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
|
---|---|---|---|---|---|---|---|---|---|---|
p02661 | u497952650 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['N = int(input())\nab = []\nfor i in range(N):\n ab.append(tuple(map(int,input().split())))\n \nup = sorted(ab,key=lambda a:a[0],reverse=True)\ndown = sorted(ab,key=lambda a:a[1],reverse=True)\n \nif N%2 == 1:\n print(up[N//2][1]-down[N//2][0]+1)\nelse:\n up2 = sorted(ab,key=lambda a:a[0],reverse=True)\n down2 = sorted(ab,key=lambda a:a[1],reverse=True)\n r = (up[N//2][1]+up2[N//2][1])\n l = (down[N//2][0]+down2[N//2][0])\n print(r-l+1)', 'N = int(input())\nA = []\nB = []\nfor i in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nA.sort()\nB.sort()\n\nif N%2 == 1:\n print(B[N//2][1]-A[N//2][0]+1)\nelse:\n r = (B[N//2-1][1]+B[N//2][1])\n l = (A[N//2-1][0]+A[N//2][0])\n print(r-l+1)', 'N = int(input())\nab = []\nfor i in range(N):\n ab.append(tuple(map(int,input().split())))\n \nup = sorted(ab,key=lambda a:a[1],reverse=False)\ndown = sorted(ab,key=lambda a:a[0],reverse=False)\n \nif N%2 == 1:\n print(up[N//2][1]-down[N//2][0]+1)\nelse:\n r = (up[N//2][1]+up[N//2-1][1])\n l = (down[N//2][0]+down[N//2-1][0])\n print(r-l+1)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s295446843', 's605282059', 's448027746'] | [9072.0, 25348.0, 42184.0] | [26.0, 455.0, 575.0] | [441, 275, 343] |
p02661 | u521866787 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n=int(input())\na=[]\nb=[]\nfor i in range(n):\n tmpa,tmpb = map(int,input().split())\n a.append(tmpa)\n b.append(tmpb)\n\na.sort()\nb.sort()\n\nif n%2==1:\n print(b[n//2] - a[n//2] +1)\nelse:\n print((b[n//2+2]-b[n//2+1]) - (a[n//2+2]-a[n//2+1]) +1)\n', '\nn=int(input())\na=[]\nb=[]\nfor i in range(n):\n tmpa,tmpb = map(int,input().split())\n a.append(tmpa)\n b.append(tmpb)\n\na.sort()\nb.sort()\n\nif n%2==1:\n print(b[n//2] - a[n//2] +1)\nelse:\n print((b[n//2]+b[n//2-1]) - (a[n//2]+a[n//2-1]) +1)\n'] | ['Runtime Error', 'Accepted'] | ['s264638746', 's627098023'] | [25352.0, 25476.0] | [469.0, 470.0] | [252, 249] |
p02661 | u522945737 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\n\na = np.zeros(n,dtype=int)\nb = np.zeros(n,dtype=int)\n\nfor i in range(n):\n a[i],b[i] = map(float, input().split())\n\n\nif n==2:\n a0 = [a[0]]\n b0 = [b[0]]\n if a[1]>=a[0]:\n a0.append(a[1])\n else:\n a0.insert(0,a[1])\n if b[1]>=a[0]:\n b0.append(b[1])\n else:\n b0.insert(0,b[1])\nelse:\n a0 = [a[0]]\n b0 = [b[0]]\n if a[1]>=a[0]:\n a0.append(a[1])\n else:\n a0.insert(0,a[1])\n if b[1]>=a[0]:\n b0.append(b[1])\n else:\n b0.insert(0,b[1]) \n for i in range(2,n):\n if a[i]>=a0[len(a0)-1]:\n a0.append(a[i])\n elif a[i]<=a0[0]:\n a0.insert(0,a[i])\n else:\n l = 0\n for j in range(len(a0)-1):\n if a0[j]<=a[i] and a[i]<=a0[j+1] and l==0:\n a0.insert(j+1,a[i])\n l = 1\n if b[i]>=b0[len(b0)-1]:\n b0.append(b[i])\n elif b[i]<=b0[0]:\n b0.insert(0,b[i])\n else:\n m = 0\n for j in range(len(b0)-1):\n if b0[j]<=b[i] and b[i]<=b0[j+1] and m==0:\n b0.insert(j+1,b[i])\n m = 1\n\n \nif n%2 == 1:\n a0cen = a0[(n-1)//2]\n b0cen = b0[(n-1)//2]\n nn = b0cen - a0cen + 1\nelse:\n a0cen1 = a0[(n-2)//2]+a0[n//2]\n b0cen1 = b0[(n-2)//2]+b0[n//2]\n nn = int(b0cen1 -a0cen1 +1)\n\nprint(nn) \n', 'n = int(input())\n\na = np.zeros(n,dtype=int)\nb = np.zeros(n,dtype=int)\n\nfor i in range(n):\n a[i],b[i] = map(float, input().split())\n\n\nif n==2:\n a0 = [a[0]]\n b0 = [b[0]]\n if a[1]>=a[0]:\n a0.append(a[1])\n else:\n a0.insert(0,a[1])\n if b[1]>=a[0]:\n b0.append(b[1])\n else:\n b0.insert(0,b[1])\nelse:\n a0 = [a[0]]\n b0 = [b[0]]\n if a[1]>=a[0]:\n a0.append(a[1])\n else:\n a0.insert(0,a[1])\n if b[1]>=a[0]:\n b0.append(b[1])\n else:\n b0.insert(0,b[1]) \n for i in range(2,n):\n if a[i]>=a0[len(a0)-1]:\n a0.append(a[i])\n elif a[i]<=a0[0]:\n a0.insert(0,a[i])\n else:\n for j in range(len(a0)-1):\n if a0[j]<=a[i] and a[i]<=a0[j+1]:\n a0.insert(j+1,a[i])\n if b[i]>=b0[len(b0)-1]:\n b0.append(b[i])\n elif b[i]<=b0[0]:\n b0.insert(0,b[i])\n else:\n for j in range(len(b0)-1):\n if b0[j]<=b[i] and b[i]<=b0[j+1]:\n b0.insert(j+1,b[i])\n\n \nif n%2 == 1:\n a0cen = a0[(n-1)//2]\n b0cen = b0[(n-1)//2]\n nn = b0cen - a0cen + 1\nelse:\n a0cen1 = a0[(n-2)//2]+a0[n//2]\n b0cen1 = b0[(n-2)//2]+b0[n//2]\n nn = int(b0cen1 -a0cen1 +1)\n\nprint(nn) \n', 'n = int(input())\n\na = np.zeros(n,dtype=int)\nb = np.zeros(n,dtype=int)\n\nfor i in range(n):\n a[i],b[i] = map(float, input().split())\n\n\nif n == 1:\n a0 = [a[0]]\n b0 = [b[0]]\nelif n==2:\n a0 = [a[0]]\n b0 = [b[0]]\n if a[1]>=a[0]:\n a0.append(a[1])\n else:\n a0.insert(0,a[1])\n if b[1]>=a[0]:\n b0.append(b[1])\n else:\n b0.insert(0,b[1])\nelse:\n a0 = [a[0]]\n b0 = [b[0]]\n if a[1]>=a[0]:\n a0.append(a[1])\n else:\n a0.insert(0,a[1])\n if b[1]>=a[0]:\n b0.append(b[1])\n else:\n b0.insert(0,b[1]) \n for i in range(2,n):\n if a[i]>=a0[len(a0)-1]:\n a0.append(a[i])\n elif a[i]<=a0[0]:\n a0.insert(0,a[i])\n else:\n for j in range(len(a0)-1):\n if a0[j]<=a[i] and a[i]<=a0[j+1]:\n a0.insert(j+1,a[i])\n if b[i]>=b0[len(b0)-1]:\n b0.append(b[i])\n elif b[i]<=b0[0]:\n b0.insert(0,b[i])\n else:\n for j in range(len(b0)-1):\n if b0[j]<=b[i] and b[i]<=b0[j+1]:\n b0.insert(j+1,b[i])\n\n \nif n%2 == 1:\n a0cen = a0[int((n-1)/2)]\n b0cen = b0[int((n-1)/2)]\n nn = b0cen - a0cen + 1\nelse:\n a0cen1 = a0[int((n-2)/2)]+a0[int(n/2)]\n b0cen1 = b0[int((n-2)/2)]+b0[int(n/2)]\n nn = int(b0cen -a0cen +1)\n\nprint(nn) \n', 'import numpy as np\n\n \nn = int(input())\n\na = np.zeros(n,dtype=int)\nb = np.zeros(n,dtype=int)\n\nfor i in range(n):\n a[i],b[i] = map(float, input().split())\n\n\na.sort()\nb.sort()\n \nif n%2 == 1:\n a0cen = a[(n-1)//2]\n b0cen = b[(n-1)//2]\n nn = b0cen - a0cen + 1\nelse:\n a0cen1 = a[(n-2)//2]+a[n//2]\n b0cen1 = b[(n-2)//2]+b[n//2]\n nn = int(b0cen1 -a0cen1 +1)\n\nprint(nn) \n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s401792062', 's528606738', 's609617722', 's213782287'] | [9284.0, 9224.0, 9360.0, 29656.0] | [23.0, 26.0, 24.0, 504.0] | [1444, 1338, 1405, 436] |
p02661 | u525796732 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import sys\nimport math\nimport fractions\nfrom collections import defaultdict\nstdin = sys.stdin\n \nns = lambda: stdin.readline().rstrip()\nni = lambda: int(stdin.readline().rstrip())\nnm = lambda: map(int, stdin.readline().split())\nnl = lambda: list(map(int, stdin.readline().split()))\n\n\nN=int(input())\nmin_l=[]\nmax_l=[]\nfor k in range(N):\n A,B=nm()\n min_l.append(A)\n max_l.append(B)\n\nmin_l.sort()\nmax_l.sort()\n\nif(N%2==0):\n print(((max_l[N//2-1]+max_l[N//2])/2-(min_l[N//2-1]+min_l[N//2])/2)*2+1) \nelse:\n print(((max_l[(N-1)//2])-(min_l[(N-1)//2]))+1)', 'import sys\nimport math\nimport fractions\nfrom collections import defaultdict\nstdin = sys.stdin\n \nns = lambda: stdin.readline().rstrip()\nni = lambda: int(stdin.readline().rstrip())\nnm = lambda: map(int, stdin.readline().split())\nnl = lambda: list(map(int, stdin.readline().split()))\n\n\nN=int(input())\nmin_l=[]\nmax_l=[]\nfor k in range(N):\n A,B=nm()\n min_l.append(A)\n max_l.append(B)\n\nmin_l.sort()\nmax_l.sort()\n\nif(N%2==0):\n print(int(((max_l[N//2-1]+max_l[N//2])/2-(min_l[N//2-1]+min_l[N//2])/2)*2+1)) \nelse:\n print(((max_l[(N-1)//2])-(min_l[(N-1)//2]))+1)'] | ['Wrong Answer', 'Accepted'] | ['s268149310', 's869102225'] | [26716.0, 26704.0] | [315.0, 328.0] | [570, 575] |
p02661 | u561231954 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ["import sys\nsys.setrecursionlimit(10000000)\nMOD = 10 ** 9 + 7\nINF = 10 ** 15\n \ndef main():\n N = int(input())\n A = []\n B = []\n for _ in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n \n A.sort()\n B.sort()\n if N%2 == 0:\n L = (A[N//2 - 1] + A[N//2])/2\n R = (B[N//2 - 1] + B[N//2])/2\n ans = (R - L + 1) * 2 - 1\n else:\n L = A[N//2]\n R = B[N//2]\n ans = R - L + 1\n print(ans)\nif __name__ == '__main__':\n main()", "import sys\nsys.setrecursionlimit(10000000)\nMOD = 10 ** 9 + 7\nINF = 10 ** 15\n \ndef main():\n N = int(input())\n A = []\n B = []\n for _ in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n \n A.sort()\n B.sort()\n if N%2 == 0:\n L = (A[N//2 - 1] + A[N//2])\n R = (B[N//2 - 1] + B[N//2])\n ans = (R - L + 1)\n else:\n L = A[N//2]\n R = B[N//2]\n ans = R - L + 1\n print(ans)\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s416107103', 's723556558'] | [25548.0, 25364.0] | [453.0, 435.0] | [520, 508] |
p02661 | u571867512 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['def median(A,N):\n A.sort()\n if N % 2 == 1:\n return A[N//2]\n else:\n return (A[(N-1)//2] + A[(N-1)//2+1])/2\n\ndef main():\n N = int(input())\n AB = [list(map(int,input().split())) for _ in range(N)]\n\n A = [AB[i][0] for i in range(N)]\n B = [AB[i][1] for i in range(N)]\n\n if N % 2 == 1:\n ans = max(int(median(B,N)-median(A,N))+1,0)\n else:\n ans = max(2*int(median(B,N)-median(A,N))+1,0)\n print(median(B,N))\n print(median(A,N))\n print(ans)\n\nif __name__ == "__main__":\n main()\n', 'def median(A,N):\n A.sort()\n if N % 2 == 1:\n return A[N//2]\n else:\n return A[(N-1)//2] + A[(N-1)//2+1]\n\ndef main():\n N = int(input())\n AB = [list(map(int,input().split())) for _ in range(N)]\n\n A = [AB[i][0] for i in range(N)]\n B = [AB[i][1] for i in range(N)]\n\n ans = median(B,N) - median(A,N) + 1\n print(ans)\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s822888728', 's222050881'] | [49212.0, 49344.0] | [500.0, 502.0] | [534, 389] |
p02661 | u583276018 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\ns = []\nzyogen = []\nkagen = []\nfor i in range(n):\n k, z = map(int, input().split())\n kagen.append(k)\n zyogen.append(z)\n\nkk = sorted(kagen)\nzz = sorted(zyogen)\nif(n % 2 == 0):\n aa = n // 2\n x = kk[aa-1] + kk[a]\n y = zz[aa-1] + zz[a]\n print(y-x+1)\nelse:\n aa = n // 2\n x = kk[aa]\n y = zz[aa]\n print(y-x+1)\n ', 'n = int(input())\ns = []\nzyogen = []\nkagen = []\nfor i in range(n):\n k, z = map(int, input().split())\n kagen.append(k)\n zyogen.append(z)\n\nkk = sorted(k)\nzz = sorted(z)\nif(n % 2 == 0):\n aa = n // 2\n x = kk[aa-1]\n y = zz[aa]\n print(y-x+1)\nelse:\n aa = n // 2\n x = kk[aa]\n y = zz[aa]\n print(y-x+1)\n ', 'n = int(input())\ns = []\nzyogen = []\nkagen = []\nfor i in range(n):\n k, z = map(int, input().split())\n kagen.append(k)\n zyogen.append(z)\n\nkk = sorted(k)\nzz = sorted(z)\nif(n % 2 == 0):\n aa = n // 2\n x = kk[aa-1] + kk[a]\n y = zz[aa-1] ++ + zz[a]\n print(y-x+1)\nelse:\n aa = n // 2\n x = kk[aa]\n y = zz[aa]\n print(y-x+1)\n ', 'n = int(input())\ns = []\nzyogen = []\nkagen = []\nfor i in range(n):\n k, z = map(int, input().split())\n kagen.append(k)\n zyogen.append(z)\n\nkk = sorted(k)\nzz = sorted(z)\nif(n % 2 == 0):\n aa = n // 2\n x = kk[aa-1] + kk[a]\n y = zz[aa-1] + zz[a]\n print(y-x+1)\nelse:\n aa = n // 2\n x = kk[aa]\n y = zz[aa]\n print(y-x+1)\n ', 'n = int(input())\ns = []\nzyogen = []\nkagen = []\nfor i in range(n):\n k, z = map(int, input().split())\n kagen.append(k)\n zyogen.append(z)\n\nkk = sorted(k)\nzz = sorted(z)\nif(n % 2 == 0):\n aa = n // 2\n x = kk[aa-1]\n y = zz[aa]\n print(y-x+1)\nelse:\n aa = n // 2\n x = kk[aa]\n y = zz[aa]\n print(y-x+1)\n ', 'n = int(input())\ns = []\nzyogen = []\nkagen = []\nfor i in range(n):\n k, z = map(int, input().split())\n kagen.append(k)\n zyogen.append(z)\n\nkk = sorted(kagen)\nzz = sorted(zyogen)\nif(n % 2 == 0):\n aa = n // 2\n x = kk[aa-1] + kk[aa]\n y = zz[aa-1] + zz[aa]\n print(y-x+1)\nelse:\n aa = n // 2\n x = kk[aa]\n y = zz[aa]\n print(y-x+1)\n '] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s170476613', 's579028831', 's639111482', 's686581698', 's963781373', 's057455206'] | [28556.0, 24856.0, 24816.0, 24868.0, 24852.0, 28616.0] | [473.0, 383.0, 383.0, 386.0, 380.0, 470.0] | [356, 329, 350, 347, 329, 358] |
p02661 | u589783652 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['N = int(input())\nlower = []\nupper = []\nfor i in range(N):\n a, b = map(int, input().split())\n lower.append(a)\n upper.append(b)\nlower.sort()\nupper.sort()\nif N % 2 == 1:\n print(upper[(N+1)//2]-lower[(N+1)//2]+1)\nelse:\n print(upper[N//2 + 1]+upper[N//2]-lower[N//2 + 1]-lower[N//2]+1)', 'N = int(input())\nlower = []\nupper = []\nfor i in range(N):\n a, b = map(int, input().split())\n lower.append(a)\n upper.append(b)\nlower.sort()\nupper.sort()\nif N % 2 == 1:\n print(upper[(N-1)//2]-lower[(N-1)//2]+1)\nelse:\n print(upper[N//2]+upper[N//2 - 1]-lower[N//2]-lower[N//2 - 1]+1)'] | ['Runtime Error', 'Accepted'] | ['s040697283', 's781694216'] | [25524.0, 25404.0] | [473.0, 474.0] | [295, 295] |
p02661 | u589913372 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import heapq as hp\nn = int(input())\nif n%2 ==0:\n m = n//2 + 1\nelse:\n m = (n+1) //2\na,b = [],[]\nfor i in (0,n):\n c = list(map(int, input().split()))\n a.append(c[0])\n b.append(c[1])\nprint(a,b)\nla = hp.nlargest(m,a)\nlb = hp.nlargest(m,b)\nif n%2 == 0:\n c = la[-1] + la[-2] \n d = lb[-1] + lb[-2] \n print(d-c+1)\nelse:\n print(lb[-1]//2-la[-1]//2+1)\n\n', 'import heapq as hp\nn = int(input())\nif n%2 ==0:\n m = n//2 + 1\nelse:\n m = (n+1) //2\na,b = [],[]\nfor i in range(0,n):\n c = list(map(int, input().split()))\n a.append(c[0])\n b.append(c[1])\nprint(a,b)\nla = hp.nlargest(m,a)\nlb = hp.nlargest(m,b)\nif n%2 == 0:\n c = la[-1] + la[-2] \n d = lb[-1] + lb[-2] \n print(d-c+1)\nelse:\n print(lb[-1]-la[-1]+1)\n\n', 'import heapq as hp\nn = int(input())\nif n%2 ==0:\n m = n//2 + 1\nelse:\n m = (n+1) //2\na,b = [],[]\nfor i in range(0,n):\n c = list(map(int, input().split()))\n a.append(c[0])\n b.append(c[1])\nla = hp.nlargest(m,a)\nlb = hp.nlargest(m,b)\nif n%2 == 0:\n c = la[-1] + la[-2] \n d = lb[-1] + lb[-2] \n print(d-c+1)\nelse:\n print(lb[-1]-la[-1]+1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s349836942', 's622169310', 's387863627'] | [9244.0, 36756.0, 36844.0] | [24.0, 952.0, 1010.0] | [370, 369, 356] |
p02661 | u593567568 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import sys\n\nsys.setrecursionlimit(10 ** 7)\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\nAB = [list(map(int, readline().split())) for _ in range(N)]\n\nLINE = []\nfor a, b in AB:\n LINE.append((a, 0))\n LINE.append((b + 1, 1))\n\nLINE.sort()\n\nans = 0\n\nsmall = 0\nsmall_able = 0\nprevx = -1\n\n\nif N % 2 == 1:\n\n mn = 10 ** 10\n mx = 0\n\n flg = False\n\n for x, p in LINE:\n if p == 0:\n small_able += 1\n elif p == 1:\n small += 1\n\n if (small_able - small) >= ((N + 1) // 2):\n flg = True\n mn = min(mn, x)\n\n if flg and not (small_able - small) >= ((N + 1) // 2):\n mx = max(mx, x - 1)\n flg = False\n\nelse:\n mn_0 = 10 ** 10\n mn_1 = 10 ** 10\n mx_0 = 0\n mx_1 = 0\n\n flg_0 = False\n flg_1 = False\n\n for x, p in LINE:\n if p == 0:\n small_able += 1\n elif p == 1:\n small += 1\n\n # N // 2\n if (small_able - small) >= ((N) // 2):\n flg_0 = True\n mn_0 = min(mn_0, x)\n\n if flg_0 and not (small_able - small) >= ((N) // 2):\n mx_0 = max(mx_0, x - 1)\n flg_0 = False\n\n # N // 2 + 1\n if (small_able - small) >= ((N // 2) + 1):\n flg_1 = True\n mn_1 = min(mn_1, x)\n\n if flg_1 and not (small_able - small) >= ((N // 2) + 1):\n mx_1 = max(mx_1, x - 1)\n flg_1 = False\n\n mn = mn_0 + mn_1\n mx = mx_0 + mx_1\n\n print(mn, mx)\n\n\nprint(mx - mn + 1)\n', 'import sys\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10 ** 7)\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\nAB = [list(map(int, readline().split())) for _ in range(N)]\n\nLINE = defaultdict(lambda: [0, 0])\nfor a, b in AB:\n LINE[a][0] += 1\n LINE[b + 1][1] += 1\n\nLINE = list(LINE.items())\nLINE.sort()\n\nans = 0\n\nsmall = 0\nsmall_able = 0\nprevx = -1\n\n\nif N % 2 == 1:\n\n mn = 10 ** 10\n mx = 10 ** 10\n\n flg = False\n\n for x, p in LINE:\n small_able += p[0]\n small += p[1]\n\n if small < (N + 1) // 2 and ((N + 1) // 2) <= small_able:\n mn = min(x, mn)\n\n if (N + 1) // 2 <= small:\n mx = min(mx, x - 1)\n break\n\n\nelse:\n mn_0 = 10 ** 10\n mn_1 = 10 ** 10\n mx_0 = 10 ** 10\n mx_1 = 10 ** 10\n\n flg_0 = False\n flg_1 = False\n\n for x, p in LINE:\n small_able += p[0]\n small += p[1]\n\n if small < N // 2 and (N // 2) <= small_able:\n mn_0 = min(x, mn_0)\n\n if N // 2 <= small:\n mx_0 = min(mx_0, x - 1)\n\n if small < (N // 2) + 1 and (N // 2) + 1 <= small_able:\n mn_1 = min(x, mn_1)\n\n if (N // 2) + 1 <= small:\n mx_1 = min(mx_1, x - 1)\n break\n\n mn = mn_0 + mn_1\n mx = mx_0 + mx_1\n\n\nprint(mx - mn + 1)\n'] | ['Wrong Answer', 'Accepted'] | ['s871578445', 's443678603'] | [81904.0, 132796.0] | [911.0, 1646.0] | [1580, 1369] |
p02661 | u607075479 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import sys\nimport math\nfrom collections import deque\n\nsys.setrecursionlimit(1000000)\nMOD = 10 ** 9 + 7\ninput = lambda: sys.stdin.readline().strip()\nNI = lambda: int(input())\nNMI = lambda: map(int, input().split())\nNLI = lambda: list(NMI())\nSI = lambda: input()\n\n\ndef make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]\n\n\n\ndef make_adjlist_d(n, edges):\n res = [[] for _ in range(n + 1)]\n for edge in edges:\n res[edge[0]].append(edge[1])\n res[edge[1]].append(edge[0])\n return res\n\n\ndef make_adjlist_nond(n, edges):\n res = [[] for _ in range(n + 1)]\n for edge in edges:\n res[edge[0]].append(edge[1])\n return res\n\n\n#nCr\ndef cmb(n, r):\n return math.factorial(n) // math.factorial(r) // math.factorial(n - r)\n\n\ndef main():\n N = NI()\n A = []\n B = []\n for i in range(N):\n a, b = NMI()\n A.append(a)\n B.append(b)\n A.sort()\n B.sort()\n\n if N%2:\n l = A[(N+1)//2-1]\n r = B[(N+1)//2-1]\n print(r-l+1)\n exit()\n\n ll = A[N//2-1]\n lr = A[N//2]\n rl = B[N//2-1]\n rr = B[N//2]\n l = (ll+lr)/2\n r = (rl+rr)/2\n gap = r-l\n print(gap*2+1)\n\n\n\nif __name__ == "__main__":\n main()', 'import sys\nimport math\nfrom collections import deque\n\nsys.setrecursionlimit(1000000)\nMOD = 10 ** 9 + 7\ninput = lambda: sys.stdin.readline().strip()\nNI = lambda: int(input())\nNMI = lambda: map(int, input().split())\nNLI = lambda: list(NMI())\nSI = lambda: input()\n\n\ndef make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]\n\n\n\ndef make_adjlist_d(n, edges):\n res = [[] for _ in range(n + 1)]\n for edge in edges:\n res[edge[0]].append(edge[1])\n res[edge[1]].append(edge[0])\n return res\n\n\ndef make_adjlist_nond(n, edges):\n res = [[] for _ in range(n + 1)]\n for edge in edges:\n res[edge[0]].append(edge[1])\n return res\n\n\n#nCr\ndef cmb(n, r):\n return math.factorial(n) // math.factorial(r) // math.factorial(n - r)\n\n\ndef main():\n N = NI()\n A = []\n B = []\n for i in range(N):\n a, b = NMI()\n A.append(a)\n B.append(b)\n A.sort()\n B.sort()\n\n if N%2:\n l = A[(N+1)//2-1]\n r = B[(N+1)//2-1]\n print(r-l+1)\n exit()\n\n ll = A[N//2-1]\n lr = A[N//2]\n rl = B[N//2-1]\n rr = B[N//2]\n l = (ll+lr)/2\n r = (rl+rr)/2\n gap = r-l\n print(int(gap*2+1))\n\n\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s407528208', 's678202808'] | [25828.0, 25752.0] | [291.0, 299.0] | [1223, 1228] |
p02661 | u627600101 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['N = int(input())\nA = [0 for _ in range(N)]\nB = [0 for _ in range(N)]\nimport statistics\nfor k in range(N):\n A[k], B[k] = map(int, input().split())\n\nif N%2 == 1:\n print(statistics.median(B) - statistics.median(A) +1)\nelse:\n print((statistics.median(B) - statistics.median(A))*2 +1)', 'N = int(input())\nA = [0 for _ in range(N)]\nB = [0 for _ in range(N)]\nimport statistics\nfor k in range(N):\n A[k], B[k] = map(int, input().split())\n\nif N%2 == 1:\n print(statistics.median(B) - statistics.median(A) +1)\nelse:\n print(int((statistics.median(B) - statistics.median(A))*2 +1))'] | ['Wrong Answer', 'Accepted'] | ['s499372986', 's440112205'] | [28960.0, 28892.0] | [471.0, 449.0] | [282, 287] |
p02661 | u638456847 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['from bisect import bisect_right\nimport sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\ndef main():\n N,*ab = map(int, read().split())\n\n AB = []\n for a, b in zip(*[iter(ab)]*2):\n AB.append((a, b))\n\n ans = 0\n AB.sort()\n a, b = AB[N // 2]\n ans += bisect_right(list(range(a, b+1)), AB[min(N // 2 + 1, N-1)][1])\n \n AB.sort(key=lambda x: x[1])\n a, b = AB[N // 2]\n ans += b - a + 1 - bisect_right(list(range(a, b+1)), AB[N // 2 - 1][0])\n \n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'import sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\ndef main():\n N,*ab = map(int, read().split())\n\n A, B = [], []\n for a, b in zip(*[iter(ab)]*2):\n A.append(a)\n B.append(b)\n\n A.sort()\n B.sort()\n\n if N % 2 == 0:\n a1, a2 = A[N // 2 - 1], A[N // 2]\n b1, b2 = B[N // 2 - 1], B[N // 2]\n\n ans = b1 + b2 - (a1 + a2) + 1\n \n else:\n a = A[N // 2]\n b = B[N // 2]\n \n ans = b - a + 1\n \n print(ans)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s539018925', 's824512597'] | [3070892.0, 54580.0] | [2292.0, 220.0] | [570, 562] |
p02661 | u642015143 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['from statistics import median\n\nn = int(input())\n\na = []\nb = []\n\nfor _ in range(n):\n x, y = map(int, input().split())\n a.append(x)\n b.append(y)\n\nprint(median(b) - median(a) + 1)\n', 'n = int(input())\n\na = []\nb = []\n\nfor _ in range(n):\n x, y = map(int, input().split())\n a.append(x)\n b.append(y)\n\na.sort()\nb.sort()\n\nx, y = 0, 0\n\nif n % 2 == 1:\n x = b[n//2]\n y = a[n//2]\nelse:\n x = b[n//2] + b[n//2-1]\n y = a[n//2] + a[n//2-1]\n\nprint(x-y+1)\n'] | ['Wrong Answer', 'Accepted'] | ['s447299847', 's817463639'] | [28868.0, 25504.0] | [488.0, 454.0] | [186, 277] |
p02661 | u651109406 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['N = int(input())\nA, B = [], []\nfor i in range(N):\n tm, p = map(int, input().split())\n A.append(tm), B.append(p)\nA.sort(), B.sort()\n\na = A[N // 2] * 2 if N % 2 == 1 else A[N // 2] + A[N // 2 + 1]\nb = B[N // 2] * 2 if N % 2 == 1 else B[N // 2] + B[N // 2 + 1]\nprint((b - a) // 2 + 1)\n', 'N = int(input())\nA, B = [], []\nfor i in range(N):\n tm, p = map(int, input().split())\n A.append(tm), B.append(p)\nA.sort(), B.sort()\n\na = A[N // 2] * 2 if N % 2 == 1 else A[N // 2 - 1] + A[N // 2]\nb = B[N // 2] * 2 if N % 2 == 1 else B[N // 2 - 1] + B[N // 2]\n\nprint((b - a) // 2 + 1 if N % 2 == 1 else b - a + 1)\n'] | ['Runtime Error', 'Accepted'] | ['s174189740', 's191275334'] | [25480.0, 25556.0] | [472.0, 472.0] | [288, 318] |
p02661 | u652656291 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['N = int(input())\nAB = [int(input().split()) for _ in range(n)]\n \nA = AB[::2]\nB = AB[1::2]\n \nA.sort()\nB.sort()\n \nif N % 2 == 0:\n n = N // 2\n med1 = A[n - 1] + A[n]\n med2 = B[n - 1] + B[n]\n x = med2 - med1 + 1\nelse:\n n = N // 2\n med1 = A[n]\n med2 = B[n]\n x = med2 - med1 + 1\n \nprint(x)', 'N = int(input())\nAB = [list(map(int,input().split())) for _ in range(N)]\n \nA = []\nB = []\nfor i in range(N):\n A.append(AB[i][0])\n B.append(AB[i][1])\nA.sort()\nB.sort()\nif N % 2 == 0:\n n = N // 2\n med1 = A[n-1] + A[n]\n med2 = B[n-1] + B[n]\n x = med2 - med1 + 1\nelse:\n n = N // 2\n med1 = A[n]\n med2 = B[n]\n x = med2 - med1 + 1\n \nprint(x)\n'] | ['Runtime Error', 'Accepted'] | ['s424726372', 's458519057'] | [9212.0, 49232.0] | [22.0, 548.0] | [307, 363] |
p02661 | u677121387 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\nx = [[int(i) for i in input().split()] for _ in range(n)]\nx.sort(key=lambda x:x[0])\ny = sorted(x,key=lambda x:x[1],reverse=True)\nif n%2 == 1:\n c = n//2\n if x[c][1] >= y[c][0]:\n ans = y[c][1] - x[c][0] + 1\n else:\n ans = x[c][1] - x[c][0] + y[c][1] - y[c][0] + 2\n print(ans)\nelse:\n cl = n//2-1\n cr = n//2-1\n lr = x[cl][1]\n rl = y[cr][0]\n print(lr,rl)\n for i in range(n):\n if x[i][0] <= x[cl][0] <= x[i][1]:\n lr = max(lr,x[i][1])\n if x[i][0] <= x[cr][1] <= x[i][1]:\n rl = min(rl, x[i][0])\n print(lr,rl)\n if rl > lr:\n ans = (lr - x[cl][0] + 1)*(y[cr][1]-rl+1)\n else:\n ans = (y[cr][1]-x[cl][0]+1)*(y[cr][1]-x[cl][0])//2\n print(ans)', 'n = int(input())\na = [0]*n\nb = [0]*n\nfor i in range(n): a[i],b[i] = map(int,input().split())\na.sort()\nb.sort()\nif n%2 == 1:\n m = n//2\n ans = b[m] - a[m] + 1\nelse:\n ml = n//2-1\n mr = n//2\n ma = (a[ml] + a[mr])/2 \n mb = (b[ml] + b[mr])/2\n ans = int((mb - ma)*2 + 1)\nprint(ans) '] | ['Wrong Answer', 'Accepted'] | ['s413858797', 's738256398'] | [46984.0, 25448.0] | [832.0, 464.0] | [749, 296] |
p02661 | u679520304 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['N = int(input())\nA = []\nB = []\nfor _ in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\nA.sort()\nB.sort()\nfrom statistics import median\nAm = median(A)\nBm = median(B)\nif N%2==1:\n ans = Bm-Am+1\nelse:\n ans = int(Bm-Am)*2+1', 'N = int(input())\nA = []\nB = []\nfor _ in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\nA.sort()\nB.sort()\nfrom statistics import median\nAm = median(A)\nBm = median(B)\nif N%2==1:\n ans = Bm-Am+1\nelse:\n ans = int((Bm-Am)*2+1)', 'N = int(input())\nA = []\nB = []\nfor _ in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\nfrom statistics import median\nAm = median(A)\nBm = median(B)\nif N%2==1:\n ans = Bm-Am+1\n print(ans)\nelse:\n ans = int((Bm-Am)*2+1)\n print(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s322415877', 's730656146', 's545512877'] | [28660.0, 28576.0, 28940.0] | [527.0, 499.0, 497.0] | [254, 256, 268] |
p02661 | u680851063 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\n\nls = []\nrs = []\nfor _ in range(n):\n x, y = map(int, input().split())\n ls.append(x)\n rs.append(y)\n\nif n % 2 == 1:\n print(rs[len(rs)//2] - ls[len(ls)//2] + 1)\nelse:\n a = (rs[len(rs)//2-1] * 10 + rs[len(rs)//2] * 10) / 2\n b = (ls[len(ls)//2-1] * 10 + ls[len(ls)//2] * 10) / 2\n print((a - b) // 5 + 1)', 'n = int(input())\n\nls = []\nrs = []\nfor _ in range(n):\n x, y = map(int, input().split())\n ls.append(x)\n rs.append(y)\n\nls = sorted(ls)\nrs = sorted(rs)\n\nif n % 2 == 1:\n print(rs[len(rs)//2] - ls[len(ls)//2] + 1)\nelse:\n a = (rs[len(rs)//2-1] * 10 + rs[len(rs)//2] * 10) // 2\n b = (ls[len(ls)//2-1] * 10 + ls[len(ls)//2] * 10) // 2\n print((a - b) // 5 + 1)'] | ['Wrong Answer', 'Accepted'] | ['s110633556', 's439576451'] | [24944.0, 27048.0] | [379.0, 474.0] | [336, 371] |
p02661 | u687044304 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['# -*- coding:utf-8 -*-\n\ndef solve():\n N = int(input())\n Ls, Rs = [], []\n for i in range(N):\n a, b = list(map(int, input().split()))\n Ls.append(a), Rs.append(b)\n\n ans = 0\n if N%2 == 0:\n \n l = Ls[N//2]\n r = Rs[N//2]\n ans = r-l+1\n else:\n \n l2 = Ls[N//2-1]+Ls[N//2]\n r2 = Rs[N//2-1]+Rs[N//2]\n ans = r2-l2+1\n\n print(ans)\n\n\nif __name__ == "__main__":\n solve()\n', '# -*- coding:utf-8 -*-\n\ndef solve():\n N = int(input())\n Ls, Rs = [], []\n for i in range(N):\n a, b = list(map(int, input().split()))\n Ls.append(a), Rs.append(b)\n Ls.sort(), Rs.sort()\n\n ans = 0\n if N%2 == 1:\n \n l = Ls[N//2]\n r = Rs[N//2]\n ans = r-l+1\n else:\n \n l2 = Ls[N//2-1]+Ls[N//2]\n r2 = Rs[N//2-1]+Rs[N//2]\n ans = r2-l2+1\n\n print(ans)\n\n\nif __name__ == "__main__":\n solve()\n'] | ['Wrong Answer', 'Accepted'] | ['s061084557', 's921095622'] | [24700.0, 25400.0] | [378.0, 450.0] | [484, 509] |
p02661 | u690536347 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['N = int(input())\nl = []\nfor _ in range(N):\n A, B = map(int, input().split())\n l.append((A, B))\n\nt = N//2\ntl = sorted(l)\ntr = sorted(l, key=lambda x:-x[1])\n\nif N%2:\n print(tr[t][1]-tl[t][0]+1)\nelse:\n print(1)\n', 'N = int(input())\nt = N//2\nla, lb = [], []\nfor _ in range(N):\n A, B = map(int, input().split())\n la.append(A)\n lb.append(B)\nla.sort()\nlb.sort()\nprint(lb[t]-la[t]+1 if N%2 else lb[t-1]-la[t]+lb[t]-la[t-1]+1)\n'] | ['Wrong Answer', 'Accepted'] | ['s698045836', 's093402731'] | [48888.0, 25336.0] | [607.0, 464.0] | [220, 215] |
p02661 | u691896522 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import bisect\nn = int(input())\na = []\nb = []\n\nfor i in range(n):\n m, p = map(int, input().split())\n a.append(m)\n b.append(p)\na.sort()\nb.sort()\nmiddle = n // 2\nif n % 2:\n print(b[middle] - a[middle] + 1)\nelse: \n a_m = ( a[middle] + a[middle - 1] ) / 2\n b_m = ( b[middle] + b[middle - 1] ) / 2\n print((b_m - a_m) * 2 + 1)\n\n\n\n\n', 'import bisect\nn = int(input())\na = []\nb = []\n\nfor i in range(n):\n m, p = map(int, input().split())\n a.append(m)\n b.append(p)\na.sort()\nb.sort()\nmiddle = n // 2\nif n % 2:\n print(b[middle] - a[middle] + 1)\nelse: \n a_m = ( a[middle] + a[middle - 1] ) / 2\n b_m = ( b[middle] + b[middle - 1] ) / 2\n print(int((b_m - a_m) * 2 + 1))\n\n\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s573369355', 's986187464'] | [25568.0, 25568.0] | [462.0, 469.0] | [345, 350] |
p02661 | u699008198 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int( input())\nA = []\nB = []\n\nfor i in range( n ):\n a, b = map( int, input().split() )\n A.append( a )\n B.append( b )\n\nA = sorted( A )\nB = sorted( B )\n\nif n % 2 == 0:\n i1 = n // 2 - 1\n i2 = n // 2\n print( (( B[ i2 ] + A[ i2 ] ) - ( B[ i1 ] + A[ i1 ] )) // 2 + 1 )\nelse:\n i = ( n + 1 ) // 2 - 1\n print( B[ i ] - A[ i ] + 1 )\n \n', 'n = int( input())\nA = []\nB = []\n\nfor i in range( n ):\n a, b = map( int, input().split() )\n A.append( a )\n B.append( b )\n\nA = sorted( A )\nB = sorted( B )\n\nif n % 2 == 0:\n i1 = n // 2 - 1\n i2 = n // 2\n print( ( B[ i2 ] - A[ i2 ] ) * ( B[ i1 ] - A[ i1 ] ) )\nelse:\n i = ( n + 1 ) // 2 - 1\n print( B[ i ] - A[ i ] + 1 )\n \n', 'n = int( input())\nA = []\nB = []\n\nfor i in range( n ):\n a, b = map( int, input().split() )\n A.append( a )\n B.append( b )\n\nsorted( A )\nsorted( B )\n\nif n % 2 == 0:\n i1 = n // 2 - 1\n i2 = n // 2\n print( (( B[ i2 ] + A[ i2 ] ) - ( B[ i1 ] + A[ i1 ] )) // 2 + 1 )\nelse:\n i = ( n + 1 ) // 2 - 1\n print( B[ i ] - A[ i ] + 1 )\n \n', 'n = int( input() )\nA = []\nB = []\n\nfor i in range( n ):\n a, b = map( int, input().split() )\n A.append( a )\n B.append( b )\n\nA = sorted( A )\nB = sorted( B )\n\nif n % 2 == 0:\n i = n // 2\n print(( B[ i ] + B[ i - 1 ] ) - ( A[ i ] - A [ i - 1 ] ) + 1 )\nelse:\n i = ( n + 1 ) // 2\n print( B[ i ] - A[ i ] + 1 )', 'n = int( input() )\nA = []\nB = []\nfor i in range(n):\n a, b = map( int, input().split() )\n A.append( a )\n B.append( b )\nA = sorted( A )\nB = sorted( B )\n\nret = 0\nif n % 2 == 0:\n i = n // 2 - 1\n ret = B[ i + 1 ] + B[ i ] - ( A[ i + 1 ] + A[ i ] ) + 1\nelse:\n i = ( n + 1 ) // 2 - 1\n ret = B[ i ] - A[ i ] + 1\n \nprint( ret )'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s419798474', 's558604227', 's559576342', 's993772783', 's030959992'] | [26920.0, 27108.0, 27108.0, 27108.0, 26928.0] | [475.0, 478.0, 468.0, 469.0, 484.0] | [337, 326, 329, 308, 326] |
p02661 | u711539583 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\nab = [list(map(int, input().split())) for _ in range(n)]\nab.sort()\nl = ab[(n+1)//2-1][0]\nab.sort(key=lambda x:x[1], reverse=True)\nr = ab[(n+1)//2-1][1]\n\nif n % 2 == 0:\n print(1/0)\nprint(r-l+1)', 'n = int(input())\nab = [list(map(int, input().split())) for _ in range(n)]\nab.sort()\nl = ab[(n+1)//2-1][0]\nab.sort(key=lambda x:x[1], reverse=True)\nr = ab[(n+1)//2-1][1]\n\nprint(l,r)\nprint(r-l+1)', 'n = int(input())\nab = [list(map(int, input().split())) for _ in range(n)]\n\nif n % 2:\n\n ab.sort()\n l = ab[(n+1)//2-1][0]\n\n ab.sort(key=lambda x:x[1], reverse=True)\n r = ab[(n+1)//2-1][1]\n\n print(r-l+1)\n\nelse:\n\n a = [ai for ai, bi in ab]\n b = [bi for ai, bi in ab]\n\n a.sort()\n b.sort()\n\n ll = a[n//2-1]\n lr = b[n//2-1]\n\n rl = a[n//2]\n rr = b[n//2]\n\n\n print((lr+rr) - (ll+rl) + 1)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s043515849', 's499108474', 's658395431'] | [48832.0, 48880.0, 49028.0] | [868.0, 961.0, 924.0] | [212, 193, 419] |
p02661 | u727148417 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ["import sys \nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN = int(input())\nA = [0]*N\nB = [0]*N\ni = 0\nfor line in readlines():\n A[i], B[i] = map(int, line.rstrip().decode('utf-8').split())\n i+=1\nsA = sorted(A)\nsB = sorted(B)\nif N % 2 == 0:\n ans = ((sB[(N//2)-1]+sB[(N//2)]) - (sA[(N//2)-1]+sA[(N//2)])) + 1\nelse:\n ans = (sB[(N-1)//2]-sA[(N-1)//2]) + 1\nprint(ans)\n", 'N = int(input())\nA = [0]*N\nB = [0]*N\ni = 0\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\nsA = sorted(A)\nsB = sorted(B)\nif N % 2 == 0:\n ans = ((sB[(N//2)-1]+sB[(N//2)]) - (sA[(N//2)-1]+sA[(N//2)])) + 1\nelse:\n ans = (sB[(N-1)//2]-sA[(N-1)//2]) + 1\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s792447449', 's241712743'] | [39116.0, 28508.0] | [302.0, 489.0] | [434, 279] |
p02661 | u731368968 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\nAB = [tuple(map(int, input().split())) for i in range(n)]\nA = [AB[i][0] for i in range(n)]\nB = [AB[i][1] for i in range(n)]\n\n\n\nA.sort()\nB.sort()\n\nif n % 2 == 1:\n print(B[n // 2] - A[n // 2] + 1)\n\nprint(A, B)\n\nif n % 2 == 0:\n # x = abs(A[n // 2 - 1] + B[n // 2])\n \n # print(x, y)\n # print(abs(x - y) + 1)\n\n # print(x, y)\n a = A[n // 2] + A[n // 2 - 1]\n b = B[n // 2] + B[n // 2 - 1]\n print(b-a+1)\n # print(a, b)\n # print(B[n // 2] - A[n // 2 - 1] + 1)\n', 'n = int(input())\nAB = [tuple(map(int, input().split())) for i in range(n)]\nA = [AB[i][0] for i in range(n)]\nB = [AB[i][1] for i in range(n)]\n\n\n\nA.sort()\nB.sort()\n\nif n % 2 == 1:\n print(B[n // 2] - A[n // 2] + 1)\n\nif n % 2 == 0:\n print(B[n % 2] - A[n // 2 - 1] + 1)\n \n', 'n = int(input())\nAB = [tuple(map(int, input().split())) for i in range(n)]\nA = [AB[i][0] for i in range(n)]\nB = [AB[i][1] for i in range(n)]\n\n\n\nA.sort()\nB.sort()\n\nif n % 2 == 1:\n print(B[n // 2] - A[n // 2] + 1)\n\n\nif n % 2 == 0:\n # x = abs(A[n // 2 - 1] + B[n // 2])\n \n # print(x, y)\n # print(abs(x - y) + 1)\n\n # print(x, y)\n a = A[n // 2] + A[n // 2 - 1]\n b = B[n // 2] + B[n // 2 - 1]\n print(b - a + 1)\n # print(a, b)\n # print(B[n // 2] - A[n // 2 - 1] + 1)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s714913757', 's906444542', 's132025854'] | [44044.0, 39672.0, 39572.0] | [577.0, 502.0, 482.0] | [615, 354, 607] |
p02661 | u734195782 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\na = []\nb = []\nfor i in range(n):\n a[i],b[i] = map(int, input().split())\na.sort()\nb.sort()\nif n%2 == 1:\n \tprint(b[(n+1)//2]-a[(n+1)//2]+1)\nelse:\n\tprint(b[n//2]-a[n//2]+b[n//2+1]-a[n//2+1]+1)', 'n = int(input())\na = []\nb = []\nfor i in range(n):\n a1,b1 = map(int, input().split())\n a.append(a1)\n b.append(b1)\na.sort()\nb.sort()\nif n%2 == 1:\n print(b[(n+1)//2-1]-a[(n+1)//2-1]+1)\nelse:\n\tprint(b[n//2-1]-a[n//2-1]+b[n//2]-a[n//2]+1)'] | ['Runtime Error', 'Accepted'] | ['s929296391', 's775307009'] | [9140.0, 25432.0] | [23.0, 473.0] | [212, 245] |
p02661 | u744054041 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['def main(N, lines):\n a = sorted(map(lambda line: line[0], lines))\n b = sorted(map(lambda line: line[1], lines))\n\n if N % 2 == 1:\n mi = a[N // 2]\n ma = b[N // 2]\n print(ma - mi + 1)\n else:\n mi = (a[N // 2 - 1] + a[N // 2]) / 2\n ma = (b[N // 2 - 1] + b[N // 2]) / 2\n print(int(ma - mi + 1))\n\n\nN = int(input())\nlines = []\nfor i in range(N):\n lines.append(list(map(int, input().split())))\nmain(N, lines)\n', 'import math\n\n\ndef main(N, lines):\n a = sorted(map(lambda line: line[0], lines))\n b = sorted(map(lambda line: line[1], lines))\n\n if N % 2 == 1:\n mi = a[N // 2]\n ma = b[N // 2]\n else:\n mi = math.floor((a[N // 2 - 1] + a[N // 2]) / 2)\n ma = math.ceil((b[N // 2 - 1] + b[N // 2]) / 2)\n print(a, b, mi, ma)\n print(int(ma - mi + 1))\n\n\nN = int(input())\nlines = []\nfor i in range(N):\n lines.append(list(map(int, input().split())))\nmain(N, lines)\n', 'def main(N, lines):\n a = sorted(map(lambda line: line[0], lines))\n b = sorted(map(lambda line: line[1], lines))\n\n if N % 2 == 1:\n mi = a[N // 2]\n ma = b[N // 2]\n else:\n mi = (a[N // 2 - 1] + a[N // 2]) / 2\n ma = (b[N // 2 - 1] + b[N // 2]) / 2\n print(a, b, mi, ma)\n print(int(ma - mi + 1 + 1))\n\n\nN = int(input())\nlines = []\nfor i in range(N):\n lines.append(list(map(int, input().split())))\nmain(N, lines)\n', 'def main(N, lines):\n a = sorted(map(lambda line: line[0], lines))\n b = sorted(map(lambda line: line[1], lines))\n\n if N % 2 == 1:\n mi = a[N // 2]\n ma = b[N // 2]\n print(int(ma - mi + 1))\n else:\n mi = (a[N // 2 - 1] + a[N // 2])\n ma = (b[N // 2 - 1] + b[N // 2])\n print(int(ma - mi + 1))\n\n\nN = int(input())\nlines = []\nfor i in range(N):\n lines.append(list(map(int, input().split())))\nmain(N, lines)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s606671439', 's747421586', 's824490664', 's580930641'] | [49024.0, 53660.0, 53568.0, 49136.0] | [559.0, 620.0, 611.0, 568.0] | [457, 495, 462, 454] |
p02661 | u770558697 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['\nblist.sort()\n\nif N % 2 == 0:\n median1 = N/2\n median2 = N/2 + 1\n median1 = int(median1) - 1\n median2 = int(median2) - 1\n amedian = (alist[median1] + alist[median2]) / 2\n bmedian = (blist[median1] + blist[median2]) / 2\n print(bmedian-amedian+1)\n\nelse:\n median = (N + 1) / 2\n median = int(median) - 1\n amedian = alist[median]\n bmedian = blist[median]\n print((bmedian-amedian)*2+1)\n', 'n = int(input())\nalist = []\nblist = []\nfor i in range(n):\n a,b = map(int,input().split())\n alist.append(a)\n blist.append(b)\n\nN = len(alist)\nalist.sort()\nblist.sort()\n\nif N % 2 == 0:\n median1 = N/2\n median2 = N/2 + 1\n median1 = int(median1) - 1\n median2 = int(median2) - 1\n amedian = (alist[median1] + alist[median2]) / 2\n bmedian = (blist[median1] + blist[median2]) / 2\n ans = (bmedian-amedian)*2+1\n\nelse:\n median = (N + 1) / 2\n median = int(median) - 1\n amedian = alist[median]\n bmedian = blist[median]\n ans = bmedian-amedian+1\nprint(int(ans))\n'] | ['Runtime Error', 'Accepted'] | ['s033410485', 's444751972'] | [9132.0, 25360.0] | [23.0, 443.0] | [449, 624] |
p02661 | u779170803 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ["import numpy as np\nINT = lambda: int(input())\nINTM = lambda: map(int,input().split())\nSTRM = lambda: map(str,input().split())\nSTR = lambda: str(input())\nLIST = lambda: list(map(int,input().split()))\nLISTS = lambda: list(map(str,input().split()))\n\ndef do():\n n=INT()\n\tA=[]\n B=[]\n for i in range(n):\n a,b=INTM()\n A.append(a)\n B.append(b)\n B=sorted(B,reverse=True)\n if n%2==1:\n ta=A[n//2]\n tb=B[n//2]\n print(tb-ta+1)\n else:\n ta1=A[n//2]\n ta2=A[n//2+1]\n tb1=B[n//2]\n tb2=B[n//2+1]\n avea=(ta1+ta2)/2\n aveb=(tb1+tb2)/2\n print(int((aveb-avea)*2)+1)\n \n \n \nif __name__ == '__main__':\n do()", "import numpy as np\nINT = lambda: int(input())\nINTM = lambda: map(int,input().split())\nSTRM = lambda: map(str,input().split())\nSTR = lambda: str(input())\nLIST = lambda: list(map(int,input().split()))\nLISTS = lambda: list(map(str,input().split()))\n\ndef do():\n n=INT()\n\tA=[]\n B=[]\n for i in range(n):\n a,b=INTM()\n A.append(a)\n B.append(b)\n B=sorted(B,reverse=True9\n if n%2==1:\n ta=A[n//2]\n tb=B[n//2]\n print(tb-ta+1)\n else:\n ta1=A[n//2]\n ta2=A[n//2+1]\n tb1=B[n//2]\n tb2=B[n//2+1]\n avea=(ta1+ta2)/2\n aveb=(tb1+tb2)/2\n print(int((aveb-avea)*2)+1)\n \n \n \nif __name__ == '__main__':\n do()", "import numpy as np\nINT = lambda: int(input())\nINTM = lambda: map(int,input().split())\nSTRM = lambda: map(str,input().split())\nSTR = lambda: str(input())\nLIST = lambda: list(map(int,input().split()))\nLISTS = lambda: list(map(str,input().split()))\n\ndef do():\n imos1=np.array([0]*(10**9))\n imos2=np.array([0]*(10**9))\n n=INT()\n\n for i in range(n):\n a,b=INTM()\n b=10**9+1-b\n imos1[a-1:]+=1\n imos2[b-1:]+=1\n \n if n%2==1:\n for i in range(n//2+1,n+1):\n if (i in imos1) and (i in imos2): \n ta=imos1.index(i)+1\n tb=10**9-imos2.index(i)\n break\n else:\n pass\n print(tb-ta+1)\n else:\n for i in range(n//2,n+1):\n if (i in imos1) and (i in imos2): \n for k in range(i+1,n+1):\n if (k in imos1) and (k in imos2):\n ta1=imos1.index(i)+1\n ta2=imos1.index(k)+1\n tb1=10**9-imos2.index(i)\n tb2=10**9-imos2.index(k)\n avea=(ta1+ta2)/2\n ave=b(tb1+tb2)/2\n print(int((aveb-avea)*2)+1)\n break\n break\n else:\n pass\n else:\n pass\n \n \n \nif __name__ == '__main__':\n do()", "import numpy as np\nINT = lambda: int(input())\nINTM = lambda: map(int,input().split())\nSTRM = lambda: map(str,input().split())\nSTR = lambda: str(input())\nLIST = lambda: list(map(int,input().split()))\nLISTS = lambda: list(map(str,input().split()))\n \ndef do():\n n=INT()\n A=[]\n B=[]\n for i in range(n):\n a,b=INTM()\n A.append(a)\n B.append(b)\n \n A=sorted(A)\n B=sorted(B,reverse=True)\n if n%2==1:\n ta=A[n//2]\n tb=B[n//2]\n print(tb-ta+1)\n else:\n ta1=A[n//2-1]\n ta2=A[n//2]\n tb1=B[n//2-1]\n tb2=B[n//2]\n avea=(ta1+ta2)/2\n aveb=(tb1+tb2)/2\n print(int((aveb-avea)*2)+1)\n \n \n \nif __name__ == '__main__':\n do()"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s134130447', 's381871368', 's883195634', 's489566215'] | [9064.0, 9048.0, 27184.0, 44948.0] | [21.0, 23.0, 108.0, 523.0] | [713, 713, 1429, 749] |
p02661 | u780962115 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['# Count median\nN=int(input())\nm=[]\nM=[]\nfor i in range(N):\n x,y=map(int,input().split())\n m.append(x)\n M.append(y)\nm.sort()\nM.sort(reverse=True)\n\nif N%2!=0:\n mini=m[N//2]\n maxi=M[-N//2]\n print(maxi-mini+1)\nelse:\n mini=m[N//2-1]\n maxi=M[-N//2-1]\n if maxi>=mini:\n print((maxi-mini)*2+1)\n else:\n print(0)\n', 'N = int(input())\na = []\nb = []\nfor i in range(N):\n x, y = map(int, input().split())\n a.append(x)\n b.append(y)\na.sort()\nb.sort()\nif N % 2 == 0:\n x = a[N//2]+a[N//2-1]\n y = b[N//2]+b[N//2-1]\n print(y-x+1)\n\nelse:\n x = a[N//2]\n y = b[N//2]\n print(y-x+1)'] | ['Wrong Answer', 'Accepted'] | ['s218303715', 's681802057'] | [25420.0, 25504.0] | [473.0, 464.0] | [346, 276] |
p02661 | u807772568 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import sys,collections as cl,bisect as bs\nsys.setrecursionlimit(100000)\ninput = sys.stdin.readline\nmod = 10**9+7\nMax = sys.maxsize\ndef l(): \n\treturn list(map(int,input().split()))\ndef m(): \n\treturn map(int,input().split())\ndef onem(): \n\treturn int(input())\ndef s(x): \n\ta = []\n\tif len(x) == 0:\n\t\treturn []\n\taa = x[0]\n\tsu = 1\n\tfor i in range(len(x)-1):\n\t\tif aa != x[i+1]:\n\t\t\ta.append([aa,su])\n\t\t\taa = x[i+1]\n\t\t\tsu = 1\n\t\telse:\n\t\t\tsu += 1\n\ta.append([aa,su])\n\treturn a\ndef jo(x): \n\treturn " ".join(map(str,x))\ndef max2(x): \n\treturn max(map(max,x))\ndef In(x,a): \n k = bs.bisect_left(a,x)\n if k != len(a) and a[k] == x:\n return True\n else:\n return False\n\ndef pow_k(x, n):\n ans = 1\n while n:\n if n % 2:\n ans *= x\n x *= x\n n >>= 1\n return ans\n\n\nn = onem()\n\nle = []\n\nri = []\n\nif n % 2 != 0:\n\tfor i in range(n):\n\t\ta,b = m()\n\t\tle.append(a)\n\t\tri.append(b)\n\tle.sort()\n\tri.sort()\n\tprint(ri[n//2+1] - le[n//2+1]+1)\n\n\n\nelse:\n\tfor i in range(n):\n\t\ta,b = m()\n\t\tle.append(a*2)\n\t\tri.append(b*2)\n\tle.sort()\n\tri.sort()\n\tprint(ri[n//2] - le[n//2-1]+1)\n\n\n', 'import sys,collections as cl,bisect as bs\nsys.setrecursionlimit(100000)\ninput = sys.stdin.readline\nmod = 10**9+7\nMax = sys.maxsize\ndef l(): \n\treturn list(map(int,input().split()))\ndef m(): \n\treturn map(int,input().split())\ndef onem(): \n\treturn int(input())\ndef s(x): \n\ta = []\n\tif len(x) == 0:\n\t\treturn []\n\taa = x[0]\n\tsu = 1\n\tfor i in range(len(x)-1):\n\t\tif aa != x[i+1]:\n\t\t\ta.append([aa,su])\n\t\t\taa = x[i+1]\n\t\t\tsu = 1\n\t\telse:\n\t\t\tsu += 1\n\ta.append([aa,su])\n\treturn a\ndef jo(x): \n\treturn " ".join(map(str,x))\ndef max2(x): \n\treturn max(map(max,x))\ndef In(x,a): \n k = bs.bisect_left(a,x)\n if k != len(a) and a[k] == x:\n return True\n else:\n return False\n\ndef pow_k(x, n):\n ans = 1\n while n:\n if n % 2:\n ans *= x\n x *= x\n n >>= 1\n return ans\n\n\nn = onem()\n\nle = []\n\nri = []\n\nif n % 2 != 0:\n\tfor i in range(n):\n\t\ta,b = m()\n\t\tle.append(a)\n\t\tri.append(b)\n\tle.sort()\n\tri.sort()\n\tprint(ri[n//2] - le[n//2]+1)\n\n\n\nelse:\n\tfor i in range(n):\n\t\ta,b = m()\n\t\tle.append(a*2)\n\t\tri.append(b*2)\n\tle.sort()\n\tri.sort()\n\tprint(((ri[n//2]) - le[n//2-1]+1)//2)\n\n\n', 'import sys,collections as cl,bisect as bs\nsys.setrecursionlimit(100000)\ninput = sys.stdin.readline\nmod = 10**9+7\nMax = sys.maxsize\ndef l(): \n\treturn list(map(int,input().split()))\ndef m(): \n\treturn map(int,input().split())\ndef onem(): \n\treturn int(input())\ndef s(x): \n\ta = []\n\tif len(x) == 0:\n\t\treturn []\n\taa = x[0]\n\tsu = 1\n\tfor i in range(len(x)-1):\n\t\tif aa != x[i+1]:\n\t\t\ta.append([aa,su])\n\t\t\taa = x[i+1]\n\t\t\tsu = 1\n\t\telse:\n\t\t\tsu += 1\n\ta.append([aa,su])\n\treturn a\ndef jo(x): \n\treturn " ".join(map(str,x))\ndef max2(x): \n\treturn max(map(max,x))\ndef In(x,a): \n k = bs.bisect_left(a,x)\n if k != len(a) and a[k] == x:\n return True\n else:\n return False\n\ndef pow_k(x, n):\n ans = 1\n while n:\n if n % 2:\n ans *= x\n x *= x\n n >>= 1\n return ans\n\n\nn = onem()\n\nle = []\n\nri = []\n\nif n % 2 != 0:\n\tfor i in range(n):\n\t\ta,b = m()\n\t\tle.append(a)\n\t\tri.append(b)\n\tle.sort()\n\tri.sort()\n\tprint(ri[n//2] - le[n//2]+1)\n\n\n\nelse:\n\tfor i in range(n):\n\t\ta,b = m()\n\t\tle.append(a*2)\n\t\tri.append(b*2)\n\tle.sort()\n\tri.sort()\n\tprint(((ri[n//2]+ri[n//2-1]) - (le[n//2]+le[n//2-1]))//2+1)\n\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s106254754', 's763679869', 's525980580'] | [25840.0, 25748.0, 25808.0] | [382.0, 337.0, 388.0] | [1409, 1412, 1434] |
p02661 | u810356688 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ["import sys\ndef input(): return sys.stdin.readline().rstrip()\ndef main():\n h,w,k=map(int,input().split())\n S=[input() for _ in range(h)]\n final_ans=10**10\n for row_lis in range(1<<(h-1)):\n lst=[0]*h\n q,ans=0,0\n for r in range(h-1):\n if (row_lis>>r)&1==0:\n lst[r+1]=q\n else:\n q+=1\n lst[r+1]=q\n ans+=1\n data=[0]*h\n for j in range(w):\n for i in range(h):\n data[lst[i]]+=int(S[i][j])\n if data[lst[i]]>k:\n ans+=1\n break\n else:\n continue\n data=[0]*h\n for i in range(h):\n data[lst[i]]+=int(S[i][j])\n if data[lst[i]]>k:\n break\n else:\n continue\n break\n else:\n final_ans=min(final_ans,ans)\n print(final_ans)\n\n\nif __name__=='__main__':\n main()", "import sys\ndef input(): return sys.stdin.readline().rstrip()\ndef main():\n n=int(input())\n A,B=[0]*n,[0]*n\n for i in range(n):\n A[i],B[i]=map(int,input().split())\n A.sort()\n B.sort()\n if n%2==1:\n print(B[n//2]-A[n//2]+1)\n else:\n print(int(((B[n//2-1]+B[n//2])/2-(A[n//2-1]+A[n//2])/2)*2)+1)\n\nif __name__=='__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s031681508', 's385199134'] | [9224.0, 25492.0] | [26.0, 277.0] | [997, 368] |
p02661 | u823885866 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport numpy as np\n\nrl = sys.stdin.readline\nn = int(rl())\na = []\nb = []\nfor _ in range(n):\n aa, bb = map(int, rl().split())\n a.append(aa)\n b.append(bb)\n\ndef heapsort(iterable):\n h = []\n for value in iterable:\n heapq.heappush(h, value)\n return [heapq.heappop(h) for i in range(len(h))]\na = heapsort(a)\nb = heapsort(b)\nif n&1:\n ans = b[n//2] - a[n//2] + 1\nelse:\n c = a[n//2] - a[n//2 - 1]\n d = b[n//2] - b[n//2 - 1]\n ans = (c/2 + d/2) / 0.5 + 1\nprint(ans)', 'import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport numpy as np\n\nrl = sys.stdin.readline\nn = int(rl())\na = []\nb = []\nfor _ in range(n):\n aa, bb = map(int, rl().split())\n a.append(aa)\n b.append(bb)\n\ndef heapsort(iterable):\n h = []\n for value in iterable:\n heapq.heappush(h, value)\n return [heapq.heappop(h) for i in range(len(h))]\na = heapsort(a)\nb = heapsort(b)\nif n&1:\n ans = b[n//2] - a[n//2] + 1\nelse:\n c = a[n//2] - a[n//2 - 1]\n d = b[n//2] - b[n//2 - 1]\n ans = (d/2 - c/2) / 0.5 + 1\nprint(ans)', 'import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport numpy as np\n\nrl = sys.stdin.readline\nn = int(rl())\na = []\nb = []\nfor _ in range(n):\n aa, bb = map(int, rl().split())\n a.append(aa)\n b.append(bb)\n\ndef heapsort(iterable):\n h = []\n for value in iterable:\n heapq.heappush(h, value)\n return [heapq.heappop(h) for i in range(len(h))]\na = heapsort(a)\nb = heapsort(b)\nif n&1:\n ans = b[n//2] - a[n//2] + 1\nelse:\n c = a[n//2] + a[n//2 - 1]\n d = b[n//2] + b[n//2 - 1]\n ans = (d/2 - c/2) / 0.5 + 1\nprint(int(ans))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s256961301', 's668854998', 's105754944'] | [45648.0, 45636.0, 45824.0] | [585.0, 607.0, 637.0] | [562, 562, 567] |
p02661 | u865298224 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import math\n\nN = int(input())\nA = [0] * N\nB = [0] * N\n\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nA.sort()\nB.sort()\n\nmid_a = A[(N + 1) // 2 - 1] if N % 2 == 1 else (A[N // 2 - 1] + A[N // 2]) / 2\nmid_b = B[(N + 1) // 2 - 1] if N % 2 == 1 else (B[N // 2 - 1] + B[N // 2]) / 2\n\nans = 0\nif isinstance(mid_a, float):\n if not mid_a.is_integer():\n ans += 1\n mid_a = math.ceil(mid_a)\nif isinstance(mid_b, float):\n if not mid_b.is_integer():\n ans += 1\n mid_b = math.floor(mid_b)\nprint(mid_b - mid_a + 1)\n', 'N = int(input())\nA = [0] * N\nB = [0] * N\n\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nA.sort()\nB.sort()\n\nif N % 2 == 1:\n mid_a = A[(N + 1) // 2 - 1]\n mid_b = B[(N + 1) // 2 - 1]\n print(mid_b - mid_a + 1)\nelse:\n mid_a = (A[N // 2 - 1] + A[N // 2]) / 2\n mid_b = (B[N // 2 - 1] + B[N // 2]) / 2\n print(int((mid_b - mid_a) * 2) + 1)\n'] | ['Wrong Answer', 'Accepted'] | ['s219773809', 's323268460'] | [25372.0, 25356.0] | [443.0, 445.0] | [550, 366] |
p02661 | u867320886 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n,*ab = map(int,open(0).read().split())\na = ab[::2]\nb = ab[1::2]\na.sort()\nb.sort(reverse=True)\n\nif n%2 == 1:\n med_min = a[(n-1)//2]\n med_max = b[(n-1)//2]\n ans = med_max - med_min + 1\nelse:\n med_min = (a[n//2-1] + a[n//2] ) /2\n med_max = (b[n//2-1] + b[n//2] ) /2\n ans = (med_max - med_min)*2 + 1\n\nprint(ans)', 'n,*ab = map(int,open(0).read().split())\na = ab[::2]\nb = ab[1::2]\na.sort()\nb.sort(reverse=True)\n\nif n%2 == 1:\n med_min = a[(n-1)//2]\n med_max = b[(n-1)//2]\n ans = med_max - med_min + 1\nelse:\n med_min = (a[n//2-1] + a[n//2] ) /2\n med_max = (b[n//2-1] + b[n//2] ) /2\n ans = (med_max - med_min)*2 + 1\n\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s260900154', 's913500939'] | [54992.0, 55044.0] | [212.0, 212.0] | [326, 331] |
p02661 | u870736713 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['from statistics import median\nN=int(input())\na,b=[],[]\n#print(map(int,input().split())\nfor i in range(N):\n i,j=map(int,input().split())\n a.append(i)\n b.append(j)\named,bmed=median(a),median(b)\n \nif N%2==1:\n print(bmed-amed+1)\nelse:\n print(2*(bmed-amed)+1)', 'from statistics import median\nN=int(input())\na,b=[],[]\n#print(map(int,input().split())\nfor i in range(N):\n i,j=map(int,input().split())\n a.append(i)\n b.append(j)\named,bmed=median(a),median(b)\n \nif N%2==1:\n print(int(bmed-amed+1))\nelse:\n print(int(2*(bmed-amed)+1))'] | ['Wrong Answer', 'Accepted'] | ['s164932122', 's781425969'] | [28832.0, 28736.0] | [478.0, 489.0] | [260, 270] |
p02661 | u882616665 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['N = int(input())\nA = []\nB = []\nfor i in range(N):\n a,b = map(input().split())\n A.append(a)\n B.append(b)\n\nA = sorted(A)\nB = sorted(B)\n \nif N%2==1:\n print(B[N//2] - A[N//2] + 1)\nelse:\n print( (B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2]) + 1 )', 'args = map(int, input().split())\nN = args[0]\nA = [a for (i,a) in enumerate(args[1:]) if i%2==1]\nB = [b for (i,b) in enumerate(args[1:]) if i%2==0]\n\nA = sorted(A)\nB = sorted(B)\n\nif N%2==1:\n\tprint(B[N//2] - A[N//2] + 1)\nelse:\n\tprint( (B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2]) + 1 )', 'N = int(input())\nA = []\nB = []\nfor i in range(N):\n a,b = map(int, input().split())\n A.append(a)\n B.append(b)\n\nA = sorted(A)\nB = sorted(B)\n \nif N%2==1:\n print(B[N//2] - A[N//2] + 1)\nelse:\n print( (B[N//2-1]+B[N//2]) - (A[N//2-1]+A[N//2]) + 1 )\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s887531205', 's973111067', 's150291058'] | [9204.0, 9164.0, 26940.0] | [25.0, 23.0, 485.0] | [242, 279, 248] |
p02661 | u886567399 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['from statistics import median\n\nN = int(input())\nA = [0] * N\nB = [0] * N\nmax=0\nmin =0\nfor c in range(N):\n A[c], B[c] = map(int, input().split())\n\nmed_A = median(A)\nmed_B = median(B)\n\nif N%2==0:\n print((med_B-med_A)*2+1)\nelse:\n print(med_B-med_A+1)', 'from statistics import median\n\nN = int(input())\nA = [0] * N\nB = [0] * N\nmax=0\nmin =0\nfor c in range(N):\n A[c], B[c] = map(int, input().split())\n\nmed_A = median(A)\nmed_B = median(B)\n\nif N%2==0:\n print(int((med_B-med_A)*2+1))\nelse:\n print(med_B-med_A+1)'] | ['Wrong Answer', 'Accepted'] | ['s574711487', 's455181629'] | [28644.0, 28672.0] | [442.0, 443.0] | [255, 260] |
p02661 | u888337853 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ["import sys\n\n# import re\nimport math\nimport collections\n\nimport bisect\nimport itertools\nimport fractions\n# import functools\nimport copy\nimport heapq\nimport decimal\n# import statistics\nimport queue\n\nsys.setrecursionlimit(10000001)\nINF = 10 ** 16\nMOD = 10 ** 9 + 7\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n# ===CODE===\n\n\ndef main():\n n = ni()\n a = []\n b = []\n d = []\n for _ in range(n):\n ai, bi = ns()\n a.append(ai)\n b.append(bi)\n d.append((ai, bi))\n\n a.sort()\n b.sort()\n\n odd = n % 2 == 1\n even = n % 2 == 0\n min_choice = a[n // 2 - even]\n max_choice = b[n // 2]\n\n kouho = []\n for ai, bi in d:\n tmp = range(max(ai, min_choice), min(bi, max_choice))\n if len(tmp) > 0:\n kouho.append(tmp)\n\n dic_even = dict()\n dic_odd = dict()\n\n for k in kouho:\n for t in k:\n dic_even[t] = 0\n\n for i in range(len(kouho)):\n for t in kouho[i]:\n for j in range(i + 1, len(kouho)):\n for l in kouho[j]:\n dic_odd[(t + l) / 2] = 0\n \n e = set(dic_even.keys())\n o = set(dic_odd.keys())\n \n ans = e+o\n print(len(ans))\n\n\nif __name__ == '__main__':\n main()\n", "import sys\n\n# import re\nimport math\nimport collections\n\nimport bisect\nimport itertools\nimport fractions\n# import functools\nimport copy\nimport heapq\nimport decimal\n# import statistics\nimport queue\nimport numpy as np\n\nsys.setrecursionlimit(10000001)\nINF = 10 ** 16\nMOD = 10 ** 9 + 7\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n# ===CODE===\n\n\ndef main():\n n = ni()\n a = []\n b = []\n for _ in range(n):\n ai, bi = ns()\n a.append(ai)\n b.append(bi)\n\n a.sort()\n b.sort()\n\n if n % 2:\n ans = b[n // 2] - a[n // 2] + 1\n else:\n ans = b[n // 2] + b[n // 2 - 1] - (a[n // 2] + a[n // 2 - 1]) + 1\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s205971054', 's234444442'] | [1478764.0, 43376.0] | [2251.0, 341.0] | [1344, 819] |
p02661 | u906501980 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['def main():\n n = int(input())\n nums = []\n for _ in range(n):\n a, b = map(int, input().split())\n if a == b:\n nums.append(a)\n else:\n nums.append(a)\n nums.append(b)\n sn = list(sorted(nums))\n kukans = []\n old = sn[0]\n for si in sn[1:]:\n kukans.append(si-old+1)\n old = si\n size = len(kukans)\n # if size%2:\n \n \n \n middle1 = kukans[size//2-1]\n middle2 = kukans[size//2]\n if n%2:\n print(middle1+middle2-1)\n else:\n print(middle1+middle2-1)\n \n\nif __name__ == "__main__":\n main()', 'def main():\n n = int(input())\n al = []\n bl = []\n for _ in range(n):\n a, b = map(int, input().split())\n al.append(a)\n bl.append(b)\n als = list(sorted(al))\n bls = list(sorted(bl))\n if n%2:\n print(bls[n//2]-als[n//2]+1)\n else:\n print(bls[n//2-1]+bls[n//2]-als[n//2]-als[n//2-1]+1)\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s238291167', 's114576519'] | [45504.0, 29408.0] | [534.0, 459.0] | [676, 375] |
p02661 | u909514237 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['N = int(input())\nlistA = [0] * N\nlistB = [0] * N\nidx = 0\nfor i in range(N):\n listA[idx],listB[idx] = map(int, input().split())\n idx += 1\n\nmedianA = 0\nmedianB = 0\nans = 0\nif N%2 == 0:\n medianA = statistics.median(listA)\n medianB = statistics.median(listB)\n ans = (medianB - medianA) * 2 + 1\nelse:\n medianA = statistics.median(listA)\n medianB = statistics.median(listB)\n ans = medianB - medianA + 1\n\nprint(int(ans))', 'import statistics\nimport math\n\nN = int(input())\nlistA = [0] * N\nlistB = [0] * N\nidx = 0\nfor i in range(N):\n listA[idx],listB[idx] = map(int, input().split())\n idx += 1\n\nmedianA = 0\nmedianB = 0\nans = 0\nif N%2 == 0:\n medianA = statistics.median(listA)\n medianB = statistics.median(listB)\n ans = (medianB - medianA) * 2 + 1\nelse:\n medianA = statistics.median(listA)\n medianB = statistics.median(listB)\n ans = medianB - medianA + 1\n\nprint(int(ans))'] | ['Runtime Error', 'Accepted'] | ['s750931855', 's347933826'] | [24592.0, 28712.0] | [371.0, 466.0] | [421, 452] |
p02661 | u930705402 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['from math import *\nfrom statistics import median\nN=int(input())\nA,B=[],[]\nfor i in range(N):\n a,b=map(int,input().split())\n A.append(a);B.append(b)\nA.sort();B.sort()\nif N%2:\n ans=median(B)-median(A)+1\nelse:\n ans=(median(B)-median(A))*2+1\nprint(ans)', 'from statistics import median\nN=int(input())\nA,B=[],[]\nfor i in range(N):\n a,b=map(int,input().split())\n A.append(a);B.append(b)\nmA=median(A);mB=median(B)\nif N%2:\n ans=int(mB-mA)+1\nelse:\n if mA//1==mA and mB//1==mB:\n ans=int(mB-mA)*2+1\n elif mA//1!=mA and mB//1==mB:\n ans=(mB-(mA//1))*2\n elif mA//1==mA and mB//1!=mB:\n ans=((mB//1+1)-mA)*2\n else:\n ans=int(mB-mA)*2+1\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s427327958', 's595548983'] | [28948.0, 28984.0] | [482.0, 460.0] | [260, 431] |
p02661 | u932291797 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\nminnums = [[] for _ in range(n)]\nmaxnums = [[] for _ in range(n)]\n\nfor i in range(n):\n minnums[i], maxnums[i] = map(int, input().split())\n \nminnums.sort()\nmaxnums.sort()\n\nif n % 2:\n minmedian = minnums[n // 2]\n maxmedian = maxnums[n // 2]\n print(maxmedian - minmedian + 1)\nelse:\n minmedian = (minnums[n // 2 - 1] + minnums[n // 2]) / 2\n maxmedian = (maxnums[n // 2 - 1] + maxnums[n // 2]) / 2\n print(int((maxmedian - minmedian) * 2 + 1))\n\n\nprint(minmedian, maxmedian)', 'n = int(input())\nminnums = [[] for _ in range(n)]\nmaxnums = [[] for _ in range(n)]\n\nfor i in range(n):\n minnums[i], maxnums[i] = map(int, input().split())\n \nminnums.sort()\nmaxnums.sort()\n\nif n % 2:\n minmedian = minnums[n // 2]\n maxmedian = maxnums[n // 2]\n print(maxmedian - minmedian + 1)\nelse:\n minmedian = (minnums[n // 2 - 1] + minnums[n // 2]) / 2\n maxmedian = (maxnums[n // 2 - 1] + maxnums[n // 2]) / 2\n print(int((maxmedian - minmedian) * 2 + 1))'] | ['Wrong Answer', 'Accepted'] | ['s254819466', 's971553502'] | [37588.0, 37712.0] | [550.0, 521.0] | [492, 462] |
p02661 | u936985471 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import sys\nreadline=sys.stdin.readline\n \nN=int(readline())\nA = [None] * N\nB = [None] * N\nfor i in range(N):\n a,b = map(int,readline().split())\n A[i] = [a,b]\n B[i] = [b,a]\n\nA = sorted(A,key = lambda x:x[0])\nB = sorted(B,key = lambda x:x[0])\n\nif N % 2 == 1:\n minval = A[N // 2][0]\n maxval = B[N // 2][0]\n print(max(maxval - minval + 1,0))\nelse:\n minval = A[(N - 1) // 2][0]\n minvalend = A[(N - 1) // 2][1]\n \n maxval = B[(N) // 2][0]\n maxvalstart = B[(N) // 2][1]\n\n print((minvalend - minval + 1) * (maxval - maxvalstart + 1))\n', 'import sys\nreadline=sys.stdin.readline\n \nN=int(readline())\nA = [None] * N\nB = [None] * N\nfor i in range(N):\n A[i],B[i] = map(int,readline().split())\n\nA = sorted(A)\nB = sorted(B)\n\nif N % 2 == 1:\n \n Amid = A[N // 2]\n Bmid = B[N // 2]\n print(Bmid - Amid + 1)\nelse:\n \n Amid = (A[N // 2] + A[(N // 2) - 1])\n Bmid = (B[N // 2] + B[(N // 2) - 1])\n print(int(Bmid - Amid) + 1)\n'] | ['Wrong Answer', 'Accepted'] | ['s879000146', 's595004666'] | [61312.0, 27080.0] | [791.0, 258.0] | [536, 412] |
p02661 | u941438707 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n=int(input())\nc=[list(map(int,input().split())) for _ in range(n)]\nc.sort()\nq,w=c[n//2][0],min(c[n//2][1],c[n//2+1][1])\nc.sort(key=lambda x: x[1])\ne,r=max(c[n//2][0],c[n//2-1][1]),c[n//2][1]\nif n%2==0:\n print(max(w-q,r-e)+1)\nelse:\n print(r-q+1)', 'n=int(input())\nc=[list(map(int,input().split())) for _ in range(n)]\nc.sort()\nq,w=c[n//2][0],min(c[n//2][1],c[n//2+1][1])\nc.sort(key=lambda x: x[1])\ne,r=max(c[n//2][0],c[n//2-1][1]),c[n//2][1]\nif n%2==0:\n print(r-q+1+e-w)\nelse:\n print(r-q+1)', 'n=int(input())\nc=[list(map(int,input().split())) for _ in range(n)]\nc.sort()\nq,w=c[n//2][0],min(c[n//2][1],c[n//2+1][1])\nc.sort(key=lambda x: x[1])\ne,r=max(c[n//2][0],c[n//2-1][1]),c[n//2][1]\nif w<=e:\n print(max(w-q,r-e)+1)\nelse:\n print(r-q+1)', 'n=int(input())\nc=[list(map(int,input().split())) for _ in range(n)]\nc.sort()\nq,w=c[n//2][0],min(c[n//2][1],c[n//2+1][1])\nc.sort(key=lambda x: x[1])\ne,r=max(c[n//2][0],c[n//2-1][1]),c[n//2][1]\n# if w<=e:\n# print(max(w-q,r-e)+1)\n# else:\nprint(r-q+1)', 'n=int(input())\na,b=[],[]\nfor _ in range(n):\n i,j=map(int,input().split())\n a+=[i]\n b+=[j]\na.sort()\nb.sort()\nc=n//2\nif n%2==1:\n print(b[c]-a[c]+1)\nelse:\n print(b[c]-a[c]+b[c-1]-a[c-1]+1)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s340534037', 's573681532', 's728298739', 's754081103', 's840284725'] | [49052.0, 48972.0, 48904.0, 48924.0, 25420.0] | [883.0, 939.0, 901.0, 880.0, 481.0] | [251, 246, 249, 251, 200] |
p02661 | u948911484 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['import copy\nn = int(input())\nab = [list(map(int,input().split())) for _ in range(n)]\nab2 = copy.deepcopy(ab)\nab = sorted(ab, key=lambda x:x[0])\nab2 = sorted(ab2, key=lambda x:x[1])\nif n % 2 == 1:\n m = ab[n//2][0]\n M = ab2[n//2][1]\n print(max(0,M-m+1))\nelse:\n m = (ab[n//2][0]+ab[n//2-1][0])/2\n M = (ab[n//2][1]+ab[n//2-1][1])/2\n print(m,M)\n print(int((M-m)*2+1))', 'import copy\nn = int(input())\nab = [list(map(int,input().split())) for _ in range(n)]\nab2 = copy.deepcopy(ab)\nab = sorted(ab, key=lambda x:x[0])\nab2 = sorted(ab2, key=lambda x:x[1])\nprint(ab,ab2)\nif n % 2 == 1:\n m = ab[n//2][0]\n M = ab2[n//2][1]\n print(M-m+1)\nelse:\n m = (ab[n//2][0]+ab[n//2-1][0])\n M = (ab[n//2][1]+ab[n//2-1][1])\n print(int(M-m+1))', 'n = int(input())\na,b = [],[]\nfor i in range(n):\n x,y = map(int,input().split())\n a.append(x)\n b.append(y)\na.sort()\nb.sort()\nif n % 2 == 1:\n print(b[n//2]-a[n//2]+1)\nelse:\n M = (b[n//2]+b[n//2-1])/2\n m = (a[n//2]+a[n//2-1])/2\n print(int((M-m)*2+1))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s657691198', 's909963379', 's639206669'] | [88240.0, 88912.0, 25524.0] | [1276.0, 1730.0, 468.0] | [383, 367, 268] |
p02661 | u955474478 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\nla = []\nlb = []\nfor i in range(n):\n a, b = map(int, input().split())\n la.append(a)\n lb.append(b)\na = statistics.median(la)\nb = statistics.median(lb)\nif n % 2 == 1:\n print(b - a + 1)\nelse:\n print((b - a) * 2 - 1)', 'import statistics\n\nn = int(input())\nla = []\nlb = []\nfor i in range(n):\n a, b = map(int, input().split())\n la.append(a)\n lb.append(b)\na = statistics.median(la)\nb = statistics.median(lb)\nif n % 2 == 1:\n print(b - a + 1)\nelse:\n print((b - a) * 2 - 1)\n', 'import statistics\n\nn = int(input())\nla = []\nlb = []\nfor i in range(n):\n a, b = map(int, input().split())\n la.append(a)\n lb.append(b)\na = statistics.median(la)\nb = statistics.median(lb)\nif n % 2 == 1:\n print(b - a + 1)\nelse:\n print((b - a) * 2 + 1)\n', 'import statistics\n\nn = int(input())\nla = [0]*n\nlb = [0]*n\nfor i in range(n):\n a, b = map(int, input().split())\n la[i] = a\n lb[i] = b\na = statistics.median(la)\nb = statistics.median(lb)\nif n % 2 == 1:\n print(b - a + 1)\nelse:\n print(int((b - a) * 2 + 1))'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s585507629', 's623245314', 's784405273', 's675965740'] | [24844.0, 28868.0, 28904.0, 28828.0] | [376.0, 466.0, 474.0, 471.0] | [233, 253, 253, 257] |
p02661 | u961674365 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\na = [0 for _ in range(n)]\nb = a[:]\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\na.sort()\nb.aort()\n\nans = 0\nif n % 2 == 0:\n l = a[n//2-1] + a[n//2]\n h = b[n//2-1] + b[n//2]\n\n ans += h - l + 1\nelse:\n l = a[n//2]\n h = b[n//2]\n\n ans += h - l + 1\n\n\n\nprint(ans)', 'n = int(input())\na = [0 for _ in range(n)]\nb = a[:]\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\na.sort()\nb.sort()\n\nans = 0\nif n % 2 == 0:\n l = a[n//2-1] + a[n//2]\n h = b[n//2-1] + b[n//2]\n\n ans += h - l + 1\nelse:\n l = a[n//2]\n h = b[n//2]\n\n ans += h - l + 1\n\n\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s764865140', 's838345149'] | [25456.0, 25368.0] | [417.0, 473.0] | [305, 305] |
p02661 | u966584145 | 2,000 | 1,048,576 | There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. | ['n = int(input())\n\naList = []\nbList = []\nfor i in range(n):\n a, b = map(int, input().split())\n aList.append(a)\n bList.append(b)\n\naList.sort()\nbList.sort()\n\nhalf = n // 2\nif not n % 2 == 0:\n print(bList[half] - aList[half] + 1)\nelse:\n print(bList[half] + bList[half+1] - aList[half] + aList[half+1] + 1)\n\n', 'n = int(input())\n\naList = []\nbList = []\nfor i in range(n):\n a, b = map(int, input().split())\n aList.append(a)\n bList.append(b)\n\naList.sort()\nbList.sort()\n\n\nif not n % 2 == 0:\n half = (n+1) // 2 - 1\n print(bList[half] - aList[half] + 1)\nelse:\n half = (n) // 2 - 1\n print(bList[half] + bList[half+1] - (aList[half] + aList[half+1]) + 1)\n\n'] | ['Runtime Error', 'Accepted'] | ['s218932928', 's850351896'] | [25552.0, 25388.0] | [466.0, 460.0] | [318, 357] |
p02662 | u117541450 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ['import numpy as np\nN,S=map(int,input().split())\nAs=list(map(int,input().split()))\n\nMOD=998244353\n\n#d = [[0]*3001 for _ in range(3001)]\nd=np.zeros((3001,3001))\nd[0,0]=1\n\nfor i in range(1,N+1):\n Ai=As[i-1]\n d[i] += 2*d[i-1]\n d[i,Ai:] += d[i-1][:-Ai]\n d[i] %= MOD\n print(d[i,:10])\nprint(int(d[N][S]))', 'import numpy as np\nN,S=map(int,input().split())\nAs=list(map(int,input().split()))\n\nMOD=998244353\n\n#d = [[0]*3001 for _ in range(3001)]\nd=np.zeros((3001,3001))\nd[0,0]=1\n\nfor i in range(1,N+1):\n Ai=As[i-1]\n d[i] += 2*d[i-1]\n d[i,Ai:] += d[i-1][:-Ai]\n d[i] %= MOD\nprint(int(d[N][S]))'] | ['Wrong Answer', 'Accepted'] | ['s921156494', 's677686117'] | [97432.0, 97396.0] | [721.0, 354.0] | [312, 292] |
p02662 | u169350228 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ["import math\nimport numpy as np\nimport queue\nfrom collections import deque,defaultdict\nimport heapq\nfrom sys import stdin,setrecursionlimit\n#from scipy.sparse.csgraph import dijkstra\n#from scipy.sparse import csr_matrix\nipt = stdin.readline\nsetrecursionlimit(10**7)\n\ndef main():\n n,s = map(int,ipt().split())\n a = [int(i) for i in ipt().split()]\n mod = 998244353\n two = [1]*(n+1)\n for i in range(n):\n two[i+1] = two[i]*2%mod\n dp = np.zeros((n+1,s+1),dtype = int)\n for i,ai in enumerate(a):\n if ai > s:\n continue\n for si in range(s):\n dp[s-si][ai:] += dp[s-si-1][:-ai]\n dp[1][ai] += 1\n ans = 0\n for i in range(n+1):\n dpi = dp[i]\n ans = (ans+(dpi[s]*two[n-i])%mod)%mod\n print(ans)\n return\n\nif __name__ == '__main__':\n main()\n", "import math\nimport numpy as np\nimport queue\nfrom collections import deque,defaultdict\nimport heapq\nfrom sys import stdin,setrecursionlimit\n#from scipy.sparse.csgraph import dijkstra\n#from scipy.sparse import csr_matrix\nipt = stdin.readline\nsetrecursionlimit(10**7)\n\ndef main():\n n,s = map(int,ipt().split())\n a = [int(i) for i in ipt().split()]\n mod = 998244353\n two = [1]*(n+1)\n for i in range(n):\n two[i+1] = two[i]*2%mod\n dp = np.zeros((n+1,s+1),dtype = int)\n for i,ai in enumerate(a):\n if ai > s:\n continue\n dp1 = np.zeros((n+1,ai),dtype=int)\n dp2 = np.zeros((1,s+1-ai),dtype=int)\n dp3 = np.array([l[:s+1-ai] for l in dp[:-1]])\n dp4 = np.block([[dp2],[dp3]])\n dp5 = np.block([dp1,dp4])\n dp += dp5\n dp[1][ai] += 1\n ans = 0\n for i in range(n+1):\n dp[i] = dpi\n ans = (ans+(dpi[s]*two[n-i])%mod)%mod\n print(ans)\n return\n\nif __name__ == '__main__':\n main()\n", "import math\nimport numpy as np\nimport queue\nfrom collections import deque,defaultdict\nimport heapq\nfrom sys import stdin,setrecursionlimit\n#from scipy.sparse.csgraph import dijkstra\n#from scipy.sparse import csr_matrix\nipt = stdin.readline\nsetrecursionlimit(10**7)\n\ndef main():\n n,s = map(int,ipt().split())\n a = [int(i) for i in ipt().split()]\n mod = 998244353\n two = [1]*(n+1)\n for i in range(n):\n two[i+1] = two[i]*2%mod\n dp = np.zeros(3010,dtype = int)\n dp[0] = 1\n for i,ai in enumerate(a):\n ndp = dp*2\n ndp[ai:] += dp[:-ai]\n ndp %= mod\n dp = ndp\n print(dp[s])\n return\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s445682922', 's649443958', 's861814623'] | [97688.0, 417908.0, 27324.0] | [2209.0, 2211.0, 206.0] | [822, 980, 677] |
p02662 | u201387466 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ['import sys\ninput=sys.stdin.readline\nsys.setrecursionlimit(10 ** 8)\nfrom itertools import accumulate\nfrom itertools import permutations\nfrom itertools import combinations\nfrom collections import defaultdict\nfrom collections import Counter\nimport fractions\nimport math\nfrom collections import deque\nfrom bisect import bisect_left\nfrom bisect import insort_left\nimport itertools\nfrom heapq import heapify\nfrom heapq import heappop\nfrom heapq import heappush\nimport heapq\nfrom copy import deepcopy\nalf = list("abcdefghijklmnopqrstuvwxyz")\nALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")\n#import numpy as np\nINF = float("inf")\n\n\n#N = int(input())\n#A = list(map(int,input().split()))\n#S = list(input())[:-1]\n#S.remove("\\n")\n#N,M = map(int,input().split())\n#S,T = map(str,input().split())\n#A = [int(input()) for _ in range(N)]\n#S = [list(input())[:-1] for _ in range(N)]\n#A = [list(map(int,input().split())) for _ in range(N)]\nimport numpy as np\nN,S = map(int,input().split())\nMOD = 998244353\nA = list(map(int,input().split()))\ndp = np.zeros(S+1,dtype = np.int64)\ndp[0] = 2\nif A[0] <= S:\n dp[A[0]] = 1\nfor i in range(1,N):\n a = A[i]\n p = (dp*2) %= MOD\n if a > S:\n continue\n else:\n p[a:] += dp[:-a]\n dp = p % MOD\nprint(dp[-1])\n\n \n\n\n\n', 'import sys\ninput=sys.stdin.readline\nsys.setrecursionlimit(10 ** 8)\nfrom itertools import accumulate\nfrom itertools import permutations\nfrom itertools import combinations\nfrom collections import defaultdict\nfrom collections import Counter\nimport fractions\nimport math\nfrom collections import deque\nfrom bisect import bisect_left\nfrom bisect import insort_left\nimport itertools\nfrom heapq import heapify\nfrom heapq import heappop\nfrom heapq import heappush\nimport heapq\nfrom copy import deepcopy\nalf = list("abcdefghijklmnopqrstuvwxyz")\nALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")\n#import numpy as np\nINF = float("inf")\n\n\n#N = int(input())\n#A = list(map(int,input().split()))\n#S = list(input())[:-1]\n#S.remove("\\n")\n#N,M = map(int,input().split())\n#S,T = map(str,input().split())\n#A = [int(input()) for _ in range(N)]\n#S = [list(input())[:-1] for _ in range(N)]\n#A = [list(map(int,input().split())) for _ in range(N)]\nimport numpy as np\nN,S = map(int,input().split())\nMOD = 998244353\nA = list(map(int,input().split()))\ndp = np.zeros(S+1,dtype = np.int64)\ndp[0] = 2\nif A[0] <= S:\n dp[A[0]] = 1\nfor i in range(1,N):\n a = A[i]\n p = dp*2\n if a <= S:\n p[a:] += dp[:-a]\n p %= MOD\n dp = p\nprint(dp[-1])\n\n \n\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s733921624', 's995291568'] | [9064.0, 27432.0] | [21.0, 210.0] | [1296, 1268] |
p02662 | u257162238 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ['import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(200000)\nfrom itertools import accumulate\nfrom collections import defaultdict\n\n\ndef read():\n N, S = map(int, input().strip().split())\n A = list(map(int, input().strip().split()))\n return N, S, A\n\n\ndef solve(N, S, A, MOD=998244353, INF=10**9):\n A = list(sorted(A))\n B = list(accumulate(A))\n dp = [[0 for j in range(S+1)] for i in range(N+1)]\n G = [[-1 for j in range(2)] for i in range(N+1)]\n for i in range(N+1):\n dp[i][0] = 1\n for i in range(N):\n for j in range(1, S+1):\n if j - A[i] >= 0:\n dp[i+1][j] = dp[i][j-A[i]] + dp[i][j]\n if dp[i][j-A[i]] > 0:\n G[i+1][1] = i\n if dp[i][j] > 0:\n G[i+1][0] = i\n\n pairs = []\n\n def dfs(i, pair):\n if i == 0:\n pairs.append(pair)\n else:\n if G[i][0] >= 0:\n dfs(i-1, pair)\n elif G[i][0] >= 0:\n dfs(i-1, [i] + pair)\n \n dfs(N, [])\n print(pairs)\n return -1\n\n\n\nif __name__ == \'__main__\':\n inputs = read()\n outputs = solve(*inputs)\n if outputs is not None:\n print("%s" % str(outputs))\n', 'import sys\ninput = sys.stdin.readline\nimport numpy as np\nfrom numba import njit\n\n\ndef read():\n N, S = map(int, input().strip().split())\n A = np.fromstring(input().strip(), dtype=np.int32, sep=" ")\n return N, S, A\n\n\n@njit\ndef solve(N, S, A, MOD=998244353):\n dp = np.zeros((S+1), dtype=np.int32)\n dp[0] = 1\n for i in range(N):\n for j in range(S, -1, -1):\n v = 2 * dp[j]\n if j - A[i] >= 0:\n v += dp[j-A[i]]\n dp[j] = v % MOD\n return dp[S]\n\n\nif __name__ == \'__main__\':\n inputs = read()\n outputs = solve(*inputs)\n if outputs is not None:\n print("%s" % str(outputs))\n'] | ['Wrong Answer', 'Accepted'] | ['s525808191', 's501260440'] | [590088.0, 110240.0] | [2220.0, 730.0] | [1223, 652] |
p02662 | u266014018 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ["def main():\n import sys\n mod = 998244353\n def input(): return sys.stdin.readline().rstrip()\n n,s = map(int, input().split())\n a = list(map(int, input().split()))\n dp = [0]*(s+1)\n dp[0] = 1\n import numpy as np\n dp = np.array(dp)\n for i in range(n):\n dp[a[i]:] = (2*dp[a[i]:]%mod + dp[:-a[i]])%mod\n print(dp[-1])\n\n\nif __name__ == '__main__':\n main()", "def main():\n import sys\n mod = 998244353\n def input(): return sys.stdin.readline().rstrip()\n n,s = map(int, input().split())\n a = list(map(int, input().split()))\n dp = [0]*(s+1)\n dp[0] = 1\n import numpy as np\n dp = np.array(dp)\n for i in range(n):\n dp[a[i]:] = (2*dp[a[i]:]%mod + dp[:-a[i]])%mod\n dp[:a[i]] *= 2\n dp[:a[i]] %= mod\n print(dp[-1])\n\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s895629747', 's741232156'] | [27372.0, 27472.0] | [265.0, 287.0] | [390, 438] |
p02662 | u307622233 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ["import sys\ninput = sys.stdin.readline\n\n\ndef main():\n n, s = map(int, input().split())\n a = [int(i) for i in input().split()]\n\n dp = [0] * (s + 1)\n dp[0] = 1\n p = [0] * (s + 1)\n\n for i in a:\n dp, p = p, dp\n for j in range(s + 1):\n dp[j] += p[j] * 2\n if j + i <= s:\n dp[j + i] += p[j]\n\n print(dp[s])\n\n\nif __name__ == '__main__':\n main()\n", 'import numpy as np\nimport sys\ninput = sys.stdin.readline\n\n\ndef main():\n n, s = map(int, input().split())\n A = [int(i) for i in input().split()]\n\n MOD = 998244353\n\n dp = np.zeros(s + 1, dtype="int32")\n dp[0] = 1\n\n for a in A:\n p = (dp * 2) % MOD\n p %= MOD\n p[a:] += dp[:a]\n dp = p % MOD\n\n print(dp[s])\n\n\nif __name__ == \'__main__\':\n main()\n', 'import numpy as np\nimport sys\ninput = sys.stdin.readline\n\n\ndef main():\n n, s = map(int, input().split())\n A = np.array([int(i) for i in input().split()])\n\n MOD = 998244353\n\n dp = np.zeros(s + 1, dtype="int32")\n dp[0] = 1\n\n for i in range(n):\n p = (dp * 2) % MOD\n p %= MOD\n p[A[i]:] += dp[:-A[i]]\n dp = p % MOD\n\n print(dp[s])\n\n\nif __name__ == \'__main__\':\n main()'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s449044852', 's553772592', 's314498310'] | [12472.0, 27424.0, 27404.0] | [2206.0, 123.0, 207.0] | [410, 390, 413] |
p02662 | u408620326 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ["def main():\n import sys\n import numpy as np\n input = sys.stdin.readline\n sys.setrecursionlimit(10**6)\n N, S = [int(x) for x in input().strip().split()]\n An = [int(x) for x in input().strip().split()]\n dp = np.array([[0] * (S + 1) for _ in range(2)], dtype=int)\n dp[0, 0] = 2\n if An[0] <= S:\n dp[0, An[0]] = 1\n\n for n in range(1, N):\n dp[(n)%2, :] *= 0\n for k in range(S + 1):\n dp[n%2, k] = (dp[n%2, k] + dp[(n-1)%2, k] * 2) % 998244353\n if k + An[n] > S:\n break\n dp[n%2, k+An[n]] = (dp[n%2, k+An[n]] + dp[(n-1)%2, k]) % 998244353\n\n print(dp[(N-1)%2, S])\n \nif __name__ == '__main__':\n main()", "def main():\n import sys\n import numpy as np\n input = sys.stdin.readline\n sys.setrecursionlimit(10**6)\n N, S = [int(x) for x in input().strip().split()]\n An = [int(x) for x in input().strip().split()]\n dp = np.zeros((S+1), dtype=int)\n dp[0] = 2\n if An[0] <= S:\n dp[An[0]] = 1\n\n for n in range(1, N):\n dp *= 2\n dp[An[n]:] += dp[:-An[n]] // 2\n dp %= 998244353\n\n print(dp[S])\n \nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s436629861', 's836175524'] | [27256.0, 27380.0] | [2206.0, 279.0] | [710, 487] |
p02662 | u477977638 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ['import sys\nread = sys.stdin.buffer.read\ninput = sys.stdin.readline\ninput = sys.stdin.buffer.readline\n\n\n\n#from functools import lru_cache\n\ndef RD(): return sys.stdin.read()\ndef II(): return int(input())\ndef MI(): return map(int,input().split())\ndef MF(): return map(float,input().split())\ndef LI(): return list(map(int,input().split()))\ndef LF(): return list(map(float,input().split()))\ndef TI(): return tuple(map(int,input().split()))\n# rstrip().decode()\n\nimport numpy as np\n\ndef main():\n\tn,s=MI()\n\tA=LI()\n\n\tli=[0]*(s+10)\n\tli=np.array(li)\n\tli[0]=1\n\t#print(li)\n\n\tfor i in A:\n\t\ttmp=li.copy()\n\t\tli*=2\n\t\tif i<n:\n\t\t\tli[i:]+=tmp[:s+10-i]\n\t\tli%=998244353\n\t\t#print(li)\n\tprint(li[s])\n\n\n\nif __name__ == "__main__":\n\tmain()\n', 'import sys\nread = sys.stdin.buffer.read\ninput = sys.stdin.readline\ninput = sys.stdin.buffer.readline\n\n\n\n#from functools import lru_cache\n\ndef RD(): return sys.stdin.read()\ndef II(): return int(input())\ndef MI(): return map(int,input().split())\ndef MF(): return map(float,input().split())\ndef LI(): return list(map(int,input().split()))\ndef LF(): return list(map(float,input().split()))\ndef TI(): return tuple(map(int,input().split()))\n# rstrip().decode()\n\nimport numpy as np\n\ndef main():\n\tn,s=MI()\n\tA=LI()\n\n\tli=[0]*(3010)\n\tli=np.array(li)\n\tli[0]=1\n\t#print(li)\n\n\tfor i in A:\n\t\ttmp=li.copy()\n\t\tli*=2\n\t\tli[i:]+=tmp[:3010-i]\n\t\tli%=998244353\n\t\t#print(li)\n\tprint(li[s])\n\n\n\nif __name__ == "__main__":\n\tmain()\n'] | ['Runtime Error', 'Accepted'] | ['s909629092', 's747063365'] | [27420.0, 27476.0] | [228.0, 234.0] | [742, 731] |
p02662 | u600402037 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ['# coding: utf-8\nimport sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nMOD = 998244353\nN, S = lr()\nA = lr()\ndp = np.zeros((N+1, S+1), np.int32) \ndp[0][0] = 1\nfor a in A:\n for i in range(N-1, -1, -1):\n dp[i+1][a:] += dp[i][:-a]', '# coding: utf-8\nimport sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nMOD = 998244353\nN, S = lr()\nA = lr()\ndp = np.zeros(S+1, np.int64)\ndp[0] = 1\nfor a in A:\n prev = dp.copy()\n dp[a:] += dp[:-a]\n dp += prev\n dp %= MOD\n\nanswer = dp[S]\nprint(answer%MOD)\n'] | ['Wrong Answer', 'Accepted'] | ['s338959106', 's352861994'] | [62280.0, 27500.0] | [2208.0, 214.0] | [364, 350] |
p02662 | u611945374 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ['import sys\nsys.setrecursionlimit(5000)\nMOD=998244353\ndef dfs(d,tot,num):\n global A,N,S,how\n if tot==S:\n how[num]+=1\n return\n if d==N:\n return\n if d>0 and A[d]==A[d-1]:\n if tot+A[d]<=S:\n dfs(d+1,tot+A[d],num+1)\n dfs(d+1,tot,num)\n \n \n\nN,S=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort(reverse=True)\nhow=[0]*(N+1)\ndfs(0,0,0)\ncur=1\nres=0\nfor i in range(N,0,-1):\n res+=(how[i]*cur)%MOD\n cur=cur*2%MOD\nprint(res)', 'N,S=map(int,input().split())\nA=list(map(int,input().split()))\n\ndef f(N,S,A):\n MOD=998244353\n dp=[0]*(S+1)\n dp[0]=pow(2,N,MOD)\n div=pow(2,MOD-2,MOD)\n m=0\n for a in A:\n m+=a\n for i in range(min(m,S),a-1,-1):\n dp[i]=(dp[i]+dp[i-a]*div)%MOD\n return dp[S]\n\nprint(f(N,S,A))\n '] | ['Runtime Error', 'Accepted'] | ['s776336912', 's126618924'] | [9036.0, 9384.0] | [23.0, 1470.0] | [491, 318] |
p02662 | u686230543 | 2,000 | 1,048,576 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S. Find the sum of f(T) over all 2^N-1 subsets T of \\{1, 2, \ldots , N \\}. Since the sum can be enormous, print it modulo 998244353. | ['mod = 998244353\nn, s = map(int, input().split())\ndp = np.zeros((n+1, s+1), dtype=int)\ndp[0, 0] = 1\nfor i, a in enumerate(map(int, input().split())):\n dp[i+1] = dp[i] * 2 % mod\n dp[i+1][a:] = (dp[i+1][a:] + dp[i][:-a]) % mod\nprint(dp[-1, -1])', 'mod = 998244353\nn, s = map(int, input().split())\ndp = [[0] * (s + 1) for _ in range(n + 1)]\nfor i, a in enumerate(map(int, input().split())):\n for j in range(s + 1):\n dp[i+1][j] = (dp[i][j] + 2) % mod\n if j >= a:\n dp[i+1][j] = (dp[i+1][j] + dp[i][j-a] + 1) % mod\nprint(dp[-1][-1])', 'import numpy as np\n\nmod = 998244353\nn, s = map(int, input().split())\ndp = np.zeros(s+1, dtype=int)\ndp[0] = 1\nfor a in map(int, input().split()):\n pre_dp = dp\n dp = pre_dp * 2 % mod\n dp[a:] = (dp[a:] + pre_dp[:-a]) % mod\nprint(dp[-1])'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s100656424', 's215925334', 's809927052'] | [9088.0, 207868.0, 27464.0] | [22.0, 2211.0, 279.0] | [243, 292, 236] |
p02675 | u000037600 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['a=int(input())\nb=a%10\nif b==0,1,6,8:\n print("pon")\nelif b==2,4,5,7,9:\n print("hon")\nelse:\n print("bon")', 'a=int(input())\nb=a%10\nif b in [0,1,6,8]:\n print("pon")\nelif b in [2,4,5,7,9]:\n print("hon")\nelse:\n print("bon")'] | ['Runtime Error', 'Accepted'] | ['s586947692', 's799075220'] | [8988.0, 8828.0] | [23.0, 26.0] | [106, 114] |
p02675 | u000579017 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["N = int(input())\n\nif N%10==2 orN%10==4 or N%10==5 or N%10==7 or N%10==9:\n print('hon')\nelif N%10==0 orN%10==1 or N%10==6 or N%10==8:\n print('pon')\nelse:\n print('bon')", 'import math\n \nA,B,H,M=map(int,input().split(" "))\n \nhour=[A*math.cos(math.radians(H*30+M/2)),A*math.sin(math.radians(H*30+M/2))]\nminute =[B*math.cos(math.radians(M*6)),B*math.sin(math.radians(M*6))]\nif (hour[0]>=0 and minute[0]>=0) or (hour[0]<0 and minute[0]<0):\n a=minute[0]-hour[0]\nelse:\n a=abs(minute[0])+abs(hour[0])\n \nif (hour[1]>=0 and minute[1]>=0) or (hour[1]<0 and minute[1]<0):\n b=minute[1]-hour[1]\nelse:\n b=abs(minute[1])+abs(hour[1]) \nprint(\'{:.16f}\'.format(math.sqrt(pow(a,2)+pow(b,2))))', "N = int(input())\n\nif N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9:\n print('hon')\nelif N%10==0 or N%10==1 or N%10==6 or N%10==8:\n print('pon')\nelse:\n print('bon')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s306912457', 's328427863', 's523712228'] | [8908.0, 9188.0, 9180.0] | [21.0, 24.0, 23.0] | [175, 519, 177] |
p02675 | u000842852 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["N = input()\n\nNl = len(N)\n\nx = int(N)%10^Nl\n\nif x==2 or x==4 or x==5 or x==7 or x==9:\n print('hon')\nelif x == 3:\n print('bon')\nelse:\n print('pon')", "N = int(input())\n\nx = N%10\n\n\nif x==2 or x==4 or x==5 or x==7 or x==9:\n print('hon')\nelif x == 3:\n print('bon')\nelse:\n print('pon')\n"] | ['Wrong Answer', 'Accepted'] | ['s424236464', 's285506897'] | [9176.0, 9160.0] | [22.0, 22.0] | [148, 134] |
p02675 | u001464994 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['N=input()\nif len(n)>1:\n N=N[1]\n \nif N in ["2","4","5","7","9"]:\n print("hon")\nelif N == "3":\n print("bon")\nelse:\n print("pon")', 'N=str(input())\nN=N[-1]\n \nif N in ["2","4","5","7","9"]:\n print("hon")\nelif N == "3":\n print("bon")\nelse:\n print("pon")\n'] | ['Runtime Error', 'Accepted'] | ['s363499299', 's839666249'] | [9040.0, 9036.0] | [22.0, 24.0] | [131, 123] |
p02675 | u001547131 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["N = int(input())\n\nif N[-1] == '2':\n print 'hon'\nelif N[-1] == '4':\n print'hon'\nelif N[-1] == '5':\n print'hon'\nelif N[-1] == '7':\n print 'hon'\nelif N[-1] == '9':\n print'hon'\nelif N[-1] == '3':\n print'bon'\nelse:\n print'pon'", "N = str(int(input()))\nif N[-1] == ('2' or '4' or '5' or '7' or '9'):\n print('hon')\nelif N[-1] == ('0' or '1' or '6' or '7'):\n print('pon')\nelse:\n print('bon')\n", "N = str(int(input()))\n\nif N[-1] == '2':\n print('hon')\nelif N[-1] == '4':\n print('hon')\nelif N[-1] == '5':\n print('hon')\nelif N[-1] == '7':\n print ('hon')\nelif N[-1] == '9':\n print('hon')\nelif N[-1] == '3':\n print('bon')\nelse:\n print('pon')\n"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s361195390', 's748821101', 's213646992'] | [8956.0, 9108.0, 9188.0] | [19.0, 21.0, 21.0] | [231, 162, 250] |
p02675 | u001769145 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['# ABC168 A ∴ (Therefore)\n\nn = int(input())\n\n_tmp = n%10\n\nif _tmp == (0 or 1 or 6 or 8):\n print("pon")\nelif _tmp == (2 or 4 or 5 or 7 or 9):\n print("hon")\nelif _tmp == 3:\n print("bon")', '# ABC168 A ∴ (Therefore)\n\nn = int(input())\n\n_tmp = n%10\n\np_list = [0,1,6,8]\nh_list = [2,4,5,7,9]\nb_list = [3]\n\nif _tmp in p_list:\n print("pon")\nelif _tmp in h_list:\n print("hon")\nelif _tmp in b_list:\n print("bon")'] | ['Wrong Answer', 'Accepted'] | ['s855140048', 's641729264'] | [9172.0, 9184.0] | [22.0, 20.0] | [194, 224] |
p02675 | u005469124 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["n = int(input())\nif n[-1]=='2' or n[-1]=='4' or n[-1]=='5' or n[-1]=='7' or n[-1]=='9':\n print('hon')\nelif n[-1]=='3':\n print('bon')\nelse:\n print('pon')", "n=input()\nif n[-1]=='2' or n[-1]=='4' or n[-1]=='5' or n[-1]=='7' or n[-1]=='9':\n print('hon')\nelif n[-1]=='3':\n print('bon')\nelse:\n print('pon')"] | ['Runtime Error', 'Accepted'] | ['s833218325', 's260345003'] | [9116.0, 9112.0] | [25.0, 25.0] | [155, 148] |
p02675 | u005569385 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['import math\nA,B,H,M = map(float,input().split())\nvec = 0\nc = abs((30.0*H + M*0.5) - (M*6.0))\nif c <= 180.0:\n vec = c\nelse:\n vec = 360.0 - c\nans = math.sqrt(A**2 + B**2 - 2.0*A*B*math.cos(vec))\nprint(ans)', 'N = int(input())\nif N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9:\n print("hon")\nelif N%10==0 or N%10==1 or N%10==6 or N%10==8:\n print("pon")\nelif N%10==3:\n print("bon")'] | ['Runtime Error', 'Accepted'] | ['s986875583', 's305108646'] | [9064.0, 8856.0] | [28.0, 26.0] | [209, 184] |
p02675 | u006738234 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['N = str(input())\n\nif(N[-1] == 2 or N[-1] == 4 or N[-1] == 5 or N[-1] == 7 or N[-1] == 9):\n print("hon")\nelif(N[-1] == 0 or N[-1] == 1 or N[-1] == 6 or N[-1] == 8):\n print("pon")\nelse:\n print("bon")\n', 'N = str(input())\n\nif(N[-1] == "2" or N[-1] == "4" or N[-1] == "5" or N[-1] == "7" or N[-1] == "9"):\n print("hon")\nelif(N[-1] == "0" or N[-1] == "1" or N[-1] == "6" or N[-1] == "8"):\n print("pon")\nelif(N[-1] == "3"):\n print("bon")\n'] | ['Wrong Answer', 'Accepted'] | ['s699638281', 's970496477'] | [9116.0, 9116.0] | [24.0, 23.0] | [207, 239] |
p02675 | u007550226 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["n=int(input())\nif n==3:\n print('bon')\nelif n in [0,1,6,8]:\n print('pon')\nelse:\n print('hon')", "n=int(input())%10\nif n==3:\n print('bon')\nelif n in [0,1,6,8]:\n print('pon')\nelse:\n print('hon')\n"] | ['Wrong Answer', 'Accepted'] | ['s018635689', 's837058089'] | [9100.0, 8888.0] | [29.0, 30.0] | [95, 99] |
p02675 | u007808656 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["def sol()\n last=int(input()[-1])\n if last in [2,4,5,7,9]:\n return 'hon'\n if last in [0,1,6,8]:\n return 'pon'\n return 'bon'\n\nsol()", "def sol():\n last=int(input()[-1])\n if last in [2,4,5,7,9]:\n return 'hon'\n if last in [0,1,6,8]:\n return 'pon'\n return 'bon'\n\nprint(sol())"] | ['Runtime Error', 'Accepted'] | ['s346176433', 's934144123'] | [8892.0, 9176.0] | [20.0, 23.0] | [139, 147] |
p02675 | u007886915 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['# -*- coding: utf-8 -*-\nimport sys\n\nimport fractions\nimport copy\nimport bisect\nimport math\nimport numpy as np\nimport itertools\nfrom itertools import combinations_with_replacement\n\n#w=input()\nfrom operator import itemgetter\nfrom sys import stdin\n\nfrom operator import mul\nfrom functools import reduce\nfrom collections import Counter\n#from collections import deque\n\n#input = stdin.readline\n\n\nj=0\nk=0\nn=3\nr=1\na=[0]\n#n=int(input())\n#r=int(input())\n#print(M)\n#A=int(input())\n#B=int(input())\n#print(N)\n"1行1つの整数を入力を取得し、整数と取得する"\n\n\n\n#print(number_list)\n"12 21 332 とか入力する時に使う"\n"1行に複数の整数の入力を取得し、整数として扱う"\n\n\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\n\n\n\n\n\n\n\n\n#print(type(brray[0][0]))\n#print(brray)\n\n"列数に関して自由度の高いint型の値を入力するタイプの行列"\n\n\n\'\'\'\ntable = [[int(i) for i in input().split()] for m in range(m)]\n\nprint(type(N))\nprint(N)\nprint(type(M))\nprint(M)\n\nprint(type(table))\nprint(table)\n\'\'\'\n\n\n\n\n#s=input()\n\n#print(a[0])\n#print([a])\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#a= stdin.readline().rstrip()\n#print(a.upper())\n"aという変数に入っているものを大文字にして出力"\n\n\n\n\n\n#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]\n#a = [[int(c) for c in l.strip()] for l in sys.stdin]]\n#print(a)\n\n\n\n##############################################################################################\n##############################################################################################\n#under this line explains example calculation\n\n\n\n\n\n#nCr combination\n\'\'\'\ndef cmb(n,r):\n #When n < r , this function isn\'t valid\n r= min(n-r,r)\n #print(n,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n-r, -1))\n #flochart mul(n,n-1)=x\n #next mul(x,n-2)........(n-r+1,n-r)\n #mul read a,b and returns a*b\n\n under = reduce(mul, range(1, r+1))\n #print(over, under)\n #reduce is applied mul(1,2)=2\n #next mul(2,3)=6\n #next mul(6,4)=4.........last(r!,r+1)=r+1!\n\n return over // under\n #// is integer divide\n #calc example 5C2\n #over=5*4*3\n #under=3*2*1\na = cmb(n, r)\n#print(a)\n\'\'\'\n\n\n\n\n\n\n\n\n\n#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]\n#print(A)\n\n#A.insert(index, 5)\n#print(index)\n#print(A)\n\n\n\n\n\ndef is_prime(n):\n if n == 1: return False\n\n for k in range(2, int(np.sqrt(n)) + 1):\n \n if n % k == 0:\n return False\n \n return True\n\n\n\n\ndef factorial(x, mod=10**9+7):\n # x!\n \n # ex) factorial(5) = 120\n tmp = 1\n for i in range(1, x+1):\n tmp = (tmp * i) % mod\n return tmp\n \'\'\'\n Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.\n But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.\n \'\'\'\n\n\n########################################################################\n########################################################################\n\n#print(b2)\n\n\n\n#print(b3)\n\n\ndef main():\n n=3\n steps=0\n state=0\n w=1\n j=0\n k=0\n \n #n=int(input())\n \n #a,b=map(int, input().split(" "))\n \n \n s=input()\n a=[int(i) for i in s]\n if a[-1]== 2 or 4 or 5 or 7 or 9:\n print(\'hon\')\n sys.exit()\n if a[-1]== 0 or 1 or 6 or 8:\n print(\'pon\')\n sys.exit()\n if a[-1]== 3:\n print(\'bon\')\n sys.exit()\n\n #print(a)\n \n #print(brray)\n\n\n for i in range(1,n+1,2):\n pass\n #print(i)\n\n l = [\'aaa\', \'bbb\', \'ccc\']\n x=l.index(\'aaa\')\n #s = \'\'.join(l)\n \n #print(s)\n \n\n #if state in known_states and not flag: # state => 2 steps => 5\n \n #print(f\'steps: {steps}, state: {state}\')\n \n\n \n \n \n \n DP = np.zeros(w+1, dtype=int)\n exdp=np.zeros((3,4)) \n \n \n # a, b = map(int, input().split())\n #dp[i][0] += [a]\n \n # dp[i] += [a]\n # dp[i] += [b]\n \n \n #print(dp)\n\n\n \n #print(brray)\n\n\n\n \n pin_l=["x" for i in range(10)]\n #print(pin_l)\n\n ls = ["a", "b", "c", "d", "e"]\n\n\n #print(ls[2:5])\n \n\n #print(ls[:-3])\n \n\n #print(ls[:4:2])\n \n \n \n #print(ls[::2])\n \n\nif __name__ == "__main__":\n main()\n', '# -*- coding: utf-8 -*-\nimport sys\n\nimport fractions\nimport copy\nimport bisect\nimport math\nimport numpy as np\nimport itertools\nfrom itertools import combinations_with_replacement\n\n#w=input()\nfrom operator import itemgetter\nfrom sys import stdin\n\nfrom operator import mul\nfrom functools import reduce\nfrom collections import Counter\n#from collections import deque\n\n#input = stdin.readline\n\n\nj=0\nk=0\nn=3\nr=1\na=[0]\n#n=int(input())\n#r=int(input())\n#print(M)\n#A=int(input())\n#B=int(input())\n#print(N)\n"1行1つの整数を入力を取得し、整数と取得する"\n\n\n\n#print(number_list)\n"12 21 332 とか入力する時に使う"\n"1行に複数の整数の入力を取得し、整数として扱う"\n\n\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\n\n\n\n\n\n\n\n\n#print(type(brray[0][0]))\n#print(brray)\n\n"列数に関して自由度の高いint型の値を入力するタイプの行列"\n\n\n\'\'\'\ntable = [[int(i) for i in input().split()] for m in range(m)]\n\nprint(type(N))\nprint(N)\nprint(type(M))\nprint(M)\n\nprint(type(table))\nprint(table)\n\'\'\'\n\n\n\n\n#s=input()\n\n#print(a[0])\n#print([a])\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#a= stdin.readline().rstrip()\n#print(a.upper())\n"aという変数に入っているものを大文字にして出力"\n\n\n\n\n\n#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]\n#a = [[int(c) for c in l.strip()] for l in sys.stdin]]\n#print(a)\n\n\n\n##############################################################################################\n##############################################################################################\n#under this line explains example calculation\n\n\n\n\n\n#nCr combination\n\'\'\'\ndef cmb(n,r):\n #When n < r , this function isn\'t valid\n r= min(n-r,r)\n #print(n,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n-r, -1))\n #flochart mul(n,n-1)=x\n #next mul(x,n-2)........(n-r+1,n-r)\n #mul read a,b and returns a*b\n\n under = reduce(mul, range(1, r+1))\n #print(over, under)\n #reduce is applied mul(1,2)=2\n #next mul(2,3)=6\n #next mul(6,4)=4.........last(r!,r+1)=r+1!\n\n return over // under\n #// is integer divide\n #calc example 5C2\n #over=5*4*3\n #under=3*2*1\na = cmb(n, r)\n#print(a)\n\'\'\'\n\n\n\n\n\n\n\n\n\n#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]\n#print(A)\n\n#A.insert(index, 5)\n#print(index)\n#print(A)\n\n\n\n\n\ndef is_prime(n):\n if n == 1: return False\n\n for k in range(2, int(np.sqrt(n)) + 1):\n \n if n % k == 0:\n return False\n \n return True\n\n\n\n\ndef factorial(x, mod=10**9+7):\n # x!\n \n # ex) factorial(5) = 120\n tmp = 1\n for i in range(1, x+1):\n tmp = (tmp * i) % mod\n return tmp\n \'\'\'\n Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.\n But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.\n \'\'\'\n\n\n########################################################################\n########################################################################\n\n#print(b2)\n\n\n\n#print(b3)\n\n\ndef main():\n n=3\n steps=0\n state=0\n w=1\n j=0\n k=0\n \n #n=int(input())\n \n #a,b=map(int, input().split(" "))\n \n \n s=input()\n a=[int(i) for i in s]\n #print(a[-1])\n if a[-1]==2 or a[-1]==4 or a[-1]==5 or a[-1]==7 or a[-1]==9:\n print(\'hon\')\n sys.exit()\n elif a[-1]== 0 or a[-1]==1 or a[-1]==6 or a[-1]==8:\n print(\'pon\')\n sys.exit()\n elif a[-1]== 3:\n print(\'bon\')\n sys.exit()\n\n #print(a)\n \n #print(brray)\n\n\n for i in range(1,n+1,2):\n pass\n #print(i)\n\n l = [\'aaa\', \'bbb\', \'ccc\']\n x=l.index(\'aaa\')\n #s = \'\'.join(l)\n \n #print(s)\n \n\n #if state in known_states and not flag: # state => 2 steps => 5\n \n #print(f\'steps: {steps}, state: {state}\')\n \n\n \n \n \n \n DP = np.zeros(w+1, dtype=int)\n exdp=np.zeros((3,4)) \n \n \n # a, b = map(int, input().split())\n #dp[i][0] += [a]\n \n # dp[i] += [a]\n # dp[i] += [b]\n \n \n #print(dp)\n\n\n \n #print(brray)\n\n\n\n \n pin_l=["x" for i in range(10)]\n #print(pin_l)\n\n ls = ["a", "b", "c", "d", "e"]\n\n\n #print(ls[2:5])\n \n\n #print(ls[:-3])\n \n\n #print(ls[:4:2])\n \n \n \n #print(ls[::2])\n \n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s059390819', 's514476462'] | [27136.0, 27156.0] | [112.0, 107.0] | [11508, 11578] |
p02675 | u008022357 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['n = input()\nprint(n[-1])\n\nif(n[-1] == "3"):\n\tprint("bon")\nelif(n[-1] == "0","1","6","8"):\n\tprint("pon")\nelse:\n\tprint("hon")', 'n = input()\nprint(n[-1])\n\nif(n[-1] == "3"):\n\tprint("bon")\nelif(n[-1] == "0" or "1" or "6" or "8"):\n\tprint("pon")\nelse:\n\tprint("hon")', 'n = input()\n\nif(n[-1] == "3"):\n\tprint("bon")\nelif(n[-1] in {"0","1","6","8"}):\n\tprint("pon")\nelse:\n\tprint("hon")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s379554879', 's667891454', 's017333117'] | [8992.0, 9048.0, 9108.0] | [24.0, 24.0, 20.0] | [123, 132, 112] |
p02675 | u008382444 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['N = int(input())\n\na = N%10\n\nif a == 2 or 4 or 5 or 7 or 9:\n print("hon")\nelif a == 3:\n print("bon")\nelse:\n print("pon")', 'N = int(input())\n\na = N%10\n\nif a == 0 or a==1 or a==6 or a==8:\n print("pon")\nelif a == 3:\n print("bon")\nelse:\n print("hon")'] | ['Wrong Answer', 'Accepted'] | ['s997483508', 's157789928'] | [9156.0, 9100.0] | [24.0, 20.0] | [122, 126] |
p02675 | u010519022 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["x = int(input()) % 10\nif x == 6, 1, 8:\n\tprint('pon')\nif x == 3:\n\tprint('bon')\nelse:\n\tprint('hon')", "x = int(input()) % 10\nif x == 6 or x == 1 or x== 8 or x == 0:\n\tprint('pon')\nelif x == 3:\n\tprint('bon')\nelse:\n\tprint('hon')"] | ['Runtime Error', 'Accepted'] | ['s523559798', 's709928817'] | [9008.0, 9168.0] | [22.0, 21.0] | [97, 122] |
p02675 | u011202375 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['N = input()\nprint(N[-1])\nif N[-1]=="3":\n print("bon")\nelif N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8":\n print("pon")\nelse:\n print("hon")', 'N = input()\nif N[-1]=="3":\n print("bon")\nelif N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8":\n print("pon")\nelse:\n print("hon")'] | ['Wrong Answer', 'Accepted'] | ['s498708750', 's187895127'] | [9108.0, 9108.0] | [27.0, 28.0] | [155, 142] |
p02675 | u013249043 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['import math\nA, B, H, M = map(int, input().split())\n\nPI = math.pi\nradA = (2.0 * PI * (H + M / 60.0)) / 12.0\nradB = (2.0 * PI * M) / 60.0\n\n\nprint(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(radA-radB)*math.sin(radA-radB)))', 'import math\nA, B, H, M = map(float, input().split())\n\nPI = math.pi\nradA = (2.0 * PI * (H + M / 60.0)) / 12.0\nradB = (2.0 * PI * M) / 60.0\nprint(math.hypot(A * math.cos(radA) - B * math.cos(radB),\n A * math.sin(radA) - B * math.sin(radB)))\n', 'import math\nA, B, H, M = map(int, input().split())\n\ndegA = H * 30 + M * 0.5\ndegB = M * 6\ndeg = math.radians(degA-degB)\nprint(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(deg)))', 'A, B, H, M = map(float, input().split())\n\nimport math\nPI = math.pi\nradA = (2.0 * PI * (H + M / 60.0)) / 12.0\nradB = (2.0 * PI * M) / 60.0\nprint(math.hypot(A * math.cos(radA) - B * math.cos(radB),\n A * math.sin(radA) - B * math.sin(radB)))', 'A, B, H, M = map(float, input().split())\n\nimport math\nPI = math.pi\nradA = (2.0 * PI * (H + M / 60.0)) / 12.0\nradB = (2.0 * PI * M) / 60.0\nprint(math.hypot(A * math.cos(radA) - B * math.cos(radB),\n A * math.sin(radA) - B * math.sin(radB)))', 'import math\nA, B, H, M = map(float, input().split())\n\nPI = math.pi\nradA = (2.0 * PI * (H + M / 60.0)) / 12.0\nradB = (2.0 * PI * M) / 60.0\nprint(math.hypot(A * math.cos(radA) - B * math.cos(radB),\n A * math.sin(radA) - B * math.sin(radB)))\n', 'import math\nA, B, H, M = map(float, input().split())\n\nPI = math.pi\nradA = (2.0 * PI * (H + M / 60.0)) / 12.0\nradB = (2.0 * PI * M) / 60.0\n\n\nprint(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(radA-radB)*math.sin(radA-radB)))', 'import math\nA, B, H, M = map(float, input().split())\n\nPI = math.pi\nradA = (2.0 * PI * (H + M / 60.0)) / 12.0\nradB = (2.0 * PI * M) / 60.0\nprint(math.hypot(A * math.cos(radA) - B * math.cos(radB), A * math.sin(radA) - B * math.sin(radB)))\n', "N = input()\n\nlast = list(N)[-1]\nif int(last) in (2,4,5,7,9):\n print('hon')\nelif int(last) in (0,1,6,8):\n print('pon')\nelse:\n print('bon')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s001878611', 's157474626', 's182251775', 's301214346', 's481063019', 's597794524', 's948894046', 's978233747', 's834157600'] | [9088.0, 9092.0, 9024.0, 8896.0, 9012.0, 9020.0, 8976.0, 9064.0, 9124.0] | [22.0, 23.0, 21.0, 26.0, 26.0, 21.0, 23.0, 22.0, 27.0] | [332, 255, 170, 254, 254, 255, 334, 238, 146] |
p02675 | u013513417 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['S=input()\nif int(S[2])==3:\n print("bon")\nelif int(S[2])==0 or int(S[2])==1 or int(S[2])==6 or int(S[2])==8:\n print("pon")\nelse:\n print("hon")', 'S=input()\nif int(S[2])==3:\n print("bon")\nelif int(S[2])==0 or int(S[2])==1 or int(S[2])==6 or int(S[2])==8:\n print("pon")\nelse:\n print("hon")', '# coding: utf-8\n# Your code here!\n\nS=int(input())%10\nS=S%10\n\nif S==3:\n print("bon")\nelif S==0 or S==1 or S==6 or S==8:\n print("pon")\nelse:\n print("hon")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s422731440', 's710295541', 's625776005'] | [9088.0, 8980.0, 9148.0] | [24.0, 26.0, 22.0] | [150, 150, 161] |
p02675 | u015416155 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["i = int(input())\n\nwhile i != 0:\n i = i % 10\n if i == 0:\n print('pon')\n elif i == 1:\n print('pon')\n elif i == 2:\n print('hon')\n elif i == 3:\n print('bon')\n elif i == 4:\n print('hon')\n elif i == 5:\n\tprint('hon')\n elif i == 6:\n\tprint('pon')\n elif i == 7:\n\tprint('hon')\n elif i == 8:\n\tprint('pon')\n elif i == 9:\n\tprint('hon')\n\n i = int(input())\n", "i = int(input())\ni = i % 10\nif i == 0:\n print('pon')\nelif i == 1:\n print('pon')\nelif i == 2:\n print('hon')\nelif i == 3:\n print('bon')\nelif i == 4:\n print('hon')\nelif i == 5:\n print('hon')\nelif i == 6:\n print('pon')\nelif i == 7:\n print('hon')\nelif i == 8:\n print('pon')\nelif i == 9:\n print('hon')\n"] | ['Runtime Error', 'Accepted'] | ['s496797086', 's560214689'] | [9032.0, 9124.0] | [20.0, 22.0] | [412, 326] |
p02675 | u018168283 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['a = input()\n\nif a[len(a)-1] == 3:\n print("bon")\nelif a[len(a)-1] == 0 or a[len(a)-1] == 1 or a[len(a)-1] == 6 or a[len(a)-1] == 8:\n print("pon")\nelse:\n print("hon")', 'a = input()\nif a[len(a)-1] == "3":\n print("bon")\nelif a[len(a)-1] == "0" or a[len(a)-1] == "1" or a[len(a)-1] == "6" or a[len(a)-1] == "8":\n print("pon")\nelse:\n print("hon")'] | ['Wrong Answer', 'Accepted'] | ['s134670190', 's060823350'] | [8984.0, 9020.0] | [21.0, 23.0] | [167, 176] |
p02675 | u020604402 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['N = list(input())\nif N[:-1] == "3":\n print("bon")\nelif N[:-1] in ["0","1","6","8"]:\n print("pon")\nelse :\n print("hon")\n', 'N = list(input())\nif N[-1] == "3":\n print("bon")\nelif N[-1] in ["0","1","6","8"]:\n print("pon")\nelse :\n print("hon")\n'] | ['Wrong Answer', 'Accepted'] | ['s232995846', 's149243808'] | [8996.0, 9032.0] | [20.0, 23.0] | [128, 126] |
p02675 | u020798319 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['N = map(int, input())\nif N%10 == 2 or N%10 == 4 or N%2== 5 or N%10 == 7 or N%10 == 9:\n print("hon")\nelif N%10 == 0 or N%10 == 1 or N%10 == 6 or N%10 == 8:\n print("pon")\nelif N%10 == 3:\n print("bon")\n\n ', 'N = map(int, input().split())\nif N%10 == 2 or N%10 == 4 or N%2== 5 or N%10 == 7 or N%10 == 9:\n print("hon")\nelif N%10 == 0 or N%10 == 1 or N%10 == 6 or N%10 == 8:\n print("pon")\nelif N%10 == 3:\n print("bon")', 'N = int(input())\na = N % 10\nif a == 2 or a == 4 or a == 5 or a == 7 or a == 9 :\n print ("hon")\nelif a == 0 or a == 1 or a == 6 or a == 8 :\n print ("pon")\nelse :\n print ("bon")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s239626255', 's517787122', 's247903365'] | [9008.0, 9060.0, 9100.0] | [23.0, 31.0, 29.0] | [204, 209, 178] |
p02675 | u021086907 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["N= int(input())\nn = N % 10\nprint(n)\nif n == 2 or n==4 or n ==5 or n == 7 or n == 9:\n print('hon')\nelif n == 0 or n ==1 or n == 6 or n == 8:\n print('pon')\nelif n == 3:\n print('bon')\n", "N= int(input())\nn = N % 10\nif n == 2 or n==4 or n ==5 or n == 7 or n == 9:\n print('hon')\nelif n == 0 or n ==1 or n == 6 or n == 8:\n print('pon')\nelif n == 3:\n print('bon')"] | ['Wrong Answer', 'Accepted'] | ['s758958511', 's163396148'] | [9164.0, 9172.0] | [27.0, 27.0] | [184, 174] |
p02675 | u021386507 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['k=input()\nn=int(k[len(k)-1])\nif(n%10==3):\n print("bon")\nelif(n%10==0|n%10==1|n%10==6|n%10==8):\n print("pon")\nelse:\n print("hon")', 'n=int(input())\nif(n%10==3):\n print("bon")\nelif(n%10==0 or n%10==1 or n%10==6 or n%10==8):\n print("pon")\nelse:\n print("hon")'] | ['Wrong Answer', 'Accepted'] | ['s460966998', 's590512968'] | [9168.0, 9172.0] | [25.0, 21.0] | [137, 132] |
p02675 | u021521597 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['def main():\n N = list(map(int,input().split()))[0]\n if N == 3:\n ans = "bon"\n elif N == 0 or N == 1 or N == 6 or N == 8:\n ans = "pon"\n else:\n ans = "hon"\n\n return ans\nif __name__ == \'__main__\':\n print(main())', 'def main():\n M = list(map(str,input().split()))[0]\n N = int(M[-1])\n if N == 3:\n ans = "bon"\n elif N == 0 or N == 1 or N == 6 or N == 8:\n ans = "pon"\n else:\n ans = "hon"\n\n return ans\nif __name__ == \'__main__\':\n print(main())'] | ['Wrong Answer', 'Accepted'] | ['s315607291', 's672359281'] | [9180.0, 9120.0] | [24.0, 25.0] | [222, 239] |
p02675 | u021849254 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['x=input()\n\n\nx=int(a[0])\n\nif x%10== 2 or 4 or 5 or 7 or 9:\n print("hon")\nelif x%10== 0 or 1 or 6 or 8:\n print("pon")\nelse x%10== 3:\n print("hon")\n', 'a=input()\n\n\nx=int(a[0])\n\nif x%10== 2 or 4 or 5 or 7 or 9:\n print("hon")\nelif x%10== 0 or 1 or 6 or 8:\n print("pon")\nelse :\n print("hon")\n', 'a=int(input())\n\na = a%10\n\nif a== 2 or a==4 or a==5 or a==7 or a==9:\n print("hon")\nelif a== 0 or a==1 or a==6 or a==8:\n print("pon")\nelse :\n print("bon")'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s799584556', 's887059044', 's216517124'] | [8872.0, 9168.0, 9176.0] | [22.0, 22.0, 28.0] | [148, 140, 155] |
p02675 | u021933148 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["l_hon = [2,3,5,7,9]\nl_pon = [0,1,6,8]\nl_bon = [3]\n\ns = input()\n\nif s[-1] in l_hon:\n print('hon')\nelif s[-1] in l_pon:\n print('pon')\nelse:\n print('bon')", "l_hon = [2,4,5,7,9]\nl_pon = [0,1,6,8]\nl_bon = [3]\n\ns = int(input()[-1])\n\nif s in l_hon:\n print('hon')\nelif s in l_pon:\n print('pon')\nelse:\n print('bon')"] | ['Wrong Answer', 'Accepted'] | ['s899506536', 's435075642'] | [8912.0, 9176.0] | [21.0, 22.0] | [154, 155] |
p02675 | u026155812 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["N = input()\nhon = [2,4,5,7,9]\npon = [0,1,6,8]\n\nif int(N[-1]) in hon:\n print('hon')\nelif int(N[-1]) in pon:\n print(pon)\nelse:\n print('bon')", "N = input()\nhon = [2,4,5,7,9]\npon = [0,1,6,8]\n\nif int(N[-1]) in hon:\n print('hon')\nelif int(N[-1]) in pon:\n print('pon')\nelse:\n print('bon')"] | ['Wrong Answer', 'Accepted'] | ['s847307836', 's064279832'] | [9124.0, 9172.0] | [30.0, 33.0] | [147, 149] |
p02675 | u031679985 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["n=int(input())\na=n%10\nif a=2 or a=4 or a=5 or a=7 or a=9:\n print('hon')\nelif a=0 or a=1 or a=6 or a=8:\n print('pon')\nelif a=3:\n print('bon')\n", "n=int(input())\na=n%10\nif a==2 or a==4 or a==5 or a==7 or a==9:\n print('hon')\nelif a==0 or a==1 or a==6 or a==8:\n print('pon')\nelif a==3:\n print('bon')"] | ['Runtime Error', 'Accepted'] | ['s006096614', 's164910847'] | [8880.0, 9112.0] | [23.0, 20.0] | [144, 153] |
p02675 | u032625182 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['import sys\nn = input()\np=3\na=n/100\nn=n-a\nb=n/10\nn=n-b\nc=n/\nif(p==0):\n print(hon)\nelse if(p==1):\n print(pon)\nelse if(p==2):\n print(bon)\n', 'import sys\nimport math\nm = input()\nn= int(m)\na=math.floor(n/100)\nn=n-a*100\nb=math.floor(n/10)\nn=n-b*10\nif n==2 or 4 or 5 or 7 or 9:\n print("hon")\nelif n==0 or 1 or 6 or 8:\n print("pon")\nelif n==3:\n print("bon")', 'import sys\nN = int(input())\nn=N%10\nif n==2 or n==4 or n==5 or n==7 or n==9:\n print("hon")\nelif n==0 or n==1 or n==6 or n==8:\n print("pon")\nelif n==3:\n print("bon")'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s180312821', 's576960109', 's654815385'] | [9016.0, 9088.0, 9164.0] | [23.0, 19.0, 22.0] | [144, 219, 172] |
p02675 | u032955959 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['n=int(input())\nl=n%10\nif l==0 or l==1 or l==6 or l==8:\n print("hon")\nelif l==3:\n print(\'bon\')\nelse:\n print("hon")', 'n=int(input())\nl=n%10\nif l==0 or l==1 or l==6 or l==8:\n print("pon")\nelif l==3:\n print(\'bon\')\nelse:\n print("hon")\n'] | ['Wrong Answer', 'Accepted'] | ['s827090496', 's284630831'] | [9160.0, 9156.0] | [23.0, 22.0] | [116, 117] |
p02675 | u033602950 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['import sys\n\n#import copy\n#from collections import deque, Counter, defaultdict\n#from fractions import gcd\n\n#import itertools\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n\ndef ri():\n return list(map(int, input().split()))\ndef rs():\n return list(input().strip())\n\nn = str(input())\nlst = n[-1]\n\nif lst == ("2"):\n print("hon")\nif lst == ("4"):\n print("hon")\nif lst == ("5"):\n print("hon")\nif lst == ("7"):\n print("hon")\nif lst == ("9"):\n print("hon")\n\nif lst =="3":\n print("bon")\nif lst =="0":\n print("pon")\n \nif lst =="1":\n print("pon")\n \nif lst =="6":\n print("pon")\n \nif lst =="8":\n print("pon")', 'import sys\n\n#import copy\n#from collections import deque, Counter, defaultdict\n#from fractions import gcd\n\n#import itertools\n#input = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n\ndef ri():\n return list(map(int, input().split()))\ndef rs():\n return list(input().strip())\n\nn = str(input())\nlst = n[-1]\n\nif lst == ("2"):\n print("hon")\nif lst == ("4"):\n print("hon")\nif lst == ("5"):\n print("hon")\nif lst == ("7"):\n print("hon")\nif lst == ("9"):\n print("hon")\n\nif lst =="3":\n print("bon")\nif lst =="0":\n print("pon")\n \nif lst =="1":\n print("pon")\n \nif lst =="6":\n print("pon")\n \nif lst =="8":\n print("pon")'] | ['Wrong Answer', 'Accepted'] | ['s956418320', 's697183648'] | [9164.0, 9032.0] | [22.0, 24.0] | [674, 675] |
p02675 | u034777138 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['N = int(input())\n\nans = N % 10\n\nif ans == 2 or ans == 4 or ans == 5 or ans == 6 or ans == 7:\n print("hon")\nelif ans == 0 or ans == 1 or ans == 6 or ans == 8:\n print("pon")\nelse:\n print("bon")', 'N = int(input())\n\nans = N % 10\n\nif ans == 2 or ans == 4 or ans == 5 or ans == 7or ans == 9:\n print("hon")\nelif ans == 0 or ans == 1 or ans == 6 or ans == 8:\n print("pon")\nelse:\n print("bon")'] | ['Wrong Answer', 'Accepted'] | ['s860400846', 's098878244'] | [9176.0, 9092.0] | [29.0, 27.0] | [200, 199] |
p02675 | u036340997 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["from math import gcd\nmod = 10**9+7\nn = int(input())\ndicn = {}\ndicp = {}\ndicz = {'a': 0, 'b': 0, 'z': 0}\nfor i in range(n):\n a, b = map(int, input().split())\n if a == 0 and b == 0:\n dicz['z'] += 1\n else:\n g = gcd(a,b)\n a //= g\n b //= g\n if a < 0:\n a *= -1\n b *= -1\n elif a == 0 and b < 0:\n b *= -1\n if a * b > 0:\n if a in dicp:\n if b in dicp[a]:\n dicp[a][b] += 1\n else:\n dicp[a][b] = 1\n else:\n dicp[a] = {b: 1}\n elif a * b < 0:\n if b in dicn:\n if a in dicn[b]:\n dicn[b][a] += 1\n else:\n dicn[b][a] = 1\n else:\n dicn[b] = {a: 1}\n else:\n if a == 0:\n dicz['a'] += 1\n else:\n dicz['b'] += 1\n\nans = 1\n\nfor a in dicp:\n for b in dicp[a]:\n if -a in dicn:\n if b in dicn[-a]:\n ans *= (pow(2, dicp[a][b], mod) + pow(2, dicn[-a][b], mod) - 1)\n dicn[-a][b] = 0\n else:\n ans *= pow(2, dicp[a][b], mod)\n else:\n ans *= pow(2, dicp[a][b], mod)\n ans %= mod\n\nfor b in dicn:\n for a in dicn[b]:\n ans *= pow(2, dicn[b][a], mod)\n ans %= mod\n \nif dicz['a'] > 0 and dicz['b'] > 0:\n ans *= pow(2,dicz['a'],mod) + pow(2,dicz['b'],mod) - 1\nelif dicz['a'] > 0:\n ans *= pow(2,dicz['a'],mod)\nelif dicz['b'] > 0:\n ans *= pow(2,dicz['b'],mod)\n \nans += pow(2,dicz['z'],mod)\nprint((ans-1)%mod)\n", "from math import gcd\nmod = 10**9+7\nn = int(input())\ndicn = {}\ndicp = {}\ndicz = {'a': 0, 'b': 0, 'z': 0}\nfor i in range(n):\n a, b = map(int, input().split())\n if a == 0 and b == 0:\n dicz['z'] += 1\n else:\n g = gcd(a,b)\n a //= g\n b //= g\n if a < 0:\n a *= -1\n b *= -1\n elif a == 0 and b < 0:\n b *= -1\n if a * b > 0:\n if a in dicp:\n if b in dicp[a]:\n dicp[a][b] += 1\n else:\n dicp[a][b] = 1\n else:\n dicp[a] = {b: 1}\n elif a * b < 0:\n if b in dicn:\n if a in dicn[b]:\n dicn[b][a] += 1\n else:\n dicn[b][a] = 1\n else:\n dicn[b] = {a: 1}\n else:\n if a == 0:\n dicz['a'] += 1\n else:\n dicz['b'] += 1\n\nans = 1\n\nfor a in dicp:\n for b in dicp[a]:\n if -a in dicn:\n if b in dicn[-a]:\n ans *= (pow(2, dicp[a][b], mod) + pow(2, dicn[-a][b], mod) - 1)\n dicn[-a][b] = 0\n else:\n ans *= pow(2, dicp[a][b], mod)\n else:\n ans *= pow(2, dicp[a][b], mod)\n ans %= mod\n\nfor b in dicn:\n for a in dicn[b]:\n ans *= pow(2, dicn[b][a], mod)\n ans %= mod\n \nif dicz['a'] > 0 and dicz['b'] > 0:\n ans *= pow(2,dicz['a'],mod) + pow(2,dicz['b'],mod) - 1\nelif dicz['a'] > 0:\n ans *= pow(2,dicz['a'],mod)\nelif dicz['b'] > 0:\n ans *= pow(2,dicz['b'],mod)\n \nans += dicz['z']\nprint((ans-1)%mod)\n", "x = int(input()[-1])\nif x in [2,4,5,7,9]:\n print('hon')\nelif x == 3:\n print('bon')\nelse:\n print('pon')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s387165750', 's961665644', 's363291093'] | [9240.0, 9304.0, 9192.0] | [25.0, 21.0, 22.0] | [1381, 1370, 105] |
p02675 | u037754315 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["n = int(input())\n\nif n%10 == [2, 4, 5, 7, 9] :\n print('hon')\nelif n%10 == [0, 1, 6, 8] :\n print('pon')\nelif n%10 == [3] :\n print('bon')", "n = int(input())\n\nif n%10 in [2, 4, 5, 7, 9] :\n print('hon')\nelif n%10 in [0, 1, 6, 8] :\n print('pon')\nelif n%10 in [3] :\n print('bon')"] | ['Wrong Answer', 'Accepted'] | ['s957657430', 's358305937'] | [9164.0, 9148.0] | [21.0, 21.0] | [144, 144] |
p02675 | u038404105 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['import math\nfrom collections import deque\n\nN = int(input())\n\na = []\nb = []\nfor i in range(N):\n i1, i2 = map(int, input().split())\n g = math.gcd(i1,i2)\n if g == 0:\n a.append(i1)\n b.append(i2)\n continue\n x = i1 // g\n y = i2 // g\n if x < 0:\n x = - x\n y = - y \n a.append(x)\n b.append(y)\n\nP = {}\nfor i in range(N):\n if b[i] < 0:\n tmp = b[i]\n b[i] = a[i]\n a[i] = - tmp\n sgn = 1\n elif a[i] == 0:\n a[i] = b[i]\n b[i] = 0\n sgn = 1\n else :\n sgn = 0\n\n if (a[i],b[i]) in P:\n P[(a[i],b[i])][sgn]=P[(a[i],b[i])][sgn] + 1\n elif sgn == 0 :\n P[(a[i],b[i])]=[1,0]\n else :\n P[(a[i],b[i])]=[0,1]\n \n\nMOD = 1000000007\na1 = 1 \nans0=0\nfor k in P:\n if k == (0,0):\n ans0 = P[k][0]\n else:\n a1 = a1*(pow(2,P[k][0],MOD)+pow(2,P[k][1],MOD) - 1) % MOD\n\nif ans0 != 0:\n ans = ans0 + a1 -1\nelse:\n ans = a1 -1\nprint(ans%MOD)\n\n', "N = int(input()) % 10\n\nif (N == 3):\n print('bon')\nelif (N == 0 or N == 1 or N == 6 or N == 8):\n print('pon')\nelse :\n print('hon')"] | ['Runtime Error', 'Accepted'] | ['s130185114', 's884978150'] | [9428.0, 9112.0] | [24.0, 20.0] | [977, 138] |
p02675 | u038819082 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ["N=int(input())\nc=c%10\nif c==2 or c==4 or c==5 or c==7 or c==9:\n print('hon')\nelif c==0 or c==1 or c==6 or c==8:\n print('pon')\nelse:\n print('bon')\n ", "N=int(input()[-1])\nif N==3:\n print('bon')\nelif N in (0,1,6,8):\n print('pon')\nelse:\n print('hon')"] | ['Runtime Error', 'Accepted'] | ['s472769830', 's886141203'] | [9016.0, 9112.0] | [25.0, 24.0] | [155, 99] |
p02675 | u040642458 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['N = int(input())\na = N[-1]\nif a="0","1","6","8":\n print("pon")\n elif a="3":\n print("bon")\n else:\n print("hon")', 'N = int(input())\na = N[-1]\nif a in [0,1,6,8]:\n print("pon")\nelif a=="3":\n print("bon")\nelse:\n print("hon")\n', 'N = int(input())\na = N[-1]\nif a="0","1","6","8":\n print("pon")\nelif a="3":\n print("bon")\nelse:\n print("hon")\n', "s =int( input())\na = s[-1]\nif a in [2, 4, 5, 7, 9]:\n print('hon')\nelif a in [0, 1, 6, 8]:\n print('pon')\nelse:\n print('bon')", 'N = int(input())\na = N[-1]\nif a in [0,1,6,8]:\n print("pon")\nelif a in [3]:\n print("bon")\nelse:\n print("hon")\n', "s =int( input()[-1])\nif s in [2, 4, 5, 7, 9]:\n print('hon')\nelif s in [0, 1, 6, 8]:\n print('pon')\nelse:\n print('bon')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s039563516', 's218208093', 's381390899', 's455572220', 's584071120', 's864300888'] | [8816.0, 9156.0, 8928.0, 9180.0, 9128.0, 9040.0] | [24.0, 20.0, 24.0, 24.0, 23.0, 22.0] | [123, 110, 112, 126, 112, 120] |
p02675 | u042347918 | 2,000 | 1,048,576 | The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a positive integer N not exceeding 999 is as follows: * `hon` when the digit in the one's place of N is 2, 4, 5, 7, or 9; * `pon` when the digit in the one's place of N is 0, 1, 6 or 8; * `bon` when the digit in the one's place of N is 3. Given N, print the pronunciation of "本" in the phrase "N 本". | ['import sys\n\nN = input()\n\nI = N[-1] \nprint(type(I))\n#print(I)\n\nif I in ["2", "4", "5", "7", "9"]: \n print("hon")\n sys.exit()\nelif I in ["0", "1", "6", "8"]:\n print("pon")\n sys.exit()\nelse :\n print("bon")\n sys.exit()\n', 'import sys\n\nN = input()\n\nI = N[-1] \n#print(type(I))\n#print(I)\n\nif I in ["2", "4", "5", "7", "9"]: \n print("hon")\n sys.exit()\nelif I in ["0", "1", "6", "8"]:\n print("pon")\n sys.exit()\nelse :\n print("bon")\n sys.exit()\n'] | ['Wrong Answer', 'Accepted'] | ['s062569925', 's605605164'] | [9012.0, 9056.0] | [27.0, 29.0] | [327, 328] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.