problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03037
u188827677
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M = map(int, input().split())\nL = []\nR = []\nfor _ in range(M):\n l,r = map(int, input().split())\n L.append(l)\n R.append(r)\n\nif min(R) <= max(L):\n print(min(R)-max(L)+1)\nelse:\n print(0)', 'n,m = map(int, input().split())\nx = []\ny = []\nfor _ in range(m):\n l,r = map(int, input().split())\n x.appen...
['Wrong Answer', 'Accepted']
['s946928795', 's554860911']
[11016.0, 16892.0]
[302.0, 198.0]
[190, 190]
p03037
u189397279
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import sys\nN, M = map(int, sys.stdin.readline().split())\nLR = [list(map(int,sys.stdin.readline().split())) for i in range(N)]\nB = list(range(0, 10 ** 5 + 1))\nfor i in LR:\n\tA = list(range(i[0], i[1]))\n\tB = set(A) & set(B)\nprint(len(B))', 'import sys\nN, M = map(int, sys.stdin.readline().split())\nLR = sorted(...
['Runtime Error', 'Accepted']
['s021173468', 's077469909']
[58656.0, 28628.0]
[2107.0, 416.0]
[234, 261]
p03037
u189479417
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int,input().split())\nL = []\nR = []\nfor i in range(M):\n tmp_L, tmp_R = input().split()\n L.append(tmp_L)\n R.append(tmp_R)\n\nleft = max(L)\nright = min(R)\n\nif right - left < 0:\n print(0)\nelse:\n print(right - left + 1)', 'N, M = map(int,input().split())\nL = []\nR = []\nfor i in rang...
['Runtime Error', 'Accepted']
['s091841414', 's649037283']
[15732.0, 11052.0]
[208.0, 302.0]
[238, 247]
p03037
u200527996
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\nL = []\nR = []\nans = 0\nfor _ in range(M):\n inp = int(input().split())\n L.append(inp[0])\n R.append(inp[1])\nfor i in range(N):\n if L[i] < i + 1 <R[i]:\n ans += 1\nprint(ans)', 'N, M = map(int, input().split())\nL = 0\nR = N\nfor _ in range(M):\n inp = input...
['Runtime Error', 'Accepted']
['s932161829', 's108511680']
[3064.0, 3064.0]
[17.0, 291.0]
[220, 187]
p03037
u202570162
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M=map(int,input().split())\nL=[]\nR=[]\nfor _ in range(M):\n l,r=map(int,input().split())\n L.append(l)\n R.append(r+1)\nL.sort()\nR.sort()\nans=L[-1]-R[0]\nprint(0 if ans<0 else ans)', 'N,M=map(int,input().split())\nL=[]\nR=[]\nfor _ in range(M):\n l,r=map(int,input().split())\n L.append(l)\n R.append(r+1)\n...
['Wrong Answer', 'Accepted']
['s169961264', 's961364006']
[11524.0, 11416.0]
[377.0, 378.0]
[178, 178]
p03037
u204904256
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\nl,r = 1,n\nfor i in range(m):\n L,R = map(int,input().split())\n L = max(l,L)\n R = min(r,R)\nprint(max(0,L-R+1))', 'n,m = map(int,input().split())\nl,r = 1,N\nfor i in range(m):\n L,R = map(int,input().split())\n L = max(l,L)\n R = min(r,R)\nprint(max(0,L-R+1))', 'n,m = map(int,...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s177538013', 's529086056', 's722049163', 's331143487']
[3060.0, 3060.0, 3060.0, 3060.0]
[321.0, 17.0, 321.0, 320.0]
[142, 142, 142, 142]
p03037
u209275335
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\nli,lia = [],[]\nfor i in range(m):\n a,b = map(int,input().split())\n li.append(a)\n lia.append(b)\nprint(min(min(lia)-max(li)+1),0)', 'n,m = map(int,input().split())\nli,lia = [],[]\nfor i in range(m):\n a,b = map(int,input().split())\n li.append(a)\n lia.append(b)\n...
['Runtime Error', 'Accepted']
['s367974618', 's187095910']
[10996.0, 11016.0]
[305.0, 306.0]
[167, 211]
p03037
u210827208
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m=map(int,input().split())\nL=[]\nR=[]\nfor i in range(m):\n l,r=map(int,input().split())\n L.append(l)\n R.append(r)\nif max(L)>min(R):\n print(0)\nelse:\n print(min(R)-min(L)+1)', 'n,m=map(int,input().split())\nL=[]\nR=[]\nfor i in range(m):\n l,r=map(int,input().split())\n L.append(l)\n R...
['Wrong Answer', 'Accepted']
['s788455741', 's651318633']
[11104.0, 11052.0]
[305.0, 311.0]
[186, 186]
p03037
u213401801
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m=map(int,input().split())\nfor i in range(m):\n l,r=list(map(int,input().split()))\nans=0\ndif=max(l)-min(r)\nif(diff>=0):\n ans=diff+1\nelse:\n ans=0\n', 'minlist=[]\nmaxlist=[]\n\nn,m=map(int,input().split())\nfor i in range(m):\n l,r=list(map(int,input().split()))\n minlist.append(l)\n if r>0:\n maxlis...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s111698814', 's180232237', 's482344654', 's512278526', 's525753343', 's697591352', 's680947759']
[3060.0, 11080.0, 11068.0, 3060.0, 3060.0, 11032.0, 11068.0]
[312.0, 347.0, 347.0, 311.0, 17.0, 346.0, 349.0]
[149, 246, 245, 159, 223, 246, 245]
p03037
u215132812
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split)\nList = [map(int,input().split()) for i in range(M)]\ncount = 0\n\nfor i in range(N):\n if i+1 >= List[2*i] & i+1 <= List[2*i+1]:\n count = count + 1\nprint(count)', 'N, M = map(int, input().split)\nList = [list(map(int,input().split())) for i in range(M)]\n\ncount = 0\nfor i in ran...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s093308388', 's141500783', 's524788842', 's995593691', 's174159232']
[3060.0, 3060.0, 3064.0, 3060.0, 29016.0]
[17.0, 17.0, 17.0, 17.0, 367.0]
[191, 198, 255, 212, 279]
p03037
u222509161
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['\nusing namespace std;\n\nint main()\n{\n\tint n, m;\n\tcin >> n >> m;\n\tint a = 0;\n\tint b = n;\n\tfor (int i = 0; i < m; i++){\n\t\tint l, r;\n\t\tcin >> l >> r;\n\t\ta = max(a, l);\n\t\tb = min(b, r);\n\t}\n\n\tcout << (a <= b ? b-a+1 : 0) << endl;\n}\n', 'n, m = map(int, input().split())\na, b = 0, n;\nfor i in...
['Runtime Error', 'Accepted']
['s663503517', 's320108645']
[2940.0, 3060.0]
[19.0, 324.0]
[244, 158]
p03037
u225627575
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['str = input().split()\nN = int(str[0])\nM = int(str[1])\nL = []\nR = []\nfor i in range(M):\n str = input().split()\n L.append(int(str[0]))\n R.append(int(str[1]))\n\nmini = 1\nmaxi = N\n \nfor i in range(M):\n if mini <= L[i]:\n mini = L[i]\n print("mini")\n print(mini)\n if ma...
['Wrong Answer', 'Accepted']
['s152019946', 's115700160']
[12312.0, 11020.0]
[507.0, 288.0]
[403, 365]
p03037
u226191225
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\nans = [-1,10**6]\n\nfor i in range(m):\n tmp = list(map(int,input().split()))\n ans[0] = max(ans[0],min(tmp))\n ans[1] = min(ans[1],max(tmp))\n\nprint(max(ans[1]-ans[0]+1),0)', 'n,m = map(int,input().split())\nans = [-1,10**6]\n\nfor i in range(m):\n tmp = list(map(int,inpu...
['Runtime Error', 'Accepted']
['s612662637', 's250053981']
[3060.0, 3060.0]
[411.0, 416.0]
[207, 207]
p03037
u234189749
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int,input().split())\n\nL,R= map(int,input().split())\n\nfor i in range(M):\n x,y= map(int,input().split())\n L = max(L,x)\n R = min(R,y)\n\nprint(R-L+1)', 'N, M = map(int,input().split())\n\nL,R= map(int,input().split())\n\nfor i in range(M-1):\n x,y= map(int,input().split())\n L = max(L,x)...
['Runtime Error', 'Accepted']
['s482939614', 's133322521']
[3060.0, 3060.0]
[323.0, 324.0]
[164, 181]
p03037
u235293257
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\n\nhaba = list()\nmax_L = 0\nmin_R = 10 ** 5 + 1\nfor i in range(M):\n L, R = map(int, input().split())\n haba.append([L, R])\n max_L = max(max_L, L)\n min_R = min(min_R, R)\n\nmin_haba = set(range(max_L, min_R + 1))\nids = set()\nfor L, M in haba:\n if max_L - 1 < L an...
['Wrong Answer', 'Accepted']
['s238913224', 's216248997']
[26000.0, 19600.0]
[412.0, 384.0]
[416, 243]
p03037
u244434589
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m =map(int,input().split())\na =[]*m\nb =[]*m\nfor i in range(n):\n l,r =map(int,input().split())\n a.append(l)\n b.append(r)\n\nif max(a) <=min(b):\n print(min(b)-max(a)+1)\nelse:\n print(0)\n', 'n,m =map(int,input().split())\na =[]*m\nb =[]*m\nfor i in range(m):\n l,r =ma...
['Runtime Error', 'Accepted']
['s614158005', 's923418193']
[16820.0, 16956.0]
[203.0, 207.0]
[218, 218]
p03037
u245870380
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\nli = [list(map(int, input().split())) for _ in range(M)]\n \nans = 0\nt = 0\n \nfor i in range(M): \n t = 1\n if li[0][1] < li[i][1] and i != 0:\n t = 0\n else:\n for j in range(N):\n if not li[i][0] <= j+1 <= li[i][1]:\n t = 0\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s373152829', 's996671176', 's723852614']
[27340.0, 29364.0, 10996.0]
[2109.0, 2106.0, 323.0]
[345, 329, 251]
p03037
u247211039
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M=map(int, input().split())\nL = []\nR = []\nfor i in range(M):\n l, r = input().split()\n L.append(int(l))\n R.append(r)\n\n\nx = min(R)-max(L)\n\n\nprint(0 if x <0 else x+1)', 'N,M=map(int, input().split())\nL = []\nR = []\nfor i in range(M):\n l, r = input().split()\n L.append(int(l))\n R.appen...
['Runtime Error', 'Accepted']
['s699492892', 's522425959']
[20160.0, 16844.0]
[183.0, 190.0]
[174, 179]
p03037
u247830763
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import sys\nn,m = map(int,input().split())\nls = [list(map(int,input().split())) for i in range(m)]\na = ls[0][0]\nb = ls[0][1]\nfor j in range(1,m):\n a = max(a,ls[j][0])\n b = min(b,ls[j][1])\n print(a)\n print(b)\n if b-a<0:\n print(0)\n sys.exit()\nprint(b-a+1)', 'import sys\nn,m = ma...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s268197826', 's718268446', 's820868168', 's172914147']
[28780.0, 27332.0, 27332.0, 27332.0]
[531.0, 396.0, 387.0, 385.0]
[281, 261, 261, 255]
p03037
u252828980
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\n#L = list(map(int,input().split()))\nli = [0]*n\nprint(li)\nfor i in range(m):\n a,b = (map(int,input().split()))\n print(a,b)\n for j in range(a-1,b):\n li[j] += 1\nprint(li.count(m))\n', 'n,m = map(int,input().split())\nmin_ = 0\nmax_ = 100001\nfor i in range(m):\n l...
['Wrong Answer', 'Accepted']
['s134612798', 's646751983']
[5668.0, 3060.0]
[2104.0, 386.0]
[224, 258]
p03037
u253952966
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int, input().split())\nlmax,rmin=0,n+1\nfor i in range(m):\n l,r=map(int, input().split())\n lmax=max(l,lmax)\n rmin=min(r,rmin)\nprint(max(0,lmax-rmin+1))', 'n,m = map(int, input().split())\nlmax,rmin=0,n+1\nfor i in range(m):\n l,r=map(int, input().split()\n lmax=max(l,lmax)\n rmin=min(r,rmin)\nprin...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s198137324', 's334667513', 's366298249', 's365590863']
[3060.0, 3060.0, 2940.0, 3060.0]
[333.0, 18.0, 18.0, 323.0]
[162, 161, 160, 162]
p03037
u257374434
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M = list(map(int, input().split()))\nLR = [list(map(int, input().split())) for _ in range(M)]\nleft = 0\nright = N -1 \n\nfor l,r in LR:\n left = max(left,l -1)\n right = min(right,r -1)\n\nif l > r:\n print(0)\nelse:\n print( r - l +1)\n', 'N,M = list(map(int, input().split()))\nLR = [list(map(int, ...
['Wrong Answer', 'Accepted']
['s401177130', 's803156410']
[27332.0, 27332.0]
[371.0, 377.0]
[241, 254]
p03037
u258862116
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import heapq\nN,M = map(int, input().split())\nA = list(map(int, input().split()))\nBC = []\n\nfor i in range(M):\n BC.append(list(map(int, input().split())))\n\nBC.sort(key=lambda x: x[1], reverse=True)\nA_min = min(A)\nheapq.heapify(A)\nfor i in range(M):\n for j in range(BC[i][0]):\n if BC[i][1] > min...
['Runtime Error', 'Accepted']
['s419643825', 's011451955']
[27452.0, 10996.0]
[351.0, 295.0]
[412, 242]
p03037
u261700262
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\ntable = [[int(i) for i in input().split()] for _ in range(M)]\n\nans = [table[0], table[1]]\n\nfor i in table:\n if ans[0] >= i[0] <= ans[1]:\n ans[0] = i[0]\n if ans[0] >= i[1] <= ans[1]:\n ans[1] = i[1]\n\nprint(ans[1] - ans[0] + 1)\n', 'N, M = map(int, input()....
['Runtime Error', 'Accepted']
['s777390978', 's381741186']
[21156.0, 21948.0]
[313.0, 344.0]
[278, 402]
p03037
u262084284
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
["N,M = map(int, input().split())\nL = ['']*M\nR = ['']*M\n\nfor i in range(M):\n L[i],R[i] = map(int, input().split())\n\ngate_l = max(L)\ngate_r = min(R)\nwidth = gate_l - gate_r + 1\nsum = N*width\n\n\n# if L[i]<=gate_l:\n\n# elif gate_l<L[i] and L[i]<=gate_r:\n\n# else:\n\n# break\n# \n# ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s303638633', 's720403085', 's821532783', 's361065973']
[10868.0, 12916.0, 12788.0, 10868.0]
[294.0, 289.0, 300.0, 295.0]
[565, 214, 206, 206]
p03037
u262869085
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import sys\ninput = sys.stdin.readline\nN,M = map(int,input().split())\nlr =[[int(i)for i in input().split()]for _ in range(M)]\nans =[0,N+1]\nfor LR in lr:\n if ans[0] < LR[0]:\n ans[0]=LR[0]\n if LR[1] < ans[1]:\n ans[1] =LR[1]\nprint(min(0,ans[1]-ans[0]+1))\n', 'import sys\ninput = sys.stdin.re...
['Wrong Answer', 'Accepted']
['s542636878', 's747239330']
[21148.0, 21148.0]
[176.0, 174.0]
[271, 271]
p03037
u270467412
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\n\nL = []\nR = []\nfor i in range(M):\n a, b = map(int, input().split())\n L.append(a)\n R.append(b)\n\nmin = min(L)\nmax = max(R)\n\nans = max(0, max - min + 1)\nprint(ans)', 'N, M = map(int, input().split())\n\nL = []\nR = []\nfor i in range(M):\n a, b = map(int, input().split()...
['Runtime Error', 'Accepted']
['s309460631', 's914811007']
[10996.0, 10996.0]
[295.0, 312.0]
[196, 223]
p03037
u284363684
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['# input\nN, M = map(int, input().split())\ncheck = []\nc_append = check.append\nfor i in range(1, M + 1):\n L, R = map(int, input().split())\n c_append(set(list(range(L, R + 1))))\n\n\nmastar_keys = set(list(range(1, N + 1)))\nfor k in sorted(check, key=lambda x: len(x)):\n mastar_keys = mastar_keys & check[...
['Runtime Error', 'Accepted']
['s108979773', 's697694018']
[2072180.0, 3188.0]
[2251.0, 316.0]
[385, 188]
p03037
u290187182
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
[' a, b = map(int, input().split())\n list_a = list(range(1, a, 1))\n for num in range(b):\n c, d = map(int, input().split())\n for item in list_a:\n if item <= c and item >= d:\n list_a.remove(item)\n \n print(len(list_a))', "if __name__ == '__main__'...
['Runtime Error', 'Accepted']
['s420973302', 's123390449']
[2940.0, 3316.0]
[17.0, 286.0]
[281, 313]
p03037
u294520705
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\nmaxL = 0\nminM = N\nfor x in range(M):\n l, m = map(int, input().split())\n maxL = max(maxL, l)\n minM = min(minM, m)\n\nprint(min(minM - maxL + 1, 0))', '10 3\n3 6\n5 7\n6 9', 'N, M = map(int, input().split())\nmaxL = 0\nminM = N\nfor x in range(M):\n l, m = map(int, inp...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s438972267', 's813111860', 's512745867']
[3188.0, 3068.0, 3060.0]
[327.0, 18.0, 321.0]
[186, 16, 186]
p03037
u296518383
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M=map(int,input().split())\nL=[0]*M\nR=[0]*M\nfor i in range(M):\n L[i],R[i]=map(int,input().split())\n\nprint(0 if min(R)>max(L) else min(R)-max(L)+1)\n ', 'N,M=map(int,input().split())\nL=[0]*M\nR=[0]*M\nfor i in range(M):\n L[i],R[i]=map(int,input().split())\n\nprint(0 if min(R)<max(L) else min(R)-max(L)+1)']
['Wrong Answer', 'Accepted']
['s050895123', 's605567025']
[10868.0, 10868.0]
[286.0, 299.0]
[151, 148]
p03037
u299840026
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = [int(i) for i in input().split()]\n\nl =[]\nr =[]\nfor i in range(m):\n l1, r1 = [int(i) for i in input().split()]\n l.append(l1)\n r.append(r1)\n\nmin = 1\nmax = n\nfor i in range(m):\n temp = l[i]\n min = min if min>temp else temp\n temp = r[i]\n max = max if max<temp else temp\n #prin...
['Wrong Answer', 'Accepted']
['s194953927', 's578198062']
[11056.0, 11120.0]
[341.0, 351.0]
[391, 392]
p03037
u299869545
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\n\nlmax = -1\nrmin = n * 100\nfor i in range(m):\n l, r = map(int, input().split())\n lmax = max(l, lmax)\n rmin = min(r, rmin)\n\nprint(max(lmax - rmin + 1, 0))', 'n, m = map(int, input().split())\n\nlmax = -1\nrmin = n * 100\nfor i in range(m):\n l, r = map(int, input()....
['Wrong Answer', 'Accepted']
['s427320816', 's350911749']
[3060.0, 3060.0]
[321.0, 330.0]
[194, 194]
p03037
u302292660
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\nL = []\nR = []\nfor i in range(m):\n l,r = map(int,input().split())\n L.append(l)\n R.append(r)\n\nans = max(L)-min(R)+1\nprint(ans if ans >0 else "0")', 'n,m = map(int,input().split())\ns = {}\nfor i in range(m):\n l,r = map(int,input().split())\n for j in range(l,r+1):\n l = ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s554203706', 's747289278', 's783953244', 's994138949']
[10996.0, 3060.0, 10996.0, 11020.0]
[306.0, 60.0, 293.0, 297.0]
[177, 195, 175, 177]
p03037
u306070611
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\nlist = []\nfor i in range(M):\n L, R = map(int, input().split())\n list.append([L,R])\nanslist = [list[0][0],list[0][1]]\narukadouka = True\nif M = 1:\n arukadouka = False\ncnt = 0\nfor i in range(1,M):\n if arukadouka == True:\n if anslist[0] > list[i][1]:\n ...
['Runtime Error', 'Accepted']
['s609013201', 's009744214']
[2940.0, 19616.0]
[17.0, 408.0]
[927, 1060]
p03037
u306412379
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\n\n\nL, R = map(int, input().split())\nar = [i for i in range(L, R+1)]\nfor i in range(M-1):\n L, R = map(int, input.split())\n if ar[-1] < L or ar[0] > R:\n break\n else:\n if ar[0] < L < ar[-1]:\n ar = [x for x in range(L, ar[-1]+1)]\n el...
['Runtime Error', 'Accepted']
['s375911936', 's602768516']
[12952.0, 9148.0]
[32.0, 203.0]
[388, 330]
p03037
u309141201
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\ninfo = []\nfor _ in range(m):\n l, r = map(int, input().split())\n info.append([l, r])\nprint(info)\nL = 0\nR = 10**5 + 1\nfor l, r in info:\n Lb, Rb = True, True\n if l < L:\n Lb = False\n elif L <= l <= R:\n L = l\n else:\n print(0)\n e...
['Wrong Answer', 'Accepted']
['s749142717', 's466530110']
[24200.0, 19600.0]
[385.0, 353.0]
[496, 512]
p03037
u312078744
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['from collections import Counter\nimport numpy as np\n\nn, m = map(int, input().split())\ntar = [0] * (1 + 10 ** 5)\ntar = np.array(tar)\n\nfor i in range(m):\n l, r = map(int, input().split())\n tar[l:r + 1] += 1\n print(tar[:10])\n\n\n# print(tar[0:5])\ncount = Counter(tar)\nans = count[m]\nprint(ans)\n\n',...
['Wrong Answer', 'Accepted']
['s474641623', 's029710364']
[15408.0, 37896.0]
[2109.0, 511.0]
[556, 820]
p03037
u316322317
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m=map(int,input().split())\ncount=0\nfor j in range(1,n+1):\n for i in range(m):\n l,r=map(int,input().split())\n if l<=j:\n if j<=r:\n count+=1\nprint(count)', 'n,m=map(int,input().split())\ncount=0\nx=[]\nfor i in range(m):\n l,r=map(int,input().split())\n x.append([l,r])\n \nfor j in range(...
['Runtime Error', 'Runtime Error', 'Accepted']
['s069242710', 's391698179', 's522745255']
[3060.0, 19604.0, 10996.0]
[288.0, 322.0, 299.0]
[171, 233, 221]
p03037
u316401642
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = list(map(int, input().split()))\nl, r = [], []\n\nfor _ in range(m):\n a, b = list(map(int, input().split()))\n l.append(a)\n r.append(b)\n\nprint(max(l) - min(r) + 1)', 'n, m = list(map(int, input().split()))\nl, r = [], []\n\nfor _ in range(m):\n a, b = list(map(int, input().split()))\n l.appe...
['Wrong Answer', 'Accepted']
['s709016759', 's272347914']
[11048.0, 11048.0]
[336.0, 342.0]
[175, 220]
p03037
u321605735
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['r=input().split()\nN=int(r[0])\nM=int(r[1])\ndata=[[int(s) for s in input().split()] for i in range(M)]\nleft=[]\nright=[]\nfor i in range(M):\n left.append(data[i][0])\n right.append(data[i][1])\nif min(right)-max(left)+1=<0:\n print(0)\nelse:\n print(min(right)-max(left)+1)', 'r=input().split()\nN=int(r...
['Runtime Error', 'Accepted']
['s200901288', 's356946742']
[8868.0, 27128.0]
[25.0, 228.0]
[276, 276]
p03037
u323045245
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\nl = [0]*m\nr = [0]*m\nfor i in range(m):\n p, q = map(int, input().split())\n l[i], r[i] = map(int, input().split())\nprint(max(min[r] - max[l] + 1, 0))', 'n, m = map(int, input().split())\ncnt = [0]*(n+1)\nfor i in range(n):\n l, r = map(int, input().split())\n for j in range(l,...
['Runtime Error', 'Runtime Error', 'Accepted']
['s629595037', 's873066989', 's844861001']
[7796.0, 5364.0, 10868.0]
[283.0, 2104.0, 285.0]
[182, 169, 148]
p03037
u327162583
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M = (int(i) for i in input().split())\ne = [[int(i) for i in input().split()] for i in range(M)]\nhoge = set()\n\nzenbu = {int(i + 1) for i in range(N)}\n\nfor i in e:\n konkaino = {int(i) for i in range(e[0],e[1] + 1)}\n zenbu = zenbu & konkaino\n\n\nprint(len(zenbu))', 'N,M = (int(i) for i in input().split(...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s103386029', 's637504886', 's988407052']
[30084.0, 21156.0, 21156.0]
[333.0, 321.0, 316.0]
[266, 275, 279]
p03037
u327532412
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import sys\ndef input():\n return sys.stdin.readline()\ndef main():\n N, M = map(int, input().split())\n dict = {}\n for _ in range(M):\n L, R = map(int, input().split())\n for x in range(L, R+1):\n if x in dict:\n dict[x] += 1\n else:\n di...
['Wrong Answer', 'Accepted']
['s296339307', 's611588457']
[15084.0, 3060.0]
[2104.0, 332.0]
[377, 157]
p03037
u328510800
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\nleft = 0 \nright = 10 ** 6 \nfor _ in range(m):\n l, r = map(int, input().split())\n left = max(left, l)\n right = min(right, r)\n right = r\n\nprint(r-l+1 if l <= r else 0)', 'n, m = map(int, input().split())\nleft = 0 \nright = 10 ** 6 \nfor _ in range(m):\n l, r = map(int, ...
['Runtime Error', 'Accepted']
['s196852103', 's436053299']
[2940.0, 3060.0]
[17.0, 317.0]
[286, 286]
p03037
u329058683
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m=map(int,input().split())\nl=0\nr=10000000000000\nfor i in range(m):\n a,b=map(int,input().split())\n l=max(l,a)\n r=min(r,b)\nprint(l)\nprint(r)\nprint(r-l+1)', 'n,m=map(int,input().split())\nl=0\nr=10000000000000\nfor i in range(m):\n a,b=map(int,input().split())\n l=max(l,a)\n r=min(r,b)\nif r-l+1 >0:\n ...
['Wrong Answer', 'Accepted']
['s434681980', 's512536355']
[3064.0, 3060.0]
[323.0, 321.0]
[156, 170]
p03037
u329455846
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N ,M = map(int , input().split())\nmax_L = []\nmin_R = []\ngate_number = [i for i in range(1, M+1)]\nfor j in range(M):\n L , M = map(int,input().split())\n max_L.append(L)\n min_R.append(M)\nprint(len([s for s in range(max(max_L) , min(min_R))]))', 'N ,M = map(int , input().split())\nmax_L = []\nmin_R = []\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s610887865', 's751726789', 's587074653']
[16380.0, 16392.0, 16392.0]
[308.0, 302.0, 310.0]
[248, 254, 252]
p03037
u330799501
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['#k = int(input())\n#s = input()\n#a, b = map(int, input().split())\n#s, t = map(str, input().split())\n#l = list(map(int, input().split()))\n\n#a = [input() for _ in range(n)]\n\nn,m = map(int, input().split())\nl = [list(map(int,input().split())) for i in range(m)]\n\n\n\n\n\nup = 10**5+1\nlo = 0\n\nfor i in range(m...
['Wrong Answer', 'Accepted']
['s949921915', 's864219796']
[27108.0, 27140.0]
[237.0, 236.0]
[846, 923]
p03037
u333404917
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\na = sorted([int(x) for x in input().split()])\nfor _ in range(m):\n b, c = map(int, input().split())\n if a[0] < c:\n for i in range(b):\n if a[i] < c:\n a[i] = c\n a.sort()\nprint(sum(a))', 'n, m = map(int, input().split())\n\ngate_cond...
['Runtime Error', 'Accepted']
['s989902749', 's205112814']
[3060.0, 22048.0]
[271.0, 326.0]
[260, 290]
p03037
u334222621
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\nleft=0\nright=0\n\nfor i in range(N):\n L, R = map(int, input().split())\n if L > left:\n left = L\n if R < left:\n right = R\n\nif left <= right:\n print(right-left+1)\nelse:\n print(0)', 'N, M = map(int, input().split())\nleft=0\nright=N\n\nfor i in ran...
['Runtime Error', 'Runtime Error', 'Accepted']
['s048037325', 's235231422', 's966094345']
[3060.0, 3060.0, 3188.0]
[284.0, 283.0, 284.0]
[235, 236, 236]
p03037
u337080722
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\nlrs = [list(map(int, input().split())) for _ in range(m)]\n\nl_max = 1\nr_min = n\nfor l, r in lrs:\n l_max = max(l, l_max)\n r_min = min(r, r_min)\n\nprint(min(r_min - l_max + 1), 0)\n', 'n, m = map(int, input().split())\nlrs = [list(map(int, input().split())) for _ in range(m...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s137100370', 's583520753', 's668597956']
[27332.0, 27332.0, 27332.0]
[389.0, 368.0, 367.0]
[215, 215, 215]
p03037
u339550873
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN,M = [int(x) for x in input().split()]\nLlist =[]\nRlist =[]\nfor i in range (M):\n L,R = [int(x) for x in input().split()]\n Llist.append(L)\n Rlist.append(R)\n \nlmax = max(Llist)\nRmax = min(Rlist)\n\nif lmax >= Rmax:\n print(0)\nelse:\n print(Rmax-...
['Wrong Answer', 'Accepted']
['s259059477', 's539409583']
[10996.0, 10996.0]
[314.0, 326.0]
[311, 310]
p03037
u340781749
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import sys\n\nn, m = list(map(int, input().split()))\nl, r = 1, n\nfor line in sys.stdin:\n a, b = list(map(int, input().split()))\n l = max(a, l)\n r = min(b, r)\nprint(max(0, r - l + 1))\n', 'import sys\n\nn, m = list(map(int, input().split()))\nl, r = 1, n\nfor line in sys.stdin:\n a, b = list(map(int,...
['Runtime Error', 'Accepted']
['s678393023', 's403249301']
[3060.0, 3060.0]
[184.0, 183.0]
[190, 187]
p03037
u345483150
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m=map(int, input().split())\nl, r=list(map(int, input().split()))\nl.sort()\nr.sort()\nif max(l) < min(r):\n print(0)\nelse:\n print(min(r) - max(l) + 1)', 'n,m=map(int,input().split())\nleft=0\nright=10**5\nfor i in range(m):\n l,r=map(int,input().split())\n left=max(left,l)\n right=min(right,r)\nprint(right...
['Runtime Error', 'Accepted']
['s240286052', 's616945720']
[3060.0, 3188.0]
[17.0, 318.0]
[151, 182]
p03037
u346395915
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\n\nleft_max = -1\nright_min = n+1\n\nfor i in range(m):\n s,t = map(int,input().split())\n left_max = max(left_max,s)\n right_min = min(right_min, t)\n \nprint(0, right_min - left_max +1)', 'n,m = map(int,input().split())\n\nleft_max = -1\nright_min = n+1\n\nfor i in range(m...
['Wrong Answer', 'Accepted']
['s630758996', 's685971093']
[3060.0, 3060.0]
[321.0, 315.0]
[220, 225]
p03037
u347640436
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\nx = 0\ny = n - 1\nfor _ in range(m):\n l, r = map(int, input().split())\n x = max(x, l - 1)\n y = min(y, r - 1)\n print(x, y)\nprint(max(y - x + 1, 0))\n', '\nN, M = map(int, input().split())\n\ncs = [0] * N\nfor _ in range(M):\n L, R = map(int, input().split())\n cs[L - 1]...
['Wrong Answer', 'Accepted']
['s988489495', 's875196334']
[4212.0, 6900.0]
[896.0, 342.0]
[182, 233]
p03037
u347912669
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['# C - Prison\n\n\nn, m = map(int, input().split())\ngates = [list(map(int, input().split())) for _ in range(m)]\n# gates = []\n\n# gates.append(list(map(int, input().split())))\n\n\nscope = [1, n]\n\nfor element in gates:\n \n\n if element[0] > scope[0]:\n scope[0] = element[0]\n\n if element[1] <...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s802068055', 's950289017', 's523423391']
[27348.0, 27352.0, 27352.0]
[347.0, 385.0, 391.0]
[812, 1060, 1045]
p03037
u351264758
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\n\nL = 1\nR = 10**5\n\nfor i in range(m):\n l, r = map(int, input().split())\n if L <= l <= R:\n L = l\n if L <= r <= R:\n R = r\n if R < l or r < L:\n ans = 0\n break\n\nif ans != 0:\n ans = R - L + 1\n\nprint(ans)', 'n, m = map(int, input()...
['Runtime Error', 'Accepted']
['s944110448', 's441192018']
[3188.0, 3064.0]
[311.0, 303.0]
[273, 281]
p03037
u354916249
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M=map(int, input().split())\n\nmax = 0\nmin = 0\n\nfor _ in range(M):\n L,R = map(int, input().split())\n\n if min < L:\n min = L\n elif min == 0:\n min = L\n\n if max > R:\n max = R\n elif max =+ 0:\n max = R\n\nans = max - min + 1\n\nprint(ans)\n', 'N,M=map(int, input()....
['Runtime Error', 'Runtime Error', 'Accepted']
['s422437663', 's736785214', 's876168825']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 289.0]
[272, 271, 298]
p03037
u359030261
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M = map(int,input().split())\ngate_list = []\nwhile True:\n try:\n gate_list.append(list(map(int,input().split())))\n except:\n break\n\nleft_ = []\nright_ = []\n\nfor i in gate_list:\n left_.append(i[0])\n right_.append(i[1])\n\nmin_ = max(left_)\nmax_ = min(right_)', 'N,M = map(int,input().split())\ngat...
['Wrong Answer', 'Accepted']
['s234270689', 's735679439']
[29012.0, 29000.0]
[367.0, 380.0]
[263, 360]
p03037
u362563655
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\nL = list(list(map(int,input().split())) for i in range(M))\nl = 0\nr = N\nfor i in range(M):\n l = max(l,L[i][0])\n r = min(r,L[i][1])\nprint(l-r+1)', 'N, M = map(int, input().split())\nL = list(list(map(int,input().split())) for i in range(M))\nl = 1\nr = N\nfor i in range(M):...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s266185512', 's697926203', 's802756789']
[27332.0, 27332.0, 27332.0]
[390.0, 393.0, 406.0]
[181, 188, 189]
p03037
u369338402
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m=map(int,input().split())\nlr=[]\nresult=0\nfor i in range(m):\n lr.append(input().split())\nfor k in range(1,n+1):\n for h in range(m):\n if int(k)<=int(lr[h][0]) or int(k)>=int(lr[h][1]):\n break\n result+=1\nprint(result)', 'n,m=map(int,input().split())\nl=0\nr=n\nlr=[]\nfor i in range(m):\n lr.ap...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s035785766', 's557972938', 's734334476', 's535502754']
[32156.0, 34072.0, 32148.0, 32152.0]
[2106.0, 395.0, 2106.0, 277.0]
[230, 195, 252, 217]
p03037
u370429695
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\nli = [list(map(int,input().split())) for _ in range(m)]\nmaxl = max(li, key=lambda x:x[0])[0]\nminr = min(li, key=lambda x:x[1])[1]\nif maxl <= minr:\n print(r-l+1)\nelse:\n print(0)', 'n,m = map(int,input().split())\nli = [list(map(int,input().split())) for _ in range(m)]\nmaxl ...
['Runtime Error', 'Accepted']
['s878699238', 's806083518']
[27356.0, 27348.0]
[354.0, 338.0]
[213, 219]
p03037
u371190543
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['100000 1\n1 100000\n', 'n, m = map(int, input().split())\nl, r = 0, 100001\nfor i in range(m):\n x, y = map(int, input().split())\n if l <= x:\n l = x\n if r >= y:\n r = y\nprint(len([x for x in range(l, r+1)]))']
['Runtime Error', 'Accepted']
['s781589237', 's573794929']
[2940.0, 7092.0]
[17.0, 281.0]
[18, 202]
p03037
u373047809
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['_, __, *d = map(int, open(0).read().split())\nprint(max(min(d[1::2]) - max(d[::2]) + 1), 0)', '_, __, *d = map(int, open(0).read().split())\nprint(max(min(d[1::2]) - max(d[::2]) + 1, 0))']
['Runtime Error', 'Accepted']
['s744595176', 's892053265']
[25076.0, 25076.0]
[68.0, 67.0]
[90, 90]
p03037
u374584942
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import heapq \nhq_left = []\nhq_right = []\n\n\nlistA=[] \nN,M= map(int,input().split())\n\nfor i in range(M):\n listA.append(list(map(int,input().split())))\n\n\ncandidate_list = [i for i in range(1,N+1)]\n\nfor i in range(M):\n hq_left.append(listA[i][0])\n hq_right.append(listA[i][1...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s118719571', 's849105744', 's700795396']
[33132.0, 33132.0, 33192.0]
[404.0, 415.0, 385.0]
[506, 523, 486]
p03037
u374829922
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['# -*- coding: utf-8 -*-\nl = [0] \nr = [0]\nall_gate_clear = 1\n\n\n#numcard\nN = input()\ncard_count = range(N+1)\n\nM = input()\n\nfor i in range(M):\n l_temp,r_temp = map(int, input().split())\nl.append(l_temp)\nr.append(r_temp)\n \nfor gate_num in range(1,M+1):\n \n for card in range(1,N+1):\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s115013719', 's245905722', 's316706581', 's347373666', 's547223719', 's595054184', 's714977442', 's835527774', 's844083448', 's885050606', 's988759731', 's251837205']
[3064.0, 10992.0, 10868.0, 12916.0, 3064.0, 3064.0, 3064.0, 10992.0, 10992.0, 10868.0, 11032.0, 10868.0]
[18.0, 2104.0, 2104.0, 2104.0, 2104.0, 18.0, 18.0, 2104.0, 2105.0, 2104.0, 2104.0, 303.0]
[693, 715, 290, 292, 703, 645, 692, 723, 711, 290, 717, 308]
p03037
u375282392
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,(input().split())\n \nl=[]\nfor i in range(m):\n\tl,r = map(int,input().split())\n li = range(l,r)\n\nfor i in li:\n\tprint(i)\n\n\t', 'n,m = map(int,input().split())\n\nli=[]\nfor i in range(m):\n\tl,r = map(int,input().split())\n\tli.append(list(range(l,r+1)))\n\nfor i in li:\n\tprint(i)',...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s177972902', 's189880694', 's759568640']
[2940.0, 1663332.0, 10996.0]
[17.0, 2289.0, 299.0]
[145, 143, 164]
p03037
u375616706
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['from itertools import accumurate\nN,M=map(int,input().split())\nL = [0]*(N+1)\nfor _ in range(M):\n l,r = map(lambda x:int(x)-1,input().split())\n L[l]+=1\n L[r+1]+=1\n\nL = list(accumurate(L))\nprint(L.count(M)) ', 'from itertools import accumulate\nN,M=map(int,input().split())\nL = [0]*(N+1)\nfor _ in range(M):\...
['Runtime Error', 'Accepted']
['s479249938', 's183765424']
[3064.0, 8116.0]
[18.0, 377.0]
[207, 206]
p03037
u376380063
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\nl = []\nr = []\n\nfor i in range(m):\n a,b = map(int,input().split())\n l.append(a)\n r.append(b)\n\n\nif min(r) < max(l):\n print(min(r) - max(l) + 1)\nelse:\n print(0)', 'n,m = map(int,input().split())\nl = []\nr = []\n\nfor i in range(m):\n a,b = map(int,input().sp...
['Wrong Answer', 'Accepted']
['s845415855', 's292750855']
[11084.0, 10996.0]
[302.0, 325.0]
[203, 204]
p03037
u376904820
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import sys\n\nn,m = input().split()\nn,m = int(n), int(m)\n\nl, r = [],[]\n\ncount = 0\n\nfor i in range(1,m) :\n l[i], r[i] = input().split()\n l[i], r[i] = int(l[i]), int( r[i] )\n\n if l[i] <= m and m <= r[i] :\n count = count + m - l[i] \n', 'import sys\n\nn,m = input().split()\nn,m = int(n), int...
['Runtime Error', 'Accepted']
['s510993133', 's114524364']
[3060.0, 16584.0]
[18.0, 308.0]
[245, 459]
p03037
u377989038
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['# -*- coding: utf-8 -*-\n \nz = []\nid, gate = map(int, input().split())\nfor i in range(gate)\n a = [list(map(int,input().split()))]\n z.append(a)\nb = []\n\nfor i in range(gate)\n c = range(a[i, 0], a[i, 1])\n b.extend(c)\n\nd = range(id)\n\nd = set(d)\nb = set(b)\n\nlist = list(b&d)\nprint(len(list...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s460855061', 's779610696', 's868393290', 's459278790']
[2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 326.0]
[301, 278, 274, 190]
p03037
u379716238
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import sys\n\nN, M = map(int,input().split())\nL = [0] * M\nR = [0] * M\nfor i in range(M):\n L[i], R[i] = map(int, input().split())\nif M == 1:\n print(N)\nelse:\n G = []\n for i in range(M):\n G1 = []\n for j in range(len(L[i:])):\n G1.append(L[i:][j])\n for k in range(le...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s100998874', 's405921951', 's766184705', 's300524229']
[13668.0, 13668.0, 13668.0, 10868.0]
[2104.0, 2104.0, 2104.0, 293.0]
[571, 585, 513, 189]
p03037
u382251756
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\nl_max = 1\nr_min = N + 1\nfor _ in range(M):\n L, R = map(int, input().split())\n if l_max < L:\n l_max = L\n if r_min > R:\n r_min = R\nif r_min < l_max:\n print(r_min - l_max + 1)\nelse:\n print(0)', 'N, M = map(int, input().split())\nl_max = 1\nr_min =...
['Wrong Answer', 'Accepted']
['s801364609', 's699349651']
[3060.0, 3060.0]
[280.0, 289.0]
[250, 254]
p03037
u382431597
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = list(map(int, input().split()))\nl_max = 1\nr_min = n\nfor i in range(m):\n l,r = list(map(int, input().split()))\n if l > l_max:\n l_max = l\n if r < r_min:\n r_min = r\nprint(r-l+1 if r>=l else 0)', 'n,m = list(map(int, input().split()))\nl_max = 1\nr_min = n\nfor i in range(m):\n l,...
['Wrong Answer', 'Accepted']
['s981047387', 's647430363']
[3060.0, 3060.0]
[330.0, 323.0]
[218, 234]
p03037
u382905693
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import numpy as np\nfrom sys import stdin\n\ndef main():\n nm = [int(x) for x in stdin.readline().rstrip().split()]\n gate = np.zeros([nm[1], 2], dtype=int)\n \n for i in range(nm[1]):\n g = [int(x) for x in stdin.readline().rstrip().split()]\n gate[i] = g\n \n l_max = np.max(gate[:, 0...
['Wrong Answer', 'Accepted']
['s238793235', 's541378946']
[14004.0, 14472.0]
[514.0, 520.0]
[407, 451]
p03037
u384031061
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = list(map(int, input().split()))\nmn = 0\nmx = N\nf = False\nfor i in range(M):\n tmn, tmx = list(map(int, input().split()))\n if mn < tmn < mx:\n mn = tmn\n else:\n f = True\n break\n if mn < tmx < mx:\n mx = tmx\n else:\n f = True\n break\nif f:\n pr...
['Wrong Answer', 'Accepted']
['s744766012', 's964250964']
[3060.0, 3188.0]
[17.0, 322.0]
[337, 292]
p03037
u396890425
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M=map(int,input().split())\nKey=[0]*(N+1)\nfor i in range(M):\n L,R = map(int,input().split())\n Key[L-1] += 1\n Key[R] -= 1\nfor i in range(N):\n Key[i+1] += Key[i] \nprint(Key)\nprint(Key.count(M))', 'N,M=map(int,input().split())\nKey=[0]*(N+1)\nfor i in range(M):\n L,R = map(int,input().split())\n...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s834138952', 's954101029', 's379560969']
[9328.0, 9328.0, 6900.0]
[344.0, 345.0, 337.0]
[215, 216, 204]
p03037
u398642144
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
["import sys\nargs = sys.stdin.readlines()\nn, m = map(int, args[0].split(' '))\ngates = []\nfor gate in args[1:]:\n l, r = map(int, gate.split(' '))\n gates.append((l, r))\n \nids = gates[0]\nfor gate in gates[1:]:\n l, r = gate\n ids = [x for x in ids in range(l, r+1)]\n \nprint(len(ids))\n", "import sys\nargs ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s336512021', 's462006340', 's578437560', 's848439636', 's458653535']
[24468.0, 2940.0, 24468.0, 25488.0, 11028.0]
[148.0, 17.0, 271.0, 164.0, 129.0]
[283, 283, 288, 275, 266]
p03037
u398846051
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\nl = 0\nr = N + 1\nfor _ in range(M):\n ll, rr = map(int, input().split())\n l = max(l, ll)\n r = min(r, rr)\nprint(max(0, r - l))', 'N, M = map(int, input().split())\nl = 0\nr = N + 1\nfor _ in range(M):\n ll, rr = map(int, input().split())\n l = max(l, ll)\n r = min(r, rr)\npr...
['Wrong Answer', 'Accepted']
['s193300379', 's026286858']
[3060.0, 3060.0]
[328.0, 322.0]
[159, 163]
p03037
u400738660
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import sys\ninput = sys.stdin.readline\nn,m = input().split()\nn = int(n)\nm = int(m)\nl = 0\nr = n+1\na = input().split()\nfor i in range(m):\n l2,r2 = input().split()\n l2 = int(l2)\n r2 = int(r2)\n if l2 > l:\n l = l2\n if r2 < r:\n r = r2\nif (r - l + 1) >= 0:\n print(r-l+1)\nelse:...
['Runtime Error', 'Accepted']
['s887744937', 's937867586']
[3064.0, 3064.0]
[127.0, 121.0]
[315, 295]
p03037
u403551852
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\ngates = [list(map(int,input().split())) for _ in range(m)]\nl = []\nr = []\nfor gate in gates:\n l.append(gate[0])\n r.append(gate[1])\nans = min(r)+1 - max(l)\n', 'n,m = map(int,input().split())\ngates = [list(map(int,input().split())) for _ in range(m)]\nl = []\nr = []\nfor gat...
['Wrong Answer', 'Accepted']
['s042048954', 's058199800']
[29088.0, 29088.0]
[368.0, 357.0]
[191, 219]
p03037
u409757418
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\nans = 0\nl_max = 0\nr_min = 0\nfor i in range(1,m+1):\n l, r = map(int, input().split())\n if r < r_min:\n r_min = r\n if l_max > l:\n l_max = l\nfor i in range(1, n+1):\n if i > l_max and i < r_min:\n ans += 1\nprint(ans)\n\n', 'n, m = map(int, input().split())\nans = 0...
['Wrong Answer', 'Accepted']
['s601820307', 's012855691']
[3060.0, 3060.0]
[291.0, 288.0]
[258, 260]
p03037
u416758623
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['import numpy as np\nn,m = map(int, input().split())\nls = []\nfor i in range(m):\n l,r = map(int, input().split())\n tmp = list(range(l,r+1))\n ls.append(tmp)\nbinary = [0] * n\n\nfor i in ls:\n for j in i:\n binary[j] += 1\nprint(binary.count(m)) ', 'import numpy as np\nn,m = map(int, input().spl...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s234987506', 's702247730', 's922312885', 's597565547']
[1639320.0, 1686280.0, 1844324.0, 8948.0]
[2293.0, 2295.0, 2296.0, 289.0]
[256, 270, 289, 229]
p03037
u428891594
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['#!/usr/bin/env python3\n\ndef main():\n N, M = map(int, input().split())\n Card = [[] for i in range(M)]\n Diff = [i for i in range(1, N + 1)]\n\n for i in range(0, M):\n L, R = map(int, input().split())\n tmp = []\n for j in range(L, R + 1):\n if j in Diff:\n ...
['Wrong Answer', 'Accepted']
['s351527852', 's849336630']
[14896.0, 11016.0]
[2104.0, 290.0]
[374, 258]
p03037
u433532588
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['cannot understand the q', '\n\nimport sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n##############################\n\nN, M = map(int, input().split())\nL = [0] * M\nR = [0] * M\nfor i in range(M):\n l, r = map(int, input().split())\n L[i] = l\n R[i] = r\n\nleft = max(L)\nright = min(R)\n\nif...
['Runtime Error', 'Accepted']
['s351633922', 's498145188']
[2940.0, 10868.0]
[20.0, 147.0]
[23, 333]
p03037
u434872492
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int,input().split())\nL = [0] * M\nR = [0] * M\nfor i in range(M):\n L[i], R[i] = map(int,input().split())\nans = 0\nA = [0] * N\nfor i in range(M):\n A[L[i]:R[i]+1] += 1\nfor i in range(N):\n if A[i] == M:\n ans += 1\nprint(ans)', 'N, M = map(int,input().split())\nL = [0] * M\nR = [0] * M\...
['Runtime Error', 'Accepted']
['s258118839', 's798687880']
[12276.0, 11636.0]
[296.0, 290.0]
[244, 242]
p03037
u439063038
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\n\nl_max = 1\nr_min = N\nfor _ in range(M):\n l, r = map(int, input().split())\n l_max = max(l_max, l)\n r_min = min(r_min, r)\n\nif r_min > l_max:\n print(0)\nelse:\n print(r_min-l_max+1)', 'N, M = map(int, input().split())\n\nl_max = 1\nr_min = N\nfor _ in range(M):\n...
['Wrong Answer', 'Accepted']
['s467188924', 's795838908']
[9220.0, 9184.0]
[219.0, 212.0]
[224, 224]
p03037
u439312138
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M = map(int,input().split())\nL_list = []\nR_list = []\n\nfor i in range(M):\n L,R = map(int,input().split())\n L_list.append(L)\n R_list.append(R)\n \nif max(R_list) >= max(L_list):\n print(max(R_list) - max(L_list) + 1)\nelse:\n print(0)', 'N,M = map(int,input().split())\nlist = []\n\nfor i in range(M):\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s241723546', 's814000229', 's848884491']
[10996.0, 24344.0, 10996.0]
[302.0, 2105.0, 305.0]
[236, 226, 234]
p03037
u440129511
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m=map(int,input().split())\nab=[map(int,input().split()) for _ in range(m)]\nb=min(ab[i][1] for i in range(m))\na=max(ab[i][0] for i in range(m))\nprint(b-a+1)', 'n,m=map(int,input().split())\nab=[list(map(int,input().split())) for _ in range(m)]\nb=min(ab[i][1] for i in range(m))\na=max(ab[i][0] for i in range(m))...
['Runtime Error', 'Accepted']
['s534148452', 's502027765']
[48784.0, 27364.0]
[369.0, 340.0]
[157, 188]
p03037
u442877951
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M = map(int,input().split())\nL = list(map(int,input().split()))\nR = list(map(int,input().split()))\nL.sort()\nR.sort()\ncount = 0\nfor i in range(1,N+1):\n if i >= L[-1] and i <= R[0]:\n count += 1\nprint(count)', 'N,M = map(int,input().split())\nL = []\nR = []\nans = 0\nfor _ in range(M):\n l, r = map(int, ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s165029825', 's189282547', 's360879698', 's508172975', 's741660421', 's809517765', 's870226129', 's947235206', 's987273104', 's265888098']
[3060.0, 11008.0, 27336.0, 3060.0, 3060.0, 27340.0, 27332.0, 10996.0, 29348.0, 10996.0]
[30.0, 301.0, 321.0, 16.0, 267.0, 2105.0, 312.0, 2104.0, 2106.0, 303.0]
[210, 178, 178, 145, 174, 189, 250, 215, 188, 164]
p03037
u443170850
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split(" "))\nmin_l = 1\nmax_r = N\n\nfor m in range(M):\n l, r = map(int, input().split(" "))\n if l > min_l:\n min_l = l\n if r < max_r:\n max_r = r\n print(min_l, max_r)\nprint((max_r-min_l)+1)', 'N, M = map(int, input().split(" "))\nmin_l = 1\nmax_r = N\n\nfor m in...
['Wrong Answer', 'Accepted']
['s651852138', 's998091169']
[4212.0, 3060.0]
[1097.0, 277.0]
[234, 247]
p03037
u452955775
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['#n=int(input())\n#s,t=input().split()\nn,m = map(int, input().split())\n#l=list(map(int, input().split()))\nl=[0]*100005\nr=[1000005]*100005\nz=1000010\nfor i in range(m):\n l[i],r[i]=map(int,input().split()) \nmi=max(l)\nma=min(r)\n\n\n\nif mi>ma:\n print(0)\nelse\n print(ma-mi+1)', '#n=int(input())\n#s,t=in...
['Runtime Error', 'Accepted']
['s281500521', 's221926027']
[8964.0, 16652.0]
[27.0, 189.0]
[273, 274]
p03037
u453623947
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m = map(int,input().split())\nlr = [[map(int,input().split())] for i in range(m)]\n\nmax = 0\nmin = n+1\nfor i in range(m):\n if lr[i][0] > max :\n max = lr[i][0]\n if lr[i][1] < min :\n min = lr[i][1]\n\nprint(min-max+1)\n', 'n,m = map(int,input().split())\nlr = [list(map(int,input().split())) ...
['Runtime Error', 'Accepted']
['s368316574', 's541800325']
[60484.0, 27056.0]
[379.0, 231.0]
[233, 278]
p03037
u456117140
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n, m = map(int, input().split())\nl_lst = list()\nfor i in range(m):\n l_lst.append(input().split())\n\nfor i in range(0, len(l_lst)):\n for j in range(0, len(l_lst[i])):\n l_lst[i][j] = int(l_lst[i][j])\n\ntemp_cnt = 0\ncnt = 0\nfor i in range(1, n+1):\n for j in range(0, len(l_lst)):\n if l_l...
['Wrong Answer', 'Accepted']
['s709197285', 's201276434']
[33160.0, 33836.0]
[2106.0, 372.0]
[459, 486]
p03037
u456566864
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['from sys import stdin\n\nN, G = map(int, stdin.readline().split())\ndic = {key: 0 for key in range(1, N+1)}\nfor i in range(G):\n l, r = map(int, stdin.readline().split())\n for j in range(l, r+1):\n dic[j] = -1\n \nans = 0\nfor key in dic:\n if dic[key] == 0:\n ans += 1\n \nprint(ans)', 'from sys import...
['Wrong Answer', 'Accepted']
['s707223068', 's645658060']
[15084.0, 3060.0]
[2104.0, 133.0]
[285, 302]
p03037
u456579619
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N,M = map(int, input().split())\n\nL=[0]*M\nR=[0]*M\nfor i in range(M):\n L[i], R[i] = map(int, input().split())\n\nkeys = []\n\nfor i in range(M):\n keys.append(set(range(L[i],R[i]+1)))\n \ncommon = set(range(1, N+1))\nfor i in range(M-1):\n common = common & keys[i]\n \nprint(len(common))', 'N,M = map(int, i...
['Wrong Answer', 'Accepted']
['s496561245', 's362079141']
[2710344.0, 16424.0]
[2284.0, 190.0]
[282, 143]
p03037
u457423258
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['n,m=map(int,input().split())\na=list(map(int,input().split()))\ns=[]\nl= 0\nr = n\nfor i in range(m):\n ln,rn=map(int,input().split())\n if ln>l:\n l=ln\n if rn<r:\n r=rn\nprint(rn-ln+1)', 'n,m=map(int,input().split())\n\ns=[]\nl= 0\nr = n\nfor i in range(m):\n ln,rn=map(int,input().split())...
['Runtime Error', 'Accepted']
['s134438463', 's520520831']
[3064.0, 3060.0]
[277.0, 287.0]
[198, 200]
p03037
u460737328
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['_, m = map(int, input().split())\n\nmi, mx = map(int, input().split())\nfor i in range(m-1):\n l, r = map(int, input().split())\n if mi < l <= mx:\n mi = l\n if mi <= r < mx:\n mx = r\n if mx < l or r < mi:\n flag = True\n break\n\nif flag:\n print(0)\nelse:\n print(mx - ...
['Runtime Error', 'Accepted']
['s734671620', 's653861220']
[3060.0, 3060.0]
[299.0, 289.0]
[309, 323]
p03037
u461836414
2,000
1,048,576
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
['N, M = map(int, input().split())\nL1, R1 = map(int, input().split())\nflag = 0\ndef find_key(L1,R1,L2,R2):\n if R1 < L2 or R2 < L1:\n print(0)\n flag = 1\n break\n elif:\n a = [R1,L1,R2,L2]\n a.sort()\n return(a[1],a[2])\nfor i in range(M - 1):\n L,R = map(int, input().split())\n L1,R1 = find_ke...
['Runtime Error', 'Runtime Error', 'Accepted']
['s084910037', 's221671759', 's416492510']
[2940.0, 3064.0, 3060.0]
[17.0, 17.0, 321.0]
[345, 410, 190]