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 | u703890795 | 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 = 1\nr = N\nfor i in range(M):\n L, R = map(int, input().split())\n if l < L:\n l = L\n if r < R:\n r = R\nif l > r:\n print(0)\nelse:\n print(r-l+1)', 'N, M = map(int, input().split())\nl = 1\nr = N\nfor i in range(M):\n L, R = map(int, input().split())\n if L < l:\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s584690891', 's751210915', 's837027448', 's595601623'] | [3060.0, 3060.0, 3060.0, 3060.0] | [289.0, 279.0, 282.0, 281.0] | [184, 184, 184, 184] |
p03037 | u711539583 | 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 = 1\nr = n\nfor i in range(m):\n li, ri = map(int, input().split())\n l = max(l, li)\n r = min(r, ri)\nprint(max(l - r + 1), 0)', 'n, m = map(int, input().split())\nl = 1\nr = n\nfor i in range(m):\n li, ri = map(int, input().split())\n l = max(l, li)\n r = min(r, ri)\nprint(... | ['Runtime Error', 'Accepted'] | ['s494272721', 's813115858'] | [3060.0, 3060.0] | [330.0, 327.0] | [159, 160] |
p03037 | u716649090 | 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]*N\n\nfor i in range(M):\n L, R = map(int, input().split())\n for j in range(L, R+1):\n l[j-1] += 1\n print(l)\nprint(l.count(M))', 'N, M = map(int, input().split())\nl = [0]*(N+1)\n\nfor i in range(M):\n L, R = map(int, input().split... | ['Wrong Answer', 'Accepted'] | ['s121272419', 's770406734'] | [107004.0, 3956.0] | [2104.0, 348.0] | [198, 252] |
p03037 | u716660050 | 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,R=0,10**5\nfor i in range(M):\n l,r=map(int,input().split())\n L=max(L,l); R=min(R,r)\nprint(L,R)\nR=min(R,N)\nprint(abs((L-1)-R))', 'N,M=map(int,input().split())\nans=0\nL,R=0,(10**5)+1\nfor i in range(M):\n l,r=map(int,input().split())\n L=max(L,l); R=min(R,r)\n ... | ['Wrong Answer', 'Accepted'] | ['s327140763', 's925627359'] | [3064.0, 3064.0] | [327.0, 338.0] | [167, 195] |
p03037 | u720124072 | 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())\nnum = [list(map(int, input().split())) for _ in range(m)]\nnum1 = 1\nnum2 = n\n\nfor j in range(m):\n num1 = max(num[j][0], num1)\n num2 = min(num[j][1], num2)\n\nans = num2 - num1 + 1\n\nif ans > 0\n print(ans)\nelse:\n print(0)', 'n, m = map(int, input().split())\nnum = [list(m... | ['Runtime Error', 'Accepted'] | ['s880659804', 's373592602'] | [2940.0, 27332.0] | [17.0, 378.0] | [253, 254] |
p03037 | u722535636 | 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=1\nr=n\nfor i in range(m):\n\ta,b=map(int,input().split())\n\tl=max(l,a)\n\tr=max(r,b)\nprint(max(r-l+1,0))', 'n,m=map(int,input().split())\nl=1\nr=n\nfor i in range(m):\n\ta,b=map(int,input().split())\n\tl=max(l,a)\n\tr=min(r,b)\nprint(max(r-l+1,0))'] | ['Wrong Answer', 'Accepted'] | ['s204905899', 's026520594'] | [3060.0, 3060.0] | [314.0, 321.0] | [129, 129] |
p03037 | u727057618 | 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()]\nleft = 0\nright = M\nfor _ in range(N):\n L, R = [int(i) for i in input().split()]\n if left < L:\n left = L\n if right > R:\n right = R\nprint(R-L+1)', 'N, M = [int(i) for i in input().split()]\nleft = 0\nright = N\nfor _ in range(M):\n L, R = [int(i) for i in inpu... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s007741937', 's712264412', 's852365526'] | [3060.0, 3060.0, 3060.0] | [297.0, 286.0, 308.0] | [192, 192, 237] |
p03037 | u728566015 | 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 x, y = [int(i) for i in input().split()]\n L.append(x)\n R.append(y)\n\nid = []\nfor i in range(M):\n id += [L[i:] + R[:i + 1]]\nprint(id)\ncom = set(id[0])\nfor j in range(1, M):\n com = com & set(id[j])\ncom_max = max(com)\ncom_mi... | ['Wrong Answer', 'Accepted'] | ['s873331721', 's164969216'] | [1058224.0, 11016.0] | [2168.0, 306.0] | [343, 203] |
p03037 | u728615412 | 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()))\nLock_min = []\nLock_max = []\nfor i in range(N_M[1]):\n ADD = list(map(int,input().split()))\n Lock_min.append(ADD[0])\n Lock_max.append(ADD[1])\nif min(Lock_max) - max(Lock_min) >= 1:\n print(min(Lock_max) - max(Lock_min))\n else:\n print(0)', 'N_M = list... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s247950222', 's639435974', 's831257952'] | [3064.0, 11056.0, 10868.0] | [17.0, 337.0, 300.0] | [294, 297, 189] |
p03037 | u730043482 | 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 math\n\ndef main():\n n, m = [int(x) for x in input().split(" ")]\n gates = []\n mi = n\n ma = 0\n\n for x in range(m):\n l, r = [int(x) for x in input().split(" ")]\n gates.append((l, r))\n\n for gate in gates:\n # print(gate)\n if ma <= gate[0]:\n ma =... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s654061548', 's709317051', 's465613324'] | [16584.0, 16584.0, 16608.0] | [309.0, 323.0, 314.0] | [498, 529, 542] |
p03037 | u731436822 | 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 = [list(map(int,input().split())) for i in range(M)]\n\nmaxi = 0\nmini = 10**6\nfor lr in LR:\n maxi = max(lr[0],maxi)\n mini = min(lr[1],mini)\n\nif mini-maxi+1 >= n:\n print(n)\nelse:\n print(mini-maxi+1)', 'import numpy as np\nN,M = map(int,input().split())\nLR = [lis... | ['Runtime Error', 'Accepted'] | ['s489378738', 's911920171'] | [27328.0, 37900.0] | [373.0, 498.0] | [241, 225] |
p03037 | u736729525 | 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(x) for x in input().split()]\n\nLR = []\nfor _ in range(M):\n LR.append([int(x) for x in input().split()])\n\nprint(sum(check(n) for n in range(1, N+1)))\ndef check(n):\n return 1 if all(l <= n <=r for l, r in range LR) else 0\n', 'N, M = [int(x) for x in input().split()]\n\ndef check(n, LR):\n retur... | ['Runtime Error', 'Accepted'] | ['s376261414', 's835289317'] | [2940.0, 3064.0] | [17.0, 303.0] | [233, 298] |
p03037 | u738287470 | 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 = 0\nmax = 0\nfor i in range(m):\n l,r = map(int,input().split())\n min = min(min,l)\n max = max(max,r)\nprint(int(n-max+min))', 'n,m = map(int,input().split())\ns = 0\nt = n\nfor i in range(m):\n l,r = map(int,input().split())\n s = max(s,l)\n t = min(t,r)\nprint... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s261026085', 's575986738', 's864645498'] | [3060.0, 3060.0, 3060.0] | [17.0, 317.0, 321.0] | [164, 147, 151] |
p03037 | u738322459 | 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\ndef main():\n n, m = map(int, input().split())\n\n gate = []\n\n for _ in range(m):\n ngate = list(map(int, input().split()))\n gate.append(ngate)\n print(gate)\n\n result = 0\n for i in range(1, n + 1):\n for j in range(m):\n if gate[j][0] <= i and i <= gate[j][1... | ['Wrong Answer', 'Accepted'] | ['s467487383', 's636823144'] | [31940.0, 3060.0] | [2105.0, 285.0] | [512, 273] |
p03037 | u740964967 | 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? | ['idCards, gates = input().split(" ")\nidCards = int(idCards)\ngates = int(gates)\n\nfor count in range(0, gates, 1):\n num1, num2 = input().split(" ")\n minNum.append(int(num1))\n maxNum.append(int(num2))\n\nminId = max(minNum)\nmaxId = min(maxNum)\nif minId > maxId:\n print("0")\nelse:\n print((maxId -... | ['Runtime Error', 'Accepted'] | ['s445920685', 's809180628'] | [3064.0, 11036.0] | [17.0, 268.0] | [316, 340] |
p03037 | u745561510 | 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\ngate = []\n\nl, r = map(int, input().split())\n\n\nfor i in range(M-1):\n tmpl, tmpr = map(int, input().split())\n if l < tmpl:\n l = tmpl\n if tmpr < r:\n r = tmpr\n\nprint(r, l)\nif r - l < 0:\n print(0)\nelse:\n print(r - l + 1)\n', 'N, M = map(int, ... | ['Wrong Answer', 'Accepted'] | ['s689223072', 's516732327'] | [3060.0, 3060.0] | [285.0, 279.0] | [279, 268] |
p03037 | u750058957 | 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(" ")))\npermit = [list(map(int, input("").split(" "))) for i in range(M)]\nl,r = 1, N\nfor i,j in permit:\n l = max(l, i)\n r = min(r, j)\nprint(max(l-r+1,0))', 'N, M = list(map(int, input("").split(" ")))\npermit = [list(map(int, input("").split(" "))) for i in range(M)]\nl,r =... | ['Wrong Answer', 'Accepted'] | ['s070833470', 's409114741'] | [27324.0, 27324.0] | [457.0, 458.0] | [191, 191] |
p03037 | u756399469 | 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,max = map(int,input().split())\nfor k in range(m-1):\n a,b = map(int,input().split())\n if min < a:\n min = a\n if max > b:\n max = b\nif b < a:\n print(0)\nelse:\n print(b-a+1)', 'max,m = map(int,input().split())\nmin = 1\nfor k in range(m):\n a,b = map(int,input().spl... | ['Runtime Error', 'Accepted'] | ['s763875099', 's679348211'] | [3060.0, 3060.0] | [285.0, 283.0] | [213, 194] |
p03037 | u756518877 | 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 -*-\nn,m=map(int,input().split())\nL=[]\nR=[]\nfor _ in range(m):\n a,b=map(int,input().split())\n L.append(a)\n R.append(b)\nprint(min(R)-max(L)+1,0)', '# -*- coding: utf-8 -*-\nn,m=map(int,input().split())\nL=[]\nR=[]\nfor _ in range(m):\n a,b=map(int,input().split())\n L.append(a... | ['Wrong Answer', 'Accepted'] | ['s366790752', 's858707245'] | [10996.0, 11056.0] | [301.0, 300.0] | [171, 176] |
p03037 | u756829954 | 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_min = n\n_max = 0\nfor _ in range(m):\n l, r = map(int, input().split())\n _min = min(_min, r)\n _max = max(_max, l)\n print(max(_min - _max + 1, 0))', 'n, m = map(int, input().split())\n_min = 0\n_max = n\nfor _ in range(m):\n l, r = map(int, input().split())\n _min = min(_mi... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s403146362', 's575697884', 's917409955', 's246109029'] | [3700.0, 3700.0, 3572.0, 3060.0] | [902.0, 909.0, 901.0, 300.0] | [181, 181, 181, 235] |
p03037 | u757117214 | 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())\n_min,_max=map(int,input().split())\nfor i in range(M-1):\n L,R=map(int,input().split())\n if R<_min or L>_max:\n print(0)\n sys.exit()\n _min,_max=max(_min,L),min(_max,R)\nprint(_min+1-_max) ', 'N,M=map(int,input().split())\n_min,_max=map(int,input().split... | ['Wrong Answer', 'Accepted'] | ['s046022923', 's295324962'] | [3060.0, 3060.0] | [328.0, 320.0] | [244, 182] |
p03037 | u759412327 | 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 = 0\nR1 = N\n\nfor m in range(M):\n L2,R2 = map(int,input().split())\n L1 = min(L1,L2)\n R1 = max(R1,R2)\n \nprint(max(0,R1-L1))', 'N,M = map(int,input().split())\nL = []\nR = []\n\nfor m in range(M):\n l,r = map(int,input().split())\n L+=[l]\n R+=[r]\n\nprint(max(0,min(R)-ma... | ['Wrong Answer', 'Accepted'] | ['s980221257', 's507407307'] | [3060.0, 16656.0] | [309.0, 206.0] | [158, 146] |
p03037 | u760961723 | 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\nLR = [list(map(int,input().split())) for _ in range(M)]\n\nmax_L = 0\nmin_R = 10**5\n\nfor m in range(M):\n if max_L > LR[m][0]:\n max_L = LR[m][0]\n if min_R <LR[m][1]:\n min_R = LR[m][1]\n \n\nL = [x[0] for x in LR]\nR = [x[1] for x in LR]\n\nif max(L) - min(R) >=0:\n... | ['Wrong Answer', 'Accepted'] | ['s326906453', 's508714222'] | [29052.0, 29048.0] | [355.0, 333.0] | [341, 212] |
p03037 | u761062383 | 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? | ['def resolve():\n N, M = [int(i) for i in input().split()]\n llrr = [list(map(int, input().split())) for _ in range(M)]\n maxL = 1\n minR = N\n for l, r in llrr:\n maxL = max(maxL, l)\n minR = min(minR, r)\n ans = minR - maxL + 1\n if ans < 0:\n print(0)\n else:\n pr... | ['Wrong Answer', 'Accepted'] | ['s109254997', 's093483077'] | [2940.0, 27348.0] | [17.0, 360.0] | [315, 326] |
p03037 | u766566560 | 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 = [list(map(int,input().split())) for i in range(M)]\ncount = 0\n\nfor i in range(N):\n for j in range(M):\n if LR[j][0] <= i <= LR[j][1]:\n count += 1\n\nprint(count)', 'N, M = map(int, input().split())\nL = [0] * M\nR = [0] * M\n\nfor i in range(M):\n L[i], R[i] = map(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s008670852', 's717498957', 's134244486'] | [27344.0, 10868.0, 10868.0] | [2109.0, 2104.0, 282.0] | [204, 206, 152] |
p03037 | u769698512 | 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 defaultdict\nn, m = map(int, input().split())\nleft = []\nright = []\nfor i in range(m):\n l, r = map(int, input().split())\n left.append(l)\n right.append(r)\n\nif min(right) < max(left):\n print(min(right) - max(left) + 1)\nelse:\n print(0)\n', 'from collections import default... | ['Wrong Answer', 'Accepted'] | ['s536165439', 's000973207'] | [11376.0, 11376.0] | [302.0, 306.0] | [270, 271] |
p03037 | u771532493 | 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=0\nb=n*10**9\nA=True\nfor i in range(m):\n x,y=map(int,input().split())\n a=max(a,x)\n b=min(b,y)\nif b>=a:\n ans=b-a+1\n print(ans)\nelse:\n print(0)', 'n,m=map(int,input().split())\na=0\nb=n*10**9\nfor i in range(m):\n x,y=map(int,input().split()) \n a=max(a,x)\n b=min(... | ['Runtime Error', 'Accepted'] | ['s783460939', 's183294796'] | [2940.0, 3060.0] | [18.0, 320.0] | [180, 172] |
p03037 | u773440446 | 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 a,b = map(int,input().split())\n l.append(a)\n r.append(b)\nans = 0\nfor j in range(1,n+1):\n cnt = 0\n for i in range(m) :\n if l[i] <= j or r[i] == j:\n cnt += 1\n continue\n break\n if cnt == ... | ['Wrong Answer', 'Accepted'] | ['s671037138', 's032601889'] | [16884.0, 9172.0] | [2206.0, 217.0] | [334, 161] |
p03037 | u779293207 | 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=1\nr=N\nfor i in range(M):\n L,R=map(int,input().split())\n if L>l:\n l=L\n if R<r:\n r=R\n \nif l<=r:\n print(l-r+1)\n \nelse:\n print(0)\n ', 'N,M=map(int,input().split())\nl=1\nr=N\nfor i in range(M):\n L,R=map(int,input().split())\n if L>l:\n l=L\n if R<r:\n ... | ['Wrong Answer', 'Accepted'] | ['s321738932', 's542677042'] | [3060.0, 3060.0] | [290.0, 285.0] | [174, 175] |
p03037 | u779483561 | 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 -*-\nn, m = map(int, input().split())\nids = [list(map(int, input().split())) for _ in range(m)]\nl = []\nr = []\nfor id in ids:\n l.append(id[0])\n r.append(id[1])\nif max(r) <= min(r):\n print(min(r) - max(l) + 1)\nelse:\n print(0)\n', '# -*- coding: utf-8 -*-\nn, m =... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s482548234', 's608227516', 's901603376'] | [29088.0, 29092.0, 29092.0] | [358.0, 348.0, 357.0] | [271, 270, 271] |
p03037 | u780475861 | 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, right = 1, n\nfor _ in range(m):\n l, r = map(int, input().split())\n if l > left:\n left = l\n if r < right:\n right = r\n if l > r:\n print(0)\n quit()\nif right > n:\n \nprint(right - left + 1)', 'n, m, *lst = map(int, input().split())\nl = max(lst[::2])\nr ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s351921616', 's418217551', 's339627035'] | [2940.0, 3060.0, 25076.0] | [17.0, 17.0, 67.0] | [240, 122, 141] |
p03037 | u780675733 | 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\nN, M = map(int, input().split())\nTable = [list(map(int, input().split())) for _ in range(M)]\nTable.sort(key=lambda x:x[0])\nTable.sort(key=lambda x:x[1])\n#print(f'Table:{Table}')\nfirst = Table[0][0]\nend = Table[0][1]\nTable.pop(0)\n\n#print(f'first:{first} end:{end}')\nfor task in Table:\n #print(f'task:{... | ['Runtime Error', 'Accepted'] | ['s915790027', 's777840585'] | [28980.0, 28980.0] | [488.0, 494.0] | [493, 556] |
p03037 | u780962115 | 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() ))\nFirstlis=[]\nSecondlis=[]\nfor i in range(m):\n s=list(map(int,inout().split()))\nS1=s[0]\nS2=s[1]\nFirstlis.append(S1)\nSecondlis.append(S2)\nMin=max(Firstlis)\nMax=min(Secondlis)\nprint(Max-Min)\n\n\n \n', 'n,m=list(map(int, input().split() ))\nFirstlis=[]\nSecondlis=[]\nfor ... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s602954656', 's820778262', 's836774202', 's909978283', 's979754688', 's009643093'] | [3060.0, 3060.0, 3064.0, 3064.0, 3060.0, 11064.0] | [17.0, 307.0, 302.0, 18.0, 17.0, 352.0] | [230, 233, 270, 331, 308, 278] |
p03037 | u782930273 | 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 = [0] * M, [0] * M\nLmax, Rmin = 0, 1e10\nfor i in range(M):\n L, R = map(int, input().split())\n if L > Lmax:\n Lmax = L\n if R < Rmin:\n Rmin = R\n\nprint(Lmax, Rmin)\nprint(max(Rmin - Lmax + 1, 0))', 'N, M = map(int, input().split())\nL, R = [0] * M, [0... | ['Wrong Answer', 'Accepted'] | ['s547290204', 's987586452'] | [4596.0, 4596.0] | [281.0, 279.0] | [251, 233] |
p03037 | u793868662 | 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? | ['def resolve():\n n, m = map(int, input().split())\n for i in range(m):\n l, r = map(int, input().split())\n if i == 0:\n start = l\n end = r\n else:\n if start <= l:\n start = l\n if r <= end:\n end = r\n if start ... | ['Wrong Answer', 'Accepted'] | ['s206088044', 's379125219'] | [2940.0, 3060.0] | [18.0, 259.0] | [366, 376] |
p03037 | u794603719 | 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# a=int(input())\nlmax=0\nrmin=b\nfor i in range(b):\n l,r = map(int,input().split())\n if l >= lmax:\n lmax = l\n if r <= rmin:\n rmin = r\nprint(max(rmin-lmax+1,0))', 'a,b = map(int,input().split())\n# a=int(input())\nlmax=0\nrmin=a\nfor i in range(b):\n l,r... | ['Wrong Answer', 'Accepted'] | ['s079044369', 's898944181'] | [3060.0, 3060.0] | [279.0, 276.0] | [211, 211] |
p03037 | u796789068 | 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())\nlist1=[list(map(int,input().split())) for i in range(M)]\nstart=[]\nend=[]\nfor i in range(M):\n start.append(list1[i][0])\n end.append(list1[i][1])\nstmax=max(start)\nprint(stmax)\nenmax=min(end)\nprint(enmax)\nprint(enmax-stmax+1)\n', 'N,M=map(int,input().split())\nlist1=[list(ma... | ['Wrong Answer', 'Accepted'] | ['s466805612', 's118399380'] | [29092.0, 29188.0] | [353.0, 357.0] | [258, 300] |
p03037 | u796942881 | 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? | ['def main():\n LR = open(0).read().split()[2:]\n max_L = max(map(int, LR[::2]))\n min_R = min(map(int, LR[1::2]))\n print(min_R - max_L + 1 if max_L <= min_M else 0)\n return\n\n\nmain()', 'def main():\n LR = open(0).read().split()[2:]\n MAX_L = max(map(int, LR[::2]))\n MIN_R = min(map(int, LR[... | ['Runtime Error', 'Accepted'] | ['s979445509', 's512380701'] | [18292.0, 18292.0] | [66.0, 66.0] | [192, 192] |
p03037 | u797994565 | 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\nSs = [list(map(int,input().split()))[1:] for _ in range(M)]\nPs = list(map(int,input().split()))\n\nans = 0\nswitch_pattern_num = 2**N\n\nfor i in range(switch_pattern_num):\n binary = format(i,'0%ib'%N)\n satisfied = True\n for j,S in enumerate(Ss):\n count = 0\n ... | ['Runtime Error', 'Accepted'] | ['s047954047', 's874658574'] | [16824.0, 27332.0] | [360.0, 337.0] | [488, 309] |
p03037 | u798260206 | 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())\nll = []\nrl = []\n\nfor i in range(m):\n l,r = list(map(int,input().split()))\n ll.append(l)\n rl.append(r)\n \nif min(rr)<max(ll):\n print("0")\n\nelse:\n print(abs(max(rr)-min(ll)+1))', 'n,m = map(int,input().split())\nll = []\nrl = []\n \nfor i in range(m):\n l,r = list(map(i... | ['Runtime Error', 'Accepted'] | ['s923236612', 's856984894'] | [11004.0, 11068.0] | [337.0, 348.0] | [210, 212] |
p03037 | u803617136 | 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 = 1\nr = m\nfor _ in range(m):\n li, ri = map(int, input().split())\n l = max(l, li)\n r = min(r, ri)\n\nprint(r - l + 1 if r >= 1 else 0)\n', 'n, m = map(int, input().split())\nl = 1\nr = 10 ** 5\nfor _ in range(m):\n li, ri = map(int, input().split())\n l = max(l, ... | ['Wrong Answer', 'Accepted'] | ['s858513325', 's503823015'] | [3060.0, 3060.0] | [318.0, 321.0] | [176, 182] |
p03037 | u806979530 | 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? | ['S = []\nN, M = input().split(" ")\nfor m in range(len(int(M))):\n S.append(set([i for i in range(int(a),int(b)+1)]))\nif M == 1:\n print(len(S[0]))\nelse:\n sets = S[0]\n for i in range(1,M):\n sets = sets & S[i]\n print(len(sets))', 'N, M = input().split(" ")\n#S = []\nif M == 1:\n a, b = input().split(" ... | ['Runtime Error', 'Accepted'] | ['s198562657', 's067812553'] | [3064.0, 3064.0] | [17.0, 288.0] | [229, 480] |
p03037 | u809690311 | 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 A, B = list(map(int,input().split()))\n l.append(A)\n r.append(B)\n\nmin = 0\nmax = n\nfor i in range(m):\n if min < l[i]:\n min = l[i]\n if max > r[i]:\n max = r[i]\n\nprint(min, max)\nif max - min + 1 > 0:\n print(max - min + 1)\nelse:... | ['Wrong Answer', 'Accepted'] | ['s717563872', 's626783393'] | [11072.0, 11068.0] | [375.0, 362.0] | [310, 294] |
p03037 | u813102292 | 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())\nres = [0,10**5]\nfor i in ragne(m):\n l, r = map(int, input().split())\n res[0] = max(res[0], l)\n res[1] = min(res[1], r)\n\nprint(max(res[1]-res[0]+1),0)', 'n, m = map(int, input().split())\nres = [0,10**5]\nfor i in ragne(m):\n l, r = map(int, input().split())\n res... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s089236893', 's992769425', 's737792758'] | [3064.0, 3060.0, 3188.0] | [17.0, 17.0, 330.0] | [191, 191, 191] |
p03037 | u814265211 | 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 = [], []\n\nfor i in range(M):\n l, r = map(int, input().split())\n L.append(l), R.append(r)\n\nif max(L) <= min(R):\n print(max(R) - min(L) + 1)\nelse:\n print(0)', 'N, M = map(int, input().split())\nL, R = [], []\n\nfor i in range(M):\n l, r = map(int, input().s... | ['Wrong Answer', 'Accepted'] | ['s981824484', 's635915557'] | [10996.0, 10980.0] | [310.0, 310.0] | [204, 205] |
p03037 | u814986259 | 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=[-1]*M\nR=[-1]*M\nfor i in range(M):\n L[i],R[i] =map(input().split())\n \nprint(min(R)-max(L)+1)\n', 'N, M = map(int, input().split())\nLR = [tuple(map(int, input().split())) for i in range(M)]\n\nl = 1\nr = N\nfor i in range(M):\n l = max(l, LR[i][0])\n r = min(r, LR[i][1])\n... | ['Runtime Error', 'Accepted'] | ['s584159868', 's009124196'] | [4596.0, 16620.0] | [19.0, 357.0] | [126, 209] |
p03037 | u815878613 | 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\nimport numpy as np\n\nN, M = input().split()\n\nN = int(N)\nM = int(M)\n\ncnt = 0\n\nNM = np.zeros([M,N])\n\nfor i in range(M):\n A = input().split()\n NM[i,int(A[0]):int(A[1])] = 1.0\n\ns = np.sum(NM,axis=0)\n\nprint(np.sum(s==M))', 'import sys\nimport numpy as np\n\nN, M = input().split()\n\nN = i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s074264699', 's889697774', 's149287838'] | [1329992.0, 1329996.0, 9144.0] | [747.0, 669.0, 178.0] | [231, 253, 301] |
p03037 | u816919571 | 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())\nr={i for i in range(1,n+1)}\nfor i in range(m):\n\tl,r = map(int,input().split())\n\tg = { i for i in range(l,r+1)}\n\tr = r&g\n\tif r == {} :\n\t\tprint(0)\n\t\tbreak\nprint(len(r))', '\nn,m = map(int,input().split())\nL = []\nR = []\nfor i in range(m):\n\tl,r = map(int,input().split(... | ['Runtime Error', 'Accepted'] | ['s761263103', 's610899493'] | [12900.0, 11136.0] | [38.0, 316.0] | [197, 219] |
p03037 | u818349438 | 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 =[list(map(int,input().split()))for _ in range(m)]\n\nlr.sort(reverse = True)\nansl = lr[0][0]\nansr = 10**9\nfor i in range(m):\n r = lr[i][1]\n if r < ansl:\n ansr = min(ansr,r)\nans = max(0,ansr-ansl+1)\n\nprint(ans)\n\n\n', 'n,m = map(int,input().split())\nlr =[li... | ['Wrong Answer', 'Accepted'] | ['s682737998', 's925232715'] | [27772.0, 27772.0] | [481.0, 456.0] | [259, 259] |
p03037 | u820052258 | 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 = list(map(int,input().split()))\nl = [list(map(int,input().split())) for i in range(n[1])]\nminp = l[0][0]\nmaxp = l[0][1]\nfor t in range(n[1]):\n minp = max(minp,l[t][0])\n maxp = min(maxp,l[t][1])\n\nprint(max(0,minp-maxp)+1)', 'n = list(map(int,input().split()))\nl = [list(map(int,input().split())) for i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s169926262', 's756759670', 's404643151'] | [27332.0, 31092.0, 27332.0] | [399.0, 344.0, 377.0] | [229, 476, 228] |
p03037 | u823885866 | 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\nimport math\nimport itertools\nimport collections\nimport heapq\nimport re\nimport numpy as np\n\nrr = lambda: sys.stdin.readline().rstrip()\nrs = lambda: map(str, sys.stdin.buffer.readline().split())\nri = lambda: int(sys.stdin.readline())\nrm = lambda: map(int, sys.stdin.buffer.readline().split())\nrl =... | ['Runtime Error', 'Accepted'] | ['s218577475', 's992914631'] | [12512.0, 12508.0] | [151.0, 307.0] | [502, 537] |
p03037 | u826557401 | 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())\nL = []\nR = []\nfor i in range(m):\n l, r = map(int, input().split())\n if r - l <= 0:\n print(0)\n sys.exit(0) \n L.append(l)\n R.append(r)\n\nprint(max(R) - max(L) + 1)', 'n ,m = map(int, input().split())\nresult = set()\nfirst = True\nfor i in... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s318236506', 's415574447', 's656678180'] | [11040.0, 2940.0, 10996.0] | [310.0, 17.0, 310.0] | [230, 713, 205] |
p03037 | u827141374 | 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(x) for x in input().split())\nA = [int(x) for x in input().split()]\nB = [0] * M\nC = [0] * M\nBsum = 0\nfor i in range(M):\n B[i], C[i] = (int(x) for x in input().split())\n Bsum += B[i]', 'N, M = (int(x) for x in input().split())\nLmax = -1\nRmin = N + 1\nfor i in range(M):\n L, R = (int(x) for... | ['Runtime Error', 'Accepted'] | ['s896991862', 's126539990'] | [10868.0, 3060.0] | [358.0, 325.0] | [198, 264] |
p03037 | u834832056 | 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 = [i for i in range(1, n + 1)]\n\nfor _ in range(m):\n x, y = map(int, input().split())\n tmp = [i for i in range(x, y + 1)]\n for ele in tmp:\n ans.remove(ele)\nprint(n - len(ans))', 'n, m = map(int, input().split())\nans = [i for i in range(1, n + 1)]\n\nl_max =... | ['Runtime Error', 'Accepted'] | ['s483009421', 's659347322'] | [16940.0, 16852.0] | [2206.0, 553.0] | [227, 248] |
p03037 | u839857256 | 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 = 0, m\nfor _ in range(m):\n l_in, r_in = map(int, input().split())\n l = max(l, l_in)\n r = min(r, r_in)\nprint(max(r-l+1, 0))\n', 'n, m = map(int, input().split())\nl, r = 0, n\nfor _ in range(m):\n l_in, r_in = map(int, input().split())\n l = max(l, l_in)\n ... | ['Wrong Answer', 'Accepted'] | ['s965510586', 's924986374'] | [3060.0, 3188.0] | [315.0, 320.0] | [170, 170] |
p03037 | u840958781 | 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\nfor i in range(m):\n l,r=map(int,input().split())\n if l>L:\n L=l\n if r<R:\n R=r\nif R-L<0:\n print(0)\nelse:\n print(R-L)', 'n,m=map(int,input().split())\nL=0\nR=n\nfor i in range(m):\n l,r=map(int,input().split())\n if l>L:\n L=l\n ... | ['Wrong Answer', 'Accepted'] | ['s018841535', 's078795381'] | [3060.0, 3060.0] | [287.0, 282.0] | [180, 182] |
p03037 | u845620905 | 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 = 1\nminR = n\nfor i in range(m):\n l, r = map(int ,input().split())\n maxL = max(l, maxL)\n minR = min(r, minR)\nif(maxL < minR):\n print(0)\nelse:\n print(minR - maxL + 1)\n', 'n, m = map(int, input().split())\nmaxL = 1\nminR = n\nfor i in range(m):\n l, r = ... | ['Wrong Answer', 'Accepted'] | ['s463619593', 's786663350'] | [3060.0, 3060.0] | [320.0, 317.0] | [218, 218] |
p03037 | u848336553 | 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 = []\nfor i in range(m):\n gates.append(list(map(int, input().split())))\ncandidate = [1, n]\nfor gate in gates:\n if candidate[0] < gate[0]:\n candidate[0] = gate[0]\n if gate[1] < candidate[1]:\n candidate[1] = gate[1]\nif candidate[1] == canditate[0]:\... | ['Runtime Error', 'Accepted'] | ['s223653247', 's461343989'] | [27344.0, 27340.0] | [372.0, 376.0] | [369, 371] |
p03037 | u854093727 | 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 bisect\nN,M = map(int,input().split())\nL_list,M_list = [],[]\nfor i in range(M):\n l,m = map(int,input().split())\n L_list.append(l)\n M_list.append(m)\n\nL_list.sort()\nM_list.sort()\nlmax = L_list[-1]\nmmin = M_list[0]\nmin = bisect.bisect_left(n,lmax)\nmax = bisect.bisect_left(n,mmin)\nif min == m... | ['Runtime Error', 'Accepted'] | ['s319538160', 's092561577'] | [11404.0, 3060.0] | [366.0, 286.0] | [370, 285] |
p03037 | u857330600 | 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())\nltmp=1,rtmp=n\nfor i in range(m):\n l,r=map(int,input().split())\n ltmp=max(l,ltmp)\n rtmp=min(r,rtmp)\nif ltmp>rtmp:\n print(0)\nelse:\n print(rtmp-ltmp+1)', 'n,m=map(int,input().split())\nltmp=1\nrtmp=n\nfor i in range(m):\n l,r=map(int,input().split())\n ltmp=max(l,ltmp)\n rtm... | ['Runtime Error', 'Accepted'] | ['s774366169', 's090859088'] | [3056.0, 3060.0] | [18.0, 322.0] | [182, 182] |
p03037 | u857673087 | 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 =[],[]\n\nfor i in range(M+1):\n x,y = map(int,input().split())\n L.append(x)\n R.append(y)\n\nprint(max(0,min(R)-max(L))', 'N,M =map(int, input().split())\nL,R =[],[]\n\nfor i in range(M+1):\n x,y = map(int,input().split())\n L.append(x)\n R.append(y)\n\nprint(max(0,min(R)-m... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s295363071', 's977144738', 's872021124'] | [2940.0, 11020.0, 10996.0] | [17.0, 300.0, 301.0] | [152, 155, 155] |
p03037 | u858670323 | 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().rstrip().split(' '))\nmaxL=0,minR=n+1\nfor i in range(m):\n l,r=map(int,input().rstrip().split(' '))\n maxL = max(maxL,l)\n minR = min(minR,r)\nprint(max(minR-maxL+1,0))", "n,m=map(int,input().rstrip().split(' '))\nmaxL=0\nminR=n+1\nfor i in range(m):\n l,r=map(int,input().rstrip().split(' '))... | ['Runtime Error', 'Accepted'] | ['s608443368', 's976047111'] | [2940.0, 3060.0] | [17.0, 342.0] | [186, 186] |
p03037 | u867069435 | 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 accumulate\n\nn, m = map(int, input().split())\ncards = [0] * (n+1)\nfor i in range(m):\n s, e = map(int, input().split())\n cards[s] += 1\n cards[e] -= 1\nvalids = accumulate(cards)\nprint(valids.count(n))', 'from itertools import accumulate\n\nn, m = map(int, input().split())\ncards = [0] *... | ['Runtime Error', 'Accepted'] | ['s043994807', 's474880906'] | [4084.0, 8124.0] | [316.0, 326.0] | [222, 231] |
p03037 | u867826040 | 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 t = tuple(map(int,input().split()))\n l.append(t[0])\n r.append(t[1])\nl,r=max(l),min(r)\nif l<=r:\n print(l-r+1)\nelse:\n print(0)', 'n,m = map(int,input().split())\nl = []\nr = []\nfor i in range(m):\n t = tuple(map(int,input().split()))\n ... | ['Wrong Answer', 'Accepted'] | ['s923650705', 's105503940'] | [11116.0, 11104.0] | [364.0, 338.0] | [194, 199] |
p03037 | u869265610 | 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()))\nla=1\nrm=N\nfor i in range(M):\n a,b=list(map(int,input().split()))\n la=max(la,a)\n rm=min(rm,b)\nprint(max(0,la-rm+1))\n\n', 'N,M =list(map(int,input().split()))\nla=1\nrm=N\nfor i in range(M):\n a,b=list(map(int,input().split()))\n la=max(la,a)\n rm=min(rm,b)\nprint(max(0... | ['Wrong Answer', 'Accepted'] | ['s740719172', 's424113134'] | [9136.0, 9188.0] | [229.0, 230.0] | [155, 155] |
p03037 | u873269440 | 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? | ['def main():\n\n N,M=map(int,input().split())\n #undivList=[map(int,(input().split())) for _ in range(N)]\n undivList=[]\n for _ in range(M):\n l=map(int,input().split())\n undivList +=l\n atmax=max(undivList[0::2])\n atmin=min(undivList[1::2])\n \n if atmax>atmin:\n print(... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s057082210', 's310827519', 's195154684'] | [11824.0, 2940.0, 11800.0] | [287.0, 18.0, 282.0] | [388, 390, 393] |
p03037 | u875361824 | 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? | ["def main():\n N, M = map(int, input().split())\n lr = [\n list(map(int, input().split()))\n for _ in range(M)\n ]\n\n ans = f(N, M, lr)\n \n print(ans)\n\n\ndef f(N, M, lr):\n \n import numpy as np\n a = np.zeros(N, dtype=int)\n for L, R in lr:\n a[L-1:R] += 1\n\n ... | ['Wrong Answer', 'Accepted'] | ['s807730642', 's049838410'] | [39400.0, 28336.0] | [2110.0, 358.0] | [657, 1039] |
p03037 | u879674287 | 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\nimport sys\nimport itertools\n\n\ndef sr(): return sys.stdin.readline().rstrip()\n\n\ndef ir(): return int(sr())\n\n\ndef lr(): return list(map(int, sr().split()))\n\n\nN, M = lr()\nl_list = []\nr_list = []\nfor i in range(M):\n l, r = lr()\n l_list.append(l)\n r_list.append(r)\n\nmaxL = 0\n... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s013157213', 's275207507', 's337419311', 's624390189', 's694632521', 's582921386'] | [11116.0, 11112.0, 11096.0, 11016.0, 11064.0, 11112.0] | [260.0, 271.0, 268.0, 262.0, 269.0, 273.0] | [496, 488, 496, 510, 481, 492] |
p03037 | u884601206 | 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=-10000000\nr=10000000\n\nfor i in range(m):\n c,d=map(int,input().split())\n if l<c:\n l=c\n if d<r:\n r=d\n \nprint(min(r-l+1,0))\n', 'n,m=map(int,input().split())\nl=-10000000\nr=10000000\n\nfor i in range(m):\n c,d=map(int,input().split())\n if l<c:\n l=c\n if d<r:... | ['Wrong Answer', 'Accepted'] | ['s121131809', 's203928435'] | [3060.0, 3060.0] | [286.0, 282.0] | [164, 164] |
p03037 | u887207211 | 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 = set(list(map(int,input().split())) for _ in range(M))\n\ncnt = 0\nfor i in range(N):\n tmp = 0\n for L, R in LR:\n if L-1 <= i <= R-1:\n tmp += 1\n else:\n break\n if tmp == M:\n cnt += 1\n break\nprint(cnt)', 'N, M = map(int,input().split())\nLR = ... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s414992446', 's628659203', 's758926957', 's687439527'] | [3064.0, 27332.0, 27332.0, 27332.0] | [18.0, 364.0, 378.0, 370.0] | [262, 190, 190, 194] |
p03037 | u891945807 | 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#v = list(map(int,input().split()))\n\n#a = [0 for _ in range(n+1)]\nml = -1\nmr = 10**6\nfor i in range(m):\n l,r = map(int,input().split())\n ml = max(ml,l)\n mr = min(mr,r)\n \nres = ml - mr + 1\nprint(res)', 'n,m = map(int,input().split())\n#v = list(map(int,input().split()))\n... | ['Wrong Answer', 'Accepted'] | ['s951052844', 's110654112'] | [3060.0, 3060.0] | [326.0, 318.0] | [233, 260] |
p03037 | u891973803 | 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 = map(int, input().split())\nfor _ in range(M-1):\n new_l, new_r = map(int, input().split())\n if l < new_l:\n l = new_l\n if new_r < r:\n r = new_r\n\nprint(r-l+1)\n', 'N, M = map(int, input().split())\nl, r = map(int, input().split())\nfor _ in range(M-1... | ['Runtime Error', 'Accepted'] | ['s944064762', 's648513056'] | [3064.0, 3060.0] | [17.0, 279.0] | [218, 269] |
p03037 | u896206464 | 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(_) for _ in input().split()]\n\nls = []\nrs = []\nfor i in range(m):\n lr = [int(_) for _ in input().split()]\n ls.append(lr[0])\n rs.append(lr[1])\n\nprint(min(min(rs) - max(ls) + 1, 0))\n', 'n, m = [int(_) for _ in input().split()]\n\nls = []\nrs = []\nfor i in range(m):\n lr = [int(_) for _... | ['Wrong Answer', 'Accepted'] | ['s428653532', 's614249625'] | [11032.0, 11036.0] | [340.0, 330.0] | [200, 200] |
p03037 | u898058223 | 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)\ncount=0\nfor i in range(1,N+1):\n if min(L)>i or i>max(R):\n break\n else:\n count+=1\nprint(count)', 'N,M=map(int,input().split())\nL=[]\nR=[]\nfor i in range(M):\n l,r=map(int,input()... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s043987012', 's645027098', 's344919895'] | [10996.0, 11020.0, 10996.0] | [2104.0, 2104.0, 308.0] | [218, 215, 184] |
p03037 | u898421873 | 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 temp = input().split()\n l.append(int(temp[0]))\n r.append(int(temp[1]))\n\na = min(l)\nb = max(r)\n\nans = b - a + 1\nif ans <= 0:\n ans = 0\nprint(ans)', 'n, m = map(int, input().split())\n\nl = []\nr = []\nfor i in range(m):\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s022144025', 's625146995', 's567727499'] | [10984.0, 11116.0, 10996.0] | [258.0, 341.0, 262.0] | [223, 195, 223] |
p03037 | u899909022 | 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()))\nmax_l = 1\nmin_r = 100000\nfor _ in range(m):\n l, r = list(map(int, input().split()))\n if l > max_l:\n max_l = l\n if r < min_r:\n min_r = r\nans = min_r - max_l -1\nprint(ans)', 'n, m = list(map(int, input().split()))\nmax_l = 0\nmin_r = 100000\nfor _ ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s128470703', 's916263417', 's976234659'] | [3060.0, 3060.0, 3188.0] | [333.0, 341.0, 328.0] | [231, 228, 267] |
p03037 | u900688325 | 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 = [list(map(int, input().split())) for _ in range(N)]\n\nl_list = [LR[i][0] for i in range(M)]\nr_list = [LR[i][1] for i in range(M)]\n\nl = max(l_list)\nr = min(r_list)\nif r-l <= 0:\n print(0)\nelse:\n print(r-l+1)', 'N, M = map(int, input().split())\nLR = [list(map(int, i... | ['Runtime Error', 'Accepted'] | ['s496382289', 's799653001'] | [29052.0, 29024.0] | [340.0, 343.0] | [248, 244] |
p03037 | u902151549 | 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\nimport re\nimport math\nfrom collections import defaultdict\nfrom collections import deque\nimport itertools\nfrom copy import deepcopy\nimport random\nimport time\nimport os\nimport queue\nimport sys\nimport datetime\nfrom functools import lru_cache\n#@lru_cache(maxsize=None)\nreadline=sys.stdin.rea... | ['Wrong Answer', 'Accepted'] | ['s817877462', 's191700918'] | [29112.0, 29112.0] | [380.0, 388.0] | [3760, 3760] |
p03037 | u902462889 | 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? | ['\nlst_1 = input().split()\n\nN = int(lst_1[0])\nM = int(lst_1[1])\n\nlst_A = []\n\ncount = 0\n\nans_min = 1\nans_max = N\n\nfor i in range(M):\n lst_A.append(input().split())\n\nprint(lst_A)\n\nfor m in range(M):\n\n com_min = int(lst_A[m][0])\n\n if com_min > ans_min:\n ans_min = com_min\n\n com_m... | ['Wrong Answer', 'Accepted'] | ['s110048147', 's925725030'] | [37908.0, 32156.0] | [331.0, 276.0] | [408, 414] |
p03037 | u902468164 | 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 = map(int, input().split())\ntmp = list(map(int, range(l-1, r)))\nfor i in range(m-1):\n l, r = map(int, input().split())\n for j in range(l-1, r):\n if j in tmp:\n tmp.remove(j)\n\nprint(len(tmp))', 'n, m = map(int, input().split())\nls = []\nrs = []\nfo... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s474975675', 's859161892', 's876136739'] | [7076.0, 10984.0, 10996.0] | [2104.0, 303.0, 298.0] | [251, 171, 172] |
p03037 | u904943473 | 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 = map(int, input().split())\nfor i in range(M-1):\n L, R = map(int, input().split())\n if (L >= l):\n l = L\n if (R =< r):\n r = R\nprint(r - l + 1)', 'N, M = map(int, input().split())\nl, r = map(int, input().split())\ncnt = 0\nnum = 0\nif (l == r):\n cnt += 1\n num ... | ['Runtime Error', 'Accepted'] | ['s596090342', 's576960430'] | [2940.0, 3064.0] | [17.0, 314.0] | [188, 711] |
p03037 | u905582793 | 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())\nprint(max(0,min(r)-max(l)))', '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())\nprint(max(0,min(r)-max(l)+1))'] | ['Wrong Answer', 'Accepted'] | ['s746171605', 's008762817'] | [10868.0, 10868.0] | [286.0, 284.0] | [128, 130] |
p03037 | u907223098 | 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())\na=0\nb=0\nfor i in range(m):\n l,r=(int(i) for i in input().split())\n if l>a,r<b:\n a=l\n b=r\n elif l>a and r>=b:\n a=l\n elif r<b and l<=a:\n b=r\nif n>a and n<b:\n print(n-a)\nelif n>a and n>=b:\n print(b-a)\nelse:\n print(0)', 'n,m=(int(i) for i in input(... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s099220327', 's192328818', 's314845777', 's611616262', 's700590348', 's087509032'] | [2940.0, 3064.0, 3064.0, 3064.0, 2940.0, 3064.0] | [17.0, 333.0, 342.0, 344.0, 17.0, 333.0] | [270, 275, 314, 309, 271, 325] |
p03037 | u914330401 | 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_list = []\nr_list = []\nfor i in range(M):\n l, r = map(int, input().split())\n l_list.append(l)\n r_list.append(r)\n \nl = max(l_list)\nr = min(r_list)\n\nif r < l:\n print(0)\nelse:\n print(l-r+1)', 'N, M = map(int, input().split())\n \nl_list = []\nr_list = []\nfor i in ... | ['Wrong Answer', 'Accepted'] | ['s201465409', 's794672826'] | [10980.0, 11008.0] | [299.0, 301.0] | [227, 229] |
p03037 | u917733926 | 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\nLR = [list(map(int, input().split())) for _ in range(M)]\nL = [i[0] for i in LR]\nR = [i[1] for i in LR]\n\nprint(max(L)-min(R)+1)', 'N, M = (int(i) for i in input().split())\n\nLR = [list(map(int, input().split())) for _ in range(M)]\nL = [i[0] for i in LR]\nR = [i[1] for ... | ['Wrong Answer', 'Accepted'] | ['s578055905', 's106810518'] | [29036.0, 29076.0] | [332.0, 334.0] | [168, 243] |
p03037 | u923341003 | 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\nif M == 1:\n L, R = map(int,input().split())\n l = [k+L for k in range(R-L+1)]\n print(len(l))\nelse:\n L, R = map(int,input().split())\n l = [k+L for k in range(R-L+1)]\n l_tmp = copy.deepcopy(l)\n\n L, R = map(int,input().split())\n l = [k+L for k in range(... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s201956680', 's330295939', 's280899530'] | [7088.0, 2940.0, 11008.0] | [26.0, 17.0, 316.0] | [585, 398, 287] |
p03037 | u925567828 | 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? | ['\nn,m = map(int, input().split())\nL = [0]*m\nR = [0]*m\n\nans = 0\n\ninfi = 1000000000000000\n\nl_max =0\nr_min =infi\n\nfor i in range(m):\n L[i],R[i] = map(int, input().split())\n if(l_max<L[i]):\n l_max = L[i]\n continue\n if(r_min>R[i]):\n r_min = R[i]\nif(l_max<r_min):\n ans = 0... | ['Wrong Answer', 'Accepted'] | ['s309334300', 's792584187'] | [10868.0, 10868.0] | [304.0, 321.0] | [510, 478] |
p03037 | u931908847 | 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? | ['ss=input().split(" ")\nN=int(ss[0])\nM=int(ss[1])\nx=0\ny=N\nfor i in range(M):\n tt=input().split(" ")\n if int(tt[0])>x:\n x=int(tt[0])\n if int(tt[1])<y:\n y=int(tt[1])\nprint(int(y-x+1)\n ', 'ss=input().split(" ")\nN=int(ss[0])\nM=int(ss[1])\nx=0\ny=N\nfor i in range(M):\n tt=input().split(" ")\n if i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s088012414', 's162357134', 's947498623'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 257.0] | [190, 190, 232] |
p03037 | u932719058 | 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())\ncnt = 0\nid = []\nfor _ in range(m):\n l= list(map(int, input().split()))\n if len(id) == 0:\n id = l\n else:\n if id[0] < l[0]:\n id[0] = l[0]\n elif id[1] > l[1]:\n id[1]... | ['Wrong Answer', 'Accepted'] | ['s151510634', 's057960893'] | [3064.0, 3064.0] | [346.0, 345.0] | [404, 394] |
p03037 | u932868243 | 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=[list(map(int,input().split())) for i in range(m)]\nl=[0]*n\nfor l,r in lr:\n for t in range(l,r+1):\n l[t-1]+=1\nans=0\nfor ll in l:\n if ll==m:\n ans+==1\nprint(ans)', 'n,m=map(int,input().split())\nl,r=map(int,input().split())\nfor i in range(m-1):\n x,y=map(int,input().sp... | ['Runtime Error', 'Accepted'] | ['s199299592', 's337977805'] | [2940.0, 3060.0] | [17.0, 323.0] | [198, 165] |
p03037 | u936985471 | 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=1\nminr=n\nfor i in range(m):\n l,r=map(int,input().split())\n maxl=max(maxl,l)\n minr=min(minr,r)\n\nprint(maxl-minr+1)\n ', 'n,m=map(int,input().split())\nmaxl=1\nminr=n\nfor i in range(m):\n l,r=map(int,input().split())\n maxl=max(maxl,l)\n minr=min(minr,r)\n\nprint(max(mi... | ['Wrong Answer', 'Accepted'] | ['s799058532', 's119229079'] | [3060.0, 3060.0] | [320.0, 320.0] | [153, 158] |
p03037 | u939757770 | 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())\nlow=[]\nhigh=[]\n\nfor i in range(m):\n b,c = map(int, input().split())\n low.append(b)\n high.append(c)\nmin(high)-max(low)+1', 'n,m = map(int, input().split())\nlow=[]\nhigh=[]\n\nfor i in range(m):\n b,c = map(int, input().split())\n low.append(b)\n high.append(c)... | ['Wrong Answer', 'Accepted'] | ['s204837142', 's864692538'] | [10996.0, 10984.0] | [302.0, 297.0] | [160, 180] |
p03037 | u941645670 | 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 _ in range(m)]\nl, r = [list(i) for i in zip(*lr)]\nanswer = (max(l) - min(r) +1) \nif answer > 0:\n print(answer)\nelse:\n print("0")', 'n,m=map(int, input().split())\nlr = [map(int, input().split()) for _ in range(m)]\nl, r = [list(i) for i ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s727348500', 's909906678', 's835596788'] | [59120.0, 59120.0, 59120.0] | [401.0, 414.0, 400.0] | [202, 202, 202] |
p03037 | u942033906 | 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())\nrange_l = 1\nrange_r = N\nfor i in range(M):\n L,R = map(int,input().split())\n range_l = max(range_l, L)\n range_r = min(range_r, R)\nif range_r - range_l < 0:\n print(0)\nelse:\n print(range_l - range_r + 1)', 'N,M = map(int,input().split())\nL,R = [],[]\nfor i in range(M):\n l... | ['Wrong Answer', 'Accepted'] | ['s272318501', 's958900581'] | [3060.0, 11020.0] | [323.0, 293.0] | [236, 190] |
p03037 | u943057856 | 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())) for _ in range(m)]\nans=0\nfor i in range(1,N+1):\n if all([i in range(l[k][0],l[k][1]+1) for k in range(m)]):\n ans+=1\nprint(ans)', 'n,m=map(int,input().split())\nl=[list(map(int,input().split())) for _ in range(m)]\nprint(l)\na=0\nz=10**5\nf... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s186291550', 's818900578', 's360867707'] | [27348.0, 31932.0, 3060.0] | [320.0, 429.0, 330.0] | [199, 176, 142] |
p03037 | u945106011 | 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=1\nminr=n\nwhile m:\n l,r=map(int,input().split())\n maxl=max(maxl,l)\n minr=min(minr,r)\n m-=1\nprint(max(0,maxl-minr+1))', 'n,m=map(int,input().split())\nmaxl=1\nminr=N\nwhile m:\n l,r=map(int,input().split())\n maxl=max(maxl,l)\n minr=min(minr,r)\n m-=1\nprint(max(0,maxl-... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s051598238', 's473327524', 's700344618', 's501433106'] | [3060.0, 3064.0, 3064.0, 3060.0] | [329.0, 17.0, 17.0, 330.0] | [153, 154, 189, 153] |
p03037 | u945200821 | 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\n\nscan = sys.stdin.readline\n\n\ndef main():\n n, m = map(int, scan().rstrip().split())\n l = 0\n r = n\n \n for _ in range(m):\n l_i, r_i = map(int, scan().rstrip().split())\n l = max(l, l_i)\n r = min(r, r_i)\n \n cards = r - l + 1 if r > l else 0\n \n print(cards)\n \n\nif __name... | ['Runtime Error', 'Accepted'] | ['s206035740', 's874831958'] | [2940.0, 3060.0] | [18.0, 157.0] | [323, 325] |
p03037 | u951480280 | 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 = [list(map(int,input().split())) for _ in range(m)]\ns = {i:0 for i in range(1,n+1)}\nfor i in range(m):\n for j in range(lr[i][0],lr[i][1]+1):\n s[j] += 1\nfor k,v in s.items():\n if v == m:\n print(k)', 'n,m=map(int,input().split())\nl = [0]*m\nr = [0]*m\nfor i ... | ['Wrong Answer', 'Accepted'] | ['s451548663', 's554575705'] | [39492.0, 10868.0] | [2106.0, 289.0] | [248, 143] |
p03037 | u952656646 | 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())\nD = []\nfor i in range(M):\n D.append(list(map(int, input().split())))\n\nL = 1\nR = N\nfor d in D:\n if L<=d[0]<=R or L<=d[1]<=R:\n L = max(L, d[0])\n R = min(R, d[1])\n else:\n print(0)\n break\n print("[{}, {}]".format(L, R))\nelse:\n pri... | ['Wrong Answer', 'Accepted'] | ['s698181409', 's155069218'] | [27340.0, 3060.0] | [496.0, 331.0] | [311, 180] |
p03037 | u953655640 | 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 = map(int, input().split())\nA = [l, r]\nfor i in range(m-1):\n l, r = map(int, input().split())\n if A[0] < l:\n A[0] = l\n if A[1] > r:\n A[1] = r\nprint(r-l+1)', 'n, m = map(int, input().split())\nl, r = map(int, input().split())\nA = [l, r]\nfor i in range(1, m):\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s078787889', 's182258006', 's931818785'] | [3060.0, 3060.0, 11432.0] | [286.0, 296.0, 369.0] | [201, 202, 248] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.