node_ids
sequencelengths
4
1.4k
edge_index
sequencelengths
1
2.22k
text
sequencelengths
4
1.4k
source
stringlengths
14
427k
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 39, 28, 13, 4, 13, 13, 4, 18, 13, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 18, 13, 18, 18, 13, 13, 17, 17, 0, 18, 13, 18, 18, 13, 13, 17, 17, 14, 18, 13, 18, 18, 13, 13, 17, 0, 18, 13, 18, 18, 13, 13, 17, 17, 14, 2, 18, 13, 18, 18, 13, 13, 17, 17, 0, 18, 13, 18, 18, 13, 13, 17, 17, 4, 13, 4, 18, 13, 13, 17, 10, 2, 13, 10, 4, 13, 10, 39, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 131, 2 ], [ 131, 11 ], [ 128, 13 ], [ 17, 16 ], [ 126, 19 ], [ 129, 22 ], [ 134, 35 ], [ 132, 40 ], [ 46, 43 ], [ 135, 44 ], [ 122, 48 ], [ 132, 53 ], [ 57, 56 ], [ 126, 59 ], [ 68, 61 ], [ 123, 62 ], [ 129, 65 ], [ 56, 66 ], [ 77, 70 ], [ 123, 71 ], [ 129, 74 ], [ 56, 75 ], [ 135, 80 ], [ 129, 83 ], [ 56, 84 ], [ 94, 87 ], [ 135, 88 ], [ 129, 91 ], [ 56, 92 ], [ 123, 98 ], [ 129, 101 ], [ 56, 102 ], [ 113, 106 ], [ 135, 107 ], [ 129, 110 ], [ 56, 111 ], [ 135, 118 ], [ 122, 123 ], [ 131, 126 ], [ 128, 129 ], [ 131, 132 ], [ 134, 135 ] ]
[ "n,m=map(int,input().split())\nl=[]\nfor _ in range(m):\n l.append(list(map(int,input().split())))\na=[0]*(n+1)\na[1]=1\nc=[1]*(n+1)\nfor i in range(m):\n c[l[i][0]]-=1\n c[l[i][1]]+=1\n if a[l[i][0]]:\n a[l[i][1]]=1\n if c[l[i][0]]==0:\n a[l[i][0]]=0\nprint(a.count(1))", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "l=[]", "l", "[]", "for _ in range(m):\n l.append(list(map(int,input().split())))", "_", "range(m)", "range", "m", "l.append(list(map(int,input().split())))", "l.append", "l", "append", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a=[0]*(n+1)", "a", "[0]*(n+1)", "[0]", "0", "n+1", "n", "1", "a[1]=1", "a[1]", "a", "1", "1", "c=[1]*(n+1)", "c", "[1]*(n+1)", "[1]", "1", "n+1", "n", "1", "for i in range(m):\n c[l[i][0]]-=1\n c[l[i][1]]+=1\n if a[l[i][0]]:\n a[l[i][1]]=1\n if c[l[i][0]]==0:\n a[l[i][0]]=0", "i", "range(m)", "range", "m", "c[l[i][0]]-=1", "c[l[i][0]]", "c", "l[i][0]", "[i]", "l", "i", "0", "1", "c[l[i][1]]+=1", "c[l[i][1]]", "c", "l[i][1]", "[i]", "l", "i", "1", "1", "if a[l[i][0]]:\n a[l[i][1]]=1\n ", "a[l[i][0]]", "a", "l[i][0]", "[i]", "l", "i", "0", "a[l[i][1]]=1", "a[l[i][1]]", "a", "l[i][1]", "[i]", "l", "i", "1", "1", "if c[l[i][0]]==0:\n a[l[i][0]]=0", "c[l[i][0]]==0", "c[l[i][0]]", "c", "l[i][0]", "[i]", "l", "i", "0", "0", "a[l[i][0]]=0", "a[l[i][0]]", "a", "l[i][0]", "[i]", "l", "i", "0", "0", "print(a.count(1))", "print", "a.count(1)", "a.count", "a", "count", "1", "c=[1]*(n+1)", "[1]*(n+1)", "c", "m=map(int,input().split())", "map(int,input().split())", "m", "l=[]", "[]", "l", "n,m=map(int,input().split())", "map(int,input().split())", "n", "a=[0]*(n+1)", "[0]*(n+1)", "a" ]
n,m=map(int,input().split()) l=[] for _ in range(m): l.append(list(map(int,input().split()))) a=[0]*(n+1) a[1]=1 c=[1]*(n+1) for i in range(m): c[l[i][0]]-=1 c[l[i][1]]+=1 if a[l[i][0]]: a[l[i][1]]=1 if c[l[i][0]]==0: a[l[i][0]]=0 print(a.count(1))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 39, 28, 13, 4, 13, 13, 0, 13, 39, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 4, 18, 13, 13, 13, 41, 28, 13, 4, 13, 2, 17, 17, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 41, 28, 13, 4, 13, 2, 17, 17, 4, 17, 0, 13, 13, 28, 13, 13, 0, 13, 18, 13, 17, 13, 18, 13, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 39, 13, 10, 39, 13, 10, 18, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 13, 13, 10, 18, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 179, 2 ], [ 179, 11 ], [ 152, 13 ], [ 17, 16 ], [ 180, 19 ], [ 155, 21 ], [ 161, 24 ], [ 153, 37 ], [ 162, 39 ], [ 156, 39 ], [ 43, 42 ], [ 170, 51 ], [ 57, 54 ], [ 171, 55 ], [ 61, 60 ], [ 164, 69 ], [ 73, 72 ], [ 153, 72 ], [ 158, 75 ], [ 72, 77 ], [ 173, 79 ], [ 72, 81 ], [ 171, 87 ], [ 159, 89 ], [ 162, 89 ], [ 156, 89 ], [ 171, 94 ], [ 174, 96 ], [ 105, 100 ], [ 171, 101 ], [ 174, 103 ], [ 112, 107 ], [ 165, 108 ], [ 174, 110 ], [ 119, 114 ], [ 165, 115 ], [ 159, 117 ], [ 162, 117 ], [ 156, 117 ], [ 165, 123 ], [ 159, 125 ], [ 162, 125 ], [ 156, 125 ], [ 134, 129 ], [ 171, 130 ], [ 159, 132 ], [ 162, 132 ], [ 156, 132 ], [ 176, 136 ], [ 140, 139 ], [ 171, 139 ], [ 139, 143 ], [ 182, 146 ], [ 183, 150 ], [ 177, 150 ], [ 152, 153 ], [ 155, 156 ], [ 158, 159 ], [ 161, 162 ], [ 164, 165 ], [ 179, 168 ], [ 170, 171 ], [ 173, 174 ], [ 176, 177 ], [ 179, 180 ], [ 182, 183 ] ]
[ "n, m = map(int,input().split())\nb_list = []\n\nfor i in range(m):\n x = []\n x = list(map(int,input().split()))\n b_list.append(x)\n\nans_list = [0 for i in range(10**5)]\nans_list[0] = 1\nball_list = [1 for i in range(10**5)]\n\nfor tmp in b_list:\n x, y = tmp[0], tmp[1]\n if ans_list[x-1] == 1 and ans_list[y-1] == 0:\n ans_list[y-1] += 1\n ball_list[y-1] += 1\n ball_list[x-1] -= 1\n if ball_list[x-1] == 0:\n ans_list[x-1] = 0\n\nans = 0\n\nfor i in ans_list:\n if i == 1:\n ans += 1\n\nprint(ans)", "n, m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "b_list = []", "b_list", "[]", "for i in range(m):\n x = []\n x = list(map(int,input().split()))\n b_list.append(x)", "i", "range(m)", "range", "m", "x = []", "x", "[]", "x = list(map(int,input().split()))", "x", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b_list.append(x)", "b_list.append", "b_list", "append", "x", "0 for i in range(10**5)", "for i in range(10**5)", "i", "range(10**5)", "range", "10**5", "10", "5", "for i in range(10**5)", "0", "ans_list = [0 for i in range(10**5)]", "ans_list", "[0 for i in range(10**5)]", "ans_list[0] = 1", "ans_list[0]", "ans_list", "0", "1", "1 for i in range(10**5)", "for i in range(10**5)", "i", "range(10**5)", "range", "10**5", "10", "5", "for i in range(10**5)", "1", "ball_list = [1 for i in range(10**5)]", "ball_list", "[1 for i in range(10**5)]", "for tmp in b_list:\n x, y = tmp[0], tmp[1]\n if ans_list[x-1] == 1 and ans_list[y-1] == 0:\n ans_list[y-1] += 1\n ball_list[y-1] += 1\n ball_list[x-1] -= 1\n if ball_list[x-1] == 0:\n ans_list[x-1] = 0", "tmp", "b_list", "x, y = tmp[0], tmp[1]", "x", "tmp[0]", "tmp", "0", "y", "tmp[1]", "tmp", "1", "if ans_list[x-1] == 1 and ans_list[y-1] == 0:\n ans_list[y-1] += 1\n ", "ans_list[x-1] == 1 and ans_list[y-1] == 0", "ans_list[x-1] == 1", "ans_list[x-1]", "ans_list", "x-1", "x", "1", "1", "ans_list[y-1] == 0", "ans_list[y-1]", "ans_list", "y-1", "y", "1", "0", "ans_list[y-1] += 1", "ans_list[y-1]", "ans_list", "y-1", "y", "1", "1", "ball_list[y-1] += 1", "ball_list[y-1]", "ball_list", "y-1", "y", "1", "1", "ball_list[x-1] -= 1", "ball_list[x-1]", "ball_list", "x-1", "x", "1", "1", "if ball_list[x-1] == 0:\n ans_list[x-1] = 0", "ball_list[x-1] == 0", "ball_list[x-1]", "ball_list", "x-1", "x", "1", "0", "ans_list[x-1] = 0", "ans_list[x-1]", "ans_list", "x-1", "x", "1", "0", "ans = 0", "ans", "0", "for i in ans_list:\n if i == 1:\n ans += 1", "i", "ans_list", "if i == 1:\n ans += 1", "i == 1", "i", "1", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "b_list = []", "[]", "b_list", "x = []", "[]", "x", "x, y = tmp[0], tmp[1]", "tmp[0]", "x", "x = list(map(int,input().split()))", "list(map(int,input().split()))", "x", "ball_list = [1 for i in range(10**5)]", "[1 for i in range(10**5)]", "ball_list", "n, m = map(int,input().split())", "map(int,input().split())", "n", "ans_list = [0 for i in range(10**5)]", "[0 for i in range(10**5)]", "ans_list", "y = tmp[0], tmp[1]", "tmp[1]", "y", "ans = 0", "0", "ans", "m = map(int,input().split())", "map(int,input().split())", "m", "ans += 1", "1", "ans" ]
n, m = map(int,input().split()) b_list = [] for i in range(m): x = [] x = list(map(int,input().split())) b_list.append(x) ans_list = [0 for i in range(10**5)] ans_list[0] = 1 ball_list = [1 for i in range(10**5)] for tmp in b_list: x, y = tmp[0], tmp[1] if ans_list[x-1] == 1 and ans_list[y-1] == 0: ans_list[y-1] += 1 ball_list[y-1] += 1 ball_list[x-1] -= 1 if ball_list[x-1] == 0: ans_list[x-1] = 0 ans = 0 for i in ans_list: if i == 1: ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 39, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 4, 18, 13, 13, 39, 2, 13, 17, 2, 13, 17, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 18, 18, 13, 13, 17, 13, 18, 18, 13, 13, 17, 14, 18, 13, 13, 14, 40, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 18, 13, 13, 4, 13, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 18, 13, 10, 18, 13, 10, 13, 13, 10, 39, 13, 10, 4, 13, 10, 18, 13 ]
[ [ 166, 2 ], [ 166, 11 ], [ 163, 13 ], [ 17, 16 ], [ 149, 19 ], [ 151, 21 ], [ 151, 30 ], [ 164, 33 ], [ 152, 37 ], [ 143, 40 ], [ 45, 44 ], [ 167, 47 ], [ 139, 51 ], [ 56, 55 ], [ 167, 58 ], [ 160, 62 ], [ 68, 65 ], [ 161, 66 ], [ 71, 70 ], [ 149, 73 ], [ 154, 75 ], [ 164, 78 ], [ 70, 79 ], [ 169, 81 ], [ 164, 84 ], [ 70, 85 ], [ 161, 89 ], [ 155, 90 ], [ 152, 90 ], [ 118, 93 ], [ 140, 94 ], [ 155, 95 ], [ 152, 95 ], [ 101, 98 ], [ 161, 99 ], [ 170, 100 ], [ 143, 100 ], [ 106, 103 ], [ 161, 104 ], [ 170, 105 ], [ 143, 105 ], [ 111, 108 ], [ 161, 109 ], [ 155, 110 ], [ 152, 110 ], [ 116, 113 ], [ 140, 114 ], [ 170, 115 ], [ 143, 115 ], [ 121, 118 ], [ 140, 119 ], [ 155, 120 ], [ 152, 120 ], [ 145, 123 ], [ 127, 126 ], [ 167, 129 ], [ 157, 131 ], [ 161, 133 ], [ 126, 134 ], [ 158, 137 ], [ 146, 137 ], [ 139, 140 ], [ 151, 143 ], [ 145, 146 ], [ 166, 149 ], [ 151, 152 ], [ 154, 155 ], [ 157, 158 ], [ 160, 161 ], [ 163, 164 ], [ 166, 167 ], [ 169, 170 ] ]
[ "n,m = map(int, input().split())\nxy = []\n\nfor i in range(m):\n x,y = map(int, input().split())\n xy.append([x-1,y-1])\n\nbox = [1 for i in range(n)]\n\nchk = [False for i in range(n)]\nchk[0] = True\nfor i in range(m):\n x, y = xy[i][0],xy[i][1]\n if chk[x]:\n if box[x] >= 2:\n chk[y] = True \n else:\n chk[y] = True\n chk[x] = False\n box[y] += 1\n box[x] -= 1\ncnt = 0\nfor i in range(n):\n cnt += chk[i]\nprint (cnt)", "n,m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "xy = []", "xy", "[]", "for i in range(m):\n x,y = map(int, input().split())\n xy.append([x-1,y-1])", "i", "range(m)", "range", "m", "x,y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "xy.append([x-1,y-1])", "xy.append", "xy", "append", "[x-1,y-1]", "x-1", "x", "1", "y-1", "y", "1", "1 for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "1", "box = [1 for i in range(n)]", "box", "[1 for i in range(n)]", "False for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "False", "chk = [False for i in range(n)]", "chk", "[False for i in range(n)]", "chk[0] = True", "chk[0]", "chk", "0", "True", "for i in range(m):\n x, y = xy[i][0],xy[i][1]\n if chk[x]:\n if box[x] >= 2:\n chk[y] = True \n else:\n chk[y] = True\n chk[x] = False\n box[y] += 1\n box[x] -= 1", "i", "range(m)", "range", "m", "x, y = xy[i][0],xy[i][1]", "x", "xy[i][0]", "[i]", "xy", "i", "0", "y", "xy[i][1]", "[i]", "xy", "i", "1", "if chk[x]:\n if box[x] >= 2:\n chk[y] = True \n else:\n chk[y] = True\n chk[x] = False\n ", "chk[x]", "chk", "x", "if box[x] >= 2:\n chk[y] = True \n else:\n chk[y] = True\n chk[x] = False\n ", "box[x] >= 2", "box[x]", "box", "x", "2", "chk[y] = True", "chk[y]", "chk", "y", "True", "chk[y] = True", "chk[y]", "chk", "y", "True", "chk[x] = False", "chk[x]", "chk", "x", "False", "box[y] += 1", "box[y]", "box", "y", "1", "box[x] -= 1", "box[x]", "box", "x", "1", "cnt = 0", "cnt", "0", "for i in range(n):\n cnt += chk[i]", "i", "range(n)", "range", "n", "cnt += chk[i]", "cnt", "chk[i]", "chk", "i", "print (cnt)", "print", "cnt", "box = [1 for i in range(n)]", "[1 for i in range(n)]", "box", "y = map(int, input().split())", "map(int, input().split())", "y", "cnt = 0", "0", "cnt", "m = map(int, input().split())", "map(int, input().split())", "m", "x,y = map(int, input().split())", "map(int, input().split())", "x", "x, y = xy[i][0],xy[i][1]", "xy[i][0]", "x", "cnt += chk[i]", "chk[i]", "cnt", "chk = [False for i in range(n)]", "[False for i in range(n)]", "chk", "xy = []", "[]", "xy", "n,m = map(int, input().split())", "map(int, input().split())", "n", "y = xy[i][0],xy[i][1]", "xy[i][1]", "y" ]
n,m = map(int, input().split()) xy = [] for i in range(m): x,y = map(int, input().split()) xy.append([x-1,y-1]) box = [1 for i in range(n)] chk = [False for i in range(n)] chk[0] = True for i in range(m): x, y = xy[i][0],xy[i][1] if chk[x]: if box[x] >= 2: chk[y] = True else: chk[y] = True chk[x] = False box[y] += 1 box[x] -= 1 cnt = 0 for i in range(n): cnt += chk[i] print (cnt)
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 12, 13, 29, 4, 18, 4, 13, 13, 12, 13, 29, 4, 13, 4, 13, 12, 13, 29, 4, 13, 13, 4, 18, 4, 13, 13, 12, 13, 29, 4, 18, 4, 13, 13, 12, 13, 0, 13, 4, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 0, 13, 13, 41, 28, 13, 4, 13, 17, 2, 13, 17, 4, 13, 17, 0, 13, 13, 0, 13, 17, 28, 39, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 13, 13, 4, 18, 13, 13, 13, 14, 40, 18, 13, 13, 4, 18, 13, 13, 13, 4, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 18, 13 ]
[ [ 144, 4 ], [ 145, 16 ], [ 145, 24 ], [ 145, 34 ], [ 145, 42 ], [ 48, 47 ], [ 130, 49 ], [ 48, 50 ], [ 54, 53 ], [ 50, 56 ], [ 130, 61 ], [ 64, 63 ], [ 68, 67 ], [ 47, 72 ], [ 67, 75 ], [ 79, 78 ], [ 82, 81 ], [ 87, 84 ], [ 63, 84 ], [ 92, 89 ], [ 78, 90 ], [ 97, 94 ], [ 78, 95 ], [ 81, 101 ], [ 81, 104 ], [ 89, 109 ], [ 78, 110 ], [ 81, 114 ], [ 81, 121 ], [ 136, 127 ], [ 144, 145 ] ]
[ "import sys\ninput = sys.stdin.readline\n\n\ndef readstr():\n return input().strip()\n\n\ndef readint():\n return int(input())\n\n\ndef readnums():\n return map(int, input().split())\n\n\ndef readstrs():\n return input().split()\n\n\ndef main():\n N, M = readnums()\n xy = [tuple(readnums()) for _ in range(M)]\n dic = {i: 1 for i in range(1, N + 1)}\n r = {1}\n for (x, y) in xy:\n dic[x] -= 1\n dic[y] += 1\n if x in r:\n r.add(y)\n if not dic[x]:\n r.remove(x)\n\n print(len(r))\n\n\nif __name__ == \"__main__\":\n main()", "import sys", "sys", "input = sys.stdin.readline", "input", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "def readstr():\n return input().strip()", "readstr", "return input().strip()", "input().strip()", "().strip", "()", "input", "strip", "def readint():\n return int(input())", "readint", "return int(input())", "int(input())", "int", "input()", "input", "def readnums():\n return map(int, input().split())", "readnums", "return map(int, input().split())", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "def readstrs():\n return input().split()", "readstrs", "return input().split()", "input().split()", "().split", "()", "input", "split", "def main():\n N, M = readnums()\n xy = [tuple(readnums()) for _ in range(M)]\n dic = {i: 1 for i in range(1, N + 1)}\n r = {1}\n for (x, y) in xy:\n dic[x] -= 1\n dic[y] += 1\n if x in r:\n r.add(y)\n if not dic[x]:\n r.remove(x)\n\n print(len(r))", "main", "N, M = readnums()", "N", "readnums()", "readnums", "M", "tuple(readnums()) for _ in range(M)", "for _ in range(M)", "_", "range(M)", "range", "M", "for _ in range(M)", "tuple(readnums())", "tuple", "readnums()", "readnums", "xy = [tuple(readnums()) for _ in range(M)]", "xy", "[tuple(readnums()) for _ in range(M)]", "i: 1 for i in range(1, N + 1)", "for i in range(1, N + 1)", "i", "range(1, N + 1)", "range", "1", "N + 1", "N", "1", "for i in range(1, N + 1)", "i", "1", "dic = {i: 1 for i in range(1, N + 1)}", "dic", "{i: 1 for i in range(1, N + 1)}", "r = {1}", "r", "{1}", "for (x, y) in xy:\n dic[x] -= 1\n dic[y] += 1\n if x in r:\n r.add(y)\n if not dic[x]:\n r.remove(x)\n\n ", "(x, y)", "x", "y", "xy", "dic[x] -= 1", "dic[x]", "dic", "x", "1", "dic[y] += 1", "dic[y]", "dic", "y", "1", "if x in r:\n r.add(y)\n if not dic[x]:\n r.remove(x)\n\n ", "x in r", "x", "r", "r.add(y)", "r.add", "r", "add", "y", "if not dic[x]:\n r.remove(x)\n\n ", "not dic[x]", "dic[x]", "dic", "x", "r.remove(x)", "r.remove", "r", "remove", "x", "print(len(r))", "print", "len(r)", "len", "r", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def readnums():\n return map(int, input().split())", "def readnums():\n return map(int, input().split())", "readnums", "def readint():\n return int(input())", "def readint():\n return int(input())", "readint", "def main():\n N, M = readnums()\n xy = [tuple(readnums()) for _ in range(M)]\n dic = {i: 1 for i in range(1, N + 1)}\n r = {1}\n for (x, y) in xy:\n dic[x] -= 1\n dic[y] += 1\n if x in r:\n r.add(y)\n if not dic[x]:\n r.remove(x)\n\n print(len(r))", "def main():\n N, M = readnums()\n xy = [tuple(readnums()) for _ in range(M)]\n dic = {i: 1 for i in range(1, N + 1)}\n r = {1}\n for (x, y) in xy:\n dic[x] -= 1\n dic[y] += 1\n if x in r:\n r.add(y)\n if not dic[x]:\n r.remove(x)\n\n print(len(r))", "main", "def readstrs():\n return input().split()", "def readstrs():\n return input().split()", "readstrs", "def readstr():\n return input().strip()", "def readstr():\n return input().strip()", "readstr", "input = sys.stdin.readline", "sys.stdin.readline", "input" ]
import sys input = sys.stdin.readline def readstr(): return input().strip() def readint(): return int(input()) def readnums(): return map(int, input().split()) def readstrs(): return input().split() def main(): N, M = readnums() xy = [tuple(readnums()) for _ in range(M)] dic = {i: 1 for i in range(1, N + 1)} r = {1} for (x, y) in xy: dic[x] -= 1 dic[y] += 1 if x in r: r.add(y) if not dic[x]: r.remove(x) print(len(r)) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 13, 13, 0, 13, 2, 13, 17, 13, 2, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 116, 2 ], [ 116, 11 ], [ 15, 14 ], [ 99, 17 ], [ 107, 30 ], [ 104, 33 ], [ 117, 37 ], [ 42, 39 ], [ 105, 40 ], [ 113, 44 ], [ 117, 48 ], [ 101, 54 ], [ 102, 56 ], [ 110, 58 ], [ 111, 60 ], [ 105, 64 ], [ 102, 65 ], [ 70, 67 ], [ 105, 68 ], [ 111, 69 ], [ 83, 73 ], [ 114, 74 ], [ 102, 75 ], [ 81, 78 ], [ 105, 79 ], [ 102, 80 ], [ 86, 83 ], [ 114, 84 ], [ 102, 85 ], [ 91, 88 ], [ 114, 89 ], [ 111, 90 ], [ 105, 96 ], [ 116, 99 ], [ 101, 102 ], [ 104, 105 ], [ 107, 108 ], [ 110, 111 ], [ 113, 114 ], [ 116, 117 ] ]
[ "N,M = map(int,input().split())\nXY = [tuple(map(int,input().split())) for i in range(M)]\n\nmay_red = [0] * N\nmay_red[0] = 1\nballs = [1] * N\n\nfor x,y in XY:\n x,y = x-1,y-1\n if may_red[x]:\n may_red[y] = 1\n if balls[x] == 1:\n may_red[x] = 0\n balls[x] -= 1\n balls[y] += 1\nprint(sum(may_red))", "N,M = map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "tuple(map(int,input().split())) for i in range(M)", "for i in range(M)", "i", "range(M)", "range", "M", "for i in range(M)", "tuple(map(int,input().split()))", "tuple", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "XY = [tuple(map(int,input().split())) for i in range(M)]", "XY", "[tuple(map(int,input().split())) for i in range(M)]", "may_red = [0] * N", "may_red", "[0] * N", "[0]", "0", "N", "may_red[0] = 1", "may_red[0]", "may_red", "0", "1", "balls = [1] * N", "balls", "[1] * N", "[1]", "1", "N", "for x,y in XY:\n x,y = x-1,y-1\n if may_red[x]:\n may_red[y] = 1\n if balls[x] == 1:\n may_red[x] = 0\n balls[x] -= 1\n balls[y] += 1", "x", "y", "XY", "x,y = x-1,y-1", "x", "x-1", "x", "1", "y", "y-1", "y", "1", "if may_red[x]:\n may_red[y] = 1\n if balls[x] == 1:\n may_red[x] = 0\n ", "may_red[x]", "may_red", "x", "may_red[y] = 1", "may_red[y]", "may_red", "y", "1", "if balls[x] == 1:\n may_red[x] = 0\n ", "balls[x] == 1", "balls[x]", "balls", "x", "1", "may_red[x] = 0", "may_red[x]", "may_red", "x", "0", "balls[x] -= 1", "balls[x]", "balls", "x", "1", "balls[y] += 1", "balls[y]", "balls", "y", "1", "print(sum(may_red))", "print", "sum(may_red)", "sum", "may_red", "M = map(int,input().split())", "map(int,input().split())", "M", "x,y = x-1,y-1", "x-1", "x", "may_red = [0] * N", "[0] * N", "may_red", "XY = [tuple(map(int,input().split())) for i in range(M)]", "[tuple(map(int,input().split())) for i in range(M)]", "XY", "y = x-1,y-1", "y-1", "y", "balls = [1] * N", "[1] * N", "balls", "N,M = map(int,input().split())", "map(int,input().split())", "N" ]
N,M = map(int,input().split()) XY = [tuple(map(int,input().split())) for i in range(M)] may_red = [0] * N may_red[0] = 1 balls = [1] * N for x,y in XY: x,y = x-1,y-1 if may_red[x]: may_red[y] = 1 if balls[x] == 1: may_red[x] = 0 balls[x] -= 1 balls[y] += 1 print(sum(may_red))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 2, 18, 13, 2, 13, 17, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 2, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 197, 2 ], [ 197, 11 ], [ 194, 13 ], [ 189, 17 ], [ 22, 19 ], [ 195, 20 ], [ 185, 24 ], [ 189, 28 ], [ 31, 30 ], [ 198, 33 ], [ 191, 35 ], [ 191, 44 ], [ 195, 49 ], [ 192, 51 ], [ 186, 56 ], [ 192, 58 ], [ 67, 62 ], [ 195, 63 ], [ 183, 65 ], [ 74, 69 ], [ 186, 70 ], [ 192, 72 ], [ 186, 76 ], [ 192, 78 ], [ 87, 82 ], [ 186, 83 ], [ 183, 85 ], [ 186, 89 ], [ 183, 91 ], [ 195, 98 ], [ 192, 100 ], [ 186, 105 ], [ 192, 107 ], [ 116, 111 ], [ 195, 112 ], [ 192, 114 ], [ 123, 118 ], [ 195, 119 ], [ 183, 121 ], [ 130, 125 ], [ 186, 126 ], [ 192, 128 ], [ 186, 132 ], [ 192, 134 ], [ 143, 138 ], [ 186, 139 ], [ 183, 141 ], [ 186, 145 ], [ 183, 147 ], [ 156, 151 ], [ 186, 152 ], [ 192, 154 ], [ 186, 158 ], [ 192, 160 ], [ 169, 164 ], [ 186, 165 ], [ 183, 167 ], [ 186, 171 ], [ 183, 173 ], [ 195, 180 ], [ 191, 183 ], [ 185, 186 ], [ 197, 189 ], [ 191, 192 ], [ 194, 195 ], [ 197, 198 ] ]
[ "n,m=map(int,input().split())\nans=[0]*n\nans[0]=1\nb=[1]*n\nfor i in range(m):\n x,y=map(int,input().split())\n if ans[x-1]==1 and b[x-1]>1:\n ans[y-1]=1\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1\n elif ans[x-1]==1 and b[x-1]==1:\n ans[x-1]=0\n ans[y-1]=1\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1\n else:\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1\nprint(sum(ans))", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "ans=[0]*n", "ans", "[0]*n", "[0]", "0", "n", "ans[0]=1", "ans[0]", "ans", "0", "1", "b=[1]*n", "b", "[1]*n", "[1]", "1", "n", "for i in range(m):\n x,y=map(int,input().split())\n if ans[x-1]==1 and b[x-1]>1:\n ans[y-1]=1\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1\n elif ans[x-1]==1 and b[x-1]==1:\n ans[x-1]=0\n ans[y-1]=1\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1\n else:\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1", "i", "range(m)", "range", "m", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if ans[x-1]==1 and b[x-1]>1:\n ans[y-1]=1\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1\n elif ans[x-1]==1 and b[x-1]==1:\n ans[x-1]=0\n ans[y-1]=1\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1\n else:\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1", "ans[x-1]==1 and b[x-1]>1", "ans[x-1]==1", "ans[x-1]", "ans", "x-1", "x", "1", "1", "b[x-1]>1", "b[x-1]", "b", "x-1", "x", "1", "1", "ans[y-1]=1", "ans[y-1]", "ans", "y-1", "y", "1", "1", "b[x-1]=b[x-1]-1", "b[x-1]", "b", "x-1", "x", "1", "b[x-1]-1", "b[x-1]", "b", "x-1", "x", "1", "1", "b[y-1]=b[y-1]+1", "b[y-1]", "b", "y-1", "y", "1", "b[y-1]+1", "b[y-1]", "b", "y-1", "y", "1", "1", "elif ans[x-1]==1 and b[x-1]==1:\n ans[x-1]=0\n ans[y-1]=1\n b[x-1]=b[x-1]-1\n b[y-1]=b[y-1]+1\n ", "ans[x-1]==1 and b[x-1]==1", "ans[x-1]==1", "ans[x-1]", "ans", "x-1", "x", "1", "1", "b[x-1]==1", "b[x-1]", "b", "x-1", "x", "1", "1", "ans[x-1]=0", "ans[x-1]", "ans", "x-1", "x", "1", "0", "ans[y-1]=1", "ans[y-1]", "ans", "y-1", "y", "1", "1", "b[x-1]=b[x-1]-1", "b[x-1]", "b", "x-1", "x", "1", "b[x-1]-1", "b[x-1]", "b", "x-1", "x", "1", "1", "b[y-1]=b[y-1]+1", "b[y-1]", "b", "y-1", "y", "1", "b[y-1]+1", "b[y-1]", "b", "y-1", "y", "1", "1", "b[x-1]=b[x-1]-1", "b[x-1]", "b", "x-1", "x", "1", "b[x-1]-1", "b[x-1]", "b", "x-1", "x", "1", "1", "b[y-1]=b[y-1]+1", "b[y-1]", "b", "y-1", "y", "1", "b[y-1]+1", "b[y-1]", "b", "y-1", "y", "1", "1", "print(sum(ans))", "print", "sum(ans)", "sum", "ans", "y=map(int,input().split())", "map(int,input().split())", "y", "b=[1]*n", "[1]*n", "b", "n,m=map(int,input().split())", "map(int,input().split())", "n", "x,y=map(int,input().split())", "map(int,input().split())", "x", "ans=[0]*n", "[0]*n", "ans", "m=map(int,input().split())", "map(int,input().split())", "m" ]
n,m=map(int,input().split()) ans=[0]*n ans[0]=1 b=[1]*n for i in range(m): x,y=map(int,input().split()) if ans[x-1]==1 and b[x-1]>1: ans[y-1]=1 b[x-1]=b[x-1]-1 b[y-1]=b[y-1]+1 elif ans[x-1]==1 and b[x-1]==1: ans[x-1]=0 ans[y-1]=1 b[x-1]=b[x-1]-1 b[y-1]=b[y-1]+1 else: b[x-1]=b[x-1]-1 b[y-1]=b[y-1]+1 print(sum(ans))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 39, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 39, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13 ]
[ [ 121, 2 ], [ 121, 11 ], [ 118, 13 ], [ 122, 17 ], [ 130, 19 ], [ 122, 23 ], [ 28, 25 ], [ 131, 26 ], [ 109, 30 ], [ 127, 33 ], [ 37, 36 ], [ 116, 39 ], [ 124, 41 ], [ 124, 50 ], [ 57, 52 ], [ 119, 53 ], [ 125, 55 ], [ 64, 59 ], [ 119, 60 ], [ 113, 62 ], [ 131, 69 ], [ 125, 71 ], [ 131, 76 ], [ 113, 78 ], [ 87, 82 ], [ 131, 83 ], [ 113, 85 ], [ 119, 91 ], [ 125, 93 ], [ 102, 97 ], [ 131, 98 ], [ 125, 100 ], [ 131, 107 ], [ 109, 110 ], [ 124, 113 ], [ 121, 116 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ], [ 127, 128 ], [ 130, 131 ] ]
[ "N,M=map(int,input().split())\nnum=[1]*N\nex=[0]*N\nex[0]=1\nP=[]\nans=1\nfor i in range(M):\n x,y=map(int,input().split())\n num[x-1]-=1\n num[y-1]+=1\n if ex[x-1]==1 and ex[y-1]==0:\n ex[y-1]=1\n if num[x-1]==0:\n ex[x-1]=0\nprint(sum(ex))", "N,M=map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "num=[1]*N", "num", "[1]*N", "[1]", "1", "N", "ex=[0]*N", "ex", "[0]*N", "[0]", "0", "N", "ex[0]=1", "ex[0]", "ex", "0", "1", "P=[]", "P", "[]", "ans=1", "ans", "1", "for i in range(M):\n x,y=map(int,input().split())\n num[x-1]-=1\n num[y-1]+=1\n if ex[x-1]==1 and ex[y-1]==0:\n ex[y-1]=1\n if num[x-1]==0:\n ex[x-1]=0", "i", "range(M)", "range", "M", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "num[x-1]-=1", "num[x-1]", "num", "x-1", "x", "1", "1", "num[y-1]+=1", "num[y-1]", "num", "y-1", "y", "1", "1", "if ex[x-1]==1 and ex[y-1]==0:\n ex[y-1]=1\n ", "ex[x-1]==1 and ex[y-1]==0", "ex[x-1]==1", "ex[x-1]", "ex", "x-1", "x", "1", "1", "ex[y-1]==0", "ex[y-1]", "ex", "y-1", "y", "1", "0", "ex[y-1]=1", "ex[y-1]", "ex", "y-1", "y", "1", "1", "if num[x-1]==0:\n ex[x-1]=0", "num[x-1]==0", "num[x-1]", "num", "x-1", "x", "1", "0", "ex[x-1]=0", "ex[x-1]", "ex", "x-1", "x", "1", "0", "print(sum(ex))", "print", "sum(ex)", "sum", "ex", "P=[]", "[]", "P", "y=map(int,input().split())", "map(int,input().split())", "y", "M=map(int,input().split())", "map(int,input().split())", "M", "num=[1]*N", "[1]*N", "num", "N,M=map(int,input().split())", "map(int,input().split())", "N", "x,y=map(int,input().split())", "map(int,input().split())", "x", "ans=1", "1", "ans", "ex=[0]*N", "[0]*N", "ex" ]
N,M=map(int,input().split()) num=[1]*N ex=[0]*N ex[0]=1 P=[] ans=1 for i in range(M): x,y=map(int,input().split()) num[x-1]-=1 num[y-1]+=1 if ex[x-1]==1 and ex[y-1]==0: ex[y-1]=1 if num[x-1]==0: ex[x-1]=0 print(sum(ex))
[ 7, 15, 15, 15, 13, 13, 13, 13, 13, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 4, 13, 17, 12, 13, 12, 13, 0, 13, 4, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 2, 13, 17, 13, 2, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 12, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 12, 13, 10, 4, 13 ]
[ [ 128, 18 ], [ 131, 25 ], [ 137, 34 ], [ 123, 36 ], [ 137, 37 ], [ 116, 39 ], [ 138, 43 ], [ 48, 45 ], [ 117, 46 ], [ 119, 50 ], [ 138, 54 ], [ 57, 56 ], [ 114, 59 ], [ 143, 61 ], [ 123, 63 ], [ 143, 64 ], [ 110, 66 ], [ 144, 68 ], [ 111, 68 ], [ 125, 70 ], [ 135, 72 ], [ 126, 72 ], [ 78, 75 ], [ 120, 76 ], [ 111, 77 ], [ 144, 77 ], [ 83, 80 ], [ 120, 81 ], [ 126, 82 ], [ 135, 82 ], [ 117, 86 ], [ 111, 87 ], [ 144, 87 ], [ 92, 89 ], [ 117, 90 ], [ 126, 91 ], [ 135, 91 ], [ 75, 95 ], [ 120, 96 ], [ 111, 97 ], [ 144, 97 ], [ 103, 100 ], [ 117, 101 ], [ 111, 102 ], [ 144, 102 ], [ 117, 108 ], [ 110, 111 ], [ 137, 114 ], [ 116, 117 ], [ 119, 120 ], [ 125, 126 ], [ 128, 129 ], [ 131, 132 ], [ 143, 135 ], [ 137, 138 ], [ 143, 144 ] ]
[ "from collections import Counter,defaultdict,deque\nfrom heapq import heappop,heappush,heapify\nimport sys,bisect,math,itertools,fractions,pprint\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\nINF = float('inf')\ndef inp(): return int(sys.stdin.readline())\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\nn,m = inpl()\nres = [False] * n\nres[0] = True\ncnt = [1] * n\nfor i in range(m):\n a,b = inpl()\n a,b = a-1,b-1\n cnt[a] -= 1; cnt[b] += 1\n if res[a]:\n res[b] = True\n if cnt[a] == 0:\n res[a] = False\nprint(sum(res))", "from collections import Counter,defaultdict,deque", "from heapq import heappop,heappush,heapify", "import sys,bisect,math,itertools,fractions,pprint", "sys", "bisect", "math", "itertools", "fractions", "pprint", "sys.setrecursionlimit(10**8)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**8", "10", "8", "mod = 10**9+7", "mod", "10**9+7", "10**9", "10", "9", "7", "INF = float('inf')", "INF", "float('inf')", "float", "'inf'", "def inp(): return int(sys.stdin.readline())", "inp", "def inpl(): return list(map(int, sys.stdin.readline().split()))", "inpl", "n,m = inpl()", "n", "inpl()", "inpl", "m", "res = [False] * n", "res", "[False] * n", "[False]", "False", "n", "res[0] = True", "res[0]", "res", "0", "True", "cnt = [1] * n", "cnt", "[1] * n", "[1]", "1", "n", "for i in range(m):\n a,b = inpl()\n a,b = a-1,b-1\n cnt[a] -= 1; cnt[b] += 1\n if res[a]:\n res[b] = True\n if cnt[a] == 0:\n res[a] = False", "i", "range(m)", "range", "m", "a,b = inpl()", "a", "inpl()", "inpl", "b", "a,b = a-1,b-1", "a", "a-1", "a", "1", "b", "b-1", "b", "1", "cnt[a] -= 1", "cnt[a]", "cnt", "a", "1", "cnt[b] += 1", "cnt[b]", "cnt", "b", "1", "if res[a]:\n res[b] = True\n ", "res[a]", "res", "a", "res[b] = True", "res[b]", "res", "b", "True", "if cnt[a] == 0:\n res[a] = False", "cnt[a] == 0", "cnt[a]", "cnt", "a", "0", "res[a] = False", "res[a]", "res", "a", "False", "print(sum(res))", "print", "sum(res)", "sum", "res", "a,b = a-1,b-1", "a-1", "a", "m = inpl()", "inpl()", "m", "res = [False] * n", "[False] * n", "res", "cnt = [1] * n", "[1] * n", "cnt", "def inpl(): return list(map(int, sys.stdin.readline().split()))", "def inpl(): return list(map(int, sys.stdin.readline().split()))", "inpl", "b = a-1,b-1", "b-1", "b", "mod = 10**9+7", "10**9+7", "mod", "INF = float('inf')", "float('inf')", "INF", "b = inpl()", "inpl()", "b", "n,m = inpl()", "inpl()", "n", "def inp(): return int(sys.stdin.readline())", "def inp(): return int(sys.stdin.readline())", "inp", "a,b = inpl()", "inpl()", "a" ]
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) n,m = inpl() res = [False] * n res[0] = True cnt = [1] * n for i in range(m): a,b = inpl() a,b = a-1,b-1 cnt[a] -= 1; cnt[b] += 1 if res[a]: res[b] = True if cnt[a] == 0: res[a] = False print(sum(res))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 13, 17, 13, 2, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 13, 14, 13, 0, 13, 17, 4, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 126, 2 ], [ 126, 11 ], [ 102, 13 ], [ 112, 21 ], [ 99, 24 ], [ 112, 28 ], [ 31, 30 ], [ 127, 33 ], [ 123, 35 ], [ 123, 44 ], [ 114, 46 ], [ 106, 48 ], [ 115, 48 ], [ 117, 50 ], [ 124, 52 ], [ 118, 52 ], [ 58, 55 ], [ 100, 56 ], [ 115, 57 ], [ 106, 57 ], [ 63, 60 ], [ 100, 61 ], [ 118, 62 ], [ 124, 62 ], [ 103, 66 ], [ 115, 67 ], [ 106, 67 ], [ 72, 69 ], [ 103, 70 ], [ 118, 71 ], [ 124, 71 ], [ 55, 75 ], [ 100, 76 ], [ 115, 77 ], [ 106, 77 ], [ 83, 80 ], [ 103, 81 ], [ 115, 82 ], [ 106, 82 ], [ 120, 85 ], [ 89, 88 ], [ 103, 88 ], [ 108, 93 ], [ 109, 97 ], [ 121, 97 ], [ 99, 100 ], [ 102, 103 ], [ 123, 106 ], [ 108, 109 ], [ 126, 112 ], [ 114, 115 ], [ 117, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ] ]
[ "n, m = map(int, input().split())\njud = [True] + [False]*(n - 1)\nl = [1]*n\n\nfor i in range(m):\n x, y = map(int, input().split())\n x, y = x - 1, y - 1\n l[x] -= 1\n l[y] += 1\n if jud[x]:\n jud[y] = True\n if l[x] == 0:\n jud[x] = False\n\nans = 0\nfor i in jud:\n if i:\n ans += 1\nprint(ans)", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "jud = [True] + [False]*(n - 1)", "jud", "[True] + [False]*(n - 1)", "[True]", "True", "[False]*(n - 1)", "[False]", "False", "n - 1", "n", "1", "l = [1]*n", "l", "[1]*n", "[1]", "1", "n", "for i in range(m):\n x, y = map(int, input().split())\n x, y = x - 1, y - 1\n l[x] -= 1\n l[y] += 1\n if jud[x]:\n jud[y] = True\n if l[x] == 0:\n jud[x] = False", "i", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x, y = x - 1, y - 1", "x", "x - 1", "x", "1", "y", "y - 1", "y", "1", "l[x] -= 1", "l[x]", "l", "x", "1", "l[y] += 1", "l[y]", "l", "y", "1", "if jud[x]:\n jud[y] = True\n ", "jud[x]", "jud", "x", "jud[y] = True", "jud[y]", "jud", "y", "True", "if l[x] == 0:\n jud[x] = False", "l[x] == 0", "l[x]", "l", "x", "0", "jud[x] = False", "jud[x]", "jud", "x", "False", "ans = 0", "ans", "0", "for i in jud:\n if i:\n ans += 1", "i", "jud", "if i:\n ans += 1", "i", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "l = [1]*n", "[1]*n", "l", "jud = [True] + [False]*(n - 1)", "[True] + [False]*(n - 1)", "jud", "x, y = map(int, input().split())", "map(int, input().split())", "x", "ans += 1", "1", "ans", "n, m = map(int, input().split())", "map(int, input().split())", "n", "x, y = x - 1, y - 1", "x - 1", "x", "y = x - 1, y - 1", "y - 1", "y", "ans = 0", "0", "ans", "y = map(int, input().split())", "map(int, input().split())", "y", "m = map(int, input().split())", "map(int, input().split())", "m" ]
n, m = map(int, input().split()) jud = [True] + [False]*(n - 1) l = [1]*n for i in range(m): x, y = map(int, input().split()) x, y = x - 1, y - 1 l[x] -= 1 l[y] += 1 if jud[x]: jud[y] = True if l[x] == 0: jud[x] = False ans = 0 for i in jud: if i: ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 39, 17, 17, 0, 13, 13, 0, 18, 13, 17, 39, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 18, 18, 13, 13, 17, 0, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 14, 2, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 4, 13, 4, 13, 18, 13, 17, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 112, 2 ], [ 112, 11 ], [ 15, 14 ], [ 110, 18 ], [ 100, 25 ], [ 31, 28 ], [ 101, 29 ], [ 36, 35 ], [ 113, 38 ], [ 106, 40 ], [ 106, 49 ], [ 101, 53 ], [ 104, 54 ], [ 62, 57 ], [ 101, 59 ], [ 107, 60 ], [ 69, 64 ], [ 101, 66 ], [ 104, 67 ], [ 101, 74 ], [ 104, 75 ], [ 84, 79 ], [ 101, 81 ], [ 104, 82 ], [ 91, 86 ], [ 101, 88 ], [ 107, 89 ], [ 104, 97 ], [ 100, 101 ], [ 106, 104 ], [ 106, 107 ], [ 112, 110 ], [ 112, 113 ] ]
[ "n, m = map(int, input().split())\n\na = [[1, False] for _ in range(n+1)]\na[1] = [1, True]\n\nfor _ in range(m):\n x, y = map(int, input().split())\n if a[x][1]:\n a[y][1] = True\n \n a[x][0] -= 1\n if a[x][0] == 0:\n a[x][1] = False\n a[y][0] += 1\n\nprint(sum(x[1] for x in a))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "[1, False] for _ in range(n+1)", "for _ in range(n+1)", "_", "range(n+1)", "range", "n+1", "n", "1", "for _ in range(n+1)", "[1, False]", "1", "False", "a = [[1, False] for _ in range(n+1)]", "a", "[[1, False] for _ in range(n+1)]", "a[1] = [1, True]", "a[1]", "a", "1", "[1, True]", "1", "True", "for _ in range(m):\n x, y = map(int, input().split())\n if a[x][1]:\n a[y][1] = True\n \n a[x][0] -= 1\n if a[x][0] == 0:\n a[x][1] = False\n a[y][0] += 1", "_", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if a[x][1]:\n a[y][1] = True\n \n ", "a[x][1]", "[x]", "a", "x", "1", "a[y][1] = True", "a[y][1]", "[y]", "a", "y", "1", "True", "a[x][0] -= 1", "a[x][0]", "[x]", "a", "x", "0", "1", "if a[x][0] == 0:\n a[x][1] = False\n ", "a[x][0] == 0", "a[x][0]", "[x]", "a", "x", "0", "0", "a[x][1] = False", "a[x][1]", "[x]", "a", "x", "1", "False", "a[y][0] += 1", "a[y][0]", "[y]", "a", "y", "0", "1", "print(sum(x[1] for x in a))", "print", "sum(x[1] for x in a)", "sum", "x[1]", "x", "1", "a = [[1, False] for _ in range(n+1)]", "[[1, False] for _ in range(n+1)]", "a", "x, y = map(int, input().split())", "map(int, input().split())", "x", "y = map(int, input().split())", "map(int, input().split())", "y", "n, m = map(int, input().split())", "map(int, input().split())", "n", "m = map(int, input().split())", "map(int, input().split())", "m" ]
n, m = map(int, input().split()) a = [[1, False] for _ in range(n+1)] a[1] = [1, True] for _ in range(m): x, y = map(int, input().split()) if a[x][1]: a[y][1] = True a[x][0] -= 1 if a[x][0] == 0: a[x][1] = False a[y][0] += 1 print(sum(x[1] for x in a))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 14, 40, 18, 13, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 132, 2 ], [ 132, 11 ], [ 126, 13 ], [ 133, 17 ], [ 120, 19 ], [ 133, 23 ], [ 28, 25 ], [ 127, 26 ], [ 135, 30 ], [ 34, 33 ], [ 115, 36 ], [ 123, 38 ], [ 123, 47 ], [ 129, 49 ], [ 117, 52 ], [ 58, 55 ], [ 121, 56 ], [ 130, 57 ], [ 124, 57 ], [ 63, 60 ], [ 121, 61 ], [ 118, 62 ], [ 112, 62 ], [ 77, 66 ], [ 127, 67 ], [ 130, 68 ], [ 124, 68 ], [ 55, 72 ], [ 121, 73 ], [ 130, 74 ], [ 124, 74 ], [ 80, 77 ], [ 127, 78 ], [ 130, 79 ], [ 124, 79 ], [ 100, 83 ], [ 127, 84 ], [ 118, 85 ], [ 112, 85 ], [ 108, 88 ], [ 100, 92 ], [ 127, 93 ], [ 118, 94 ], [ 112, 94 ], [ 138, 97 ], [ 103, 100 ], [ 127, 101 ], [ 118, 102 ], [ 112, 102 ], [ 139, 106 ], [ 109, 106 ], [ 136, 106 ], [ 108, 109 ], [ 123, 112 ], [ 132, 115 ], [ 117, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ], [ 129, 130 ], [ 132, 133 ], [ 135, 136 ], [ 138, 139 ] ]
[ "N, M = map(int, input().split())\ns = [0]*N\nt = [1]*N\ns[0] = 1\nres = 1\nfor _ in range(M):\n x, y = map(int, input().split())\n x-=1\n y-=1\n t[x] -= 1\n t[y] += 1\n if s[x] == 1:\n if t[x]==0:\n s[x] = 0\n if s[y]==1:\n res -= 1\n else:\n if s[y]!=1:\n res += 1\n s[y] = 1\nprint(res)", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "s = [0]*N", "s", "[0]*N", "[0]", "0", "N", "t = [1]*N", "t", "[1]*N", "[1]", "1", "N", "s[0] = 1", "s[0]", "s", "0", "1", "res = 1", "res", "1", "for _ in range(M):\n x, y = map(int, input().split())\n x-=1\n y-=1\n t[x] -= 1\n t[y] += 1\n if s[x] == 1:\n if t[x]==0:\n s[x] = 0\n if s[y]==1:\n res -= 1\n else:\n if s[y]!=1:\n res += 1\n s[y] = 1", "_", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x-=1", "x", "1", "y-=1", "y", "1", "t[x] -= 1", "t[x]", "t", "x", "1", "t[y] += 1", "t[y]", "t", "y", "1", "if s[x] == 1:\n if t[x]==0:\n s[x] = 0\n if s[y]==1:\n res -= 1\n else:\n if s[y]!=1:\n res += 1\n s[y] = 1", "s[x] == 1", "s[x]", "s", "x", "1", "if t[x]==0:\n s[x] = 0\n if s[y]==1:\n res -= 1\n else:\n if s[y]!=1:\n res += 1\n ", "t[x]==0", "t[x]", "t", "x", "0", "s[x] = 0", "s[x]", "s", "x", "0", "if s[y]==1:\n res -= 1\n ", "s[y]==1", "s[y]", "s", "y", "1", "res -= 1", "res", "1", "if s[y]!=1:\n res += 1\n ", "s[y]!=1", "s[y]", "s", "y", "1", "res += 1", "res", "1", "s[y] = 1", "s[y]", "s", "y", "1", "print(res)", "print", "res", "res -= 1", "1", "res", "y = map(int, input().split())", "map(int, input().split())", "y", "M = map(int, input().split())", "map(int, input().split())", "M", "y-=1", "1", "y", "t = [1]*N", "[1]*N", "t", "x, y = map(int, input().split())", "map(int, input().split())", "x", "s = [0]*N", "[0]*N", "s", "x-=1", "1", "x", "N, M = map(int, input().split())", "map(int, input().split())", "N", "res = 1", "1", "res", "res += 1", "1", "res" ]
N, M = map(int, input().split()) s = [0]*N t = [1]*N s[0] = 1 res = 1 for _ in range(M): x, y = map(int, input().split()) x-=1 y-=1 t[x] -= 1 t[y] += 1 if s[x] == 1: if t[x]==0: s[x] = 0 if s[y]==1: res -= 1 else: if s[y]!=1: res += 1 s[y] = 1 print(res)
[ 7, 15, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 2, 13, 4, 18, 18, 13, 39, 17, 13, 17, 10, 4, 13, 10, 2, 13, 10, 18, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 119, 4 ], [ 122, 20 ], [ 120, 27 ], [ 122, 29 ], [ 128, 31 ], [ 114, 36 ], [ 116, 39 ], [ 114, 44 ], [ 50, 47 ], [ 129, 48 ], [ 55, 52 ], [ 117, 53 ], [ 58, 57 ], [ 123, 60 ], [ 131, 62 ], [ 120, 69 ], [ 131, 71 ], [ 129, 74 ], [ 132, 75 ], [ 80, 77 ], [ 129, 78 ], [ 126, 79 ], [ 85, 82 ], [ 117, 83 ], [ 126, 84 ], [ 117, 88 ], [ 132, 89 ], [ 94, 91 ], [ 117, 92 ], [ 132, 93 ], [ 99, 96 ], [ 129, 97 ], [ 132, 98 ], [ 114, 103 ], [ 129, 107 ], [ 122, 114 ], [ 116, 117 ], [ 119, 120 ], [ 122, 123 ], [ 131, 126 ], [ 128, 129 ], [ 131, 132 ] ]
[ "import sys\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 7)\n\nN, M = map(int, input().split())\nred = [0] * (N + 1)\nwhite = [1] * (N + 1)\nred[1] = 1\nwhite[1] = 0\n\nfor _ in range(M):\n x, y = map(int, input().split())\n if red[x]:\n red[y] += 1\n else:\n white[y] += 1\n if white[x]:\n white[x] -= 1\n else:\n red[x] -= 1\n\nprint(N-red[1:].count(0))", "import sys", "sys", "input = sys.stdin.buffer.readline", "input", "sys.stdin.buffer.readline", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readline", "sys.setrecursionlimit(10 ** 7)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 7", "10", "7", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "red = [0] * (N + 1)", "red", "[0] * (N + 1)", "[0]", "0", "N + 1", "N", "1", "white = [1] * (N + 1)", "white", "[1] * (N + 1)", "[1]", "1", "N + 1", "N", "1", "red[1] = 1", "red[1]", "red", "1", "1", "white[1] = 0", "white[1]", "white", "1", "0", "for _ in range(M):\n x, y = map(int, input().split())\n if red[x]:\n red[y] += 1\n else:\n white[y] += 1\n if white[x]:\n white[x] -= 1\n else:\n red[x] -= 1", "_", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if red[x]:\n red[y] += 1\n else:\n white[y] += 1\n ", "red[x]", "red", "x", "red[y] += 1", "red[y]", "red", "y", "1", "white[y] += 1", "white[y]", "white", "y", "1", "if white[x]:\n white[x] -= 1\n else:\n red[x] -= 1", "white[x]", "white", "x", "white[x] -= 1", "white[x]", "white", "x", "1", "red[x] -= 1", "red[x]", "red", "x", "1", "print(N-red[1:].count(0))", "print", "N-red[1:].count(0)", "N", "red[1:].count(0)", "[1:].count", "[1:]", "red", "1:", "1", "count", "0", "N, M = map(int, input().split())", "map(int, input().split())", "N", "white = [1] * (N + 1)", "[1] * (N + 1)", "white", "input = sys.stdin.buffer.readline", "sys.stdin.buffer.readline", "input", "M = map(int, input().split())", "map(int, input().split())", "M", "y = map(int, input().split())", "map(int, input().split())", "y", "red = [0] * (N + 1)", "[0] * (N + 1)", "red", "x, y = map(int, input().split())", "map(int, input().split())", "x" ]
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N, M = map(int, input().split()) red = [0] * (N + 1) white = [1] * (N + 1) red[1] = 1 white[1] = 0 for _ in range(M): x, y = map(int, input().split()) if red[x]: red[y] += 1 else: white[y] += 1 if white[x]: white[x] -= 1 else: red[x] -= 1 print(N-red[1:].count(0))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 18, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 18, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 18, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 134, 2 ], [ 134, 11 ], [ 113, 13 ], [ 137, 25 ], [ 129, 29 ], [ 116, 31 ], [ 129, 35 ], [ 40, 37 ], [ 117, 38 ], [ 43, 42 ], [ 135, 45 ], [ 125, 47 ], [ 114, 49 ], [ 42, 50 ], [ 125, 51 ], [ 122, 53 ], [ 110, 56 ], [ 117, 60 ], [ 123, 61 ], [ 108, 61 ], [ 66, 63 ], [ 117, 64 ], [ 111, 65 ], [ 126, 65 ], [ 71, 68 ], [ 138, 69 ], [ 123, 70 ], [ 108, 70 ], [ 76, 73 ], [ 138, 74 ], [ 111, 75 ], [ 126, 75 ], [ 68, 79 ], [ 138, 80 ], [ 123, 81 ], [ 108, 81 ], [ 87, 84 ], [ 117, 85 ], [ 123, 86 ], [ 108, 86 ], [ 131, 89 ], [ 93, 92 ], [ 129, 95 ], [ 117, 98 ], [ 92, 99 ], [ 119, 101 ], [ 120, 105 ], [ 132, 105 ], [ 125, 108 ], [ 110, 111 ], [ 113, 114 ], [ 116, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ], [ 134, 129 ], [ 131, 132 ], [ 134, 135 ], [ 137, 138 ] ]
[ "n, m = map(int, input().split())\nXY = list(map(int, input().split()) for _ in range(m))\n\nBall = [1] * n\nDone = [False] * n\nDone[0] = True\n\nfor i in range(m):\n\tx, y = XY[i]\n\tx -= 1\n\ty -= 1\n\tif Done[x]:\n\t\tDone[y] = True\n\t\n\tBall[x] -= 1\n\tBall[y] += 1\n\t\n\tif Ball[x] == 0:\n\t\tDone[x] = False\n\t\t\t\t\nres = 0\nfor i in range(n):\n\tif Done[i]:\n\t\tres += 1\n\nprint(res)", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "XY = list(map(int, input().split()) for _ in range(m))", "XY", "list(map(int, input().split()) for _ in range(m))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "Ball = [1] * n", "Ball", "[1] * n", "[1]", "1", "n", "Done = [False] * n", "Done", "[False] * n", "[False]", "False", "n", "Done[0] = True", "Done[0]", "Done", "0", "True", "for i in range(m):\n\tx, y = XY[i]\n\tx -= 1\n\ty -= 1\n\tif Done[x]:\n\t\tDone[y] = True\n\t\n\tBall[x] -= 1\n\tBall[y] += 1\n\t\n\tif Ball[x] == 0:\n\t\tDone[x] = False\n\t\t\t\t", "i", "range(m)", "range", "m", "x, y = XY[i]", "x", "XY[i]", "XY", "i", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "if Done[x]:\n\t\tDone[y] = True\n\t\n\t", "Done[x]", "Done", "x", "Done[y] = True", "Done[y]", "Done", "y", "True", "Ball[x] -= 1", "Ball[x]", "Ball", "x", "1", "Ball[y] += 1", "Ball[y]", "Ball", "y", "1", "if Ball[x] == 0:\n\t\tDone[x] = False\n\t\t\t\t", "Ball[x] == 0", "Ball[x]", "Ball", "x", "0", "Done[x] = False", "Done[x]", "Done", "x", "False", "res = 0", "res", "0", "for i in range(n):\n\tif Done[i]:\n\t\tres += 1", "i", "range(n)", "range", "n", "if Done[i]:\n\t\tres += 1", "Done[i]", "Done", "i", "res += 1", "res", "1", "print(res)", "print", "res", "x, y = XY[i]", "XY[i]", "x", "y -= 1", "1", "y", "XY = list(map(int, input().split()) for _ in range(m))", "list(map(int, input().split()) for _ in range(m))", "XY", "Done = [False] * n", "[False] * n", "Done", "res += 1", "1", "res", "x -= 1", "1", "x", "y = XY[i]", "XY[i]", "y", "n, m = map(int, input().split())", "map(int, input().split())", "n", "res = 0", "0", "res", "m = map(int, input().split())", "map(int, input().split())", "m", "Ball = [1] * n", "[1] * n", "Ball" ]
n, m = map(int, input().split()) XY = list(map(int, input().split()) for _ in range(m)) Ball = [1] * n Done = [False] * n Done[0] = True for i in range(m): x, y = XY[i] x -= 1 y -= 1 if Done[x]: Done[y] = True Ball[x] -= 1 Ball[y] += 1 if Ball[x] == 0: Done[x] = False res = 0 for i in range(n): if Done[i]: res += 1 print(res)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 138, 2 ], [ 138, 11 ], [ 15, 14 ], [ 139, 17 ], [ 135, 21 ], [ 27, 24 ], [ 136, 25 ], [ 31, 30 ], [ 139, 33 ], [ 126, 37 ], [ 41, 40 ], [ 130, 43 ], [ 147, 45 ], [ 147, 54 ], [ 127, 57 ], [ 133, 59 ], [ 67, 62 ], [ 127, 63 ], [ 133, 65 ], [ 74, 69 ], [ 127, 70 ], [ 148, 72 ], [ 136, 77 ], [ 133, 79 ], [ 87, 82 ], [ 136, 83 ], [ 148, 85 ], [ 127, 91 ], [ 133, 93 ], [ 102, 97 ], [ 136, 98 ], [ 133, 100 ], [ 144, 104 ], [ 108, 107 ], [ 139, 110 ], [ 136, 114 ], [ 107, 115 ], [ 127, 117 ], [ 107, 118 ], [ 141, 120 ], [ 142, 124 ], [ 145, 124 ], [ 126, 127 ], [ 138, 130 ], [ 147, 133 ], [ 135, 136 ], [ 138, 139 ], [ 141, 142 ], [ 144, 145 ], [ 147, 148 ] ]
[ "n, m = map(int, input().split())\nred = [0 for _ in range(n)]\nred[0] = 1\nballs = [1 for _ in range(n)]\nfor _ in range(m):\n x, y = map(int, input().split())\n if balls[x-1]:\n balls[x-1] -= 1\n balls[y-1] += 1\n if red[x-1]:\n red[y-1] = 1\n if balls[x-1] == 0:\n red[x-1] = 0\ncnt = 0\nfor i in range(n):\n if red[i] and balls[i]:\n cnt += 1\nprint(cnt)", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "0 for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "0", "red = [0 for _ in range(n)]", "red", "[0 for _ in range(n)]", "red[0] = 1", "red[0]", "red", "0", "1", "1 for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "1", "balls = [1 for _ in range(n)]", "balls", "[1 for _ in range(n)]", "for _ in range(m):\n x, y = map(int, input().split())\n if balls[x-1]:\n balls[x-1] -= 1\n balls[y-1] += 1\n if red[x-1]:\n red[y-1] = 1\n if balls[x-1] == 0:\n red[x-1] = 0", "_", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if balls[x-1]:\n balls[x-1] -= 1\n balls[y-1] += 1\n if red[x-1]:\n red[y-1] = 1\n if balls[x-1] == 0:\n red[x-1] = 0", "balls[x-1]", "balls", "x-1", "x", "1", "balls[x-1] -= 1", "balls[x-1]", "balls", "x-1", "x", "1", "1", "balls[y-1] += 1", "balls[y-1]", "balls", "y-1", "y", "1", "1", "if red[x-1]:\n red[y-1] = 1\n if balls[x-1] == 0:\n red[x-1] = 0", "red[x-1]", "red", "x-1", "x", "1", "red[y-1] = 1", "red[y-1]", "red", "y-1", "y", "1", "1", "if balls[x-1] == 0:\n red[x-1] = 0", "balls[x-1] == 0", "balls[x-1]", "balls", "x-1", "x", "1", "0", "red[x-1] = 0", "red[x-1]", "red", "x-1", "x", "1", "0", "cnt = 0", "cnt", "0", "for i in range(n):\n if red[i] and balls[i]:\n cnt += 1", "i", "range(n)", "range", "n", "if red[i] and balls[i]:\n cnt += 1", "red[i] and balls[i]", "red[i]", "red", "i", "balls[i]", "balls", "i", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "balls = [1 for _ in range(n)]", "[1 for _ in range(n)]", "balls", "m = map(int, input().split())", "map(int, input().split())", "m", "x, y = map(int, input().split())", "map(int, input().split())", "x", "red = [0 for _ in range(n)]", "[0 for _ in range(n)]", "red", "n, m = map(int, input().split())", "map(int, input().split())", "n", "cnt += 1", "1", "cnt", "cnt = 0", "0", "cnt", "y = map(int, input().split())", "map(int, input().split())", "y" ]
n, m = map(int, input().split()) red = [0 for _ in range(n)] red[0] = 1 balls = [1 for _ in range(n)] for _ in range(m): x, y = map(int, input().split()) if balls[x-1]: balls[x-1] -= 1 balls[y-1] += 1 if red[x-1]: red[y-1] = 1 if balls[x-1] == 0: red[x-1] = 0 cnt = 0 for i in range(n): if red[i] and balls[i]: cnt += 1 print(cnt)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 13, 17, 14, 2, 18, 13, 17, 17, 0, 18, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 28, 13, 4, 13, 2, 13, 17, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 3, 4, 13, 4, 18, 13, 13, 17, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 159, 2 ], [ 159, 11 ], [ 162, 13 ], [ 160, 17 ], [ 168, 19 ], [ 160, 23 ], [ 28, 25 ], [ 169, 26 ], [ 31, 30 ], [ 154, 33 ], [ 171, 35 ], [ 171, 44 ], [ 51, 46 ], [ 163, 47 ], [ 166, 49 ], [ 175, 49 ], [ 58, 53 ], [ 163, 54 ], [ 172, 56 ], [ 157, 56 ], [ 166, 61 ], [ 175, 61 ], [ 163, 66 ], [ 73, 70 ], [ 169, 71 ], [ 80, 75 ], [ 169, 76 ], [ 172, 78 ], [ 157, 78 ], [ 83, 82 ], [ 30, 86 ], [ 154, 88 ], [ 174, 90 ], [ 174, 99 ], [ 169, 103 ], [ 175, 105 ], [ 166, 105 ], [ 114, 109 ], [ 169, 110 ], [ 157, 112 ], [ 172, 112 ], [ 163, 118 ], [ 175, 120 ], [ 166, 120 ], [ 129, 124 ], [ 169, 125 ], [ 175, 127 ], [ 166, 127 ], [ 136, 131 ], [ 163, 132 ], [ 175, 134 ], [ 166, 134 ], [ 143, 138 ], [ 163, 139 ], [ 157, 141 ], [ 172, 141 ], [ 169, 149 ], [ 159, 154 ], [ 174, 157 ], [ 159, 160 ], [ 162, 163 ], [ 171, 166 ], [ 168, 169 ], [ 171, 172 ], [ 174, 175 ] ]
[ "n,m=map(int,input().split())\ncnt=[1]*n\nyn=[0]*n\nyn[0]=1\nfor i in range(m):\n x,y=map(int,input().split())\n cnt[x-1]-=1\n cnt[y-1]+=1\n if x==1:\n if cnt[0]==0:\n yn[0]=0\n yn[y-1]=1\n for j in range(i+1,m):\n x,y=map(int,input().split())\n if yn[x-1]==1:\n yn[y-1]=1\n if cnt[x-1]==1:\n yn[x-1]=0\n cnt[x-1]-=1\n cnt[y-1]+=1\n break\nprint(yn.count(1))", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "cnt=[1]*n", "cnt", "[1]*n", "[1]", "1", "n", "yn=[0]*n", "yn", "[0]*n", "[0]", "0", "n", "yn[0]=1", "yn[0]", "yn", "0", "1", "for i in range(m):\n x,y=map(int,input().split())\n cnt[x-1]-=1\n cnt[y-1]+=1\n if x==1:\n if cnt[0]==0:\n yn[0]=0\n yn[y-1]=1\n for j in range(i+1,m):\n x,y=map(int,input().split())\n if yn[x-1]==1:\n yn[y-1]=1\n if cnt[x-1]==1:\n yn[x-1]=0\n cnt[x-1]-=1\n cnt[y-1]+=1\n break", "i", "range(m)", "range", "m", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "cnt[x-1]-=1", "cnt[x-1]", "cnt", "x-1", "x", "1", "1", "cnt[y-1]+=1", "cnt[y-1]", "cnt", "y-1", "y", "1", "1", "if x==1:\n if cnt[0]==0:\n yn[0]=0\n yn[y-1]=1\n for j in range(i+1,m):\n x,y=map(int,input().split())\n if yn[x-1]==1:\n yn[y-1]=1\n if cnt[x-1]==1:\n yn[x-1]=0\n cnt[x-1]-=1\n cnt[y-1]+=1\n break", "x==1", "x", "1", "if cnt[0]==0:\n yn[0]=0\n ", "cnt[0]==0", "cnt[0]", "cnt", "0", "0", "yn[0]=0", "yn[0]", "yn", "0", "0", "yn[y-1]=1", "yn[y-1]", "yn", "y-1", "y", "1", "1", "for j in range(i+1,m):\n x,y=map(int,input().split())\n if yn[x-1]==1:\n yn[y-1]=1\n if cnt[x-1]==1:\n yn[x-1]=0\n cnt[x-1]-=1\n cnt[y-1]+=1\n ", "j", "range(i+1,m)", "range", "i+1", "i", "1", "m", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if yn[x-1]==1:\n yn[y-1]=1\n ", "yn[x-1]==1", "yn[x-1]", "yn", "x-1", "x", "1", "1", "yn[y-1]=1", "yn[y-1]", "yn", "y-1", "y", "1", "1", "if cnt[x-1]==1:\n yn[x-1]=0\n ", "cnt[x-1]==1", "cnt[x-1]", "cnt", "x-1", "x", "1", "1", "yn[x-1]=0", "yn[x-1]", "yn", "x-1", "x", "1", "0", "cnt[x-1]-=1", "cnt[x-1]", "cnt", "x-1", "x", "1", "1", "cnt[y-1]+=1", "cnt[y-1]", "cnt", "y-1", "y", "1", "1", "break", "print(yn.count(1))", "print", "yn.count(1)", "yn.count", "yn", "count", "1", "m=map(int,input().split())", "map(int,input().split())", "m", "y=map(int,input().split())", "map(int,input().split())", "y", "n,m=map(int,input().split())", "map(int,input().split())", "n", "cnt=[1]*n", "[1]*n", "cnt", "x,y=map(int,input().split())", "map(int,input().split())", "x", "yn=[0]*n", "[0]*n", "yn", "y=map(int,input().split())", "map(int,input().split())", "y", "x,y=map(int,input().split())", "map(int,input().split())", "x" ]
n,m=map(int,input().split()) cnt=[1]*n yn=[0]*n yn[0]=1 for i in range(m): x,y=map(int,input().split()) cnt[x-1]-=1 cnt[y-1]+=1 if x==1: if cnt[0]==0: yn[0]=0 yn[y-1]=1 for j in range(i+1,m): x,y=map(int,input().split()) if yn[x-1]==1: yn[y-1]=1 if cnt[x-1]==1: yn[x-1]=0 cnt[x-1]-=1 cnt[y-1]+=1 break print(yn.count(1))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 118, 2 ], [ 118, 11 ], [ 124, 13 ], [ 116, 17 ], [ 22, 19 ], [ 125, 20 ], [ 106, 24 ], [ 116, 28 ], [ 31, 30 ], [ 119, 33 ], [ 127, 35 ], [ 127, 44 ], [ 125, 47 ], [ 128, 49 ], [ 57, 52 ], [ 125, 53 ], [ 110, 55 ], [ 64, 59 ], [ 107, 60 ], [ 128, 62 ], [ 71, 66 ], [ 107, 67 ], [ 110, 69 ], [ 107, 75 ], [ 128, 77 ], [ 86, 81 ], [ 125, 82 ], [ 128, 84 ], [ 112, 88 ], [ 92, 91 ], [ 116, 94 ], [ 125, 97 ], [ 91, 98 ], [ 121, 100 ], [ 122, 104 ], [ 113, 104 ], [ 106, 107 ], [ 127, 110 ], [ 112, 113 ], [ 118, 116 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ], [ 127, 128 ] ]
[ "N,M = map(int,input().split())\nrboxes = [False]*N\nrboxes[0] = True\nballC = [1]*N\nfor i in range(M):\n x, y = map(int, input().split())\n if rboxes[x-1]:\n rboxes[y-1] = True\n ballC[x-1] -= 1\n ballC[y-1] += 1\n if ballC[x-1] == 0:\n rboxes[x-1] = False\nc = 0\nfor i in range(N):\n if rboxes[i]:\n c+=1\nprint(c)\n\n", "N,M = map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "rboxes = [False]*N", "rboxes", "[False]*N", "[False]", "False", "N", "rboxes[0] = True", "rboxes[0]", "rboxes", "0", "True", "ballC = [1]*N", "ballC", "[1]*N", "[1]", "1", "N", "for i in range(M):\n x, y = map(int, input().split())\n if rboxes[x-1]:\n rboxes[y-1] = True\n ballC[x-1] -= 1\n ballC[y-1] += 1\n if ballC[x-1] == 0:\n rboxes[x-1] = False", "i", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if rboxes[x-1]:\n rboxes[y-1] = True\n ", "rboxes[x-1]", "rboxes", "x-1", "x", "1", "rboxes[y-1] = True", "rboxes[y-1]", "rboxes", "y-1", "y", "1", "True", "ballC[x-1] -= 1", "ballC[x-1]", "ballC", "x-1", "x", "1", "1", "ballC[y-1] += 1", "ballC[y-1]", "ballC", "y-1", "y", "1", "1", "if ballC[x-1] == 0:\n rboxes[x-1] = False", "ballC[x-1] == 0", "ballC[x-1]", "ballC", "x-1", "x", "1", "0", "rboxes[x-1] = False", "rboxes[x-1]", "rboxes", "x-1", "x", "1", "False", "c = 0", "c", "0", "for i in range(N):\n if rboxes[i]:\n c+=1", "i", "range(N)", "range", "N", "if rboxes[i]:\n c+=1", "rboxes[i]", "rboxes", "i", "c+=1", "c", "1", "print(c)", "print", "c", "ballC = [1]*N", "[1]*N", "ballC", "y = map(int, input().split())", "map(int, input().split())", "y", "c = 0", "0", "c", "N,M = map(int,input().split())", "map(int,input().split())", "N", "M = map(int,input().split())", "map(int,input().split())", "M", "c+=1", "1", "c", "rboxes = [False]*N", "[False]*N", "rboxes", "x, y = map(int, input().split())", "map(int, input().split())", "x" ]
N,M = map(int,input().split()) rboxes = [False]*N rboxes[0] = True ballC = [1]*N for i in range(M): x, y = map(int, input().split()) if rboxes[x-1]: rboxes[y-1] = True ballC[x-1] -= 1 ballC[y-1] += 1 if ballC[x-1] == 0: rboxes[x-1] = False c = 0 for i in range(N): if rboxes[i]: c+=1 print(c)
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 12, 13, 12, 13, 12, 13, 12, 13, 0, 13, 2, 2, 17, 17, 17, 0, 13, 4, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 4, 13, 10, 12, 13, 10, 18, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 109, 4 ], [ 20, 19 ], [ 27, 26 ], [ 119, 28 ], [ 27, 29 ], [ 32, 31 ], [ 26, 35 ], [ 40, 37 ], [ 31, 38 ], [ 43, 42 ], [ 26, 46 ], [ 49, 48 ], [ 29, 51 ], [ 54, 53 ], [ 119, 55 ], [ 54, 56 ], [ 59, 58 ], [ 62, 61 ], [ 81, 65 ], [ 31, 66 ], [ 58, 67 ], [ 53, 67 ], [ 73, 70 ], [ 31, 71 ], [ 61, 72 ], [ 56, 72 ], [ 89, 76 ], [ 42, 77 ], [ 58, 78 ], [ 53, 78 ], [ 84, 81 ], [ 31, 82 ], [ 58, 83 ], [ 53, 83 ], [ 87, 86 ], [ 92, 89 ], [ 42, 90 ], [ 58, 91 ], [ 53, 91 ], [ 97, 94 ], [ 42, 95 ], [ 61, 96 ], [ 56, 96 ], [ 31, 102 ], [ 107, 104 ], [ 109, 110 ] ]
[ "import sys\ninput = sys.stdin.readline\n\ndef I(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(map(int, input().split()))\n\ndef main():\n mod=10**9+7\n N,M=MI()\n L=[0]*N\n L[0]=1\n cnt=[1]*N\n for i in range(M):\n x,y=MI()\n x-=1\n y-=1\n if L[x]==1:\n L[y]=1\n if cnt[x]==1:\n L[x]=0\n flag=0\n cnt[x]-=1\n cnt[y]+=1\n \n print(sum(L))\n \n\nmain()", "import sys", "sys", "input = sys.stdin.readline", "input", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "def I(): return int(input())", "I", "def MI(): return map(int, input().split())", "MI", "def LI(): return list(map(int, input().split()))", "LI", "def main():\n mod=10**9+7\n N,M=MI()\n L=[0]*N\n L[0]=1\n cnt=[1]*N\n for i in range(M):\n x,y=MI()\n x-=1\n y-=1\n if L[x]==1:\n L[y]=1\n if cnt[x]==1:\n L[x]=0\n flag=0\n cnt[x]-=1\n cnt[y]+=1\n \n print(sum(L))\n ", "main", "mod=10**9+7", "mod", "10**9+7", "10**9", "10", "9", "7", "N,M=MI()", "N", "MI()", "MI", "M", "L=[0]*N", "L", "[0]*N", "[0]", "0", "N", "L[0]=1", "L[0]", "L", "0", "1", "cnt=[1]*N", "cnt", "[1]*N", "[1]", "1", "N", "for i in range(M):\n x,y=MI()\n x-=1\n y-=1\n if L[x]==1:\n L[y]=1\n if cnt[x]==1:\n L[x]=0\n flag=0\n cnt[x]-=1\n cnt[y]+=1\n \n ", "i", "range(M)", "range", "M", "x,y=MI()", "x", "MI()", "MI", "y", "x-=1", "x", "1", "y-=1", "y", "1", "if L[x]==1:\n L[y]=1\n if cnt[x]==1:\n L[x]=0\n flag=0\n ", "L[x]==1", "L[x]", "L", "x", "1", "L[y]=1", "L[y]", "L", "y", "1", "if cnt[x]==1:\n L[x]=0\n flag=0\n ", "cnt[x]==1", "cnt[x]", "cnt", "x", "1", "L[x]=0", "L[x]", "L", "x", "0", "flag=0", "flag", "0", "cnt[x]-=1", "cnt[x]", "cnt", "x", "1", "cnt[y]+=1", "cnt[y]", "cnt", "y", "1", "print(sum(L))", "print", "sum(L)", "sum", "L", "main()", "main", "def main():\n mod=10**9+7\n N,M=MI()\n L=[0]*N\n L[0]=1\n cnt=[1]*N\n for i in range(M):\n x,y=MI()\n x-=1\n y-=1\n if L[x]==1:\n L[y]=1\n if cnt[x]==1:\n L[x]=0\n flag=0\n cnt[x]-=1\n cnt[y]+=1\n \n print(sum(L))\n ", "def main():\n mod=10**9+7\n N,M=MI()\n L=[0]*N\n L[0]=1\n cnt=[1]*N\n for i in range(M):\n x,y=MI()\n x-=1\n y-=1\n if L[x]==1:\n L[y]=1\n if cnt[x]==1:\n L[x]=0\n flag=0\n cnt[x]-=1\n cnt[y]+=1\n \n print(sum(L))\n ", "main", "input = sys.stdin.readline", "sys.stdin.readline", "input", "def LI(): return list(map(int, input().split()))", "def LI(): return list(map(int, input().split()))", "LI", "def I(): return int(input())", "def I(): return int(input())", "I", "def MI(): return map(int, input().split())", "def MI(): return map(int, input().split())", "MI" ]
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N,M=MI() L=[0]*N L[0]=1 cnt=[1]*N for i in range(M): x,y=MI() x-=1 y-=1 if L[x]==1: L[y]=1 if cnt[x]==1: L[x]=0 flag=0 cnt[x]-=1 cnt[y]+=1 print(sum(L)) main()
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 2, 13, 17, 14, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 118, 2 ], [ 118, 11 ], [ 121, 13 ], [ 113, 18 ], [ 24, 21 ], [ 122, 22 ], [ 100, 26 ], [ 113, 31 ], [ 35, 34 ], [ 119, 37 ], [ 109, 39 ], [ 109, 48 ], [ 53, 50 ], [ 101, 51 ], [ 110, 52 ], [ 58, 55 ], [ 101, 56 ], [ 104, 57 ], [ 122, 61 ], [ 110, 62 ], [ 67, 64 ], [ 122, 65 ], [ 104, 66 ], [ 50, 70 ], [ 101, 71 ], [ 110, 72 ], [ 78, 75 ], [ 122, 76 ], [ 110, 77 ], [ 106, 80 ], [ 84, 83 ], [ 113, 87 ], [ 122, 91 ], [ 83, 92 ], [ 115, 94 ], [ 116, 98 ], [ 107, 98 ], [ 100, 101 ], [ 109, 104 ], [ 106, 107 ], [ 109, 110 ], [ 118, 113 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ] ]
[ "n,m = map(int, input().split())\nr = [0]*(n+1)\nr[1] = 1\nb0 = [1]*(n+1)\nfor i in range(m):\n x,y = map(int, input().split())\n b0[x] -= 1\n b0[y] += 1\n if r[x]:\n r[y] = 1\n if b0[x]==0:\n r[x]=0\nans = 0\nfor j in range(n+1):\n if r[j]:\n ans += 1\nprint(ans)", "n,m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "r = [0]*(n+1)", "r", "[0]*(n+1)", "[0]", "0", "n+1", "n", "1", "r[1] = 1", "r[1]", "r", "1", "1", "b0 = [1]*(n+1)", "b0", "[1]*(n+1)", "[1]", "1", "n+1", "n", "1", "for i in range(m):\n x,y = map(int, input().split())\n b0[x] -= 1\n b0[y] += 1\n if r[x]:\n r[y] = 1\n if b0[x]==0:\n r[x]=0", "i", "range(m)", "range", "m", "x,y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "b0[x] -= 1", "b0[x]", "b0", "x", "1", "b0[y] += 1", "b0[y]", "b0", "y", "1", "if r[x]:\n r[y] = 1\n ", "r[x]", "r", "x", "r[y] = 1", "r[y]", "r", "y", "1", "if b0[x]==0:\n r[x]=0", "b0[x]==0", "b0[x]", "b0", "x", "0", "r[x]=0", "r[x]", "r", "x", "0", "ans = 0", "ans", "0", "for j in range(n+1):\n if r[j]:\n ans += 1", "j", "range(n+1)", "range", "n+1", "n", "1", "if r[j]:\n ans += 1", "r[j]", "r", "j", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "b0 = [1]*(n+1)", "[1]*(n+1)", "b0", "y = map(int, input().split())", "map(int, input().split())", "y", "ans = 0", "0", "ans", "x,y = map(int, input().split())", "map(int, input().split())", "x", "n,m = map(int, input().split())", "map(int, input().split())", "n", "ans += 1", "1", "ans", "m = map(int, input().split())", "map(int, input().split())", "m", "r = [0]*(n+1)", "[0]*(n+1)", "r" ]
n,m = map(int, input().split()) r = [0]*(n+1) r[1] = 1 b0 = [1]*(n+1) for i in range(m): x,y = map(int, input().split()) b0[x] -= 1 b0[y] += 1 if r[x]: r[y] = 1 if b0[x]==0: r[x]=0 ans = 0 for j in range(n+1): if r[j]: ans += 1 print(ans)
[ 7, 15, 13, 15, 0, 13, 4, 13, 17, 15, 13, 4, 18, 13, 13, 2, 17, 17, 15, 13, 15, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 12, 13, 23, 13, 12, 13, 0, 13, 4, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 215, 5 ], [ 30, 29 ], [ 201, 35 ], [ 39, 39 ], [ 43, 42 ], [ 210, 48 ], [ 52, 52 ], [ 62, 61 ], [ 204, 66 ], [ 70, 70 ], [ 74, 73 ], [ 198, 79 ], [ 83, 83 ], [ 87, 86 ], [ 204, 94 ], [ 98, 98 ], [ 103, 102 ], [ 222, 104 ], [ 103, 105 ], [ 109, 108 ], [ 102, 112 ], [ 118, 117 ], [ 122, 121 ], [ 102, 125 ], [ 131, 130 ], [ 136, 133 ], [ 130, 134 ], [ 139, 138 ], [ 105, 141 ], [ 144, 143 ], [ 222, 145 ], [ 144, 146 ], [ 151, 148 ], [ 117, 149 ], [ 143, 150 ], [ 156, 153 ], [ 117, 154 ], [ 146, 155 ], [ 175, 159 ], [ 130, 160 ], [ 143, 161 ], [ 167, 164 ], [ 130, 165 ], [ 146, 166 ], [ 148, 170 ], [ 117, 171 ], [ 143, 172 ], [ 178, 175 ], [ 130, 176 ], [ 143, 177 ], [ 130, 183 ], [ 207, 189 ], [ 215, 216 ] ]
[ "import math\nfrom math import gcd,pi\nINF = float(\"inf\")\n\nimport sys\nsys.setrecursionlimit(10**6)\nimport itertools\nfrom collections import Counter,deque\ndef i_input(): return int(input())\ndef i_map(): return map(int, input().split())\ndef i_list(): return list(i_map())\ndef i_row(N): return [i_input() for _ in range(N)]\ndef i_row_list(N): return [i_list() for _ in range(N)]\ndef s_input(): return input()\ndef s_map(): return input().split()\ndef s_list(): return list(s_map())\ndef s_row(N): return [s_input for _ in range(N)]\ndef s_row_str(N): return [s_list() for _ in range(N)]\ndef s_row_list(N): return [list(s_input()) for _ in range(N)]\n\n\ndef main():\n n,m = i_map()\n box = [1 for _ in range(n+1)]\n red = [0 for _ in range(n+1)]\n red[1] = 1\n\n for i in range(m):\n x,y = i_map()\n box[x] -= 1\n box[y] += 1\n if red[x] == 1:\n red[y] = 1\n if box[x] == 0:\n red[x] = 0\n\n print(sum(red))\n\nif __name__==\"__main__\":\n main()", "import math", "math", "from math import gcd,pi", "INF = float(\"inf\")", "INF", "float(\"inf\")", "float", "\"inf\"", "import sys", "sys", "sys.setrecursionlimit(10**6)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**6", "10", "6", "import itertools", "itertools", "from collections import Counter,deque", "def i_input(): return int(input())", "i_input", "def i_map(): return map(int, input().split())", "i_map", "def i_list(): return list(i_map())", "i_list", "i_input() for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "i_input()", "i_input", "def i_row(N): return [i_input() for _ in range(N)]", "i_row", "N", "N", "i_list() for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "i_list()", "i_list", "def i_row_list(N): return [i_list() for _ in range(N)]", "i_row_list", "N", "N", "def s_input(): return input()", "s_input", "def s_map(): return input().split()", "s_map", "def s_list(): return list(s_map())", "s_list", "s_input for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "s_input", "def s_row(N): return [s_input for _ in range(N)]", "s_row", "N", "N", "s_list() for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "s_list()", "s_list", "def s_row_str(N): return [s_list() for _ in range(N)]", "s_row_str", "N", "N", "list(s_input()) for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "list(s_input())", "list", "s_input()", "s_input", "def s_row_list(N): return [list(s_input()) for _ in range(N)]", "s_row_list", "N", "N", "def main():\n n,m = i_map()\n box = [1 for _ in range(n+1)]\n red = [0 for _ in range(n+1)]\n red[1] = 1\n\n for i in range(m):\n x,y = i_map()\n box[x] -= 1\n box[y] += 1\n if red[x] == 1:\n red[y] = 1\n if box[x] == 0:\n red[x] = 0\n\n print(sum(red))", "main", "n,m = i_map()", "n", "i_map()", "i_map", "m", "1 for _ in range(n+1)", "for _ in range(n+1)", "_", "range(n+1)", "range", "n+1", "n", "1", "for _ in range(n+1)", "1", "box = [1 for _ in range(n+1)]", "box", "[1 for _ in range(n+1)]", "0 for _ in range(n+1)", "for _ in range(n+1)", "_", "range(n+1)", "range", "n+1", "n", "1", "for _ in range(n+1)", "0", "red = [0 for _ in range(n+1)]", "red", "[0 for _ in range(n+1)]", "red[1] = 1", "red[1]", "red", "1", "1", "for i in range(m):\n x,y = i_map()\n box[x] -= 1\n box[y] += 1\n if red[x] == 1:\n red[y] = 1\n if box[x] == 0:\n red[x] = 0\n\n ", "i", "range(m)", "range", "m", "x,y = i_map()", "x", "i_map()", "i_map", "y", "box[x] -= 1", "box[x]", "box", "x", "1", "box[y] += 1", "box[y]", "box", "y", "1", "if red[x] == 1:\n red[y] = 1\n ", "red[x] == 1", "red[x]", "red", "x", "1", "red[y] = 1", "red[y]", "red", "y", "1", "if box[x] == 0:\n red[x] = 0\n\n ", "box[x] == 0", "box[x]", "box", "x", "0", "red[x] = 0", "red[x]", "red", "x", "0", "print(sum(red))", "print", "sum(red)", "sum", "red", "if __name__==\"__main__\":\n main()", "__name__==\"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def i_row_list(N): return [i_list() for _ in range(N)]", "def i_row_list(N): return [i_list() for _ in range(N)]", "i_row_list", "def s_map(): return input().split()", "def s_map(): return input().split()", "s_map", "def s_list(): return list(s_map())", "def s_list(): return list(s_map())", "s_list", "def i_input(): return int(input())", "def i_input(): return int(input())", "i_input", "def s_input(): return input()", "def s_input(): return input()", "s_input", "def main():\n n,m = i_map()\n box = [1 for _ in range(n+1)]\n red = [0 for _ in range(n+1)]\n red[1] = 1\n\n for i in range(m):\n x,y = i_map()\n box[x] -= 1\n box[y] += 1\n if red[x] == 1:\n red[y] = 1\n if box[x] == 0:\n red[x] = 0\n\n print(sum(red))", "def main():\n n,m = i_map()\n box = [1 for _ in range(n+1)]\n red = [0 for _ in range(n+1)]\n red[1] = 1\n\n for i in range(m):\n x,y = i_map()\n box[x] -= 1\n box[y] += 1\n if red[x] == 1:\n red[y] = 1\n if box[x] == 0:\n red[x] = 0\n\n print(sum(red))", "main", "def i_list(): return list(i_map())", "def i_list(): return list(i_map())", "i_list", "def s_row(N): return [s_input for _ in range(N)]", "def s_row(N): return [s_input for _ in range(N)]", "s_row", "INF = float(\"inf\")", "float(\"inf\")", "INF", "def i_row(N): return [i_input() for _ in range(N)]", "def i_row(N): return [i_input() for _ in range(N)]", "i_row", "def i_map(): return map(int, input().split())", "def i_map(): return map(int, input().split())", "i_map", "def s_row_list(N): return [list(s_input()) for _ in range(N)]", "def s_row_list(N): return [list(s_input()) for _ in range(N)]", "s_row_list", "def s_row_str(N): return [s_list() for _ in range(N)]", "def s_row_str(N): return [s_list() for _ in range(N)]", "s_row_str" ]
import math from math import gcd,pi INF = float("inf") import sys sys.setrecursionlimit(10**6) import itertools from collections import Counter,deque def i_input(): return int(input()) def i_map(): return map(int, input().split()) def i_list(): return list(i_map()) def i_row(N): return [i_input() for _ in range(N)] def i_row_list(N): return [i_list() for _ in range(N)] def s_input(): return input() def s_map(): return input().split() def s_list(): return list(s_map()) def s_row(N): return [s_input for _ in range(N)] def s_row_str(N): return [s_list() for _ in range(N)] def s_row_list(N): return [list(s_input()) for _ in range(N)] def main(): n,m = i_map() box = [1 for _ in range(n+1)] red = [0 for _ in range(n+1)] red[1] = 1 for i in range(m): x,y = i_map() box[x] -= 1 box[y] += 1 if red[x] == 1: red[y] = 1 if box[x] == 0: red[x] = 0 print(sum(red)) if __name__=="__main__": main()
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 101, 2 ], [ 101, 11 ], [ 98, 13 ], [ 102, 17 ], [ 22, 19 ], [ 99, 20 ], [ 110, 24 ], [ 102, 28 ], [ 31, 30 ], [ 96, 33 ], [ 107, 35 ], [ 107, 44 ], [ 51, 46 ], [ 111, 47 ], [ 105, 49 ], [ 58, 53 ], [ 111, 54 ], [ 108, 56 ], [ 99, 62 ], [ 105, 64 ], [ 73, 68 ], [ 99, 69 ], [ 108, 71 ], [ 111, 77 ], [ 105, 79 ], [ 88, 83 ], [ 99, 84 ], [ 105, 86 ], [ 99, 93 ], [ 101, 96 ], [ 98, 99 ], [ 101, 102 ], [ 107, 105 ], [ 107, 108 ], [ 110, 111 ] ]
[ "N, M = map(int, input().split())\nans = [0] * N\nans[0] = 1\nw = [1] * N\n\nfor i in range(M):\n x, y = map(int, input().split())\n w[x-1] -= 1\n w[y-1] += 1\n if ans[x-1] == 1:\n ans[y-1] = 1\n if w[x-1] == 0:\n ans[x-1] = 0\n \nprint(sum(ans))", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "ans = [0] * N", "ans", "[0] * N", "[0]", "0", "N", "ans[0] = 1", "ans[0]", "ans", "0", "1", "w = [1] * N", "w", "[1] * N", "[1]", "1", "N", "for i in range(M):\n x, y = map(int, input().split())\n w[x-1] -= 1\n w[y-1] += 1\n if ans[x-1] == 1:\n ans[y-1] = 1\n if w[x-1] == 0:\n ans[x-1] = 0\n ", "i", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "w[x-1] -= 1", "w[x-1]", "w", "x-1", "x", "1", "1", "w[y-1] += 1", "w[y-1]", "w", "y-1", "y", "1", "1", "if ans[x-1] == 1:\n ans[y-1] = 1\n if w[x-1] == 0:\n ans[x-1] = 0\n ", "ans[x-1] == 1", "ans[x-1]", "ans", "x-1", "x", "1", "1", "ans[y-1] = 1", "ans[y-1]", "ans", "y-1", "y", "1", "1", "if w[x-1] == 0:\n ans[x-1] = 0\n ", "w[x-1] == 0", "w[x-1]", "w", "x-1", "x", "1", "0", "ans[x-1] = 0", "ans[x-1]", "ans", "x-1", "x", "1", "0", "print(sum(ans))", "print", "sum(ans)", "sum", "ans", "M = map(int, input().split())", "map(int, input().split())", "M", "ans = [0] * N", "[0] * N", "ans", "N, M = map(int, input().split())", "map(int, input().split())", "N", "x, y = map(int, input().split())", "map(int, input().split())", "x", "y = map(int, input().split())", "map(int, input().split())", "y", "w = [1] * N", "[1] * N", "w" ]
N, M = map(int, input().split()) ans = [0] * N ans[0] = 1 w = [1] * N for i in range(M): x, y = map(int, input().split()) w[x-1] -= 1 w[y-1] += 1 if ans[x-1] == 1: ans[y-1] = 1 if w[x-1] == 0: ans[x-1] = 0 print(sum(ans))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 39, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 4, 18, 13, 13, 39, 13, 13, 28, 13, 4, 13, 13, 0, 13, 18, 18, 13, 13, 17, 13, 18, 18, 13, 13, 17, 0, 13, 2, 13, 17, 13, 2, 13, 17, 14, 2, 40, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 40, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 18, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 39, 13, 10, 4, 13, 10, 18, 13 ]
[ [ 218, 2 ], [ 218, 11 ], [ 212, 13 ], [ 219, 17 ], [ 206, 19 ], [ 219, 23 ], [ 28, 25 ], [ 213, 26 ], [ 215, 30 ], [ 34, 33 ], [ 210, 36 ], [ 203, 38 ], [ 203, 47 ], [ 216, 50 ], [ 57, 56 ], [ 210, 59 ], [ 194, 61 ], [ 216, 64 ], [ 56, 65 ], [ 221, 67 ], [ 216, 70 ], [ 56, 71 ], [ 191, 74 ], [ 195, 76 ], [ 204, 76 ], [ 192, 76 ], [ 200, 78 ], [ 222, 80 ], [ 198, 80 ], [ 201, 80 ], [ 176, 85 ], [ 154, 85 ], [ 132, 85 ], [ 100, 85 ], [ 207, 86 ], [ 192, 87 ], [ 195, 87 ], [ 204, 87 ], [ 122, 90 ], [ 213, 91 ], [ 192, 92 ], [ 195, 92 ], [ 204, 92 ], [ 98, 95 ], [ 213, 96 ], [ 201, 97 ], [ 222, 97 ], [ 198, 97 ], [ 103, 100 ], [ 207, 101 ], [ 192, 102 ], [ 195, 102 ], [ 204, 102 ], [ 108, 105 ], [ 207, 106 ], [ 201, 107 ], [ 222, 107 ], [ 198, 107 ], [ 176, 112 ], [ 154, 112 ], [ 132, 112 ], [ 100, 112 ], [ 207, 113 ], [ 192, 114 ], [ 195, 114 ], [ 204, 114 ], [ 122, 117 ], [ 213, 118 ], [ 192, 119 ], [ 195, 119 ], [ 204, 119 ], [ 125, 122 ], [ 213, 123 ], [ 192, 124 ], [ 195, 124 ], [ 204, 124 ], [ 130, 127 ], [ 213, 128 ], [ 201, 129 ], [ 222, 129 ], [ 198, 129 ], [ 135, 132 ], [ 207, 133 ], [ 192, 134 ], [ 195, 134 ], [ 204, 134 ], [ 140, 137 ], [ 207, 138 ], [ 201, 139 ], [ 222, 139 ], [ 198, 139 ], [ 176, 144 ], [ 154, 144 ], [ 132, 144 ], [ 100, 144 ], [ 207, 145 ], [ 192, 146 ], [ 195, 146 ], [ 204, 146 ], [ 122, 149 ], [ 213, 150 ], [ 192, 151 ], [ 195, 151 ], [ 204, 151 ], [ 157, 154 ], [ 207, 155 ], [ 192, 156 ], [ 195, 156 ], [ 204, 156 ], [ 162, 159 ], [ 207, 160 ], [ 201, 161 ], [ 222, 161 ], [ 198, 161 ], [ 176, 166 ], [ 154, 166 ], [ 132, 166 ], [ 100, 166 ], [ 207, 167 ], [ 192, 168 ], [ 195, 168 ], [ 204, 168 ], [ 122, 171 ], [ 213, 172 ], [ 192, 173 ], [ 195, 173 ], [ 204, 173 ], [ 179, 176 ], [ 207, 177 ], [ 192, 178 ], [ 195, 178 ], [ 204, 178 ], [ 184, 181 ], [ 207, 182 ], [ 201, 183 ], [ 222, 183 ], [ 198, 183 ], [ 213, 189 ], [ 191, 192 ], [ 194, 195 ], [ 203, 198 ], [ 200, 201 ], [ 203, 204 ], [ 206, 207 ], [ 218, 210 ], [ 212, 213 ], [ 215, 216 ], [ 218, 219 ], [ 221, 222 ] ]
[ "n,m = map(int,input().split())\npossible = [0]*n\nkosuu = [1]*n\npossible[0] = 1\nL = []\n\nfor i in range(m):\n x,y = map(int,input().split())\n L.append((x,y))\n\nfor i in range(m):\n x,y = L[i][0],L[i][1]\n x,y = x-1,y-1\n if kosuu[x] >=2 and possible[x] == 1:\n possible[y] = 1\n kosuu[x] -=1\n kosuu[y] +=1\n elif kosuu[x] == 1 and possible[x] == 1:\n possible[x] = 0\n possible[y] = 1\n kosuu[x] = 0\n kosuu[y] +=1\n elif kosuu[x] >=2 and possible[x] == 0:\n kosuu[x] -=1\n kosuu[y] +=1\n elif kosuu[x] == 1 and possible[x] == 0:\n kosuu[x] = 0\n kosuu[y] +=1\nprint(sum(possible))", "n,m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "possible = [0]*n", "possible", "[0]*n", "[0]", "0", "n", "kosuu = [1]*n", "kosuu", "[1]*n", "[1]", "1", "n", "possible[0] = 1", "possible[0]", "possible", "0", "1", "L = []", "L", "[]", "for i in range(m):\n x,y = map(int,input().split())\n L.append((x,y))", "i", "range(m)", "range", "m", "x,y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "L.append((x,y))", "L.append", "L", "append", "(x,y)", "x", "y", "for i in range(m):\n x,y = L[i][0],L[i][1]\n x,y = x-1,y-1\n if kosuu[x] >=2 and possible[x] == 1:\n possible[y] = 1\n kosuu[x] -=1\n kosuu[y] +=1\n elif kosuu[x] == 1 and possible[x] == 1:\n possible[x] = 0\n possible[y] = 1\n kosuu[x] = 0\n kosuu[y] +=1\n elif kosuu[x] >=2 and possible[x] == 0:\n kosuu[x] -=1\n kosuu[y] +=1\n elif kosuu[x] == 1 and possible[x] == 0:\n kosuu[x] = 0\n kosuu[y] +=1", "i", "range(m)", "range", "m", "x,y = L[i][0],L[i][1]", "x", "L[i][0]", "[i]", "L", "i", "0", "y", "L[i][1]", "[i]", "L", "i", "1", "x,y = x-1,y-1", "x", "x-1", "x", "1", "y", "y-1", "y", "1", "if kosuu[x] >=2 and possible[x] == 1:\n possible[y] = 1\n kosuu[x] -=1\n kosuu[y] +=1\n elif kosuu[x] == 1 and possible[x] == 1:\n possible[x] = 0\n possible[y] = 1\n kosuu[x] = 0\n kosuu[y] +=1\n elif kosuu[x] >=2 and possible[x] == 0:\n kosuu[x] -=1\n kosuu[y] +=1\n elif kosuu[x] == 1 and possible[x] == 0:\n kosuu[x] = 0\n kosuu[y] +=1", "kosuu[x] >=2 and possible[x] == 1", "kosuu[x] >=2", "kosuu[x]", "kosuu", "x", "2", "possible[x] == 1", "possible[x]", "possible", "x", "1", "possible[y] = 1", "possible[y]", "possible", "y", "1", "kosuu[x] -=1", "kosuu[x]", "kosuu", "x", "1", "kosuu[y] +=1", "kosuu[y]", "kosuu", "y", "1", "elif kosuu[x] == 1 and possible[x] == 1:\n possible[x] = 0\n possible[y] = 1\n kosuu[x] = 0\n kosuu[y] +=1\n ", "kosuu[x] == 1 and possible[x] == 1", "kosuu[x] == 1", "kosuu[x]", "kosuu", "x", "1", "possible[x] == 1", "possible[x]", "possible", "x", "1", "possible[x] = 0", "possible[x]", "possible", "x", "0", "possible[y] = 1", "possible[y]", "possible", "y", "1", "kosuu[x] = 0", "kosuu[x]", "kosuu", "x", "0", "kosuu[y] +=1", "kosuu[y]", "kosuu", "y", "1", "elif kosuu[x] >=2 and possible[x] == 0:\n kosuu[x] -=1\n kosuu[y] +=1\n ", "kosuu[x] >=2 and possible[x] == 0", "kosuu[x] >=2", "kosuu[x]", "kosuu", "x", "2", "possible[x] == 0", "possible[x]", "possible", "x", "0", "kosuu[x] -=1", "kosuu[x]", "kosuu", "x", "1", "kosuu[y] +=1", "kosuu[y]", "kosuu", "y", "1", "elif kosuu[x] == 1 and possible[x] == 0:\n kosuu[x] = 0\n kosuu[y] +=1", "kosuu[x] == 1 and possible[x] == 0", "kosuu[x] == 1", "kosuu[x]", "kosuu", "x", "1", "possible[x] == 0", "possible[x]", "possible", "x", "0", "kosuu[x] = 0", "kosuu[x]", "kosuu", "x", "0", "kosuu[y] +=1", "kosuu[y]", "kosuu", "y", "1", "print(sum(possible))", "print", "sum(possible)", "sum", "possible", "x,y = x-1,y-1", "x-1", "x", "x,y = L[i][0],L[i][1]", "L[i][0]", "x", "y = map(int,input().split())", "map(int,input().split())", "y", "y = x-1,y-1", "y-1", "y", "x,y = map(int,input().split())", "map(int,input().split())", "x", "kosuu = [1]*n", "[1]*n", "kosuu", "m = map(int,input().split())", "map(int,input().split())", "m", "possible = [0]*n", "[0]*n", "possible", "L = []", "[]", "L", "n,m = map(int,input().split())", "map(int,input().split())", "n", "y = L[i][0],L[i][1]", "L[i][1]", "y" ]
n,m = map(int,input().split()) possible = [0]*n kosuu = [1]*n possible[0] = 1 L = [] for i in range(m): x,y = map(int,input().split()) L.append((x,y)) for i in range(m): x,y = L[i][0],L[i][1] x,y = x-1,y-1 if kosuu[x] >=2 and possible[x] == 1: possible[y] = 1 kosuu[x] -=1 kosuu[y] +=1 elif kosuu[x] == 1 and possible[x] == 1: possible[x] = 0 possible[y] = 1 kosuu[x] = 0 kosuu[y] +=1 elif kosuu[x] >=2 and possible[x] == 0: kosuu[x] -=1 kosuu[y] +=1 elif kosuu[x] == 1 and possible[x] == 0: kosuu[x] = 0 kosuu[y] +=1 print(sum(possible))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 125, 2 ], [ 125, 11 ], [ 119, 13 ], [ 111, 17 ], [ 22, 19 ], [ 120, 20 ], [ 122, 24 ], [ 111, 28 ], [ 31, 30 ], [ 126, 33 ], [ 116, 35 ], [ 116, 44 ], [ 120, 47 ], [ 114, 49 ], [ 57, 52 ], [ 120, 53 ], [ 117, 55 ], [ 123, 61 ], [ 114, 63 ], [ 72, 67 ], [ 120, 68 ], [ 114, 70 ], [ 79, 74 ], [ 123, 75 ], [ 114, 77 ], [ 86, 81 ], [ 123, 82 ], [ 117, 84 ], [ 131, 88 ], [ 92, 91 ], [ 111, 94 ], [ 120, 98 ], [ 91, 99 ], [ 123, 101 ], [ 91, 102 ], [ 128, 104 ], [ 129, 108 ], [ 132, 108 ], [ 125, 111 ], [ 116, 114 ], [ 116, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ], [ 128, 129 ], [ 131, 132 ] ]
[ "n, m = map(int, input().split())\n\ns = [0] * n\ns[0] = 1\nb = [1] * n\nfor i in range(m):\n x, y = map(int, input().split())\n if s[x-1]:\n s[y-1] = 1\n if b[x-1] == 1:\n s[x-1] = 0\n b[x-1] -= 1\n b[y-1] += 1\n\nans = 0\nfor i in range(n):\n if s[i] and b[i]:\n ans += 1\n\nprint(ans)", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "s = [0] * n", "s", "[0] * n", "[0]", "0", "n", "s[0] = 1", "s[0]", "s", "0", "1", "b = [1] * n", "b", "[1] * n", "[1]", "1", "n", "for i in range(m):\n x, y = map(int, input().split())\n if s[x-1]:\n s[y-1] = 1\n if b[x-1] == 1:\n s[x-1] = 0\n b[x-1] -= 1\n b[y-1] += 1", "i", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if s[x-1]:\n s[y-1] = 1\n ", "s[x-1]", "s", "x-1", "x", "1", "s[y-1] = 1", "s[y-1]", "s", "y-1", "y", "1", "1", "if b[x-1] == 1:\n s[x-1] = 0\n ", "b[x-1] == 1", "b[x-1]", "b", "x-1", "x", "1", "1", "s[x-1] = 0", "s[x-1]", "s", "x-1", "x", "1", "0", "b[x-1] -= 1", "b[x-1]", "b", "x-1", "x", "1", "1", "b[y-1] += 1", "b[y-1]", "b", "y-1", "y", "1", "1", "ans = 0", "ans", "0", "for i in range(n):\n if s[i] and b[i]:\n ans += 1", "i", "range(n)", "range", "n", "if s[i] and b[i]:\n ans += 1", "s[i] and b[i]", "s[i]", "s", "i", "b[i]", "b", "i", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "n, m = map(int, input().split())", "map(int, input().split())", "n", "x, y = map(int, input().split())", "map(int, input().split())", "x", "y = map(int, input().split())", "map(int, input().split())", "y", "s = [0] * n", "[0] * n", "s", "b = [1] * n", "[1] * n", "b", "m = map(int, input().split())", "map(int, input().split())", "m", "ans += 1", "1", "ans", "ans = 0", "0", "ans" ]
n, m = map(int, input().split()) s = [0] * n s[0] = 1 b = [1] * n for i in range(m): x, y = map(int, input().split()) if s[x-1]: s[y-1] = 1 if b[x-1] == 1: s[x-1] = 0 b[x-1] -= 1 b[y-1] += 1 ans = 0 for i in range(n): if s[i] and b[i]: ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13, 10, 13, 13 ]
[ [ 106, 2 ], [ 106, 11 ], [ 15, 14 ], [ 107, 18 ], [ 109, 23 ], [ 28, 27 ], [ 107, 31 ], [ 112, 36 ], [ 42, 39 ], [ 110, 40 ], [ 45, 44 ], [ 104, 47 ], [ 100, 49 ], [ 100, 58 ], [ 77, 61 ], [ 110, 62 ], [ 98, 63 ], [ 69, 66 ], [ 110, 67 ], [ 101, 68 ], [ 82, 72 ], [ 113, 73 ], [ 98, 74 ], [ 80, 77 ], [ 110, 78 ], [ 98, 79 ], [ 85, 82 ], [ 113, 83 ], [ 98, 84 ], [ 90, 87 ], [ 113, 88 ], [ 101, 89 ], [ 110, 95 ], [ 100, 98 ], [ 100, 101 ], [ 106, 104 ], [ 106, 107 ], [ 109, 110 ], [ 112, 113 ] ]
[ "n,m=map(int,input().split())\nans=[0 for _ in range(n+1)]\ncnt=[1 for _ in range(n+1)]\nans[1]=1\nfor i in range(m):\n a,b=map(int,input().split())\n if ans[a]==1:\n ans[b]=1\n if cnt[a]==1:\n ans[a]=0\n cnt[a]-=1\n cnt[b]+=1\nprint(sum(ans))", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "0 for _ in range(n+1)", "for _ in range(n+1)", "_", "range(n+1)", "range", "n+1", "n", "1", "for _ in range(n+1)", "0", "ans=[0 for _ in range(n+1)]", "ans", "[0 for _ in range(n+1)]", "1 for _ in range(n+1)", "for _ in range(n+1)", "_", "range(n+1)", "range", "n+1", "n", "1", "for _ in range(n+1)", "1", "cnt=[1 for _ in range(n+1)]", "cnt", "[1 for _ in range(n+1)]", "ans[1]=1", "ans[1]", "ans", "1", "1", "for i in range(m):\n a,b=map(int,input().split())\n if ans[a]==1:\n ans[b]=1\n if cnt[a]==1:\n ans[a]=0\n cnt[a]-=1\n cnt[b]+=1", "i", "range(m)", "range", "m", "a,b=map(int,input().split())", "a", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "if ans[a]==1:\n ans[b]=1\n if cnt[a]==1:\n ans[a]=0\n ", "ans[a]==1", "ans[a]", "ans", "a", "1", "ans[b]=1", "ans[b]", "ans", "b", "1", "if cnt[a]==1:\n ans[a]=0\n ", "cnt[a]==1", "cnt[a]", "cnt", "a", "1", "ans[a]=0", "ans[a]", "ans", "a", "0", "cnt[a]-=1", "cnt[a]", "cnt", "a", "1", "cnt[b]+=1", "cnt[b]", "cnt", "b", "1", "print(sum(ans))", "print", "sum(ans)", "sum", "ans", "a,b=map(int,input().split())", "map(int,input().split())", "a", "b=map(int,input().split())", "map(int,input().split())", "b", "m=map(int,input().split())", "map(int,input().split())", "m", "n,m=map(int,input().split())", "map(int,input().split())", "n", "ans=[0 for _ in range(n+1)]", "[0 for _ in range(n+1)]", "ans", "cnt=[1 for _ in range(n+1)]", "[1 for _ in range(n+1)]", "cnt" ]
n,m=map(int,input().split()) ans=[0 for _ in range(n+1)] cnt=[1 for _ in range(n+1)] ans[1]=1 for i in range(m): a,b=map(int,input().split()) if ans[a]==1: ans[b]=1 if cnt[a]==1: ans[a]=0 cnt[a]-=1 cnt[b]+=1 print(sum(ans))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 39, 17, 13, 0, 13, 2, 2, 39, 17, 39, 17, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 113, 2 ], [ 113, 11 ], [ 107, 13 ], [ 114, 20 ], [ 101, 22 ], [ 114, 33 ], [ 37, 36 ], [ 105, 39 ], [ 116, 41 ], [ 116, 50 ], [ 79, 53 ], [ 102, 54 ], [ 111, 55 ], [ 61, 58 ], [ 108, 59 ], [ 111, 60 ], [ 66, 63 ], [ 108, 64 ], [ 117, 65 ], [ 71, 68 ], [ 102, 69 ], [ 117, 70 ], [ 58, 74 ], [ 84, 74 ], [ 108, 75 ], [ 111, 76 ], [ 82, 79 ], [ 102, 80 ], [ 111, 81 ], [ 87, 84 ], [ 108, 85 ], [ 111, 86 ], [ 92, 89 ], [ 108, 90 ], [ 117, 91 ], [ 102, 97 ], [ 101, 102 ], [ 113, 105 ], [ 107, 108 ], [ 116, 111 ], [ 113, 114 ], [ 116, 117 ] ]
[ "n,m=map(int,input().split())\nkosuu=[0]+[1]*n\nhaitteru=[0]+[1]+[0]*(n-1)\nfor _ in range(m):\n x,y=map(int,input().split())\n if haitteru[x]==1:\n kosuu[x]-=1\n kosuu[y]+=1\n haitteru[y]=1\n if kosuu[x]==0:\n haitteru[x]=0\n else:\n kosuu[x]-=1\n kosuu[y]+=1\nprint(haitteru.count(1))", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "kosuu=[0]+[1]*n", "kosuu", "[0]+[1]*n", "[0]", "0", "[1]*n", "[1]", "1", "n", "haitteru=[0]+[1]+[0]*(n-1)", "haitteru", "[0]+[1]+[0]*(n-1)", "[0]+[1]", "[0]", "0", "[1]", "1", "[0]*(n-1)", "[0]", "0", "n-1", "n", "1", "for _ in range(m):\n x,y=map(int,input().split())\n if haitteru[x]==1:\n kosuu[x]-=1\n kosuu[y]+=1\n haitteru[y]=1\n if kosuu[x]==0:\n haitteru[x]=0\n else:\n kosuu[x]-=1\n kosuu[y]+=1", "_", "range(m)", "range", "m", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if haitteru[x]==1:\n kosuu[x]-=1\n kosuu[y]+=1\n haitteru[y]=1\n if kosuu[x]==0:\n haitteru[x]=0\n else:\n kosuu[x]-=1\n kosuu[y]+=1", "haitteru[x]==1", "haitteru[x]", "haitteru", "x", "1", "kosuu[x]-=1", "kosuu[x]", "kosuu", "x", "1", "kosuu[y]+=1", "kosuu[y]", "kosuu", "y", "1", "haitteru[y]=1", "haitteru[y]", "haitteru", "y", "1", "if kosuu[x]==0:\n haitteru[x]=0\n ", "kosuu[x]==0", "kosuu[x]", "kosuu", "x", "0", "haitteru[x]=0", "haitteru[x]", "haitteru", "x", "0", "kosuu[x]-=1", "kosuu[x]", "kosuu", "x", "1", "kosuu[y]+=1", "kosuu[y]", "kosuu", "y", "1", "print(haitteru.count(1))", "print", "haitteru.count(1)", "haitteru.count", "haitteru", "count", "1", "haitteru=[0]+[1]+[0]*(n-1)", "[0]+[1]+[0]*(n-1)", "haitteru", "m=map(int,input().split())", "map(int,input().split())", "m", "kosuu=[0]+[1]*n", "[0]+[1]*n", "kosuu", "x,y=map(int,input().split())", "map(int,input().split())", "x", "n,m=map(int,input().split())", "map(int,input().split())", "n", "y=map(int,input().split())", "map(int,input().split())", "y" ]
n,m=map(int,input().split()) kosuu=[0]+[1]*n haitteru=[0]+[1]+[0]*(n-1) for _ in range(m): x,y=map(int,input().split()) if haitteru[x]==1: kosuu[x]-=1 kosuu[y]+=1 haitteru[y]=1 if kosuu[x]==0: haitteru[x]=0 else: kosuu[x]-=1 kosuu[y]+=1 print(haitteru.count(1))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 2, 39, 17, 2, 17, 17, 0, 13, 2, 39, 17, 2, 17, 17, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 18, 18, 13, 13, 17, 0, 13, 18, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 18, 13, 10, 4, 13, 10, 2, 13, 10, 18, 13 ]
[ [ 122, 2 ], [ 122, 11 ], [ 15, 14 ], [ 123, 17 ], [ 110, 30 ], [ 116, 33 ], [ 125, 41 ], [ 52, 49 ], [ 126, 50 ], [ 55, 54 ], [ 123, 57 ], [ 128, 59 ], [ 111, 62 ], [ 54, 63 ], [ 119, 66 ], [ 111, 69 ], [ 54, 70 ], [ 100, 74 ], [ 126, 75 ], [ 129, 76 ], [ 82, 79 ], [ 126, 80 ], [ 120, 81 ], [ 87, 84 ], [ 117, 85 ], [ 129, 86 ], [ 92, 89 ], [ 117, 90 ], [ 120, 91 ], [ 84, 95 ], [ 117, 96 ], [ 129, 97 ], [ 103, 100 ], [ 126, 101 ], [ 129, 102 ], [ 126, 108 ], [ 110, 111 ], [ 122, 114 ], [ 116, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ], [ 128, 129 ] ]
[ "n, m = map(int, input().split())\nli = [list(map(int, input().split())) for _ in range(m)]\n\nball_cnt = [1] * 10**6\ncheck = [0] * 10**6\n\ncheck[1] += 1\n\nfor i in range(m):\n x = li[i][0]\n y = li[i][1]\n \n if check[x] == 1:\n check[y] = 1\n \n ball_cnt[x] -= 1\n ball_cnt[y] += 1\n \n if ball_cnt[x] == 0:\n check[x] = 0\n \nprint(sum(check))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "list(map(int, input().split())) for _ in range(m)", "for _ in range(m)", "_", "range(m)", "range", "m", "for _ in range(m)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "li = [list(map(int, input().split())) for _ in range(m)]", "li", "[list(map(int, input().split())) for _ in range(m)]", "ball_cnt = [1] * 10**6", "ball_cnt", "[1] * 10**6", "[1]", "1", "10**6", "10", "6", "check = [0] * 10**6", "check", "[0] * 10**6", "[0]", "0", "10**6", "10", "6", "check[1] += 1", "check[1]", "check", "1", "1", "for i in range(m):\n x = li[i][0]\n y = li[i][1]\n \n if check[x] == 1:\n check[y] = 1\n \n ball_cnt[x] -= 1\n ball_cnt[y] += 1\n \n if ball_cnt[x] == 0:\n check[x] = 0\n ", "i", "range(m)", "range", "m", "x = li[i][0]", "x", "li[i][0]", "[i]", "li", "i", "0", "y = li[i][1]", "y", "li[i][1]", "[i]", "li", "i", "1", "if check[x] == 1:\n check[y] = 1\n \n ", "check[x] == 1", "check[x]", "check", "x", "1", "check[y] = 1", "check[y]", "check", "y", "1", "ball_cnt[x] -= 1", "ball_cnt[x]", "ball_cnt", "x", "1", "ball_cnt[y] += 1", "ball_cnt[y]", "ball_cnt", "y", "1", "if ball_cnt[x] == 0:\n check[x] = 0\n ", "ball_cnt[x] == 0", "ball_cnt[x]", "ball_cnt", "x", "0", "check[x] = 0", "check[x]", "check", "x", "0", "print(sum(check))", "print", "sum(check)", "sum", "check", "li = [list(map(int, input().split())) for _ in range(m)]", "[list(map(int, input().split())) for _ in range(m)]", "li", "n, m = map(int, input().split())", "map(int, input().split())", "n", "ball_cnt = [1] * 10**6", "[1] * 10**6", "ball_cnt", "y = li[i][1]", "li[i][1]", "y", "m = map(int, input().split())", "map(int, input().split())", "m", "check = [0] * 10**6", "[0] * 10**6", "check", "x = li[i][0]", "li[i][0]", "x" ]
n, m = map(int, input().split()) li = [list(map(int, input().split())) for _ in range(m)] ball_cnt = [1] * 10**6 check = [0] * 10**6 check[1] += 1 for i in range(m): x = li[i][0] y = li[i][1] if check[x] == 1: check[y] = 1 ball_cnt[x] -= 1 ball_cnt[y] += 1 if ball_cnt[x] == 0: check[x] = 0 print(sum(check))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 2, 18, 18, 13, 13, 17, 17, 0, 13, 2, 18, 18, 13, 13, 17, 17, 14, 2, 40, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 13, 13, 10, 13, 13, 10, 2, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13 ]
[ [ 168, 2 ], [ 168, 11 ], [ 15, 14 ], [ 148, 17 ], [ 150, 30 ], [ 35, 34 ], [ 169, 37 ], [ 171, 41 ], [ 46, 45 ], [ 169, 48 ], [ 153, 52 ], [ 58, 55 ], [ 154, 56 ], [ 61, 60 ], [ 148, 63 ], [ 162, 65 ], [ 151, 69 ], [ 60, 70 ], [ 156, 74 ], [ 151, 78 ], [ 60, 79 ], [ 117, 85 ], [ 172, 86 ], [ 163, 87 ], [ 112, 90 ], [ 154, 91 ], [ 163, 92 ], [ 98, 95 ], [ 154, 96 ], [ 157, 97 ], [ 117, 102 ], [ 172, 103 ], [ 163, 104 ], [ 112, 107 ], [ 154, 108 ], [ 163, 109 ], [ 115, 112 ], [ 154, 113 ], [ 163, 114 ], [ 120, 117 ], [ 172, 118 ], [ 163, 119 ], [ 125, 122 ], [ 172, 123 ], [ 157, 124 ], [ 165, 127 ], [ 131, 130 ], [ 169, 133 ], [ 154, 137 ], [ 130, 138 ], [ 159, 141 ], [ 160, 145 ], [ 166, 145 ], [ 168, 148 ], [ 150, 151 ], [ 153, 154 ], [ 156, 157 ], [ 159, 160 ], [ 162, 163 ], [ 165, 166 ], [ 168, 169 ], [ 171, 172 ] ]
[ "N, M = map(int, input().split())\nZ = [list(map(int,input().split())) for i in range(M)]\nkosuu = [1 for _ in range(N)]\nred = [False for _ in range(N)]\nred[0] = True\n\nfor i in range(M):\n x = Z[i][0] - 1\n y = Z[i][1] - 1\n if (kosuu[x] != 0 and red[x] == True):\n red[y] = True\n if (kosuu[x] == 1 and red[x] == True):\n red[x] = False\n kosuu[x] -= 1\n kosuu[y] += 1\n\nans = 0\nfor i in range(N):\n if red[i] == True:\n ans+=1\n\nprint(ans)", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "list(map(int,input().split())) for i in range(M)", "for i in range(M)", "i", "range(M)", "range", "M", "for i in range(M)", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "Z = [list(map(int,input().split())) for i in range(M)]", "Z", "[list(map(int,input().split())) for i in range(M)]", "1 for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "1", "kosuu = [1 for _ in range(N)]", "kosuu", "[1 for _ in range(N)]", "False for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "False", "red = [False for _ in range(N)]", "red", "[False for _ in range(N)]", "red[0] = True", "red[0]", "red", "0", "True", "for i in range(M):\n x = Z[i][0] - 1\n y = Z[i][1] - 1\n if (kosuu[x] != 0 and red[x] == True):\n red[y] = True\n if (kosuu[x] == 1 and red[x] == True):\n red[x] = False\n kosuu[x] -= 1\n kosuu[y] += 1", "i", "range(M)", "range", "M", "x = Z[i][0] - 1", "x", "Z[i][0] - 1", "Z[i][0]", "[i]", "Z", "i", "0", "1", "y = Z[i][1] - 1", "y", "Z[i][1] - 1", "Z[i][1]", "[i]", "Z", "i", "1", "1", "if (kosuu[x] != 0 and red[x] == True):\n red[y] = True\n ", "kosuu[x] != 0 and red[x] == True", "kosuu[x] != 0", "kosuu[x]", "kosuu", "x", "0", "red[x] == True", "red[x]", "red", "x", "True", "red[y] = True", "red[y]", "red", "y", "True", "if (kosuu[x] == 1 and red[x] == True):\n red[x] = False\n ", "kosuu[x] == 1 and red[x] == True", "kosuu[x] == 1", "kosuu[x]", "kosuu", "x", "1", "red[x] == True", "red[x]", "red", "x", "True", "red[x] = False", "red[x]", "red", "x", "False", "kosuu[x] -= 1", "kosuu[x]", "kosuu", "x", "1", "kosuu[y] += 1", "kosuu[y]", "kosuu", "y", "1", "ans = 0", "ans", "0", "for i in range(N):\n if red[i] == True:\n ans+=1", "i", "range(N)", "range", "N", "if red[i] == True:\n ans+=1", "red[i] == True", "red[i]", "red", "i", "True", "ans+=1", "ans", "1", "print(ans)", "print", "ans", "M = map(int, input().split())", "map(int, input().split())", "M", "Z = [list(map(int,input().split())) for i in range(M)]", "[list(map(int,input().split())) for i in range(M)]", "Z", "red = [False for _ in range(N)]", "[False for _ in range(N)]", "red", "y = Z[i][1] - 1", "Z[i][1] - 1", "y", "ans+=1", "1", "ans", "x = Z[i][0] - 1", "Z[i][0] - 1", "x", "ans = 0", "0", "ans", "N, M = map(int, input().split())", "map(int, input().split())", "N", "kosuu = [1 for _ in range(N)]", "[1 for _ in range(N)]", "kosuu" ]
N, M = map(int, input().split()) Z = [list(map(int,input().split())) for i in range(M)] kosuu = [1 for _ in range(N)] red = [False for _ in range(N)] red[0] = True for i in range(M): x = Z[i][0] - 1 y = Z[i][1] - 1 if (kosuu[x] != 0 and red[x] == True): red[y] = True if (kosuu[x] == 1 and red[x] == True): red[x] = False kosuu[x] -= 1 kosuu[y] += 1 ans = 0 for i in range(N): if red[i] == True: ans+=1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 18, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 117, 2 ], [ 117, 11 ], [ 120, 13 ], [ 106, 17 ], [ 108, 19 ], [ 106, 23 ], [ 28, 25 ], [ 109, 26 ], [ 31, 30 ], [ 118, 33 ], [ 114, 35 ], [ 114, 44 ], [ 102, 46 ], [ 111, 49 ], [ 121, 53 ], [ 103, 54 ], [ 115, 54 ], [ 79, 57 ], [ 109, 58 ], [ 103, 59 ], [ 115, 59 ], [ 65, 62 ], [ 109, 63 ], [ 112, 64 ], [ 100, 64 ], [ 84, 68 ], [ 121, 69 ], [ 103, 70 ], [ 115, 70 ], [ 79, 74 ], [ 109, 75 ], [ 103, 76 ], [ 115, 76 ], [ 82, 79 ], [ 109, 80 ], [ 103, 81 ], [ 115, 81 ], [ 87, 84 ], [ 121, 85 ], [ 103, 86 ], [ 115, 86 ], [ 92, 89 ], [ 121, 90 ], [ 112, 91 ], [ 100, 91 ], [ 109, 97 ], [ 114, 100 ], [ 102, 103 ], [ 117, 106 ], [ 108, 109 ], [ 111, 112 ], [ 114, 115 ], [ 117, 118 ], [ 120, 121 ] ]
[ "n, m = map(int, input().split())\nbox = [1] * n\nred = [0] * n\nred[0] = 1\nfor i in range(m):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n\n if box[a]:\n if red[a] == 1:\n red[b] = 1\n\n if box[a] == 1:\n if red[a] == 1:\n red[a] = 0\n\n box[a] -= 1\n box[b] += 1\n\nprint(sum(red))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "box = [1] * n", "box", "[1] * n", "[1]", "1", "n", "red = [0] * n", "red", "[0] * n", "[0]", "0", "n", "red[0] = 1", "red[0]", "red", "0", "1", "for i in range(m):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n\n if box[a]:\n if red[a] == 1:\n red[b] = 1\n\n if box[a] == 1:\n if red[a] == 1:\n red[a] = 0\n\n box[a] -= 1\n box[b] += 1", "i", "range(m)", "range", "m", "a, b = map(int, input().split())", "a", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "a -= 1", "a", "1", "b -= 1", "b", "1", "if box[a]:\n if red[a] == 1:\n red[b] = 1\n\n if box[a] == 1:\n if red[a] == 1:\n red[a] = 0\n\n box[a] -= 1\n box[b] += 1", "box[a]", "box", "a", "if red[a] == 1:\n red[b] = 1\n\n ", "red[a] == 1", "red[a]", "red", "a", "1", "red[b] = 1", "red[b]", "red", "b", "1", "if box[a] == 1:\n if red[a] == 1:\n red[a] = 0\n\n ", "box[a] == 1", "box[a]", "box", "a", "1", "if red[a] == 1:\n red[a] = 0\n\n ", "red[a] == 1", "red[a]", "red", "a", "1", "red[a] = 0", "red[a]", "red", "a", "0", "box[a] -= 1", "box[a]", "box", "a", "1", "box[b] += 1", "box[b]", "box", "b", "1", "print(sum(red))", "print", "sum(red)", "sum", "red", "b = map(int, input().split())", "map(int, input().split())", "b", "a -= 1", "1", "a", "n, m = map(int, input().split())", "map(int, input().split())", "n", "red = [0] * n", "[0] * n", "red", "b -= 1", "1", "b", "a, b = map(int, input().split())", "map(int, input().split())", "a", "m = map(int, input().split())", "map(int, input().split())", "m", "box = [1] * n", "[1] * n", "box" ]
n, m = map(int, input().split()) box = [1] * n red = [0] * n red[0] = 1 for i in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 if box[a]: if red[a] == 1: red[b] = 1 if box[a] == 1: if red[a] == 1: red[a] = 0 box[a] -= 1 box[b] += 1 print(sum(red))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 2, 13, 17, 14, 2, 18, 13, 13, 40, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 128, 2 ], [ 128, 11 ], [ 113, 13 ], [ 129, 18 ], [ 125, 21 ], [ 129, 26 ], [ 32, 29 ], [ 114, 30 ], [ 35, 34 ], [ 111, 37 ], [ 122, 39 ], [ 122, 48 ], [ 53, 50 ], [ 126, 51 ], [ 123, 52 ], [ 58, 55 ], [ 126, 56 ], [ 120, 57 ], [ 114, 61 ], [ 123, 62 ], [ 67, 64 ], [ 114, 65 ], [ 120, 66 ], [ 50, 70 ], [ 126, 71 ], [ 123, 72 ], [ 78, 75 ], [ 114, 76 ], [ 123, 77 ], [ 107, 80 ], [ 84, 83 ], [ 129, 88 ], [ 114, 93 ], [ 83, 94 ], [ 126, 97 ], [ 83, 98 ], [ 116, 101 ], [ 117, 105 ], [ 108, 105 ], [ 107, 108 ], [ 128, 111 ], [ 113, 114 ], [ 116, 117 ], [ 122, 120 ], [ 122, 123 ], [ 125, 126 ], [ 128, 129 ] ]
[ "n, m = map(int, input().split())\nused = [False] * (n+1)\nball = [1] * (n+1)\nused[1] = True\nfor _ in range(m):\n x,y = map(int, input().split())\n ball[x] -= 1\n ball[y] += 1\n if used[x]:\n used[y] = True\n if ball[x] == 0:\n used[x] = False\nres = 0\nfor i in range(1, n + 1):\n if used[i] and ball[i] != 0:\n res += 1\nprint(res)\n#print(ball)\n#print(used)", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "used = [False] * (n+1)", "used", "[False] * (n+1)", "[False]", "False", "n+1", "n", "1", "ball = [1] * (n+1)", "ball", "[1] * (n+1)", "[1]", "1", "n+1", "n", "1", "used[1] = True", "used[1]", "used", "1", "True", "for _ in range(m):\n x,y = map(int, input().split())\n ball[x] -= 1\n ball[y] += 1\n if used[x]:\n used[y] = True\n if ball[x] == 0:\n used[x] = False", "_", "range(m)", "range", "m", "x,y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "ball[x] -= 1", "ball[x]", "ball", "x", "1", "ball[y] += 1", "ball[y]", "ball", "y", "1", "if used[x]:\n used[y] = True\n ", "used[x]", "used", "x", "used[y] = True", "used[y]", "used", "y", "True", "if ball[x] == 0:\n used[x] = False", "ball[x] == 0", "ball[x]", "ball", "x", "0", "used[x] = False", "used[x]", "used", "x", "False", "res = 0", "res", "0", "for i in range(1, n + 1):\n if used[i] and ball[i] != 0:\n res += 1", "i", "range(1, n + 1)", "range", "1", "n + 1", "n", "1", "if used[i] and ball[i] != 0:\n res += 1", "used[i] and ball[i] != 0", "used[i]", "used", "i", "ball[i] != 0", "ball[i]", "ball", "i", "0", "res += 1", "res", "1", "print(res)", "print", "res", "res = 0", "0", "res", "m = map(int, input().split())", "map(int, input().split())", "m", "used = [False] * (n+1)", "[False] * (n+1)", "used", "res += 1", "1", "res", "y = map(int, input().split())", "map(int, input().split())", "y", "x,y = map(int, input().split())", "map(int, input().split())", "x", "ball = [1] * (n+1)", "[1] * (n+1)", "ball", "n, m = map(int, input().split())", "map(int, input().split())", "n" ]
n, m = map(int, input().split()) used = [False] * (n+1) ball = [1] * (n+1) used[1] = True for _ in range(m): x,y = map(int, input().split()) ball[x] -= 1 ball[y] += 1 if used[x]: used[y] = True if ball[x] == 0: used[x] = False res = 0 for i in range(1, n + 1): if used[i] and ball[i] != 0: res += 1 print(res) #print(ball) #print(used)
[ 7, 15, 13, 12, 13, 12, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 9, 8 ], [ 124, 15 ], [ 9, 17 ], [ 20, 19 ], [ 8, 23 ], [ 26, 25 ], [ 8, 29 ], [ 34, 31 ], [ 25, 32 ], [ 37, 36 ], [ 17, 39 ], [ 42, 41 ], [ 124, 48 ], [ 42, 50 ], [ 53, 52 ], [ 56, 55 ], [ 64, 59 ], [ 88, 59 ], [ 19, 60 ], [ 52, 61 ], [ 41, 61 ], [ 67, 64 ], [ 19, 65 ], [ 52, 66 ], [ 41, 66 ], [ 72, 69 ], [ 19, 70 ], [ 55, 71 ], [ 50, 71 ], [ 25, 75 ], [ 52, 76 ], [ 41, 76 ], [ 81, 78 ], [ 25, 79 ], [ 52, 80 ], [ 41, 80 ], [ 86, 83 ], [ 25, 84 ], [ 55, 85 ], [ 50, 85 ], [ 91, 88 ], [ 19, 89 ], [ 52, 90 ], [ 41, 90 ], [ 96, 93 ], [ 19, 94 ], [ 55, 95 ], [ 50, 95 ], [ 25, 99 ], [ 52, 100 ], [ 41, 100 ], [ 105, 102 ], [ 25, 103 ], [ 55, 104 ], [ 50, 104 ], [ 25, 110 ], [ 121, 118 ] ]
[ "import sys\ndef input(): return sys.stdin.readline().rstrip()\ndef main():\n n,m=map(int,input().split())\n lis=[1]*n\n rlis=[False]*n\n rlis[0]=True\n for i in range(m):\n x,y=map(int,input().split())\n x-=1\n y-=1\n if lis[x]==1:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[x]=False\n rlis[y]=True\n else:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[y]=True\n print(rlis.count(True))\n\n\nif __name__=='__main__':\n main()", "import sys", "sys", "def input(): return sys.stdin.readline().rstrip()", "input", "def main():\n n,m=map(int,input().split())\n lis=[1]*n\n rlis=[False]*n\n rlis[0]=True\n for i in range(m):\n x,y=map(int,input().split())\n x-=1\n y-=1\n if lis[x]==1:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[x]=False\n rlis[y]=True\n else:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[y]=True\n print(rlis.count(True))", "main", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "lis=[1]*n", "lis", "[1]*n", "[1]", "1", "n", "rlis=[False]*n", "rlis", "[False]*n", "[False]", "False", "n", "rlis[0]=True", "rlis[0]", "rlis", "0", "True", "for i in range(m):\n x,y=map(int,input().split())\n x-=1\n y-=1\n if lis[x]==1:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[x]=False\n rlis[y]=True\n else:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[y]=True\n ", "i", "range(m)", "range", "m", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x-=1", "x", "1", "y-=1", "y", "1", "if lis[x]==1:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[x]=False\n rlis[y]=True\n else:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[y]=True\n ", "lis[x]==1", "lis[x]", "lis", "x", "1", "lis[x]-=1", "lis[x]", "lis", "x", "1", "lis[y]+=1", "lis[y]", "lis", "y", "1", "if rlis[x]:\n rlis[x]=False\n rlis[y]=True\n ", "rlis[x]", "rlis", "x", "rlis[x]=False", "rlis[x]", "rlis", "x", "False", "rlis[y]=True", "rlis[y]", "rlis", "y", "True", "lis[x]-=1", "lis[x]", "lis", "x", "1", "lis[y]+=1", "lis[y]", "lis", "y", "1", "if rlis[x]:\n rlis[y]=True\n ", "rlis[x]", "rlis", "x", "rlis[y]=True", "rlis[y]", "rlis", "y", "True", "print(rlis.count(True))", "print", "rlis.count(True)", "rlis.count", "rlis", "count", "True", "if __name__=='__main__':\n main()", "__name__=='__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n n,m=map(int,input().split())\n lis=[1]*n\n rlis=[False]*n\n rlis[0]=True\n for i in range(m):\n x,y=map(int,input().split())\n x-=1\n y-=1\n if lis[x]==1:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[x]=False\n rlis[y]=True\n else:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[y]=True\n print(rlis.count(True))", "def main():\n n,m=map(int,input().split())\n lis=[1]*n\n rlis=[False]*n\n rlis[0]=True\n for i in range(m):\n x,y=map(int,input().split())\n x-=1\n y-=1\n if lis[x]==1:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[x]=False\n rlis[y]=True\n else:\n lis[x]-=1\n lis[y]+=1\n if rlis[x]:\n rlis[y]=True\n print(rlis.count(True))", "main", "def input(): return sys.stdin.readline().rstrip()", "def input(): return sys.stdin.readline().rstrip()", "input" ]
import sys def input(): return sys.stdin.readline().rstrip() def main(): n,m=map(int,input().split()) lis=[1]*n rlis=[False]*n rlis[0]=True for i in range(m): x,y=map(int,input().split()) x-=1 y-=1 if lis[x]==1: lis[x]-=1 lis[y]+=1 if rlis[x]: rlis[x]=False rlis[y]=True else: lis[x]-=1 lis[y]+=1 if rlis[x]: rlis[y]=True print(rlis.count(True)) if __name__=='__main__': main()
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 17, 2, 13, 17, 4, 17, 0, 13, 2, 39, 17, 13, 0, 13, 4, 13, 4, 18, 13, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 18, 13, 13, 13, 14, 2, 18, 13, 13, 17, 4, 18, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 115, 2 ], [ 115, 11 ], [ 15, 14 ], [ 101, 19 ], [ 112, 24 ], [ 106, 30 ], [ 107, 35 ], [ 40, 39 ], [ 116, 42 ], [ 109, 44 ], [ 109, 53 ], [ 110, 56 ], [ 107, 57 ], [ 62, 59 ], [ 113, 60 ], [ 110, 61 ], [ 67, 64 ], [ 113, 65 ], [ 104, 66 ], [ 107, 70 ], [ 104, 72 ], [ 59, 75 ], [ 85, 75 ], [ 113, 76 ], [ 110, 77 ], [ 107, 81 ], [ 110, 83 ], [ 88, 85 ], [ 113, 86 ], [ 110, 87 ], [ 93, 90 ], [ 113, 91 ], [ 104, 92 ], [ 107, 98 ], [ 115, 101 ], [ 109, 104 ], [ 106, 107 ], [ 109, 110 ], [ 112, 113 ], [ 115, 116 ] ]
[ "N,M = map(int, input().split())\n\nballs_in_box = [0] + [1 for _ in range(1,N+1)]\nred_ball_containable_box = set()\nred_ball_containable_box.add(1)\n\nfor i in range(M):\n x,y = map(int, input().split())\n if x in red_ball_containable_box:\n balls_in_box[x] -= 1\n balls_in_box[y] += 1\n red_ball_containable_box.add(y)\n if balls_in_box[x] == 0: #赤玉が入っている可能性が100%の箱を全部空にすれば確実に移る\n red_ball_containable_box.remove(x)\n else:\n balls_in_box[x] -= 1\n balls_in_box[y] += 1\n\nprint(len(red_ball_containable_box))", "N,M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "1 for _ in range(1,N+1)", "for _ in range(1,N+1)", "_", "range(1,N+1)", "range", "1", "N+1", "N", "1", "for _ in range(1,N+1)", "1", "balls_in_box = [0] + [1 for _ in range(1,N+1)]", "balls_in_box", "[0] + [1 for _ in range(1,N+1)]", "[0]", "0", "[1 for _ in range(1,N+1)]", "red_ball_containable_box = set()", "red_ball_containable_box", "set()", "set", "red_ball_containable_box.add(1)", "red_ball_containable_box.add", "red_ball_containable_box", "add", "1", "for i in range(M):\n x,y = map(int, input().split())\n if x in red_ball_containable_box:\n balls_in_box[x] -= 1\n balls_in_box[y] += 1\n red_ball_containable_box.add(y)\n if balls_in_box[x] == 0: #赤玉が入っている可能性が100%の箱を全部空にすれば確実に移る\n red_ball_containable_box.remove(x)\n else:\n balls_in_box[x] -= 1\n balls_in_box[y] += 1", "i", "range(M)", "range", "M", "x,y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if x in red_ball_containable_box:\n balls_in_box[x] -= 1\n balls_in_box[y] += 1\n red_ball_containable_box.add(y)\n if balls_in_box[x] == 0: #赤玉が入っている可能性が100%の箱を全部空にすれば確実に移る\n red_ball_containable_box.remove(x)\n else:\n balls_in_box[x] -= 1\n balls_in_box[y] += 1", "x in red_ball_containable_box", "x", "red_ball_containable_box", "balls_in_box[x] -= 1", "balls_in_box[x]", "balls_in_box", "x", "1", "balls_in_box[y] += 1", "balls_in_box[y]", "balls_in_box", "y", "1", "red_ball_containable_box.add(y)", "red_ball_containable_box.add", "red_ball_containable_box", "add", "y", "if balls_in_box[x] == 0: #赤玉が入っている可能性が100%の箱を全部空にすれば確実に移る\n red_ball_containable_box.remove(x)\n ", "balls_in_box[x] == 0", "balls_in_box[x]", "balls_in_box", "x", "0", "red_ball_containable_box.remove(x)", "red_ball_containable_box.remove", "red_ball_containable_box", "remove", "x", "balls_in_box[x] -= 1", "balls_in_box[x]", "balls_in_box", "x", "1", "balls_in_box[y] += 1", "balls_in_box[y]", "balls_in_box", "y", "1", "print(len(red_ball_containable_box))", "print", "len(red_ball_containable_box)", "len", "red_ball_containable_box", "N,M = map(int, input().split())", "map(int, input().split())", "N", "y = map(int, input().split())", "map(int, input().split())", "y", "red_ball_containable_box = set()", "set()", "red_ball_containable_box", "x,y = map(int, input().split())", "map(int, input().split())", "x", "balls_in_box = [0] + [1 for _ in range(1,N+1)]", "[0] + [1 for _ in range(1,N+1)]", "balls_in_box", "M = map(int, input().split())", "map(int, input().split())", "M" ]
N,M = map(int, input().split()) balls_in_box = [0] + [1 for _ in range(1,N+1)] red_ball_containable_box = set() red_ball_containable_box.add(1) for i in range(M): x,y = map(int, input().split()) if x in red_ball_containable_box: balls_in_box[x] -= 1 balls_in_box[y] += 1 red_ball_containable_box.add(y) if balls_in_box[x] == 0: #赤玉が入っている可能性が100%の箱を全部空にすれば確実に移る red_ball_containable_box.remove(x) else: balls_in_box[x] -= 1 balls_in_box[y] += 1 print(len(red_ball_containable_box))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 41, 28, 13, 13, 2, 13, 17, 4, 13, 0, 13, 4, 13, 13, 4, 13, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 122, 2 ], [ 122, 11 ], [ 125, 13 ], [ 123, 17 ], [ 110, 19 ], [ 123, 27 ], [ 31, 30 ], [ 117, 33 ], [ 113, 35 ], [ 113, 44 ], [ 111, 48 ], [ 114, 50 ], [ 59, 54 ], [ 111, 55 ], [ 108, 57 ], [ 66, 61 ], [ 126, 62 ], [ 114, 64 ], [ 73, 68 ], [ 126, 69 ], [ 108, 71 ], [ 126, 77 ], [ 114, 79 ], [ 88, 83 ], [ 111, 84 ], [ 114, 86 ], [ 92, 91 ], [ 111, 91 ], [ 91, 94 ], [ 91, 97 ], [ 119, 99 ], [ 120, 105 ], [ 113, 108 ], [ 110, 111 ], [ 113, 114 ], [ 122, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ] ]
[ "n, m = map(int, input().split())\n\n# ボール個数、赤いボールがある可能性を管理\nb = [1] * n\nred = [1] + [0] * (n - 1)\n\nfor i in range(m):\n x, y = map(int, input().split())\n\n # 移す元に赤いボールがある可能性があれば、移す先に赤いボールが渡る可能性がある\n if red[x - 1] == 1:\n red[y - 1] = 1\n\n # ボール数の足し引き\n b[x - 1] -= 1\n b[y - 1] += 1\n\n # xのボールが0になったら赤いボールがある可能性が消える\n if b[x - 1] == 0:\n red[x - 1] = 0\n\nans = len([x for x in red if x > 0])\n\nprint(ans)", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "b = [1] * n", "b", "[1] * n", "[1]", "1", "n", "red = [1] + [0] * (n - 1)", "red", "[1] + [0] * (n - 1)", "[1]", "1", "[0] * (n - 1)", "[0]", "0", "n - 1", "n", "1", "for i in range(m):\n x, y = map(int, input().split())\n\n # 移す元に赤いボールがある可能性があれば、移す先に赤いボールが渡る可能性がある\n if red[x - 1] == 1:\n red[y - 1] = 1\n\n # ボール数の足し引き\n b[x - 1] -= 1\n b[y - 1] += 1\n\n # xのボールが0になったら赤いボールがある可能性が消える\n if b[x - 1] == 0:\n red[x - 1] = 0", "i", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if red[x - 1] == 1:\n red[y - 1] = 1\n\n # ボール数の足し引き\n ", "red[x - 1] == 1", "red[x - 1]", "red", "x - 1", "x", "1", "1", "red[y - 1] = 1", "red[y - 1]", "red", "y - 1", "y", "1", "1", "b[x - 1] -= 1", "b[x - 1]", "b", "x - 1", "x", "1", "1", "b[y - 1] += 1", "b[y - 1]", "b", "y - 1", "y", "1", "1", "if b[x - 1] == 0:\n red[x - 1] = 0", "b[x - 1] == 0", "b[x - 1]", "b", "x - 1", "x", "1", "0", "red[x - 1] = 0", "red[x - 1]", "red", "x - 1", "x", "1", "0", "x for x in red if x > 0", "for x in red if x > 0", "x", "red", "x > 0", "x", "0", "if x > 0", "x", "ans = len([x for x in red if x > 0])", "ans", "len([x for x in red if x > 0])", "len", "[x for x in red if x > 0]", "print(ans)", "print", "ans", "y = map(int, input().split())", "map(int, input().split())", "y", "red = [1] + [0] * (n - 1)", "[1] + [0] * (n - 1)", "red", "x, y = map(int, input().split())", "map(int, input().split())", "x", "m = map(int, input().split())", "map(int, input().split())", "m", "ans = len([x for x in red if x > 0])", "len([x for x in red if x > 0])", "ans", "n, m = map(int, input().split())", "map(int, input().split())", "n", "b = [1] * n", "[1] * n", "b" ]
n, m = map(int, input().split()) # ボール個数、赤いボールがある可能性を管理 b = [1] * n red = [1] + [0] * (n - 1) for i in range(m): x, y = map(int, input().split()) # 移す元に赤いボールがある可能性があれば、移す先に赤いボールが渡る可能性がある if red[x - 1] == 1: red[y - 1] = 1 # ボール数の足し引き b[x - 1] -= 1 b[y - 1] += 1 # xのボールが0になったら赤いボールがある可能性が消える if b[x - 1] == 0: red[x - 1] = 0 ans = len([x for x in red if x > 0]) print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 13, 0, 13, 13, 4, 13, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13 ]
[ [ 112, 2 ], [ 112, 11 ], [ 118, 13 ], [ 113, 17 ], [ 97, 19 ], [ 113, 23 ], [ 28, 25 ], [ 98, 26 ], [ 31, 30 ], [ 107, 33 ], [ 115, 35 ], [ 115, 44 ], [ 109, 46 ], [ 94, 49 ], [ 98, 53 ], [ 110, 54 ], [ 101, 54 ], [ 59, 56 ], [ 98, 57 ], [ 95, 58 ], [ 116, 58 ], [ 64, 61 ], [ 119, 62 ], [ 110, 63 ], [ 101, 63 ], [ 69, 66 ], [ 119, 67 ], [ 95, 68 ], [ 116, 68 ], [ 61, 72 ], [ 119, 73 ], [ 110, 74 ], [ 101, 74 ], [ 80, 77 ], [ 98, 78 ], [ 110, 79 ], [ 101, 79 ], [ 121, 82 ], [ 86, 85 ], [ 98, 85 ], [ 103, 88 ], [ 85, 89 ], [ 104, 92 ], [ 122, 92 ], [ 94, 95 ], [ 97, 98 ], [ 115, 101 ], [ 85, 103 ], [ 103, 104 ], [ 112, 107 ], [ 109, 110 ], [ 112, 113 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ] ]
[ "n, m = map(int, input().split())\nnum = [1] * n\nred = [False] * n\nred[0] = True\nfor _ in range(m):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n if red[x]:\n red[y] = True\n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = False\nans = 0\nfor r in red:\n ans += r\nprint(ans)", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "num = [1] * n", "num", "[1] * n", "[1]", "1", "n", "red = [False] * n", "red", "[False] * n", "[False]", "False", "n", "red[0] = True", "red[0]", "red", "0", "True", "for _ in range(m):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n if red[x]:\n red[y] = True\n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = False", "_", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "if red[x]:\n red[y] = True\n ", "red[x]", "red", "x", "red[y] = True", "red[y]", "red", "y", "True", "num[x] -= 1", "num[x]", "num", "x", "1", "num[y] += 1", "num[y]", "num", "y", "1", "if num[x] == 0:\n red[x] = False", "num[x] == 0", "num[x]", "num", "x", "0", "red[x] = False", "red[x]", "red", "x", "False", "ans = 0", "ans", "0", "for r in red:\n ans += r", "r", "red", "ans += r", "ans", "r", "print(ans)", "print", "ans", "y -= 1", "1", "y", "red = [False] * n", "[False] * n", "red", "x, y = map(int, input().split())", "map(int, input().split())", "x", "ans += r", "r", "ans", "m = map(int, input().split())", "map(int, input().split())", "m", "x -= 1", "1", "x", "n, m = map(int, input().split())", "map(int, input().split())", "n", "y = map(int, input().split())", "map(int, input().split())", "y", "num = [1] * n", "[1] * n", "num", "ans = 0", "0", "ans" ]
n, m = map(int, input().split()) num = [1] * n red = [False] * n red[0] = True for _ in range(m): x, y = map(int, input().split()) x -= 1 y -= 1 if red[x]: red[y] = True num[x] -= 1 num[y] += 1 if num[x] == 0: red[x] = False ans = 0 for r in red: ans += r print(ans)
[ 7, 15, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 39, 17, 17, 0, 13, 13, 0, 18, 18, 13, 17, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 2, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 14, 2, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 18, 13, 13, 17, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 147, 4 ], [ 147, 13 ], [ 17, 16 ], [ 127, 19 ], [ 135, 25 ], [ 33, 28 ], [ 136, 30 ], [ 36, 35 ], [ 148, 38 ], [ 141, 40 ], [ 141, 49 ], [ 132, 51 ], [ 144, 54 ], [ 136, 60 ], [ 133, 61 ], [ 139, 61 ], [ 70, 65 ], [ 136, 67 ], [ 145, 68 ], [ 142, 68 ], [ 77, 72 ], [ 136, 74 ], [ 145, 75 ], [ 142, 75 ], [ 84, 79 ], [ 136, 81 ], [ 133, 82 ], [ 139, 82 ], [ 136, 89 ], [ 133, 90 ], [ 139, 90 ], [ 99, 94 ], [ 136, 96 ], [ 133, 97 ], [ 139, 97 ], [ 123, 101 ], [ 105, 104 ], [ 127, 107 ], [ 136, 112 ], [ 104, 113 ], [ 129, 117 ], [ 130, 121 ], [ 124, 121 ], [ 123, 124 ], [ 147, 127 ], [ 129, 130 ], [ 132, 133 ], [ 135, 136 ], [ 141, 139 ], [ 141, 142 ], [ 144, 145 ], [ 147, 148 ] ]
[ "import collections\nn,m = map(int,input().split())\nbox = [[1,\"white\"] for i in range(n)]\nbox[0][1] = \"red\"\nfor i in range(m):\n x,y = map(int,input().split())\n x -= 1\n y -= 1\n if box[x][1] == \"red\":\n box[y][1] = \"red\"\n box[y][0] += 1\n box[x][0] -= 1\n if box[x][0] == 0:\n box[x][1] = \"white\"\nans = 0\nfor i in range(n):\n if box[i][1] == \"red\":\n ans += 1\nprint(ans)", "import collections", "collections", "n,m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "[1,\"white\"] for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "[1,\"white\"]", "1", "\"white\"", "box = [[1,\"white\"] for i in range(n)]", "box", "[[1,\"white\"] for i in range(n)]", "box[0][1] = \"red\"", "box[0][1]", "[0]", "box", "0", "1", "\"red\"", "for i in range(m):\n x,y = map(int,input().split())\n x -= 1\n y -= 1\n if box[x][1] == \"red\":\n box[y][1] = \"red\"\n box[y][0] += 1\n box[x][0] -= 1\n if box[x][0] == 0:\n box[x][1] = \"white\"", "i", "range(m)", "range", "m", "x,y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "if box[x][1] == \"red\":\n box[y][1] = \"red\"\n ", "box[x][1] == \"red\"", "box[x][1]", "[x]", "box", "x", "1", "\"red\"", "box[y][1] = \"red\"", "box[y][1]", "[y]", "box", "y", "1", "\"red\"", "box[y][0] += 1", "box[y][0]", "[y]", "box", "y", "0", "1", "box[x][0] -= 1", "box[x][0]", "[x]", "box", "x", "0", "1", "if box[x][0] == 0:\n box[x][1] = \"white\"", "box[x][0] == 0", "box[x][0]", "[x]", "box", "x", "0", "0", "box[x][1] = \"white\"", "box[x][1]", "[x]", "box", "x", "1", "\"white\"", "ans = 0", "ans", "0", "for i in range(n):\n if box[i][1] == \"red\":\n ans += 1", "i", "range(n)", "range", "n", "if box[i][1] == \"red\":\n ans += 1", "box[i][1] == \"red\"", "box[i][1]", "[i]", "box", "i", "1", "\"red\"", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "ans = 0", "0", "ans", "n,m = map(int,input().split())", "map(int,input().split())", "n", "ans += 1", "1", "ans", "x -= 1", "1", "x", "box = [[1,\"white\"] for i in range(n)]", "[[1,\"white\"] for i in range(n)]", "box", "x,y = map(int,input().split())", "map(int,input().split())", "x", "y = map(int,input().split())", "map(int,input().split())", "y", "y -= 1", "1", "y", "m = map(int,input().split())", "map(int,input().split())", "m" ]
import collections n,m = map(int,input().split()) box = [[1,"white"] for i in range(n)] box[0][1] = "red" for i in range(m): x,y = map(int,input().split()) x -= 1 y -= 1 if box[x][1] == "red": box[y][1] = "red" box[y][0] += 1 box[x][0] -= 1 if box[x][0] == 0: box[x][1] = "white" ans = 0 for i in range(n): if box[i][1] == "red": ans += 1 print(ans)
[ 7, 12, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 39, 0, 13, 39, 28, 13, 4, 13, 2, 13, 17, 4, 18, 13, 13, 17, 4, 18, 13, 13, 17, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 29, 4, 13, 13, 4, 13, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 5, 13 ], [ 16, 15 ], [ 19, 18 ], [ 22, 21 ], [ 4, 25 ], [ 15, 29 ], [ 18, 34 ], [ 41, 38 ], [ 18, 39 ], [ 44, 43 ], [ 13, 46 ], [ 49, 48 ], [ 49, 57 ], [ 86, 60 ], [ 18, 61 ], [ 48, 62 ], [ 68, 65 ], [ 18, 66 ], [ 57, 67 ], [ 73, 70 ], [ 15, 71 ], [ 48, 72 ], [ 78, 75 ], [ 15, 76 ], [ 57, 77 ], [ 70, 81 ], [ 15, 82 ], [ 48, 83 ], [ 89, 86 ], [ 18, 87 ], [ 48, 88 ], [ 18, 93 ], [ 100, 97 ] ]
[ "def solve():\n N, M = map(int, input().split())\n \n num = []\n red = []\n for i in range(N+1):\n num.append(1)\n red.append(0)\n red[1] = 1\n \n for _ in range(M):\n x, y = map(int, input().split())\n if red[x] == 1:\n red[y] = 1\n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n \n return sum(red)\n\nprint(solve())", "def solve():\n N, M = map(int, input().split())\n \n num = []\n red = []\n for i in range(N+1):\n num.append(1)\n red.append(0)\n red[1] = 1\n \n for _ in range(M):\n x, y = map(int, input().split())\n if red[x] == 1:\n red[y] = 1\n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n \n return sum(red)", "solve", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "num = []", "num", "[]", "red = []", "red", "[]", "for i in range(N+1):\n num.append(1)\n red.append(0)\n ", "i", "range(N+1)", "range", "N+1", "N", "1", "num.append(1)", "num.append", "num", "append", "1", "red.append(0)", "red.append", "red", "append", "0", "red[1] = 1", "red[1]", "red", "1", "1", "for _ in range(M):\n x, y = map(int, input().split())\n if red[x] == 1:\n red[y] = 1\n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n \n ", "_", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if red[x] == 1:\n red[y] = 1\n ", "red[x] == 1", "red[x]", "red", "x", "1", "red[y] = 1", "red[y]", "red", "y", "1", "num[x] -= 1", "num[x]", "num", "x", "1", "num[y] += 1", "num[y]", "num", "y", "1", "if num[x] == 0:\n red[x] = 0\n \n ", "num[x] == 0", "num[x]", "num", "x", "0", "red[x] = 0", "red[x]", "red", "x", "0", "return sum(red)", "sum(red)", "sum", "red", "print(solve())", "print", "solve()", "solve", "def solve():\n N, M = map(int, input().split())\n \n num = []\n red = []\n for i in range(N+1):\n num.append(1)\n red.append(0)\n red[1] = 1\n \n for _ in range(M):\n x, y = map(int, input().split())\n if red[x] == 1:\n red[y] = 1\n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n \n return sum(red)", "def solve():\n N, M = map(int, input().split())\n \n num = []\n red = []\n for i in range(N+1):\n num.append(1)\n red.append(0)\n red[1] = 1\n \n for _ in range(M):\n x, y = map(int, input().split())\n if red[x] == 1:\n red[y] = 1\n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n \n return sum(red)", "solve" ]
def solve(): N, M = map(int, input().split()) num = [] red = [] for i in range(N+1): num.append(1) red.append(0) red[1] = 1 for _ in range(M): x, y = map(int, input().split()) if red[x] == 1: red[y] = 1 num[x] -= 1 num[y] += 1 if num[x] == 0: red[x] = 0 return sum(red) print(solve())
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 10, 17, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 110, 2 ], [ 110, 11 ], [ 92, 13 ], [ 111, 17 ], [ 95, 19 ], [ 111, 23 ], [ 28, 25 ], [ 96, 26 ], [ 31, 30 ], [ 102, 33 ], [ 107, 35 ], [ 107, 44 ], [ 89, 46 ], [ 98, 49 ], [ 55, 52 ], [ 93, 53 ], [ 90, 54 ], [ 108, 54 ], [ 60, 57 ], [ 93, 58 ], [ 99, 59 ], [ 105, 59 ], [ 96, 63 ], [ 90, 64 ], [ 108, 64 ], [ 52, 67 ], [ 93, 68 ], [ 90, 69 ], [ 108, 69 ], [ 75, 72 ], [ 96, 73 ], [ 90, 74 ], [ 108, 74 ], [ 80, 77 ], [ 96, 78 ], [ 99, 79 ], [ 105, 79 ], [ 96, 85 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ], [ 110, 102 ], [ 107, 105 ], [ 107, 108 ], [ 110, 111 ] ]
[ "n, m = map(int, input().split())\na = [1]*n\nans_box = [False]*n\nans_box[0] = True\nfor _ in range(m):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n a[x] -= 1\n a[y] += 1\n if ans_box[x]:\n if a[x] == 0:\n ans_box[x] = False\n ans_box[y] = True\nprint(ans_box.count(True))\n\n\n\n", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "a = [1]*n", "a", "[1]*n", "[1]", "1", "n", "ans_box = [False]*n", "ans_box", "[False]*n", "[False]", "False", "n", "ans_box[0] = True", "ans_box[0]", "ans_box", "0", "True", "for _ in range(m):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n a[x] -= 1\n a[y] += 1\n if ans_box[x]:\n if a[x] == 0:\n ans_box[x] = False\n ans_box[y] = True", "_", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "a[x] -= 1", "a[x]", "a", "x", "1", "a[y] += 1", "a[y]", "a", "y", "1", "if ans_box[x]:\n if a[x] == 0:\n ans_box[x] = False\n ans_box[y] = True", "ans_box[x]", "ans_box", "x", "if a[x] == 0:\n ans_box[x] = False\n ", "a[x] == 0", "a[x]", "a", "x", "0", "ans_box[x] = False", "ans_box[x]", "ans_box", "x", "False", "ans_box[y] = True", "ans_box[y]", "ans_box", "y", "True", "print(ans_box.count(True))", "print", "ans_box.count(True)", "ans_box.count", "ans_box", "count", "True", "x -= 1", "1", "x", "a = [1]*n", "[1]*n", "a", "ans_box = [False]*n", "[False]*n", "ans_box", "y -= 1", "1", "y", "m = map(int, input().split())", "map(int, input().split())", "m", "y = map(int, input().split())", "map(int, input().split())", "y", "x, y = map(int, input().split())", "map(int, input().split())", "x", "n, m = map(int, input().split())", "map(int, input().split())", "n" ]
n, m = map(int, input().split()) a = [1]*n ans_box = [False]*n ans_box[0] = True for _ in range(m): x, y = map(int, input().split()) x -= 1 y -= 1 a[x] -= 1 a[y] += 1 if ans_box[x]: if a[x] == 0: ans_box[x] = False ans_box[y] = True print(ans_box.count(True))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 39, 2, 39, 17, 13, 2, 39, 17, 13, 0, 18, 18, 13, 17, 17, 17, 0, 18, 18, 13, 17, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 18, 13, 17, 2, 13, 17, 17, 0, 18, 18, 13, 17, 2, 13, 17, 17, 0, 18, 18, 13, 17, 2, 13, 17, 17, 14, 2, 18, 18, 13, 17, 2, 13, 17, 17, 0, 18, 18, 13, 17, 2, 13, 17, 17, 0, 18, 18, 13, 17, 2, 13, 17, 17, 41, 28, 13, 18, 13, 17, 2, 13, 17, 4, 13, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 39, 13 ]
[ [ 135, 2 ], [ 135, 11 ], [ 138, 13 ], [ 136, 18 ], [ 136, 22 ], [ 29, 24 ], [ 139, 26 ], [ 36, 31 ], [ 139, 33 ], [ 39, 38 ], [ 127, 41 ], [ 132, 43 ], [ 132, 52 ], [ 139, 57 ], [ 130, 60 ], [ 71, 64 ], [ 139, 66 ], [ 133, 69 ], [ 80, 73 ], [ 139, 75 ], [ 133, 78 ], [ 139, 85 ], [ 130, 88 ], [ 99, 92 ], [ 139, 94 ], [ 130, 97 ], [ 108, 101 ], [ 139, 103 ], [ 130, 106 ], [ 112, 111 ], [ 139, 113 ], [ 111, 116 ], [ 111, 119 ], [ 135, 127 ], [ 132, 130 ], [ 132, 133 ], [ 135, 136 ], [ 138, 139 ] ]
[ "N,M = map(int,input().split())\nA = [[0]*N,[1]*N]\nA[0][0] = 1\nA[1][0] = 0\n\nfor i in range(M):\n x,y = map(int,input().split())\n if A[0][x-1] > 0:\n A[0][y-1] += 1\n else:\n A[1][y-1] += 1\n if A[1][x-1] > 0:\n A[1][x-1] -= 1\n else:\n A[0][x-1] -= 1\nprint(len([i for i in A[0] if i > 0]))", "N,M = map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "A = [[0]*N,[1]*N]", "A", "[[0]*N,[1]*N]", "[0]*N", "[0]", "0", "N", "[1]*N", "[1]", "1", "N", "A[0][0] = 1", "A[0][0]", "[0]", "A", "0", "0", "1", "A[1][0] = 0", "A[1][0]", "[1]", "A", "1", "0", "0", "for i in range(M):\n x,y = map(int,input().split())\n if A[0][x-1] > 0:\n A[0][y-1] += 1\n else:\n A[1][y-1] += 1\n if A[1][x-1] > 0:\n A[1][x-1] -= 1\n else:\n A[0][x-1] -= 1", "i", "range(M)", "range", "M", "x,y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if A[0][x-1] > 0:\n A[0][y-1] += 1\n else:\n A[1][y-1] += 1\n ", "A[0][x-1] > 0", "A[0][x-1]", "[0]", "A", "0", "x-1", "x", "1", "0", "A[0][y-1] += 1", "A[0][y-1]", "[0]", "A", "0", "y-1", "y", "1", "1", "A[1][y-1] += 1", "A[1][y-1]", "[1]", "A", "1", "y-1", "y", "1", "1", "if A[1][x-1] > 0:\n A[1][x-1] -= 1\n else:\n A[0][x-1] -= 1", "A[1][x-1] > 0", "A[1][x-1]", "[1]", "A", "1", "x-1", "x", "1", "0", "A[1][x-1] -= 1", "A[1][x-1]", "[1]", "A", "1", "x-1", "x", "1", "1", "A[0][x-1] -= 1", "A[0][x-1]", "[0]", "A", "0", "x-1", "x", "1", "1", "i for i in A[0] if i > 0", "for i in A[0] if i > 0", "i", "A[0]", "A", "0", "i > 0", "i", "0", "if i > 0", "i", "print(len([i for i in A[0] if i > 0]))", "print", "len([i for i in A[0] if i > 0])", "len", "[i for i in A[0] if i > 0]", "M = map(int,input().split())", "map(int,input().split())", "M", "x,y = map(int,input().split())", "map(int,input().split())", "x", "y = map(int,input().split())", "map(int,input().split())", "y", "N,M = map(int,input().split())", "map(int,input().split())", "N", "A = [[0]*N,[1]*N]", "[[0]*N,[1]*N]", "A" ]
N,M = map(int,input().split()) A = [[0]*N,[1]*N] A[0][0] = 1 A[1][0] = 0 for i in range(M): x,y = map(int,input().split()) if A[0][x-1] > 0: A[0][y-1] += 1 else: A[1][y-1] += 1 if A[1][x-1] > 0: A[1][x-1] -= 1 else: A[0][x-1] -= 1 print(len([i for i in A[0] if i > 0]))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 18, 13, 13, 17, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 104, 2 ], [ 104, 11 ], [ 110, 13 ], [ 102, 17 ], [ 98, 19 ], [ 102, 23 ], [ 28, 25 ], [ 99, 26 ], [ 31, 30 ], [ 105, 33 ], [ 107, 35 ], [ 107, 44 ], [ 99, 47 ], [ 96, 49 ], [ 57, 52 ], [ 99, 53 ], [ 108, 55 ], [ 64, 59 ], [ 111, 60 ], [ 96, 62 ], [ 71, 66 ], [ 111, 67 ], [ 108, 69 ], [ 111, 75 ], [ 96, 77 ], [ 86, 81 ], [ 99, 82 ], [ 96, 84 ], [ 99, 91 ], [ 107, 96 ], [ 98, 99 ], [ 104, 102 ], [ 104, 105 ], [ 107, 108 ], [ 110, 111 ] ]
[ "n,m=map(int,input().split())\nball_in_boxes = [1]*n\nredball_flag = [False]*n\nredball_flag[0] = True\nfor _ in range(m):\n x,y = map(int,input().split())\n if redball_flag[x-1]: # x番目の箱に赤いボールが入っている可能性がある\n redball_flag[y-1] = True\n ball_in_boxes[x-1] -= 1\n ball_in_boxes[y-1] += 1\n\n if ball_in_boxes[x-1] == 0: # x番目の箱にボールが入っていないので\n redball_flag[x-1] = False\nprint(redball_flag.count(True))", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "ball_in_boxes = [1]*n", "ball_in_boxes", "[1]*n", "[1]", "1", "n", "redball_flag = [False]*n", "redball_flag", "[False]*n", "[False]", "False", "n", "redball_flag[0] = True", "redball_flag[0]", "redball_flag", "0", "True", "for _ in range(m):\n x,y = map(int,input().split())\n if redball_flag[x-1]: # x番目の箱に赤いボールが入っている可能性がある\n redball_flag[y-1] = True\n ball_in_boxes[x-1] -= 1\n ball_in_boxes[y-1] += 1\n\n if ball_in_boxes[x-1] == 0: # x番目の箱にボールが入っていないので\n redball_flag[x-1] = False", "_", "range(m)", "range", "m", "x,y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if redball_flag[x-1]: # x番目の箱に赤いボールが入っている可能性がある\n redball_flag[y-1] = True\n ", "redball_flag[x-1]", "redball_flag", "x-1", "x", "1", "redball_flag[y-1] = True", "redball_flag[y-1]", "redball_flag", "y-1", "y", "1", "True", "ball_in_boxes[x-1] -= 1", "ball_in_boxes[x-1]", "ball_in_boxes", "x-1", "x", "1", "1", "ball_in_boxes[y-1] += 1", "ball_in_boxes[y-1]", "ball_in_boxes", "y-1", "y", "1", "1", "if ball_in_boxes[x-1] == 0: # x番目の箱にボールが入っていないので\n redball_flag[x-1] = False", "ball_in_boxes[x-1] == 0", "ball_in_boxes[x-1]", "ball_in_boxes", "x-1", "x", "1", "0", "redball_flag[x-1] = False", "redball_flag[x-1]", "redball_flag", "x-1", "x", "1", "False", "print(redball_flag.count(True))", "print", "redball_flag.count(True)", "redball_flag.count", "redball_flag", "count", "True", "x,y = map(int,input().split())", "map(int,input().split())", "x", "redball_flag = [False]*n", "[False]*n", "redball_flag", "n,m=map(int,input().split())", "map(int,input().split())", "n", "m=map(int,input().split())", "map(int,input().split())", "m", "y = map(int,input().split())", "map(int,input().split())", "y", "ball_in_boxes = [1]*n", "[1]*n", "ball_in_boxes" ]
n,m=map(int,input().split()) ball_in_boxes = [1]*n redball_flag = [False]*n redball_flag[0] = True for _ in range(m): x,y = map(int,input().split()) if redball_flag[x-1]: # x番目の箱に赤いボールが入っている可能性がある redball_flag[y-1] = True ball_in_boxes[x-1] -= 1 ball_in_boxes[y-1] += 1 if ball_in_boxes[x-1] == 0: # x番目の箱にボールが入っていないので redball_flag[x-1] = False print(redball_flag.count(True))
[ 7, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13 ]
[ [ 114, 2 ], [ 114, 13 ], [ 17, 16 ], [ 100, 19 ], [ 117, 32 ], [ 105, 35 ], [ 115, 39 ], [ 108, 41 ], [ 115, 45 ], [ 50, 47 ], [ 106, 48 ], [ 102, 56 ], [ 111, 59 ], [ 89, 63 ], [ 106, 64 ], [ 103, 65 ], [ 71, 68 ], [ 106, 69 ], [ 112, 70 ], [ 76, 73 ], [ 109, 74 ], [ 103, 75 ], [ 81, 78 ], [ 109, 79 ], [ 112, 80 ], [ 73, 84 ], [ 109, 85 ], [ 103, 86 ], [ 92, 89 ], [ 106, 90 ], [ 103, 91 ], [ 106, 97 ], [ 114, 100 ], [ 102, 103 ], [ 105, 106 ], [ 108, 109 ], [ 111, 112 ], [ 114, 115 ], [ 117, 118 ] ]
[ "N, M = list(map(int, input().split()))\nxy = [list(map(int, input().split())) for _ in range(M)]\n\nD = [0] * N\nC = [1] * N\nD[0] = 1\n\nfor x, y in xy:\n x -= 1\n y -= 1\n if D[x] == 1:\n D[y] = 1\n C[x] -= 1\n C[y] += 1\n if C[x] == 0:\n D[x] = 0\n\nprint(sum(D))", "N, M = list(map(int, input().split()))", "N", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "list(map(int, input().split())) for _ in range(M)", "for _ in range(M)", "_", "range(M)", "range", "M", "for _ in range(M)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "xy = [list(map(int, input().split())) for _ in range(M)]", "xy", "[list(map(int, input().split())) for _ in range(M)]", "D = [0] * N", "D", "[0] * N", "[0]", "0", "N", "C = [1] * N", "C", "[1] * N", "[1]", "1", "N", "D[0] = 1", "D[0]", "D", "0", "1", "for x, y in xy:\n x -= 1\n y -= 1\n if D[x] == 1:\n D[y] = 1\n C[x] -= 1\n C[y] += 1\n if C[x] == 0:\n D[x] = 0", "x", "y", "xy", "x -= 1", "x", "1", "y -= 1", "y", "1", "if D[x] == 1:\n D[y] = 1\n ", "D[x] == 1", "D[x]", "D", "x", "1", "D[y] = 1", "D[y]", "D", "y", "1", "C[x] -= 1", "C[x]", "C", "x", "1", "C[y] += 1", "C[y]", "C", "y", "1", "if C[x] == 0:\n D[x] = 0", "C[x] == 0", "C[x]", "C", "x", "0", "D[x] = 0", "D[x]", "D", "x", "0", "print(sum(D))", "print", "sum(D)", "sum", "D", "M = list(map(int, input().split()))", "list(map(int, input().split()))", "M", "x -= 1", "1", "x", "D = [0] * N", "[0] * N", "D", "C = [1] * N", "[1] * N", "C", "y -= 1", "1", "y", "N, M = list(map(int, input().split()))", "list(map(int, input().split()))", "N", "xy = [list(map(int, input().split())) for _ in range(M)]", "[list(map(int, input().split())) for _ in range(M)]", "xy" ]
N, M = list(map(int, input().split())) xy = [list(map(int, input().split())) for _ in range(M)] D = [0] * N C = [1] * N D[0] = 1 for x, y in xy: x -= 1 y -= 1 if D[x] == 1: D[y] = 1 C[x] -= 1 C[y] += 1 if C[x] == 0: D[x] = 0 print(sum(D))
[ 7, 15, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 39, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 4, 18, 13, 13, 39, 2, 13, 17, 2, 13, 17, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 18, 18, 13, 13, 17, 0, 13, 18, 18, 13, 13, 17, 14, 18, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 18, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 39, 13, 10, 18, 13, 10, 2, 13 ]
[ [ 156, 4 ], [ 156, 13 ], [ 159, 15 ], [ 19, 18 ], [ 157, 21 ], [ 150, 23 ], [ 150, 32 ], [ 160, 35 ], [ 148, 39 ], [ 151, 42 ], [ 141, 45 ], [ 154, 49 ], [ 165, 51 ], [ 154, 55 ], [ 60, 57 ], [ 166, 58 ], [ 63, 62 ], [ 157, 65 ], [ 162, 67 ], [ 160, 70 ], [ 62, 71 ], [ 144, 74 ], [ 160, 77 ], [ 62, 78 ], [ 166, 82 ], [ 163, 83 ], [ 126, 86 ], [ 111, 86 ], [ 91, 86 ], [ 142, 87 ], [ 163, 88 ], [ 94, 91 ], [ 142, 92 ], [ 163, 93 ], [ 99, 96 ], [ 142, 97 ], [ 145, 98 ], [ 104, 101 ], [ 166, 102 ], [ 163, 103 ], [ 109, 106 ], [ 166, 107 ], [ 145, 108 ], [ 114, 111 ], [ 142, 112 ], [ 163, 113 ], [ 119, 116 ], [ 142, 117 ], [ 145, 118 ], [ 124, 121 ], [ 166, 122 ], [ 145, 123 ], [ 129, 126 ], [ 142, 127 ], [ 163, 128 ], [ 134, 131 ], [ 142, 132 ], [ 145, 133 ], [ 166, 139 ], [ 141, 142 ], [ 144, 145 ], [ 150, 148 ], [ 150, 151 ], [ 156, 154 ], [ 156, 157 ], [ 159, 160 ], [ 162, 163 ], [ 165, 166 ] ]
[ "import copy\nN, M = map(int, input().split())\nXY = []\nfor _ in range(M):\n x, y = map(int, input().split())\n XY.append([x - 1, y - 1])\n\nball_num = [1] * N\nis_red = [False] * N\nis_red[0] = True\n\nfor i in range(M):\n s = XY[i][0]\n g = XY[i][1]\n if is_red[s]:\n if ball_num[s] == 1:\n ball_num[s] -= 1\n ball_num[g] += 1\n is_red[s] = False\n is_red[g] = True\n else:\n ball_num[s] -= 1\n ball_num[g] += 1\n is_red[g] = True\n else:\n ball_num[s] -= 1\n ball_num[g] += 1\n\nprint(sum(is_red))", "import copy", "copy", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "XY = []", "XY", "[]", "for _ in range(M):\n x, y = map(int, input().split())\n XY.append([x - 1, y - 1])", "_", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "XY.append([x - 1, y - 1])", "XY.append", "XY", "append", "[x - 1, y - 1]", "x - 1", "x", "1", "y - 1", "y", "1", "ball_num = [1] * N", "ball_num", "[1] * N", "[1]", "1", "N", "is_red = [False] * N", "is_red", "[False] * N", "[False]", "False", "N", "is_red[0] = True", "is_red[0]", "is_red", "0", "True", "for i in range(M):\n s = XY[i][0]\n g = XY[i][1]\n if is_red[s]:\n if ball_num[s] == 1:\n ball_num[s] -= 1\n ball_num[g] += 1\n is_red[s] = False\n is_red[g] = True\n else:\n ball_num[s] -= 1\n ball_num[g] += 1\n is_red[g] = True\n else:\n ball_num[s] -= 1\n ball_num[g] += 1", "i", "range(M)", "range", "M", "s = XY[i][0]", "s", "XY[i][0]", "[i]", "XY", "i", "0", "g = XY[i][1]", "g", "XY[i][1]", "[i]", "XY", "i", "1", "if is_red[s]:\n if ball_num[s] == 1:\n ball_num[s] -= 1\n ball_num[g] += 1\n is_red[s] = False\n is_red[g] = True\n else:\n ball_num[s] -= 1\n ball_num[g] += 1\n is_red[g] = True\n else:\n ball_num[s] -= 1\n ball_num[g] += 1", "is_red[s]", "is_red", "s", "if ball_num[s] == 1:\n ball_num[s] -= 1\n ball_num[g] += 1\n is_red[s] = False\n is_red[g] = True\n else:\n ball_num[s] -= 1\n ball_num[g] += 1\n is_red[g] = True\n ", "ball_num[s] == 1", "ball_num[s]", "ball_num", "s", "1", "ball_num[s] -= 1", "ball_num[s]", "ball_num", "s", "1", "ball_num[g] += 1", "ball_num[g]", "ball_num", "g", "1", "is_red[s] = False", "is_red[s]", "is_red", "s", "False", "is_red[g] = True", "is_red[g]", "is_red", "g", "True", "ball_num[s] -= 1", "ball_num[s]", "ball_num", "s", "1", "ball_num[g] += 1", "ball_num[g]", "ball_num", "g", "1", "is_red[g] = True", "is_red[g]", "is_red", "g", "True", "ball_num[s] -= 1", "ball_num[s]", "ball_num", "s", "1", "ball_num[g] += 1", "ball_num[g]", "ball_num", "g", "1", "print(sum(is_red))", "print", "sum(is_red)", "sum", "is_red", "ball_num = [1] * N", "[1] * N", "ball_num", "g = XY[i][1]", "XY[i][1]", "g", "x, y = map(int, input().split())", "map(int, input().split())", "x", "y = map(int, input().split())", "map(int, input().split())", "y", "N, M = map(int, input().split())", "map(int, input().split())", "N", "M = map(int, input().split())", "map(int, input().split())", "M", "XY = []", "[]", "XY", "s = XY[i][0]", "XY[i][0]", "s", "is_red = [False] * N", "[False] * N", "is_red" ]
import copy N, M = map(int, input().split()) XY = [] for _ in range(M): x, y = map(int, input().split()) XY.append([x - 1, y - 1]) ball_num = [1] * N is_red = [False] * N is_red[0] = True for i in range(M): s = XY[i][0] g = XY[i][1] if is_red[s]: if ball_num[s] == 1: ball_num[s] -= 1 ball_num[g] += 1 is_red[s] = False is_red[g] = True else: ball_num[s] -= 1 ball_num[g] += 1 is_red[g] = True else: ball_num[s] -= 1 ball_num[g] += 1 print(sum(is_red))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 2, 18, 18, 13, 13, 17, 17, 0, 13, 2, 18, 18, 13, 13, 17, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13 ]
[ [ 155, 2 ], [ 155, 11 ], [ 15, 14 ], [ 138, 17 ], [ 143, 30 ], [ 35, 34 ], [ 156, 37 ], [ 149, 41 ], [ 46, 45 ], [ 156, 48 ], [ 152, 52 ], [ 58, 55 ], [ 153, 56 ], [ 61, 60 ], [ 138, 63 ], [ 140, 65 ], [ 144, 69 ], [ 60, 70 ], [ 146, 74 ], [ 144, 78 ], [ 60, 79 ], [ 122, 85 ], [ 150, 86 ], [ 141, 87 ], [ 112, 90 ], [ 153, 91 ], [ 141, 92 ], [ 98, 95 ], [ 153, 96 ], [ 147, 97 ], [ 122, 102 ], [ 150, 103 ], [ 141, 104 ], [ 112, 107 ], [ 153, 108 ], [ 141, 109 ], [ 115, 112 ], [ 153, 113 ], [ 141, 114 ], [ 120, 117 ], [ 153, 118 ], [ 147, 119 ], [ 125, 122 ], [ 150, 123 ], [ 141, 124 ], [ 130, 127 ], [ 150, 128 ], [ 147, 129 ], [ 153, 135 ], [ 155, 138 ], [ 140, 141 ], [ 143, 144 ], [ 146, 147 ], [ 149, 150 ], [ 152, 153 ], [ 155, 156 ] ]
[ "N, M = map(int, input().split())\nZ = [list(map(int,input().split())) for i in range(M)]\n\nB = [1 for i in range(N)]\nR = [0 for i in range(N)]\nR[0] = 1 #赤いボールが入っている可能性があるなら1、無いなら0\nfor i in range(M):\n src = Z[i][0]-1\n dst = Z[i][1]-1\n if B[src] > 1 and R[src] == 1:\n R[dst] = 1\n if B[src] == 1 and R[src] == 1:\n R[src] = 0 \n R[dst] = 1\n B[src] -= 1\n B[dst] += 1\nprint(sum(R))", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "list(map(int,input().split())) for i in range(M)", "for i in range(M)", "i", "range(M)", "range", "M", "for i in range(M)", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "Z = [list(map(int,input().split())) for i in range(M)]", "Z", "[list(map(int,input().split())) for i in range(M)]", "1 for i in range(N)", "for i in range(N)", "i", "range(N)", "range", "N", "for i in range(N)", "1", "B = [1 for i in range(N)]", "B", "[1 for i in range(N)]", "0 for i in range(N)", "for i in range(N)", "i", "range(N)", "range", "N", "for i in range(N)", "0", "R = [0 for i in range(N)]", "R", "[0 for i in range(N)]", "R[0] = 1", "R[0]", "R", "0", "1", "for i in range(M):\n src = Z[i][0]-1\n dst = Z[i][1]-1\n if B[src] > 1 and R[src] == 1:\n R[dst] = 1\n if B[src] == 1 and R[src] == 1:\n R[src] = 0 \n R[dst] = 1\n B[src] -= 1\n B[dst] += 1", "i", "range(M)", "range", "M", "src = Z[i][0]-1", "src", "Z[i][0]-1", "Z[i][0]", "[i]", "Z", "i", "0", "1", "dst = Z[i][1]-1", "dst", "Z[i][1]-1", "Z[i][1]", "[i]", "Z", "i", "1", "1", "if B[src] > 1 and R[src] == 1:\n R[dst] = 1\n ", "B[src] > 1 and R[src] == 1", "B[src] > 1", "B[src]", "B", "src", "1", "R[src] == 1", "R[src]", "R", "src", "1", "R[dst] = 1", "R[dst]", "R", "dst", "1", "if B[src] == 1 and R[src] == 1:\n R[src] = 0 \n R[dst] = 1\n ", "B[src] == 1 and R[src] == 1", "B[src] == 1", "B[src]", "B", "src", "1", "R[src] == 1", "R[src]", "R", "src", "1", "R[src] = 0", "R[src]", "R", "src", "0", "R[dst] = 1", "R[dst]", "R", "dst", "1", "B[src] -= 1", "B[src]", "B", "src", "1", "B[dst] += 1", "B[dst]", "B", "dst", "1", "print(sum(R))", "print", "sum(R)", "sum", "R", "M = map(int, input().split())", "map(int, input().split())", "M", "src = Z[i][0]-1", "Z[i][0]-1", "src", "Z = [list(map(int,input().split())) for i in range(M)]", "[list(map(int,input().split())) for i in range(M)]", "Z", "dst = Z[i][1]-1", "Z[i][1]-1", "dst", "B = [1 for i in range(N)]", "[1 for i in range(N)]", "B", "R = [0 for i in range(N)]", "[0 for i in range(N)]", "R", "N, M = map(int, input().split())", "map(int, input().split())", "N" ]
N, M = map(int, input().split()) Z = [list(map(int,input().split())) for i in range(M)] B = [1 for i in range(N)] R = [0 for i in range(N)] R[0] = 1 #赤いボールが入っている可能性があるなら1、無いなら0 for i in range(M): src = Z[i][0]-1 dst = Z[i][1]-1 if B[src] > 1 and R[src] == 1: R[dst] = 1 if B[src] == 1 and R[src] == 1: R[src] = 0 R[dst] = 1 B[src] -= 1 B[dst] += 1 print(sum(R))
[ 7, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 105, 2 ], [ 105, 13 ], [ 111, 15 ], [ 106, 19 ], [ 99, 21 ], [ 106, 25 ], [ 30, 27 ], [ 100, 28 ], [ 33, 32 ], [ 97, 35 ], [ 114, 37 ], [ 114, 48 ], [ 93, 50 ], [ 108, 53 ], [ 59, 56 ], [ 112, 57 ], [ 94, 58 ], [ 115, 58 ], [ 64, 61 ], [ 112, 62 ], [ 109, 63 ], [ 103, 63 ], [ 100, 67 ], [ 94, 68 ], [ 115, 68 ], [ 73, 70 ], [ 100, 71 ], [ 109, 72 ], [ 103, 72 ], [ 56, 76 ], [ 112, 77 ], [ 94, 78 ], [ 115, 78 ], [ 84, 81 ], [ 100, 82 ], [ 94, 83 ], [ 115, 83 ], [ 100, 89 ], [ 93, 94 ], [ 105, 97 ], [ 99, 100 ], [ 114, 103 ], [ 105, 106 ], [ 108, 109 ], [ 111, 112 ], [ 114, 115 ] ]
[ "N,M= list(map(int,input().split()))\ndot=[1]*N\nsw=[0] * N\nsw[0]=1\nfor i in range(M):\n a,b=list(map(int,input().split()))\n a-=1;b-=1\n dot[a]-=1\n dot[b]+=1\n if sw[a]:\n sw[b]=1\n if dot[a] == 0:\n sw[a]=0\nprint(sw.count(1))", "N,M= list(map(int,input().split()))", "N", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "dot=[1]*N", "dot", "[1]*N", "[1]", "1", "N", "sw=[0] * N", "sw", "[0] * N", "[0]", "0", "N", "sw[0]=1", "sw[0]", "sw", "0", "1", "for i in range(M):\n a,b=list(map(int,input().split()))\n a-=1;b-=1\n dot[a]-=1\n dot[b]+=1\n if sw[a]:\n sw[b]=1\n if dot[a] == 0:\n sw[a]=0", "i", "range(M)", "range", "M", "a,b=list(map(int,input().split()))", "a", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "a-=1", "a", "1", "b-=1", "b", "1", "dot[a]-=1", "dot[a]", "dot", "a", "1", "dot[b]+=1", "dot[b]", "dot", "b", "1", "if sw[a]:\n sw[b]=1\n ", "sw[a]", "sw", "a", "sw[b]=1", "sw[b]", "sw", "b", "1", "if dot[a] == 0:\n sw[a]=0", "dot[a] == 0", "dot[a]", "dot", "a", "0", "sw[a]=0", "sw[a]", "sw", "a", "0", "print(sw.count(1))", "print", "sw.count(1)", "sw.count", "sw", "count", "1", "a-=1", "1", "a", "M= list(map(int,input().split()))", "list(map(int,input().split()))", "M", "sw=[0] * N", "[0] * N", "sw", "b=list(map(int,input().split()))", "list(map(int,input().split()))", "b", "N,M= list(map(int,input().split()))", "list(map(int,input().split()))", "N", "b-=1", "1", "b", "dot=[1]*N", "[1]*N", "dot", "a,b=list(map(int,input().split()))", "list(map(int,input().split()))", "a" ]
N,M= list(map(int,input().split())) dot=[1]*N sw=[0] * N sw[0]=1 for i in range(M): a,b=list(map(int,input().split())) a-=1;b-=1 dot[a]-=1 dot[b]+=1 if sw[a]: sw[b]=1 if dot[a] == 0: sw[a]=0 print(sw.count(1))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 39, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 13, 17, 28, 13, 13, 14, 13, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 39, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 126, 2 ], [ 126, 11 ], [ 120, 13 ], [ 108, 16 ], [ 127, 20 ], [ 114, 22 ], [ 127, 26 ], [ 31, 28 ], [ 115, 29 ], [ 34, 33 ], [ 106, 36 ], [ 117, 38 ], [ 117, 47 ], [ 54, 49 ], [ 109, 50 ], [ 112, 52 ], [ 61, 56 ], [ 109, 57 ], [ 118, 59 ], [ 115, 64 ], [ 112, 66 ], [ 74, 69 ], [ 115, 70 ], [ 118, 72 ], [ 109, 78 ], [ 112, 80 ], [ 89, 84 ], [ 115, 85 ], [ 112, 87 ], [ 129, 91 ], [ 95, 94 ], [ 115, 94 ], [ 123, 99 ], [ 124, 103 ], [ 130, 103 ], [ 126, 106 ], [ 108, 109 ], [ 117, 112 ], [ 114, 115 ], [ 117, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ], [ 129, 130 ] ]
[ "#!/usr/bin/env python\n# coding: utf-8\n\n# In[27]:\n\n\nN,M = map(int, input().split())\nxy = []\nb = [1]*N\np = [False]*N\np[0] = True\nfor _ in range(M):\n x,y = map(int, input().split())\n b[x-1] -= 1\n b[y-1] += 1\n if p[x-1]:\n p[y-1] = True\n if b[x-1] == 0:\n p[x-1] = False\n\n\n# In[28]:\n\n\nans = 0\nfor j in p:\n if j:\n ans += 1\nprint(ans)\n\n\n# In[ ]:\n\n\n\n", "N,M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "xy = []", "xy", "[]", "b = [1]*N", "b", "[1]*N", "[1]", "1", "N", "p = [False]*N", "p", "[False]*N", "[False]", "False", "N", "p[0] = True", "p[0]", "p", "0", "True", "for _ in range(M):\n x,y = map(int, input().split())\n b[x-1] -= 1\n b[y-1] += 1\n if p[x-1]:\n p[y-1] = True\n if b[x-1] == 0:\n p[x-1] = False\n\n\n# In[28]:", "_", "range(M)", "range", "M", "x,y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "b[x-1] -= 1", "b[x-1]", "b", "x-1", "x", "1", "1", "b[y-1] += 1", "b[y-1]", "b", "y-1", "y", "1", "1", "if p[x-1]:\n p[y-1] = True\n ", "p[x-1]", "p", "x-1", "x", "1", "p[y-1] = True", "p[y-1]", "p", "y-1", "y", "1", "True", "if b[x-1] == 0:\n p[x-1] = False\n\n\n# In[28]:", "b[x-1] == 0", "b[x-1]", "b", "x-1", "x", "1", "0", "p[x-1] = False", "p[x-1]", "p", "x-1", "x", "1", "False", "ans = 0", "ans", "0", "for j in p:\n if j:\n ans += 1", "j", "p", "if j:\n ans += 1", "j", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "M = map(int, input().split())", "map(int, input().split())", "M", "b = [1]*N", "[1]*N", "b", "x,y = map(int, input().split())", "map(int, input().split())", "x", "p = [False]*N", "[False]*N", "p", "y = map(int, input().split())", "map(int, input().split())", "y", "xy = []", "[]", "xy", "ans += 1", "1", "ans", "N,M = map(int, input().split())", "map(int, input().split())", "N", "ans = 0", "0", "ans" ]
#!/usr/bin/env python # coding: utf-8 # In[27]: N,M = map(int, input().split()) xy = [] b = [1]*N p = [False]*N p[0] = True for _ in range(M): x,y = map(int, input().split()) b[x-1] -= 1 b[y-1] += 1 if p[x-1]: p[y-1] = True if b[x-1] == 0: p[x-1] = False # In[28]: ans = 0 for j in p: if j: ans += 1 print(ans) # In[ ]:
[ 7, 15, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 13, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 4, 18, 13, 13, 13, 0, 13, 4, 18, 13, 13, 13, 0, 13, 18, 13, 13, 0, 18, 13, 17, 17, 28, 13, 13, 13, 0, 18, 13, 13, 8, 2, 18, 13, 13, 17, 17, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 8, 2, 18, 13, 13, 17, 17, 18, 13, 13, 0, 18, 13, 13, 8, 2, 18, 13, 13, 17, 18, 13, 13, 17, 0, 13, 4, 18, 13, 13, 18, 13, 2, 13, 17, 4, 13, 13, 10, 13, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13 ]
[ [ 6, 5 ], [ 5, 14 ], [ 138, 16 ], [ 138, 18 ], [ 22, 21 ], [ 139, 24 ], [ 132, 28 ], [ 33, 32 ], [ 127, 35 ], [ 135, 39 ], [ 141, 46 ], [ 127, 51 ], [ 54, 53 ], [ 61, 58 ], [ 142, 59 ], [ 70, 67 ], [ 136, 68 ], [ 67, 72 ], [ 136, 73 ], [ 82, 79 ], [ 136, 80 ], [ 87, 84 ], [ 142, 85 ], [ 98, 89 ], [ 142, 90 ], [ 84, 94 ], [ 142, 95 ], [ 101, 98 ], [ 142, 99 ], [ 67, 103 ], [ 136, 104 ], [ 98, 107 ], [ 142, 108 ], [ 129, 112 ], [ 142, 118 ], [ 136, 120 ], [ 130, 124 ], [ 138, 127 ], [ 129, 130 ], [ 132, 133 ], [ 135, 136 ], [ 138, 139 ], [ 141, 142 ] ]
[ "import numpy as np \nn,m = [int(i)for i in input().split()]\n\nl = [[int(i)-1 for i in input().split()] for _ in range(m)]\n\nline = np.array([1 for _ in range(n)])\nis_red = np.zeros(n,dtype = np.int32)\nis_red[0] = 1\n\nfor x,y in l:\n line[x] -= 1 if line[x] > 0 else 0\n line[y] += 1\n is_red[y] = 1 if is_red[x] == 1 else is_red[y]\n is_red[x] = is_red[x] if line[x] > 0 else 0\n \n\nans = np.count_nonzero(is_red[line > 0])\n\nprint(ans)\n \n\n ", "import numpy as np", "numpy", "int(i)for i in input().split()", "for i in input().split()", "i", "input().split()", "().split", "()", "input", "split", "for i in input().split()", "int(i)", "int", "i", "n,m = [int(i)for i in input().split()]", "n", "[int(i)for i in input().split()]", "m", "[int(i)-1 for i in input().split()] for _ in range(m)", "for _ in range(m)", "_", "range(m)", "range", "m", "for _ in range(m)", "[int(i)-1 for i in input().split()]", "l = [[int(i)-1 for i in input().split()] for _ in range(m)]", "l", "[[int(i)-1 for i in input().split()] for _ in range(m)]", "1 for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "1", "line = np.array([1 for _ in range(n)])", "line", "np.array([1 for _ in range(n)])", "np.array", "np", "array", "[1 for _ in range(n)]", "is_red = np.zeros(n,dtype = np.int32)", "is_red", "np.zeros(n,dtype = np.int32)", "np.zeros", "np", "zeros", "n", "dtype = np.int32", "dtype", "np.int32", "np", "int32", "is_red[0] = 1", "is_red[0]", "is_red", "0", "1", "for x,y in l:\n line[x] -= 1 if line[x] > 0 else 0\n line[y] += 1\n is_red[y] = 1 if is_red[x] == 1 else is_red[y]\n is_red[x] = is_red[x] if line[x] > 0 else 0\n ", "x", "y", "l", "line[x] -= 1 if line[x] > 0 else 0", "line[x]", "line", "x", "1 if line[x] > 0 else 0", "line[x] > 0", "line[x]", "line", "x", "0", "1", "0", "line[y] += 1", "line[y]", "line", "y", "1", "is_red[y] = 1 if is_red[x] == 1 else is_red[y]", "is_red[y]", "is_red", "y", "1 if is_red[x] == 1 else is_red[y]", "is_red[x] == 1", "is_red[x]", "is_red", "x", "1", "1", "is_red[y]", "is_red", "y", "is_red[x] = is_red[x] if line[x] > 0 else 0", "is_red[x]", "is_red", "x", "is_red[x] if line[x] > 0 else 0", "line[x] > 0", "line[x]", "line", "x", "0", "is_red[x]", "is_red", "x", "0", "ans = np.count_nonzero(is_red[line > 0])", "ans", "np.count_nonzero(is_red[line > 0])", "np.count_nonzero", "np", "count_nonzero", "is_red[line > 0]", "is_red", "line > 0", "line", "0", "print(ans)", "print", "ans", "n,m = [int(i)for i in input().split()]", "[int(i)for i in input().split()]", "n", "ans = np.count_nonzero(is_red[line > 0])", "np.count_nonzero(is_red[line > 0])", "ans", "l = [[int(i)-1 for i in input().split()] for _ in range(m)]", "[[int(i)-1 for i in input().split()] for _ in range(m)]", "l", "line = np.array([1 for _ in range(n)])", "np.array([1 for _ in range(n)])", "line", "m = [int(i)for i in input().split()]", "[int(i)for i in input().split()]", "m", "is_red = np.zeros(n,dtype = np.int32)", "np.zeros(n,dtype = np.int32)", "is_red" ]
import numpy as np n,m = [int(i)for i in input().split()] l = [[int(i)-1 for i in input().split()] for _ in range(m)] line = np.array([1 for _ in range(n)]) is_red = np.zeros(n,dtype = np.int32) is_red[0] = 1 for x,y in l: line[x] -= 1 if line[x] > 0 else 0 line[y] += 1 is_red[y] = 1 if is_red[x] == 1 else is_red[y] is_red[x] = is_red[x] if line[x] > 0 else 0 ans = np.count_nonzero(is_red[line > 0]) print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 18, 13, 13, 13, 18, 13, 13, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 18, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 18, 13, 10, 2, 13 ]
[ [ 97, 2 ], [ 97, 11 ], [ 121, 13 ], [ 98, 17 ], [ 103, 19 ], [ 98, 23 ], [ 28, 25 ], [ 104, 26 ], [ 31, 30 ], [ 95, 33 ], [ 115, 35 ], [ 115, 44 ], [ 106, 46 ], [ 109, 49 ], [ 118, 52 ], [ 79, 53 ], [ 122, 54 ], [ 107, 55 ], [ 113, 55 ], [ 100, 56 ], [ 84, 57 ], [ 122, 58 ], [ 110, 59 ], [ 116, 59 ], [ 104, 62 ], [ 107, 63 ], [ 113, 63 ], [ 68, 65 ], [ 104, 66 ], [ 110, 67 ], [ 116, 67 ], [ 119, 71 ], [ 77, 74 ], [ 104, 75 ], [ 107, 76 ], [ 113, 76 ], [ 82, 79 ], [ 122, 80 ], [ 107, 81 ], [ 113, 81 ], [ 87, 84 ], [ 122, 85 ], [ 110, 86 ], [ 116, 86 ], [ 104, 92 ], [ 97, 95 ], [ 97, 98 ], [ 84, 100 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ], [ 109, 110 ], [ 115, 113 ], [ 115, 116 ], [ 79, 118 ], [ 118, 119 ], [ 121, 122 ] ]
[ "N, M = map(int, input().split())\nnum = [1] * N\npossible = [False] * N\npossible[0] = True\n\nfor i in range(M):\n x, y = map(int, input().split())\n x -= 1; y -= 1\n nx, ny = num[x], num[y]\n if possible[x]:\n possible[y] = True\n if nx == 1:\n possible[x] = False\n \n num[x] -= 1; num[y] += 1\n\nprint(sum(possible))", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "num = [1] * N", "num", "[1] * N", "[1]", "1", "N", "possible = [False] * N", "possible", "[False] * N", "[False]", "False", "N", "possible[0] = True", "possible[0]", "possible", "0", "True", "for i in range(M):\n x, y = map(int, input().split())\n x -= 1; y -= 1\n nx, ny = num[x], num[y]\n if possible[x]:\n possible[y] = True\n if nx == 1:\n possible[x] = False\n \n num[x] -= 1; num[y] += 1", "i", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "nx, ny = num[x], num[y]", "nx", "num[x]", "num", "x", "ny", "num[y]", "num", "y", "if possible[x]:\n possible[y] = True\n if nx == 1:\n possible[x] = False\n \n ", "possible[x]", "possible", "x", "possible[y] = True", "possible[y]", "possible", "y", "True", "if nx == 1:\n possible[x] = False\n \n ", "nx == 1", "nx", "1", "possible[x] = False", "possible[x]", "possible", "x", "False", "num[x] -= 1", "num[x]", "num", "x", "1", "num[y] += 1", "num[y]", "num", "y", "1", "print(sum(possible))", "print", "sum(possible)", "sum", "possible", "M = map(int, input().split())", "map(int, input().split())", "M", "N, M = map(int, input().split())", "map(int, input().split())", "N", "ny = num[x], num[y]", "num[y]", "ny", "possible = [False] * N", "[False] * N", "possible", "x -= 1", "1", "x", "y -= 1", "1", "y", "x, y = map(int, input().split())", "map(int, input().split())", "x", "y = map(int, input().split())", "map(int, input().split())", "y", "nx, ny = num[x], num[y]", "num[x]", "nx", "num = [1] * N", "[1] * N", "num" ]
N, M = map(int, input().split()) num = [1] * N possible = [False] * N possible[0] = True for i in range(M): x, y = map(int, input().split()) x -= 1; y -= 1 nx, ny = num[x], num[y] if possible[x]: possible[y] = True if nx == 1: possible[x] = False num[x] -= 1; num[y] += 1 print(sum(possible))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13, 10, 17, 13, 10, 13, 13, 10, 4, 13 ]
[ [ 108, 2 ], [ 108, 11 ], [ 15, 14 ], [ 106, 17 ], [ 111, 21 ], [ 26, 25 ], [ 106, 28 ], [ 117, 32 ], [ 38, 35 ], [ 118, 36 ], [ 41, 40 ], [ 109, 43 ], [ 120, 45 ], [ 120, 54 ], [ 102, 56 ], [ 114, 59 ], [ 65, 62 ], [ 112, 63 ], [ 103, 64 ], [ 100, 64 ], [ 70, 67 ], [ 112, 68 ], [ 115, 69 ], [ 121, 69 ], [ 118, 73 ], [ 103, 74 ], [ 100, 74 ], [ 79, 76 ], [ 118, 77 ], [ 115, 78 ], [ 121, 78 ], [ 62, 82 ], [ 112, 83 ], [ 103, 84 ], [ 100, 84 ], [ 90, 87 ], [ 118, 88 ], [ 103, 89 ], [ 100, 89 ], [ 118, 95 ], [ 120, 100 ], [ 102, 103 ], [ 108, 106 ], [ 108, 109 ], [ 111, 112 ], [ 114, 115 ], [ 117, 118 ], [ 120, 121 ] ]
[ "n, m = map(int, input().split())\nnums = [1 for _ in range(n)]\ntf = [False for _ in range(n)]\ntf[0] = True\n\nfor _ in range(m):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n nums[x] -= 1\n nums[y] += 1\n if tf[x]:\n tf[y] = True\n if nums[x] == 0:\n tf[x] = False\nprint(tf.count(True))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "1 for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "1", "nums = [1 for _ in range(n)]", "nums", "[1 for _ in range(n)]", "False for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "False", "tf = [False for _ in range(n)]", "tf", "[False for _ in range(n)]", "tf[0] = True", "tf[0]", "tf", "0", "True", "for _ in range(m):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n nums[x] -= 1\n nums[y] += 1\n if tf[x]:\n tf[y] = True\n if nums[x] == 0:\n tf[x] = False", "_", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "nums[x] -= 1", "nums[x]", "nums", "x", "1", "nums[y] += 1", "nums[y]", "nums", "y", "1", "if tf[x]:\n tf[y] = True\n if nums[x] == 0:\n tf[x] = False", "tf[x]", "tf", "x", "tf[y] = True", "tf[y]", "tf", "y", "True", "if nums[x] == 0:\n tf[x] = False", "nums[x] == 0", "nums[x]", "nums", "x", "0", "tf[x] = False", "tf[x]", "tf", "x", "False", "print(tf.count(True))", "print", "tf.count(True)", "tf.count", "tf", "count", "True", "x, y = map(int, input().split())", "map(int, input().split())", "x", "x -= 1", "1", "x", "n, m = map(int, input().split())", "map(int, input().split())", "n", "m = map(int, input().split())", "map(int, input().split())", "m", "nums = [1 for _ in range(n)]", "[1 for _ in range(n)]", "nums", "y -= 1", "1", "y", "tf = [False for _ in range(n)]", "[False for _ in range(n)]", "tf", "y = map(int, input().split())", "map(int, input().split())", "y" ]
n, m = map(int, input().split()) nums = [1 for _ in range(n)] tf = [False for _ in range(n)] tf[0] = True for _ in range(m): x, y = map(int, input().split()) x -= 1 y -= 1 nums[x] -= 1 nums[y] += 1 if tf[x]: tf[y] = True if nums[x] == 0: tf[x] = False print(tf.count(True))
[ 7, 12, 13, 29, 2, 4, 13, 13, 17, 23, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 13, 13, 14, 2, 18, 13, 13, 17, 4, 18, 13, 13, 13, 4, 18, 13, 13, 13, 4, 18, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 12, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 10, 7 ], [ 10, 10 ], [ 94, 12 ], [ 94, 21 ], [ 106, 23 ], [ 95, 27 ], [ 97, 29 ], [ 33, 32 ], [ 92, 35 ], [ 103, 37 ], [ 89, 40 ], [ 103, 46 ], [ 101, 49 ], [ 98, 50 ], [ 73, 53 ], [ 107, 54 ], [ 101, 55 ], [ 98, 59 ], [ 101, 61 ], [ 98, 64 ], [ 104, 66 ], [ 98, 69 ], [ 104, 71 ], [ 76, 73 ], [ 107, 74 ], [ 101, 75 ], [ 81, 78 ], [ 107, 79 ], [ 104, 80 ], [ 98, 86 ], [ 94, 92 ], [ 94, 95 ], [ 97, 98 ], [ 103, 101 ], [ 103, 104 ], [ 106, 107 ] ]
[ "def int_(num_str):\n return int(num_str) - 1\n\nN, M = map(int, input().split())\nballs = [1] * N\nred = {0}\nfor i in range(M):\n x, y = map(int_, input().split())\n if x in red:\n if balls[x] == 1:\n red.remove(x)\n red.add(y)\n else:\n red.add(y)\n balls[x] -= 1\n balls[y] += 1\nprint(len(red))", "def int_(num_str):\n return int(num_str) - 1", "int_", "return int(num_str) - 1", "int(num_str) - 1", "int(num_str)", "int", "num_str", "1", "num_str", "num_str", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "balls = [1] * N", "balls", "[1] * N", "[1]", "1", "N", "red = {0}", "red", "{0}", "for i in range(M):\n x, y = map(int_, input().split())\n if x in red:\n if balls[x] == 1:\n red.remove(x)\n red.add(y)\n else:\n red.add(y)\n balls[x] -= 1\n balls[y] += 1", "i", "range(M)", "range", "M", "x, y = map(int_, input().split())", "x", "map(int_, input().split())", "map", "int_", "input().split()", "().split", "()", "input", "split", "y", "if x in red:\n if balls[x] == 1:\n red.remove(x)\n red.add(y)\n else:\n red.add(y)\n ", "x in red", "x", "red", "if balls[x] == 1:\n red.remove(x)\n red.add(y)\n else:\n red.add(y)\n ", "balls[x] == 1", "balls[x]", "balls", "x", "1", "red.remove(x)", "red.remove", "red", "remove", "x", "red.add(y)", "red.add", "red", "add", "y", "red.add(y)", "red.add", "red", "add", "y", "balls[x] -= 1", "balls[x]", "balls", "x", "1", "balls[y] += 1", "balls[y]", "balls", "y", "1", "print(len(red))", "print", "len(red)", "len", "red", "def int_(num_str):\n return int(num_str) - 1", "def int_(num_str):\n return int(num_str) - 1", "int_", "M = map(int, input().split())", "map(int, input().split())", "M", "N, M = map(int, input().split())", "map(int, input().split())", "N", "red = {0}", "{0}", "red", "x, y = map(int_, input().split())", "map(int_, input().split())", "x", "y = map(int_, input().split())", "map(int_, input().split())", "y", "balls = [1] * N", "[1] * N", "balls" ]
def int_(num_str): return int(num_str) - 1 N, M = map(int, input().split()) balls = [1] * N red = {0} for i in range(M): x, y = map(int_, input().split()) if x in red: if balls[x] == 1: red.remove(x) red.add(y) else: red.add(y) balls[x] -= 1 balls[y] += 1 print(len(red))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 39, 17, 28, 13, 4, 13, 17, 13, 4, 18, 13, 13, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 14, 18, 13, 2, 18, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 14, 2, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 41, 28, 13, 4, 13, 4, 13, 13, 18, 13, 13, 4, 17, 4, 13, 4, 13, 13, 10, 13, 13, 10, 4, 13, 10, 39, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 152, 2 ], [ 152, 11 ], [ 15, 14 ], [ 147, 17 ], [ 143, 30 ], [ 149, 33 ], [ 38, 37 ], [ 153, 41 ], [ 150, 44 ], [ 155, 48 ], [ 153, 52 ], [ 55, 54 ], [ 147, 57 ], [ 150, 60 ], [ 144, 64 ], [ 54, 65 ], [ 78, 69 ], [ 150, 70 ], [ 144, 74 ], [ 54, 75 ], [ 89, 80 ], [ 156, 81 ], [ 144, 85 ], [ 54, 86 ], [ 100, 91 ], [ 156, 92 ], [ 144, 96 ], [ 54, 97 ], [ 156, 104 ], [ 144, 108 ], [ 54, 109 ], [ 123, 114 ], [ 150, 115 ], [ 144, 119 ], [ 54, 120 ], [ 127, 126 ], [ 150, 131 ], [ 150, 133 ], [ 126, 134 ], [ 143, 144 ], [ 152, 147 ], [ 149, 150 ], [ 152, 153 ], [ 155, 156 ] ]
[ "n, m = map(int, input().split())\nx_y = [list(map(int, input().split())) for _ in range(m)]\n\naka_list = [True]\nfor i in range(1, n):\n aka_list.append(False)\nballs = [1] * n\n\nfor i in range(m):\n if aka_list[x_y[i][0] - 1]:\n aka_list[x_y[i][1]-1] = True\n balls[x_y[i][0] - 1] -= 1\n balls[x_y[i][1] - 1] += 1\n if balls[x_y[i][0] - 1] == 0:\n aka_list[x_y[i][0] - 1] = False\n\nprint(sum([1 for i in range(len(aka_list)) if aka_list[i]]))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "list(map(int, input().split())) for _ in range(m)", "for _ in range(m)", "_", "range(m)", "range", "m", "for _ in range(m)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "x_y = [list(map(int, input().split())) for _ in range(m)]", "x_y", "[list(map(int, input().split())) for _ in range(m)]", "aka_list = [True]", "aka_list", "[True]", "True", "for i in range(1, n):\n aka_list.append(False)", "i", "range(1, n)", "range", "1", "n", "aka_list.append(False)", "aka_list.append", "aka_list", "append", "False", "balls = [1] * n", "balls", "[1] * n", "[1]", "1", "n", "for i in range(m):\n if aka_list[x_y[i][0] - 1]:\n aka_list[x_y[i][1]-1] = True\n balls[x_y[i][0] - 1] -= 1\n balls[x_y[i][1] - 1] += 1\n if balls[x_y[i][0] - 1] == 0:\n aka_list[x_y[i][0] - 1] = False", "i", "range(m)", "range", "m", "if aka_list[x_y[i][0] - 1]:\n aka_list[x_y[i][1]-1] = True\n ", "aka_list[x_y[i][0] - 1]", "aka_list", "x_y[i][0] - 1", "x_y[i][0]", "[i]", "x_y", "i", "0", "1", "aka_list[x_y[i][1]-1] = True", "aka_list[x_y[i][1]-1]", "aka_list", "x_y[i][1]-1", "x_y[i][1]", "[i]", "x_y", "i", "1", "1", "True", "balls[x_y[i][0] - 1] -= 1", "balls[x_y[i][0] - 1]", "balls", "x_y[i][0] - 1", "x_y[i][0]", "[i]", "x_y", "i", "0", "1", "1", "balls[x_y[i][1] - 1] += 1", "balls[x_y[i][1] - 1]", "balls", "x_y[i][1] - 1", "x_y[i][1]", "[i]", "x_y", "i", "1", "1", "1", "if balls[x_y[i][0] - 1] == 0:\n aka_list[x_y[i][0] - 1] = False", "balls[x_y[i][0] - 1] == 0", "balls[x_y[i][0] - 1]", "balls", "x_y[i][0] - 1", "x_y[i][0]", "[i]", "x_y", "i", "0", "1", "0", "aka_list[x_y[i][0] - 1] = False", "aka_list[x_y[i][0] - 1]", "aka_list", "x_y[i][0] - 1", "x_y[i][0]", "[i]", "x_y", "i", "0", "1", "False", "1 for i in range(len(aka_list)) if aka_list[i]", "for i in range(len(aka_list)) if aka_list[i]", "i", "range(len(aka_list))", "range", "len(aka_list)", "len", "aka_list", "aka_list[i]", "aka_list", "i", "if aka_list[i]", "1", "print(sum([1 for i in range(len(aka_list)) if aka_list[i]]))", "print", "sum([1 for i in range(len(aka_list)) if aka_list[i]])", "sum", "[1 for i in range(len(aka_list)) if aka_list[i]]", "x_y = [list(map(int, input().split())) for _ in range(m)]", "[list(map(int, input().split())) for _ in range(m)]", "x_y", "m = map(int, input().split())", "map(int, input().split())", "m", "aka_list = [True]", "[True]", "aka_list", "n, m = map(int, input().split())", "map(int, input().split())", "n", "balls = [1] * n", "[1] * n", "balls" ]
n, m = map(int, input().split()) x_y = [list(map(int, input().split())) for _ in range(m)] aka_list = [True] for i in range(1, n): aka_list.append(False) balls = [1] * n for i in range(m): if aka_list[x_y[i][0] - 1]: aka_list[x_y[i][1]-1] = True balls[x_y[i][0] - 1] -= 1 balls[x_y[i][1] - 1] += 1 if balls[x_y[i][0] - 1] == 0: aka_list[x_y[i][0] - 1] = False print(sum([1 for i in range(len(aka_list)) if aka_list[i]]))
[ 7, 15, 13, 0, 13, 18, 13, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 4, 13, 17, 0, 13, 2, 17, 17, 12, 13, 0, 13, 4, 13, 13, 4, 18, 4, 18, 4, 18, 13, 13, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 18, 4, 18, 13, 13, 13, 13, 13, 14, 2, 40, 18, 13, 2, 13, 17, 17, 40, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 40, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 2, 13, 10, 18, 13, 10, 12, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 203, 4 ], [ 209, 16 ], [ 200, 21 ], [ 215, 28 ], [ 212, 33 ], [ 41, 40 ], [ 204, 50 ], [ 41, 54 ], [ 57, 56 ], [ 40, 60 ], [ 65, 62 ], [ 56, 63 ], [ 68, 67 ], [ 40, 71 ], [ 74, 73 ], [ 54, 76 ], [ 79, 78 ], [ 204, 88 ], [ 79, 92 ], [ 56, 97 ], [ 78, 99 ], [ 67, 104 ], [ 78, 106 ], [ 115, 110 ], [ 56, 111 ], [ 92, 113 ], [ 122, 117 ], [ 67, 118 ], [ 78, 120 ], [ 129, 124 ], [ 67, 125 ], [ 92, 127 ], [ 56, 134 ], [ 78, 136 ], [ 67, 141 ], [ 78, 143 ], [ 152, 147 ], [ 56, 148 ], [ 78, 150 ], [ 159, 154 ], [ 56, 155 ], [ 92, 157 ], [ 166, 161 ], [ 67, 162 ], [ 78, 164 ], [ 173, 168 ], [ 67, 169 ], [ 92, 171 ], [ 180, 175 ], [ 67, 176 ], [ 78, 178 ], [ 187, 182 ], [ 67, 183 ], [ 92, 185 ], [ 56, 192 ], [ 207, 198 ], [ 200, 201 ], [ 203, 204 ], [ 209, 210 ], [ 212, 213 ], [ 215, 216 ] ]
[ "import sys\n#import string\n#from collections import defaultdict, deque, Counter\n#import bisect\n#import heapq\n#import math\n#from itertools import accumulate\n#from itertools import permutations as perm\n#from itertools import combinations as comb\n#from itertools import combinations_with_replacement as combr\n#from fractions import gcd\n#import numpy as np\n\nstdin = sys.stdin\nsys.setrecursionlimit(10 ** 7)\nMIN = -10 ** 9\nMOD = 10 ** 9 + 7\nINF = float(\"inf\")\nIINF = 10 ** 18\n\ndef solve():\n #n = int(stdin.readline().rstrip())\n n,m = map(int, stdin.readline().rstrip().split())\n #l = list(map(int, stdin.readline().rstrip().split()))\n #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]\n #word = [stdin.readline().rstrip() for _ in range(n)]\n #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]\n #zeros = [[0] * w for i in range(h)]\n red = [0] * n\n red[0] = 1\n ball = [1] * n\n for i in range(m):\n x,y = map(int, stdin.readline().rstrip().split())\n if red[x-1] != 0 and ball[x-1] != 1:\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n elif red[x-1] != 0 and ball[x-1] == 1:\n red[x-1] = 0\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n else:\n ball[x-1] -= 1\n ball[y-1] += 1\n print(sum(red))\n\n\nif __name__ == '__main__':\n solve()", "import sys", "sys", "stdin = sys.stdin", "stdin", "sys.stdin", "sys", "stdin", "sys.setrecursionlimit(10 ** 7)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 7", "10", "7", "MIN = -10 ** 9", "MIN", "-10 ** 9", "-10", "9", "MOD = 10 ** 9 + 7", "MOD", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "INF = float(\"inf\")", "INF", "float(\"inf\")", "float", "\"inf\"", "IINF = 10 ** 18", "IINF", "10 ** 18", "10", "18", "def solve():\n #n = int(stdin.readline().rstrip())\n n,m = map(int, stdin.readline().rstrip().split())\n #l = list(map(int, stdin.readline().rstrip().split()))\n #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]\n #word = [stdin.readline().rstrip() for _ in range(n)]\n #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]\n #zeros = [[0] * w for i in range(h)]\n red = [0] * n\n red[0] = 1\n ball = [1] * n\n for i in range(m):\n x,y = map(int, stdin.readline().rstrip().split())\n if red[x-1] != 0 and ball[x-1] != 1:\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n elif red[x-1] != 0 and ball[x-1] == 1:\n red[x-1] = 0\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n else:\n ball[x-1] -= 1\n ball[y-1] += 1\n print(sum(red))", "solve", "n,m = map(int, stdin.readline().rstrip().split())", "n", "map(int, stdin.readline().rstrip().split())", "map", "int", "stdin.readline().rstrip().split()", "stdin.readline().rstrip().split", "stdin.readline().rstrip()", "stdin.readline().rstrip", "stdin.readline()", "stdin.readline", "stdin", "readline", "rstrip", "split", "m", "red = [0] * n", "red", "[0] * n", "[0]", "0", "n", "red[0] = 1", "red[0]", "red", "0", "1", "ball = [1] * n", "ball", "[1] * n", "[1]", "1", "n", "for i in range(m):\n x,y = map(int, stdin.readline().rstrip().split())\n if red[x-1] != 0 and ball[x-1] != 1:\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n elif red[x-1] != 0 and ball[x-1] == 1:\n red[x-1] = 0\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n else:\n ball[x-1] -= 1\n ball[y-1] += 1\n ", "i", "range(m)", "range", "m", "x,y = map(int, stdin.readline().rstrip().split())", "x", "map(int, stdin.readline().rstrip().split())", "map", "int", "stdin.readline().rstrip().split()", "stdin.readline().rstrip().split", "stdin.readline().rstrip()", "stdin.readline().rstrip", "stdin.readline()", "stdin.readline", "stdin", "readline", "rstrip", "split", "y", "if red[x-1] != 0 and ball[x-1] != 1:\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n elif red[x-1] != 0 and ball[x-1] == 1:\n red[x-1] = 0\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n else:\n ball[x-1] -= 1\n ball[y-1] += 1\n ", "red[x-1] != 0 and ball[x-1] != 1", "red[x-1] != 0", "red[x-1]", "red", "x-1", "x", "1", "0", "ball[x-1] != 1", "ball[x-1]", "ball", "x-1", "x", "1", "1", "red[y-1] = 1", "red[y-1]", "red", "y-1", "y", "1", "1", "ball[x-1] -= 1", "ball[x-1]", "ball", "x-1", "x", "1", "1", "ball[y-1] += 1", "ball[y-1]", "ball", "y-1", "y", "1", "1", "elif red[x-1] != 0 and ball[x-1] == 1:\n red[x-1] = 0\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n ", "red[x-1] != 0 and ball[x-1] == 1", "red[x-1] != 0", "red[x-1]", "red", "x-1", "x", "1", "0", "ball[x-1] == 1", "ball[x-1]", "ball", "x-1", "x", "1", "1", "red[x-1] = 0", "red[x-1]", "red", "x-1", "x", "1", "0", "red[y-1] = 1", "red[y-1]", "red", "y-1", "y", "1", "1", "ball[x-1] -= 1", "ball[x-1]", "ball", "x-1", "x", "1", "1", "ball[y-1] += 1", "ball[y-1]", "ball", "y-1", "y", "1", "1", "ball[x-1] -= 1", "ball[x-1]", "ball", "x-1", "x", "1", "1", "ball[y-1] += 1", "ball[y-1]", "ball", "y-1", "y", "1", "1", "print(sum(red))", "print", "sum(red)", "sum", "red", "if __name__ == '__main__':\n solve()", "__name__ == '__main__'", "__name__", "'__main__'", "solve()", "solve", "MOD = 10 ** 9 + 7", "10 ** 9 + 7", "MOD", "stdin = sys.stdin", "sys.stdin", "stdin", "def solve():\n #n = int(stdin.readline().rstrip())\n n,m = map(int, stdin.readline().rstrip().split())\n #l = list(map(int, stdin.readline().rstrip().split()))\n #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]\n #word = [stdin.readline().rstrip() for _ in range(n)]\n #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]\n #zeros = [[0] * w for i in range(h)]\n red = [0] * n\n red[0] = 1\n ball = [1] * n\n for i in range(m):\n x,y = map(int, stdin.readline().rstrip().split())\n if red[x-1] != 0 and ball[x-1] != 1:\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n elif red[x-1] != 0 and ball[x-1] == 1:\n red[x-1] = 0\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n else:\n ball[x-1] -= 1\n ball[y-1] += 1\n print(sum(red))", "def solve():\n #n = int(stdin.readline().rstrip())\n n,m = map(int, stdin.readline().rstrip().split())\n #l = list(map(int, stdin.readline().rstrip().split()))\n #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]\n #word = [stdin.readline().rstrip() for _ in range(n)]\n #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]\n #zeros = [[0] * w for i in range(h)]\n red = [0] * n\n red[0] = 1\n ball = [1] * n\n for i in range(m):\n x,y = map(int, stdin.readline().rstrip().split())\n if red[x-1] != 0 and ball[x-1] != 1:\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n elif red[x-1] != 0 and ball[x-1] == 1:\n red[x-1] = 0\n red[y-1] = 1\n ball[x-1] -= 1\n ball[y-1] += 1\n else:\n ball[x-1] -= 1\n ball[y-1] += 1\n print(sum(red))", "solve", "MIN = -10 ** 9", "-10 ** 9", "MIN", "IINF = 10 ** 18", "10 ** 18", "IINF", "INF = float(\"inf\")", "float(\"inf\")", "INF" ]
import sys #import string #from collections import defaultdict, deque, Counter #import bisect #import heapq #import math #from itertools import accumulate #from itertools import permutations as perm #from itertools import combinations as comb #from itertools import combinations_with_replacement as combr #from fractions import gcd #import numpy as np stdin = sys.stdin sys.setrecursionlimit(10 ** 7) MIN = -10 ** 9 MOD = 10 ** 9 + 7 INF = float("inf") IINF = 10 ** 18 def solve(): #n = int(stdin.readline().rstrip()) n,m = map(int, stdin.readline().rstrip().split()) #l = list(map(int, stdin.readline().rstrip().split())) #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin] #word = [stdin.readline().rstrip() for _ in range(n)] #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)] #zeros = [[0] * w for i in range(h)] red = [0] * n red[0] = 1 ball = [1] * n for i in range(m): x,y = map(int, stdin.readline().rstrip().split()) if red[x-1] != 0 and ball[x-1] != 1: red[y-1] = 1 ball[x-1] -= 1 ball[y-1] += 1 elif red[x-1] != 0 and ball[x-1] == 1: red[x-1] = 0 red[y-1] = 1 ball[x-1] -= 1 ball[y-1] += 1 else: ball[x-1] -= 1 ball[y-1] += 1 print(sum(red)) if __name__ == '__main__': solve()
[ 7, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 0, 13, 39, 28, 13, 4, 13, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 4, 18, 13, 13, 39, 2, 13, 17, 2, 13, 17, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 13, 13, 14, 2, 17, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 39, 13, 10, 13, 13 ]
[ [ 4, 3 ], [ 3, 12 ], [ 123, 14 ], [ 123, 16 ], [ 126, 18 ], [ 22, 21 ], [ 112, 24 ], [ 28, 27 ], [ 27, 36 ], [ 129, 38 ], [ 129, 40 ], [ 127, 43 ], [ 130, 47 ], [ 118, 50 ], [ 114, 53 ], [ 124, 57 ], [ 120, 59 ], [ 124, 63 ], [ 68, 65 ], [ 121, 66 ], [ 101, 76 ], [ 121, 77 ], [ 83, 80 ], [ 121, 81 ], [ 88, 85 ], [ 115, 86 ], [ 93, 90 ], [ 115, 91 ], [ 85, 96 ], [ 115, 97 ], [ 104, 101 ], [ 121, 102 ], [ 121, 109 ], [ 123, 112 ], [ 114, 115 ], [ 129, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ], [ 129, 130 ] ]
[ "n, m = (int(x) for x in input().split())\nab = []\nfor _ in range(m):\n a, b = (int(x) for x in input().split())\n ab.append([a-1, b-1])\n\nbox = [1]*n\n\nred = [0]*n\n\nred[0] = 1\n\nfor x,y in ab:\n if 0 < red[x]:\n red[y] = 1\n box[x] -= 1\n box[y] += 1\n\n if box[x] == 0:\n red[x] = 0\nprint(sum(red))", "int(x) for x in input().split()", "for x in input().split()", "x", "input().split()", "().split", "()", "input", "split", "for x in input().split()", "int(x)", "int", "x", "n, m = (int(x) for x in input().split())", "n", "(int(x) for x in input().split())", "m", "ab = []", "ab", "[]", "for _ in range(m):\n a, b = (int(x) for x in input().split())\n ab.append([a-1, b-1])", "_", "range(m)", "range", "m", "int(x) for x in input().split()", "for x in input().split()", "x", "input().split()", "().split", "()", "input", "split", "for x in input().split()", "int(x)", "int", "x", "a, b = (int(x) for x in input().split())", "a", "(int(x) for x in input().split())", "b", "ab.append([a-1, b-1])", "ab.append", "ab", "append", "[a-1, b-1]", "a-1", "a", "1", "b-1", "b", "1", "box = [1]*n", "box", "[1]*n", "[1]", "1", "n", "red = [0]*n", "red", "[0]*n", "[0]", "0", "n", "red[0] = 1", "red[0]", "red", "0", "1", "for x,y in ab:\n if 0 < red[x]:\n red[y] = 1\n box[x] -= 1\n box[y] += 1\n\n if box[x] == 0:\n red[x] = 0", "x", "y", "ab", "if 0 < red[x]:\n red[y] = 1\n ", "0 < red[x]", "0", "red[x]", "red", "x", "red[y] = 1", "red[y]", "red", "y", "1", "box[x] -= 1", "box[x]", "box", "x", "1", "box[y] += 1", "box[y]", "box", "y", "1", "if box[x] == 0:\n red[x] = 0", "box[x] == 0", "box[x]", "box", "x", "0", "red[x] = 0", "red[x]", "red", "x", "0", "print(sum(red))", "print", "sum(red)", "sum", "red", "m = (int(x) for x in input().split())", "(int(x) for x in input().split())", "m", "box = [1]*n", "[1]*n", "box", "b = (int(x) for x in input().split())", "(int(x) for x in input().split())", "b", "red = [0]*n", "[0]*n", "red", "n, m = (int(x) for x in input().split())", "(int(x) for x in input().split())", "n", "ab = []", "[]", "ab", "a, b = (int(x) for x in input().split())", "(int(x) for x in input().split())", "a" ]
n, m = (int(x) for x in input().split()) ab = [] for _ in range(m): a, b = (int(x) for x in input().split()) ab.append([a-1, b-1]) box = [1]*n red = [0]*n red[0] = 1 for x,y in ab: if 0 < red[x]: red[y] = 1 box[x] -= 1 box[y] += 1 if box[x] == 0: red[x] = 0 print(sum(red))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 13, 4, 18, 13, 13, 17, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 110, 2 ], [ 110, 11 ], [ 113, 13 ], [ 108, 17 ], [ 104, 19 ], [ 108, 23 ], [ 28, 25 ], [ 105, 26 ], [ 31, 30 ], [ 111, 33 ], [ 119, 35 ], [ 119, 44 ], [ 105, 47 ], [ 117, 49 ], [ 57, 52 ], [ 105, 53 ], [ 120, 55 ], [ 114, 62 ], [ 117, 64 ], [ 105, 68 ], [ 117, 70 ], [ 78, 73 ], [ 105, 74 ], [ 117, 76 ], [ 85, 80 ], [ 114, 81 ], [ 120, 83 ], [ 92, 87 ], [ 114, 88 ], [ 117, 90 ], [ 122, 94 ], [ 105, 97 ], [ 123, 102 ], [ 104, 105 ], [ 110, 108 ], [ 110, 111 ], [ 113, 114 ], [ 119, 117 ], [ 119, 120 ], [ 122, 123 ] ]
[ "n, m = map(int, input().split())\nball = [1]*n\nflg = [False]*n\nflg[0] = True\n\nfor _ in range(m):\n x, y = map(int, input().split())\n if flg[x-1]:\n flg[y-1] = True\n if ball[x-1] == 1 and flg[x-1]:\n flg[x-1] = False\n ball[y-1] += 1\n ball[x-1] -= 1\n # print(x, y, ball, flg)\n\nans = flg.count(True)\nprint(ans)", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "ball = [1]*n", "ball", "[1]*n", "[1]", "1", "n", "flg = [False]*n", "flg", "[False]*n", "[False]", "False", "n", "flg[0] = True", "flg[0]", "flg", "0", "True", "for _ in range(m):\n x, y = map(int, input().split())\n if flg[x-1]:\n flg[y-1] = True\n if ball[x-1] == 1 and flg[x-1]:\n flg[x-1] = False\n ball[y-1] += 1\n ball[x-1] -= 1\n # print(x, y, ball, flg)", "_", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if flg[x-1]:\n flg[y-1] = True\n ", "flg[x-1]", "flg", "x-1", "x", "1", "flg[y-1] = True", "flg[y-1]", "flg", "y-1", "y", "1", "True", "if ball[x-1] == 1 and flg[x-1]:\n flg[x-1] = False\n ", "ball[x-1] == 1 and flg[x-1]", "ball[x-1] == 1", "ball[x-1]", "ball", "x-1", "x", "1", "1", "flg[x-1]", "flg", "x-1", "x", "1", "flg[x-1] = False", "flg[x-1]", "flg", "x-1", "x", "1", "False", "ball[y-1] += 1", "ball[y-1]", "ball", "y-1", "y", "1", "1", "ball[x-1] -= 1", "ball[x-1]", "ball", "x-1", "x", "1", "1", "ans = flg.count(True)", "ans", "flg.count(True)", "flg.count", "flg", "count", "True", "print(ans)", "print", "ans", "flg = [False]*n", "[False]*n", "flg", "n, m = map(int, input().split())", "map(int, input().split())", "n", "m = map(int, input().split())", "map(int, input().split())", "m", "ball = [1]*n", "[1]*n", "ball", "x, y = map(int, input().split())", "map(int, input().split())", "x", "y = map(int, input().split())", "map(int, input().split())", "y", "ans = flg.count(True)", "flg.count(True)", "ans" ]
n, m = map(int, input().split()) ball = [1]*n flg = [False]*n flg[0] = True for _ in range(m): x, y = map(int, input().split()) if flg[x-1]: flg[y-1] = True if ball[x-1] == 1 and flg[x-1]: flg[x-1] = False ball[y-1] += 1 ball[x-1] -= 1 # print(x, y, ball, flg) ans = flg.count(True) print(ans)
[ 7, 15, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 18, 18, 13, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 41, 28, 13, 4, 13, 13, 4, 39, 17, 17, 0, 13, 13, 0, 18, 13, 17, 39, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 13, 17, 13, 2, 13, 17, 14, 2, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 2, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 2, 2, 18, 18, 13, 13, 17, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 2, 18, 18, 13, 13, 17, 17, 14, 2, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 2, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 2, 18, 18, 13, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 18, 13, 13, 17, 17, 4, 13, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 18, 13, 10, 4, 13 ]
[ [ 226, 11 ], [ 220, 18 ], [ 227, 25 ], [ 220, 27 ], [ 217, 29 ], [ 206, 33 ], [ 214, 35 ], [ 206, 39 ], [ 43, 42 ], [ 206, 45 ], [ 199, 51 ], [ 57, 54 ], [ 200, 55 ], [ 62, 61 ], [ 221, 64 ], [ 229, 66 ], [ 227, 73 ], [ 229, 75 ], [ 208, 77 ], [ 203, 79 ], [ 218, 79 ], [ 209, 79 ], [ 223, 81 ], [ 230, 83 ], [ 215, 83 ], [ 224, 83 ], [ 200, 89 ], [ 209, 90 ], [ 203, 90 ], [ 218, 90 ], [ 99, 94 ], [ 200, 96 ], [ 209, 97 ], [ 203, 97 ], [ 218, 97 ], [ 200, 102 ], [ 209, 103 ], [ 203, 103 ], [ 218, 103 ], [ 112, 107 ], [ 200, 109 ], [ 224, 110 ], [ 230, 110 ], [ 215, 110 ], [ 200, 116 ], [ 224, 117 ], [ 230, 117 ], [ 215, 117 ], [ 200, 121 ], [ 224, 122 ], [ 230, 122 ], [ 215, 122 ], [ 131, 126 ], [ 200, 128 ], [ 224, 129 ], [ 230, 129 ], [ 215, 129 ], [ 138, 133 ], [ 200, 135 ], [ 209, 136 ], [ 203, 136 ], [ 218, 136 ], [ 200, 141 ], [ 209, 142 ], [ 203, 142 ], [ 218, 142 ], [ 200, 149 ], [ 224, 150 ], [ 230, 150 ], [ 215, 150 ], [ 159, 154 ], [ 200, 156 ], [ 224, 157 ], [ 230, 157 ], [ 215, 157 ], [ 200, 162 ], [ 224, 163 ], [ 230, 163 ], [ 215, 163 ], [ 172, 167 ], [ 200, 169 ], [ 224, 170 ], [ 230, 170 ], [ 215, 170 ], [ 200, 175 ], [ 224, 176 ], [ 230, 176 ], [ 215, 176 ], [ 211, 180 ], [ 184, 183 ], [ 206, 186 ], [ 200, 191 ], [ 183, 192 ], [ 212, 197 ], [ 199, 200 ], [ 229, 203 ], [ 220, 206 ], [ 208, 209 ], [ 211, 212 ], [ 214, 215 ], [ 217, 218 ], [ 220, 221 ], [ 223, 224 ], [ 226, 227 ], [ 229, 230 ] ]
[ "import sys\nsys.setrecursionlimit(10 ** 7)\ninput = sys.stdin.readline\n\nn, m = map(int, input().split())\nx = [0]* n\ny = [0]* n\n\nbox = [[1, 0] for _ in range(n)]\nbox[0] = [0,1]\n\nfor i in range(m):\n x, y = map(int, input().split())\n x,y= x-1,y-1\n\n if box[x][1]>0:\n box[x][1] = box[x][1]-1\n box[y][1] = box[y][1] + box[y][0] + 1\n box[y][0] = 0\n else:\n box[x][0] = box[x][0]-1\n if box[y][1]>0:\n box[y][1] = box[y][1]+1\n else:\n box[y][0] = box[y][0]+1\n\nans = 0\nfor i in range(n):\n if box[i][1]>0: ans+=1\n\nprint(ans)\n", "import sys", "sys", "sys.setrecursionlimit(10 ** 7)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 7", "10", "7", "input = sys.stdin.readline", "input", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "x = [0]* n", "x", "[0]* n", "[0]", "0", "n", "y = [0]* n", "y", "[0]* n", "[0]", "0", "n", "[1, 0] for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "[1, 0]", "1", "0", "box = [[1, 0] for _ in range(n)]", "box", "[[1, 0] for _ in range(n)]", "box[0] = [0,1]", "box[0]", "box", "0", "[0,1]", "0", "1", "for i in range(m):\n x, y = map(int, input().split())\n x,y= x-1,y-1\n\n if box[x][1]>0:\n box[x][1] = box[x][1]-1\n box[y][1] = box[y][1] + box[y][0] + 1\n box[y][0] = 0\n else:\n box[x][0] = box[x][0]-1\n if box[y][1]>0:\n box[y][1] = box[y][1]+1\n else:\n box[y][0] = box[y][0]+1", "i", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x,y= x-1,y-1", "x", "x-1", "x", "1", "y", "y-1", "y", "1", "if box[x][1]>0:\n box[x][1] = box[x][1]-1\n box[y][1] = box[y][1] + box[y][0] + 1\n box[y][0] = 0\n else:\n box[x][0] = box[x][0]-1\n if box[y][1]>0:\n box[y][1] = box[y][1]+1\n else:\n box[y][0] = box[y][0]+1", "box[x][1]>0", "box[x][1]", "[x]", "box", "x", "1", "0", "box[x][1] = box[x][1]-1", "box[x][1]", "[x]", "box", "x", "1", "box[x][1]-1", "box[x][1]", "[x]", "box", "x", "1", "1", "box[y][1] = box[y][1] + box[y][0] + 1", "box[y][1]", "[y]", "box", "y", "1", "box[y][1] + box[y][0] + 1", "box[y][1] + box[y][0]", "box[y][1]", "[y]", "box", "y", "1", "box[y][0]", "[y]", "box", "y", "0", "1", "box[y][0] = 0", "box[y][0]", "[y]", "box", "y", "0", "0", "box[x][0] = box[x][0]-1", "box[x][0]", "[x]", "box", "x", "0", "box[x][0]-1", "box[x][0]", "[x]", "box", "x", "0", "1", "if box[y][1]>0:\n box[y][1] = box[y][1]+1\n else:\n box[y][0] = box[y][0]+1", "box[y][1]>0", "box[y][1]", "[y]", "box", "y", "1", "0", "box[y][1] = box[y][1]+1", "box[y][1]", "[y]", "box", "y", "1", "box[y][1]+1", "box[y][1]", "[y]", "box", "y", "1", "1", "box[y][0] = box[y][0]+1", "box[y][0]", "[y]", "box", "y", "0", "box[y][0]+1", "box[y][0]", "[y]", "box", "y", "0", "1", "ans = 0", "ans", "0", "for i in range(n):\n if box[i][1]>0: ans+=1", "i", "range(n)", "range", "n", "if box[i][1]>0: an", "box[i][1]>0", "box[i][1]", "[i]", "box", "i", "1", "0", "print(ans)", "print", "ans", "box = [[1, 0] for _ in range(n)]", "[[1, 0] for _ in range(n)]", "box", "x, y = map(int, input().split())", "map(int, input().split())", "x", "n, m = map(int, input().split())", "map(int, input().split())", "n", "x,y= x-1,y-1", "x-1", "x", "ans = 0", "0", "ans", "y = [0]* n", "[0]* n", "y", "x = [0]* n", "[0]* n", "x", "m = map(int, input().split())", "map(int, input().split())", "m", "y= x-1,y-1", "y-1", "y", "input = sys.stdin.readline", "sys.stdin.readline", "input", "y = map(int, input().split())", "map(int, input().split())", "y" ]
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline n, m = map(int, input().split()) x = [0]* n y = [0]* n box = [[1, 0] for _ in range(n)] box[0] = [0,1] for i in range(m): x, y = map(int, input().split()) x,y= x-1,y-1 if box[x][1]>0: box[x][1] = box[x][1]-1 box[y][1] = box[y][1] + box[y][0] + 1 box[y][0] = 0 else: box[x][0] = box[x][0]-1 if box[y][1]>0: box[y][1] = box[y][1]+1 else: box[y][0] = box[y][0]+1 ans = 0 for i in range(n): if box[i][1]>0: ans+=1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 13, 17, 0, 13, 4, 13, 39, 17, 0, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 13, 13, 0, 18, 13, 13, 13, 28, 13, 4, 13, 13, 0, 18, 13, 18, 13, 13, 17, 0, 18, 13, 18, 13, 13, 17, 14, 2, 18, 13, 13, 13, 4, 18, 13, 13, 18, 13, 13, 14, 2, 2, 18, 13, 18, 13, 13, 17, 2, 18, 13, 13, 13, 4, 18, 13, 13, 18, 13, 13, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 150, 2 ], [ 150, 11 ], [ 135, 13 ], [ 130, 17 ], [ 147, 19 ], [ 130, 23 ], [ 138, 25 ], [ 141, 28 ], [ 153, 34 ], [ 144, 37 ], [ 151, 42 ], [ 46, 45 ], [ 130, 48 ], [ 156, 50 ], [ 156, 59 ], [ 64, 61 ], [ 136, 62 ], [ 45, 63 ], [ 133, 64 ], [ 69, 66 ], [ 148, 67 ], [ 45, 68 ], [ 157, 69 ], [ 72, 71 ], [ 130, 74 ], [ 81, 76 ], [ 145, 77 ], [ 61, 78 ], [ 136, 79 ], [ 71, 80 ], [ 88, 83 ], [ 145, 84 ], [ 66, 85 ], [ 148, 86 ], [ 71, 87 ], [ 61, 91 ], [ 136, 92 ], [ 71, 93 ], [ 142, 94 ], [ 142, 97 ], [ 66, 99 ], [ 148, 100 ], [ 71, 101 ], [ 76, 105 ], [ 145, 106 ], [ 61, 107 ], [ 136, 108 ], [ 71, 109 ], [ 61, 112 ], [ 136, 113 ], [ 71, 114 ], [ 142, 115 ], [ 142, 118 ], [ 61, 120 ], [ 136, 121 ], [ 71, 122 ], [ 142, 127 ], [ 150, 130 ], [ 156, 133 ], [ 135, 136 ], [ 138, 139 ], [ 141, 142 ], [ 144, 145 ], [ 147, 148 ], [ 150, 151 ], [ 153, 154 ], [ 156, 157 ] ]
[ "N, M = map(int, input().split())\nX = [0] * (M)\nY = [0] * (M)\n\nstarted = False\ncontains_red = set([1])\nans = 1\n\nnums = [1] * (N + 1)\n\nfor _ in range(M):\n x, y = map(int, input().split())\n X[_] = x\n Y[_] = y\n\nfor _ in range(M):\n nums[X[_]] -= 1\n nums[Y[_]] += 1\n\n if X[_] in contains_red:\n contains_red.add(Y[_])\n\n if nums[X[_]] == 0 and X[_] in contains_red:\n contains_red.remove(X[_])\n\n# print(contains_red)\nprint(len(contains_red))", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "X = [0] * (M)", "X", "[0] * (M)", "[0]", "0", "M", "Y = [0] * (M)", "Y", "[0] * (M)", "[0]", "0", "M", "started = False", "started", "False", "contains_red = set([1])", "contains_red", "set([1])", "set", "[1]", "1", "ans = 1", "ans", "1", "nums = [1] * (N + 1)", "nums", "[1] * (N + 1)", "[1]", "1", "N + 1", "N", "1", "for _ in range(M):\n x, y = map(int, input().split())\n X[_] = x\n Y[_] = y", "_", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "X[_] = x", "X[_]", "X", "_", "x", "Y[_] = y", "Y[_]", "Y", "_", "y", "for _ in range(M):\n nums[X[_]] -= 1\n nums[Y[_]] += 1\n\n if X[_] in contains_red:\n contains_red.add(Y[_])\n\n if nums[X[_]] == 0 and X[_] in contains_red:\n contains_red.remove(X[_])\n\n# print(contains_red)", "_", "range(M)", "range", "M", "nums[X[_]] -= 1", "nums[X[_]]", "nums", "X[_]", "X", "_", "1", "nums[Y[_]] += 1", "nums[Y[_]]", "nums", "Y[_]", "Y", "_", "1", "if X[_] in contains_red:\n contains_red.add(Y[_])\n\n ", "X[_] in contains_red", "X[_]", "X", "_", "contains_red", "contains_red.add(Y[_])", "contains_red.add", "contains_red", "add", "Y[_]", "Y", "_", "if nums[X[_]] == 0 and X[_] in contains_red:\n contains_red.remove(X[_])\n\n# print(contains_red)", "nums[X[_]] == 0 and X[_] in contains_red", "nums[X[_]] == 0", "nums[X[_]]", "nums", "X[_]", "X", "_", "0", "X[_] in contains_red", "X[_]", "X", "_", "contains_red", "contains_red.remove(X[_])", "contains_red.remove", "contains_red", "remove", "X[_]", "X", "_", "print(len(contains_red))", "print", "len(contains_red)", "len", "contains_red", "M = map(int, input().split())", "map(int, input().split())", "M", "x, y = map(int, input().split())", "map(int, input().split())", "x", "X = [0] * (M)", "[0] * (M)", "X", "started = False", "False", "started", "contains_red = set([1])", "set([1])", "contains_red", "nums = [1] * (N + 1)", "[1] * (N + 1)", "nums", "Y = [0] * (M)", "[0] * (M)", "Y", "N, M = map(int, input().split())", "map(int, input().split())", "N", "ans = 1", "1", "ans", "y = map(int, input().split())", "map(int, input().split())", "y" ]
N, M = map(int, input().split()) X = [0] * (M) Y = [0] * (M) started = False contains_red = set([1]) ans = 1 nums = [1] * (N + 1) for _ in range(M): x, y = map(int, input().split()) X[_] = x Y[_] = y for _ in range(M): nums[X[_]] -= 1 nums[Y[_]] += 1 if X[_] in contains_red: contains_red.add(Y[_]) if nums[X[_]] == 0 and X[_] in contains_red: contains_red.remove(X[_]) # print(contains_red) print(len(contains_red))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 107, 2 ], [ 107, 11 ], [ 98, 13 ], [ 108, 17 ], [ 95, 19 ], [ 108, 27 ], [ 31, 30 ], [ 102, 33 ], [ 110, 35 ], [ 110, 44 ], [ 96, 48 ], [ 111, 50 ], [ 59, 54 ], [ 96, 55 ], [ 105, 57 ], [ 99, 63 ], [ 111, 65 ], [ 74, 69 ], [ 96, 70 ], [ 111, 72 ], [ 81, 76 ], [ 99, 77 ], [ 111, 79 ], [ 88, 83 ], [ 99, 84 ], [ 105, 86 ], [ 96, 93 ], [ 95, 96 ], [ 98, 99 ], [ 107, 102 ], [ 110, 105 ], [ 107, 108 ], [ 110, 111 ] ]
[ "N, M = map(int, input().split())\nc = [1] * N\nr = [True] + [False] * (N-1)\nfor i in range(M):\n x, y = map(int, input().split())\n if r[x-1] == True:\n r[y-1] = True\n if c[x-1] == 1:\n r[x-1] = False\n c[x-1] -= 1\n c[y-1] += 1\nprint(sum(r))", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "c = [1] * N", "c", "[1] * N", "[1]", "1", "N", "r = [True] + [False] * (N-1)", "r", "[True] + [False] * (N-1)", "[True]", "True", "[False] * (N-1)", "[False]", "False", "N-1", "N", "1", "for i in range(M):\n x, y = map(int, input().split())\n if r[x-1] == True:\n r[y-1] = True\n if c[x-1] == 1:\n r[x-1] = False\n c[x-1] -= 1\n c[y-1] += 1", "i", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if r[x-1] == True:\n r[y-1] = True\n ", "r[x-1] == True", "r[x-1]", "r", "x-1", "x", "1", "True", "r[y-1] = True", "r[y-1]", "r", "y-1", "y", "1", "True", "if c[x-1] == 1:\n r[x-1] = False\n ", "c[x-1] == 1", "c[x-1]", "c", "x-1", "x", "1", "1", "r[x-1] = False", "r[x-1]", "r", "x-1", "x", "1", "False", "c[x-1] -= 1", "c[x-1]", "c", "x-1", "x", "1", "1", "c[y-1] += 1", "c[y-1]", "c", "y-1", "y", "1", "1", "print(sum(r))", "print", "sum(r)", "sum", "r", "r = [True] + [False] * (N-1)", "[True] + [False] * (N-1)", "r", "c = [1] * N", "[1] * N", "c", "M = map(int, input().split())", "map(int, input().split())", "M", "y = map(int, input().split())", "map(int, input().split())", "y", "N, M = map(int, input().split())", "map(int, input().split())", "N", "x, y = map(int, input().split())", "map(int, input().split())", "x" ]
N, M = map(int, input().split()) c = [1] * N r = [True] + [False] * (N-1) for i in range(M): x, y = map(int, input().split()) if r[x-1] == True: r[y-1] = True if c[x-1] == 1: r[x-1] = False c[x-1] -= 1 c[y-1] += 1 print(sum(r))
[ 7, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 39, 17, 17, 0, 13, 13, 0, 18, 13, 17, 39, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 18, 13, 2, 13, 17, 17, 17, 14, 2, 18, 18, 13, 2, 13, 17, 17, 17, 0, 18, 13, 2, 13, 17, 39, 17, 2, 18, 18, 13, 2, 13, 17, 17, 17, 14, 2, 18, 18, 13, 2, 13, 17, 17, 17, 0, 18, 18, 13, 2, 13, 17, 17, 17, 0, 18, 18, 13, 2, 13, 17, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 18, 13, 13, 17, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 154, 2 ], [ 154, 13 ], [ 17, 16 ], [ 149, 19 ], [ 151, 25 ], [ 31, 28 ], [ 152, 29 ], [ 36, 35 ], [ 155, 38 ], [ 142, 40 ], [ 142, 51 ], [ 60, 53 ], [ 152, 55 ], [ 143, 57 ], [ 152, 65 ], [ 143, 67 ], [ 77, 72 ], [ 152, 73 ], [ 140, 75 ], [ 152, 82 ], [ 140, 84 ], [ 152, 92 ], [ 143, 94 ], [ 106, 99 ], [ 152, 101 ], [ 143, 103 ], [ 115, 108 ], [ 152, 110 ], [ 140, 112 ], [ 145, 117 ], [ 121, 120 ], [ 149, 123 ], [ 152, 128 ], [ 120, 129 ], [ 157, 133 ], [ 158, 137 ], [ 146, 137 ], [ 142, 140 ], [ 142, 143 ], [ 145, 146 ], [ 154, 149 ], [ 151, 152 ], [ 154, 155 ], [ 157, 158 ] ]
[ "n, m = list(map(int, input().split()))\nb = [[\"W\", 1] for _ in range(n)]\nb[0] = [\"R\", 1]\n\nfor i in range(m):\n x, y = list(map(int, input().split()))\n\n b[x-1][1] -= 1\n if b[x-1][0] == \"R\":\n b[y-1] = [\"R\", b[y-1][1]+1]\n\n if b[x-1][1] == 0:\n b[x-1][0] = \"W\"\n else:\n b[y-1][1] += 1\n\ncnt = 0\nfor i in range(n):\n if b[i][0] == \"R\":\n cnt += 1\n\nprint(cnt)", "n, m = list(map(int, input().split()))", "n", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "[\"W\", 1] for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "[\"W\", 1]", "\"W\"", "1", "b = [[\"W\", 1] for _ in range(n)]", "b", "[[\"W\", 1] for _ in range(n)]", "b[0] = [\"R\", 1]", "b[0]", "b", "0", "[\"R\", 1]", "\"R\"", "1", "for i in range(m):\n x, y = list(map(int, input().split()))\n\n b[x-1][1] -= 1\n if b[x-1][0] == \"R\":\n b[y-1] = [\"R\", b[y-1][1]+1]\n\n if b[x-1][1] == 0:\n b[x-1][0] = \"W\"\n else:\n b[y-1][1] += 1", "i", "range(m)", "range", "m", "x, y = list(map(int, input().split()))", "x", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "b[x-1][1] -= 1", "b[x-1][1]", "[x-1]", "b", "x-1", "x", "1", "1", "1", "if b[x-1][0] == \"R\":\n b[y-1] = [\"R\", b[y-1][1]+1]\n\n if b[x-1][1] == 0:\n b[x-1][0] = \"W\"\n else:\n b[y-1][1] += 1", "b[x-1][0] == \"R\"", "b[x-1][0]", "[x-1]", "b", "x-1", "x", "1", "0", "\"R\"", "b[y-1] = [\"R\", b[y-1][1]+1]", "b[y-1]", "b", "y-1", "y", "1", "[\"R\", b[y-1][1]+1]", "\"R\"", "b[y-1][1]+1", "b[y-1][1]", "[y-1]", "b", "y-1", "y", "1", "1", "1", "if b[x-1][1] == 0:\n b[x-1][0] = \"W\"\n ", "b[x-1][1] == 0", "b[x-1][1]", "[x-1]", "b", "x-1", "x", "1", "1", "0", "b[x-1][0] = \"W\"", "b[x-1][0]", "[x-1]", "b", "x-1", "x", "1", "0", "\"W\"", "b[y-1][1] += 1", "b[y-1][1]", "[y-1]", "b", "y-1", "y", "1", "1", "1", "cnt = 0", "cnt", "0", "for i in range(n):\n if b[i][0] == \"R\":\n cnt += 1", "i", "range(n)", "range", "n", "if b[i][0] == \"R\":\n cnt += 1", "b[i][0] == \"R\"", "b[i][0]", "[i]", "b", "i", "0", "\"R\"", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "y = list(map(int, input().split()))", "list(map(int, input().split()))", "y", "x, y = list(map(int, input().split()))", "list(map(int, input().split()))", "x", "cnt = 0", "0", "cnt", "n, m = list(map(int, input().split()))", "list(map(int, input().split()))", "n", "b = [[\"W\", 1] for _ in range(n)]", "[[\"W\", 1] for _ in range(n)]", "b", "m = list(map(int, input().split()))", "list(map(int, input().split()))", "m", "cnt += 1", "1", "cnt" ]
n, m = list(map(int, input().split())) b = [["W", 1] for _ in range(n)] b[0] = ["R", 1] for i in range(m): x, y = list(map(int, input().split())) b[x-1][1] -= 1 if b[x-1][0] == "R": b[y-1] = ["R", b[y-1][1]+1] if b[x-1][1] == 0: b[x-1][0] = "W" else: b[y-1][1] += 1 cnt = 0 for i in range(n): if b[i][0] == "R": cnt += 1 print(cnt)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 13, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 13, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 161, 2 ], [ 161, 11 ], [ 155, 13 ], [ 162, 17 ], [ 22, 19 ], [ 156, 20 ], [ 158, 24 ], [ 162, 28 ], [ 33, 30 ], [ 159, 31 ], [ 152, 35 ], [ 39, 38 ], [ 150, 41 ], [ 146, 43 ], [ 146, 52 ], [ 156, 56 ], [ 144, 58 ], [ 156, 64 ], [ 147, 66 ], [ 75, 70 ], [ 156, 71 ], [ 147, 73 ], [ 137, 77 ], [ 85, 80 ], [ 159, 81 ], [ 147, 83 ], [ 159, 89 ], [ 144, 91 ], [ 100, 95 ], [ 159, 96 ], [ 144, 98 ], [ 107, 102 ], [ 156, 103 ], [ 144, 105 ], [ 140, 109 ], [ 159, 114 ], [ 144, 116 ], [ 125, 120 ], [ 159, 121 ], [ 144, 123 ], [ 132, 127 ], [ 159, 128 ], [ 147, 130 ], [ 141, 135 ], [ 138, 135 ], [ 153, 135 ], [ 137, 138 ], [ 140, 141 ], [ 146, 144 ], [ 146, 147 ], [ 161, 150 ], [ 152, 153 ], [ 155, 156 ], [ 158, 159 ], [ 161, 162 ] ]
[ "N, M = map(int, input().split())\n\nred = [0]*N\nred[0] = 1\nwhite = [1]*N\nwhite[0] = 0\nans = 1\nfor i in range(M):\n a, b = map(int, input().split())\n if red[a-1] == 1:\n if red[b-1] == 0:\n red[b-1] += 1\n ans += 1\n else:\n white[b-1] += 1\n\n if white[a-1] > 0:\n white[a-1] -= 1\n else:\n red[a-1] -= 1\n ans -= 1\n elif white[a-1] > 0:\n white[a-1] -= 1\n white[b-1] += 1\nprint(ans)\n \n \n \n ", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "red = [0]*N", "red", "[0]*N", "[0]", "0", "N", "red[0] = 1", "red[0]", "red", "0", "1", "white = [1]*N", "white", "[1]*N", "[1]", "1", "N", "white[0] = 0", "white[0]", "white", "0", "0", "ans = 1", "ans", "1", "for i in range(M):\n a, b = map(int, input().split())\n if red[a-1] == 1:\n if red[b-1] == 0:\n red[b-1] += 1\n ans += 1\n else:\n white[b-1] += 1\n\n if white[a-1] > 0:\n white[a-1] -= 1\n else:\n red[a-1] -= 1\n ans -= 1\n elif white[a-1] > 0:\n white[a-1] -= 1\n white[b-1] += 1", "i", "range(M)", "range", "M", "a, b = map(int, input().split())", "a", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "if red[a-1] == 1:\n if red[b-1] == 0:\n red[b-1] += 1\n ans += 1\n else:\n white[b-1] += 1\n\n if white[a-1] > 0:\n white[a-1] -= 1\n else:\n red[a-1] -= 1\n ans -= 1\n elif white[a-1] > 0:\n white[a-1] -= 1\n white[b-1] += 1", "red[a-1] == 1", "red[a-1]", "red", "a-1", "a", "1", "1", "if red[b-1] == 0:\n red[b-1] += 1\n ans += 1\n else:\n white[b-1] += 1\n\n ", "red[b-1] == 0", "red[b-1]", "red", "b-1", "b", "1", "0", "red[b-1] += 1", "red[b-1]", "red", "b-1", "b", "1", "1", "ans += 1", "ans", "1", "white[b-1] += 1", "white[b-1]", "white", "b-1", "b", "1", "1", "if white[a-1] > 0:\n white[a-1] -= 1\n else:\n red[a-1] -= 1\n ans -= 1\n ", "white[a-1] > 0", "white[a-1]", "white", "a-1", "a", "1", "0", "white[a-1] -= 1", "white[a-1]", "white", "a-1", "a", "1", "1", "red[a-1] -= 1", "red[a-1]", "red", "a-1", "a", "1", "1", "ans -= 1", "ans", "1", "elif white[a-1] > 0:\n white[a-1] -= 1\n white[b-1] += 1", "white[a-1] > 0", "white[a-1]", "white", "a-1", "a", "1", "0", "white[a-1] -= 1", "white[a-1]", "white", "a-1", "a", "1", "1", "white[b-1] += 1", "white[b-1]", "white", "b-1", "b", "1", "1", "print(ans)", "print", "ans", "ans += 1", "1", "ans", "ans -= 1", "1", "ans", "a, b = map(int, input().split())", "map(int, input().split())", "a", "b = map(int, input().split())", "map(int, input().split())", "b", "M = map(int, input().split())", "map(int, input().split())", "M", "ans = 1", "1", "ans", "red = [0]*N", "[0]*N", "red", "white = [1]*N", "[1]*N", "white", "N, M = map(int, input().split())", "map(int, input().split())", "N" ]
N, M = map(int, input().split()) red = [0]*N red[0] = 1 white = [1]*N white[0] = 0 ans = 1 for i in range(M): a, b = map(int, input().split()) if red[a-1] == 1: if red[b-1] == 0: red[b-1] += 1 ans += 1 else: white[b-1] += 1 if white[a-1] > 0: white[a-1] -= 1 else: red[a-1] -= 1 ans -= 1 elif white[a-1] > 0: white[a-1] -= 1 white[b-1] += 1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 117, 2 ], [ 117, 11 ], [ 15, 14 ], [ 115, 17 ], [ 108, 21 ], [ 26, 25 ], [ 115, 28 ], [ 105, 32 ], [ 38, 35 ], [ 106, 36 ], [ 41, 40 ], [ 118, 43 ], [ 120, 45 ], [ 120, 54 ], [ 61, 56 ], [ 109, 57 ], [ 112, 59 ], [ 68, 63 ], [ 109, 64 ], [ 121, 66 ], [ 106, 72 ], [ 112, 74 ], [ 83, 78 ], [ 106, 79 ], [ 121, 81 ], [ 109, 87 ], [ 112, 89 ], [ 98, 93 ], [ 106, 94 ], [ 112, 96 ], [ 106, 103 ], [ 105, 106 ], [ 108, 109 ], [ 120, 112 ], [ 117, 115 ], [ 117, 118 ], [ 120, 121 ] ]
[ "N,M=map(int,input().split())\nbox=[1 for _ in range(N)]\nans=[0 for _ in range(N)]\nans[0]=1\nfor i in range(M):\n x,y=map(int,input().split())\n box[x-1]-=1\n box[y-1]+=1\n if ans[x-1]==1:\n ans[y-1]=1\n if box[x-1]==0:\n ans[x-1]=0\nprint(sum(ans))", "N,M=map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "1 for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "1", "box=[1 for _ in range(N)]", "box", "[1 for _ in range(N)]", "0 for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "0", "ans=[0 for _ in range(N)]", "ans", "[0 for _ in range(N)]", "ans[0]=1", "ans[0]", "ans", "0", "1", "for i in range(M):\n x,y=map(int,input().split())\n box[x-1]-=1\n box[y-1]+=1\n if ans[x-1]==1:\n ans[y-1]=1\n if box[x-1]==0:\n ans[x-1]=0", "i", "range(M)", "range", "M", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "box[x-1]-=1", "box[x-1]", "box", "x-1", "x", "1", "1", "box[y-1]+=1", "box[y-1]", "box", "y-1", "y", "1", "1", "if ans[x-1]==1:\n ans[y-1]=1\n ", "ans[x-1]==1", "ans[x-1]", "ans", "x-1", "x", "1", "1", "ans[y-1]=1", "ans[y-1]", "ans", "y-1", "y", "1", "1", "if box[x-1]==0:\n ans[x-1]=0", "box[x-1]==0", "box[x-1]", "box", "x-1", "x", "1", "0", "ans[x-1]=0", "ans[x-1]", "ans", "x-1", "x", "1", "0", "print(sum(ans))", "print", "sum(ans)", "sum", "ans", "ans=[0 for _ in range(N)]", "[0 for _ in range(N)]", "ans", "box=[1 for _ in range(N)]", "[1 for _ in range(N)]", "box", "x,y=map(int,input().split())", "map(int,input().split())", "x", "N,M=map(int,input().split())", "map(int,input().split())", "N", "M=map(int,input().split())", "map(int,input().split())", "M", "y=map(int,input().split())", "map(int,input().split())", "y" ]
N,M=map(int,input().split()) box=[1 for _ in range(N)] ans=[0 for _ in range(N)] ans[0]=1 for i in range(M): x,y=map(int,input().split()) box[x-1]-=1 box[y-1]+=1 if ans[x-1]==1: ans[y-1]=1 if box[x-1]==0: ans[x-1]=0 print(sum(ans))
[ 7, 15, 15, 15, 15, 13, 15, 13, 15, 13, 4, 18, 13, 13, 17, 0, 13, 2, 2, 17, 17, 17, 12, 13, 29, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 12, 13, 29, 4, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 12, 2, 4, 13, 13, 17, 23, 4, 18, 4, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 12, 13, 10, 4, 13, 10, 4, 13, 10, 12, 13 ]
[ [ 127, 16 ], [ 145, 43 ], [ 149, 45 ], [ 145, 46 ], [ 133, 48 ], [ 125, 52 ], [ 130, 54 ], [ 125, 62 ], [ 66, 65 ], [ 146, 68 ], [ 142, 70 ], [ 142, 85 ], [ 90, 87 ], [ 134, 88 ], [ 143, 89 ], [ 95, 92 ], [ 134, 93 ], [ 137, 94 ], [ 131, 98 ], [ 143, 99 ], [ 104, 101 ], [ 131, 102 ], [ 137, 103 ], [ 87, 107 ], [ 134, 108 ], [ 143, 109 ], [ 115, 112 ], [ 131, 113 ], [ 143, 114 ], [ 131, 120 ], [ 145, 125 ], [ 127, 128 ], [ 130, 131 ], [ 133, 134 ], [ 142, 137 ], [ 142, 143 ], [ 145, 146 ] ]
[ "#from statistics import median\n#import collections\n#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]\nfrom fractions import gcd\nfrom itertools import combinations,permutations,accumulate # (string,3) 3回\n#from collections import deque\nfrom collections import deque,defaultdict,Counter\nimport decimal\nimport re\n#import bisect\n#\n# d = m - k[i] - k[j]\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n#\n#\n#\n# pythonで無理なときは、pypyでやると正解するかも!!\n#\n#\n\nimport sys\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n#mod = 9982443453\ndef readInts():\n return list(map(int,input().split()))\ndef I():\n return int(input())\nn,m = readInts()\nbox = [1] * n\nnya = [True] + [False]*(n-1)\nfor i in range(m):\n x,y = map(lambda x:int(x)-1,input().split())\n # if box[x] < 2:\n # if nya[x] == True:\n # if box[x]-1 == 0:\n # nya[x] = False\n # nya[y] = True\n # else:\n # nya[y] = False\n # box[x] -= 1\n # box[y] += 1\n # else:\n # nya[y] = True\n # box[x] -= 1\n # box[y] += 1\n box[x] -= 1\n box[y] += 1\n if nya[x]:\n nya[y] = True\n if box[x] == 0:\n nya[x] = False\nprint(nya.count(True))", "from fractions import gcd", "from itertools import combinations,permutations,accumulate", "from collections import deque,defaultdict,Counter", "import decimal", "decimal", "import re", "re", "import sys", "sys", "sys.setrecursionlimit(10000000)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10000000", "mod = 10**9 + 7", "mod", "10**9 + 7", "10**9", "10", "9", "7", "def readInts():\n return list(map(int,input().split()))", "readInts", "return list(map(int,input().split()))", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "def I():\n return int(input())", "I", "return int(input())", "int(input())", "int", "input()", "input", "n,m = readInts()", "n", "readInts()", "readInts", "m", "box = [1] * n", "box", "[1] * n", "[1]", "1", "n", "nya = [True] + [False]*(n-1)", "nya", "[True] + [False]*(n-1)", "[True]", "True", "[False]*(n-1)", "[False]", "False", "n-1", "n", "1", "for i in range(m):\n x,y = map(lambda x:int(x)-1,input().split())\n # if box[x] < 2:\n # if nya[x] == True:\n # if box[x]-1 == 0:\n # nya[x] = False\n # nya[y] = True\n # else:\n # nya[y] = False\n # box[x] -= 1\n # box[y] += 1\n # else:\n # nya[y] = True\n # box[x] -= 1\n # box[y] += 1\n box[x] -= 1\n box[y] += 1\n if nya[x]:\n nya[y] = True\n if box[x] == 0:\n nya[x] = False", "i", "range(m)", "range", "m", "x,y = map(lambda x:int(x)-1,input().split())", "x", "map(lambda x:int(x)-1,input().split())", "map", "lambda x:int(x)-1", "int(x)-1", "int(x)", "int", "x", "1", "x", "input().split()", "().split", "()", "input", "split", "y", "box[x] -= 1", "box[x]", "box", "x", "1", "box[y] += 1", "box[y]", "box", "y", "1", "if nya[x]:\n nya[y] = True\n ", "nya[x]", "nya", "x", "nya[y] = True", "nya[y]", "nya", "y", "True", "if box[x] == 0:\n nya[x] = False", "box[x] == 0", "box[x]", "box", "x", "0", "nya[x] = False", "nya[x]", "nya", "x", "False", "print(nya.count(True))", "print", "nya.count(True)", "nya.count", "nya", "count", "True", "n,m = readInts()", "readInts()", "n", "mod = 10**9 + 7", "10**9 + 7", "mod", "nya = [True] + [False]*(n-1)", "[True] + [False]*(n-1)", "nya", "box = [1] * n", "[1] * n", "box", "y = map(lambda x:int(x)-1,input().split())", "map(lambda x:int(x)-1,input().split())", "y", "def I():\n return int(input())", "def I():\n return int(input())", "I", "x,y = map(lambda x:int(x)-1,input().split())", "map(lambda x:int(x)-1,input().split())", "x", "m = readInts()", "readInts()", "m", "def readInts():\n return list(map(int,input().split()))", "def readInts():\n return list(map(int,input().split()))", "readInts" ]
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate # (string,3) 3回 #from collections import deque from collections import deque,defaultdict,Counter import decimal import re #import bisect # # d = m - k[i] - k[j] # if kk[bisect.bisect_right(kk,d) - 1] == d: # # # # pythonで無理なときは、pypyでやると正解するかも!! # # import sys sys.setrecursionlimit(10000000) mod = 10**9 + 7 #mod = 9982443453 def readInts(): return list(map(int,input().split())) def I(): return int(input()) n,m = readInts() box = [1] * n nya = [True] + [False]*(n-1) for i in range(m): x,y = map(lambda x:int(x)-1,input().split()) # if box[x] < 2: # if nya[x] == True: # if box[x]-1 == 0: # nya[x] = False # nya[y] = True # else: # nya[y] = False # box[x] -= 1 # box[y] += 1 # else: # nya[y] = True # box[x] -= 1 # box[y] += 1 box[x] -= 1 box[y] += 1 if nya[x]: nya[y] = True if box[x] == 0: nya[x] = False print(nya.count(True))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 102, 2 ], [ 102, 11 ], [ 99, 13 ], [ 88, 18 ], [ 24, 21 ], [ 100, 22 ], [ 96, 26 ], [ 88, 31 ], [ 35, 34 ], [ 103, 37 ], [ 93, 39 ], [ 93, 48 ], [ 53, 50 ], [ 97, 51 ], [ 91, 52 ], [ 58, 55 ], [ 97, 56 ], [ 94, 57 ], [ 77, 61 ], [ 100, 62 ], [ 91, 63 ], [ 69, 66 ], [ 100, 67 ], [ 94, 68 ], [ 50, 72 ], [ 97, 73 ], [ 91, 74 ], [ 80, 77 ], [ 100, 78 ], [ 91, 79 ], [ 100, 85 ], [ 102, 88 ], [ 93, 91 ], [ 93, 94 ], [ 96, 97 ], [ 99, 100 ], [ 102, 103 ] ]
[ "# AGC002 B Box and Ball\n\nn, m = map(int, input().split())\n\nb_list = [0] * (n+1)\nb_list[1] = 1\nc_list = [1] * (n+1)\n\nfor i in range(m):\n _x, _y = map(int, input().split())\n c_list[_x] -= 1\n c_list[_y] += 1 \n if b_list[_x] == 1:\n b_list[_y] = 1\n if c_list[_x] == 0:\n b_list[_x] = 0\n\nprint(sum(b_list))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "b_list = [0] * (n+1)", "b_list", "[0] * (n+1)", "[0]", "0", "n+1", "n", "1", "b_list[1] = 1", "b_list[1]", "b_list", "1", "1", "c_list = [1] * (n+1)", "c_list", "[1] * (n+1)", "[1]", "1", "n+1", "n", "1", "for i in range(m):\n _x, _y = map(int, input().split())\n c_list[_x] -= 1\n c_list[_y] += 1 \n if b_list[_x] == 1:\n b_list[_y] = 1\n if c_list[_x] == 0:\n b_list[_x] = 0", "i", "range(m)", "range", "m", "_x, _y = map(int, input().split())", "_x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "_y", "c_list[_x] -= 1", "c_list[_x]", "c_list", "_x", "1", "c_list[_y] += 1", "c_list[_y]", "c_list", "_y", "1", "if b_list[_x] == 1:\n b_list[_y] = 1\n if c_list[_x] == 0:\n b_list[_x] = 0", "b_list[_x] == 1", "b_list[_x]", "b_list", "_x", "1", "b_list[_y] = 1", "b_list[_y]", "b_list", "_y", "1", "if c_list[_x] == 0:\n b_list[_x] = 0", "c_list[_x] == 0", "c_list[_x]", "c_list", "_x", "0", "b_list[_x] = 0", "b_list[_x]", "b_list", "_x", "0", "print(sum(b_list))", "print", "sum(b_list)", "sum", "b_list", "n, m = map(int, input().split())", "map(int, input().split())", "n", "_x, _y = map(int, input().split())", "map(int, input().split())", "_x", "_y = map(int, input().split())", "map(int, input().split())", "_y", "c_list = [1] * (n+1)", "[1] * (n+1)", "c_list", "b_list = [0] * (n+1)", "[0] * (n+1)", "b_list", "m = map(int, input().split())", "map(int, input().split())", "m" ]
# AGC002 B Box and Ball n, m = map(int, input().split()) b_list = [0] * (n+1) b_list[1] = 1 c_list = [1] * (n+1) for i in range(m): _x, _y = map(int, input().split()) c_list[_x] -= 1 c_list[_y] += 1 if b_list[_x] == 1: b_list[_y] = 1 if c_list[_x] == 0: b_list[_x] = 0 print(sum(b_list))
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 2, 17, 17, 0, 13, 2, 17, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 13, 17, 13, 2, 13, 17, 14, 18, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 18, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 135, 4 ], [ 126, 18 ], [ 141, 25 ], [ 144, 30 ], [ 150, 35 ], [ 136, 42 ], [ 150, 44 ], [ 123, 46 ], [ 133, 50 ], [ 153, 52 ], [ 133, 56 ], [ 61, 58 ], [ 154, 59 ], [ 64, 63 ], [ 151, 66 ], [ 156, 68 ], [ 136, 75 ], [ 156, 77 ], [ 138, 79 ], [ 157, 81 ], [ 139, 81 ], [ 147, 83 ], [ 130, 85 ], [ 148, 85 ], [ 154, 89 ], [ 139, 90 ], [ 157, 90 ], [ 108, 93 ], [ 124, 94 ], [ 139, 95 ], [ 157, 95 ], [ 101, 98 ], [ 154, 99 ], [ 139, 100 ], [ 157, 100 ], [ 106, 103 ], [ 154, 104 ], [ 148, 105 ], [ 130, 105 ], [ 111, 108 ], [ 124, 109 ], [ 139, 110 ], [ 157, 110 ], [ 116, 113 ], [ 124, 114 ], [ 148, 115 ], [ 130, 115 ], [ 154, 121 ], [ 123, 124 ], [ 126, 127 ], [ 156, 130 ], [ 150, 133 ], [ 135, 136 ], [ 138, 139 ], [ 141, 142 ], [ 144, 145 ], [ 147, 148 ], [ 150, 151 ], [ 153, 154 ], [ 156, 157 ] ]
[ "import sys\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\n#mod = 998244353\nINF = 10**18\neps = 10**-7\n\nN,M = map(int,readline().split())\n\nc = [1]*N\nr = [0]*N\nr[0] = 1\n\nfor _ in range(M):\n x,y = map(int,readline().split())\n x,y = x-1,y-1\n if r[x]:\n if c[x] == 1:\n r[x] = 0\n r[y] = 1\n c[x] -= 1\n c[y] += 1\n\nprint(sum(r))", "import sys", "sys", "readline = sys.stdin.readline", "readline", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "sys.setrecursionlimit(10**8)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**8", "10", "8", "mod = 10**9+7", "mod", "10**9+7", "10**9", "10", "9", "7", "INF = 10**18", "INF", "10**18", "10", "18", "eps = 10**-7", "eps", "10**-7", "10", "-7", "N,M = map(int,readline().split())", "N", "map(int,readline().split())", "map", "int", "readline().split()", "().split", "()", "readline", "split", "M", "c = [1]*N", "c", "[1]*N", "[1]", "1", "N", "r = [0]*N", "r", "[0]*N", "[0]", "0", "N", "r[0] = 1", "r[0]", "r", "0", "1", "for _ in range(M):\n x,y = map(int,readline().split())\n x,y = x-1,y-1\n if r[x]:\n if c[x] == 1:\n r[x] = 0\n r[y] = 1\n c[x] -= 1\n c[y] += 1", "_", "range(M)", "range", "M", "x,y = map(int,readline().split())", "x", "map(int,readline().split())", "map", "int", "readline().split()", "().split", "()", "readline", "split", "y", "x,y = x-1,y-1", "x", "x-1", "x", "1", "y", "y-1", "y", "1", "if r[x]:\n if c[x] == 1:\n r[x] = 0\n r[y] = 1\n ", "r[x]", "r", "x", "if c[x] == 1:\n r[x] = 0\n ", "c[x] == 1", "c[x]", "c", "x", "1", "r[x] = 0", "r[x]", "r", "x", "0", "r[y] = 1", "r[y]", "r", "y", "1", "c[x] -= 1", "c[x]", "c", "x", "1", "c[y] += 1", "c[y]", "c", "y", "1", "print(sum(r))", "print", "sum(r)", "sum", "r", "c = [1]*N", "[1]*N", "c", "mod = 10**9+7", "10**9+7", "mod", "y = map(int,readline().split())", "map(int,readline().split())", "y", "N,M = map(int,readline().split())", "map(int,readline().split())", "N", "readline = sys.stdin.readline", "sys.stdin.readline", "readline", "x,y = x-1,y-1", "x-1", "x", "INF = 10**18", "10**18", "INF", "eps = 10**-7", "10**-7", "eps", "y = x-1,y-1", "y-1", "y", "M = map(int,readline().split())", "map(int,readline().split())", "M", "r = [0]*N", "[0]*N", "r", "x,y = map(int,readline().split())", "map(int,readline().split())", "x" ]
import sys readline = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 #mod = 998244353 INF = 10**18 eps = 10**-7 N,M = map(int,readline().split()) c = [1]*N r = [0]*N r[0] = 1 for _ in range(M): x,y = map(int,readline().split()) x,y = x-1,y-1 if r[x]: if c[x] == 1: r[x] = 0 r[y] = 1 c[x] -= 1 c[y] += 1 print(sum(r))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 2, 18, 13, 13, 17, 40, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 134, 2 ], [ 134, 11 ], [ 125, 13 ], [ 135, 17 ], [ 116, 19 ], [ 135, 23 ], [ 28, 25 ], [ 126, 26 ], [ 31, 30 ], [ 129, 33 ], [ 122, 35 ], [ 122, 44 ], [ 143, 46 ], [ 131, 49 ], [ 55, 52 ], [ 117, 53 ], [ 144, 54 ], [ 120, 54 ], [ 60, 57 ], [ 117, 58 ], [ 132, 59 ], [ 123, 59 ], [ 85, 63 ], [ 126, 64 ], [ 144, 65 ], [ 120, 65 ], [ 71, 68 ], [ 126, 69 ], [ 132, 70 ], [ 123, 70 ], [ 85, 75 ], [ 126, 76 ], [ 144, 77 ], [ 120, 77 ], [ 52, 80 ], [ 117, 81 ], [ 144, 82 ], [ 120, 82 ], [ 88, 85 ], [ 126, 86 ], [ 144, 87 ], [ 120, 87 ], [ 140, 90 ], [ 94, 93 ], [ 135, 96 ], [ 126, 101 ], [ 93, 102 ], [ 117, 106 ], [ 93, 107 ], [ 137, 110 ], [ 138, 114 ], [ 141, 114 ], [ 116, 117 ], [ 122, 120 ], [ 122, 123 ], [ 125, 126 ], [ 134, 129 ], [ 131, 132 ], [ 134, 135 ], [ 137, 138 ], [ 140, 141 ], [ 143, 144 ] ]
[ "n,m = map(int,input().split())\nflag = [False]*n\nballs = [1]*n\nflag[0]= True\nfor i in range(m):\n x,y = map(int,input().split())\n x -= 1\n y -= 1\n balls[x] -=1\n balls[y] += 1\n if flag[x] == True:\n flag[y] =True\n if flag[x] == True and balls[x] == 0:\n flag[x] = False\n\ncnt = 0\nfor i in range(n):\n if flag[i] == True and balls[i]>=1:\n cnt += 1\nprint(cnt)", "n,m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "flag = [False]*n", "flag", "[False]*n", "[False]", "False", "n", "balls = [1]*n", "balls", "[1]*n", "[1]", "1", "n", "flag[0]= True", "flag[0]", "flag", "0", "True", "for i in range(m):\n x,y = map(int,input().split())\n x -= 1\n y -= 1\n balls[x] -=1\n balls[y] += 1\n if flag[x] == True:\n flag[y] =True\n if flag[x] == True and balls[x] == 0:\n flag[x] = False", "i", "range(m)", "range", "m", "x,y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "balls[x] -=1", "balls[x]", "balls", "x", "1", "balls[y] += 1", "balls[y]", "balls", "y", "1", "if flag[x] == True:\n flag[y] =True\n ", "flag[x] == True", "flag[x]", "flag", "x", "True", "flag[y] =True", "flag[y]", "flag", "y", "True", "if flag[x] == True and balls[x] == 0:\n flag[x] = False", "flag[x] == True and balls[x] == 0", "flag[x] == True", "flag[x]", "flag", "x", "True", "balls[x] == 0", "balls[x]", "balls", "x", "0", "flag[x] = False", "flag[x]", "flag", "x", "False", "cnt = 0", "cnt", "0", "for i in range(n):\n if flag[i] == True and balls[i]>=1:\n cnt += 1", "i", "range(n)", "range", "n", "if flag[i] == True and balls[i]>=1:\n cnt += 1", "flag[i] == True and balls[i]>=1", "flag[i] == True", "flag[i]", "flag", "i", "True", "balls[i]>=1", "balls[i]", "balls", "i", "1", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "balls = [1]*n", "[1]*n", "balls", "x,y = map(int,input().split())", "map(int,input().split())", "x", "y = map(int,input().split())", "map(int,input().split())", "y", "flag = [False]*n", "[False]*n", "flag", "m = map(int,input().split())", "map(int,input().split())", "m", "y -= 1", "1", "y", "n,m = map(int,input().split())", "map(int,input().split())", "n", "cnt += 1", "1", "cnt", "cnt = 0", "0", "cnt", "x -= 1", "1", "x" ]
n,m = map(int,input().split()) flag = [False]*n balls = [1]*n flag[0]= True for i in range(m): x,y = map(int,input().split()) x -= 1 y -= 1 balls[x] -=1 balls[y] += 1 if flag[x] == True: flag[y] =True if flag[x] == True and balls[x] == 0: flag[x] = False cnt = 0 for i in range(n): if flag[i] == True and balls[i]>=1: cnt += 1 print(cnt)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 28, 13, 4, 13, 13, 0, 13, 2, 18, 18, 13, 13, 17, 17, 0, 13, 2, 18, 18, 13, 13, 17, 17, 14, 2, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 10, 13, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13 ]
[ [ 175, 2 ], [ 175, 11 ], [ 15, 14 ], [ 170, 17 ], [ 163, 30 ], [ 35, 34 ], [ 176, 37 ], [ 166, 41 ], [ 47, 44 ], [ 167, 45 ], [ 51, 50 ], [ 176, 53 ], [ 178, 57 ], [ 61, 60 ], [ 170, 63 ], [ 172, 65 ], [ 164, 69 ], [ 60, 70 ], [ 181, 74 ], [ 164, 78 ], [ 60, 79 ], [ 146, 84 ], [ 131, 84 ], [ 115, 84 ], [ 95, 84 ], [ 179, 85 ], [ 173, 86 ], [ 105, 90 ], [ 167, 91 ], [ 173, 92 ], [ 98, 95 ], [ 179, 96 ], [ 173, 97 ], [ 103, 100 ], [ 179, 101 ], [ 182, 102 ], [ 108, 105 ], [ 167, 106 ], [ 173, 107 ], [ 113, 110 ], [ 167, 111 ], [ 182, 112 ], [ 118, 115 ], [ 179, 116 ], [ 173, 117 ], [ 123, 120 ], [ 179, 121 ], [ 182, 122 ], [ 105, 126 ], [ 167, 127 ], [ 173, 128 ], [ 134, 131 ], [ 179, 132 ], [ 173, 133 ], [ 139, 136 ], [ 179, 137 ], [ 182, 138 ], [ 144, 141 ], [ 167, 142 ], [ 182, 143 ], [ 149, 146 ], [ 179, 147 ], [ 173, 148 ], [ 154, 151 ], [ 179, 152 ], [ 182, 153 ], [ 167, 159 ], [ 163, 164 ], [ 166, 167 ], [ 175, 170 ], [ 172, 173 ], [ 175, 176 ], [ 178, 179 ], [ 181, 182 ] ]
[ "n, m = map(int,input().split())\nxy = [list(map(int,input().split())) for i in range(m)]\n\nred_boxes = [False for i in range(n)]\nred_boxes[0] = True\nn_ball = [1 for i in range(n)]\n\n\nfor i in range(m):\n x_i = xy[i][0]-1\n y_i = xy[i][1]-1\n \n if n_ball[x_i] == 1:\n if red_boxes[x_i] == True:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n red_boxes[x_i] = False\n red_boxes[y_i] = True\n \n else:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n \n else:\n if red_boxes[x_i] == True:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n red_boxes[y_i] = True\n \n else:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n \n \n \nprint(red_boxes.count(True))", "n, m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "list(map(int,input().split())) for i in range(m)", "for i in range(m)", "i", "range(m)", "range", "m", "for i in range(m)", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "xy = [list(map(int,input().split())) for i in range(m)]", "xy", "[list(map(int,input().split())) for i in range(m)]", "False for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "False", "red_boxes = [False for i in range(n)]", "red_boxes", "[False for i in range(n)]", "red_boxes[0] = True", "red_boxes[0]", "red_boxes", "0", "True", "1 for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "1", "n_ball = [1 for i in range(n)]", "n_ball", "[1 for i in range(n)]", "for i in range(m):\n x_i = xy[i][0]-1\n y_i = xy[i][1]-1\n \n if n_ball[x_i] == 1:\n if red_boxes[x_i] == True:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n red_boxes[x_i] = False\n red_boxes[y_i] = True\n \n else:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n \n else:\n if red_boxes[x_i] == True:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n red_boxes[y_i] = True\n \n else:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n \n \n ", "i", "range(m)", "range", "m", "x_i = xy[i][0]-1", "x_i", "xy[i][0]-1", "xy[i][0]", "[i]", "xy", "i", "0", "1", "y_i = xy[i][1]-1", "y_i", "xy[i][1]-1", "xy[i][1]", "[i]", "xy", "i", "1", "1", "if n_ball[x_i] == 1:\n if red_boxes[x_i] == True:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n red_boxes[x_i] = False\n red_boxes[y_i] = True\n \n else:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n \n else:\n if red_boxes[x_i] == True:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n red_boxes[y_i] = True\n \n else:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n \n \n ", "n_ball[x_i] == 1", "n_ball[x_i]", "n_ball", "x_i", "1", "if red_boxes[x_i] == True:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n red_boxes[x_i] = False\n red_boxes[y_i] = True\n \n else:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n \n ", "red_boxes[x_i] == True", "red_boxes[x_i]", "red_boxes", "x_i", "True", "n_ball[x_i] -= 1", "n_ball[x_i]", "n_ball", "x_i", "1", "n_ball[y_i] += 1", "n_ball[y_i]", "n_ball", "y_i", "1", "red_boxes[x_i] = False", "red_boxes[x_i]", "red_boxes", "x_i", "False", "red_boxes[y_i] = True", "red_boxes[y_i]", "red_boxes", "y_i", "True", "n_ball[x_i] -= 1", "n_ball[x_i]", "n_ball", "x_i", "1", "n_ball[y_i] += 1", "n_ball[y_i]", "n_ball", "y_i", "1", "if red_boxes[x_i] == True:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n red_boxes[y_i] = True\n \n else:\n n_ball[x_i] -= 1\n n_ball[y_i] += 1\n \n \n ", "red_boxes[x_i] == True", "red_boxes[x_i]", "red_boxes", "x_i", "True", "n_ball[x_i] -= 1", "n_ball[x_i]", "n_ball", "x_i", "1", "n_ball[y_i] += 1", "n_ball[y_i]", "n_ball", "y_i", "1", "red_boxes[y_i] = True", "red_boxes[y_i]", "red_boxes", "y_i", "True", "n_ball[x_i] -= 1", "n_ball[x_i]", "n_ball", "x_i", "1", "n_ball[y_i] += 1", "n_ball[y_i]", "n_ball", "y_i", "1", "print(red_boxes.count(True))", "print", "red_boxes.count(True)", "red_boxes.count", "red_boxes", "count", "True", "xy = [list(map(int,input().split())) for i in range(m)]", "[list(map(int,input().split())) for i in range(m)]", "xy", "red_boxes = [False for i in range(n)]", "[False for i in range(n)]", "red_boxes", "m = map(int,input().split())", "map(int,input().split())", "m", "x_i = xy[i][0]-1", "xy[i][0]-1", "x_i", "n, m = map(int,input().split())", "map(int,input().split())", "n", "n_ball = [1 for i in range(n)]", "[1 for i in range(n)]", "n_ball", "y_i = xy[i][1]-1", "xy[i][1]-1", "y_i" ]
n, m = map(int,input().split()) xy = [list(map(int,input().split())) for i in range(m)] red_boxes = [False for i in range(n)] red_boxes[0] = True n_ball = [1 for i in range(n)] for i in range(m): x_i = xy[i][0]-1 y_i = xy[i][1]-1 if n_ball[x_i] == 1: if red_boxes[x_i] == True: n_ball[x_i] -= 1 n_ball[y_i] += 1 red_boxes[x_i] = False red_boxes[y_i] = True else: n_ball[x_i] -= 1 n_ball[y_i] += 1 else: if red_boxes[x_i] == True: n_ball[x_i] -= 1 n_ball[y_i] += 1 red_boxes[y_i] = True else: n_ball[x_i] -= 1 n_ball[y_i] += 1 print(red_boxes.count(True))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13 ]
[ [ 148, 2 ], [ 148, 11 ], [ 15, 14 ], [ 140, 17 ], [ 151, 21 ], [ 26, 25 ], [ 140, 29 ], [ 142, 34 ], [ 41, 40 ], [ 149, 43 ], [ 145, 45 ], [ 145, 54 ], [ 61, 56 ], [ 152, 57 ], [ 137, 59 ], [ 68, 63 ], [ 152, 64 ], [ 146, 66 ], [ 143, 73 ], [ 137, 75 ], [ 152, 80 ], [ 137, 82 ], [ 91, 86 ], [ 143, 87 ], [ 146, 89 ], [ 143, 96 ], [ 137, 98 ], [ 152, 103 ], [ 137, 105 ], [ 114, 109 ], [ 143, 110 ], [ 137, 112 ], [ 121, 116 ], [ 143, 117 ], [ 146, 119 ], [ 143, 125 ], [ 137, 127 ], [ 143, 134 ], [ 145, 137 ], [ 148, 140 ], [ 142, 143 ], [ 145, 146 ], [ 148, 149 ], [ 151, 152 ] ]
[ "n, m = map(int, input().split())\ncl = [1 for _ in range(n)]\nrl = [1]+[0 for _ in range(n-1)]\n\nfor i in range(m):\n x_n, y_n = map(int, input().split())\n cl[x_n-1] -= 1\n cl[y_n-1] += 1\n if rl[x_n-1] == 1 and cl[x_n-1]>0:\n rl[y_n-1] = 1\n elif rl[x_n-1] == 1 and cl[x_n-1] == 0:\n rl[x_n-1] = 0\n rl[y_n-1] = 1\n elif rl[x_n-1] == 0:\n pass\nprint(sum(rl))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "1 for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "1", "cl = [1 for _ in range(n)]", "cl", "[1 for _ in range(n)]", "0 for _ in range(n-1)", "for _ in range(n-1)", "_", "range(n-1)", "range", "n-1", "n", "1", "for _ in range(n-1)", "0", "rl = [1]+[0 for _ in range(n-1)]", "rl", "[1]+[0 for _ in range(n-1)]", "[1]", "1", "[0 for _ in range(n-1)]", "for i in range(m):\n x_n, y_n = map(int, input().split())\n cl[x_n-1] -= 1\n cl[y_n-1] += 1\n if rl[x_n-1] == 1 and cl[x_n-1]>0:\n rl[y_n-1] = 1\n elif rl[x_n-1] == 1 and cl[x_n-1] == 0:\n rl[x_n-1] = 0\n rl[y_n-1] = 1\n elif rl[x_n-1] == 0:\n pass", "i", "range(m)", "range", "m", "x_n, y_n = map(int, input().split())", "x_n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y_n", "cl[x_n-1] -= 1", "cl[x_n-1]", "cl", "x_n-1", "x_n", "1", "1", "cl[y_n-1] += 1", "cl[y_n-1]", "cl", "y_n-1", "y_n", "1", "1", "if rl[x_n-1] == 1 and cl[x_n-1]>0:\n rl[y_n-1] = 1\n elif rl[x_n-1] == 1 and cl[x_n-1] == 0:\n rl[x_n-1] = 0\n rl[y_n-1] = 1\n elif rl[x_n-1] == 0:\n pass", "rl[x_n-1] == 1 and cl[x_n-1]>0", "rl[x_n-1] == 1", "rl[x_n-1]", "rl", "x_n-1", "x_n", "1", "1", "cl[x_n-1]>0", "cl[x_n-1]", "cl", "x_n-1", "x_n", "1", "0", "rl[y_n-1] = 1", "rl[y_n-1]", "rl", "y_n-1", "y_n", "1", "1", "elif rl[x_n-1] == 1 and cl[x_n-1] == 0:\n rl[x_n-1] = 0\n rl[y_n-1] = 1\n ", "rl[x_n-1] == 1 and cl[x_n-1] == 0", "rl[x_n-1] == 1", "rl[x_n-1]", "rl", "x_n-1", "x_n", "1", "1", "cl[x_n-1] == 0", "cl[x_n-1]", "cl", "x_n-1", "x_n", "1", "0", "rl[x_n-1] = 0", "rl[x_n-1]", "rl", "x_n-1", "x_n", "1", "0", "rl[y_n-1] = 1", "rl[y_n-1]", "rl", "y_n-1", "y_n", "1", "1", "elif rl[x_n-1] == 0:\n pass", "rl[x_n-1] == 0", "rl[x_n-1]", "rl", "x_n-1", "x_n", "1", "0", "print(sum(rl))", "print", "sum(rl)", "sum", "rl", "x_n, y_n = map(int, input().split())", "map(int, input().split())", "x_n", "n, m = map(int, input().split())", "map(int, input().split())", "n", "rl = [1]+[0 for _ in range(n-1)]", "[1]+[0 for _ in range(n-1)]", "rl", "y_n = map(int, input().split())", "map(int, input().split())", "y_n", "m = map(int, input().split())", "map(int, input().split())", "m", "cl = [1 for _ in range(n)]", "[1 for _ in range(n)]", "cl" ]
n, m = map(int, input().split()) cl = [1 for _ in range(n)] rl = [1]+[0 for _ in range(n-1)] for i in range(m): x_n, y_n = map(int, input().split()) cl[x_n-1] -= 1 cl[y_n-1] += 1 if rl[x_n-1] == 1 and cl[x_n-1]>0: rl[y_n-1] = 1 elif rl[x_n-1] == 1 and cl[x_n-1] == 0: rl[x_n-1] = 0 rl[y_n-1] = 1 elif rl[x_n-1] == 0: pass print(sum(rl))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13 ]
[ [ 170, 2 ], [ 170, 11 ], [ 173, 13 ], [ 165, 17 ], [ 176, 19 ], [ 165, 23 ], [ 28, 25 ], [ 177, 26 ], [ 31, 30 ], [ 171, 33 ], [ 167, 35 ], [ 167, 44 ], [ 174, 49 ], [ 162, 51 ], [ 177, 56 ], [ 162, 58 ], [ 67, 62 ], [ 174, 63 ], [ 162, 65 ], [ 74, 69 ], [ 177, 70 ], [ 162, 72 ], [ 81, 76 ], [ 177, 77 ], [ 168, 79 ], [ 88, 83 ], [ 174, 84 ], [ 168, 86 ], [ 174, 93 ], [ 162, 95 ], [ 177, 100 ], [ 162, 102 ], [ 111, 106 ], [ 174, 107 ], [ 162, 109 ], [ 118, 113 ], [ 177, 114 ], [ 162, 116 ], [ 125, 120 ], [ 177, 121 ], [ 168, 123 ], [ 132, 127 ], [ 174, 128 ], [ 168, 130 ], [ 177, 136 ], [ 162, 138 ], [ 147, 142 ], [ 174, 143 ], [ 162, 145 ], [ 154, 149 ], [ 174, 150 ], [ 168, 152 ], [ 177, 159 ], [ 167, 162 ], [ 170, 165 ], [ 167, 168 ], [ 170, 171 ], [ 173, 174 ], [ 176, 177 ] ]
[ "n,m=map(int,input().split())\nnum=[1]*n\naka=[0]*n\naka[0]=1\nfor _ in range(m):\n x,y=map(int,input().split())\n if num[x-1]>1 and aka[x-1]==1:\n num[x-1]+=-1\n aka[x-1]=1\n aka[y-1]=1\n num[y-1]+=1\n elif num[x-1]==1 and aka[x-1]==1:\n num[x-1]=0\n aka[x-1]=0\n aka[y-1]=1\n num[y-1]+=1\n elif aka[x-1]==0:\n num[x-1]+=-1\n num[y-1]+=1\nprint(sum(aka))", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "num=[1]*n", "num", "[1]*n", "[1]", "1", "n", "aka=[0]*n", "aka", "[0]*n", "[0]", "0", "n", "aka[0]=1", "aka[0]", "aka", "0", "1", "for _ in range(m):\n x,y=map(int,input().split())\n if num[x-1]>1 and aka[x-1]==1:\n num[x-1]+=-1\n aka[x-1]=1\n aka[y-1]=1\n num[y-1]+=1\n elif num[x-1]==1 and aka[x-1]==1:\n num[x-1]=0\n aka[x-1]=0\n aka[y-1]=1\n num[y-1]+=1\n elif aka[x-1]==0:\n num[x-1]+=-1\n num[y-1]+=1", "_", "range(m)", "range", "m", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if num[x-1]>1 and aka[x-1]==1:\n num[x-1]+=-1\n aka[x-1]=1\n aka[y-1]=1\n num[y-1]+=1\n elif num[x-1]==1 and aka[x-1]==1:\n num[x-1]=0\n aka[x-1]=0\n aka[y-1]=1\n num[y-1]+=1\n elif aka[x-1]==0:\n num[x-1]+=-1\n num[y-1]+=1", "num[x-1]>1 and aka[x-1]==1", "num[x-1]>1", "num[x-1]", "num", "x-1", "x", "1", "1", "aka[x-1]==1", "aka[x-1]", "aka", "x-1", "x", "1", "1", "num[x-1]+=-1", "num[x-1]", "num", "x-1", "x", "1", "-1", "aka[x-1]=1", "aka[x-1]", "aka", "x-1", "x", "1", "1", "aka[y-1]=1", "aka[y-1]", "aka", "y-1", "y", "1", "1", "num[y-1]+=1", "num[y-1]", "num", "y-1", "y", "1", "1", "elif num[x-1]==1 and aka[x-1]==1:\n num[x-1]=0\n aka[x-1]=0\n aka[y-1]=1\n num[y-1]+=1\n ", "num[x-1]==1 and aka[x-1]==1", "num[x-1]==1", "num[x-1]", "num", "x-1", "x", "1", "1", "aka[x-1]==1", "aka[x-1]", "aka", "x-1", "x", "1", "1", "num[x-1]=0", "num[x-1]", "num", "x-1", "x", "1", "0", "aka[x-1]=0", "aka[x-1]", "aka", "x-1", "x", "1", "0", "aka[y-1]=1", "aka[y-1]", "aka", "y-1", "y", "1", "1", "num[y-1]+=1", "num[y-1]", "num", "y-1", "y", "1", "1", "elif aka[x-1]==0:\n num[x-1]+=-1\n num[y-1]+=1", "aka[x-1]==0", "aka[x-1]", "aka", "x-1", "x", "1", "0", "num[x-1]+=-1", "num[x-1]", "num", "x-1", "x", "1", "-1", "num[y-1]+=1", "num[y-1]", "num", "y-1", "y", "1", "1", "print(sum(aka))", "print", "sum(aka)", "sum", "aka", "x,y=map(int,input().split())", "map(int,input().split())", "x", "n,m=map(int,input().split())", "map(int,input().split())", "n", "y=map(int,input().split())", "map(int,input().split())", "y", "m=map(int,input().split())", "map(int,input().split())", "m", "num=[1]*n", "[1]*n", "num", "aka=[0]*n", "[0]*n", "aka" ]
n,m=map(int,input().split()) num=[1]*n aka=[0]*n aka[0]=1 for _ in range(m): x,y=map(int,input().split()) if num[x-1]>1 and aka[x-1]==1: num[x-1]+=-1 aka[x-1]=1 aka[y-1]=1 num[y-1]+=1 elif num[x-1]==1 and aka[x-1]==1: num[x-1]=0 aka[x-1]=0 aka[y-1]=1 num[y-1]+=1 elif aka[x-1]==0: num[x-1]+=-1 num[y-1]+=1 print(sum(aka))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 40, 18, 13, 13, 0, 18, 13, 13, 17, 41, 28, 13, 13, 4, 13, 13, 13, 4, 2, 13, 2, 13, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 118, 2 ], [ 118, 11 ], [ 106, 13 ], [ 119, 17 ], [ 22, 19 ], [ 107, 20 ], [ 100, 24 ], [ 119, 28 ], [ 31, 30 ], [ 110, 33 ], [ 112, 35 ], [ 112, 44 ], [ 121, 46 ], [ 115, 49 ], [ 107, 53 ], [ 122, 54 ], [ 113, 54 ], [ 59, 56 ], [ 107, 57 ], [ 116, 58 ], [ 104, 58 ], [ 64, 61 ], [ 101, 62 ], [ 122, 63 ], [ 113, 63 ], [ 69, 66 ], [ 101, 67 ], [ 116, 68 ], [ 104, 68 ], [ 61, 72 ], [ 101, 73 ], [ 122, 74 ], [ 113, 74 ], [ 79, 76 ], [ 107, 77 ], [ 122, 78 ], [ 113, 78 ], [ 107, 86 ], [ 101, 87 ], [ 100, 101 ], [ 112, 104 ], [ 106, 107 ], [ 118, 110 ], [ 112, 113 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ] ]
[ "N,M = map(int,input().split())\n\nans = [0]*N\nans[0] = 1\nball = [1]*N\n\nfor _ in range(M):\n x,y = map(int,input().split())\n x -= 1\n y -= 1\n if ans[x]:\n ans[y] = 1\n ball[x] -= 1\n ball[y] += 1\n\n if not ball[x]:\n ans[x] = 0\n\nprint(sum([i*(j>0) for i,j in zip(ans,ball)]))", "N,M = map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "ans = [0]*N", "ans", "[0]*N", "[0]", "0", "N", "ans[0] = 1", "ans[0]", "ans", "0", "1", "ball = [1]*N", "ball", "[1]*N", "[1]", "1", "N", "for _ in range(M):\n x,y = map(int,input().split())\n x -= 1\n y -= 1\n if ans[x]:\n ans[y] = 1\n ball[x] -= 1\n ball[y] += 1\n\n if not ball[x]:\n ans[x] = 0", "_", "range(M)", "range", "M", "x,y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "if ans[x]:\n ans[y] = 1\n ", "ans[x]", "ans", "x", "ans[y] = 1", "ans[y]", "ans", "y", "1", "ball[x] -= 1", "ball[x]", "ball", "x", "1", "ball[y] += 1", "ball[y]", "ball", "y", "1", "if not ball[x]:\n ans[x] = 0", "not ball[x]", "ball[x]", "ball", "x", "ans[x] = 0", "ans[x]", "ans", "x", "0", "i*(j>0) for i,j in zip(ans,ball)", "for i,j in zip(ans,ball)", "i", "j", "zip(ans,ball)", "zip", "ans", "ball", "for i,j in zip(ans,ball)", "i*(j>0)", "i", "j>0", "j", "0", "print(sum([i*(j>0) for i,j in zip(ans,ball)]))", "print", "sum([i*(j>0) for i,j in zip(ans,ball)])", "sum", "[i*(j>0) for i,j in zip(ans,ball)]", "ball = [1]*N", "[1]*N", "ball", "y = map(int,input().split())", "map(int,input().split())", "y", "ans = [0]*N", "[0]*N", "ans", "M = map(int,input().split())", "map(int,input().split())", "M", "x,y = map(int,input().split())", "map(int,input().split())", "x", "y -= 1", "1", "y", "N,M = map(int,input().split())", "map(int,input().split())", "N", "x -= 1", "1", "x" ]
N,M = map(int,input().split()) ans = [0]*N ans[0] = 1 ball = [1]*N for _ in range(M): x,y = map(int,input().split()) x -= 1 y -= 1 if ans[x]: ans[y] = 1 ball[x] -= 1 ball[y] += 1 if not ball[x]: ans[x] = 0 print(sum([i*(j>0) for i,j in zip(ans,ball)]))
[ 7, 15, 13, 13, 15, 4, 18, 13, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 12, 13, 29, 18, 4, 18, 18, 13, 13, 13, 39, 17, 12, 13, 29, 4, 13, 13, 4, 18, 4, 13, 13, 12, 13, 29, 4, 13, 4, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 0, 13, 13, 41, 28, 13, 4, 13, 31, 13, 4, 4, 13, 13, 29, 13, 23, 13, 0, 13, 4, 13, 13, 0, 13, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 18, 13, 2, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 14, 18, 13, 2, 18, 13, 13, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 14, 2, 18, 13, 2, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 4, 13, 4, 18, 13, 13, 17, 10, 2, 13, 10, 2, 13, 10, 12, 13, 10, 13, 13, 10, 12, 13, 10, 12, 13, 10, 4, 13, 10, 4, 13, 10, 12, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 183, 13 ], [ 187, 40 ], [ 187, 48 ], [ 54, 53 ], [ 79, 56 ], [ 205, 61 ], [ 64, 63 ], [ 68, 67 ], [ 63, 71 ], [ 67, 75 ], [ 79, 79 ], [ 207, 81 ], [ 205, 83 ], [ 207, 84 ], [ 210, 86 ], [ 196, 88 ], [ 199, 89 ], [ 210, 90 ], [ 180, 92 ], [ 208, 96 ], [ 100, 99 ], [ 208, 102 ], [ 189, 106 ], [ 112, 109 ], [ 190, 110 ], [ 115, 114 ], [ 199, 117 ], [ 126, 119 ], [ 181, 120 ], [ 211, 123 ], [ 114, 124 ], [ 135, 128 ], [ 181, 129 ], [ 202, 132 ], [ 114, 133 ], [ 190, 138 ], [ 211, 141 ], [ 114, 142 ], [ 152, 145 ], [ 190, 146 ], [ 202, 149 ], [ 114, 150 ], [ 181, 156 ], [ 211, 159 ], [ 114, 160 ], [ 171, 164 ], [ 190, 165 ], [ 211, 168 ], [ 114, 169 ], [ 190, 176 ], [ 180, 181 ], [ 183, 184 ], [ 189, 190 ], [ 207, 199 ], [ 210, 202 ], [ 207, 208 ], [ 210, 211 ] ]
[ "import sys, math\nfrom functools import lru_cache\nsys.setrecursionlimit(10**9)\nMOD = 10**9+7\n\ndef input():\n return sys.stdin.readline()[:-1]\n\ndef mi():\n return map(int, input().split())\n\ndef ii():\n return int(input())\n\ndef i2(n):\n tmp = [list(mi()) for i in range(n)]\n return [list(i) for i in zip(*tmp)]\n\nN, M = mi()\nx, y = i2(M)\n\nboxes = [1]*N\nred = [False for i in range(N)]\nred[0] = True\n\nfor i in range(M):\n boxes[x[i]-1] -= 1\n boxes[y[i]-1] += 1\n\n if red[x[i]-1]:\n red[y[i]-1] = True\n if boxes[x[i]-1] == 0:\n red[x[i]-1] = False\n\nprint(red.count(True))\n", "import sys, math", "sys", "math", "from functools import lru_cache", "sys.setrecursionlimit(10**9)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**9", "10", "9", "MOD = 10**9+7", "MOD", "10**9+7", "10**9", "10", "9", "7", "def input():\n return sys.stdin.readline()[:-1]", "input", "return sys.stdin.readline()[:-1]", "sys.stdin.readline()[:-1]", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", ":-1", "-1", "def mi():\n return map(int, input().split())", "mi", "return map(int, input().split())", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "def ii():\n return int(input())", "ii", "return int(input())", "int(input())", "int", "input()", "input", "def i2(n):\n tmp = [list(mi()) for i in range(n)]\n return [list(i) for i in zip(*tmp)]", "i2", "list(mi()) for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "list(mi())", "list", "mi()", "mi", "tmp = [list(mi()) for i in range(n)]", "tmp", "[list(mi()) for i in range(n)]", "list(i) for i in zip(*tmp)", "for i in zip(*tmp)", "i", "zip(*tmp)", "zip", "*tmp", "tmp", "for i in zip(*tmp)", "list(i)", "list", "i", "return [list(i) for i in zip(*tmp)]", "[list(i) for i in zip(*tmp)]", "n", "n", "N, M = mi()", "N", "mi()", "mi", "M", "x, y = i2(M)", "x", "i2(M)", "i2", "M", "y", "boxes = [1]*N", "boxes", "[1]*N", "[1]", "1", "N", "False for i in range(N)", "for i in range(N)", "i", "range(N)", "range", "N", "for i in range(N)", "False", "red = [False for i in range(N)]", "red", "[False for i in range(N)]", "red[0] = True", "red[0]", "red", "0", "True", "for i in range(M):\n boxes[x[i]-1] -= 1\n boxes[y[i]-1] += 1\n\n if red[x[i]-1]:\n red[y[i]-1] = True\n if boxes[x[i]-1] == 0:\n red[x[i]-1] = False", "i", "range(M)", "range", "M", "boxes[x[i]-1] -= 1", "boxes[x[i]-1]", "boxes", "x[i]-1", "x[i]", "x", "i", "1", "1", "boxes[y[i]-1] += 1", "boxes[y[i]-1]", "boxes", "y[i]-1", "y[i]", "y", "i", "1", "1", "if red[x[i]-1]:\n red[y[i]-1] = True\n ", "red[x[i]-1]", "red", "x[i]-1", "x[i]", "x", "i", "1", "red[y[i]-1] = True", "red[y[i]-1]", "red", "y[i]-1", "y[i]", "y", "i", "1", "True", "if boxes[x[i]-1] == 0:\n red[x[i]-1] = False", "boxes[x[i]-1] == 0", "boxes[x[i]-1]", "boxes", "x[i]-1", "x[i]", "x", "i", "1", "0", "red[x[i]-1] = False", "red[x[i]-1]", "red", "x[i]-1", "x[i]", "x", "i", "1", "False", "print(red.count(True))", "print", "red.count(True)", "red.count", "red", "count", "True", "boxes = [1]*N", "[1]*N", "boxes", "MOD = 10**9+7", "10**9+7", "MOD", "def input():\n return sys.stdin.readline()[:-1]", "def input():\n return sys.stdin.readline()[:-1]", "input", "red = [False for i in range(N)]", "[False for i in range(N)]", "red", "def ii():\n return int(input())", "def ii():\n return int(input())", "ii", "def i2(n):\n tmp = [list(mi()) for i in range(n)]\n return [list(i) for i in zip(*tmp)]", "def i2(n):\n tmp = [list(mi()) for i in range(n)]\n return [list(i) for i in zip(*tmp)]", "i2", "M = mi()", "mi()", "M", "y = i2(M)", "i2(M)", "y", "def mi():\n return map(int, input().split())", "def mi():\n return map(int, input().split())", "mi", "N, M = mi()", "mi()", "N", "x, y = i2(M)", "i2(M)", "x" ]
import sys, math from functools import lru_cache sys.setrecursionlimit(10**9) MOD = 10**9+7 def input(): return sys.stdin.readline()[:-1] def mi(): return map(int, input().split()) def ii(): return int(input()) def i2(n): tmp = [list(mi()) for i in range(n)] return [list(i) for i in zip(*tmp)] N, M = mi() x, y = i2(M) boxes = [1]*N red = [False for i in range(N)] red[0] = True for i in range(M): boxes[x[i]-1] -= 1 boxes[y[i]-1] += 1 if red[x[i]-1]: red[y[i]-1] = True if boxes[x[i]-1] == 0: red[x[i]-1] = False print(red.count(True))
[ 7, 15, 13, 4, 18, 13, 13, 2, 2, 17, 17, 17, 12, 13, 12, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 18, 13, 13, 4, 13, 13, 4, 18, 4, 13, 13, 18, 13, 13, 0, 13, 2, 39, 17, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 18, 13, 2, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 14, 18, 13, 2, 18, 13, 13, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 14, 2, 18, 13, 2, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 4, 13, 4, 18, 13, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 18, 17 ], [ 145, 24 ], [ 18, 26 ], [ 29, 28 ], [ 26, 32 ], [ 34, 33 ], [ 26, 37 ], [ 40, 39 ], [ 26, 42 ], [ 47, 44 ], [ 28, 45 ], [ 39, 46 ], [ 145, 53 ], [ 47, 55 ], [ 33, 56 ], [ 39, 57 ], [ 60, 59 ], [ 17, 67 ], [ 71, 70 ], [ 17, 74 ], [ 77, 76 ], [ 26, 79 ], [ 88, 81 ], [ 70, 82 ], [ 44, 84 ], [ 28, 85 ], [ 76, 86 ], [ 97, 90 ], [ 70, 91 ], [ 55, 93 ], [ 33, 94 ], [ 76, 95 ], [ 59, 100 ], [ 44, 102 ], [ 28, 103 ], [ 76, 104 ], [ 114, 107 ], [ 59, 108 ], [ 55, 110 ], [ 33, 111 ], [ 76, 112 ], [ 70, 118 ], [ 44, 120 ], [ 28, 121 ], [ 76, 122 ], [ 133, 126 ], [ 59, 127 ], [ 44, 129 ], [ 28, 130 ], [ 76, 131 ], [ 59, 138 ], [ 148, 142 ] ]
[ "import sys\nsys.setrecursionlimit(10 ** 5 + 10)\ndef input(): return sys.stdin.readline().strip()\n\ndef resolve():\n\n N,M=map(int,input().split())\n X, Y = [0] * M, [0] * M\n for i in range(M):\n X[i], Y[i] = map(int, input().split())\n\n red=[True]+[False]*(N-1)\n cnt=[1]*N\n\n for i in range(M):\n cnt[X[i]-1]-=1\n cnt[Y[i]-1]+=1\n if red[X[i]-1]:\n red[Y[i]-1]=True\n if cnt[X[i]-1]==0:\n red[X[i] - 1]=False\n\n print(red.count(True))\n\n\nresolve()", "import sys", "sys", "sys.setrecursionlimit(10 ** 5 + 10)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 5 + 10", "10 ** 5", "10", "5", "10", "def input(): return sys.stdin.readline().strip()", "input", "def resolve():\n\n N,M=map(int,input().split())\n X, Y = [0] * M, [0] * M\n for i in range(M):\n X[i], Y[i] = map(int, input().split())\n\n red=[True]+[False]*(N-1)\n cnt=[1]*N\n\n for i in range(M):\n cnt[X[i]-1]-=1\n cnt[Y[i]-1]+=1\n if red[X[i]-1]:\n red[Y[i]-1]=True\n if cnt[X[i]-1]==0:\n red[X[i] - 1]=False\n\n print(red.count(True))", "resolve", "N,M=map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "X, Y = [0] * M, [0] * M", "X", "[0] * M", "[0]", "0", "M", "Y", "[0] * M", "[0]", "0", "M", "for i in range(M):\n X[i], Y[i] = map(int, input().split())\n\n ", "i", "range(M)", "range", "M", "X[i], Y[i] = map(int, input().split())", "X[i]", "X", "i", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "Y[i]", "Y", "i", "red=[True]+[False]*(N-1)", "red", "[True]+[False]*(N-1)", "[True]", "True", "[False]*(N-1)", "[False]", "False", "N-1", "N", "1", "cnt=[1]*N", "cnt", "[1]*N", "[1]", "1", "N", "for i in range(M):\n cnt[X[i]-1]-=1\n cnt[Y[i]-1]+=1\n if red[X[i]-1]:\n red[Y[i]-1]=True\n if cnt[X[i]-1]==0:\n red[X[i] - 1]=False\n\n ", "i", "range(M)", "range", "M", "cnt[X[i]-1]-=1", "cnt[X[i]-1]", "cnt", "X[i]-1", "X[i]", "X", "i", "1", "1", "cnt[Y[i]-1]+=1", "cnt[Y[i]-1]", "cnt", "Y[i]-1", "Y[i]", "Y", "i", "1", "1", "if red[X[i]-1]:\n red[Y[i]-1]=True\n ", "red[X[i]-1]", "red", "X[i]-1", "X[i]", "X", "i", "1", "red[Y[i]-1]=True", "red[Y[i]-1]", "red", "Y[i]-1", "Y[i]", "Y", "i", "1", "True", "if cnt[X[i]-1]==0:\n red[X[i] - 1]=False\n\n ", "cnt[X[i]-1]==0", "cnt[X[i]-1]", "cnt", "X[i]-1", "X[i]", "X", "i", "1", "0", "red[X[i] - 1]=False", "red[X[i] - 1]", "red", "X[i] - 1", "X[i]", "X", "i", "1", "False", "print(red.count(True))", "print", "red.count(True)", "red.count", "red", "count", "True", "resolve()", "resolve", "def input(): return sys.stdin.readline().strip()", "def input(): return sys.stdin.readline().strip()", "input", "def resolve():\n\n N,M=map(int,input().split())\n X, Y = [0] * M, [0] * M\n for i in range(M):\n X[i], Y[i] = map(int, input().split())\n\n red=[True]+[False]*(N-1)\n cnt=[1]*N\n\n for i in range(M):\n cnt[X[i]-1]-=1\n cnt[Y[i]-1]+=1\n if red[X[i]-1]:\n red[Y[i]-1]=True\n if cnt[X[i]-1]==0:\n red[X[i] - 1]=False\n\n print(red.count(True))", "def resolve():\n\n N,M=map(int,input().split())\n X, Y = [0] * M, [0] * M\n for i in range(M):\n X[i], Y[i] = map(int, input().split())\n\n red=[True]+[False]*(N-1)\n cnt=[1]*N\n\n for i in range(M):\n cnt[X[i]-1]-=1\n cnt[Y[i]-1]+=1\n if red[X[i]-1]:\n red[Y[i]-1]=True\n if cnt[X[i]-1]==0:\n red[X[i] - 1]=False\n\n print(red.count(True))", "resolve" ]
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N,M=map(int,input().split()) X, Y = [0] * M, [0] * M for i in range(M): X[i], Y[i] = map(int, input().split()) red=[True]+[False]*(N-1) cnt=[1]*N for i in range(M): cnt[X[i]-1]-=1 cnt[Y[i]-1]+=1 if red[X[i]-1]: red[Y[i]-1]=True if cnt[X[i]-1]==0: red[X[i] - 1]=False print(red.count(True)) resolve()
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 28, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13 ]
[ [ 93, 2 ], [ 93, 11 ], [ 15, 14 ], [ 94, 17 ], [ 96, 30 ], [ 87, 33 ], [ 91, 38 ], [ 99, 41 ], [ 91, 46 ], [ 52, 49 ], [ 100, 50 ], [ 61, 58 ], [ 88, 59 ], [ 66, 63 ], [ 88, 64 ], [ 100, 70 ], [ 58, 75 ], [ 88, 76 ], [ 100, 83 ], [ 87, 88 ], [ 93, 91 ], [ 93, 94 ], [ 96, 97 ], [ 99, 100 ] ]
[ "n,m = map(int, input().split())\nxy = [list(map(int, input().split())) for _ in range(m)]\n\nbox = [1] * (n+1)\nred = [0] * (n+1)\nred[1] = 1\nfor x,y in xy:\n box[x] -= 1\n box[y] += 1\n if red[x] == 1: red[y] = 1\n if box[x] == 0: red[x] = 0\nprint(red.count(1))", "n,m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "list(map(int, input().split())) for _ in range(m)", "for _ in range(m)", "_", "range(m)", "range", "m", "for _ in range(m)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "xy = [list(map(int, input().split())) for _ in range(m)]", "xy", "[list(map(int, input().split())) for _ in range(m)]", "box = [1] * (n+1)", "box", "[1] * (n+1)", "[1]", "1", "n+1", "n", "1", "red = [0] * (n+1)", "red", "[0] * (n+1)", "[0]", "0", "n+1", "n", "1", "red[1] = 1", "red[1]", "red", "1", "1", "for x,y in xy:\n box[x] -= 1\n box[y] += 1\n if red[x] == 1: red[y] = 1\n if box[x] == 0: red[x] = 0", "x", "y", "xy", "box[x] -= 1", "box[x]", "box", "x", "1", "box[y] += 1", "box[y]", "box", "y", "1", "if red[x] == 1: red[y] = 1\n ", "red[x] == 1", "red[x]", "red", "x", "1", "if box[x] == 0: red[x]", "box[x] == 0", "box[x]", "box", "x", "0", "print(red.count(1))", "print", "red.count(1)", "red.count", "red", "count", "1", "box = [1] * (n+1)", "[1] * (n+1)", "box", "n,m = map(int, input().split())", "map(int, input().split())", "n", "m = map(int, input().split())", "map(int, input().split())", "m", "xy = [list(map(int, input().split())) for _ in range(m)]", "[list(map(int, input().split())) for _ in range(m)]", "xy", "red = [0] * (n+1)", "[0] * (n+1)", "red" ]
n,m = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(m)] box = [1] * (n+1) red = [0] * (n+1) red[1] = 1 for x,y in xy: box[x] -= 1 box[y] += 1 if red[x] == 1: red[y] = 1 if box[x] == 0: red[x] = 0 print(red.count(1))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 12, 2, 4, 13, 13, 17, 23, 4, 18, 4, 13, 13, 13, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 4, 13, 4, 13, 12, 13, 23, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 109, 2 ], [ 109, 11 ], [ 94, 13 ], [ 110, 17 ], [ 97, 19 ], [ 110, 23 ], [ 28, 25 ], [ 95, 26 ], [ 31, 30 ], [ 104, 33 ], [ 106, 35 ], [ 106, 50 ], [ 95, 53 ], [ 107, 54 ], [ 59, 56 ], [ 95, 57 ], [ 101, 58 ], [ 77, 62 ], [ 98, 63 ], [ 107, 64 ], [ 70, 67 ], [ 95, 68 ], [ 107, 69 ], [ 75, 72 ], [ 98, 73 ], [ 101, 74 ], [ 80, 77 ], [ 98, 78 ], [ 107, 79 ], [ 95, 92 ], [ 94, 95 ], [ 97, 98 ], [ 106, 101 ], [ 109, 104 ], [ 106, 107 ], [ 109, 110 ] ]
[ "n, m = map(int, input().split())\n\nred = [False] * n\nball = [1] * n\n\nred[0] = True\nfor _ in range(m):\n x, y = map(lambda x: int(x) - 1, input().split())\n if red[x]:\n red[y] = True\n if ball[x] == 1:\n red[x] = False\n ball[y] += 1\n ball[x] -= 1\nprint(len(list(filter(lambda x: x, red))))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "red = [False] * n", "red", "[False] * n", "[False]", "False", "n", "ball = [1] * n", "ball", "[1] * n", "[1]", "1", "n", "red[0] = True", "red[0]", "red", "0", "True", "for _ in range(m):\n x, y = map(lambda x: int(x) - 1, input().split())\n if red[x]:\n red[y] = True\n if ball[x] == 1:\n red[x] = False\n ball[y] += 1\n ball[x] -= 1", "_", "range(m)", "range", "m", "x, y = map(lambda x: int(x) - 1, input().split())", "x", "map(lambda x: int(x) - 1, input().split())", "map", "lambda x: int(x) - 1", "int(x) - 1", "int(x)", "int", "x", "1", "x", "input().split()", "().split", "()", "input", "split", "y", "if red[x]:\n red[y] = True\n if ball[x] == 1:\n red[x] = False\n ", "red[x]", "red", "x", "red[y] = True", "red[y]", "red", "y", "True", "if ball[x] == 1:\n red[x] = False\n ", "ball[x] == 1", "ball[x]", "ball", "x", "1", "red[x] = False", "red[x]", "red", "x", "False", "ball[y] += 1", "ball[y]", "ball", "y", "1", "ball[x] -= 1", "ball[x]", "ball", "x", "1", "print(len(list(filter(lambda x: x, red))))", "print", "len(list(filter(lambda x: x, red)))", "len", "list(filter(lambda x: x, red))", "list", "filter(lambda x: x, red)", "filter", "lambda x: x", "x", "x", "red", "red = [False] * n", "[False] * n", "red", "ball = [1] * n", "[1] * n", "ball", "y = map(lambda x: int(x) - 1, input().split())", "map(lambda x: int(x) - 1, input().split())", "y", "m = map(int, input().split())", "map(int, input().split())", "m", "x, y = map(lambda x: int(x) - 1, input().split())", "map(lambda x: int(x) - 1, input().split())", "x", "n, m = map(int, input().split())", "map(int, input().split())", "n" ]
n, m = map(int, input().split()) red = [False] * n ball = [1] * n red[0] = True for _ in range(m): x, y = map(lambda x: int(x) - 1, input().split()) if red[x]: red[y] = True if ball[x] == 1: red[x] = False ball[y] += 1 ball[x] -= 1 print(len(list(filter(lambda x: x, red))))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 41, 28, 13, 4, 13, 31, 13, 4, 4, 13, 13, 0, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 2, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 14, 2, 18, 13, 2, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 13, 13, 17, 17, 4, 13, 4, 18, 13, 13, 17, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13 ]
[ [ 151, 2 ], [ 151, 11 ], [ 15, 14 ], [ 143, 17 ], [ 133, 30 ], [ 35, 34 ], [ 134, 38 ], [ 34, 42 ], [ 148, 44 ], [ 148, 46 ], [ 136, 48 ], [ 152, 52 ], [ 145, 54 ], [ 152, 58 ], [ 63, 60 ], [ 146, 61 ], [ 66, 65 ], [ 143, 68 ], [ 146, 72 ], [ 140, 75 ], [ 65, 76 ], [ 87, 80 ], [ 146, 81 ], [ 149, 84 ], [ 65, 85 ], [ 96, 89 ], [ 137, 90 ], [ 140, 93 ], [ 65, 94 ], [ 105, 98 ], [ 137, 99 ], [ 149, 102 ], [ 65, 103 ], [ 137, 109 ], [ 140, 112 ], [ 65, 113 ], [ 124, 117 ], [ 146, 118 ], [ 140, 121 ], [ 65, 122 ], [ 146, 129 ], [ 133, 134 ], [ 136, 137 ], [ 148, 140 ], [ 151, 143 ], [ 145, 146 ], [ 148, 149 ], [ 151, 152 ] ]
[ "n,m = map(int,input().split())\nl = [list(map(int,input().split())) for i in range(m)]\nx,y = [list(i) for i in zip(*l)]\nnum = [1] * n\nred = ['out'] * n\nred[0] = 'in'\nfor i in range(m):\n if red[x[i]-1] == 'in':\n red[y[i]-1] = 'in'\n num[x[i]-1] -= 1\n num[y[i]-1] += 1\n if num[x[i]-1] == 0:\n red[x[i]-1] = 'out'\nprint(red.count('in'))", "n,m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "list(map(int,input().split())) for i in range(m)", "for i in range(m)", "i", "range(m)", "range", "m", "for i in range(m)", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "l = [list(map(int,input().split())) for i in range(m)]", "l", "[list(map(int,input().split())) for i in range(m)]", "list(i) for i in zip(*l)", "for i in zip(*l)", "i", "zip(*l)", "zip", "*l", "l", "for i in zip(*l)", "list(i)", "list", "i", "x,y = [list(i) for i in zip(*l)]", "x", "[list(i) for i in zip(*l)]", "y", "num = [1] * n", "num", "[1] * n", "[1]", "1", "n", "red = ['out'] * n", "red", "['out'] * n", "['out']", "'out'", "n", "red[0] = 'in'", "red[0]", "red", "0", "'in'", "for i in range(m):\n if red[x[i]-1] == 'in':\n red[y[i]-1] = 'in'\n num[x[i]-1] -= 1\n num[y[i]-1] += 1\n if num[x[i]-1] == 0:\n red[x[i]-1] = 'out'", "i", "range(m)", "range", "m", "if red[x[i]-1] == 'in':\n red[y[i]-1] = 'in'\n ", "red[x[i]-1] == 'in'", "red[x[i]-1]", "red", "x[i]-1", "x[i]", "x", "i", "1", "'in'", "red[y[i]-1] = 'in'", "red[y[i]-1]", "red", "y[i]-1", "y[i]", "y", "i", "1", "'in'", "num[x[i]-1] -= 1", "num[x[i]-1]", "num", "x[i]-1", "x[i]", "x", "i", "1", "1", "num[y[i]-1] += 1", "num[y[i]-1]", "num", "y[i]-1", "y[i]", "y", "i", "1", "1", "if num[x[i]-1] == 0:\n red[x[i]-1] = 'out'", "num[x[i]-1] == 0", "num[x[i]-1]", "num", "x[i]-1", "x[i]", "x", "i", "1", "0", "red[x[i]-1] = 'out'", "red[x[i]-1]", "red", "x[i]-1", "x[i]", "x", "i", "1", "'out'", "print(red.count('in'))", "print", "red.count('in')", "red.count", "red", "count", "'in'", "l = [list(map(int,input().split())) for i in range(m)]", "[list(map(int,input().split())) for i in range(m)]", "l", "num = [1] * n", "[1] * n", "num", "x,y = [list(i) for i in zip(*l)]", "[list(i) for i in zip(*l)]", "x", "m = map(int,input().split())", "map(int,input().split())", "m", "red = ['out'] * n", "['out'] * n", "red", "y = [list(i) for i in zip(*l)]", "[list(i) for i in zip(*l)]", "y", "n,m = map(int,input().split())", "map(int,input().split())", "n" ]
n,m = map(int,input().split()) l = [list(map(int,input().split())) for i in range(m)] x,y = [list(i) for i in zip(*l)] num = [1] * n red = ['out'] * n red[0] = 'in' for i in range(m): if red[x[i]-1] == 'in': red[y[i]-1] = 'in' num[x[i]-1] -= 1 num[y[i]-1] += 1 if num[x[i]-1] == 0: red[x[i]-1] = 'out' print(red.count('in'))
[ 7, 15, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 41, 28, 13, 13, 13, 4, 13, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13 ]
[ [ 126, 3 ], [ 126, 12 ], [ 16, 15 ], [ 115, 18 ], [ 120, 22 ], [ 27, 26 ], [ 115, 29 ], [ 123, 33 ], [ 39, 36 ], [ 124, 37 ], [ 42, 41 ], [ 127, 44 ], [ 108, 46 ], [ 108, 55 ], [ 117, 57 ], [ 111, 60 ], [ 66, 63 ], [ 121, 64 ], [ 118, 65 ], [ 109, 65 ], [ 71, 68 ], [ 121, 69 ], [ 112, 70 ], [ 106, 70 ], [ 124, 74 ], [ 118, 75 ], [ 109, 75 ], [ 80, 77 ], [ 124, 78 ], [ 112, 79 ], [ 106, 79 ], [ 63, 83 ], [ 121, 84 ], [ 118, 85 ], [ 109, 85 ], [ 91, 88 ], [ 124, 89 ], [ 118, 90 ], [ 109, 90 ], [ 95, 94 ], [ 124, 94 ], [ 94, 98 ], [ 108, 106 ], [ 108, 109 ], [ 111, 112 ], [ 126, 115 ], [ 117, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ] ]
[ "from collections import defaultdict\n\nN, M = map(int, input().split())\n\nball_count=[1 for _ in range(N)]\nredExist=[0 for _ in range(N)]\nredExist[0]=1\nfor m in range(M):\n x, y = map(int, input().split())\n #1オリジンから0オリジンに\n x-=1\n y-=1\n\n ball_count[x] -= 1\n ball_count[y] += 1\n if (redExist[x]):\n redExist[y]=True\n if ball_count[x] == 0:\n redExist[x]=False\nprint(len([b for b in redExist if b]))", "from collections import defaultdict", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "1 for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "1", "ball_count=[1 for _ in range(N)]", "ball_count", "[1 for _ in range(N)]", "0 for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "0", "redExist=[0 for _ in range(N)]", "redExist", "[0 for _ in range(N)]", "redExist[0]=1", "redExist[0]", "redExist", "0", "1", "for m in range(M):\n x, y = map(int, input().split())\n #1オリジンから0オリジンに\n x-=1\n y-=1\n\n ball_count[x] -= 1\n ball_count[y] += 1\n if (redExist[x]):\n redExist[y]=True\n if ball_count[x] == 0:\n redExist[x]=False", "m", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x-=1", "x", "1", "y-=1", "y", "1", "ball_count[x] -= 1", "ball_count[x]", "ball_count", "x", "1", "ball_count[y] += 1", "ball_count[y]", "ball_count", "y", "1", "if (redExist[x]):\n redExist[y]=True\n ", "redExist[x]", "redExist", "x", "redExist[y]=True", "redExist[y]", "redExist", "y", "True", "if ball_count[x] == 0:\n redExist[x]=False", "ball_count[x] == 0", "ball_count[x]", "ball_count", "x", "0", "redExist[x]=False", "redExist[x]", "redExist", "x", "False", "b for b in redExist if b", "for b in redExist if b", "b", "redExist", "b", "if b", "b", "print(len([b for b in redExist if b]))", "print", "len([b for b in redExist if b])", "len", "[b for b in redExist if b]", "y = map(int, input().split())", "map(int, input().split())", "y", "x, y = map(int, input().split())", "map(int, input().split())", "x", "y-=1", "1", "y", "N, M = map(int, input().split())", "map(int, input().split())", "N", "x-=1", "1", "x", "ball_count=[1 for _ in range(N)]", "[1 for _ in range(N)]", "ball_count", "redExist=[0 for _ in range(N)]", "[0 for _ in range(N)]", "redExist", "M = map(int, input().split())", "map(int, input().split())", "M" ]
from collections import defaultdict N, M = map(int, input().split()) ball_count=[1 for _ in range(N)] redExist=[0 for _ in range(N)] redExist[0]=1 for m in range(M): x, y = map(int, input().split()) #1オリジンから0オリジンに x-=1 y-=1 ball_count[x] -= 1 ball_count[y] += 1 if (redExist[x]): redExist[y]=True if ball_count[x] == 0: redExist[x]=False print(len([b for b in redExist if b]))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 145, 2 ], [ 145, 11 ], [ 133, 13 ], [ 146, 17 ], [ 130, 19 ], [ 146, 27 ], [ 31, 30 ], [ 137, 33 ], [ 142, 35 ], [ 142, 44 ], [ 131, 48 ], [ 143, 50 ], [ 134, 56 ], [ 143, 58 ], [ 67, 62 ], [ 134, 63 ], [ 143, 65 ], [ 74, 69 ], [ 134, 70 ], [ 140, 72 ], [ 81, 76 ], [ 131, 77 ], [ 143, 79 ], [ 88, 83 ], [ 131, 84 ], [ 140, 86 ], [ 95, 90 ], [ 134, 91 ], [ 143, 93 ], [ 102, 97 ], [ 134, 98 ], [ 140, 100 ], [ 109, 104 ], [ 131, 105 ], [ 140, 107 ], [ 116, 111 ], [ 134, 112 ], [ 143, 114 ], [ 123, 118 ], [ 134, 119 ], [ 140, 121 ], [ 131, 128 ], [ 130, 131 ], [ 133, 134 ], [ 145, 137 ], [ 142, 140 ], [ 142, 143 ], [ 145, 146 ] ]
[ "n, m = map(int,input().split())\nball = [1]*n\nred_ball = [1] + [0]*(n-1)\nfor i in range(m):\n a,b = map(int,input().split())\n if red_ball[a-1] == 1:\n if ball[a-1] == 1:\n ball[a-1] -= 1\n ball[b-1] += 1\n red_ball[a-1] = 0\n red_ball[b-1] = 1\n else:\n ball[a-1] -= 1\n ball[b-1] += 1\n red_ball[b-1] = 1\n else:\n ball[a-1] -= 1\n ball[b-1] += 1\nprint(sum(red_ball))", "n, m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "ball = [1]*n", "ball", "[1]*n", "[1]", "1", "n", "red_ball = [1] + [0]*(n-1)", "red_ball", "[1] + [0]*(n-1)", "[1]", "1", "[0]*(n-1)", "[0]", "0", "n-1", "n", "1", "for i in range(m):\n a,b = map(int,input().split())\n if red_ball[a-1] == 1:\n if ball[a-1] == 1:\n ball[a-1] -= 1\n ball[b-1] += 1\n red_ball[a-1] = 0\n red_ball[b-1] = 1\n else:\n ball[a-1] -= 1\n ball[b-1] += 1\n red_ball[b-1] = 1\n else:\n ball[a-1] -= 1\n ball[b-1] += 1", "i", "range(m)", "range", "m", "a,b = map(int,input().split())", "a", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "if red_ball[a-1] == 1:\n if ball[a-1] == 1:\n ball[a-1] -= 1\n ball[b-1] += 1\n red_ball[a-1] = 0\n red_ball[b-1] = 1\n else:\n ball[a-1] -= 1\n ball[b-1] += 1\n red_ball[b-1] = 1\n else:\n ball[a-1] -= 1\n ball[b-1] += 1", "red_ball[a-1] == 1", "red_ball[a-1]", "red_ball", "a-1", "a", "1", "1", "if ball[a-1] == 1:\n ball[a-1] -= 1\n ball[b-1] += 1\n red_ball[a-1] = 0\n red_ball[b-1] = 1\n else:\n ball[a-1] -= 1\n ball[b-1] += 1\n red_ball[b-1] = 1\n ", "ball[a-1] == 1", "ball[a-1]", "ball", "a-1", "a", "1", "1", "ball[a-1] -= 1", "ball[a-1]", "ball", "a-1", "a", "1", "1", "ball[b-1] += 1", "ball[b-1]", "ball", "b-1", "b", "1", "1", "red_ball[a-1] = 0", "red_ball[a-1]", "red_ball", "a-1", "a", "1", "0", "red_ball[b-1] = 1", "red_ball[b-1]", "red_ball", "b-1", "b", "1", "1", "ball[a-1] -= 1", "ball[a-1]", "ball", "a-1", "a", "1", "1", "ball[b-1] += 1", "ball[b-1]", "ball", "b-1", "b", "1", "1", "red_ball[b-1] = 1", "red_ball[b-1]", "red_ball", "b-1", "b", "1", "1", "ball[a-1] -= 1", "ball[a-1]", "ball", "a-1", "a", "1", "1", "ball[b-1] += 1", "ball[b-1]", "ball", "b-1", "b", "1", "1", "print(sum(red_ball))", "print", "sum(red_ball)", "sum", "red_ball", "red_ball = [1] + [0]*(n-1)", "[1] + [0]*(n-1)", "red_ball", "ball = [1]*n", "[1]*n", "ball", "m = map(int,input().split())", "map(int,input().split())", "m", "b = map(int,input().split())", "map(int,input().split())", "b", "a,b = map(int,input().split())", "map(int,input().split())", "a", "n, m = map(int,input().split())", "map(int,input().split())", "n" ]
n, m = map(int,input().split()) ball = [1]*n red_ball = [1] + [0]*(n-1) for i in range(m): a,b = map(int,input().split()) if red_ball[a-1] == 1: if ball[a-1] == 1: ball[a-1] -= 1 ball[b-1] += 1 red_ball[a-1] = 0 red_ball[b-1] = 1 else: ball[a-1] -= 1 ball[b-1] += 1 red_ball[b-1] = 1 else: ball[a-1] -= 1 ball[b-1] += 1 print(sum(red_ball))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 18, 13, 13, 4, 13, 13, 4, 18, 4, 13, 13, 18, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 18, 13, 13, 13, 18, 13, 13, 0, 13, 2, 13, 17, 13, 2, 13, 17, 14, 2, 18, 13, 13, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 18, 13, 10, 18, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 153, 2 ], [ 153, 11 ], [ 141, 13 ], [ 154, 17 ], [ 144, 19 ], [ 154, 23 ], [ 26, 25 ], [ 154, 28 ], [ 33, 30 ], [ 142, 31 ], [ 25, 32 ], [ 33, 41 ], [ 145, 42 ], [ 25, 43 ], [ 156, 45 ], [ 151, 49 ], [ 138, 51 ], [ 151, 55 ], [ 60, 57 ], [ 139, 58 ], [ 63, 62 ], [ 154, 65 ], [ 129, 67 ], [ 30, 68 ], [ 142, 69 ], [ 62, 70 ], [ 132, 71 ], [ 41, 72 ], [ 145, 73 ], [ 62, 74 ], [ 135, 76 ], [ 130, 78 ], [ 136, 78 ], [ 147, 80 ], [ 133, 82 ], [ 148, 82 ], [ 109, 86 ], [ 139, 87 ], [ 136, 88 ], [ 130, 88 ], [ 114, 90 ], [ 157, 91 ], [ 136, 92 ], [ 130, 92 ], [ 98, 95 ], [ 139, 96 ], [ 148, 97 ], [ 133, 97 ], [ 139, 101 ], [ 136, 102 ], [ 130, 102 ], [ 107, 104 ], [ 139, 105 ], [ 148, 106 ], [ 133, 106 ], [ 112, 109 ], [ 139, 110 ], [ 136, 111 ], [ 130, 111 ], [ 117, 114 ], [ 157, 115 ], [ 136, 116 ], [ 130, 116 ], [ 122, 119 ], [ 157, 120 ], [ 148, 121 ], [ 133, 121 ], [ 139, 127 ], [ 30, 129 ], [ 129, 130 ], [ 41, 132 ], [ 132, 133 ], [ 135, 136 ], [ 138, 139 ], [ 141, 142 ], [ 144, 145 ], [ 147, 148 ], [ 153, 151 ], [ 153, 154 ], [ 156, 157 ] ]
[ "n,m = map(int,input().split())\nx_li = [0]*m\ny_li = [0]*m\nfor i in range(m):\n x_li[i],y_li[i]=map(int,input().split())\n\nmap_li = [1]*n\nred = [False]*n\nred[0]=True\n\nfor i in range(m):\n x,y = x_li[i],y_li[i]\n x,y = x-1,y-1\n if red[x] and map_li[x]>1:\n red[y]=True\n elif red[x]:\n red[y]=True\n red[x]=False\n map_li[x]-=1\n map_li[y]+=1\n#print(map_li)\nprint(sum(red))", "n,m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "x_li = [0]*m", "x_li", "[0]*m", "[0]", "0", "m", "y_li = [0]*m", "y_li", "[0]*m", "[0]", "0", "m", "for i in range(m):\n x_li[i],y_li[i]=map(int,input().split())", "i", "range(m)", "range", "m", "x_li[i],y_li[i]=map(int,input().split())", "x_li[i]", "x_li", "i", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y_li[i]", "y_li", "i", "map_li = [1]*n", "map_li", "[1]*n", "[1]", "1", "n", "red = [False]*n", "red", "[False]*n", "[False]", "False", "n", "red[0]=True", "red[0]", "red", "0", "True", "for i in range(m):\n x,y = x_li[i],y_li[i]\n x,y = x-1,y-1\n if red[x] and map_li[x]>1:\n red[y]=True\n elif red[x]:\n red[y]=True\n red[x]=False\n map_li[x]-=1\n map_li[y]+=1\n#print(map_li)", "i", "range(m)", "range", "m", "x,y = x_li[i],y_li[i]", "x", "x_li[i]", "x_li", "i", "y", "y_li[i]", "y_li", "i", "x,y = x-1,y-1", "x", "x-1", "x", "1", "y", "y-1", "y", "1", "if red[x] and map_li[x]>1:\n red[y]=True\n elif red[x]:\n red[y]=True\n red[x]=False\n ", "red[x] and map_li[x]>1", "red[x]", "red", "x", "map_li[x]>1", "map_li[x]", "map_li", "x", "1", "red[y]=True", "red[y]", "red", "y", "True", "elif red[x]:\n red[y]=True\n red[x]=False\n ", "red[x]", "red", "x", "red[y]=True", "red[y]", "red", "y", "True", "red[x]=False", "red[x]", "red", "x", "False", "map_li[x]-=1", "map_li[x]", "map_li", "x", "1", "map_li[y]+=1", "map_li[y]", "map_li", "y", "1", "print(sum(red))", "print", "sum(red)", "sum", "red", "x,y = x_li[i],y_li[i]", "x_li[i]", "x", "y = x_li[i],y_li[i]", "y_li[i]", "y", "x,y = x-1,y-1", "x-1", "x", "red = [False]*n", "[False]*n", "red", "x_li = [0]*m", "[0]*m", "x_li", "y_li = [0]*m", "[0]*m", "y_li", "y = x-1,y-1", "y-1", "y", "n,m = map(int,input().split())", "map(int,input().split())", "n", "m = map(int,input().split())", "map(int,input().split())", "m", "map_li = [1]*n", "[1]*n", "map_li" ]
n,m = map(int,input().split()) x_li = [0]*m y_li = [0]*m for i in range(m): x_li[i],y_li[i]=map(int,input().split()) map_li = [1]*n red = [False]*n red[0]=True for i in range(m): x,y = x_li[i],y_li[i] x,y = x-1,y-1 if red[x] and map_li[x]>1: red[y]=True elif red[x]: red[y]=True red[x]=False map_li[x]-=1 map_li[y]+=1 #print(map_li) print(sum(red))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 39, 17, 13, 0, 13, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 152, 2 ], [ 152, 11 ], [ 161, 13 ], [ 147, 20 ], [ 149, 22 ], [ 147, 27 ], [ 31, 30 ], [ 153, 33 ], [ 158, 35 ], [ 158, 44 ], [ 150, 49 ], [ 159, 51 ], [ 162, 56 ], [ 159, 58 ], [ 67, 62 ], [ 162, 63 ], [ 156, 65 ], [ 74, 69 ], [ 150, 70 ], [ 159, 72 ], [ 81, 76 ], [ 150, 77 ], [ 156, 79 ], [ 150, 86 ], [ 159, 88 ], [ 162, 93 ], [ 159, 95 ], [ 104, 99 ], [ 162, 100 ], [ 156, 102 ], [ 111, 106 ], [ 162, 107 ], [ 159, 109 ], [ 118, 113 ], [ 150, 114 ], [ 159, 116 ], [ 125, 120 ], [ 150, 121 ], [ 156, 123 ], [ 132, 127 ], [ 150, 128 ], [ 159, 130 ], [ 139, 134 ], [ 150, 135 ], [ 156, 137 ], [ 162, 144 ], [ 152, 147 ], [ 149, 150 ], [ 152, 153 ], [ 158, 156 ], [ 158, 159 ], [ 161, 162 ] ]
[ "n,m = map(int,input().split())\n\ncheck = [1]+[0]*n\nnumlis = [1]*(n+1)\n\nfor i in range(m):\n x, y = map(int, input().split())\n if numlis[x-1] > 1 and check[x-1] == 1:\n check[y-1] = 1\n numlis[x-1] -= 1\n numlis[y-1] += 1\n elif numlis[x-1] == 1 and check[x-1] == 1:\n check[y-1] = 1\n check[x-1] = 0\n numlis[x-1] -= 1\n numlis[y-1] += 1\n else:\n numlis[x-1] -= 1\n numlis[y-1] += 1\n \n\nprint(sum(check))", "n,m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "check = [1]+[0]*n", "check", "[1]+[0]*n", "[1]", "1", "[0]*n", "[0]", "0", "n", "numlis = [1]*(n+1)", "numlis", "[1]*(n+1)", "[1]", "1", "n+1", "n", "1", "for i in range(m):\n x, y = map(int, input().split())\n if numlis[x-1] > 1 and check[x-1] == 1:\n check[y-1] = 1\n numlis[x-1] -= 1\n numlis[y-1] += 1\n elif numlis[x-1] == 1 and check[x-1] == 1:\n check[y-1] = 1\n check[x-1] = 0\n numlis[x-1] -= 1\n numlis[y-1] += 1\n else:\n numlis[x-1] -= 1\n numlis[y-1] += 1\n ", "i", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if numlis[x-1] > 1 and check[x-1] == 1:\n check[y-1] = 1\n numlis[x-1] -= 1\n numlis[y-1] += 1\n elif numlis[x-1] == 1 and check[x-1] == 1:\n check[y-1] = 1\n check[x-1] = 0\n numlis[x-1] -= 1\n numlis[y-1] += 1\n else:\n numlis[x-1] -= 1\n numlis[y-1] += 1\n ", "numlis[x-1] > 1 and check[x-1] == 1", "numlis[x-1] > 1", "numlis[x-1]", "numlis", "x-1", "x", "1", "1", "check[x-1] == 1", "check[x-1]", "check", "x-1", "x", "1", "1", "check[y-1] = 1", "check[y-1]", "check", "y-1", "y", "1", "1", "numlis[x-1] -= 1", "numlis[x-1]", "numlis", "x-1", "x", "1", "1", "numlis[y-1] += 1", "numlis[y-1]", "numlis", "y-1", "y", "1", "1", "elif numlis[x-1] == 1 and check[x-1] == 1:\n check[y-1] = 1\n check[x-1] = 0\n numlis[x-1] -= 1\n numlis[y-1] += 1\n ", "numlis[x-1] == 1 and check[x-1] == 1", "numlis[x-1] == 1", "numlis[x-1]", "numlis", "x-1", "x", "1", "1", "check[x-1] == 1", "check[x-1]", "check", "x-1", "x", "1", "1", "check[y-1] = 1", "check[y-1]", "check", "y-1", "y", "1", "1", "check[x-1] = 0", "check[x-1]", "check", "x-1", "x", "1", "0", "numlis[x-1] -= 1", "numlis[x-1]", "numlis", "x-1", "x", "1", "1", "numlis[y-1] += 1", "numlis[y-1]", "numlis", "y-1", "y", "1", "1", "numlis[x-1] -= 1", "numlis[x-1]", "numlis", "x-1", "x", "1", "1", "numlis[y-1] += 1", "numlis[y-1]", "numlis", "y-1", "y", "1", "1", "print(sum(check))", "print", "sum(check)", "sum", "check", "n,m = map(int,input().split())", "map(int,input().split())", "n", "numlis = [1]*(n+1)", "[1]*(n+1)", "numlis", "m = map(int,input().split())", "map(int,input().split())", "m", "y = map(int, input().split())", "map(int, input().split())", "y", "x, y = map(int, input().split())", "map(int, input().split())", "x", "check = [1]+[0]*n", "[1]+[0]*n", "check" ]
n,m = map(int,input().split()) check = [1]+[0]*n numlis = [1]*(n+1) for i in range(m): x, y = map(int, input().split()) if numlis[x-1] > 1 and check[x-1] == 1: check[y-1] = 1 numlis[x-1] -= 1 numlis[y-1] += 1 elif numlis[x-1] == 1 and check[x-1] == 1: check[y-1] = 1 check[x-1] = 0 numlis[x-1] -= 1 numlis[y-1] += 1 else: numlis[x-1] -= 1 numlis[y-1] += 1 print(sum(check))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 18, 13, 13, 14, 40, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 40, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 2, 13, 17, 14, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 13, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 13, 13, 10, 4, 13 ]
[ [ 151, 2 ], [ 151, 11 ], [ 15, 14 ], [ 143, 18 ], [ 160, 23 ], [ 28, 27 ], [ 143, 31 ], [ 145, 36 ], [ 42, 39 ], [ 161, 40 ], [ 45, 44 ], [ 152, 47 ], [ 163, 49 ], [ 163, 58 ], [ 161, 61 ], [ 155, 62 ], [ 111, 65 ], [ 86, 65 ], [ 70, 65 ], [ 146, 66 ], [ 155, 67 ], [ 73, 70 ], [ 146, 71 ], [ 155, 72 ], [ 78, 75 ], [ 146, 76 ], [ 164, 77 ], [ 111, 81 ], [ 86, 81 ], [ 70, 81 ], [ 146, 82 ], [ 155, 83 ], [ 89, 86 ], [ 146, 87 ], [ 155, 88 ], [ 94, 91 ], [ 146, 92 ], [ 164, 93 ], [ 99, 96 ], [ 161, 97 ], [ 155, 98 ], [ 104, 101 ], [ 161, 102 ], [ 164, 103 ], [ 96, 107 ], [ 161, 108 ], [ 155, 109 ], [ 114, 111 ], [ 146, 112 ], [ 155, 113 ], [ 119, 116 ], [ 146, 117 ], [ 164, 118 ], [ 157, 121 ], [ 125, 124 ], [ 143, 129 ], [ 161, 133 ], [ 124, 134 ], [ 148, 136 ], [ 149, 140 ], [ 158, 140 ], [ 151, 143 ], [ 145, 146 ], [ 148, 149 ], [ 151, 152 ], [ 163, 155 ], [ 157, 158 ], [ 160, 161 ], [ 163, 164 ] ]
[ "n , m = map(int,input().split())\naka = [False for i in range(n+1)]\nkazu = [1 for i in range(n+1)]\naka[1] = True\nfor i in range(m):\n x , y = map(int,input().split())\n if aka[x]:\n if kazu[x] >= 2:\n kazu[x] -= 1\n kazu[y] += 1\n elif kazu[x] == 1:\n kazu[x] -= 1\n kazu[y] += 1 \n aka[x] = False\n aka[y] = True\n elif not aka[x]:\n kazu[x] -= 1\n kazu[y] += 1\nans = 0\nfor i in range(1,n+1):\n if aka[i]:\n ans += 1\nprint(ans)", "n , m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "False for i in range(n+1)", "for i in range(n+1)", "i", "range(n+1)", "range", "n+1", "n", "1", "for i in range(n+1)", "False", "aka = [False for i in range(n+1)]", "aka", "[False for i in range(n+1)]", "1 for i in range(n+1)", "for i in range(n+1)", "i", "range(n+1)", "range", "n+1", "n", "1", "for i in range(n+1)", "1", "kazu = [1 for i in range(n+1)]", "kazu", "[1 for i in range(n+1)]", "aka[1] = True", "aka[1]", "aka", "1", "True", "for i in range(m):\n x , y = map(int,input().split())\n if aka[x]:\n if kazu[x] >= 2:\n kazu[x] -= 1\n kazu[y] += 1\n elif kazu[x] == 1:\n kazu[x] -= 1\n kazu[y] += 1 \n aka[x] = False\n aka[y] = True\n elif not aka[x]:\n kazu[x] -= 1\n kazu[y] += 1", "i", "range(m)", "range", "m", "x , y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if aka[x]:\n if kazu[x] >= 2:\n kazu[x] -= 1\n kazu[y] += 1\n elif kazu[x] == 1:\n kazu[x] -= 1\n kazu[y] += 1 \n aka[x] = False\n aka[y] = True\n elif not aka[x]:\n kazu[x] -= 1\n kazu[y] += 1", "aka[x]", "aka", "x", "if kazu[x] >= 2:\n kazu[x] -= 1\n kazu[y] += 1\n elif kazu[x] == 1:\n kazu[x] -= 1\n kazu[y] += 1 \n aka[x] = False\n ", "kazu[x] >= 2", "kazu[x]", "kazu", "x", "2", "kazu[x] -= 1", "kazu[x]", "kazu", "x", "1", "kazu[y] += 1", "kazu[y]", "kazu", "y", "1", "elif kazu[x] == 1:\n kazu[x] -= 1\n kazu[y] += 1 \n aka[x] = False\n ", "kazu[x] == 1", "kazu[x]", "kazu", "x", "1", "kazu[x] -= 1", "kazu[x]", "kazu", "x", "1", "kazu[y] += 1", "kazu[y]", "kazu", "y", "1", "aka[x] = False", "aka[x]", "aka", "x", "False", "aka[y] = True", "aka[y]", "aka", "y", "True", "elif not aka[x]:\n kazu[x] -= 1\n kazu[y] += 1", "not aka[x]", "aka[x]", "aka", "x", "kazu[x] -= 1", "kazu[x]", "kazu", "x", "1", "kazu[y] += 1", "kazu[y]", "kazu", "y", "1", "ans = 0", "ans", "0", "for i in range(1,n+1):\n if aka[i]:\n ans += 1", "i", "range(1,n+1)", "range", "1", "n+1", "n", "1", "if aka[i]:\n ans += 1", "aka[i]", "aka", "i", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "n , m = map(int,input().split())", "map(int,input().split())", "n", "kazu = [1 for i in range(n+1)]", "[1 for i in range(n+1)]", "kazu", "ans += 1", "1", "ans", "m = map(int,input().split())", "map(int,input().split())", "m", "x , y = map(int,input().split())", "map(int,input().split())", "x", "ans = 0", "0", "ans", "aka = [False for i in range(n+1)]", "[False for i in range(n+1)]", "aka", "y = map(int,input().split())", "map(int,input().split())", "y" ]
n , m = map(int,input().split()) aka = [False for i in range(n+1)] kazu = [1 for i in range(n+1)] aka[1] = True for i in range(m): x , y = map(int,input().split()) if aka[x]: if kazu[x] >= 2: kazu[x] -= 1 kazu[y] += 1 elif kazu[x] == 1: kazu[x] -= 1 kazu[y] += 1 aka[x] = False aka[y] = True elif not aka[x]: kazu[x] -= 1 kazu[y] += 1 ans = 0 for i in range(1,n+1): if aka[i]: ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 18, 4, 13, 17, 13, 13, 13, 31, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 13, 4, 13, 31, 2, 39, 4, 13, 13, 17, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 92, 2 ], [ 92, 15 ], [ 92, 16 ], [ 98, 19 ], [ 93, 23 ], [ 95, 25 ], [ 93, 29 ], [ 34, 31 ], [ 96, 32 ], [ 104, 48 ], [ 101, 51 ], [ 57, 54 ], [ 99, 55 ], [ 105, 56 ], [ 62, 59 ], [ 99, 60 ], [ 102, 61 ], [ 96, 65 ], [ 105, 66 ], [ 54, 69 ], [ 99, 70 ], [ 105, 71 ], [ 77, 74 ], [ 96, 75 ], [ 105, 76 ], [ 82, 79 ], [ 96, 80 ], [ 102, 81 ], [ 96, 87 ], [ 92, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ], [ 101, 102 ], [ 104, 105 ] ]
[ "N, M, *xy = map(int, open(0).read().split())\nboxes = [1] * N\nis_red = [0] * N\nis_red[0] = 1\n\nfor x, y in zip(*[iter(xy)] * 2):\n x -= 1\n y -= 1\n boxes[x] -= 1\n boxes[y] += 1\n if is_red[x]:\n if boxes[x] == 0:\n is_red[x] = 0\n is_red[y] = 1\nprint(sum(is_red))", "N, M, *xy = map(int, open(0).read().split())", "N", "map(int, open(0).read().split())", "map", "int", "open(0).read().split()", "(0).read().split", "(0).read()", "(0).read", "(0)", "open", "0", "read", "split", "M", "*xy", "xy", "boxes = [1] * N", "boxes", "[1] * N", "[1]", "1", "N", "is_red = [0] * N", "is_red", "[0] * N", "[0]", "0", "N", "is_red[0] = 1", "is_red[0]", "is_red", "0", "1", "for x, y in zip(*[iter(xy)] * 2):\n x -= 1\n y -= 1\n boxes[x] -= 1\n boxes[y] += 1\n if is_red[x]:\n if boxes[x] == 0:\n is_red[x] = 0\n is_red[y] = 1", "x", "y", "zip(*[iter(xy)] * 2)", "zip", "*[iter(xy)] * 2", "[iter(xy)] * 2", "[iter(xy)]", "iter(xy)", "iter", "xy", "2", "x -= 1", "x", "1", "y -= 1", "y", "1", "boxes[x] -= 1", "boxes[x]", "boxes", "x", "1", "boxes[y] += 1", "boxes[y]", "boxes", "y", "1", "if is_red[x]:\n if boxes[x] == 0:\n is_red[x] = 0\n is_red[y] = 1", "is_red[x]", "is_red", "x", "if boxes[x] == 0:\n is_red[x] = 0\n ", "boxes[x] == 0", "boxes[x]", "boxes", "x", "0", "is_red[x] = 0", "is_red[x]", "is_red", "x", "0", "is_red[y] = 1", "is_red[y]", "is_red", "y", "1", "print(sum(is_red))", "print", "sum(is_red)", "sum", "is_red", "M, *xy = map(int, open(0).read().split())", "map(int, open(0).read().split())", "M", "N, M, *xy = map(int, open(0).read().split())", "map(int, open(0).read().split())", "N", "is_red = [0] * N", "[0] * N", "is_red", "boxes = [1] * N", "[1] * N", "boxes", "y -= 1", "1", "y", "x -= 1", "1", "x" ]
N, M, *xy = map(int, open(0).read().split()) boxes = [1] * N is_red = [0] * N is_red[0] = 1 for x, y in zip(*[iter(xy)] * 2): x -= 1 y -= 1 boxes[x] -= 1 boxes[y] += 1 if is_red[x]: if boxes[x] == 0: is_red[x] = 0 is_red[y] = 1 print(sum(is_red))
[ 7, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 4, 18, 13, 13, 17, 0, 13, 18, 13, 13, 0, 13, 2, 2, 17, 17, 17, 0, 13, 12, 4, 13, 4, 18, 18, 13, 13, 13, 0, 13, 12, 4, 13, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 0, 13, 12, 4, 13, 4, 13, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 12, 13, 0, 13, 4, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 13, 14, 13, 0, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 18, 13, 10, 12, 13, 10, 2, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 188, 33 ], [ 194, 38 ], [ 200, 45 ], [ 197, 56 ], [ 203, 71 ], [ 91, 90 ], [ 198, 92 ], [ 91, 93 ], [ 97, 96 ], [ 90, 99 ], [ 104, 103 ], [ 109, 106 ], [ 103, 107 ], [ 113, 112 ], [ 90, 115 ], [ 120, 119 ], [ 123, 122 ], [ 93, 125 ], [ 128, 127 ], [ 198, 129 ], [ 128, 130 ], [ 133, 132 ], [ 136, 135 ], [ 141, 138 ], [ 119, 139 ], [ 132, 140 ], [ 127, 140 ], [ 146, 143 ], [ 119, 144 ], [ 135, 145 ], [ 130, 145 ], [ 103, 149 ], [ 132, 150 ], [ 127, 150 ], [ 155, 152 ], [ 103, 153 ], [ 135, 154 ], [ 130, 154 ], [ 138, 158 ], [ 119, 159 ], [ 132, 160 ], [ 127, 160 ], [ 166, 163 ], [ 103, 164 ], [ 132, 165 ], [ 127, 165 ], [ 169, 168 ], [ 172, 171 ], [ 103, 171 ], [ 177, 176 ], [ 176, 180 ], [ 168, 180 ], [ 192, 186 ], [ 188, 189 ], [ 194, 195 ], [ 197, 198 ], [ 200, 201 ], [ 203, 204 ] ]
[ "import sys\nimport re\nimport math\nimport collections\nimport decimal\nimport bisect\nimport itertools\nimport fractions\nimport functools\nimport copy\nimport heapq\nimport decimal\nimport statistics\n\nsys.setrecursionlimit(10000001)\nINF = sys.maxsize\nMOD = 10 ** 9 + 7\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n# ===CODE===\ndef main():\n n, m = ns()\n\n table_TF = [False for _ in range(n)]\n table_TF[0] = True\n\n table_cnt = [1 for _ in range(n)]\n\n for _ in range(m):\n x, y = ns()\n x -= 1\n y -= 1\n\n table_cnt[x] -= 1\n table_cnt[y] += 1\n if table_TF[x]:\n table_TF[y] = True\n if table_cnt[x] == 0:\n table_TF[x] = False\n\n ans = 0\n for tf in table_TF:\n if tf:\n ans += 1\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "import re", "re", "import math", "math", "import collections", "collections", "import decimal", "decimal", "import bisect", "bisect", "import itertools", "itertools", "import fractions", "fractions", "import functools", "functools", "import copy", "copy", "import heapq", "heapq", "import decimal", "decimal", "import statistics", "statistics", "sys.setrecursionlimit(10000001)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10000001", "INF = sys.maxsize", "INF", "sys.maxsize", "sys", "maxsize", "MOD = 10 ** 9 + 7", "MOD", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "ni = lambda: int(sys.stdin.readline())", "ni", "lambda: int(sys.stdin.readline())", "int(sys.stdin.readline())", "int", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "ns = lambda: map(int, sys.stdin.readline().split())", "ns", "lambda: map(int, sys.stdin.readline().split())", "map(int, sys.stdin.readline().split())", "map", "int", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "na = lambda: list(map(int, sys.stdin.readline().split()))", "na", "lambda: list(map(int, sys.stdin.readline().split()))", "list(map(int, sys.stdin.readline().split()))", "list", "map(int, sys.stdin.readline().split())", "map", "int", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "def main():\n n, m = ns()\n\n table_TF = [False for _ in range(n)]\n table_TF[0] = True\n\n table_cnt = [1 for _ in range(n)]\n\n for _ in range(m):\n x, y = ns()\n x -= 1\n y -= 1\n\n table_cnt[x] -= 1\n table_cnt[y] += 1\n if table_TF[x]:\n table_TF[y] = True\n if table_cnt[x] == 0:\n table_TF[x] = False\n\n ans = 0\n for tf in table_TF:\n if tf:\n ans += 1\n\n print(ans)", "main", "n, m = ns()", "n", "ns()", "ns", "m", "False for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "False", "table_TF = [False for _ in range(n)]", "table_TF", "[False for _ in range(n)]", "table_TF[0] = True", "table_TF[0]", "table_TF", "0", "True", "1 for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "1", "table_cnt = [1 for _ in range(n)]", "table_cnt", "[1 for _ in range(n)]", "for _ in range(m):\n x, y = ns()\n x -= 1\n y -= 1\n\n table_cnt[x] -= 1\n table_cnt[y] += 1\n if table_TF[x]:\n table_TF[y] = True\n if table_cnt[x] == 0:\n table_TF[x] = False\n\n ", "_", "range(m)", "range", "m", "x, y = ns()", "x", "ns()", "ns", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "table_cnt[x] -= 1", "table_cnt[x]", "table_cnt", "x", "1", "table_cnt[y] += 1", "table_cnt[y]", "table_cnt", "y", "1", "if table_TF[x]:\n table_TF[y] = True\n ", "table_TF[x]", "table_TF", "x", "table_TF[y] = True", "table_TF[y]", "table_TF", "y", "True", "if table_cnt[x] == 0:\n table_TF[x] = False\n\n ", "table_cnt[x] == 0", "table_cnt[x]", "table_cnt", "x", "0", "table_TF[x] = False", "table_TF[x]", "table_TF", "x", "False", "ans = 0", "ans", "0", "for tf in table_TF:\n if tf:\n ans += 1\n\n ", "tf", "table_TF", "if tf:\n ans += 1\n\n ", "tf", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "INF = sys.maxsize", "sys.maxsize", "INF", "def main():\n n, m = ns()\n\n table_TF = [False for _ in range(n)]\n table_TF[0] = True\n\n table_cnt = [1 for _ in range(n)]\n\n for _ in range(m):\n x, y = ns()\n x -= 1\n y -= 1\n\n table_cnt[x] -= 1\n table_cnt[y] += 1\n if table_TF[x]:\n table_TF[y] = True\n if table_cnt[x] == 0:\n table_TF[x] = False\n\n ans = 0\n for tf in table_TF:\n if tf:\n ans += 1\n\n print(ans)", "def main():\n n, m = ns()\n\n table_TF = [False for _ in range(n)]\n table_TF[0] = True\n\n table_cnt = [1 for _ in range(n)]\n\n for _ in range(m):\n x, y = ns()\n x -= 1\n y -= 1\n\n table_cnt[x] -= 1\n table_cnt[y] += 1\n if table_TF[x]:\n table_TF[y] = True\n if table_cnt[x] == 0:\n table_TF[x] = False\n\n ans = 0\n for tf in table_TF:\n if tf:\n ans += 1\n\n print(ans)", "main", "MOD = 10 ** 9 + 7", "10 ** 9 + 7", "MOD", "ns = lambda: map(int, sys.stdin.readline().split())", "lambda: map(int, sys.stdin.readline().split())", "ns", "ni = lambda: int(sys.stdin.readline())", "lambda: int(sys.stdin.readline())", "ni", "na = lambda: list(map(int, sys.stdin.readline().split()))", "lambda: list(map(int, sys.stdin.readline().split()))", "na" ]
import sys import re import math import collections import decimal import bisect import itertools import fractions import functools import copy import heapq import decimal import statistics sys.setrecursionlimit(10000001) INF = sys.maxsize MOD = 10 ** 9 + 7 ni = lambda: int(sys.stdin.readline()) ns = lambda: map(int, sys.stdin.readline().split()) na = lambda: list(map(int, sys.stdin.readline().split())) # ===CODE=== def main(): n, m = ns() table_TF = [False for _ in range(n)] table_TF[0] = True table_cnt = [1 for _ in range(n)] for _ in range(m): x, y = ns() x -= 1 y -= 1 table_cnt[x] -= 1 table_cnt[y] += 1 if table_TF[x]: table_TF[y] = True if table_cnt[x] == 0: table_TF[x] = False ans = 0 for tf in table_TF: if tf: ans += 1 print(ans) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 39, 28, 13, 4, 13, 13, 4, 18, 13, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 18, 18, 13, 13, 17, 13, 18, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 18, 13, 10, 4, 13, 10, 39, 13, 10, 13, 13, 10, 13, 13, 10, 18, 13 ]
[ [ 129, 2 ], [ 129, 13 ], [ 132, 15 ], [ 19, 18 ], [ 124, 21 ], [ 133, 24 ], [ 39, 38 ], [ 130, 42 ], [ 135, 47 ], [ 52, 51 ], [ 130, 55 ], [ 138, 60 ], [ 66, 63 ], [ 139, 64 ], [ 69, 68 ], [ 124, 71 ], [ 126, 73 ], [ 133, 76 ], [ 68, 77 ], [ 141, 79 ], [ 133, 82 ], [ 68, 83 ], [ 113, 87 ], [ 139, 88 ], [ 127, 89 ], [ 95, 92 ], [ 139, 93 ], [ 142, 94 ], [ 100, 97 ], [ 136, 98 ], [ 127, 99 ], [ 105, 102 ], [ 136, 103 ], [ 142, 104 ], [ 97, 108 ], [ 136, 109 ], [ 127, 110 ], [ 116, 113 ], [ 139, 114 ], [ 127, 115 ], [ 139, 121 ], [ 129, 124 ], [ 126, 127 ], [ 129, 130 ], [ 132, 133 ], [ 135, 136 ], [ 138, 139 ], [ 141, 142 ] ]
[ "\nn,m = list(map(int, input().split()))\nmanu = []\n\nfor i in range(m):\n manu.append(list(map(int, input().split())))\n\nnum = [1 for i in range(n+1)]\nposs = [0 for i in range(n+1)]\nposs[1] = 1\n\nfor i in range(m):\n a,b = manu[i][0],manu[i][1]\n if(poss[a]==1):\n poss[b]=1\n num[a]-=1\n num[b]+=1\n if(num[a]==0):\n poss[a]=0\n\nprint(sum(poss))", "n,m = list(map(int, input().split()))", "n", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "manu = []", "manu", "[]", "for i in range(m):\n manu.append(list(map(int, input().split())))", "i", "range(m)", "range", "m", "manu.append(list(map(int, input().split())))", "manu.append", "manu", "append", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "1 for i in range(n+1)", "for i in range(n+1)", "i", "range(n+1)", "range", "n+1", "n", "1", "for i in range(n+1)", "1", "num = [1 for i in range(n+1)]", "num", "[1 for i in range(n+1)]", "0 for i in range(n+1)", "for i in range(n+1)", "i", "range(n+1)", "range", "n+1", "n", "1", "for i in range(n+1)", "0", "poss = [0 for i in range(n+1)]", "poss", "[0 for i in range(n+1)]", "poss[1] = 1", "poss[1]", "poss", "1", "1", "for i in range(m):\n a,b = manu[i][0],manu[i][1]\n if(poss[a]==1):\n poss[b]=1\n num[a]-=1\n num[b]+=1\n if(num[a]==0):\n poss[a]=0", "i", "range(m)", "range", "m", "a,b = manu[i][0],manu[i][1]", "a", "manu[i][0]", "[i]", "manu", "i", "0", "b", "manu[i][1]", "[i]", "manu", "i", "1", "if(poss[a]==1):\n poss[b]=1\n ", "poss[a]==1", "poss[a]", "poss", "a", "1", "poss[b]=1", "poss[b]", "poss", "b", "1", "num[a]-=1", "num[a]", "num", "a", "1", "num[b]+=1", "num[b]", "num", "b", "1", "if(num[a]==0):\n poss[a]=0", "num[a]==0", "num[a]", "num", "a", "0", "poss[a]=0", "poss[a]", "poss", "a", "0", "print(sum(poss))", "print", "sum(poss)", "sum", "poss", "m = list(map(int, input().split()))", "list(map(int, input().split()))", "m", "a,b = manu[i][0],manu[i][1]", "manu[i][0]", "a", "n,m = list(map(int, input().split()))", "list(map(int, input().split()))", "n", "manu = []", "[]", "manu", "num = [1 for i in range(n+1)]", "[1 for i in range(n+1)]", "num", "poss = [0 for i in range(n+1)]", "[0 for i in range(n+1)]", "poss", "b = manu[i][0],manu[i][1]", "manu[i][1]", "b" ]
n,m = list(map(int, input().split())) manu = [] for i in range(m): manu.append(list(map(int, input().split()))) num = [1 for i in range(n+1)] poss = [0 for i in range(n+1)] poss[1] = 1 for i in range(m): a,b = manu[i][0],manu[i][1] if(poss[a]==1): poss[b]=1 num[a]-=1 num[b]+=1 if(num[a]==0): poss[a]=0 print(sum(poss))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 2, 18, 13, 13, 17, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 2, 18, 13, 13, 17, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 168, 2 ], [ 168, 11 ], [ 156, 13 ], [ 169, 18 ], [ 150, 21 ], [ 169, 26 ], [ 37, 29 ], [ 157, 30 ], [ 37, 34 ], [ 151, 35 ], [ 162, 39 ], [ 169, 44 ], [ 48, 47 ], [ 166, 50 ], [ 159, 52 ], [ 159, 61 ], [ 138, 65 ], [ 163, 66 ], [ 154, 67 ], [ 103, 69 ], [ 78, 69 ], [ 151, 70 ], [ 154, 71 ], [ 76, 73 ], [ 151, 74 ], [ 160, 75 ], [ 81, 78 ], [ 151, 79 ], [ 154, 80 ], [ 86, 83 ], [ 157, 84 ], [ 154, 85 ], [ 91, 88 ], [ 157, 89 ], [ 160, 90 ], [ 138, 95 ], [ 163, 96 ], [ 154, 97 ], [ 103, 99 ], [ 78, 99 ], [ 151, 100 ], [ 154, 101 ], [ 106, 103 ], [ 151, 104 ], [ 154, 105 ], [ 111, 108 ], [ 157, 109 ], [ 160, 110 ], [ 157, 114 ], [ 154, 115 ], [ 138, 118 ], [ 163, 119 ], [ 154, 120 ], [ 126, 123 ], [ 157, 124 ], [ 154, 125 ], [ 131, 128 ], [ 157, 129 ], [ 160, 130 ], [ 136, 133 ], [ 163, 134 ], [ 160, 135 ], [ 141, 138 ], [ 163, 139 ], [ 154, 140 ], [ 157, 146 ], [ 150, 151 ], [ 159, 154 ], [ 156, 157 ], [ 159, 160 ], [ 162, 163 ], [ 168, 166 ], [ 168, 169 ] ]
[ "n, m = map(int, input().split())\nprob = [False] * (n + 1)\nexact = [False] * (n + 1)\nprob[1] = exact[1] = True\nnum_in = [1] * (n + 1)\nfor _ in range(m):\n x, y = map(int, input().split())\n if num_in[x] == 1 and exact[x]:\n exact[y] = True\n exact[x] = False\n prob[x] = False\n prob[y] = True\n elif num_in[x] > 1 and exact[x]:\n exact[x] = False\n prob[y] = True\n elif prob[x]:\n if num_in[x] == 1:\n prob[x] = False\n prob[y] = True\n num_in[y] += 1\n num_in[x] -= 1\nprint(prob.count(True))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "prob = [False] * (n + 1)", "prob", "[False] * (n + 1)", "[False]", "False", "n + 1", "n", "1", "exact = [False] * (n + 1)", "exact", "[False] * (n + 1)", "[False]", "False", "n + 1", "n", "1", "prob[1] = exact[1] = True", "prob[1]", "prob", "1", "True", "= exact[1] = True", "exact[1]", "exact", "1", "True", "num_in = [1] * (n + 1)", "num_in", "[1] * (n + 1)", "[1]", "1", "n + 1", "n", "1", "for _ in range(m):\n x, y = map(int, input().split())\n if num_in[x] == 1 and exact[x]:\n exact[y] = True\n exact[x] = False\n prob[x] = False\n prob[y] = True\n elif num_in[x] > 1 and exact[x]:\n exact[x] = False\n prob[y] = True\n elif prob[x]:\n if num_in[x] == 1:\n prob[x] = False\n prob[y] = True\n num_in[y] += 1\n num_in[x] -= 1", "_", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if num_in[x] == 1 and exact[x]:\n exact[y] = True\n exact[x] = False\n prob[x] = False\n prob[y] = True\n elif num_in[x] > 1 and exact[x]:\n exact[x] = False\n prob[y] = True\n elif prob[x]:\n if num_in[x] == 1:\n prob[x] = False\n prob[y] = True\n ", "num_in[x] == 1 and exact[x]", "num_in[x] == 1", "num_in[x]", "num_in", "x", "1", "exact[x]", "exact", "x", "exact[y] = True", "exact[y]", "exact", "y", "True", "exact[x] = False", "exact[x]", "exact", "x", "False", "prob[x] = False", "prob[x]", "prob", "x", "False", "prob[y] = True", "prob[y]", "prob", "y", "True", "elif num_in[x] > 1 and exact[x]:\n exact[x] = False\n prob[y] = True\n ", "num_in[x] > 1 and exact[x]", "num_in[x] > 1", "num_in[x]", "num_in", "x", "1", "exact[x]", "exact", "x", "exact[x] = False", "exact[x]", "exact", "x", "False", "prob[y] = True", "prob[y]", "prob", "y", "True", "elif prob[x]:\n if num_in[x] == 1:\n prob[x] = False\n prob[y] = True\n ", "prob[x]", "prob", "x", "if num_in[x] == 1:\n prob[x] = False\n ", "num_in[x] == 1", "num_in[x]", "num_in", "x", "1", "prob[x] = False", "prob[x]", "prob", "x", "False", "prob[y] = True", "prob[y]", "prob", "y", "True", "num_in[y] += 1", "num_in[y]", "num_in", "y", "1", "num_in[x] -= 1", "num_in[x]", "num_in", "x", "1", "print(prob.count(True))", "print", "prob.count(True)", "prob.count", "prob", "count", "True", "exact = [False] * (n + 1)", "[False] * (n + 1)", "exact", "x, y = map(int, input().split())", "map(int, input().split())", "x", "prob = [False] * (n + 1)", "[False] * (n + 1)", "prob", "y = map(int, input().split())", "map(int, input().split())", "y", "num_in = [1] * (n + 1)", "[1] * (n + 1)", "num_in", "m = map(int, input().split())", "map(int, input().split())", "m", "n, m = map(int, input().split())", "map(int, input().split())", "n" ]
n, m = map(int, input().split()) prob = [False] * (n + 1) exact = [False] * (n + 1) prob[1] = exact[1] = True num_in = [1] * (n + 1) for _ in range(m): x, y = map(int, input().split()) if num_in[x] == 1 and exact[x]: exact[y] = True exact[x] = False prob[x] = False prob[y] = True elif num_in[x] > 1 and exact[x]: exact[x] = False prob[y] = True elif prob[x]: if num_in[x] == 1: prob[x] = False prob[y] = True num_in[y] += 1 num_in[x] -= 1 print(prob.count(True))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 0, 13, 17, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 40, 4, 18, 13, 13, 13, 17, 17, 14, 2, 4, 18, 13, 13, 13, 17, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 28, 13, 4, 13, 2, 13, 17, 14, 2, 2, 18, 13, 13, 17, 40, 4, 18, 13, 13, 13, 17, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13 ]
[ [ 134, 2 ], [ 134, 11 ], [ 125, 13 ], [ 146, 16 ], [ 135, 21 ], [ 27, 24 ], [ 147, 25 ], [ 137, 29 ], [ 35, 32 ], [ 126, 33 ], [ 38, 37 ], [ 132, 40 ], [ 140, 42 ], [ 140, 51 ], [ 56, 53 ], [ 147, 54 ], [ 141, 55 ], [ 61, 58 ], [ 147, 59 ], [ 129, 60 ], [ 126, 66 ], [ 141, 68 ], [ 126, 75 ], [ 129, 77 ], [ 84, 81 ], [ 126, 82 ], [ 129, 83 ], [ 58, 87 ], [ 147, 88 ], [ 129, 89 ], [ 95, 92 ], [ 126, 93 ], [ 129, 94 ], [ 98, 97 ], [ 135, 101 ], [ 147, 107 ], [ 97, 108 ], [ 126, 113 ], [ 97, 115 ], [ 143, 119 ], [ 144, 123 ], [ 138, 123 ], [ 125, 126 ], [ 140, 129 ], [ 134, 132 ], [ 134, 135 ], [ 137, 138 ], [ 140, 141 ], [ 143, 144 ], [ 146, 147 ] ]
[ "n,m = map(int,input().split())\ndic = {}\nls = [1]*(n+1)\nls[0] = 0\nans = 0\ndic[1] = 1\nfor i in range(m):\n a,b = map(int,input().split())\n ls[a] -= 1\n ls[b] += 1\n if dic.get(a,0) != 0:\n if dic.get(b,0) == 0:\n dic[b] = 1\n else:\n if ls[b] == 1:\n dic[b] = 0\nfor j in range(n+1):\n if ls[j] > 0 and dic.get(j,0) != 0:\n ans += 1\nprint(ans)", "n,m = map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "dic = {}", "dic", "{}", "ls = [1]*(n+1)", "ls", "[1]*(n+1)", "[1]", "1", "n+1", "n", "1", "ls[0] = 0", "ls[0]", "ls", "0", "0", "ans = 0", "ans", "0", "dic[1] = 1", "dic[1]", "dic", "1", "1", "for i in range(m):\n a,b = map(int,input().split())\n ls[a] -= 1\n ls[b] += 1\n if dic.get(a,0) != 0:\n if dic.get(b,0) == 0:\n dic[b] = 1\n else:\n if ls[b] == 1:\n dic[b] = 0", "i", "range(m)", "range", "m", "a,b = map(int,input().split())", "a", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "ls[a] -= 1", "ls[a]", "ls", "a", "1", "ls[b] += 1", "ls[b]", "ls", "b", "1", "if dic.get(a,0) != 0:\n if dic.get(b,0) == 0:\n dic[b] = 1\n else:\n if ls[b] == 1:\n dic[b] = 0", "dic.get(a,0) != 0", "dic.get(a,0)", "dic.get", "dic", "get", "a", "0", "0", "if dic.get(b,0) == 0:\n dic[b] = 1\n ", "dic.get(b,0) == 0", "dic.get(b,0)", "dic.get", "dic", "get", "b", "0", "0", "dic[b] = 1", "dic[b]", "dic", "b", "1", "if ls[b] == 1:\n dic[b] = 0", "ls[b] == 1", "ls[b]", "ls", "b", "1", "dic[b] = 0", "dic[b]", "dic", "b", "0", "for j in range(n+1):\n if ls[j] > 0 and dic.get(j,0) != 0:\n ans += 1", "j", "range(n+1)", "range", "n+1", "n", "1", "if ls[j] > 0 and dic.get(j,0) != 0:\n ans += 1", "ls[j] > 0 and dic.get(j,0) != 0", "ls[j] > 0", "ls[j]", "ls", "j", "0", "dic.get(j,0) != 0", "dic.get(j,0)", "dic.get", "dic", "get", "j", "0", "0", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "dic = {}", "{}", "dic", "b = map(int,input().split())", "map(int,input().split())", "b", "m = map(int,input().split())", "map(int,input().split())", "m", "n,m = map(int,input().split())", "map(int,input().split())", "n", "ans = 0", "0", "ans", "a,b = map(int,input().split())", "map(int,input().split())", "a", "ans += 1", "1", "ans", "ls = [1]*(n+1)", "[1]*(n+1)", "ls" ]
n,m = map(int,input().split()) dic = {} ls = [1]*(n+1) ls[0] = 0 ans = 0 dic[1] = 1 for i in range(m): a,b = map(int,input().split()) ls[a] -= 1 ls[b] += 1 if dic.get(a,0) != 0: if dic.get(b,0) == 0: dic[b] = 1 else: if ls[b] == 1: dic[b] = 0 for j in range(n+1): if ls[j] > 0 and dic.get(j,0) != 0: ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 13, 17, 13, 2, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 2, 18, 13, 13, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13 ]
[ [ 118, 2 ], [ 118, 11 ], [ 106, 13 ], [ 119, 17 ], [ 109, 18 ], [ 119, 22 ], [ 27, 24 ], [ 107, 25 ], [ 30, 29 ], [ 113, 32 ], [ 121, 34 ], [ 121, 43 ], [ 127, 45 ], [ 116, 47 ], [ 128, 47 ], [ 124, 49 ], [ 122, 51 ], [ 125, 51 ], [ 91, 56 ], [ 110, 57 ], [ 128, 58 ], [ 116, 58 ], [ 81, 61 ], [ 107, 62 ], [ 128, 63 ], [ 116, 63 ], [ 69, 66 ], [ 107, 67 ], [ 125, 68 ], [ 122, 68 ], [ 91, 73 ], [ 110, 74 ], [ 128, 75 ], [ 116, 75 ], [ 81, 76 ], [ 107, 77 ], [ 128, 78 ], [ 116, 78 ], [ 84, 81 ], [ 107, 82 ], [ 128, 83 ], [ 116, 83 ], [ 89, 86 ], [ 107, 87 ], [ 125, 88 ], [ 122, 88 ], [ 94, 91 ], [ 110, 92 ], [ 128, 93 ], [ 116, 93 ], [ 99, 96 ], [ 110, 97 ], [ 125, 98 ], [ 122, 98 ], [ 107, 104 ], [ 106, 107 ], [ 109, 110 ], [ 118, 113 ], [ 121, 116 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ], [ 127, 128 ] ]
[ "N,M = map(int,input().split())\nR,A = [0]*N,[1]*N\nR[0] = 1\nfor i in range(M):\n x,y = map(int,input().split())\n x,y = x-1,y-1\n if A[x] > 1 and R[x] == 1:\n R[y] = 1\n elif A[x] == R[x] == 1:\n R[x] = 0\n R[y] = 1\n A[x] -= 1\n A[y] += 1\nprint(sum(R))", "N,M = map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "R,A = [0]*N,[1]*N", "R", "[0]*N", "[0]", "0", "N", "A", "[1]*N", "[1]", "1", "N", "R[0] = 1", "R[0]", "R", "0", "1", "for i in range(M):\n x,y = map(int,input().split())\n x,y = x-1,y-1\n if A[x] > 1 and R[x] == 1:\n R[y] = 1\n elif A[x] == R[x] == 1:\n R[x] = 0\n R[y] = 1\n A[x] -= 1\n A[y] += 1", "i", "range(M)", "range", "M", "x,y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x,y = x-1,y-1", "x", "x-1", "x", "1", "y", "y-1", "y", "1", "if A[x] > 1 and R[x] == 1:\n R[y] = 1\n elif A[x] == R[x] == 1:\n R[x] = 0\n R[y] = 1\n ", "A[x] > 1 and R[x] == 1", "A[x] > 1", "A[x]", "A", "x", "1", "R[x] == 1", "R[x]", "R", "x", "1", "R[y] = 1", "R[y]", "R", "y", "1", "elif A[x] == R[x] == 1:\n R[x] = 0\n R[y] = 1\n ", "A[x] == R[x] == 1", "A[x] == R[x]", "A[x]", "A", "x", "R[x]", "R", "x", "1", "R[x] = 0", "R[x]", "R", "x", "0", "R[y] = 1", "R[y]", "R", "y", "1", "A[x] -= 1", "A[x]", "A", "x", "1", "A[y] += 1", "A[y]", "A", "y", "1", "print(sum(R))", "print", "sum(R)", "sum", "R", "R,A = [0]*N,[1]*N", "[0]*N", "R", "A = [0]*N,[1]*N", "[1]*N", "A", "M = map(int,input().split())", "map(int,input().split())", "M", "x,y = map(int,input().split())", "map(int,input().split())", "x", "N,M = map(int,input().split())", "map(int,input().split())", "N", "y = map(int,input().split())", "map(int,input().split())", "y", "y = x-1,y-1", "y-1", "y", "x,y = x-1,y-1", "x-1", "x" ]
N,M = map(int,input().split()) R,A = [0]*N,[1]*N R[0] = 1 for i in range(M): x,y = map(int,input().split()) x,y = x-1,y-1 if A[x] > 1 and R[x] == 1: R[y] = 1 elif A[x] == R[x] == 1: R[x] = 0 R[y] = 1 A[x] -= 1 A[y] += 1 print(sum(R))
[ 7, 15, 13, 12, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 7, 6 ], [ 7, 15 ], [ 18, 17 ], [ 6, 21 ], [ 26, 23 ], [ 17, 24 ], [ 29, 28 ], [ 6, 32 ], [ 35, 34 ], [ 15, 37 ], [ 40, 39 ], [ 40, 48 ], [ 51, 50 ], [ 54, 53 ], [ 17, 57 ], [ 50, 58 ], [ 39, 58 ], [ 63, 60 ], [ 17, 61 ], [ 53, 62 ], [ 48, 62 ], [ 68, 65 ], [ 28, 66 ], [ 50, 67 ], [ 39, 67 ], [ 73, 70 ], [ 28, 71 ], [ 53, 72 ], [ 48, 72 ], [ 65, 76 ], [ 28, 77 ], [ 50, 78 ], [ 39, 78 ], [ 84, 81 ], [ 17, 82 ], [ 50, 83 ], [ 39, 83 ], [ 17, 89 ], [ 98, 95 ] ]
[ "#!/usr/bin/env python3\nimport sys\n\n\ndef main():\n N, M = map(int, input().split())\n red = [0] * N\n red[0] = 1\n num = [1] * N\n\n for i in range(M):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n if red[x]:\n red[y] = 1\n \n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n print(sum(red))\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "def main():\n N, M = map(int, input().split())\n red = [0] * N\n red[0] = 1\n num = [1] * N\n\n for i in range(M):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n if red[x]:\n red[y] = 1\n \n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n print(sum(red))", "main", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "red = [0] * N", "red", "[0] * N", "[0]", "0", "N", "red[0] = 1", "red[0]", "red", "0", "1", "num = [1] * N", "num", "[1] * N", "[1]", "1", "N", "for i in range(M):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n if red[x]:\n red[y] = 1\n \n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n ", "i", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "if red[x]:\n red[y] = 1\n \n ", "red[x]", "red", "x", "red[y] = 1", "red[y]", "red", "y", "1", "num[x] -= 1", "num[x]", "num", "x", "1", "num[y] += 1", "num[y]", "num", "y", "1", "if num[x] == 0:\n red[x] = 0\n ", "num[x] == 0", "num[x]", "num", "x", "0", "red[x] = 0", "red[x]", "red", "x", "0", "print(sum(red))", "print", "sum(red)", "sum", "red", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n N, M = map(int, input().split())\n red = [0] * N\n red[0] = 1\n num = [1] * N\n\n for i in range(M):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n if red[x]:\n red[y] = 1\n \n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n print(sum(red))", "def main():\n N, M = map(int, input().split())\n red = [0] * N\n red[0] = 1\n num = [1] * N\n\n for i in range(M):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n if red[x]:\n red[y] = 1\n \n num[x] -= 1\n num[y] += 1\n if num[x] == 0:\n red[x] = 0\n print(sum(red))", "main" ]
#!/usr/bin/env python3 import sys def main(): N, M = map(int, input().split()) red = [0] * N red[0] = 1 num = [1] * N for i in range(M): x, y = map(int, input().split()) x -= 1 y -= 1 if red[x]: red[y] = 1 num[x] -= 1 num[y] += 1 if num[x] == 0: red[x] = 0 print(sum(red)) if __name__ == '__main__': main()
[ 7, 15, 13, 13, 13, 15, 15, 15, 15, 15, 15, 15, 12, 13, 14, 13, 4, 13, 31, 13, 23, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 23, 13, 23, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 18, 13, 13, 0, 13, 2, 2, 17, 17, 17, 0, 13, 39, 17, 17, 17, 17, 17, 17, 17, 17, 0, 13, 39, 17, 17, 17, 17, 17, 17, 17, 17, 0, 13, 17, 0, 13, 4, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 14, 40, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 39, 13, 10, 39, 13, 10, 12, 13, 10, 4, 13, 10, 18, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 4, 13, 10, 2, 13, 10, 12, 13 ]
[ [ 40, 40 ], [ 42, 42 ], [ 200, 51 ], [ 233, 56 ], [ 188, 63 ], [ 191, 74 ], [ 176, 85 ], [ 230, 88 ], [ 207, 90 ], [ 230, 91 ], [ 95, 94 ], [ 231, 97 ], [ 215, 101 ], [ 106, 105 ], [ 231, 108 ], [ 212, 112 ], [ 118, 115 ], [ 216, 116 ], [ 121, 120 ], [ 219, 123 ], [ 197, 125 ], [ 207, 127 ], [ 197, 128 ], [ 135, 130 ], [ 213, 131 ], [ 180, 133 ], [ 142, 137 ], [ 213, 138 ], [ 198, 140 ], [ 216, 145 ], [ 180, 147 ], [ 155, 150 ], [ 216, 151 ], [ 198, 153 ], [ 213, 159 ], [ 180, 161 ], [ 169, 164 ], [ 216, 165 ], [ 180, 167 ], [ 216, 174 ], [ 176, 177 ], [ 197, 180 ], [ 188, 189 ], [ 191, 192 ], [ 197, 198 ], [ 200, 201 ], [ 212, 213 ], [ 215, 216 ], [ 230, 219 ], [ 230, 231 ], [ 233, 234 ] ]
[ "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10\nfrom itertools import permutations, combinations, product, accumulate, combinations_with_replacement\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\ndef debug(*args):\n if debugmode:\n print(*args)\ndef input(): return sys.stdin.readline().strip()\ndef STR(): return input()\ndef INT(): return int(input())\ndef FLOAT(): return float(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\ndef lcm(a, b): return a * b // gcd(a, b)\nsys.setrecursionlimit(10 ** 9)\ninf = sys.maxsize\nmod = 10 ** 9 + 7\ndx = [0, 1, 0, -1, 1, -1, -1, 1]\ndy = [1, 0, -1, 0, 1, -1, 1, -1]\ndebugmode = True\n\nn, m = MAP()\nans = [0 for _ in range(n)]\nbal = [1 for _ in range(n)]\nans[0] = 1\nfor _ in range(m):\n x, y = MAP()\n bal[x - 1] -= 1\n bal[y - 1] += 1\n if ans[x - 1]:\n ans[y - 1] = 1\n if not bal[x - 1]:\n ans[x - 1] = 0\nprint(sum(ans))", "import sys, re, os", "sys", "re", "os", "from collections import deque, defaultdict, Counter", "from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10", "from itertools import permutations, combinations, product, accumulate, combinations_with_replacement", "from operator import itemgetter, mul", "from copy import deepcopy", "from string import ascii_lowercase, ascii_uppercase, digits", "from fractions import gcd", "def debug(*args):\n if debugmode:\n print(*args)", "debug", "if debugmode:\n print(*args)", "debugmode", "print(*args)", "print", "*args", "args", "*args", "def input(): return sys.stdin.readline().strip()", "input", "def STR(): return input()", "STR", "def INT(): return int(input())", "INT", "def FLOAT(): return float(input())", "FLOAT", "def MAP(): return map(int, input().split())", "MAP", "def S_MAP(): return map(str, input().split())", "S_MAP", "def LIST(): return list(map(int, input().split()))", "LIST", "def S_LIST(): return list(map(str, input().split()))", "S_LIST", "def lcm(a, b): return a * b // gcd(a, b)", "lcm", "a", "a", "b", "b", "sys.setrecursionlimit(10 ** 9)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 9", "10", "9", "inf = sys.maxsize", "inf", "sys.maxsize", "sys", "maxsize", "mod = 10 ** 9 + 7", "mod", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "dx = [0, 1, 0, -1, 1, -1, -1, 1]", "dx", "[0, 1, 0, -1, 1, -1, -1, 1]", "0", "1", "0", "-1", "1", "-1", "-1", "1", "dy = [1, 0, -1, 0, 1, -1, 1, -1]", "dy", "[1, 0, -1, 0, 1, -1, 1, -1]", "1", "0", "-1", "0", "1", "-1", "1", "-1", "debugmode = True", "debugmode", "True", "n, m = MAP()", "n", "MAP()", "MAP", "m", "0 for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "0", "ans = [0 for _ in range(n)]", "ans", "[0 for _ in range(n)]", "1 for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "1", "bal = [1 for _ in range(n)]", "bal", "[1 for _ in range(n)]", "ans[0] = 1", "ans[0]", "ans", "0", "1", "for _ in range(m):\n x, y = MAP()\n bal[x - 1] -= 1\n bal[y - 1] += 1\n if ans[x - 1]:\n ans[y - 1] = 1\n if not bal[x - 1]:\n ans[x - 1] = 0", "_", "range(m)", "range", "m", "x, y = MAP()", "x", "MAP()", "MAP", "y", "bal[x - 1] -= 1", "bal[x - 1]", "bal", "x - 1", "x", "1", "1", "bal[y - 1] += 1", "bal[y - 1]", "bal", "y - 1", "y", "1", "1", "if ans[x - 1]:\n ans[y - 1] = 1\n if not bal[x - 1]:\n ans[x - 1] = 0", "ans[x - 1]", "ans", "x - 1", "x", "1", "ans[y - 1] = 1", "ans[y - 1]", "ans", "y - 1", "y", "1", "1", "if not bal[x - 1]:\n ans[x - 1] = 0", "not bal[x - 1]", "bal[x - 1]", "bal", "x - 1", "x", "1", "ans[x - 1] = 0", "ans[x - 1]", "ans", "x - 1", "x", "1", "0", "print(sum(ans))", "print", "sum(ans)", "sum", "ans", "debugmode = True", "True", "debugmode", "x, y = MAP()", "MAP()", "x", "def S_MAP(): return map(str, input().split())", "def S_MAP(): return map(str, input().split())", "S_MAP", "def lcm(a, b): return a * b // gcd(a, b)", "def lcm(a, b): return a * b // gcd(a, b)", "lcm", "dx = [0, 1, 0, -1, 1, -1, -1, 1]", "[0, 1, 0, -1, 1, -1, -1, 1]", "dx", "dy = [1, 0, -1, 0, 1, -1, 1, -1]", "[1, 0, -1, 0, 1, -1, 1, -1]", "dy", "def S_LIST(): return list(map(str, input().split()))", "def S_LIST(): return list(map(str, input().split()))", "S_LIST", "y = MAP()", "MAP()", "y", "inf = sys.maxsize", "sys.maxsize", "inf", "def FLOAT(): return float(input())", "def FLOAT(): return float(input())", "FLOAT", "def MAP(): return map(int, input().split())", "def MAP(): return map(int, input().split())", "MAP", "def INT(): return int(input())", "def INT(): return int(input())", "INT", "bal = [1 for _ in range(n)]", "[1 for _ in range(n)]", "bal", "ans = [0 for _ in range(n)]", "[0 for _ in range(n)]", "ans", "m = MAP()", "MAP()", "m", "def input(): return sys.stdin.readline().strip()", "def input(): return sys.stdin.readline().strip()", "input", "def STR(): return input()", "def STR(): return input()", "STR", "def LIST(): return list(map(int, input().split()))", "def LIST(): return list(map(int, input().split()))", "LIST", "n, m = MAP()", "MAP()", "n", "mod = 10 ** 9 + 7", "10 ** 9 + 7", "mod", "def debug(*args):\n if debugmode:\n print(*args)", "def debug(*args):\n if debugmode:\n print(*args)", "debug" ]
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10 from itertools import permutations, combinations, product, accumulate, combinations_with_replacement from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from fractions import gcd def debug(*args): if debugmode: print(*args) def input(): return sys.stdin.readline().strip() def STR(): return input() def INT(): return int(input()) def FLOAT(): return float(input()) def MAP(): return map(int, input().split()) def S_MAP(): return map(str, input().split()) def LIST(): return list(map(int, input().split())) def S_LIST(): return list(map(str, input().split())) def lcm(a, b): return a * b // gcd(a, b) sys.setrecursionlimit(10 ** 9) inf = sys.maxsize mod = 10 ** 9 + 7 dx = [0, 1, 0, -1, 1, -1, -1, 1] dy = [1, 0, -1, 0, 1, -1, 1, -1] debugmode = True n, m = MAP() ans = [0 for _ in range(n)] bal = [1 for _ in range(n)] ans[0] = 1 for _ in range(m): x, y = MAP() bal[x - 1] -= 1 bal[y - 1] += 1 if ans[x - 1]: ans[y - 1] = 1 if not bal[x - 1]: ans[x - 1] = 0 print(sum(ans))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 13, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 97, 2 ], [ 97, 11 ], [ 103, 13 ], [ 89, 18 ], [ 24, 21 ], [ 104, 22 ], [ 100, 26 ], [ 89, 31 ], [ 109, 34 ], [ 91, 36 ], [ 40, 39 ], [ 98, 42 ], [ 106, 44 ], [ 106, 53 ], [ 58, 55 ], [ 104, 56 ], [ 95, 57 ], [ 92, 57 ], [ 78, 58 ], [ 104, 59 ], [ 107, 60 ], [ 110, 60 ], [ 65, 62 ], [ 101, 63 ], [ 95, 64 ], [ 92, 64 ], [ 70, 67 ], [ 101, 68 ], [ 107, 69 ], [ 110, 69 ], [ 67, 73 ], [ 101, 74 ], [ 107, 75 ], [ 110, 75 ], [ 81, 78 ], [ 104, 79 ], [ 107, 80 ], [ 110, 80 ], [ 104, 86 ], [ 97, 89 ], [ 91, 92 ], [ 106, 95 ], [ 97, 98 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ], [ 109, 110 ] ]
[ "N,M=map(int,input().split())\nX=[0]*(N+1)\nX[1]=1\nY=[1]*(N+1)\na,b=0,0\nfor i in range(M):\n a,b=map(int,input().split())\n X[b]|=X[a]\n Y[b]+=1\n Y[a]-=1\n if Y[a]==0:\n X[a]=0\nprint(sum(X))", "N,M=map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "X=[0]*(N+1)", "X", "[0]*(N+1)", "[0]", "0", "N+1", "N", "1", "X[1]=1", "X[1]", "X", "1", "1", "Y=[1]*(N+1)", "Y", "[1]*(N+1)", "[1]", "1", "N+1", "N", "1", "a,b=0,0", "a", "0", "b", "0", "for i in range(M):\n a,b=map(int,input().split())\n X[b]|=X[a]\n Y[b]+=1\n Y[a]-=1\n if Y[a]==0:\n X[a]=0", "i", "range(M)", "range", "M", "a,b=map(int,input().split())", "a", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "X[b]|=X[a]", "X[b]", "X", "b", "X[a]", "X", "a", "Y[b]+=1", "Y[b]", "Y", "b", "1", "Y[a]-=1", "Y[a]", "Y", "a", "1", "if Y[a]==0:\n X[a]=0", "Y[a]==0", "Y[a]", "Y", "a", "0", "X[a]=0", "X[a]", "X", "a", "0", "print(sum(X))", "print", "sum(X)", "sum", "X", "N,M=map(int,input().split())", "map(int,input().split())", "N", "b=0,0", "0", "b", "b=map(int,input().split())", "map(int,input().split())", "b", "M=map(int,input().split())", "map(int,input().split())", "M", "Y=[1]*(N+1)", "[1]*(N+1)", "Y", "X=[0]*(N+1)", "[0]*(N+1)", "X", "a,b=map(int,input().split())", "map(int,input().split())", "a", "a,b=0,0", "0", "a" ]
N,M=map(int,input().split()) X=[0]*(N+1) X[1]=1 Y=[1]*(N+1) a,b=0,0 for i in range(M): a,b=map(int,input().split()) X[b]|=X[a] Y[b]+=1 Y[a]-=1 if Y[a]==0: X[a]=0 print(sum(X))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 39, 17, 17, 17, 0, 13, 13, 0, 18, 13, 17, 39, 17, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 18, 13, 2, 13, 17, 17, 17, 0, 18, 18, 13, 2, 13, 17, 17, 17, 14, 2, 18, 18, 13, 2, 13, 17, 17, 17, 0, 18, 18, 13, 2, 13, 17, 17, 17, 14, 2, 18, 18, 13, 2, 13, 17, 17, 17, 0, 18, 18, 13, 2, 13, 17, 17, 17, 18, 18, 13, 2, 13, 17, 17, 17, 14, 2, 18, 18, 13, 2, 13, 17, 17, 17, 0, 18, 18, 13, 2, 13, 17, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 2, 18, 18, 13, 13, 17, 17, 40, 18, 18, 13, 13, 17, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 13, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 173, 2 ], [ 173, 11 ], [ 15, 14 ], [ 165, 17 ], [ 167, 24 ], [ 30, 27 ], [ 168, 28 ], [ 36, 35 ], [ 174, 38 ], [ 179, 40 ], [ 179, 49 ], [ 58, 51 ], [ 168, 53 ], [ 177, 55 ], [ 67, 60 ], [ 168, 62 ], [ 180, 64 ], [ 168, 72 ], [ 177, 74 ], [ 86, 79 ], [ 168, 81 ], [ 180, 83 ], [ 168, 91 ], [ 177, 93 ], [ 105, 98 ], [ 168, 100 ], [ 177, 102 ], [ 113, 106 ], [ 168, 108 ], [ 180, 110 ], [ 168, 118 ], [ 177, 120 ], [ 132, 125 ], [ 168, 127 ], [ 177, 129 ], [ 170, 134 ], [ 138, 137 ], [ 165, 140 ], [ 168, 146 ], [ 137, 147 ], [ 168, 153 ], [ 137, 154 ], [ 182, 158 ], [ 183, 162 ], [ 171, 162 ], [ 173, 165 ], [ 167, 168 ], [ 170, 171 ], [ 173, 174 ], [ 179, 177 ], [ 179, 180 ], [ 182, 183 ] ]
[ "N,M=map(int,input().split())\narr=[[0,1,0] for _ in range(N)]\narr[0]=[1,1,1]\nfor i in range(M):\n a,b=map(int,input().split())\n arr[a-1][1]-=1\n arr[b-1][1]+=1\n if arr[a-1][0]==1:\n arr[b-1][0]=1\n if arr[a-1][2]==1:\n arr[a-1][2],arr[b-1][2]=0,1\n if arr[a-1][1]==0:\n arr[a-1][0]=0\nans=0\nfor i in range(N):\n if arr[i][0]==1 and arr[i][1]!=0:\n ans+=1\nprint(ans)", "N,M=map(int,input().split())", "N", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "[0,1,0] for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "[0,1,0]", "0", "1", "0", "arr=[[0,1,0] for _ in range(N)]", "arr", "[[0,1,0] for _ in range(N)]", "arr[0]=[1,1,1]", "arr[0]", "arr", "0", "[1,1,1]", "1", "1", "1", "for i in range(M):\n a,b=map(int,input().split())\n arr[a-1][1]-=1\n arr[b-1][1]+=1\n if arr[a-1][0]==1:\n arr[b-1][0]=1\n if arr[a-1][2]==1:\n arr[a-1][2],arr[b-1][2]=0,1\n if arr[a-1][1]==0:\n arr[a-1][0]=0", "i", "range(M)", "range", "M", "a,b=map(int,input().split())", "a", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "arr[a-1][1]-=1", "arr[a-1][1]", "[a-1]", "arr", "a-1", "a", "1", "1", "1", "arr[b-1][1]+=1", "arr[b-1][1]", "[b-1]", "arr", "b-1", "b", "1", "1", "1", "if arr[a-1][0]==1:\n arr[b-1][0]=1\n ", "arr[a-1][0]==1", "arr[a-1][0]", "[a-1]", "arr", "a-1", "a", "1", "0", "1", "arr[b-1][0]=1", "arr[b-1][0]", "[b-1]", "arr", "b-1", "b", "1", "0", "1", "if arr[a-1][2]==1:\n arr[a-1][2],arr[b-1][2]=0,1\n ", "arr[a-1][2]==1", "arr[a-1][2]", "[a-1]", "arr", "a-1", "a", "1", "2", "1", "arr[a-1][2],arr[b-1][2]=0,1", "arr[a-1][2]", "[a-1]", "arr", "a-1", "a", "1", "2", "0", "arr[b-1][2]", "[b-1]", "arr", "b-1", "b", "1", "2", "1", "if arr[a-1][1]==0:\n arr[a-1][0]=0", "arr[a-1][1]==0", "arr[a-1][1]", "[a-1]", "arr", "a-1", "a", "1", "1", "0", "arr[a-1][0]=0", "arr[a-1][0]", "[a-1]", "arr", "a-1", "a", "1", "0", "0", "ans=0", "ans", "0", "for i in range(N):\n if arr[i][0]==1 and arr[i][1]!=0:\n ans+=1", "i", "range(N)", "range", "N", "if arr[i][0]==1 and arr[i][1]!=0:\n ans+=1", "arr[i][0]==1 and arr[i][1]!=0", "arr[i][0]==1", "arr[i][0]", "[i]", "arr", "i", "0", "1", "arr[i][1]!=0", "arr[i][1]", "[i]", "arr", "i", "1", "0", "ans+=1", "ans", "1", "print(ans)", "print", "ans", "N,M=map(int,input().split())", "map(int,input().split())", "N", "arr=[[0,1,0] for _ in range(N)]", "[[0,1,0] for _ in range(N)]", "arr", "ans=0", "0", "ans", "M=map(int,input().split())", "map(int,input().split())", "M", "a,b=map(int,input().split())", "map(int,input().split())", "a", "b=map(int,input().split())", "map(int,input().split())", "b", "ans+=1", "1", "ans" ]
N,M=map(int,input().split()) arr=[[0,1,0] for _ in range(N)] arr[0]=[1,1,1] for i in range(M): a,b=map(int,input().split()) arr[a-1][1]-=1 arr[b-1][1]+=1 if arr[a-1][0]==1: arr[b-1][0]=1 if arr[a-1][2]==1: arr[a-1][2],arr[b-1][2]=0,1 if arr[a-1][1]==0: arr[a-1][0]=0 ans=0 for i in range(N): if arr[i][0]==1 and arr[i][1]!=0: ans+=1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 13, 17, 0, 13, 2, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 13, 4, 13, 4, 13, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 131, 2 ], [ 131, 11 ], [ 15, 14 ], [ 132, 17 ], [ 119, 21 ], [ 26, 25 ], [ 132, 28 ], [ 107, 32 ], [ 38, 35 ], [ 108, 36 ], [ 134, 40 ], [ 44, 43 ], [ 114, 46 ], [ 116, 48 ], [ 116, 57 ], [ 122, 59 ], [ 117, 61 ], [ 125, 64 ], [ 111, 66 ], [ 72, 69 ], [ 120, 70 ], [ 123, 71 ], [ 77, 74 ], [ 120, 75 ], [ 126, 76 ], [ 108, 80 ], [ 123, 81 ], [ 69, 84 ], [ 120, 85 ], [ 123, 86 ], [ 92, 89 ], [ 108, 90 ], [ 123, 91 ], [ 97, 94 ], [ 108, 95 ], [ 126, 96 ], [ 128, 99 ], [ 126, 100 ], [ 108, 105 ], [ 107, 108 ], [ 116, 111 ], [ 131, 114 ], [ 116, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ], [ 126, 128 ], [ 128, 129 ], [ 131, 132 ], [ 134, 135 ] ]
[ "N, M = map(int, input().split())\n\nball = [1 for _ in range(N)]\nred = [0 for _ in range(N)]\nred[0] = 1\n\nnow_red = 0\n\nfor i in range(M):\n xx, yy = map(int, input().split())\n x = xx-1\n y = yy-1\n \n ball[x] -= 1\n ball[y] += 1\n \n if red[x]:\n if ball[x] == 0:\n red[x] = 0\n\n red[y] = 1\n now_red = y\n # print(\"ball\", ball)\n # print(\"red\", red)\n # print(\"now_red\", now_red)\n\nprint(sum(red))\n ", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "1 for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "1", "ball = [1 for _ in range(N)]", "ball", "[1 for _ in range(N)]", "0 for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "0", "red = [0 for _ in range(N)]", "red", "[0 for _ in range(N)]", "red[0] = 1", "red[0]", "red", "0", "1", "now_red = 0", "now_red", "0", "for i in range(M):\n xx, yy = map(int, input().split())\n x = xx-1\n y = yy-1\n \n ball[x] -= 1\n ball[y] += 1\n \n if red[x]:\n if ball[x] == 0:\n red[x] = 0\n\n red[y] = 1\n now_red = y\n # print(\"ball\", ball)\n # print(\"red\", red)\n # print(\"now_red\", now_red)", "i", "range(M)", "range", "M", "xx, yy = map(int, input().split())", "xx", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "yy", "x = xx-1", "x", "xx-1", "xx", "1", "y = yy-1", "y", "yy-1", "yy", "1", "ball[x] -= 1", "ball[x]", "ball", "x", "1", "ball[y] += 1", "ball[y]", "ball", "y", "1", "if red[x]:\n if ball[x] == 0:\n red[x] = 0\n\n red[y] = 1\n now_red = y\n # print(\"ball\", ball)\n # print(\"red\", red)\n # print(\"now_red\", now_red)", "red[x]", "red", "x", "if ball[x] == 0:\n red[x] = 0\n\n ", "ball[x] == 0", "ball[x]", "ball", "x", "0", "red[x] = 0", "red[x]", "red", "x", "0", "red[y] = 1", "red[y]", "red", "y", "1", "now_red = y", "now_red", "y", "print(sum(red))", "print", "sum(red)", "sum", "red", "red = [0 for _ in range(N)]", "[0 for _ in range(N)]", "red", "yy = map(int, input().split())", "map(int, input().split())", "yy", "M = map(int, input().split())", "map(int, input().split())", "M", "xx, yy = map(int, input().split())", "map(int, input().split())", "xx", "ball = [1 for _ in range(N)]", "[1 for _ in range(N)]", "ball", "x = xx-1", "xx-1", "x", "y = yy-1", "yy-1", "y", "now_red = y", "y", "now_red", "N, M = map(int, input().split())", "map(int, input().split())", "N", "now_red = 0", "0", "now_red" ]
N, M = map(int, input().split()) ball = [1 for _ in range(N)] red = [0 for _ in range(N)] red[0] = 1 now_red = 0 for i in range(M): xx, yy = map(int, input().split()) x = xx-1 y = yy-1 ball[x] -= 1 ball[y] += 1 if red[x]: if ball[x] == 0: red[x] = 0 red[y] = 1 now_red = y # print("ball", ball) # print("red", red) # print("now_red", now_red) print(sum(red))
[ 7, 15, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 0, 13, 4, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 18, 13, 10, 12, 13 ]
[ [ 140, 4 ], [ 32, 31 ], [ 123, 33 ], [ 32, 34 ], [ 37, 36 ], [ 31, 41 ], [ 45, 44 ], [ 31, 49 ], [ 55, 52 ], [ 44, 53 ], [ 58, 57 ], [ 34, 60 ], [ 63, 62 ], [ 123, 64 ], [ 63, 65 ], [ 90, 68 ], [ 44, 69 ], [ 62, 70 ], [ 76, 73 ], [ 44, 74 ], [ 65, 75 ], [ 95, 80 ], [ 36, 81 ], [ 62, 82 ], [ 90, 85 ], [ 44, 86 ], [ 62, 87 ], [ 93, 90 ], [ 44, 91 ], [ 62, 92 ], [ 98, 95 ], [ 36, 96 ], [ 62, 97 ], [ 103, 100 ], [ 36, 101 ], [ 65, 102 ], [ 44, 108 ], [ 132, 114 ], [ 140, 141 ] ]
[ "import sys\ninput = sys.stdin.buffer.readline\n\n#sys.setrecursionlimit(10**9)\n#from functools import lru_cache\n\ndef RD(): return input().rstrip().decode()\ndef II(): return int(input())\ndef FI(): return int(input())\ndef MI(): return map(int,input().split())\ndef MF(): return map(float,input().split())\ndef LI(): return list(map(int,input().split()))\ndef LF(): return list(map(float,input().split()))\ndef TI(): return tuple(map(int,input().split()))\n# rstrip().decode()\n\n\n\ndef main():\n\tn,m=MI()\n\tA=[1]*(n+1)\n\tans=[0]*(n+1)\n\tans[1]=1\n\n\tfor _ in range(m):\n\t\tx,y=MI()\n\t\tif ans[x]==1:\n\t\t\tans[y]=1\n\t\tif A[x]==1 and ans[x]==1:\n\t\t\tans[x]=0\n\t\tA[x]-=1\n\t\tA[y]+=1\n\t\t#print(A,ans)\n\n\tprint(sum(ans))\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\tmain()", "import sys", "sys", "input = sys.stdin.buffer.readline", "input", "sys.stdin.buffer.readline", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readline", "def RD(): return input().rstrip().decode()", "RD", "def II(): return int(input())", "II", "def FI(): return int(input())", "FI", "def MI(): return map(int,input().split())", "MI", "def MF(): return map(float,input().split())", "MF", "def LI(): return list(map(int,input().split()))", "LI", "def LF(): return list(map(float,input().split()))", "LF", "def TI(): return tuple(map(int,input().split()))\n# rstrip().decode()", "TI", "def main():\n\tn,m=MI()\n\tA=[1]*(n+1)\n\tans=[0]*(n+1)\n\tans[1]=1\n\n\tfor _ in range(m):\n\t\tx,y=MI()\n\t\tif ans[x]==1:\n\t\t\tans[y]=1\n\t\tif A[x]==1 and ans[x]==1:\n\t\t\tans[x]=0\n\t\tA[x]-=1\n\t\tA[y]+=1\n\t\t#print(A,ans)\n\n\tprint(sum(ans))", "main", "n,m=MI()", "n", "MI()", "MI", "m", "A=[1]*(n+1)", "A", "[1]*(n+1)", "[1]", "1", "n+1", "n", "1", "ans=[0]*(n+1)", "ans", "[0]*(n+1)", "[0]", "0", "n+1", "n", "1", "ans[1]=1", "ans[1]", "ans", "1", "1", "for _ in range(m):\n\t\tx,y=MI()\n\t\tif ans[x]==1:\n\t\t\tans[y]=1\n\t\tif A[x]==1 and ans[x]==1:\n\t\t\tans[x]=0\n\t\tA[x]-=1\n\t\tA[y]+=1\n\t\t#print(A,ans)\n\n\t", "_", "range(m)", "range", "m", "x,y=MI()", "x", "MI()", "MI", "y", "if ans[x]==1:\n\t\t\tans[y]=1\n\t\t", "ans[x]==1", "ans[x]", "ans", "x", "1", "ans[y]=1", "ans[y]", "ans", "y", "1", "if A[x]==1 and ans[x]==1:\n\t\t\tans[x]=0\n\t\t", "A[x]==1 and ans[x]==1", "A[x]==1", "A[x]", "A", "x", "1", "ans[x]==1", "ans[x]", "ans", "x", "1", "ans[x]=0", "ans[x]", "ans", "x", "0", "A[x]-=1", "A[x]", "A", "x", "1", "A[y]+=1", "A[y]", "A", "y", "1", "print(sum(ans))", "print", "sum(ans)", "sum", "ans", "if __name__ == \"__main__\":\n\tmain()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def LF(): return list(map(float,input().split()))", "def LF(): return list(map(float,input().split()))", "LF", "def FI(): return int(input())", "def FI(): return int(input())", "FI", "def MI(): return map(int,input().split())", "def MI(): return map(int,input().split())", "MI", "def MF(): return map(float,input().split())", "def MF(): return map(float,input().split())", "MF", "def TI(): return tuple(map(int,input().split()))\n# rstrip().decode()", "def TI(): return tuple(map(int,input().split()))\n# rstrip().decode()", "TI", "def main():\n\tn,m=MI()\n\tA=[1]*(n+1)\n\tans=[0]*(n+1)\n\tans[1]=1\n\n\tfor _ in range(m):\n\t\tx,y=MI()\n\t\tif ans[x]==1:\n\t\t\tans[y]=1\n\t\tif A[x]==1 and ans[x]==1:\n\t\t\tans[x]=0\n\t\tA[x]-=1\n\t\tA[y]+=1\n\t\t#print(A,ans)\n\n\tprint(sum(ans))", "def main():\n\tn,m=MI()\n\tA=[1]*(n+1)\n\tans=[0]*(n+1)\n\tans[1]=1\n\n\tfor _ in range(m):\n\t\tx,y=MI()\n\t\tif ans[x]==1:\n\t\t\tans[y]=1\n\t\tif A[x]==1 and ans[x]==1:\n\t\t\tans[x]=0\n\t\tA[x]-=1\n\t\tA[y]+=1\n\t\t#print(A,ans)\n\n\tprint(sum(ans))", "main", "def II(): return int(input())", "def II(): return int(input())", "II", "def RD(): return input().rstrip().decode()", "def RD(): return input().rstrip().decode()", "RD", "input = sys.stdin.buffer.readline", "sys.stdin.buffer.readline", "input", "def LI(): return list(map(int,input().split()))", "def LI(): return list(map(int,input().split()))", "LI" ]
import sys input = sys.stdin.buffer.readline #sys.setrecursionlimit(10**9) #from functools import lru_cache def RD(): return input().rstrip().decode() def II(): return int(input()) def FI(): return int(input()) def MI(): return map(int,input().split()) def MF(): return map(float,input().split()) def LI(): return list(map(int,input().split())) def LF(): return list(map(float,input().split())) def TI(): return tuple(map(int,input().split())) # rstrip().decode() def main(): n,m=MI() A=[1]*(n+1) ans=[0]*(n+1) ans[1]=1 for _ in range(m): x,y=MI() if ans[x]==1: ans[y]=1 if A[x]==1 and ans[x]==1: ans[x]=0 A[x]-=1 A[y]+=1 #print(A,ans) print(sum(ans)) if __name__ == "__main__": main()
[ 7, 12, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 21, 22, 17, 39, 17, 17, 28, 13, 4, 13, 17, 2, 13, 17, 0, 18, 13, 13, 39, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 18, 13, 13, 13, 0, 18, 18, 13, 13, 17, 17, 14, 2, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 17, 0, 18, 18, 13, 13, 17, 2, 18, 18, 13, 13, 17, 13, 0, 13, 17, 28, 13, 4, 13, 17, 2, 13, 17, 0, 13, 18, 18, 13, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 5, 13 ], [ 16, 15 ], [ 24, 23 ], [ 4, 28 ], [ 34, 31 ], [ 15, 32 ], [ 23, 33 ], [ 39, 38 ], [ 13, 41 ], [ 44, 43 ], [ 44, 52 ], [ 55, 54 ], [ 15, 56 ], [ 43, 57 ], [ 55, 58 ], [ 65, 60 ], [ 15, 62 ], [ 43, 63 ], [ 15, 70 ], [ 43, 71 ], [ 80, 75 ], [ 15, 77 ], [ 43, 78 ], [ 87, 82 ], [ 15, 84 ], [ 52, 85 ], [ 94, 89 ], [ 15, 91 ], [ 52, 92 ], [ 15, 97 ], [ 52, 98 ], [ 58, 100 ], [ 103, 102 ], [ 106, 105 ], [ 4, 110 ], [ 114, 113 ], [ 31, 115 ], [ 15, 116 ], [ 105, 117 ], [ 113, 121 ], [ 102, 121 ], [ 130, 127 ] ]
[ "#!/usr/bin python3\n# -*- coding: utf-8 -*-\n\ndef main():\n N, M = map(int, input().split())\n dp = {1:[1,True]} #dp[i] iの箱の状態 [x個]赤がいる可能性がある\n for _ in range(2,N+1):\n dp[_] = [1,False]\n for _ in range(M):\n fm, to = map(int, input().split())\n num, state = dp[fm]\n #fmの処理\n dp[fm][0]-=1 #移動\n if dp[fm][0]==0:\n dp[fm][1] = False\n #toの処理\n dp[to][0]+=1 #移動\n dp[to][1]=dp[to][1] or state\n ret = 0\n for _ in range(1,N+1):\n ret += dp[_][1]\n print(ret)\n\nif __name__ == '__main__':\n main()", "def main():\n N, M = map(int, input().split())\n dp = {1:[1,True]} #dp[i] iの箱の状態 [x個]赤がいる可能性がある\n for _ in range(2,N+1):\n dp[_] = [1,False]\n for _ in range(M):\n fm, to = map(int, input().split())\n num, state = dp[fm]\n #fmの処理\n dp[fm][0]-=1 #移動\n if dp[fm][0]==0:\n dp[fm][1] = False\n #toの処理\n dp[to][0]+=1 #移動\n dp[to][1]=dp[to][1] or state\n ret = 0\n for _ in range(1,N+1):\n ret += dp[_][1]\n print(ret)", "main", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "dp = {1:[1,True]}", "dp", "{1:[1,True]}", "1", "1", "[1,True]", "1", "True", "for _ in range(2,N+1):\n dp[_] = [1,False]\n ", "_", "range(2,N+1)", "range", "2", "N+1", "N", "1", "dp[_] = [1,False]", "dp[_]", "dp", "_", "[1,False]", "1", "False", "for _ in range(M):\n fm, to = map(int, input().split())\n num, state = dp[fm]\n #fmの処理\n dp[fm][0]-=1 #移動\n if dp[fm][0]==0:\n dp[fm][1] = False\n #toの処理\n dp[to][0]+=1 #移動\n dp[to][1]=dp[to][1] or state\n ", "_", "range(M)", "range", "M", "fm, to = map(int, input().split())", "fm", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "to", "num, state = dp[fm]", "num", "dp[fm]", "dp", "fm", "state", "dp[fm][0]-=1", "dp[fm][0]", "[fm]", "dp", "fm", "0", "1", "if dp[fm][0]==0:\n dp[fm][1] = False\n #toの処理\n ", "dp[fm][0]==0", "dp[fm][0]", "[fm]", "dp", "fm", "0", "0", "dp[fm][1] = False", "dp[fm][1]", "[fm]", "dp", "fm", "1", "False", "dp[to][0]+=1", "dp[to][0]", "[to]", "dp", "to", "0", "1", "dp[to][1]=dp[to][1] or state", "dp[to][1]", "[to]", "dp", "to", "1", "dp[to][1] or state", "dp[to][1]", "[to]", "dp", "to", "1", "state", "ret = 0", "ret", "0", "for _ in range(1,N+1):\n ret += dp[_][1]\n ", "_", "range(1,N+1)", "range", "1", "N+1", "N", "1", "ret += dp[_][1]", "ret", "dp[_][1]", "[_]", "dp", "_", "1", "print(ret)", "print", "ret", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n N, M = map(int, input().split())\n dp = {1:[1,True]} #dp[i] iの箱の状態 [x個]赤がいる可能性がある\n for _ in range(2,N+1):\n dp[_] = [1,False]\n for _ in range(M):\n fm, to = map(int, input().split())\n num, state = dp[fm]\n #fmの処理\n dp[fm][0]-=1 #移動\n if dp[fm][0]==0:\n dp[fm][1] = False\n #toの処理\n dp[to][0]+=1 #移動\n dp[to][1]=dp[to][1] or state\n ret = 0\n for _ in range(1,N+1):\n ret += dp[_][1]\n print(ret)", "def main():\n N, M = map(int, input().split())\n dp = {1:[1,True]} #dp[i] iの箱の状態 [x個]赤がいる可能性がある\n for _ in range(2,N+1):\n dp[_] = [1,False]\n for _ in range(M):\n fm, to = map(int, input().split())\n num, state = dp[fm]\n #fmの処理\n dp[fm][0]-=1 #移動\n if dp[fm][0]==0:\n dp[fm][1] = False\n #toの処理\n dp[to][0]+=1 #移動\n dp[to][1]=dp[to][1] or state\n ret = 0\n for _ in range(1,N+1):\n ret += dp[_][1]\n print(ret)", "main" ]
#!/usr/bin python3 # -*- coding: utf-8 -*- def main(): N, M = map(int, input().split()) dp = {1:[1,True]} #dp[i] iの箱の状態 [x個]赤がいる可能性がある for _ in range(2,N+1): dp[_] = [1,False] for _ in range(M): fm, to = map(int, input().split()) num, state = dp[fm] #fmの処理 dp[fm][0]-=1 #移動 if dp[fm][0]==0: dp[fm][1] = False #toの処理 dp[to][0]+=1 #移動 dp[to][1]=dp[to][1] or state ret = 0 for _ in range(1,N+1): ret += dp[_][1] print(ret) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 13, 17, 13, 2, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 4, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13 ]
[ [ 157, 2 ], [ 157, 11 ], [ 15, 14 ], [ 152, 17 ], [ 154, 21 ], [ 27, 24 ], [ 155, 25 ], [ 31, 30 ], [ 152, 33 ], [ 136, 37 ], [ 145, 40 ], [ 44, 43 ], [ 158, 46 ], [ 139, 48 ], [ 139, 57 ], [ 160, 59 ], [ 140, 61 ], [ 161, 61 ], [ 148, 63 ], [ 134, 65 ], [ 149, 65 ], [ 71, 68 ], [ 137, 69 ], [ 161, 70 ], [ 140, 70 ], [ 76, 73 ], [ 137, 74 ], [ 149, 75 ], [ 134, 75 ], [ 155, 79 ], [ 161, 80 ], [ 140, 80 ], [ 85, 82 ], [ 155, 83 ], [ 149, 84 ], [ 134, 84 ], [ 68, 89 ], [ 137, 90 ], [ 161, 91 ], [ 140, 91 ], [ 155, 96 ], [ 102, 99 ], [ 155, 100 ], [ 161, 101 ], [ 140, 101 ], [ 68, 105 ], [ 137, 106 ], [ 161, 107 ], [ 140, 107 ], [ 113, 110 ], [ 155, 111 ], [ 161, 112 ], [ 140, 112 ], [ 163, 115 ], [ 119, 118 ], [ 152, 121 ], [ 155, 124 ], [ 118, 125 ], [ 142, 127 ], [ 143, 131 ], [ 164, 131 ], [ 139, 134 ], [ 136, 137 ], [ 139, 140 ], [ 142, 143 ], [ 145, 146 ], [ 148, 149 ], [ 157, 152 ], [ 154, 155 ], [ 157, 158 ], [ 160, 161 ], [ 163, 164 ] ]
[ "n,m=map(int,input().split())\nflg=[False for i in range(n)]\nflg[0]=True\nt=[1 for i in range(n)]\ntmp=1\nfor i in range(m):\n x,y=map(int,input().split())\n x,y=x-1,y-1\n t[x]-=1\n t[y]+=1\n if flg[x]:\n flg[y]=True\n if t[x]==1 and len(flg)==1:\n flg[x]=False\n\n if t[x]==0:\n flg[x]=False\nans=0\nfor i in range(n):\n if flg[i]:\n ans+=1\nprint(ans)", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "False for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "False", "flg=[False for i in range(n)]", "flg", "[False for i in range(n)]", "flg[0]=True", "flg[0]", "flg", "0", "True", "1 for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "1", "t=[1 for i in range(n)]", "t", "[1 for i in range(n)]", "tmp=1", "tmp", "1", "for i in range(m):\n x,y=map(int,input().split())\n x,y=x-1,y-1\n t[x]-=1\n t[y]+=1\n if flg[x]:\n flg[y]=True\n if t[x]==1 and len(flg)==1:\n flg[x]=False\n\n if t[x]==0:\n flg[x]=False", "i", "range(m)", "range", "m", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x,y=x-1,y-1", "x", "x-1", "x", "1", "y", "y-1", "y", "1", "t[x]-=1", "t[x]", "t", "x", "1", "t[y]+=1", "t[y]", "t", "y", "1", "if flg[x]:\n flg[y]=True\n if t[x]==1 and len(flg)==1:\n flg[x]=False\n\n ", "flg[x]", "flg", "x", "flg[y]=True", "flg[y]", "flg", "y", "True", "if t[x]==1 and len(flg)==1:\n flg[x]=False\n\n ", "t[x]==1 and len(flg)==1", "t[x]==1", "t[x]", "t", "x", "1", "len(flg)==1", "len(flg)", "len", "flg", "1", "flg[x]=False", "flg[x]", "flg", "x", "False", "if t[x]==0:\n flg[x]=False", "t[x]==0", "t[x]", "t", "x", "0", "flg[x]=False", "flg[x]", "flg", "x", "False", "ans=0", "ans", "0", "for i in range(n):\n if flg[i]:\n ans+=1", "i", "range(n)", "range", "n", "if flg[i]:\n ans+=1", "flg[i]", "flg", "i", "ans+=1", "ans", "1", "print(ans)", "print", "ans", "y=map(int,input().split())", "map(int,input().split())", "y", "t=[1 for i in range(n)]", "[1 for i in range(n)]", "t", "x,y=map(int,input().split())", "map(int,input().split())", "x", "ans+=1", "1", "ans", "tmp=1", "1", "tmp", "y=x-1,y-1", "y-1", "y", "n,m=map(int,input().split())", "map(int,input().split())", "n", "flg=[False for i in range(n)]", "[False for i in range(n)]", "flg", "m=map(int,input().split())", "map(int,input().split())", "m", "x,y=x-1,y-1", "x-1", "x", "ans=0", "0", "ans" ]
n,m=map(int,input().split()) flg=[False for i in range(n)] flg[0]=True t=[1 for i in range(n)] tmp=1 for i in range(m): x,y=map(int,input().split()) x,y=x-1,y-1 t[x]-=1 t[y]+=1 if flg[x]: flg[y]=True if t[x]==1 and len(flg)==1: flg[x]=False if t[x]==0: flg[x]=False ans=0 for i in range(n): if flg[i]: ans+=1 print(ans)
[ 7, 15, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 4, 18, 13, 13, 17, 0, 13, 4, 13, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 13, 13, 4, 18, 13, 13, 13, 14, 2, 2, 18, 13, 13, 17, 2, 13, 13, 4, 18, 13, 13, 13, 0, 13, 4, 13, 4, 13, 13, 28, 13, 13, 14, 2, 2, 18, 13, 13, 17, 2, 13, 13, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 110, 3 ], [ 110, 12 ], [ 125, 14 ], [ 126, 19 ], [ 119, 23 ], [ 29, 28 ], [ 111, 31 ], [ 113, 33 ], [ 113, 42 ], [ 47, 44 ], [ 120, 45 ], [ 105, 46 ], [ 52, 49 ], [ 120, 50 ], [ 114, 51 ], [ 105, 55 ], [ 126, 56 ], [ 126, 59 ], [ 114, 61 ], [ 44, 65 ], [ 120, 66 ], [ 105, 67 ], [ 105, 70 ], [ 126, 71 ], [ 126, 74 ], [ 105, 76 ], [ 116, 78 ], [ 126, 83 ], [ 86, 85 ], [ 120, 85 ], [ 120, 91 ], [ 85, 92 ], [ 85, 95 ], [ 126, 96 ], [ 122, 98 ], [ 123, 102 ], [ 117, 102 ], [ 113, 105 ], [ 110, 108 ], [ 110, 111 ], [ 113, 114 ], [ 116, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ] ]
[ "from collections import defaultdict\nn, m = map(int, input().split())\nr = set()\nr.add(1)\nd = defaultdict(int)\nfor i in range(m):\n x, y = map(int, input().split())\n d[x] -= 1\n d[y] += 1\n if x in r:\n r.add(y)\n if d[x] == -1 and x in r:\n r.remove(x)\nans = len(list(r))\nfor e in d:\n if d[e] == -1 and e in r:\n ans -= 1\nprint(ans)", "from collections import defaultdict", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "r = set()", "r", "set()", "set", "r.add(1)", "r.add", "r", "add", "1", "d = defaultdict(int)", "d", "defaultdict(int)", "defaultdict", "int", "for i in range(m):\n x, y = map(int, input().split())\n d[x] -= 1\n d[y] += 1\n if x in r:\n r.add(y)\n if d[x] == -1 and x in r:\n r.remove(x)", "i", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "d[x] -= 1", "d[x]", "d", "x", "1", "d[y] += 1", "d[y]", "d", "y", "1", "if x in r:\n r.add(y)\n ", "x in r", "x", "r", "r.add(y)", "r.add", "r", "add", "y", "if d[x] == -1 and x in r:\n r.remove(x)", "d[x] == -1 and x in r", "d[x] == -1", "d[x]", "d", "x", "-1", "x in r", "x", "r", "r.remove(x)", "r.remove", "r", "remove", "x", "ans = len(list(r))", "ans", "len(list(r))", "len", "list(r)", "list", "r", "for e in d:\n if d[e] == -1 and e in r:\n ans -= 1", "e", "d", "if d[e] == -1 and e in r:\n ans -= 1", "d[e] == -1 and e in r", "d[e] == -1", "d[e]", "d", "e", "-1", "e in r", "e", "r", "ans -= 1", "ans", "1", "print(ans)", "print", "ans", "x, y = map(int, input().split())", "map(int, input().split())", "x", "n, m = map(int, input().split())", "map(int, input().split())", "n", "m = map(int, input().split())", "map(int, input().split())", "m", "y = map(int, input().split())", "map(int, input().split())", "y", "ans = len(list(r))", "len(list(r))", "ans", "d = defaultdict(int)", "defaultdict(int)", "d", "ans -= 1", "1", "ans", "r = set()", "set()", "r" ]
from collections import defaultdict n, m = map(int, input().split()) r = set() r.add(1) d = defaultdict(int) for i in range(m): x, y = map(int, input().split()) d[x] -= 1 d[y] += 1 if x in r: r.add(y) if d[x] == -1 and x in r: r.remove(x) ans = len(list(r)) for e in d: if d[e] == -1 and e in r: ans -= 1 print(ans)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 13, 17, 14, 2, 18, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 13, 17, 14, 2, 18, 18, 13, 13, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 13, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 14, 2, 2, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 40, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 14, 2, 40, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 40, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 18, 13, 2, 18, 18, 13, 13, 17, 17, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 40, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 285, 2 ], [ 285, 11 ], [ 15, 14 ], [ 286, 17 ], [ 267, 30 ], [ 255, 33 ], [ 265, 37 ], [ 273, 39 ], [ 265, 43 ], [ 279, 45 ], [ 265, 49 ], [ 276, 51 ], [ 288, 54 ], [ 58, 57 ], [ 286, 60 ], [ 289, 63 ], [ 271, 63 ], [ 259, 63 ], [ 268, 69 ], [ 57, 70 ], [ 83, 74 ], [ 280, 75 ], [ 268, 79 ], [ 57, 80 ], [ 258, 85 ], [ 268, 91 ], [ 57, 92 ], [ 105, 96 ], [ 280, 97 ], [ 268, 101 ], [ 57, 102 ], [ 270, 107 ], [ 119, 110 ], [ 256, 111 ], [ 268, 115 ], [ 57, 116 ], [ 130, 121 ], [ 256, 122 ], [ 268, 126 ], [ 57, 127 ], [ 141, 132 ], [ 256, 133 ], [ 268, 137 ], [ 57, 138 ], [ 152, 143 ], [ 256, 144 ], [ 268, 148 ], [ 57, 149 ], [ 256, 157 ], [ 268, 161 ], [ 57, 162 ], [ 280, 168 ], [ 268, 172 ], [ 57, 173 ], [ 187, 178 ], [ 280, 179 ], [ 268, 183 ], [ 57, 184 ], [ 198, 189 ], [ 280, 190 ], [ 268, 194 ], [ 57, 195 ], [ 256, 203 ], [ 268, 207 ], [ 57, 208 ], [ 280, 214 ], [ 268, 218 ], [ 57, 219 ], [ 233, 224 ], [ 280, 225 ], [ 268, 229 ], [ 57, 230 ], [ 261, 235 ], [ 239, 238 ], [ 265, 241 ], [ 280, 245 ], [ 238, 246 ], [ 282, 249 ], [ 283, 253 ], [ 262, 253 ], [ 255, 256 ], [ 258, 259 ], [ 261, 262 ], [ 285, 265 ], [ 267, 268 ], [ 270, 271 ], [ 273, 274 ], [ 276, 277 ], [ 279, 280 ], [ 282, 283 ], [ 285, 286 ], [ 288, 289 ] ]
[ "n,m=map(int,input().split())\nxy = [list(map(int, input().split())) for _ in range(m)]\nl=[1]*n\nout_=[0]*n\nin_=[0]*n\nc=1\n\ncheck=0\nfor i in range(m):\n if check==0:\n if xy[i][0]==1:\n in_[xy[i][1]-1]+=1\n check=1\n else:\n if xy[i][1]==1:\n in_[xy[i][1]-1]+=1\n check=1\n l[xy[i][0]-1]-=1\n l[xy[i][1]-1]+=1\n else:\n l[xy[i][0]-1]-=1\n l[xy[i][1]-1]+=1\n if l[xy[i][0]-1]==0 and in_[xy[i][0]-1]!=0:\n in_[xy[i][0]-1]=0\n in_[xy[i][1]-1]+=1\n elif l[xy[i][0]-1]!=0 and in_[xy[i][0]-1]!=0:\n in_[xy[i][1]-1]+=1\nans=0\nfor i in range(n):\n if in_[i]!=0:\n ans+=1\nprint(ans)", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "list(map(int, input().split())) for _ in range(m)", "for _ in range(m)", "_", "range(m)", "range", "m", "for _ in range(m)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "xy = [list(map(int, input().split())) for _ in range(m)]", "xy", "[list(map(int, input().split())) for _ in range(m)]", "l=[1]*n", "l", "[1]*n", "[1]", "1", "n", "out_=[0]*n", "out_", "[0]*n", "[0]", "0", "n", "in_=[0]*n", "in_", "[0]*n", "[0]", "0", "n", "c=1", "c", "1", "check=0", "check", "0", "for i in range(m):\n if check==0:\n if xy[i][0]==1:\n in_[xy[i][1]-1]+=1\n check=1\n else:\n if xy[i][1]==1:\n in_[xy[i][1]-1]+=1\n check=1\n l[xy[i][0]-1]-=1\n l[xy[i][1]-1]+=1\n else:\n l[xy[i][0]-1]-=1\n l[xy[i][1]-1]+=1\n if l[xy[i][0]-1]==0 and in_[xy[i][0]-1]!=0:\n in_[xy[i][0]-1]=0\n in_[xy[i][1]-1]+=1\n elif l[xy[i][0]-1]!=0 and in_[xy[i][0]-1]!=0:\n in_[xy[i][1]-1]+=1", "i", "range(m)", "range", "m", "if check==0:\n if xy[i][0]==1:\n in_[xy[i][1]-1]+=1\n check=1\n else:\n if xy[i][1]==1:\n in_[xy[i][1]-1]+=1\n check=1\n l[xy[i][0]-1]-=1\n l[xy[i][1]-1]+=1\n else:\n l[xy[i][0]-1]-=1\n l[xy[i][1]-1]+=1\n if l[xy[i][0]-1]==0 and in_[xy[i][0]-1]!=0:\n in_[xy[i][0]-1]=0\n in_[xy[i][1]-1]+=1\n elif l[xy[i][0]-1]!=0 and in_[xy[i][0]-1]!=0:\n in_[xy[i][1]-1]+=1", "check==0", "check", "0", "if xy[i][0]==1:\n in_[xy[i][1]-1]+=1\n check=1\n else:\n if xy[i][1]==1:\n in_[xy[i][1]-1]+=1\n check=1\n ", "xy[i][0]==1", "xy[i][0]", "[i]", "xy", "i", "0", "1", "in_[xy[i][1]-1]+=1", "in_[xy[i][1]-1]", "in_", "xy[i][1]-1", "xy[i][1]", "[i]", "xy", "i", "1", "1", "1", "check=1", "check", "1", "if xy[i][1]==1:\n in_[xy[i][1]-1]+=1\n check=1\n ", "xy[i][1]==1", "xy[i][1]", "[i]", "xy", "i", "1", "1", "in_[xy[i][1]-1]+=1", "in_[xy[i][1]-1]", "in_", "xy[i][1]-1", "xy[i][1]", "[i]", "xy", "i", "1", "1", "1", "check=1", "check", "1", "l[xy[i][0]-1]-=1", "l[xy[i][0]-1]", "l", "xy[i][0]-1", "xy[i][0]", "[i]", "xy", "i", "0", "1", "1", "l[xy[i][1]-1]+=1", "l[xy[i][1]-1]", "l", "xy[i][1]-1", "xy[i][1]", "[i]", "xy", "i", "1", "1", "1", "l[xy[i][0]-1]-=1", "l[xy[i][0]-1]", "l", "xy[i][0]-1", "xy[i][0]", "[i]", "xy", "i", "0", "1", "1", "l[xy[i][1]-1]+=1", "l[xy[i][1]-1]", "l", "xy[i][1]-1", "xy[i][1]", "[i]", "xy", "i", "1", "1", "1", "if l[xy[i][0]-1]==0 and in_[xy[i][0]-1]!=0:\n in_[xy[i][0]-1]=0\n in_[xy[i][1]-1]+=1\n elif l[xy[i][0]-1]!=0 and in_[xy[i][0]-1]!=0:\n in_[xy[i][1]-1]+=1", "l[xy[i][0]-1]==0 and in_[xy[i][0]-1]!=0", "l[xy[i][0]-1]==0", "l[xy[i][0]-1]", "l", "xy[i][0]-1", "xy[i][0]", "[i]", "xy", "i", "0", "1", "0", "in_[xy[i][0]-1]!=0", "in_[xy[i][0]-1]", "in_", "xy[i][0]-1", "xy[i][0]", "[i]", "xy", "i", "0", "1", "0", "in_[xy[i][0]-1]=0", "in_[xy[i][0]-1]", "in_", "xy[i][0]-1", "xy[i][0]", "[i]", "xy", "i", "0", "1", "0", "in_[xy[i][1]-1]+=1", "in_[xy[i][1]-1]", "in_", "xy[i][1]-1", "xy[i][1]", "[i]", "xy", "i", "1", "1", "1", "elif l[xy[i][0]-1]!=0 and in_[xy[i][0]-1]!=0:\n in_[xy[i][1]-1]+=1", "l[xy[i][0]-1]!=0 and in_[xy[i][0]-1]!=0", "l[xy[i][0]-1]!=0", "l[xy[i][0]-1]", "l", "xy[i][0]-1", "xy[i][0]", "[i]", "xy", "i", "0", "1", "0", "in_[xy[i][0]-1]!=0", "in_[xy[i][0]-1]", "in_", "xy[i][0]-1", "xy[i][0]", "[i]", "xy", "i", "0", "1", "0", "in_[xy[i][1]-1]+=1", "in_[xy[i][1]-1]", "in_", "xy[i][1]-1", "xy[i][1]", "[i]", "xy", "i", "1", "1", "1", "ans=0", "ans", "0", "for i in range(n):\n if in_[i]!=0:\n ans+=1", "i", "range(n)", "range", "n", "if in_[i]!=0:\n ans+=1", "in_[i]!=0", "in_[i]", "in_", "i", "0", "ans+=1", "ans", "1", "print(ans)", "print", "ans", "l=[1]*n", "[1]*n", "l", "check=1", "1", "check", "ans=0", "0", "ans", "n,m=map(int,input().split())", "map(int,input().split())", "n", "xy = [list(map(int, input().split())) for _ in range(m)]", "[list(map(int, input().split())) for _ in range(m)]", "xy", "check=1", "1", "check", "out_=[0]*n", "[0]*n", "out_", "c=1", "1", "c", "in_=[0]*n", "[0]*n", "in_", "ans+=1", "1", "ans", "m=map(int,input().split())", "map(int,input().split())", "m", "check=0", "0", "check" ]
n,m=map(int,input().split()) xy = [list(map(int, input().split())) for _ in range(m)] l=[1]*n out_=[0]*n in_=[0]*n c=1 check=0 for i in range(m): if check==0: if xy[i][0]==1: in_[xy[i][1]-1]+=1 check=1 else: if xy[i][1]==1: in_[xy[i][1]-1]+=1 check=1 l[xy[i][0]-1]-=1 l[xy[i][1]-1]+=1 else: l[xy[i][0]-1]-=1 l[xy[i][1]-1]+=1 if l[xy[i][0]-1]==0 and in_[xy[i][0]-1]!=0: in_[xy[i][0]-1]=0 in_[xy[i][1]-1]+=1 elif l[xy[i][0]-1]!=0 and in_[xy[i][0]-1]!=0: in_[xy[i][1]-1]+=1 ans=0 for i in range(n): if in_[i]!=0: ans+=1 print(ans)
[ 7, 12, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 2, 18, 13, 13, 17, 0, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 5, 13 ], [ 16, 15 ], [ 4, 19 ], [ 22, 21 ], [ 4, 25 ], [ 30, 27 ], [ 21, 28 ], [ 33, 32 ], [ 13, 35 ], [ 38, 37 ], [ 38, 46 ], [ 49, 48 ], [ 52, 51 ], [ 57, 54 ], [ 15, 55 ], [ 48, 56 ], [ 37, 56 ], [ 62, 59 ], [ 15, 60 ], [ 51, 61 ], [ 46, 61 ], [ 21, 65 ], [ 48, 66 ], [ 37, 66 ], [ 71, 68 ], [ 21, 69 ], [ 51, 70 ], [ 46, 70 ], [ 54, 74 ], [ 15, 75 ], [ 48, 76 ], [ 37, 76 ], [ 82, 79 ], [ 21, 80 ], [ 48, 81 ], [ 37, 81 ], [ 85, 84 ], [ 88, 87 ], [ 4, 90 ], [ 21, 94 ], [ 87, 95 ], [ 15, 98 ], [ 87, 99 ], [ 103, 102 ], [ 102, 106 ], [ 84, 106 ], [ 115, 112 ] ]
[ "\ndef solve():\n N, M = map(int, input().split())\n exist = [1] * N\n red = [False] * N\n red[0] = True\n for i in range(M):\n x, y = map(int, input().split())\n x -= 1; y -= 1\n exist[x] -= 1; exist[y] += 1\n if red[x]:\n red[y] = True\n if exist[x] == 0:\n red[x] = False\n ans = 0\n for i in range(N):\n if red[i] and exist[i] > 0:\n ans += 1\n print(ans)\n\n\nif __name__ == '__main__':\n solve()", "def solve():\n N, M = map(int, input().split())\n exist = [1] * N\n red = [False] * N\n red[0] = True\n for i in range(M):\n x, y = map(int, input().split())\n x -= 1; y -= 1\n exist[x] -= 1; exist[y] += 1\n if red[x]:\n red[y] = True\n if exist[x] == 0:\n red[x] = False\n ans = 0\n for i in range(N):\n if red[i] and exist[i] > 0:\n ans += 1\n print(ans)", "solve", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "exist = [1] * N", "exist", "[1] * N", "[1]", "1", "N", "red = [False] * N", "red", "[False] * N", "[False]", "False", "N", "red[0] = True", "red[0]", "red", "0", "True", "for i in range(M):\n x, y = map(int, input().split())\n x -= 1; y -= 1\n exist[x] -= 1; exist[y] += 1\n if red[x]:\n red[y] = True\n if exist[x] == 0:\n red[x] = False\n ", "i", "range(M)", "range", "M", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x -= 1", "x", "1", "y -= 1", "y", "1", "exist[x] -= 1", "exist[x]", "exist", "x", "1", "exist[y] += 1", "exist[y]", "exist", "y", "1", "if red[x]:\n red[y] = True\n ", "red[x]", "red", "x", "red[y] = True", "red[y]", "red", "y", "True", "if exist[x] == 0:\n red[x] = False\n ", "exist[x] == 0", "exist[x]", "exist", "x", "0", "red[x] = False", "red[x]", "red", "x", "False", "ans = 0", "ans", "0", "for i in range(N):\n if red[i] and exist[i] > 0:\n ans += 1\n ", "i", "range(N)", "range", "N", "if red[i] and exist[i] > 0:\n ans += 1\n ", "red[i] and exist[i] > 0", "red[i]", "red", "i", "exist[i] > 0", "exist[i]", "exist", "i", "0", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "if __name__ == '__main__':\n solve()", "__name__ == '__main__'", "__name__", "'__main__'", "solve()", "solve", "def solve():\n N, M = map(int, input().split())\n exist = [1] * N\n red = [False] * N\n red[0] = True\n for i in range(M):\n x, y = map(int, input().split())\n x -= 1; y -= 1\n exist[x] -= 1; exist[y] += 1\n if red[x]:\n red[y] = True\n if exist[x] == 0:\n red[x] = False\n ans = 0\n for i in range(N):\n if red[i] and exist[i] > 0:\n ans += 1\n print(ans)", "def solve():\n N, M = map(int, input().split())\n exist = [1] * N\n red = [False] * N\n red[0] = True\n for i in range(M):\n x, y = map(int, input().split())\n x -= 1; y -= 1\n exist[x] -= 1; exist[y] += 1\n if red[x]:\n red[y] = True\n if exist[x] == 0:\n red[x] = False\n ans = 0\n for i in range(N):\n if red[i] and exist[i] > 0:\n ans += 1\n print(ans)", "solve" ]
def solve(): N, M = map(int, input().split()) exist = [1] * N red = [False] * N red[0] = True for i in range(M): x, y = map(int, input().split()) x -= 1; y -= 1 exist[x] -= 1; exist[y] += 1 if red[x]: red[y] = True if exist[x] == 0: red[x] = False ans = 0 for i in range(N): if red[i] and exist[i] > 0: ans += 1 print(ans) if __name__ == '__main__': solve()
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 17, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 2, 18, 13, 2, 13, 17, 17, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 134, 2 ], [ 134, 11 ], [ 16, 15 ], [ 129, 18 ], [ 122, 22 ], [ 27, 26 ], [ 129, 29 ], [ 125, 33 ], [ 39, 36 ], [ 126, 37 ], [ 42, 41 ], [ 135, 44 ], [ 137, 46 ], [ 137, 55 ], [ 62, 57 ], [ 123, 58 ], [ 138, 60 ], [ 69, 64 ], [ 123, 65 ], [ 132, 67 ], [ 126, 74 ], [ 138, 76 ], [ 126, 81 ], [ 132, 83 ], [ 92, 87 ], [ 126, 88 ], [ 132, 90 ], [ 123, 97 ], [ 138, 99 ], [ 126, 104 ], [ 138, 106 ], [ 115, 110 ], [ 126, 111 ], [ 138, 113 ], [ 126, 120 ], [ 122, 123 ], [ 125, 126 ], [ 134, 129 ], [ 137, 132 ], [ 134, 135 ], [ 137, 138 ] ]
[ "n,m = map(int, input().split())\n\n'''\nd = dict()\nfor i in range(1,n+1):\n d[str(i)] = 1\nfrom collections import deque\nans = deque('1')'''\nbox = [1 for i in range(n)]\nans = [0 for i in range(n)]\nans[0] = 1\nfor _ in range(m):\n x,y = map(int,input().split())\n box[x-1] -= 1\n box[y-1] += 1\n if ans[x-1]==1 and ans[y-1]==0:\n ans[y-1] = 1\n if box[x-1]==0 and ans[x-1]==1:\n ans[x-1] = 0\nprint(sum(ans))", "n,m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "'''\nd = dict()\nfor i in range(1,n+1):\n d[str(i)] = 1\nfrom collections import deque\nans = deque('1')'''", "1 for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "1", "box = [1 for i in range(n)]", "box", "[1 for i in range(n)]", "0 for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "0", "ans = [0 for i in range(n)]", "ans", "[0 for i in range(n)]", "ans[0] = 1", "ans[0]", "ans", "0", "1", "for _ in range(m):\n x,y = map(int,input().split())\n box[x-1] -= 1\n box[y-1] += 1\n if ans[x-1]==1 and ans[y-1]==0:\n ans[y-1] = 1\n if box[x-1]==0 and ans[x-1]==1:\n ans[x-1] = 0", "_", "range(m)", "range", "m", "x,y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "box[x-1] -= 1", "box[x-1]", "box", "x-1", "x", "1", "1", "box[y-1] += 1", "box[y-1]", "box", "y-1", "y", "1", "1", "if ans[x-1]==1 and ans[y-1]==0:\n ans[y-1] = 1\n ", "ans[x-1]==1 and ans[y-1]==0", "ans[x-1]==1", "ans[x-1]", "ans", "x-1", "x", "1", "1", "ans[y-1]==0", "ans[y-1]", "ans", "y-1", "y", "1", "0", "ans[y-1] = 1", "ans[y-1]", "ans", "y-1", "y", "1", "1", "if box[x-1]==0 and ans[x-1]==1:\n ans[x-1] = 0", "box[x-1]==0 and ans[x-1]==1", "box[x-1]==0", "box[x-1]", "box", "x-1", "x", "1", "0", "ans[x-1]==1", "ans[x-1]", "ans", "x-1", "x", "1", "1", "ans[x-1] = 0", "ans[x-1]", "ans", "x-1", "x", "1", "0", "print(sum(ans))", "print", "sum(ans)", "sum", "ans", "box = [1 for i in range(n)]", "[1 for i in range(n)]", "box", "ans = [0 for i in range(n)]", "[0 for i in range(n)]", "ans", "n,m = map(int, input().split())", "map(int, input().split())", "n", "y = map(int,input().split())", "map(int,input().split())", "y", "m = map(int, input().split())", "map(int, input().split())", "m", "x,y = map(int,input().split())", "map(int,input().split())", "x" ]
n,m = map(int, input().split()) ''' d = dict() for i in range(1,n+1): d[str(i)] = 1 from collections import deque ans = deque('1')''' box = [1 for i in range(n)] ans = [0 for i in range(n)] ans[0] = 1 for _ in range(m): x,y = map(int,input().split()) box[x-1] -= 1 box[y-1] += 1 if ans[x-1]==1 and ans[y-1]==0: ans[y-1] = 1 if box[x-1]==0 and ans[x-1]==1: ans[x-1] = 0 print(sum(ans))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 39, 28, 13, 4, 13, 13, 4, 18, 13, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 13, 0, 13, 13, 13, 0, 13, 2, 13, 17, 13, 2, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 13, 14, 13, 0, 13, 17, 4, 13, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13, 10, 13, 13, 10, 17, 13, 10, 39, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 142, 2 ], [ 142, 11 ], [ 133, 13 ], [ 17, 16 ], [ 143, 19 ], [ 134, 22 ], [ 115, 35 ], [ 122, 39 ], [ 112, 41 ], [ 122, 45 ], [ 50, 47 ], [ 113, 48 ], [ 53, 52 ], [ 134, 52 ], [ 127, 55 ], [ 52, 56 ], [ 127, 57 ], [ 136, 59 ], [ 125, 61 ], [ 137, 61 ], [ 139, 63 ], [ 128, 65 ], [ 140, 65 ], [ 113, 69 ], [ 137, 70 ], [ 125, 70 ], [ 75, 72 ], [ 113, 73 ], [ 140, 74 ], [ 128, 74 ], [ 80, 77 ], [ 116, 78 ], [ 137, 79 ], [ 125, 79 ], [ 77, 83 ], [ 116, 84 ], [ 137, 85 ], [ 125, 85 ], [ 91, 88 ], [ 113, 89 ], [ 137, 90 ], [ 125, 90 ], [ 96, 93 ], [ 116, 94 ], [ 140, 95 ], [ 128, 95 ], [ 130, 98 ], [ 102, 101 ], [ 113, 101 ], [ 118, 106 ], [ 119, 110 ], [ 131, 110 ], [ 112, 113 ], [ 115, 116 ], [ 118, 119 ], [ 142, 122 ], [ 52, 124 ], [ 127, 125 ], [ 52, 127 ], [ 127, 128 ], [ 130, 131 ], [ 133, 134 ], [ 136, 137 ], [ 139, 140 ], [ 142, 143 ] ]
[ "N, M = map(int, input().split())\nxy = []\nfor _ in range(M):\n xy.append(tuple(map(int, input().split())))\n\nnum = [1] * N\nred = [False] * N\nred[0] = True\n\nfor el in xy:\n x, y = el\n x, y = x - 1, y - 1\n if red[x]:\n red[y] = True\n num[x] -= 1\n if num[x] == 0:\n red[x] = False\n num[y] += 1\n# print(num, red)\ncnt = 0\nfor el in red:\n if el:\n cnt += 1\nprint(cnt)", "N, M = map(int, input().split())", "N", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "M", "xy = []", "xy", "[]", "for _ in range(M):\n xy.append(tuple(map(int, input().split())))", "_", "range(M)", "range", "M", "xy.append(tuple(map(int, input().split())))", "xy.append", "xy", "append", "tuple(map(int, input().split()))", "tuple", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "num = [1] * N", "num", "[1] * N", "[1]", "1", "N", "red = [False] * N", "red", "[False] * N", "[False]", "False", "N", "red[0] = True", "red[0]", "red", "0", "True", "for el in xy:\n x, y = el\n x, y = x - 1, y - 1\n if red[x]:\n red[y] = True\n num[x] -= 1\n if num[x] == 0:\n red[x] = False\n num[y] += 1\n# print(num, red)", "el", "xy", "x, y = el", "x", "el", "y", "x, y = x - 1, y - 1", "x", "x - 1", "x", "1", "y", "y - 1", "y", "1", "if red[x]:\n red[y] = True\n ", "red[x]", "red", "x", "red[y] = True", "red[y]", "red", "y", "True", "num[x] -= 1", "num[x]", "num", "x", "1", "if num[x] == 0:\n red[x] = False\n ", "num[x] == 0", "num[x]", "num", "x", "0", "red[x] = False", "red[x]", "red", "x", "False", "num[y] += 1", "num[y]", "num", "y", "1", "cnt = 0", "cnt", "0", "for el in red:\n if el:\n cnt += 1", "el", "red", "if el:\n cnt += 1", "el", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "red = [False] * N", "[False] * N", "red", "num = [1] * N", "[1] * N", "num", "cnt += 1", "1", "cnt", "N, M = map(int, input().split())", "map(int, input().split())", "N", "x, y = el", "el", "x", "y = el", "el", "y", "cnt = 0", "0", "cnt", "xy = []", "[]", "xy", "x, y = x - 1, y - 1", "x - 1", "x", "y = x - 1, y - 1", "y - 1", "y", "M = map(int, input().split())", "map(int, input().split())", "M" ]
N, M = map(int, input().split()) xy = [] for _ in range(M): xy.append(tuple(map(int, input().split()))) num = [1] * N red = [False] * N red[0] = True for el in xy: x, y = el x, y = x - 1, y - 1 if red[x]: red[y] = True num[x] -= 1 if num[x] == 0: red[x] = False num[y] += 1 # print(num, red) cnt = 0 for el in red: if el: cnt += 1 print(cnt)
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 39, 17, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 2, 18, 13, 13, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 18, 13, 13, 17, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13 ]
[ [ 113, 2 ], [ 113, 11 ], [ 125, 13 ], [ 105, 21 ], [ 116, 24 ], [ 105, 28 ], [ 31, 30 ], [ 114, 33 ], [ 110, 35 ], [ 110, 44 ], [ 119, 46 ], [ 122, 49 ], [ 62, 53 ], [ 126, 54 ], [ 120, 55 ], [ 108, 55 ], [ 87, 57 ], [ 117, 58 ], [ 120, 59 ], [ 108, 59 ], [ 65, 62 ], [ 126, 63 ], [ 120, 64 ], [ 108, 64 ], [ 70, 67 ], [ 126, 68 ], [ 123, 69 ], [ 111, 69 ], [ 62, 73 ], [ 126, 74 ], [ 120, 75 ], [ 108, 75 ], [ 87, 77 ], [ 117, 78 ], [ 120, 79 ], [ 108, 79 ], [ 85, 82 ], [ 126, 83 ], [ 123, 84 ], [ 111, 84 ], [ 90, 87 ], [ 117, 88 ], [ 120, 89 ], [ 108, 89 ], [ 95, 92 ], [ 117, 93 ], [ 123, 94 ], [ 111, 94 ], [ 126, 100 ], [ 113, 105 ], [ 110, 108 ], [ 110, 111 ], [ 113, 114 ], [ 116, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ] ]
[ "n,m=map(int,input().split())\nred=[1]+[0]*(n-1)\npink=[1]*n\nfor _ in range(m):\n x,y=map(int,input().split())\n x-=1\n y-=1\n if red[x] and pink[x]==1:\n red[x]=0\n red[y]=1\n elif red[x] and pink[x]>1:\n red[y]=1\n pink[x]-=1\n pink[y]+=1\nprint(red.count(1))", "n,m=map(int,input().split())", "n", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "red=[1]+[0]*(n-1)", "red", "[1]+[0]*(n-1)", "[1]", "1", "[0]*(n-1)", "[0]", "0", "n-1", "n", "1", "pink=[1]*n", "pink", "[1]*n", "[1]", "1", "n", "for _ in range(m):\n x,y=map(int,input().split())\n x-=1\n y-=1\n if red[x] and pink[x]==1:\n red[x]=0\n red[y]=1\n elif red[x] and pink[x]>1:\n red[y]=1\n pink[x]-=1\n pink[y]+=1", "_", "range(m)", "range", "m", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "x-=1", "x", "1", "y-=1", "y", "1", "if red[x] and pink[x]==1:\n red[x]=0\n red[y]=1\n elif red[x] and pink[x]>1:\n red[y]=1\n ", "red[x] and pink[x]==1", "red[x]", "red", "x", "pink[x]==1", "pink[x]", "pink", "x", "1", "red[x]=0", "red[x]", "red", "x", "0", "red[y]=1", "red[y]", "red", "y", "1", "elif red[x] and pink[x]>1:\n red[y]=1\n ", "red[x] and pink[x]>1", "red[x]", "red", "x", "pink[x]>1", "pink[x]", "pink", "x", "1", "red[y]=1", "red[y]", "red", "y", "1", "pink[x]-=1", "pink[x]", "pink", "x", "1", "pink[y]+=1", "pink[y]", "pink", "y", "1", "print(red.count(1))", "print", "red.count(1)", "red.count", "red", "count", "1", "n,m=map(int,input().split())", "map(int,input().split())", "n", "x,y=map(int,input().split())", "map(int,input().split())", "x", "y=map(int,input().split())", "map(int,input().split())", "y", "m=map(int,input().split())", "map(int,input().split())", "m", "pink=[1]*n", "[1]*n", "pink", "x-=1", "1", "x", "y-=1", "1", "y", "red=[1]+[0]*(n-1)", "[1]+[0]*(n-1)", "red" ]
n,m=map(int,input().split()) red=[1]+[0]*(n-1) pink=[1]*n for _ in range(m): x,y=map(int,input().split()) x-=1 y-=1 if red[x] and pink[x]==1: red[x]=0 red[y]=1 elif red[x] and pink[x]>1: red[y]=1 pink[x]-=1 pink[y]+=1 print(red.count(1))
[ 7, 15, 13, 15, 15, 12, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 0, 13, 4, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 4, 18, 18, 13, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 2, 13, 17, 14, 2, 18, 13, 13, 18, 13, 13, 0, 13, 17, 4, 13, 13, 0, 13, 17, 28, 13, 4, 13, 17, 2, 13, 17, 0, 13, 4, 13, 17, 10, 17, 13, 10, 12, 13, 10, 4, 13 ]
[ [ 10, 9 ], [ 9, 18 ], [ 21, 20 ], [ 21, 22 ], [ 25, 24 ], [ 30, 29 ], [ 20, 34 ], [ 38, 37 ], [ 20, 42 ], [ 48, 45 ], [ 37, 46 ], [ 51, 50 ], [ 22, 53 ], [ 57, 56 ], [ 56, 65 ], [ 68, 67 ], [ 68, 69 ], [ 24, 73 ], [ 67, 74 ], [ 69, 76 ], [ 81, 78 ], [ 29, 79 ], [ 67, 80 ], [ 86, 83 ], [ 29, 84 ], [ 69, 85 ], [ 37, 89 ], [ 67, 90 ], [ 78, 93 ], [ 29, 94 ], [ 67, 95 ], [ 101, 98 ], [ 37, 99 ], [ 67, 100 ], [ 106, 103 ], [ 37, 104 ], [ 69, 105 ], [ 109, 108 ], [ 112, 111 ], [ 20, 116 ], [ 29, 121 ], [ 111, 122 ], [ 37, 124 ], [ 111, 125 ], [ 128, 127 ], [ 127, 131 ], [ 108, 131 ], [ 149, 133 ], [ 137, 136 ], [ 150, 141 ], [ 155, 144 ], [ 153, 146 ], [ 149, 150 ], [ 155, 156 ] ]
[ "# -*- coding: utf-8 -*-\nimport sys\nfrom collections import deque, defaultdict\nfrom math import sqrt, factorial, gcd\n# def input(): return sys.stdin.readline()[:-1] # warning not \\n\n# def input(): return sys.stdin.buffer.readline().strip() # warning bytes\n# def input(): return sys.stdin.buffer.readline().decode('utf-8')\n\n\ndef solve():\n n, m = [int(x) for x in input().split()]\n g = defaultdict(list)\n cnt = [1] * (n + 1)\n w = [0] * (n + 1)\n w[1] = 1\n for _ in range(m):\n a, b = [int(x) for x in input().split()]\n g[a].append(b)\n cnt[a] -= 1\n cnt[b] += 1\n if w[a]:\n if cnt[a] == 0:\n w[a] = 0\n w[b] = 1\n \n ans = 0\n for i in range(1, n+1):\n if cnt[i] and w[i]:\n ans += 1\n print(ans)\n \n\n \n \nt = 1\n# t = int(input())\nfor case in range(1,t+1):\n ans = solve()\n\n\n\"\"\"\n\nR s\nS p\nP r\n\n\"\"\"", "import sys", "sys", "from collections import deque, defaultdict", "from math import sqrt, factorial, gcd", "def solve():\n n, m = [int(x) for x in input().split()]\n g = defaultdict(list)\n cnt = [1] * (n + 1)\n w = [0] * (n + 1)\n w[1] = 1\n for _ in range(m):\n a, b = [int(x) for x in input().split()]\n g[a].append(b)\n cnt[a] -= 1\n cnt[b] += 1\n if w[a]:\n if cnt[a] == 0:\n w[a] = 0\n w[b] = 1\n \n ans = 0\n for i in range(1, n+1):\n if cnt[i] and w[i]:\n ans += 1\n print(ans)\n \n\n \n ", "solve", "int(x) for x in input().split()", "for x in input().split()", "x", "input().split()", "().split", "()", "input", "split", "for x in input().split()", "int(x)", "int", "x", "n, m = [int(x) for x in input().split()]", "n", "[int(x) for x in input().split()]", "m", "g = defaultdict(list)", "g", "defaultdict(list)", "defaultdict", "list", "cnt = [1] * (n + 1)", "cnt", "[1] * (n + 1)", "[1]", "1", "n + 1", "n", "1", "w = [0] * (n + 1)", "w", "[0] * (n + 1)", "[0]", "0", "n + 1", "n", "1", "w[1] = 1", "w[1]", "w", "1", "1", "for _ in range(m):\n a, b = [int(x) for x in input().split()]\n g[a].append(b)\n cnt[a] -= 1\n cnt[b] += 1\n if w[a]:\n if cnt[a] == 0:\n w[a] = 0\n w[b] = 1\n \n ", "_", "range(m)", "range", "m", "int(x) for x in input().split()", "for x in input().split()", "x", "input().split()", "().split", "()", "input", "split", "for x in input().split()", "int(x)", "int", "x", "a, b = [int(x) for x in input().split()]", "a", "[int(x) for x in input().split()]", "b", "g[a].append(b)", "[a].append", "[a]", "g", "a", "append", "b", "cnt[a] -= 1", "cnt[a]", "cnt", "a", "1", "cnt[b] += 1", "cnt[b]", "cnt", "b", "1", "if w[a]:\n if cnt[a] == 0:\n w[a] = 0\n w[b] = 1\n \n ", "w[a]", "w", "a", "if cnt[a] == 0:\n w[a] = 0\n ", "cnt[a] == 0", "cnt[a]", "cnt", "a", "0", "w[a] = 0", "w[a]", "w", "a", "0", "w[b] = 1", "w[b]", "w", "b", "1", "ans = 0", "ans", "0", "for i in range(1, n+1):\n if cnt[i] and w[i]:\n ans += 1\n ", "i", "range(1, n+1)", "range", "1", "n+1", "n", "1", "if cnt[i] and w[i]:\n ans += 1\n ", "cnt[i] and w[i]", "cnt[i]", "cnt", "i", "w[i]", "w", "i", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "t = 1", "t", "1", "for case in range(1,t+1):\n ans = solve()", "case", "range(1,t+1)", "range", "1", "t+1", "t", "1", "ans = solve()", "ans", "solve()", "solve", "\"\"\"\n\nR s\nS p\nP r\n\n\"\"\"", "t = 1", "1", "t", "def solve():\n n, m = [int(x) for x in input().split()]\n g = defaultdict(list)\n cnt = [1] * (n + 1)\n w = [0] * (n + 1)\n w[1] = 1\n for _ in range(m):\n a, b = [int(x) for x in input().split()]\n g[a].append(b)\n cnt[a] -= 1\n cnt[b] += 1\n if w[a]:\n if cnt[a] == 0:\n w[a] = 0\n w[b] = 1\n \n ans = 0\n for i in range(1, n+1):\n if cnt[i] and w[i]:\n ans += 1\n print(ans)\n \n\n \n ", "def solve():\n n, m = [int(x) for x in input().split()]\n g = defaultdict(list)\n cnt = [1] * (n + 1)\n w = [0] * (n + 1)\n w[1] = 1\n for _ in range(m):\n a, b = [int(x) for x in input().split()]\n g[a].append(b)\n cnt[a] -= 1\n cnt[b] += 1\n if w[a]:\n if cnt[a] == 0:\n w[a] = 0\n w[b] = 1\n \n ans = 0\n for i in range(1, n+1):\n if cnt[i] and w[i]:\n ans += 1\n print(ans)\n \n\n \n ", "solve", "ans = solve()", "solve()", "ans" ]
# -*- coding: utf-8 -*- import sys from collections import deque, defaultdict from math import sqrt, factorial, gcd # def input(): return sys.stdin.readline()[:-1] # warning not \n # def input(): return sys.stdin.buffer.readline().strip() # warning bytes # def input(): return sys.stdin.buffer.readline().decode('utf-8') def solve(): n, m = [int(x) for x in input().split()] g = defaultdict(list) cnt = [1] * (n + 1) w = [0] * (n + 1) w[1] = 1 for _ in range(m): a, b = [int(x) for x in input().split()] g[a].append(b) cnt[a] -= 1 cnt[b] += 1 if w[a]: if cnt[a] == 0: w[a] = 0 w[b] = 1 ans = 0 for i in range(1, n+1): if cnt[i] and w[i]: ans += 1 print(ans) t = 1 # t = int(input()) for case in range(1,t+1): ans = solve() """ R s S p P r """
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 41, 28, 13, 4, 13, 2, 13, 17, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 13, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 111, 2 ], [ 111, 11 ], [ 15, 14 ], [ 106, 18 ], [ 108, 23 ], [ 29, 26 ], [ 109, 27 ], [ 33, 32 ], [ 106, 36 ], [ 102, 41 ], [ 47, 44 ], [ 103, 45 ], [ 50, 49 ], [ 112, 52 ], [ 117, 54 ], [ 117, 63 ], [ 92, 66 ], [ 103, 67 ], [ 115, 68 ], [ 74, 71 ], [ 103, 72 ], [ 118, 73 ], [ 79, 76 ], [ 109, 77 ], [ 115, 78 ], [ 84, 81 ], [ 109, 82 ], [ 118, 83 ], [ 76, 87 ], [ 109, 88 ], [ 115, 89 ], [ 95, 92 ], [ 103, 93 ], [ 115, 94 ], [ 103, 100 ], [ 102, 103 ], [ 111, 106 ], [ 108, 109 ], [ 111, 112 ], [ 117, 115 ], [ 117, 118 ] ]
[ "n, m = map(int, input().split())\ncount = [1 for i in range(n + 1)]\ncount[0] = 0\nflag = [False for i in range(n + 1)]\nflag[1] = True\nfor i in range(m):\n x, y = map(int, input().split())\n if flag[x] == True:\n flag[y] = True\n count[x] -= 1\n count[y] += 1\n if count[x] == 0:\n flag[x] = False\nprint(sum(flag))", "n, m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "1 for i in range(n + 1)", "for i in range(n + 1)", "i", "range(n + 1)", "range", "n + 1", "n", "1", "for i in range(n + 1)", "1", "count = [1 for i in range(n + 1)]", "count", "[1 for i in range(n + 1)]", "count[0] = 0", "count[0]", "count", "0", "0", "False for i in range(n + 1)", "for i in range(n + 1)", "i", "range(n + 1)", "range", "n + 1", "n", "1", "for i in range(n + 1)", "False", "flag = [False for i in range(n + 1)]", "flag", "[False for i in range(n + 1)]", "flag[1] = True", "flag[1]", "flag", "1", "True", "for i in range(m):\n x, y = map(int, input().split())\n if flag[x] == True:\n flag[y] = True\n count[x] -= 1\n count[y] += 1\n if count[x] == 0:\n flag[x] = False", "i", "range(m)", "range", "m", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "if flag[x] == True:\n flag[y] = True\n ", "flag[x] == True", "flag[x]", "flag", "x", "True", "flag[y] = True", "flag[y]", "flag", "y", "True", "count[x] -= 1", "count[x]", "count", "x", "1", "count[y] += 1", "count[y]", "count", "y", "1", "if count[x] == 0:\n flag[x] = False", "count[x] == 0", "count[x]", "count", "x", "0", "flag[x] = False", "flag[x]", "flag", "x", "False", "print(sum(flag))", "print", "sum(flag)", "sum", "flag", "flag = [False for i in range(n + 1)]", "[False for i in range(n + 1)]", "flag", "n, m = map(int, input().split())", "map(int, input().split())", "n", "count = [1 for i in range(n + 1)]", "[1 for i in range(n + 1)]", "count", "m = map(int, input().split())", "map(int, input().split())", "m", "x, y = map(int, input().split())", "map(int, input().split())", "x", "y = map(int, input().split())", "map(int, input().split())", "y" ]
n, m = map(int, input().split()) count = [1 for i in range(n + 1)] count[0] = 0 flag = [False for i in range(n + 1)] flag[1] = True for i in range(m): x, y = map(int, input().split()) if flag[x] == True: flag[y] = True count[x] -= 1 count[y] += 1 if count[x] == 0: flag[x] = False print(sum(flag))
[ 7, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 41, 28, 13, 4, 13, 13, 4, 17, 0, 13, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 2, 4, 13, 13, 17, 0, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 13, 13, 10, 13, 13, 10, 13, 13, 10, 13, 13, 10, 13, 13, 10, 13, 13 ]
[ [ 4, 3 ], [ 3, 12 ], [ 118, 14 ], [ 118, 16 ], [ 20, 19 ], [ 104, 22 ], [ 109, 26 ], [ 31, 30 ], [ 104, 33 ], [ 106, 37 ], [ 43, 40 ], [ 107, 41 ], [ 46, 45 ], [ 119, 48 ], [ 52, 51 ], [ 51, 61 ], [ 115, 64 ], [ 115, 66 ], [ 71, 68 ], [ 110, 69 ], [ 113, 70 ], [ 76, 73 ], [ 110, 74 ], [ 116, 75 ], [ 107, 79 ], [ 113, 80 ], [ 85, 82 ], [ 107, 83 ], [ 116, 84 ], [ 68, 88 ], [ 110, 89 ], [ 113, 90 ], [ 96, 93 ], [ 107, 94 ], [ 113, 95 ], [ 107, 101 ], [ 118, 104 ], [ 106, 107 ], [ 109, 110 ], [ 115, 113 ], [ 115, 116 ], [ 118, 119 ] ]
[ "n, m = [int(_) for _ in input().split()]\n\nball = [1 for i in range(n)]\nred = [False for i in range(n)]\nred[0] = True\n\nfor i in range(m):\n x, y = [int(_)-1 for _ in input().split()]\n ball[x] -= 1\n ball[y] += 1\n if red[x]:\n red[y] = True\n if ball[x] == 0:\n red[x] = False\n\nprint(sum(red))", "int(_) for _ in input().split()", "for _ in input().split()", "_", "input().split()", "().split", "()", "input", "split", "for _ in input().split()", "int(_)", "int", "_", "n, m = [int(_) for _ in input().split()]", "n", "[int(_) for _ in input().split()]", "m", "1 for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "1", "ball = [1 for i in range(n)]", "ball", "[1 for i in range(n)]", "False for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "False", "red = [False for i in range(n)]", "red", "[False for i in range(n)]", "red[0] = True", "red[0]", "red", "0", "True", "for i in range(m):\n x, y = [int(_)-1 for _ in input().split()]\n ball[x] -= 1\n ball[y] += 1\n if red[x]:\n red[y] = True\n if ball[x] == 0:\n red[x] = False", "i", "range(m)", "range", "m", "int(_)-1 for _ in input().split()", "for _ in input().split()", "_", "input().split()", "().split", "()", "input", "split", "for _ in input().split()", "int(_)-1", "int(_)", "int", "_", "1", "x, y = [int(_)-1 for _ in input().split()]", "x", "[int(_)-1 for _ in input().split()]", "y", "ball[x] -= 1", "ball[x]", "ball", "x", "1", "ball[y] += 1", "ball[y]", "ball", "y", "1", "if red[x]:\n red[y] = True\n ", "red[x]", "red", "x", "red[y] = True", "red[y]", "red", "y", "True", "if ball[x] == 0:\n red[x] = False", "ball[x] == 0", "ball[x]", "ball", "x", "0", "red[x] = False", "red[x]", "red", "x", "False", "print(sum(red))", "print", "sum(red)", "sum", "red", "n, m = [int(_) for _ in input().split()]", "[int(_) for _ in input().split()]", "n", "red = [False for i in range(n)]", "[False for i in range(n)]", "red", "ball = [1 for i in range(n)]", "[1 for i in range(n)]", "ball", "x, y = [int(_)-1 for _ in input().split()]", "[int(_)-1 for _ in input().split()]", "x", "y = [int(_)-1 for _ in input().split()]", "[int(_)-1 for _ in input().split()]", "y", "m = [int(_) for _ in input().split()]", "[int(_) for _ in input().split()]", "m" ]
n, m = [int(_) for _ in input().split()] ball = [1 for i in range(n)] red = [False for i in range(n)] red[0] = True for i in range(m): x, y = [int(_)-1 for _ in input().split()] ball[x] -= 1 ball[y] += 1 if red[x]: red[y] = True if ball[x] == 0: red[x] = False print(sum(red))
[ 7, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 28, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 2, 18, 13, 13, 17, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 13, 13 ]
[ [ 104, 2 ], [ 104, 11 ], [ 15, 14 ], [ 99, 17 ], [ 107, 30 ], [ 95, 33 ], [ 105, 38 ], [ 101, 41 ], [ 105, 46 ], [ 52, 49 ], [ 102, 50 ], [ 61, 58 ], [ 96, 59 ], [ 66, 63 ], [ 96, 64 ], [ 85, 69 ], [ 102, 70 ], [ 77, 74 ], [ 102, 75 ], [ 58, 80 ], [ 96, 81 ], [ 88, 85 ], [ 102, 86 ], [ 102, 93 ], [ 95, 96 ], [ 104, 99 ], [ 101, 102 ], [ 104, 105 ], [ 107, 108 ] ]
[ "n,m = map(int, input().split())\nxy = [list(map(int, input().split())) for _ in range(m)]\n\nball = [1] * (n+1)\nred = [0] * (n+1)\nred[1] = 1\n\nfor x,y in xy:\n ball[x] -= 1\n ball[y] += 1\n if red[x] == 1:\n red[y] = 1\n if ball[x] == 0:\n red[x] = 0\nprint(sum(red))", "n,m = map(int, input().split())", "n", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "m", "list(map(int, input().split())) for _ in range(m)", "for _ in range(m)", "_", "range(m)", "range", "m", "for _ in range(m)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "xy = [list(map(int, input().split())) for _ in range(m)]", "xy", "[list(map(int, input().split())) for _ in range(m)]", "ball = [1] * (n+1)", "ball", "[1] * (n+1)", "[1]", "1", "n+1", "n", "1", "red = [0] * (n+1)", "red", "[0] * (n+1)", "[0]", "0", "n+1", "n", "1", "red[1] = 1", "red[1]", "red", "1", "1", "for x,y in xy:\n ball[x] -= 1\n ball[y] += 1\n if red[x] == 1:\n red[y] = 1\n if ball[x] == 0:\n red[x] = 0", "x", "y", "xy", "ball[x] -= 1", "ball[x]", "ball", "x", "1", "ball[y] += 1", "ball[y]", "ball", "y", "1", "if red[x] == 1:\n red[y] = 1\n if ball[x] == 0:\n red[x] = 0", "red[x] == 1", "red[x]", "red", "x", "1", "red[y] = 1", "red[y]", "red", "y", "1", "if ball[x] == 0:\n red[x] = 0", "ball[x] == 0", "ball[x]", "ball", "x", "0", "red[x] = 0", "red[x]", "red", "x", "0", "print(sum(red))", "print", "sum(red)", "sum", "red", "ball = [1] * (n+1)", "[1] * (n+1)", "ball", "m = map(int, input().split())", "map(int, input().split())", "m", "red = [0] * (n+1)", "[0] * (n+1)", "red", "n,m = map(int, input().split())", "map(int, input().split())", "n", "xy = [list(map(int, input().split())) for _ in range(m)]", "[list(map(int, input().split())) for _ in range(m)]", "xy" ]
n,m = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(m)] ball = [1] * (n+1) red = [0] * (n+1) red[1] = 1 for x,y in xy: ball[x] -= 1 ball[y] += 1 if red[x] == 1: red[y] = 1 if ball[x] == 0: red[x] = 0 print(sum(red))
[ 7, 15, 13, 12, 13, 12, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 4, 13, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 18, 13, 2, 13, 17, 8, 2, 18, 13, 2, 13, 17, 17, 17, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 14, 2, 18, 13, 2, 13, 17, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 12, 13, 10, 12, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 119, 15 ], [ 102, 17 ], [ 119, 18 ], [ 107, 20 ], [ 120, 24 ], [ 110, 26 ], [ 120, 30 ], [ 35, 32 ], [ 108, 33 ], [ 38, 37 ], [ 114, 40 ], [ 122, 42 ], [ 102, 44 ], [ 122, 45 ], [ 52, 47 ], [ 108, 48 ], [ 117, 50 ], [ 108, 55 ], [ 123, 57 ], [ 108, 62 ], [ 117, 64 ], [ 72, 67 ], [ 111, 68 ], [ 123, 70 ], [ 79, 74 ], [ 111, 75 ], [ 117, 77 ], [ 111, 83 ], [ 123, 85 ], [ 94, 89 ], [ 108, 90 ], [ 123, 92 ], [ 108, 99 ], [ 107, 108 ], [ 110, 111 ], [ 119, 114 ], [ 122, 117 ], [ 119, 120 ], [ 122, 123 ] ]
[ "import sys\ndef input(): return sys.stdin.readline().strip()\ndef mapint(): return map(int, input().split())\nsys.setrecursionlimit(10**9)\n\nN, M = mapint()\nboxes = [0]*N\nballs = [1]*N\nboxes[0] = 1\nfor _ in range(M):\n x, y = mapint()\n boxes[y-1] = 1 if boxes[x-1]==1 else boxes[y-1]\n balls[x-1] -= 1\n balls[y-1] += 1\n if balls[x-1]==0:\n boxes[x-1] = 0\n\nprint(sum(boxes))", "import sys", "sys", "def input(): return sys.stdin.readline().strip()", "input", "def mapint(): return map(int, input().split())", "mapint", "sys.setrecursionlimit(10**9)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**9", "10", "9", "N, M = mapint()", "N", "mapint()", "mapint", "M", "boxes = [0]*N", "boxes", "[0]*N", "[0]", "0", "N", "balls = [1]*N", "balls", "[1]*N", "[1]", "1", "N", "boxes[0] = 1", "boxes[0]", "boxes", "0", "1", "for _ in range(M):\n x, y = mapint()\n boxes[y-1] = 1 if boxes[x-1]==1 else boxes[y-1]\n balls[x-1] -= 1\n balls[y-1] += 1\n if balls[x-1]==0:\n boxes[x-1] = 0", "_", "range(M)", "range", "M", "x, y = mapint()", "x", "mapint()", "mapint", "y", "boxes[y-1] = 1 if boxes[x-1]==1 else boxes[y-1]", "boxes[y-1]", "boxes", "y-1", "y", "1", "1 if boxes[x-1]==1 else boxes[y-1]", "boxes[x-1]==1", "boxes[x-1]", "boxes", "x-1", "x", "1", "1", "1", "boxes[y-1]", "boxes", "y-1", "y", "1", "balls[x-1] -= 1", "balls[x-1]", "balls", "x-1", "x", "1", "1", "balls[y-1] += 1", "balls[y-1]", "balls", "y-1", "y", "1", "1", "if balls[x-1]==0:\n boxes[x-1] = 0", "balls[x-1]==0", "balls[x-1]", "balls", "x-1", "x", "1", "0", "boxes[x-1] = 0", "boxes[x-1]", "boxes", "x-1", "x", "1", "0", "print(sum(boxes))", "print", "sum(boxes)", "sum", "boxes", "def mapint(): return map(int, input().split())", "def mapint(): return map(int, input().split())", "mapint", "def input(): return sys.stdin.readline().strip()", "def input(): return sys.stdin.readline().strip()", "input", "boxes = [0]*N", "[0]*N", "boxes", "balls = [1]*N", "[1]*N", "balls", "M = mapint()", "mapint()", "M", "y = mapint()", "mapint()", "y", "N, M = mapint()", "mapint()", "N", "x, y = mapint()", "mapint()", "x" ]
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) N, M = mapint() boxes = [0]*N balls = [1]*N boxes[0] = 1 for _ in range(M): x, y = mapint() boxes[y-1] = 1 if boxes[x-1]==1 else boxes[y-1] balls[x-1] -= 1 balls[y-1] += 1 if balls[x-1]==0: boxes[x-1] = 0 print(sum(boxes))
[ 7, 15, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 2, 39, 17, 2, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 0, 18, 13, 17, 17, 28, 13, 13, 4, 13, 13, 13, 0, 18, 13, 13, 17, 0, 18, 13, 13, 17, 14, 18, 13, 13, 0, 18, 13, 13, 17, 14, 40, 18, 13, 13, 0, 18, 13, 13, 17, 4, 13, 4, 13, 13, 10, 4, 13, 10, 18, 13, 10, 18, 13, 10, 18, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 117, 4 ], [ 120, 13 ], [ 123, 22 ], [ 135, 31 ], [ 121, 38 ], [ 135, 40 ], [ 129, 42 ], [ 118, 49 ], [ 126, 52 ], [ 136, 57 ], [ 132, 60 ], [ 136, 65 ], [ 71, 68 ], [ 133, 69 ], [ 130, 77 ], [ 130, 78 ], [ 83, 80 ], [ 127, 81 ], [ 88, 85 ], [ 127, 86 ], [ 133, 91 ], [ 97, 94 ], [ 133, 95 ], [ 80, 100 ], [ 127, 101 ], [ 107, 104 ], [ 133, 105 ], [ 133, 112 ], [ 135, 115 ], [ 117, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ], [ 129, 130 ], [ 132, 133 ], [ 135, 136 ] ]
[ "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN, M = map(int, readline().split())\nm = map(int, read().split())\n\ncount = [1] * (N+1)\nred = [0] * (N+1)\nred[1] = True\nfor x, y in zip(m, m):\n count[x] -= 1\n count[y] += 1\n if red[x]:\n red[y] = 1\n if not count[x]:\n red[x] = 0\n\nprint(sum(red))", "import sys", "sys", "read = sys.stdin.buffer.read", "read", "sys.stdin.buffer.read", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "read", "readline = sys.stdin.buffer.readline", "readline", "sys.stdin.buffer.readline", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readline", "readlines = sys.stdin.buffer.readlines", "readlines", "sys.stdin.buffer.readlines", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readlines", "N, M = map(int, readline().split())", "N", "map(int, readline().split())", "map", "int", "readline().split()", "().split", "()", "readline", "split", "M", "m = map(int, read().split())", "m", "map(int, read().split())", "map", "int", "read().split()", "().split", "()", "read", "split", "count = [1] * (N+1)", "count", "[1] * (N+1)", "[1]", "1", "N+1", "N", "1", "red = [0] * (N+1)", "red", "[0] * (N+1)", "[0]", "0", "N+1", "N", "1", "red[1] = True", "red[1]", "red", "1", "True", "for x, y in zip(m, m):\n count[x] -= 1\n count[y] += 1\n if red[x]:\n red[y] = 1\n if not count[x]:\n red[x] = 0", "x", "y", "zip(m, m)", "zip", "m", "m", "count[x] -= 1", "count[x]", "count", "x", "1", "count[y] += 1", "count[y]", "count", "y", "1", "if red[x]:\n red[y] = 1\n ", "red[x]", "red", "x", "red[y] = 1", "red[y]", "red", "y", "1", "if not count[x]:\n red[x] = 0", "not count[x]", "count[x]", "count", "x", "red[x] = 0", "red[x]", "red", "x", "0", "print(sum(red))", "print", "sum(red)", "sum", "red", "M = map(int, readline().split())", "map(int, readline().split())", "M", "read = sys.stdin.buffer.read", "sys.stdin.buffer.read", "read", "readline = sys.stdin.buffer.readline", "sys.stdin.buffer.readline", "readline", "readlines = sys.stdin.buffer.readlines", "sys.stdin.buffer.readlines", "readlines", "count = [1] * (N+1)", "[1] * (N+1)", "count", "m = map(int, read().split())", "map(int, read().split())", "m", "red = [0] * (N+1)", "[0] * (N+1)", "red", "N, M = map(int, readline().split())", "map(int, readline().split())", "N" ]
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = map(int, readline().split()) m = map(int, read().split()) count = [1] * (N+1) red = [0] * (N+1) red[1] = True for x, y in zip(m, m): count[x] -= 1 count[y] += 1 if red[x]: red[y] = 1 if not count[x]: red[x] = 0 print(sum(red))