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
p02984
u923659712
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
["n=int(input())\na=list(map(int,input().split()))\nb=[0]*n\nk=0\nfor i in range(n):\n if i%2==0:\n k+=a[i]\nb[0]=sum(a)-k*2\nfor i in range(1,n):\n b[i]=2*a[i-1]-b[i-1]\n \nprint(' '.join(b))", "n=int(input())\na=list(map(int,input().split()))\nb=[0]*n\nk=0\nfor i in range(n):\n if i%2==1:\n k+=a[i]\nb[0]=su...
['Runtime Error', 'Accepted']
['s874839536', 's643978575']
[14028.0, 19220.0]
[89.0, 106.0]
[185, 199]
p02984
u928784113
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['N = int(input())\nA = list(map(int,input().split()))\nsumA = 0\nfor i in range(N):\n sumA += A[i]\nk = 0\nans = []\nres = []\nfor i in range(N):\n if i % 2 == 0:\n res.append(A[i])\n else:\n res.append(-A[i])\nP = sum(res)\nans.append(P)\ntem = A[0]\ntempans = P - tem\nfor i in range(N-1):\n ...
['Wrong Answer', 'Accepted']
['s081821712', 's870346695']
[17768.0, 16108.0]
[134.0, 168.0]
[381, 392]
p02984
u931072631
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['import sys\nsys.setrecursionlimit(10**9)\nN, K = map(int, input().split())\nmod = 10**9 + 7\nG = [[] for _ in range(N)]\nfor _ in range(N-1):\n a, b = map(int, input().split())\n G[a-1].append(b-1)\n G[b-1].append(a-1)\ndef p(n, k):\n x = 1\n for i in range(k):\n x *= n - i\n x %= mod\n ...
['Runtime Error', 'Accepted']
['s562992496', 's139594052']
[3064.0, 18680.0]
[18.0, 194.0]
[682, 324]
p02984
u934099192
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
["n = int(input())\nb = np.array(list(map(int, input().strip().split())))\ns = sum(b)\nx = []\n\nfor i in range(n):\n y = s\n k = i + 1\n for j in range(int((n-1)/2)):\n y -= 2*b[k%n]\n k += 2\n\n x.append(y)\n\ns = str(x)\ns = s.replace(',','')\ns = s.replace('[','')\ns = s.replace(']','')\np...
['Runtime Error', 'Accepted']
['s492832241', 's475198968']
[3064.0, 24712.0]
[17.0, 449.0]
[307, 381]
p02984
u950708010
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['def solve():\n l,r = (int(i) for i in input().split())\n mod = 2019\n l %= mod\n r %= mod\n ans = 10**15\n if l > r :\n print(0)\n exit()\n elif l == 0 or r == 0:\n print(0)\n exit()\n else:\n for i in range(l,r):\n for j in range(l+1,r+1):\n if i<j:\n ans = min(ans,(i*j)%mo...
['Runtime Error', 'Accepted']
['s762524717', 's622636250']
[3060.0, 14512.0]
[17.0, 128.0]
[330, 345]
p02984
u952656646
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['N = int(input())\nA = list(map(int, input().split()))\na = [0]*N\na[0] = sum(A) - 2*sum(map(lambda i,x: x if i%2==1 else 0, range(N), A))\nfor i in range(1, N):\n a[i] = 2*A[i-1]-a[i-1]\nprint(a)', 'N = int(input())\nA = list(map(int, input().split()))\na = [0]*N\na[0] = sum(A) - 2*sum(map(lambda i,x: x if i%2==1 ...
['Wrong Answer', 'Accepted']
['s581955536', 's742167961']
[15252.0, 14028.0]
[98.0, 135.0]
[192, 193]
p02984
u960653324
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['N = int(input())\nA = [int(i) for i in input().split()]\n\nA_tmp = 0\n\nfor i in range(len(A)):\n if i%2 == 0:\n A_tmp += 2*A[i]\n else:\n A_tmp -= 2*A[i]\n\nA1 = A_tmp * 2//3\nans = [A1]\nfor i in range(len(A)-1):\n ans.append(2*A[i]-ans[i])\n\nprint(" ".join(map(str,ans)))\n', 'N = int(input())\nA = [int(i...
['Wrong Answer', 'Accepted']
['s372551663', 's838524648']
[19396.0, 19144.0]
[122.0, 120.0]
[269, 267]
p02984
u962479059
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['N = int(input())\nA =[int(x) for x in input().split()]\n\nsum = 0\nfor i in range(N):\n sum+=A[i]\nX =[0 for x in range(N)]\nsum2=0\ni=1\nwhile i < N:\n sum2+=A[i]\n i+=2\nX[0]=sum-sum2\n\nfor i in range(1,N):\n X[i]=2*A[i-1]-X[i-1]\nfor i in range(N):\n X[i]=string(X[i])\nprint(" ".join(X))', 'N = int(input())\...
['Runtime Error', 'Accepted']
['s380005356', 's720681162']
[14092.0, 17300.0]
[110.0, 141.0]
[279, 278]
p02984
u963903527
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['n = int(input())\na = list(map(int, input().split()))\ns = sum(a)\n\nx_1 = s\nfor i in range(1,n,2):\n x_1 -= 2*a[i]\nans = [x_1]\nfor i in range(1, n):\n ans.append(2*a[i-1]-ans[i-1])\nprint(ans)\nprint(" ".join(list(map(str, ans))))', 'n = int(input())\na = list(map(int, input().split()))\ns = sum(a)\n\nx_1 =...
['Wrong Answer', 'Accepted']
['s681519145', 's027896202']
[20332.0, 19092.0]
[111.0, 101.0]
[252, 241]
p02984
u981931040
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['import numpy as np\nN = int(input())\nA = list(map(int , input().split()))\nprint(A)\n\nW = [0] * N\ntmp0 = int(np.ceil(A[N-1] / 2) % 2)\ntmp1 = int(np.ceil(A[0] / 2) % 2)\nif tmp0 == 0 and tmp1 == 0:\n W[0] = int(min(np.ceil(A[N-1] / 2),np.ceil(A[0] / 2)))\nelif tmp0 == 0 and tmp1 == 1:\n W[0] = int(np.ceil(A[...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s391111249', 's428697238', 's124007323']
[24020.0, 14392.0, 14032.0]
[265.0, 143.0, 120.0]
[467, 292, 613]
p02984
u982438430
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['N = int(input())\nA = list(map(int,input().split()))\n\nX1by2 = 0\nfor i in range(N):\n if i%2 ==0:\n X1by2 += A[i]\n else:\n X1by2 -= A[i]\n\nX = []\n\nX.append(X1by2)\nfor i in range(len(A-1)):\n X.append((A[i]-X[i]/2)*2)\n\nprint(" ".join(repr(int(e)) for e in X))\n', 'N = int(input())\nA = list(map(int,i...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s635057008', 's746138459', 's649304724']
[14092.0, 18504.0, 18376.0]
[68.0, 136.0, 138.0]
[261, 257, 261]
p02984
u995861601
2,000
1,048,576
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i ...
['# -*- coding: utf-8 -*-\n"""\nCreated on Sat Jul 20 13:50:17 2019\n\n@author: yama\n"""\n\nn = int(input())\nl = list(map(int, input().split()))\n\nl = l+l\nxl = []\nfor i in range(2):\n a = 0\n m = False\n for j in range(i, n+i):\n if m is False:\n a += l[j]\n m = True\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s031534592', 's969859694', 's815358634']
[14028.0, 14092.0, 19912.0]
[86.0, 86.0, 153.0]
[472, 388, 387]
p02986
u102461423
4,000
1,048,576
There is a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and Vertex b_i, and the color and length of that edge are c_i and d_i, respectively. Here the color of each edge is represented by an integer between 1 and N-1 (inclusive). The same integer corresponds to the same color, and...
["import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nimport numpy as np\n\nN,Q = map(int,input().split())\ngraph = [[] for _ in range(N+1)]\nfor _ in range(N-1):\n a,b,c,d = map(int,input().split())\n graph[a].append((b,c,d))\n graph[b].append((a,c,d))\nquery = [[int(x) for x in input().spli...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s031790215', 's167027705', 's251876893', 's283972702', 's332356147', 's367941916', 's505081217', 's687953541', 's692308842', 's864768199', 's902052961', 's940826038', 's999525485']
[244848.0, 136276.0, 200148.0, 12448.0, 157656.0, 173152.0, 127584.0, 99640.0, 162116.0, 162116.0, 167364.0, 136176.0, 149772.0]
[2279.0, 1713.0, 1983.0, 149.0, 1153.0, 3141.0, 1268.0, 820.0, 1342.0, 1334.0, 1580.0, 1425.0, 1713.0]
[1948, 2931, 1584, 1516, 790, 1407, 2337, 1994, 1394, 1395, 771, 2952, 2921]
p02986
u533039576
4,000
1,048,576
There is a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and Vertex b_i, and the color and length of that edge are c_i and d_i, respectively. Here the color of each edge is represented by an integer between 1 and N-1 (inclusive). The same integer corresponds to the same color, and...
['import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**10)\n\n\nclass SegmentTree1():\n \n def __init__(self, n_, ele_id, operation_func):\n self.n = 1 << (n_ - 1).bit_length() # size\n self.data = [ele_id] * (2 * self.n) # binary tree\n self.ele_id = ele_id # identity element...
['Runtime Error', 'Accepted']
['s483040289', 's837411597']
[3444.0, 248916.0]
[18.0, 3894.0]
[4476, 4757]
p02986
u707124227
4,000
1,048,576
There is a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and Vertex b_i, and the color and length of that edge are c_i and d_i, respectively. Here the color of each edge is represented by an integer between 1 and N-1 (inclusive). The same integer corresponds to the same color, and...
["import sys\nsys.setrecursionlimit(10**7)\n\ndef main0(n,g,xyuv):\n \n \n depth=[0]*n\n tour=[]\n hatsu=[0]*n\n dist=[0]*n\n tmp=0\n def et(p,v,tour,tmp,pc,pd):\n hatsu[v]=len(tour)-1\n for nv,c,d in g[v]:\n if nv==p:continue\n depth[nv]=depth[v]+1\n tmp+=d\n dist[nv]=tmp\n tour....
['Wrong Answer', 'Accepted']
['s647477646', 's529566784']
[247244.0, 246848.0]
[3837.0, 3979.0]
[2651, 2650]
p02986
u968404618
4,000
1,048,576
There is a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and Vertex b_i, and the color and length of that edge are c_i and d_i, respectively. Here the color of each edge is represented by an integer between 1 and N-1 (inclusive). The same integer corresponds to the same color, and...
['class LCA(object):\n def __init__(self, to, root=0):\n self.__n = len(to)\n self.__to = to\n self.__logn = (self.__n-1).bit_length()\n self.__depth = [-1]*self.__n\n self.__dist = [-1]*self.__n\n self.__depth[root] = 0\n self.__dist[root] = 0\n self.__parents...
['Runtime Error', 'Accepted']
['s236833036', 's779580470']
[122780.0, 205120.0]
[3581.0, 3993.0]
[2492, 2678]
p02988
u000212387
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=list(map(int,input().split()))\nc=0\nfor i in range(n-3):\n a=p[i:i+3]\n b=sorted(a)\n if a[1]==b[1]:\n c+=1\nprint(c)\n', 'n=int(input())\np=list(map(int,input().split()))\nc=0\nfor i in range(n-2):\n a=p[i:i+3]\n b=sorted(a)\n if a[1]==b[1]:\n c+=1\nprint(c)']
['Wrong Answer', 'Accepted']
['s826350230', 's414468361']
[2940.0, 2940.0]
[18.0, 17.0]
[145, 144]
p02988
u003652013
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['x = input().split()\nn = int(x[0])\n\np = list(map(int,x[1:]))\n\nc = 0\n\nfor i in range(1,n-1):\n if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):\n c += 1\n \n\nprint(c)', 'x = input().split()\nn = int(x[0])\n\np = list(map(int,x[1:]))\nc = 0\n\nfor i in range(1,n-1):\n if (p[i-...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s049768956', 's640965634', 's790260903', 's961069007', 's963630329']
[3060.0, 3060.0, 3064.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[195, 194, 243, 179, 322]
p02988
u004823354
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = map(int,input().split())\n\nans = 0\n\nfor i in range(1,n-1):\n if p[i-1]<p[i]<p[i+1] or p[i+1]<p[i]<p[i-1]:\n ans += 1\n \nprint(ans)\n ', 'n = int(input())\np = list(map(int,input().split()))\n \nans = 0\n \nfor i in range(1,n-1):\n if p[i-1]<p[i]<p[i+1] or p[i+1]<p[i]<p[i-1]:\n ...
['Runtime Error', 'Accepted']
['s670418911', 's508982068']
[9184.0, 9100.0]
[23.0, 25.0]
[159, 167]
p02988
u006883624
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['def main():\n n = int(input())\n P = map(int, input().split())\n\n count = 0\n p1 = P[0]\n p2 = P[1]\n for i in range(2, n):\n p3 = P[i]\n if p1 < p2 < p3 or p1 > p2 > p3:\n count += 1\n p1 = p2\n p2 = p3\n\nmain()\n', 'def main():\n n = int(input())\n P = list(map(int, input().split()))\...
['Runtime Error', 'Accepted']
['s950908715', 's168389344']
[3060.0, 3060.0]
[17.0, 18.0]
[224, 283]
p02988
u007785897
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = input()\np = [int(i) for i in input().split()]\nans = 0\nfor i in range(n-3):\n if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):\n ans += 0\n else:\n ans += 1\nprint(ans)', 'n = input()\np = [int(i) for i in input().split()]\nans = 0\nfor i in range(n-1):\n if p[i+1] == max(...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s129086668', 's354133111', 's655111596', 's685474577']
[3060.0, 3060.0, 3060.0, 3064.0]
[18.0, 17.0, 17.0, 17.0]
[204, 195, 204, 209]
p02988
u007991836
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = map(int,input().split())\n\nlarge_small = -1\nans = 2\nfor i in range(n-1):\n if p[i] > p[i+1]:\n if large_small == 1:\n ans += 1\n large_small = 1\n elif p[i] < p[i+1]:\n if large_small == -1:\n ans += 1\n large_small = -1\n else:\n ...
['Runtime Error', 'Accepted']
['s713704904', 's968522296']
[3060.0, 3060.0]
[17.0, 17.0]
[335, 340]
p02988
u010069411
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=list(map(int, input().split())\naa = 0\nfor i in range(0, n-2):\n t = p[i:i+3]\n t.sort()\n if t[1] == p[i+1]:\n aa += 1\nprint(aa)\n', 'n=int(input())\np=list(map(int, input().split()))\naa = 0\nfor i in range(0, n-2):\n t = p[i:i+3]\n t.sort()\n if t[1] == p[i+1]:\n ...
['Runtime Error', 'Accepted']
['s881035045', 's116772249']
[2940.0, 2940.0]
[17.0, 17.0]
[158, 159]
p02988
u011811357
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['# -*- coding: utf-8 -*-\n\ndef main():\n \n # a = int(input())\n \n # b, c = map(int, input().split())\n \n \n \n # print("{} {}".format(a+b+c, s))\n n = int(input())\n p_list = list(map(int, input().split()))\n cnt = 0\n for i in range(1, n-1):\n if min(p_list[i-1:i+2])<p_l...
['Wrong Answer', 'Accepted']
['s969077909', 's896759016']
[3060.0, 3060.0]
[20.0, 17.0]
[560, 576]
p02988
u023229441
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\nA=list(map(int,input().split()))\nans=0\nfor i in range(n-2):\n if A[i]<A[i+1]<A[i+2]:\n ans+=1\nprint(ans)', 'n=int(input())\nA=list(map(int,input().split()))\nans=0\nfor i in range(n-2):\n if A[i]<A[i+1]<A[i+2] or A[i]>A[i+1]>A[i+2]:\n ans+=1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s194346588', 's078132418']
[2940.0, 2940.0]
[18.0, 17.0]
[121, 144]
p02988
u027076164
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = input()\np = list(map(int,input().split()))\na = 0\nfor i in range(1,n):\n if p[i-1] < p[i] < p[i+1] or p[i+1] < p[i] < p[i-1]:\n a += 1\nprint(a)', 'n = int(input())\np = list(map(int,input().split()))\na = 0\nfor i in range(1,n):\n if p[i-1] < p[i] < p[i+1] or p[i+1] < p[i] < p[i-1]:\n a += 1\nprint(a)'...
['Runtime Error', 'Runtime Error', 'Accepted']
['s343957332', 's428798241', 's690643235']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0]
[148, 153, 155]
p02988
u032222383
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=list(map(int, input().solilt()))\nc=0\nfor i in range(1,n-1):\n if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i-1]>p[i] and p[i]>p[i+1]):\n c+=1\nprint(c)\n ', 'n=int(input())\np=list(map(int, input().split()))\nc=0\nfor i in range(1,n-1):\n if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i-1]>p...
['Runtime Error', 'Accepted']
['s403747975', 's726116146']
[3060.0, 3060.0]
[17.0, 17.0]
[178, 178]
p02988
u036340997
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = input()\np = input().split()\n\ns = 0\nfor i in range(n-2):\n if max(int(p[i]), int(p[i+1]), int(p[i+2])) != int(p[i+1]) and min(int(p[i]), int(p[i+1]), int(p[i+2])) != int(p[i+1]):\n s += 1\n\nprint(s)', 'n = int(input())\np = input().split()\n\ns = 0\nfor i in range(n-2):\n if max(int(p[i]), int(p[i+1]), i...
['Runtime Error', 'Accepted']
['s791042675', 's720869708']
[3060.0, 3060.0]
[17.0, 19.0]
[202, 208]
p02988
u038136206
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\npn = input().split()\n\na = 0\nb = 0\nc = 0\ncnt = 0\n\nfor i in range(n-1):\n\tc = pn[i]\n\tif i >= 2:\n\t\tif (a<b and b<c) or (a>b and b>c):\n\t\t\tcnt += 1\n\n\ta = b\n\tb = c\n\nprint(cnt)', 'n=int(input())\npn = input().split()\n\na = 9999\nb = 9999\nc = 9999\ncnt = 0\n\nfor i in range(n):\n\tc ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s102254686', 's695480694', 's848305390', 's207589390']
[3064.0, 2940.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[183, 240, 236, 162]
p02988
u038408819
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int, input().split()))\n\nimport numpy\np = np.array(p)\ncnt = 0\nfor i in range(1, n-1):\n pi = np.array(p[i-1:i+2])\n #print(pi)\n if np.argsort(pi)[1] == 1:\n cnt += 1\nprint(cnt)', 'n = int(input())\np = list(map(int, input().split()))\n\nimport numpy\np = np.array(p...
['Runtime Error', 'Runtime Error', 'Accepted']
['s527766178', 's829607104', 's668085034']
[12504.0, 12504.0, 21148.0]
[150.0, 148.0, 329.0]
[218, 219, 223]
p02988
u041335584
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\nP = list(map(int,input().split()))\np = [0]*3\ncnt = 0\nfor i in range(1,n-1):\n for j in range(0,len(p)):\n p[j] = P[i+(j-1)] - P[i]\n p.sort()\n if p.index(0) == 1:\n cnt += 1', 'n = int(input())\nP = list(map(int,input().split()))\np = [0]*3\ncnt = 0\nfor i in range(1,n-1):...
['Wrong Answer', 'Accepted']
['s468677158', 's028371052']
[3064.0, 3060.0]
[17.0, 17.0]
[209, 220]
p02988
u044442911
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['from sys import stdin\n\n\ndef main():\n n = int(input())\n\n p = stdin.readline().split()\n count = 0\n\n for i in range(1 , n):\n if p[i-1] >= p[i] >=p[i+1] and p[i-1] != p[i] or p[i-1] <= p[i] <=p[i+1] and p[i] !=p[i+1]:\n count +=1\n \n print(count)\n\n\nif __name__ == "__main...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s458384447', 's725964363', 's983656644']
[3060.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0]
[317, 340, 296]
p02988
u046585946
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=list(map(int,input().split()))\nans=0\nfor i in range(n-2):\n if p[i]<p[i+1] and p[i+1]<p[i+2] or p[i]<p[i+1] and p[i+1]<p[i+2]:\n ans=ans+1\nprint(ans)', 'n=int(input())\np=list(map(int,input().split()))\nans=0\nfor i in range(len(p)-3):\n if p[i]<p[i+1] and p[i+1]<p[i+2] or p[i]<p[i+1] and p[...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s466898143', 's499989811', 's648630827', 's094436922']
[3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[168, 173, 173, 168]
p02988
u047918169
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
["s = sorted(input())\n\nif s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:\n print('Yes')\nelse:\n print('No')\n", 'n = int(input())\np = [int(i) for i in input().split()]\n\ncount = 0\n\nfor i in range(n-2):\n if p[i] <= p[i+1] < p[i+2] or p[i+2] <= p[i+1] < p[i] or (p[i] == p[i+2] and p[i+1] < p[i]):\n ...
['Runtime Error', 'Accepted']
['s114093862', 's367741912']
[2940.0, 3060.0]
[17.0, 17.0]
[111, 218]
p02988
u056659569
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np = list(map(int, input().split()))\ncount=0\nfor i in range(n-2)\n\tif p[i]>p[i+1]>p[i+2] or p[i+2]>p[i+1]>p[i]:\n \tcount=count+1\nprint(count)', 'n=int(input())\np = [int(x) for x in input().split()] \ncount=0\nfor i in range(n-2)\n\tif p[i]>p[i+1]>p[i+2] or p[i+2]>p[i+1]>p[i]:\n \tcount=coun...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s042628685', 's093609732', 's113433699', 's224221158', 's300195947', 's439405456', 's610763686', 's627433444', 's232481931']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3188.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0, 17.0, 17.0, 18.0, 17.0, 17.0, 18.0]
[156, 159, 157, 150, 157, 160, 147, 171, 166]
p02988
u057993957
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['N = int(input())\ndata = list(map(int, input().split()))\npn = [x for x in range(1, N-1)]\n\ncnt = 0\nfor p in pn:\n p_t = np.sort([data[p - 1], data[p], data[p + 1]])\n cnt = cnt + 1 if p_t[1] == data[p] else cnt\n \nprint(cnt)', 'import numpy as np\n\nN = int(input())\ndata = list(map(int, input().split())...
['Runtime Error', 'Accepted']
['s772061387', 's806837795']
[3060.0, 22300.0]
[18.0, 331.0]
[228, 248]
p02988
u062459048
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['N = int(input())\nP = [map(int, input.split())]\n\nc = 0\nfor i in range(N-2):\n if P[i] < P[i+1] <= P[i+2]:\n c += 1\n elif P[i+2] < P[i+1] <= P[i]:\n c += 1\n else:\n pass\n \nprint(c)\n ', 'N = int(input())\nP = [map(int, input().split())]\n\nc = 0\nfor i in range(N-2):\n if P[i] < P[i+1] <= P[i+2]:...
['Runtime Error', 'Runtime Error', 'Accepted']
['s874170839', 's882829928', 's131532920']
[3060.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[190, 193, 177]
p02988
u062604519
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int,input().split()))\ncount = 0\n\nfor i in range(n):\n if i != 0 and i != n-1:\n if p[i] > p[i-1]:\n if p[i] < p[i+1]:\n count += 1\n elif p[i] < p[i-1]:\n if p[i] > p[i+1]:\n count += 1', 'n = int(input())\np = list(map(int,input().split()))\ncount = 0\...
['Wrong Answer', 'Accepted']
['s055894652', 's835960071']
[3060.0, 3188.0]
[17.0, 18.0]
[239, 261]
p02988
u068695365
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = input()\nl = [i for i in input().split()]\n\ncnt = 0\nfor i in range(1,len(l)-1):\n l_tmp = [l[i-1], l[i], l[i+1]]\n l_tmp.sort()\n if l_tmp[1]==l[i]:\n cnt += 1\n', 'import numpy as np\n\nn = input()\nl = [int(i) for i in input().split()]\n\ncnt = 0\nfor i in range(1,len(l)-1):\n l_tmp = [l[i-...
['Wrong Answer', 'Accepted']
['s360194588', 's610267183']
[2940.0, 18380.0]
[18.0, 270.0]
[174, 263]
p02988
u069868839
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=[int(i) for i in input().split()]\nans=0\nfor x in range(2,n):\n a=p[x-1]\n b=p[x]\n c=p[x+1]\n if a<b<c or c<b<a:\n ans+=1\nprint(ans)', 'n=int(input())\np=[int(i) for i in input().split()]\nans=0\nfor x in range(1,n-1):\n a=p[x-1]\n b=p[x]\n c=p[x+1]\n if a<b<c or c<...
['Runtime Error', 'Accepted']
['s556784992', 's900596005']
[3060.0, 3060.0]
[17.0, 17.0]
[163, 165]
p02988
u073852194
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int, input().split()))\nc = 0\nfor i in range(0,n-2):\n if p[i] * p[i+2] < p[i+1] ** 2:\n c += 1\nprint(c) ', 'n = int(input())\np = list(map(int, input().split()))\nc = 0\nfor i in range(0,n-2):\n if p[i] < p[i+1] < p[i+2] or p[i] > p[i+1] > p[i+2]:\n c += 1\nprint(c) ']
['Wrong Answer', 'Accepted']
['s941682033', 's302785501']
[2940.0, 3060.0]
[17.0, 17.0]
[138, 160]
p02988
u074338678
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(n):\n if p[i]<p[i+1]<p[i+2] or p[i+2]<p[i+1]<p[i]:\n ans += 1\n \nprint(ans)\n', 'n = int(input())\np = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(n-1):\n if p[i]<p[i+1]<p[i+2] or p[i+2]<p[i+1]<p[i]:\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s310247176', 's806268667', 's945017286', 's873379987']
[2940.0, 2940.0, 3060.0, 2940.0]
[17.0, 18.0, 17.0, 17.0]
[160, 166, 166, 166]
p02988
u075303794
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int, input().split()))\nans = 0\nfor i in range(1, n-1):\n if p[i-1] < p[i] and p[i] < p[i+1]:\n ans += 1\n elif p[i-1] > p[i] and p[i] > p[i+1]:\n ans += 1\n ', 'n = int(input())\np = list(map(int, input().split()))\nans = 0\nfor i in range(1, n-1):\n if p[i-1] < p[i] and p...
['Wrong Answer', 'Accepted']
['s414505746', 's756416585']
[2940.0, 3060.0]
[17.0, 17.0]
[193, 199]
p02988
u076170062
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
["def counting(numbers) -> int:\n count = 0\n for i in range(1, len(numbers) - 1):\n pre = numbers[i-1]\n curr = numbers[i]\n next_ = numbers[i+1]\n if pre < curr < next_:\n count += 1\n return count\n \n_ = input()\nnumbers_str = input()\nresult = counting(numbers_str.sp...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s081409730', 's454410716', 's561422738', 's886405033']
[3060.0, 2940.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0, 18.0]
[330, 334, 348, 502]
p02988
u079022116
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=list(map(int,input().split()))\ncount=0\nfor i in range(1,n-2):\n if p[i-1] < p[i] < p[i+1] or p[i+1] < p[i] < p[i-1]:\n count+=1\nprint(count)', 'n=int(input())\np=list(map(int,input().split()))\ncount=0\nfor i in range(1,n-1):\n if p[i-1] < p[i] < p[i+1] or p[i+1] < p[i] < p[i-1]:\n count+...
['Wrong Answer', 'Accepted']
['s224435758', 's399623410']
[3060.0, 3060.0]
[17.0, 17.0]
[159, 159]
p02988
u089230684
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['#\n\nfrom bisect import bisect\n\nfor _ in range(int(input())):\n N, D = map(int, input().split())\n P = list(map(int, input().split()))\n swaps = 0\n possible = True\n for m in range(D):\n order = []\n for i in range(m, N, D):\n if (P[i]-(i+1)) % D:\n possible =...
['Runtime Error', 'Accepted']
['s229732892', 's925703083']
[3188.0, 9188.0]
[19.0, 31.0]
[516, 187]
p02988
u096514906
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['l = list(map(int, input().split()))\ncount = 0\nfor i in range(1, l-1):\n ll = l[i-1:i+1]\n ll.sort()\n if ll[1]==l[i]:\n count+=1\nprint(count)\n', 'l = list(map(int, input().split()))\ncount = 0\nfor i in range(l):\n ll = l[i-1:i+1]\n ll.sort()\n if ll[1]==l[i]:\n count+=1\nprint(count)', 'N = int(input...
['Runtime Error', 'Runtime Error', 'Accepted']
['s558343895', 's633321353', 's863773777']
[2940.0, 3316.0, 3060.0]
[17.0, 20.0, 17.0]
[144, 138, 182]
p02988
u098041609
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\n\nls = list(map(int, input().split()))\n \ncount = 0\n\nfor i in range(n-2):\n if a[i-1] < a[i] and a[i+1] > a[i]:\n count+=1\n else:\n if a[i-1] > a[i] and a[i+1] < a[i]:\n count += 1\n\nprint count', 'n = int(input())\n\nls = list(map(int, input().split()))\n \ncount...
['Runtime Error', 'Accepted']
['s341530343', 's343875845']
[3060.0, 3060.0]
[18.0, 17.0]
[235, 239]
p02988
u098588273
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=list(map(int,input().split()))\nfor i in range(0,n-2):\n cnt=0\n if p[i]<p[i+1]<p[i+2] or p[i]>p[i+1]>p[i+2]:\n cnt+=1\nprint(cnt)', 'n=int(input())\np=list(map(int,input().split()))\ncnt=0\nfor i in range(0,n-2):\n if p[i]<p[i+1]<p[i+2] or p[i]>p[i+1]>p[i+2]:\n cnt+=1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s530556228', 's436121085']
[3060.0, 3060.0]
[18.0, 17.0]
[147, 145]
p02988
u101113363
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\n\nli = list(map(int,input().split()))\n\nans= 0\n\nfor i in range(1,n-1):\n lis= sorted([li[i],li[i-1],li[i+1]])\n print(lis)\n if lis[1]==li[i]:\n ans +=1\nprint(ans)', 'n=int(input())\n\nli = list(map(int,input().split()))\n\nans= 0\n\nfor i in range(1,n-1):\n lis= sorted([li[i],l...
['Wrong Answer', 'Accepted']
['s797141269', 's455821990']
[3060.0, 3060.0]
[18.0, 17.0]
[188, 173]
p02988
u101988775
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
[' n = int(input())\n p_list = list(map(int, input().split()))\n count = 0\n for i in range(len(p_list)-2):\n \tif (p_list[i]<p_list[i+1] and p_list[i+1]<p_list[i+2]) or (p_list[i]>p_list[i+1] and p_list[i+1]>p_list[i+2]):\n \t\tcount += 1\n print(count)', 'n = int(input())\np_list = list(map(int, ...
['Runtime Error', 'Accepted']
['s595666256', 's705593969']
[2940.0, 3060.0]
[17.0, 17.0]
[264, 236]
p02988
u104442591
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = [i for i in input().split()]\nans = 0\nfor i in range(1,n-2):\n if p[i] != max(p[i-1:i+2]) and p[i] != min(p[i-1:i+2]):\n ans += 1\nprint(ans)', 'n = int(input())\np = [int(i) for i in input().split()]\nans = 0\nfor i in range(1,n-1):\n if p[i] != max(p[i-1:i+2]) and p[i] != min(p[i-1:i+2])...
['Wrong Answer', 'Accepted']
['s955466871', 's980410078']
[3060.0, 3060.0]
[17.0, 17.0]
[162, 167]
p02988
u111497285
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\nl = list(map(int, input().split()))\n\nans = 0\nfor i in range(1, n - 1):\n if l[i - 1] < l[i] and l[i] < l[i + 1]:\n ans += 1\n\nprint(ans)\n', 'n = int(input())\nl = list(map(int, input().split()))\n \nans = 0\nfor i in range(1, n - 1):\n if l[i - 1] < l[i] and l[i] < l[i + 1]:\n ans += 1\...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s062529326', 's124185463', 's117893638']
[3064.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[155, 209, 211]
p02988
u113287094
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['long = int(input())\np = input()\nplng = []\npstr = p.split(" ")\nn = 0\n\nfor i in range(long):\n plng.append(int(pstr[i]))\n\n\nfor i in range(long-2):\n three = [plng[i],plng[i+1],plng[i+2]]\n three.sort()\n\n if three[1] == plng[i + 1]:\n n = n +\u30001\n\nprint(n)\n', 'long = int(input())\np = in...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s193344491', 's402460862', 's586239845', 's650553373', 's660431004', 's414700009']
[2940.0, 2940.0, 2940.0, 3064.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[266, 266, 278, 275, 260, 265]
p02988
u113971909
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\na=list(map(int,input().split()))\ncnt=0\nfor i in range(n-2):\n if a[i]<a[i+1]<a[i+2]:\n cnt+=1\nprint(cnt)', 'n=int(input())\na=list(map(int,input().split()))\ncnt=0\nfor i in range(n-2):\n if a[i]<a[i+1]<a[i+2]:\n cnt+=1\n elif a[i]>a[i+1]>a[i+2]:\n cnt+=1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s708927218', 's447997819']
[2940.0, 3060.0]
[17.0, 17.0]
[121, 159]
p02988
u115988130
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['N = int(input())\np = list(map(int, input().split()))\ncount = 0\n\n\nfor i in range(0,N-2):\n if p[i] < p[i+1] and p[i+1] < p[i+2]:\n count += 1\nprint(count)', 'N = int(input())\np = list(map(int, input().split()))\ncount = 0\n\n\nfor i in range(0,N-2):\n if p[i] < p[i+1] and p[i+1] < p[i+2]:\n ...
['Wrong Answer', 'Accepted']
['s961317450', 's114866275']
[3060.0, 3060.0]
[18.0, 17.0]
[161, 225]
p02988
u123745130
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\nl=list(map(int,input().split()))\ncnt=0\nfor i in range(n-2):\n if l[i]<l[i+1]<l[i+2]:\n cnt+=1\nprint(cnt)', 'n=int(input())\nl=list(map(int,input().split()))\ncnt=0\nfor i in range(n-2):\n if l[i]<l[i+1]<l[i+2] or l[i]>l[i+1]>l[i+2]:\n cnt+=1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s422615925', 's914634227']
[2940.0, 3060.0]
[17.0, 17.0]
[121, 143]
p02988
u125348436
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=list(map(int,input().split()))\n\nfor i in range(1,n-1):\n if p[i-1]<p[i] and p[i]<p[i+1]:\n cnt+=1\n elif p[i+1]<p[i] and p[i]<p[i-1]:\n cnt+=1\nprint(cnt)', 'n=int(input())\np=list(map(int,input().split()))\n \ncnt=0\nfor i in range(1,n-1):\n if p[i-1]<p[i] and p[i]<p[i+1]:\n cnt+=1\n ...
['Runtime Error', 'Accepted']
['s439211592', 's963640085']
[9116.0, 9188.0]
[27.0, 28.0]
[174, 181]
p02988
u131264627
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = [int(i) for i in input().split()]\nctn = 0\nfor j in range(1, n-2):\n if p[j - 1] < p[j] < p[j + 1] or p[j + 1] < p[j] < p[j - 1]:\n ctn += 1\nprint(ctn)', 'n = int(input())\np = [int(i) for i in input().split()]\nctn = 0\nfor j in range(1, n-2):\n if p[j -1] < p[j] < p[j + 1]:\n ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s004257229', 's479835466', 's668233881', 's684992501']
[3060.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 18.0]
[179, 148, 147, 179]
p02988
u131666536
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\narrayP = [int(s) for s in input().split()]\n\ncnt = 0\n\nfor i in range(0, n-2):\n threeNums = arrayP[i:i+3].sort()\n if threeNums[1] == arrayP[i+1]:\n cnt += 1\n\nprint(cnt)\n', '# -*- coding: utf-8 -*-\n\nn = int(input())\narrayP = [int(s) for s in input().split()]\n \ncnt = 0\n \nfor...
['Runtime Error', 'Accepted']
['s229995327', 's236266677']
[2940.0, 3060.0]
[18.0, 18.0]
[196, 238]
p02988
u135734261
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
[" = input()\np = []\ninput_first = input()\nfor ki in range(int(n)):\n p = input_first.rstrip().split(' ')\ncount = 0\nprint(p)\nfor i in range(1,int(n)-1):\n if (int(p[i]) > int(p[i-1]) and int(p[i]) < int(p[i+1])) or (int(p[i]) < int(p[i-1]) and p[i] > p[i+1]):\n count += 1\n else:\n pass\npri...
['Runtime Error', 'Accepted']
['s797941793', 's013148098']
[2940.0, 3064.0]
[17.0, 17.0]
[316, 340]
p02988
u137667583
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['p = list(map(int,input().split()))\ncount = 0\nfor i in range(len(p)-2):\n if p[i]<=p[i+1]<p[i+2]:\n count = count + 1\n elif p[i]>p[i+1]>=p[i+2]:\n count = count + 1\nelse:\n print(count)', 'n = int(input())\np = list(map(int,input().split()))\ncount = 0\nfor i in range(n-2):\n if p[i]<=p[i+1]<p[i+2]:\n ...
['Wrong Answer', 'Accepted']
['s709739305', 's832765506']
[3064.0, 3060.0]
[17.0, 17.0]
[189, 201]
p02988
u152893557
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=input().split()\np=[int(s) for s in p]\n\nprint(n,p)\ncount=0\n\nfor i in range(1,len(p)-1):\n if p[i]>=p[i-1] or p[i]>=p[i+1]:\n if p[i]<=p[i-1] or p[i]<=p[i+1]:\n count+=1\n\nprint(count)\n', 'n=int(input())\np=input().split()\np=[int(s) for s in p]\n\n#print(n,p)\ncount=0\n\n...
['Wrong Answer', 'Accepted']
['s848653677', 's517158732']
[3060.0, 3060.0]
[17.0, 17.0]
[217, 218]
p02988
u159808230
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\nseq_str = input().split(" ")\nseq = [int(s) for s in seq_str]\ncounter = 0\n\nfor i in range(1,n-1):\n if seq[i-1] < sqe[i] and seq[i] < seq[i+1]\n counter =+ 1\nprint(counter)', 'n = int(input())\nseq_str = input().split(" ")\nseq = [int(s) for s in seq_str]\ncounter = 0\n\nfor i in range(1,n...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s583273816', 's611268613', 's788293899']
[2940.0, 3060.0, 2940.0]
[17.0, 17.0, 20.0]
[192, 197, 198]
p02988
u162911102
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\ns = input().split() \nnum = 0\n\nfor i in range(n-2): \n if s[i] < s[i+1] and s[i+1] < s[i+2]:\n num = num+1 \n else: \n pass\n\nprint(num)', 'n = int(input())\ns = list(map(int, input().split())) \nnum = 0\n\nfor i in range(n-2): \n if s[i] < s[i+1] and s[i+1] < s[i+2]:\n ...
['Wrong Answer', 'Accepted']
['s854407821', 's598190510']
[3060.0, 3064.0]
[17.0, 17.0]
[167, 249]
p02988
u166621202
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\nlst = [int, input().split()]\ncnt = 0\n\nfor i in range(n-2):\n if lst[1][i] < lst[1][i+1] < lst[1][i+2] or lst[1][i] > lst[1][i+1] > lst[1][i+2] or lst[1][i] = lst[1][i+1] < lst[1][i+2] or lst[1][i] > lst[1][i+1] = lst[1][i+2]:\n cnt += 1\n \nprint(cnt)', 'n = int(input())\nlst = list(map(in...
['Runtime Error', 'Accepted']
['s217638471', 's483709353']
[2940.0, 3060.0]
[17.0, 17.0]
[271, 187]
p02988
u169711213
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
["# ordinary number\nn = int(input())\nlist = [int(i) for i in input().split(' ')]\nprint(n,list)\nans = 0\nfor i in range(1,n-1):\n\ttmp = list[i-1:i+2]\n\ttmp.sort()\n\tprint(tmp)\n\tif tmp[0] != list[i] and tmp[1] == list[i]:\n\t\tans = ans + 1\nprint(ans)\n", "# ordinary number\nn = int(input())\nlist = [int(i) fo...
['Wrong Answer', 'Accepted']
['s907506208', 's949007633']
[3060.0, 3060.0]
[18.0, 17.0]
[242, 246]
p02988
u170765582
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['input()\na=list(map(int,input().split()))\nb=0\nfor i in range(1,len(a)-1):\n b+=a[i-1]<i and i<a[i+1]\n b+=a[i-1]>i and i>a[i+1]\nprint(b)', 'input()\na=list(map(int,input().split()))\nb=0\nfor i in range(1,len(a)-1):\n b+=a[i-1]<a[i] and a[i]<a[i+1]\n b+=a[i-1]>a[i] and a[i]>a[i+1]\nprint(b)']
['Wrong Answer', 'Accepted']
['s295794984', 's758623068']
[2940.0, 2940.0]
[17.0, 17.0]
[135, 147]
p02988
u175034939
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int, input().split()))\ncnt = 0\nfor i in range(1, n-3+2):\n print(i, p[i])\n if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):\n cnt += 1\nprint(cnt)', 'n = int(input())\np = list(map(int, input().split()))\ncnt = 0\nfor i in range(1, n-3+2):\n ...
['Wrong Answer', 'Accepted']
['s818642931', 's111308970']
[8956.0, 9076.0]
[28.0, 25.0]
[212, 193]
p02988
u176674210
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['# -*- coding:utf8 -*-\nimport math\n\nn = int(input())\np = list(map(int, input().split()))\n\nans = 0\nfor i in range(n-1, 1):\n l = p[i-1:i+2]\n if l[1] == sorted(l)[1]:\n ans += 1\nprint(ans)\n\n', '# -*- coding:utf8 -*-\nimport math\n\nn = int(input())\np = list(map(int, input().split()))\n\nans = 0\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s664508850', 's736771648', 's277907439']
[3060.0, 3060.0, 3060.0]
[19.0, 19.0, 18.0]
[198, 211, 198]
p02988
u185821641
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
["# -*- coding: utf-8 -*-\n\n# main\nn = int(input())\narray_p = [int(i) for i in input().split(' ')]\n\ndef is_second(input_list):\n print(input_list)\n sort = sorted(input_list)\n print(sort)\n if input_list[1] == sort[1]:\n return True\n else:\n return False\n\ncount = 0\nfor i in range(...
['Wrong Answer', 'Accepted']
['s638346502', 's121957505']
[3060.0, 3060.0]
[17.0, 17.0]
[387, 349]
p02988
u187366461
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=list(map(int,input().split()))\n\nfor i in range(n-2):\n if p[i]<p[i+1]<p[i+2] or p[i]>p[i+1]>p[i+2]:\n count+=1\n\nprint(count)\n\n', 'n=int(input())\np=list(map(int,input().split()))\n\ncount=0\n\nfor i in range(n-2):\n if p[i]<p[i+1]<p[i+2] or p[i]>p[i+1]>p[i+2]:\n count+=1\n\...
['Runtime Error', 'Accepted']
['s069580348', 's357834451']
[2940.0, 2940.0]
[19.0, 18.0]
[151, 159]
p02988
u192088280
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
["def main():\n n = int(input())\n p = list(map(int, input().split()))\n\n count = 0\n for i, p_i in enumerate(p):\n if i == n-2:\n break\n \n if p[i-1] < p_i and p_i < p[i+1]:\n count += 1\n print(count)\nif __name__ == '__main__':\n main()\n\n ", "def ma...
['Wrong Answer', 'Accepted']
['s606030309', 's338526779']
[2940.0, 3060.0]
[19.0, 17.0]
[293, 310]
p02988
u200527996
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int, input().split()))\nans = 0\nfor i in range(n-2):\n if p[i] > p[i+1] > p[i+1] or p[i+1] > p[i+1] > p[i]:\n ans += 1\nprint(ans)', 'n = int(input())\np = list(map(int, input().split()))\nans = 0\nfor i in range(n-2):\n if p[i] > p[i+1] > p[i+2] or p[i+2] > p[i+1] > p[i]:...
['Wrong Answer', 'Accepted']
['s659382675', 's868855588']
[3060.0, 3060.0]
[17.0, 17.0]
[166, 166]
p02988
u202727309
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['\nn = int(input())\nP = [i for i in range(n)]\ncnt = 0\nfor i in range(1:n-1):\n if (P[i-1] < P[i] < P[i+1]) or (P[i-1] > P[i] > P[i+1]):\n cnt += 1\nprint(cnt)', ' \nn = int(input())\n \nP = list(map(int, input().split()))\ncnt = 0\nfor i in range(1, n-1):\n if (P[i-1] < P[i] < P[i+1]) or (P[i-1] ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s024683454', 's115381190', 's130135033']
[2940.0, 3060.0, 3060.0]
[17.0, 19.0, 20.0]
[163, 192, 188]
p02988
u202826462
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = input().split()\n\ncnt = 0\nfor i in range(1, n - 1):\n if (p[i - 1] < p[i] < p[i+1] or p[i-1] < p[i] < p[i + 1]):\n cnt += 1\n else:\n continue\n\nprint(cnt)\n', 'n = int(input())\np = list(map(int, input().split()))\n\ncnt = 0\nfor i in range(1, n - 1):\n if p[i - 1] < p...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s312187707', 's865615844', 's986383945']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[191, 205, 199]
p02988
u203022424
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int, input().split(" ")))\n\nmin1 = 20\nmin2 = 20\nfor pi in p:\n if min1 > pi:\n min2 = min1\n min1 = pi\nprint(min2)', 'n = int(input())\np = list(map(int, input().split(" ")))\n\nc = 0\nfor i in range(1, len(p)-1):\n #print(p[i-1], p[i] ,p[i+1])\n if (p[i] > p[i-1] and p[i] ...
['Wrong Answer', 'Accepted']
['s784574820', 's464942753']
[3060.0, 3060.0]
[17.0, 18.0]
[147, 219]
p02988
u207799478
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['import math\n#import numpy\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\nn = int(input())\np = readints()\nprint(p)\nsum = 0\nfor i in range(n-2):\n #print(p[i], end="")\n #print(p[i+1], end="")\n #print(p[i+2], end="")\n if p[i] < p[i+1] < p[i+2] or p[i] > p[i+1] > p[i+2]:\n ...
['Wrong Answer', 'Accepted']
['s004666687', 's225125469']
[3060.0, 3060.0]
[17.0, 17.0]
[323, 324]
p02988
u217303170
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input)\np = list(map(int, input().split()))\nans=0\nx=0\nfor i in range(n+1):\n\tif p[x] < p[x+1]:\n\t\tans+=1\n\t\tx+=1\nprint(ans)', 'n=int(input())\np = list(map(int, input().split()))\nans=0\n\nfor i in range(1,n-1):\n if p[i-1]<p[i]<p[i+1] or p[i+1]<p[i]<p[i-1]:\n ans+=1\nprint(ans)']
['Runtime Error', 'Accepted']
['s117981482', 's190837569']
[2940.0, 3060.0]
[17.0, 17.0]
[125, 149]
p02988
u217556271
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
["import math\nimport string\nimport itertools\nimport fractions\nimport heapq\nimport collections\nimport re\nimport array\nimport bisect\nimport sys\nimport random\nimport time\ninf = 10**9\n\n\ndef main():\n n = int(input())\n p = list(map(int, input().split()))\n\n count = 0\n for i in range(1, n-1):\n ...
['Wrong Answer', 'Accepted']
['s342570518', 's118914981']
[6736.0, 6868.0]
[101.0, 74.0]
[460, 462]
p02988
u219226973
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = 5\nnum_list = [1,2,3,2,1]\ncount = 0\nfor i in range(len(num_list)-3):\n\thoge = num_list[i:i+3].sort_values()\n if hoge[1] = num_list[1]:\n count += 1\n \nprint(count)\n ', "if __name__ == '__main__':\n z = input()\n num_list = input()\n count = 0\n for i in range(z-3):\n hoge = num_list[i:i+3]\n ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s135818886', 's199050415', 's219287431', 's466519537', 's722712450', 's988909347']
[2940.0, 2940.0, 3060.0, 3060.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 19.0]
[173, 212, 299, 263, 317, 306]
p02988
u219466830
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = map(int, input().split())\n\ncount = 0\n\nfor i in range(1, n-1):\n if sorted(p[i-1:i+1]).index(p[i]) == 1:\n count += 1\n\nprint(count)', 'n = int(input())\np = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(1, n-1):\n if sorted(p[i-1:i+2]).index(p[i]) == 1:\n ...
['Runtime Error', 'Accepted']
['s269312031', 's974002083']
[2940.0, 3060.0]
[17.0, 17.0]
[159, 165]
p02988
u222643068
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=list(map(input.split()))\n\ncount=0\nfor i in range(1,len(n)-1):\n if (n[i-1]<n[i] and n[i]<n[i+1]) or (n[i-1]>n[i] and n[i]>n[i+1]):\n count+=1\nprint(count)', 's=input()\nn=list(map(int,input().split()))\n\ncount=0\nfor i in range(1,len(n)-1):\n if (n[i-1]<n[i] and n[i]<n[i+1]) or (n[i-1]>n[i] and n[i]>n[i+1...
['Runtime Error', 'Accepted']
['s670489247', 's994014506']
[3060.0, 3316.0]
[17.0, 20.0]
[158, 175]
p02988
u223555291
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['a=int(input())\nb=list(map(int,input().split()))\ni=0\nc=0\nfor i in range(a-1):\n if b[i-1]<b[i]<b[i+1]:\n c+=1\n i+=1\nprint(c)', 'n=int(input())\np=list(map(int,input().split()))\na=0\nfor i in range(n-2):\n if (p[i+1]>p[i] and p[i+1]<p[i+2]) or (p[i+1]<p[i] and p[i+1]>p[i+2]):\n a+=1\nprint(a)']
['Wrong Answer', 'Accepted']
['s045052817', 's003150928']
[2940.0, 3060.0]
[17.0, 18.0]
[126, 169]
p02988
u235837041
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int, input().split()))\n\ncount = 0\nfor num in range(1, len(p)-1):\n print(p[num])\n if (p[num - 1] < p[num] < p[num + 1]) or (p[num - 1] > p[num] > p[num + 1]) :\n count+=1\nprint(count)', 'n = int(input())\np = list(map(int, input().split()))\n\n\ncount = 0\nfor num in r...
['Wrong Answer', 'Accepted']
['s925258206', 's845889460']
[3064.0, 3060.0]
[17.0, 17.0]
[224, 208]
p02988
u243312682
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
["def main():\n n = int(input())\n p = list(map(int, input().split()))\n cnt = 0\n\n for i in range(1, n-1):\n print(p[i-1], p[i], p[i+1])\n if (p[i-1] < p[i] and p[i] < p[i+1]) \\\n or (p[i-1] > p[i] and p[i] > p[i+1]):\n cnt += 1\n print(cnt)\n\nif __name__ == '__ma...
['Wrong Answer', 'Accepted']
['s277332642', 's675145121']
[3064.0, 3064.0]
[17.0, 18.0]
[322, 286]
p02988
u246975555
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['N = int(input())\nnum = [int(i) for i in range(N)]\n\ncount = 0\n\nfor i in range(N-2):\n num_ = num[i:i+3]\n if max(num_) != num_[1] and min(num_) != num_[1]:\n count += 1\n\nprint(count)\n ', 'N = int(input())\nnum = input().split()\n \ncount = 0\n \nfor i in range(N-3):\n if num[i] < num[i+1] < num[i+2]:\n ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s013909249', 's421003162', 's421589071', 's991936005']
[2940.0, 3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[186, 190, 192, 174]
p02988
u247554097
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\narr = list(map(int, input().split()))\ncount = 0\nfor i in range(1, n - 1):\n if arr[i - 1] < arr[i] < arr[i + 1]:\n count += 1\n\nprint(count)\n', 'n = int(input())\narr = list(map(int, input().split()))\ncount = 0\nfor i in range(1, n - 1):\n if arr[i - 1] < arr[i] < arr[i + 1] or arr...
['Wrong Answer', 'Accepted']
['s415887502', 's518728323']
[3316.0, 3060.0]
[21.0, 17.0]
[165, 201]
p02988
u248670337
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['#ABC132 A\nS = list(input())\nS.sort()\nif S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:\n print("Yes")\nelse:\n print("No")', '#ABC132 B\nn = int(input())\np = list(map(int, input().split()))\nC = 0\nfor i in range(1, n - 1):\n L = [p[i - 1], p[i], p[i + 1]]\n L.sort()\n if p[i] == L[1]:\n C ...
['Runtime Error', 'Accepted']
['s692169037', 's331912498']
[2940.0, 2940.0]
[17.0, 17.0]
[126, 187]
p02988
u251075661
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\nPs = list(map(int, input().split()))\n\ncount = 0\nfor i in range(1, n - 1):\n if (p[i-1] < p[i]) and (p[i] < p[i+1]):\n count += 1\n elif (p[i-1] > p[i]) and (p[i] > p[i+1]):\n count += 1\n\nprint(count)', 'n = int(input())\nPs = list(map(int, input().split()))\n\ncount = 0\nfor i in range(...
['Runtime Error', 'Accepted']
['s240230794', 's941657852']
[3060.0, 3060.0]
[20.0, 17.0]
[220, 228]
p02988
u253220242
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\narr = [map(int, input().split())]\nprint(sum([1 for i in range(len(arr)) if (((arr[i] < arr[i+1]) and (arr[i] > arr[i-1])) or ((arr[i] > arr[i+1]) and (arr[i] < arr[i-1])))]))\n', 'n = int(input())\narr = list(map(int, input().split()))\ncount = 0\nfor i in range(1, len(arr)-1):\n if (arr[i+1] - ar...
['Runtime Error', 'Accepted']
['s400580882', 's580455426']
[9160.0, 9184.0]
[23.0, 28.0]
[192, 174]
p02988
u255943004
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['N = int(N)\nP = [int(i) for i in input().split()]\nans = 0\nfor i in range(N-2):\n if max(P[i:i+3]) != P[i+1] and min(P[i:i+3]) != P[i+1]:\n ans += 1\nprint(ans)', 'N = int(input())\nP = [int(i) for i in input().split()]\nans = 0\nfor i in range(N-2):\n if max(P[i:i+3]) != P[i+1] and min(P[i:i+3]) != P[i+1]:\n ...
['Runtime Error', 'Accepted']
['s496680662', 's150114300']
[3060.0, 2940.0]
[18.0, 17.0]
[159, 166]
p02988
u258808501
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=map(int, input().split())\ncnt=0\n\nfor i in range(n-2):\n l=p[i:i+2]\n if l[0]>=l[1] and l[1]>=l[2]:\n cnt+=1\n if l[2]>=l[1] and l[1]>=l[0]:\n cnt+=1\n\nprint (cnt)', 'n=int(input())\np=list(map(int, input().split()))\ncnt=0\n\nfor i in range(n-2):\n l=p[i:i+2]\n if l[0]>=l[1] and l[1]>...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s362589217', 's548507597', 's578473995', 's524989535']
[3064.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[182, 188, 205, 205]
p02988
u264508862
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['input();a=0\nprint([sorted(i)[1]==i[1]for i in [list(map(int,input().split()))[i:i+3] for i in range(len(list(map(int,input().split())))-4)]].count(True))', 'def c(x,s):\n return [x[i:i+s]for i in range(len(x)-s+1)]\ninput()\nprint([sorted(i)[1]==i[1]for i in c(list(map(int,input().split())),3)].count(True))']
['Runtime Error', 'Accepted']
['s382465558', 's350070079']
[3060.0, 3060.0]
[17.0, 18.0]
[153, 151]
p02988
u264989012
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int,input().split()))\ni = 1\nans = 0\nwhile i =< n-2:\n if (p[i]-p[i-1])*(p[i]-p[i+1]) < 0:\n ans += 1\n if (p[i]-p[i-1])*(p[i]-p[i+1]) = 0:\n if p[i] < p[i-1] or p[i] < p[i+1]:\n ans += 1\n i += 1\nprint("%d",ans)', 'n = int(input())\np = list(map(int,input().split()))\n...
['Runtime Error', 'Accepted']
['s227820108', 's261049340']
[2940.0, 3064.0]
[17.0, 17.0]
[249, 245]
p02988
u266054689
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\nl = list(map(int, input().split()))\n\ncnt = 0\nl_ext = []\n\nfor i in range(n-2):\n l_ext.clear()\n l_ext.append(l[i])\n l_ext.append(l[i+1])\n l_ext.append(l[i+2])\n if not l_ext.index(max(l_ext)) and not l_ext.index(min(l_ext)):\n cnt += 1\n i += 1\n\nprint(cnt)', 'n = int(input())\nl = ...
['Wrong Answer', 'Accepted']
['s330480288', 's340618023']
[3064.0, 3064.0]
[17.0, 17.0]
[277, 247]
p02988
u267300160
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['N = int(input())\nP = list(map(int,input().split()))\nans = 0\nfor i in range(N-2):\n p = P[i:i+3]\n print(p)\n if min(p)!=p[1] and max(p)!=p[1]:\n ans += 1\nprint(ans)\n', 'N = int(input())\nP = list(map(int,input().split()))\nans = 0\nfor i in range(N-2):\n p = P[i:i+3]\n if min(p)!=p[1] and m...
['Wrong Answer', 'Accepted']
['s481758211', 's172462684']
[2940.0, 3060.0]
[17.0, 17.0]
[177, 164]
p02988
u270467412
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n = int(input())\np = list(map(int, input().split()))\n\nans = 0\nfor i in range(1, n-1):\n if p[i-1]<p[i]<p[i+1]:\n ans += 1\nprint(ans)', 'n = int(input())\np = list(map(int, input().split()))\n\nans = 0\nfor i in range(1, n-1):\n if p[i-1]<p[i] and p[i]<p[i+1]:\n ans += 1\nprint(ans)\n', 'n = int(input())\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s315661023', 's767009108', 's958447925']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[134, 144, 191]
p02988
u270589070
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['def OrdinaryNumber(n,p,flag=None):\n \n \n if n < 3:\n return 0\n \n \n if flag == "LessThan":\n if p[1] < p[2]:\n count = OrdinaryNumber(n-1, p[1:], "LessThan")+1\n else:\n count = OrdinaryNumber(n-1, p[1:], "GreaterThan")\n \n \n elif fla...
['Wrong Answer', 'Accepted']
['s650700682', 's666278647']
[3064.0, 3064.0]
[17.0, 17.0]
[1000, 998]
p02988
u274635633
2,000
1,048,576
We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}. Print the number of elements p_i (1 < i < n) that satisfy the following condition: * p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
['n=int(input())\np=map(int,input().split())\nans=0\nfor i in range(1,n-1):\n if p[i-1]<p[i] and p[i]<p[i+1]:\n ans+=1\nprint(ans)', 'n=int(input())\np=list(map(int,input().split()))\nans=0\nfor i in range(1,n-1):\n if max(p[i-1],p[i],p[i+1])!=p[i] and min(p[i-1],p[i],p[i+1])!=p[i]:\n ans+=1\nprint(ans)']
['Runtime Error', 'Accepted']
['s575940454', 's080360038']
[2940.0, 3060.0]
[17.0, 17.0]
[126, 168]