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
|
---|---|---|---|---|---|---|---|---|---|---|
p04019 | u027929618 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s=input()\nif (("N" in s) and ("S" in s)) or (("E" in s) and ("W" in s)):\n print("No")\nelse:\n print("Yes")\n', 'S = input()\nif (("N" in S) ^ ("S" in S)) | (("E" in S) ^ ("W" in S)):\n print("No")\nelse:\n print("Yes")\n'] | ['Wrong Answer', 'Accepted'] | ['s514972671', 's352328127'] | [2940.0, 2940.0] | [17.0, 17.0] | [108, 105] |
p04019 | u033524082 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s=input()s=input()\nif "N" in s and "S" in s and "W" in s and "E" in s:\n print("Yes")\nelif "N" in s and "S" in s:\n print("Yes" if "W" in s or "E" in s else "No")\nelse:\n print("Yes" if "N" in s or "S" in s else "No")', 's=input()\nif "N" in s and "S" in s and "W" in s and "E" in s:\n print("Yes")\nelif "N" in s and "S" in s:\n print("No" if "W" in s or "E" in s else "Yes")\nelif "W" in s and "E" in s:\n print("No" if "N" in s or "S" in s else "Yes")\nelse:\n print("No") '] | ['Runtime Error', 'Accepted'] | ['s527604111', 's533000033'] | [2940.0, 3060.0] | [17.0, 18.0] | [223, 260] |
p04019 | u052347048 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['a = input()\nW = a.count("W")\nS = a.count("S")\nE = a.count("E")\nN = a.count("N")\nprint("YES" if N-S == 0 and W-E == 0 else "No")', 'a = input()\nfor i in ["SN","EW","ENSW"]:\n if set(i) == set(a):\n print("Yes")\n exit()\nprint("No")'] | ['Wrong Answer', 'Accepted'] | ['s945843896', 's110465650'] | [2940.0, 2940.0] | [18.0, 18.0] | [127, 113] |
p04019 | u057964173 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["def input(): return sys.stdin.readline().strip()\n\ndef resolve():\n s=input()\n if 'N' in s and 'S' in s and 'W' in s and 'E' in s:\n ans='Yes'\n elif 'N' in s and 'S' in s and 'W' not in s and 'E' not in s:\n ans='Yes'\n elif 'N' not in s and 'S' not in s and 'W' in s and 'E' in s:\n ans='Yes'\n else:\n ans='No'\n print(ans)\nresolve()", "import sys\ndef input(): return sys.stdin.readline().strip()\n\ndef resolve():\n s=set(input())\n ans='No'\n if s==set('NSWE') or s==set('NS') or s==set('WE'):\n ans='Yes'\n print(ans)\nresolve()"] | ['Runtime Error', 'Accepted'] | ['s570459864', 's195728283'] | [3060.0, 2940.0] | [18.0, 17.0] | [372, 205] |
p04019 | u064246852 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = input()\nfrom collections import defaultdict\nd = defaultdict(bool)\ndef inv(c):\n dic = {"W":"E", "E":"W", "S":"N", "N":"S"}\n return dic[c]\nfor c in s:\n d[c] = True\ndef sol():\n for c in "NSWE":\n if d[c] == True and d[inv(c)] == False:\n return False\n return True\nprint("YNEOS"[not sol()::2]) ', 's = input()\nfrom collections import defaultdict\nd = defaultdict(bool)\ndef inv(c):\n dic = {"W":"E", "E":"W", "S":"N", "N":"S"}\n return dic[c]\nfor c in s:\n d[c] = True\ndef sol():\n for c in "NSWE":\n if d[c] == True and d[inv(c)] == False:\n return False\n return True\nprint("YNeos"[not sol()::2]) '] | ['Wrong Answer', 'Accepted'] | ['s973544085', 's863222018'] | [3316.0, 3316.0] | [21.0, 21.0] | [326, 326] |
p04019 | u086503932 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S = input()\na = S.count('N')\nb = S.count('S')\nc = S.count('E') \nd = S.count('W')\n\nif a*b > 0 and c==0 and d==0:\n print('Yes')\nelif c*d >0 and a==0 and b==0:\n print('Yes')\nelif a==0 and b==0 and c==0 and d==0:\n print('Yes')\nelse:\n print('No')", "S = input()\na = S.count('N')\nb = S.count('S')\nc = S.count('E') \nd = S.count('W')\n\nif a*b*c*d > 0:\n print('Yes')\nelif a*b > 0 and c==0 and d==0:\n print('Yes')\nelif c*d >0 and a==0 and b==0:\n print('Yes')\nelif a==0 and b==0 and c==0 and d==0:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s400551564', 's239290941'] | [3064.0, 3064.0] | [18.0, 18.0] | [245, 278] |
p04019 | u089032001 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["def inpl():\n return list(map(int, input().split()))\n\n\ndef f(a, b):\n if a == 0 and b == 0:\n return True\n elif a * b == 0:\n return False\n else:\n return True\n\nS = input()\n\nN = S.count('N')\nW = S.count('W')\nS = S.count('S')\nE = E.count('E')\n\nif f(N, S) is True and f(W, E) is True:\n print('Yes')\nelse:\n print('No')", "def inpl():\n return list(map(int, input().split()))\n\n\ndef f(a, b):\n if a == 0 and b == 0:\n return True\n elif a * b == 0:\n return False\n else:\n return True\n\n\nS = input()\n# print(S)\ncN = S.count('N')\ncW = S.count('W')\ncS = S.count('S')\ncE = S.count('E')\n\nif f(cN, cS) is True and f(cW, cE) is True:\n print('Yes')\nelse:\n print('No')\n"] | ['Runtime Error', 'Accepted'] | ['s069269449', 's407719525'] | [3064.0, 3060.0] | [17.0, 17.0] | [349, 369] |
p04019 | u089230684 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['def main():\n for line in sys.stdin:\n\t\ts = line\n\t\tif ((\'N\' in s) and (\'S\' in s)) and not ((\'W\' in s) or (\'E\' in s)):\n\t\t\tprint("Yes")\n\t\telif ((\'W\' in s) and (\'E\' in s)) and not ((\'N\' in s) or (\'S\' in s)):\n\t\t\tprint("Yes")\n\t\telif ((\'W\' in s) and (\'E\' in s)) and ((\'N\' in s) and (\'S\' in s)):\n\t\t\tprint("Yes")\n\t\telse:\n\t\t\tprint("No")', "from sys import stdin\n\ndef main():\n M = stdin.readline().strip()\n S,E,N,W=False,False,False,False\n for i in M:\n if i == 'S':\n S = True\n elif i == 'E':\n E = True\n elif i == 'N':\n N = True\n elif i == 'W':\n W = True\n if S == N and E == W:\n print('Yes')\n else:\n print('No')\n\nmain()\n"] | ['Runtime Error', 'Accepted'] | ['s540854186', 's305878400'] | [2940.0, 3060.0] | [17.0, 20.0] | [328, 379] |
p04019 | u102461423 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["se = set(input())\nbl = not ((se ^ set('WE')) or (se ^ set('NS')))\nprint('Yes' if bl else 'No')", "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nS = read().decode()\n\nN, W, S, E = 'N' in S, 'W' in S, 'S' in S, 'E' in S\n\ncond1 = not N ^ S\ncond2 = not W ^ E\n\nprint('Yes' if cond1 and cond2 else 'No')"] | ['Wrong Answer', 'Accepted'] | ['s626072543', 's111069897'] | [2940.0, 9092.0] | [17.0, 28.0] | [94, 270] |
p04019 | u102960641 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['n = int(input())\na = [int(input()) for i in range(n)]\nb = sorted(a[::2])\na.sort()\nnow = 0\nans = 0\nbr = (n+1) // 2\nfor k,v in enumerate(a):\n if b[now] == v:\n ans += abs(k-now*2)\n now += 1\n if now == br:\n break\nprint(ans)', 'n = set(list(input()))\nif n == set("N","S") or n == set("W","E") or n == set("N","S","W","E")\n print("Yes")\nelse:\n print("No")', 'n = set(list(input()))\nif n == set(["N","S"]) or n == set(["W","E"]) or n == set(["N","S","W","E"]):\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s103417228', 's172506545', 's243980379'] | [3064.0, 2940.0, 3060.0] | [17.0, 18.0, 17.0] | [230, 128, 135] |
p04019 | u103902792 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\n\ndef f(a,b):\n return (a in s and b not in s) or (b in s and a not in s):\n \nif f('W', 'E') or f('N', 'S'):\n print('No')\nelse:\n print('Yes')", "s = input()\n\ndef f(a,b):\n return (a in s and b not in s) or (b in s and a not in s)\n \nif f('W', 'E') or f('N', 'S'):\n print('No')\nelse:\n print('Yes')\n\n"] | ['Runtime Error', 'Accepted'] | ['s989029118', 's917672452'] | [2940.0, 2940.0] | [18.0, 17.0] | [154, 155] |
p04019 | u125348436 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = input()\n\n\ndef walk(s):\n ls = len(s)\n nc = 0\n sc = 0\n wc = 0\n ec = 0\n l=[]\n for i in range(ls):\n if s[i] == "W":\n wc += 1\n l.append(wc)\n elif s[i] == "E":\n ec += 1\n l.append(ec)\n elif s[i] == "N":\n nc += 1\n l.append(nc)\n else:\n sc += 1\n l.append(sc)\n if (wc>0 and ec==0) or (wc==0 and ec>0) or (nc==0 and sc>0) or (nc>0 and sc==0):\n print("NO")\n return\n \n else:\n print("YES")\n return\n\n\nwalk(s)\n', 's=input()\n\ndef walk(s):\n ls=len(s)\n if ls%2==1:\n print("NO")\n return\n nc=0\n sc=0\n wc=0\n ec=0\n for i in range(ls):\n if s[i]="W":\n wc+=1\n elif s[i]="E":\n ec+=1\n elif s[i]="N":\n nc+=1\n else:\n sc+=1\n if wc==ec and nc==sc:\n print("YES")\n return\n else:\n print("NO")\n return\nwalk(s)\n ', 's = input()\n\n\ndef walk(s):\n ls = len(s)\n nc = 0\n sc = 0\n wc = 0\n ec = 0\n l=[]\n for i in range(ls):\n if s[i] == "W":\n wc += 1\n l.append(wc)\n elif s[i] == "E":\n ec += 1\n l.append(ec)\n elif s[i] == "N":\n nc += 1\n l.append(nc)\n else:\n sc += 1\n l.append(sc)\n if (wc>0 and ec==0) or (wc==0 and ec>0) or (nc==0 and sc>0) or (nc>0 and sc==0):\n print("No")\n return\n \n else:\n print("Yes")\n return\nwalk(s)\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s191817379', 's414469097', 's959161994'] | [9148.0, 8844.0, 8980.0] | [27.0, 34.0, 30.0] | [571, 339, 569] |
p04019 | u137667583 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S = input()\ni = 0\nX = [False,False]\nY = [False,False]\nflg = False\nwhile(i < len(S)):\n if S[i:i+1] == 'N':\n X[0] = True\n elif S[i:i+1] == 'S':\n X[1] = True\n elif S[i:i+1] == 'W':\n Y[0] = True\n elif S[i:i+1] == 'E':\n Y[1] = True\n print(X,Y)\n if X[0]==X[1] and Y[0]==Y[1]:\n flg = True\n break\n i+=1\nprint('Yes' if flg else 'No')\n", "print('NYoe s'[set(input())in map(set,['','NS','EW','NSEW'])::2])"] | ['Wrong Answer', 'Accepted'] | ['s065312383', 's615016978'] | [3188.0, 2940.0] | [20.0, 18.0] | [388, 65] |
p04019 | u143051858 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\n\nn = 0\ne = 0\nw = 0\ns = 0\n\nfor v in s:\n if v == 'N': n+=1\n if v == 'E': e+=1\n if v == 'W': w+=1\n if v == 'S': s+=1\n\nif n == s and e == w:\n print('Yes')\nelse:\n print('No')", "S = input()\n\nn = 0\ne = 0\nw = 0\ns = 0\n\nfor v in S:\n if v == 'N': n+=1\n if v == 'E': e+=1\n if v == 'W': w+=1\n if v == 'S': s+=1\nif ((0<n and 0<s) or (n==0 and s==0)) and ((0<e and 0<w) or (e==0 and w==0)):\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s378800675', 's044612483'] | [8888.0, 8984.0] | [23.0, 27.0] | [199, 254] |
p04019 | u151625340 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S = input()\nN = len(S)\nd = [0,0,0,0]\ns = ['N','W','S','E']\nfor i in range(N):\n for j in range(3):\n if S[i] == s[j]:\n d[j] += 1\n break\nflag = True\nif (d[0] == 0 and d[2] == 0) or (d[0] != 0 and d[2] != 0):\n pass\nelse:\n flag = False\nif (d[1] == 0 and d[3] == 0) or (d[1] != 0 and d[3] != 0):\n pass\nelse:\n flag = False\n \nif flag:\n print('Yes')\nelse:\n print('No')\n", "S = input()\nN = len(S)\nd = [0,0,0,0]\ns = ['N','W','S','E']\nfor i in range(N):\n for j in range(4):\n if S[i] == s[j]:\n d[j] += 1\n break\n\nflag = True\nif (d[0] == 0 and d[2] == 0) or (d[0] != 0 and d[2] != 0):\n pass\nelse:\n flag = False\nif (d[1] == 0 and d[3] == 0) or (d[1] != 0 and d[3] != 0):\n pass\nelse:\n flag = False\n \nif flag:\n print('Yes')\nelse:\n print('No')\n\n"] | ['Wrong Answer', 'Accepted'] | ['s154743044', 's116124410'] | [3064.0, 3188.0] | [19.0, 21.0] | [413, 415] |
p04019 | u163320134 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s=input()\nans=[0]*4\nchecK='NWSE'\nfor i in range(len(s)):\n for j in range(len(check)):\n if s[i]==check[j]:\n ans[j]+=1\nif (ans[0]%2+ans[2]%2)%2==0 and (ans[1]%2+ans[3]%2)%2==0:\n print('Yes')\nelse:\n print('No')", "s=input()\nans=[0]*4\nchecK='NWSE'\nfor i in range(len(s)):\n for j in range(len(check)):\n if s[i]==check[j]:\n ans[j]+=1\nif (ans[0]+ans[2])%2==0 and (ans[1]+ans[3])%2==0:\n print('Yes')\nelse:\n print('No')", "s=input()\nans=[0]*4\ncheck='NWSE'\nfor i in range(len(s)):\n for j in range(len(check)):\n if s[i]==check[j]:\n ans[j]=1\nif (ans[0]+ans[2])%2==0 and (ans[1]+ans[3])%2==0:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s737699837', 's933711930', 's144283692'] | [9036.0, 3060.0, 9128.0] | [26.0, 17.0, 25.0] | [218, 210, 209] |
p04019 | u163421511 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\n\na = 'N' in s\nb = 'S' in s\nc = 'E' in s\nd = 'W' in s\nans = all([a == b, c == d])\nprint(ans)\n\n", "s = input()\n\na = 'N' in s\nb = 'S' in s\nc = 'E' in s\nd = 'W' in s\n\nans = 'Yes' if all([a == b, c == d]) else 'No'\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s733530629', 's254647760'] | [8892.0, 9020.0] | [28.0, 32.0] | [105, 124] |
p04019 | u167908302 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["# coding:utf-8\n\nS = input()\nn = S.count('N')\ns = S.count('S')\ne = S.count('E')\nw = S.count('W')\nprint(n, s, e, w)\n\nif (n == 0 and s != 0) or (n != 0 and s == 0):\n print('No')\nelif (e == 0 and w != 0) or (e != 0 and w == 0):\n print('No')\nelse:\n print('Yes')\n", "# coding:utf-8\n\nS = input()\nn = S.count('N')\ns = S.count('S')\ne = S.count('E')\nw = S.count('W')\n# print(n, s, e, w)\n\nif (n == 0 and s != 0) or (n != 0 and s == 0):\n print('No')\nelif (e == 0 and w != 0) or (e != 0 and w == 0):\n print('No')\nelse:\n print('Yes')\n"] | ['Wrong Answer', 'Accepted'] | ['s182306862', 's489499191'] | [3060.0, 3060.0] | [17.0, 17.0] | [266, 268] |
p04019 | u170324846 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['def NS(S):\n return ("N" in S) ^ ("S" in S)\n\ndef EW(S):\n return ("E" in S) ^ ("W" in S)\n\nS = input()\nif NS(S) and EW(S):\n print("Yes")\nelse:\n print("No")\n', 'def NS(S):\n return ("N" in S) ^ ("S" in S)\n\ndef EW(S):\n return ("E" in S) ^ ("W" in S)\n\n\n\nS = input()\nif not(NS(S)) and not(EW(S)):\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s303221218', 's678028726'] | [2940.0, 3060.0] | [19.0, 18.0] | [157, 168] |
p04019 | u177398299 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = set(input())\nif len(s) == 4 and (len(s) == 2 and (s == {'S', 'N'} or s == {'E', 'W'})):\n print('Yes')\nelse:\n print('No')", "s = set(input())\nif len(s) == 4 or (len(s) == 2 and (s == {'S', 'N'} or s == {'E', 'W'})):\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s798682156', 's878897861'] | [2940.0, 3064.0] | [17.0, 19.0] | [130, 129] |
p04019 | u178432859 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = list(set(input()))\nl = [["N","S"], ["W","E"], ["N", "S", "W", "E"]]\ndame = True\nfor i in l:\n for j in s:\n x = 0\n if j in i:\n x += 1\n else:\n pass\n if x == len(s):\n print("Yes")\n exit()\nprint("No")\n ', 's = list(set(input()))\nl = [["N","S"], ["W","E"], ["N", "S", "W", "E"]]\nif len(s) != 2 and len(s) != 4:\n print("No")\n exit()\nfor i in l:\n x = 0\n for j in s:\n if j in i:\n x += 1\n if x == len(i):\n print("Yes")\n exit()\nprint("No")'] | ['Wrong Answer', 'Accepted'] | ['s818403537', 's915503537'] | [3060.0, 3064.0] | [17.0, 17.0] | [275, 274] |
p04019 | u186426563 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\nprint('Yes' if('W' in s == 'E' in s and 'S' in s == 'N' in s) else 'No')", "s = input()\nprint('Yes' if(('W' in s)==('E' in s) and ('N' in s)==('S' in s)) else 'No')"] | ['Wrong Answer', 'Accepted'] | ['s569253180', 's965090766'] | [2940.0, 3064.0] | [17.0, 17.0] | [84, 88] |
p04019 | u198930868 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['i = input()\ns = i.count("S")\nn = i.count("N")\ne = i.count("E")\nw = i.count("W")\nprint(s,n,e,w)\n\nif s == n and e == w:\n print("Yes")\nelse:\n print("No")\n', 'i = input()\n\nif "S" in i and "N" not in i:\n print("No")\nelif "N" in i and "S" not in i:\n print("No")\nelif "E" in i and "W" not in i: \n\tprint("No")\nelif "W" in i and "E" not in i: \n\tprint("No")\nelse:\n \tprint("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s092233623', 's996707478'] | [8976.0, 8984.0] | [27.0, 26.0] | [153, 220] |
p04019 | u268792407 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s=input()\nif "N" in s:\n if "S" not in s:\n print("No")\n exit()\nif "S" in s:\n if "N" not in s:\n print("No")\n exit()\nif "W" in s:\n if "E" not in s:\n print("No")\n exit()\nif "E" in s:\n if "W" not in s:\n print("No")\n exit()', 's=input()\nif "N" in s:\n if "S" not in s:\n print("No")\n exit()\nif "S" in s:\n if "N" not in s:\n print("No")\n exit()\nif "W" in s:\n if "E" not in s:\n print("No")\n exit()\nif "E" in s:\n if "W" not in s:\n print("No")\n exit()\nprint("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s763443590', 's326429163'] | [3060.0, 3060.0] | [17.0, 18.0] | [245, 258] |
p04019 | u276686572 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['string = input()\n\nc1 = True\nc2 = True\nc3 = True\n\nif ("W" in string and not("E" in string) or "E" in string and not("W" in string): c1 = False\n \nif ("N" in string and not("S" in string) or "S" in string and not("N" in string): c2 = False\n\nif "N" in string and "S" in string and "E" in string and "W" in string:\n N = string.count("N")\n S = string.count("S")\n W = string.count("W")\n E = string.count("E")\n if not(N/S == W/E or N/S == E/W): c3 = False\n \nif c1 and c2 and c3: print("Yes")\nelse: print("No")', 'string = input()\n\nc1 = True\nc2 = True\nc3 = True\n\nif ("W" in string and not("E" in string)) or "E" in string and not("W" in string): c1 = False\n \nif ("N" in string and not("S" in string)) or "S" in string and not("N" in string): c2 = False\n\nif "N" in string and "S" in string and "E" in string and "W" in string:\n N = string.count("N")\n S = string.count("S")\n W = string.count("W")\n E = string.count("E")\n if not(N/S == W/E or N/S == E/W): c3 = False\n \nif c1 and c2 and c3: print("Yes")\nelse: print("No")'] | ['Runtime Error', 'Accepted'] | ['s313344487', 's469747961'] | [8896.0, 9056.0] | [23.0, 24.0] | [522, 524] |
p04019 | u278886389 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["c = list(input())\nprint(['YES','NO'][('N' in c)^('S' in c)or('E' in c)^('W' in c)])", "c = list(input())\nprint(['Yes','No'][('N' in c)^('S' in c)or('E' in c)^('W' in c)])"] | ['Wrong Answer', 'Accepted'] | ['s334077981', 's306004809'] | [2940.0, 2940.0] | [17.0, 17.0] | [83, 83] |
p04019 | u288430479 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = input()\nif "N" in s:\n if "S" in s:\n continue\n else:\n print("No")\n exit()\nif "E" in s:\n if "W" in s:\n continue\n else:\n print("no")\n exit()\nprint("Yes")', 's = input()\nif "N" in s:\n if "S" not in s :\n print("No")\n exit()\nif "E" in s:\n if "W" not in s:\n print("No")\n exit()\nif "S" in s:\n if "N" not in s :\n print("No")\n exit()\nif "W" in s:\n if "E" not in s:\n print("No")\n exit()\nprint("Yes")'] | ['Runtime Error', 'Accepted'] | ['s636631687', 's502203476'] | [2940.0, 3060.0] | [18.0, 17.0] | [176, 262] |
p04019 | u294000907 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\nstr = input()\na = list(set(str))\nif len(a)==4:\n print("YES")\nelif len(a)%2==1:\n print("NO")\nelse:\n if (\'N\' in a and \'S\' in a ) or (\'W\' in a and \'E\' in a ):\n print("YES")\n else:\n print("NO")', '#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\nstr = input()\na = list(set(str))\nif len(a)==4:\n print("Yes")\nelif len(a)%2==1:\n print("No")\nelse:\n if (\'N\' in a and \'S\' in a ) or (\'W\' in a and \'E\' in a ):\n print("Yes")\n else:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s322324665', 's426950402'] | [3060.0, 3060.0] | [17.0, 19.0] | [290, 290] |
p04019 | u296150111 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['n=int(input())\na=[]\nfor i in range(n):\n\tx=int(input())\n\ta.append(x)\nans=0\nfor i in range(n-1):\n\tif a[i]>0:\n\t\tans+=(a[i]//2)\n\t\ta[i]-=(a[i]//2)*2\n\tif a[i]>0:\n\t\ta[i+1]-=min(a[i],a[i+1])\n\t\tans+=min(a[i],a[i+1])\nif a[-1]>0:\n\tans+=a[-1]//2\nprint(ans', 'n=int(input())\na=[]\nfor i in range(n):\n\tx=int(input())\n\ta.append(x)\nans=0\nfor i in range(n-1):\n\tif a[i]>0:\n\t\tans+=(a[i]//2)\n\t\ta[i]-=(a[i]//2)*2\n\tif a[i]>0:\n\t\ta[i+1]-=min(a[i],a[i+1])\n\t\tans+=min(a[i],a[i+1])\nif a[-1]>0:\n\tans+=a[-1]//2\nprint(ans)\n', '=int(input())\na=[]\nfor i in range(n):\n\tx=int(input())\n\ta.append(x)\nans=0\nfor i in range(n-1):\n\tif a[i]>0:\n\t\tans+=(a[i]//2)\n\t\ta[i]-=(a[i]//2)*2\n\tif a[i]>0:\n\t\ta[i+1]-=min(a[i],a[i+1])\n\t\tans+=min(a[i],a[i+1])\nif a[-1]>0:\n\tans+=a[-1]//2\nprint(ans)\n', 's=input()\nS=s.count("S")\nE=s.count("E")\nN=s.count("N")\nW=s.count("W")\na=0\nb=0\nif S>0 and N>0:\n\ta+=1\nelif S==N==0:\n\ta+=1\nif E>0 and W>0:\n\tb+=1\nelif E==W==0:\n\tb+=1\nif a==b==1:\n\tprint("Yes")\nelse:\n\tprint("No")\n\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s160782219', 's270199733', 's447382381', 's236663273'] | [3064.0, 3064.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 17.0] | [243, 245, 244, 208] |
p04019 | u298297089 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["dire = [0,0,0,0]\nd = {c:i for i,c in numerate('WENS')}\nfor c in input():\n\tdire[d[c]] = 1\nprint('No' if (dire[0] ^ dire[1]) or (dire[2] ^ dire[3]) else 'Yes')", "dire = [0,0,0,0]\nd = {c:i for i,c in enumerate('WENS')}\nfor c in input():\n\tdire[d[c]] = 1\nprint('No' if (dire[0] ^ dire[1]) or (dire[2] ^ dire[3]) else 'Yes')"] | ['Runtime Error', 'Accepted'] | ['s173980332', 's746022759'] | [2940.0, 3060.0] | [18.0, 18.0] | [157, 158] |
p04019 | u301302814 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['# coding: utf-8\n\ndef main():\n S = input()\n dic = {\'N\':0, \'S\':0, \'E\':0, \'W\':0}\n ans = \'No\'\n\n for s in S:\n dic[s] += 1\n\n if (dic[\'N\'] == 0 and dic[\'S\'] == 0) or (dic[\'N\'] > 0 and dic[\'S\'] > 0):\n if (dic[\'E\'] == 0 and dic[\'W\'] == 0) or (dic[\'E\'] > 0 and mp[\'W\'] > 0):\n ans = \'Yes\'\n\n print(ans)\n\nif __name__ == "__main__":\n main()\n', '# coding: utf-8\n\ndef main():\n S = input()\n dic = {\'N\':0, \'S\':0, \'E\':0, \'W\':0}\n ans = \'No\'\n\n for s in S:\n dic[s] += 1\n\n if (dic[\'N\'] == 0 and dic[\'S\'] == 0) or (dic[\'N\'] > 0 and dic[\'S\'] > 0):\n if (dic[\'E\'] == 0 and dic[\'W\'] == 0) or (dic[\'E\'] > 0 and dic[\'W\'] > 0):\n ans = \'Yes\'\n\n print(ans)\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s431826903', 's247101838'] | [9128.0, 9124.0] | [28.0, 26.0] | [373, 374] |
p04019 | u303059352 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['print("Yes" if (\'N\' in s) == (\'S\' in s) and (\'W\' in s) == (\'E\' in s) for s in [input()] else "No")\n', 'print("Yes" if \'N\' in s and \'S\' in s and \'W\' in s and\'E\' in s for s in [input()] else "No")', 's = input()\nprint("Yes" if (\'N\' in s) == (\'S\' in s) and (\'W\' in s) == (\'E\' in s) else "No")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s008552884', 's655310295', 's910931262'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [99, 91, 91] |
p04019 | u309141201 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["# import collections\nS = input()\n# CS = collections.Counter(S)\n# print(CS)\ncn = S.count('N')\nce = S.count('E')\ncs = S.count('S')\ncw = S.count('W')\nif cn > 1 and cs > 1 and ce < 0 and cw < 0:\n print('Yes')\nelif cn < 0 and cs < 0 and ce > 1 and cw > 1:\n print('Yes')\nelif cn > 1 and cs > 1 and ce > 1 and cw > 1:\n print('Yes')\nelse:\n print('No')\n", "# import collections\nS = input()\n# CS = collections.Counter(S)\n# print(CS)\ncn = S.count('N')\nce = S.count('E')\ncs = S.count('S')\ncw = S.count('W')\n# print(cn, cs, cw, ce)\nif cn > 0 and cs > 0 and ce == 0 and cw == 0:\n print('Yes')\nelif cn == 0 and cs == 0 and ce > 0 and cw > 0:\n print('Yes')\nelif cn > 0 and cs > 0 and ce > 0 and cw > 0:\n print('Yes')\nelse:\n print('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s255032560', 's762077275'] | [3060.0, 3060.0] | [17.0, 17.0] | [356, 384] |
p04019 | u314089899 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['S = str(input())\n\nif ((S.count("N") !=0 and S.count("S") !=0) or (S.count("N") ==0 and S.count("S") ==0)) and\n ((S.count("W") !=0 and S.count("E") !=0) or (S.count("W") ==0 and S.count("E") ==0)):\n print("Yes")\nelse:\n print("No")', 'S = str(input())\n\nif (S.count("N") !=0 and S.count("S") !=0) or (S.count("N") ==0 and S.count("S") ==0):\n if (S.count("W") !=0 and S.count("E") !=0) or (S.count("W") ==0 and S.count("E") ==0):\n print("Yes")\n else:\n print("No")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s329565899', 's544238253'] | [2940.0, 3060.0] | [17.0, 19.0] | [233, 268] |
p04019 | u318427318 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n\n s = input()\n s = set(s)\n\n if s == "WE" or s == "EW":\n print("Yes")\n elif s == "NS" or s == "SN":\n print("Yes") \n elif s == set(["W","E","N","S"]):\n print("Yes")\n else:\n print("No")\n\nif __name__=="__main__":\n main()', '#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n\n s = input()\n s = set(s)\n if s == "WE" or s == "EW":\n print("Yes")\n elif s == "NS" or s == "SN":\n print("Yes") \n elif s == "WENS" or s == "ENSW" or s == "NSWE" or s == "SWEN":\n print("Yes")\n else:\n print("No")\n\nif __name__=="__main__":\n main()', '#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n\n s = input().rstrip()\n s = set(s)\n WE={\'W\',\'E\'}\n NS={\'N\',\'S\'}\n all_direction={\'N\', \'E\', \'S\', \'W\'}\n\n if s == set(WE):\n print("Yes")\n elif s == set(NS):\n print("Yes") \n elif s == set(all_direction):\n print("Yes")\n else:\n print("No")\n\nif __name__=="__main__":\n main()'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s169921784', 's644502903', 's058333838'] | [9060.0, 8844.0, 9096.0] | [28.0, 30.0, 33.0] | [397, 425, 454] |
p04019 | u339443002 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['from collections import defaultdict as dd\n\ns = input().strip()\ncoll = dd(int)\n\nfor el in s:\n coll[el] += 1\n\n\ncondition = (\n min(coll["N"], coll["S"]) == 0 and\n max(coll["N"], coll["S"]) != 0 or\n min(coll["E"], coll["W"]) == 0 and\n max(coll["E"], coll["W"]) != 0)\n\nif condition:\n print("no")\nelse:\n print("yes")\n\n', 'from collections import defaultdict as dd\n\ns = input().strip()\ncoll = dd(int)\n\nfor el in s:\n coll[el] += 1\n\n\ncondition = (\n min(coll["N"], coll["S"]) == 0 and\n max(coll["N"], coll["S"]) != 0 or\n min(coll["E"], coll["W"]) == 0 and\n max(coll["E"], coll["W"]) != 0)\n\nif condition:\n print("No")\nelse:\n print("Yes")\n\n'] | ['Wrong Answer', 'Accepted'] | ['s562334696', 's640986168'] | [3444.0, 3316.0] | [27.0, 21.0] | [333, 333] |
p04019 | u344122377 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = input();\n\ns = set(s)\nprint("Yes" if s == "WE" or s == "NS" or s == "SENW" else "No")', 's = input();\n\nst = set(s)\nprint("Yes" if st == set("WE") or st == set("NS") or st == set("SENW") else "No")'] | ['Wrong Answer', 'Accepted'] | ['s631013869', 's057711170'] | [2940.0, 2940.0] | [17.0, 18.0] | [88, 107] |
p04019 | u347640436 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S = input()\nif ('N' in S) ^ ('S' in S) or ('W' in S) ^ ('E' in S):\n print('NO')\nelse:\n print('YES')\n", "S = input()\nif ('N' in S) ^ ('S' in S) or ('W' in S) ^ ('E' in S):\n print('No')\nelse:\n print('Yes')\n"] | ['Wrong Answer', 'Accepted'] | ['s636934391', 's833162813'] | [2940.0, 2940.0] | [17.0, 17.0] | [102, 102] |
p04019 | u353919145 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['def back_home():\n r=input()\n t=r.count(\'S\') +1\n y=r.count(\'N\') +1\n u=r.count(\'W\') +1\n i=r.count(\'E\')+1\n if (t>1 and y>1 and u==1 and i==1):\n print("YES")\n elif((t==1 and y==1 and u>1 and i>1):\n print("YES")\n elif ((t>1 and y>1 and u>1 and i>1):\n print("YES")\n else:\n print("NO")\n \nback_home()', 'def backhome():\n\ts = input()\n\tif ((\'N\' in s) and (\'S\' in s)) and not ((\'W\' in s) or (\'E\' in s)):\n\t\treturn "Yes"\n\telif ((\'W\' in s) and (\'E\' in s)) and not ((\'N\' in s) or (\'S\' in s)):\n\t\treturn "Yes"\n\telif ((\'W\' in s) and (\'E\' in s)) and ((\'N\' in s) and (\'S\' in s)):\n\t\treturn "Yes"\n\telse:\n\t\treturn "No"', 'def back_home(r):\n l = dict()\n for i in r:\n if i in l:\n l[i]=int(l[i])+1\n else:\n l[i]=1\n if (len(l)==1):\n return(\'NO\')\n elif(len(l)==2):\n if (len(l[\'S\'])>0 and len(l[\'N\']>0)):\n return ("yes")\n elif(len(l[\'E\'])>0 and len(l[\'W\']>0)):\n return("yes")\n else:\n return("NO")\n elif(len(l)==3):\n return("NO")\n else:\n return("YES")\n \nback_home(S):', 'def back_home():\n S=input()\n if(((\'S\'in S) and (\'N\' in S)) and not ((\'E\' in S) or (\'W\' in S))):\n print(\'Yes\')\n elif(not ((\'S\' in S) or (\'N\' in S)) and ((\'E\' in S) and (\'W\' in S))):\n print("Yes")\n elif(((\'S\'in S) and (\'N\' in S)) and ((\'E\' in S) and (\'W\' in S))):\n print("Yes")\n else:\n print("No")\n \nback_home()'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s088507066', 's920399275', 's926445282', 's802573662'] | [2940.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 17.0] | [353, 299, 473, 363] |
p04019 | u357751375 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = list(input())\nn = s.count('N')\nw = s.count('W')\ns = s.count('S')\ne = s.count('E')\nif (n + s) % 2 == 0 and (w + e) % 2 == 0:\n print('Yes')\nelse:\n print('No')", "s = input()\nwe = [0,0]\nns = [0,0]\n\nfor i in range(len(s)):\n if s[i] == ('N'):\n ns[0] == 1\n elif s[i] == ('W'):\n we[0] == 1\n elif s[i] == ('S'):\n ns[1] == 1\n else\n we[1] == 1\n\nif sum(we) % 2 == 0 and sum(ns) % 2 == 0:\n print('Yes')\nelse:\n print('No')", "l = list(input())\nn = l.count('N')\nw = l.count('W')\ns = l.count('S')\ne = l.count('E')\nif n == s or (n != 0 and s != 0):\n if w == e or (w != 0 and e != 0):\n print('Yes')\n exit(0)\nprint('No')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s366596957', 's834662135', 's694018088'] | [9004.0, 8888.0, 9052.0] | [23.0, 22.0, 33.0] | [166, 295, 206] |
p04019 | u361381049 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\nans = 'Yes'\nn = 0\nw = 0\nsow = 0\ne = 0\n#print(s)\nfor i in range(len(s)):\n if s[i] == 'N':\n n += 1\n elif s[i] == 'W':\n w += 1\n elif s[i] == 'S':\n sow += 1\n else:\n e += 1\n\n\n\nif (n == 0 and w != 0) or (n != 0 and w == 0):\n ans = 'No'\nif (sow == 0 and e != 0) or (sow != 0 and e == 0):\n ans = 'NO'\nprint('ans')", "s = input()\nans = 'Yes'\nn = 0\nw = 0\nsow = 0\ne = 0\n#print(s)\nfor i in range(len(s)):\n if s[i] == 'N':\n n += 1\n elif s[i] == 'W':\n w += 1\n elif s[i] == 'S':\n sow += 1\n else:\n e += 1\n\n\n\nif (n == 0 and sow != 0) or (n != 0 and sow == 0):\n ans = 'No'\nif (w == 0 and e != 0) or (w != 0 and e == 0):\n ans = 'No'\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s335952446', 's875717904'] | [3064.0, 3064.0] | [17.0, 17.0] | [363, 362] |
p04019 | u363610900 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["# -*- coding: utf-8 -*-\n\n\ns = set(input())\nif s in {{'N', 'S'}, {'W', 'E'}, {'N', 'W', 'S', 'N'}}:\n print('Yes')\nelse:\n print('No')\n\n ", "# -*- coding: utf-8 -*-\n\n\ns = set(input())\nif s in {{'N', 'S'}, {'W', 'E'}, {'N', 'W', 'S', 'N'}}:\n print('yes')\nelse:\n print('No')\n\n ", "# -*- coding: utf-8 -*-\n\ns = set(input())\nans = 0\nfor i in s:\n if 'N' in i:\n ans += 1\n elif 'W' in i:\n ans += -2\n elif 'S' in i:\n ans += -1\n else:\n ans += 2\nprint('Yes' if ans == 0 else 'No')\n "] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s365739409', 's962556214', 's929474779'] | [2940.0, 2940.0, 3060.0] | [17.0, 18.0, 20.0] | [143, 143, 236] |
p04019 | u367130284 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s=set(input())\nif len(s)%2==0:\n if s==set("SN") or s==set("WE"):\n print("Yes")\n else:\n print("No")\nelse:\n print("No")', 's=set(input())\nif len(s)%2==0:\n if s==set("SN") or s==set("WE") or s==set("WENW"):\n print("Yes")\n else:\n print("No")\nelse:\n print("No")', 's=set(input())\nif len(s)%2==0:\n if s==set("SN") or s==set("WE"):\n print("Yes")\nelse:\n print("No")\nelse:\n print("No")', 'from collections import*\ns=input()\n\nc=Counter(s)\n\nif (c["S"]==0 and c["N"]>0) or (c["N"]==0 and c["S"]>0) or (c["E"]==0 and c["W"]>0) or (c["W"]==0 and c["E"]>0):\n print("No")\nelse:\n print("Yes")\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s816786696', 's953711678', 's973869213', 's026179499'] | [2940.0, 2940.0, 2940.0, 3316.0] | [17.0, 18.0, 17.0, 22.0] | [126, 144, 124, 202] |
p04019 | u371467115 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s=list(input())\nif l.count("N")==l.count("S") and l.count("E")==l.count("W"):\n print("Yes")\nelse:\n print("No")', 's=list(input())\ns_s=set(s)\nl={"W","N","E","S"}\nif s_s==l:\n print("Yes")\nelse: \n print(("No")', 's=input()\nif ("S" in s)^("N" in s):\n print("No")\nelif ("W" in s)^("E" in s):\n print("No")\nelse:\n print("Yes")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s184927449', 's585434670', 's096307350'] | [2940.0, 2940.0, 2940.0] | [18.0, 18.0, 18.0] | [116, 98, 112] |
p04019 | u375616706 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\nlinp = list(map(int, input().split()))\n\ns = input()\nans = "Yes"\nif "W" in s:\n if not "E" in s:\n ans = "No"\nif "E" in s:\n if not "W" in s:\n ans = "No"\n\nif "N" in s:\n if not "S" in s:\n ans = "No"\nif "S" in s:\n if not "N" in s:\n ans = "No"\n\nprint(ans)\n', '# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\ns = input()\nans = "Yes"\nif "W" in s:\n if not "E" in s:\n ans = "No"\nif "E" in s:\n if not "W" in s:\n ans = "No"\n\nif "N" in s:\n if not "S" in s:\n ans = "No"\nif "S" in s:\n if not "N" in s:\n ans = "No"\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s770598458', 's209477664'] | [3060.0, 3060.0] | [17.0, 18.0] | [387, 348] |
p04019 | u379692329 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['S = set(input())\nflagNS = \'N\' in S == \'S\' in S\nflagEW = \'S\' in S == \'W\' in S\n\nprint("Yes" if flagNS and flagEW else "No")', 'S = input()\nflagNS = ((\'N\' in S) == (\'S\' in S))\nflagEW = ((\'E\' in S) == (\'W\' in S))\n\nprint("Yes" if flagNS and flagEW else "No")'] | ['Wrong Answer', 'Accepted'] | ['s851413431', 's242592290'] | [2940.0, 2940.0] | [17.0, 17.0] | [121, 128] |
p04019 | u394731058 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["import sys\n\ninput = sys.stdin.readline\n\ndef main():\n S = input().rstrip('\\n')\n if ('S' in S == 'N' in S) and ('E' in S == 'W' in S):\n print('Yes')\n else:\n print('No')\n\nif __name__ == '__main__':\n main()", "import sys\n\ninput = sys.stdin.readline\n\ndef main():\n S = input().rstrip('\\n')\n if 'S' in S == 'N' in S and 'E' in S == 'W' in S:\n print('Yes')\n else:\n print('No')\n\nif __name__ == '__main__':\n main()", "import sys\n\ninput = sys.stdin.readline\n\ndef main():\n S = input().rstrip('\\n')\n if (('S' in S) == ('N' in S)) and (('E' in S) == ('W' in S)):\n print('Yes')\n else:\n print('No')\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s434797648', 's755269490', 's147721144'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [228, 224, 236] |
p04019 | u411858517 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S = input()\n\ntmp = [0 for _ in range(4)]\n\nres = 'Yes'\nfor i in range(len(S)):\n if S[i] == 'S':\n tmp[0] = 1\n elif S[i] == 'N':\n tmp[1] = 1\n elif S[i] == 'W':\n tmp[2] = 1\n else:\n tmp[2] = 1\n \nif tmp[0] == 1 and tmp[1] == 0:\n res = 'No'\nif tmp[1] == 1 and tmp[0] == 0:\n res = 'No'\nif tmp[2] == 1 and tmp[3] == 0:\n res = 'No'\nif tmp[3] == 1 and tmp[2] == 0:\n res = 'No'\n\nprint(res)\n\n", "S = input()\n\ntmp = [0 for _ in range(4)]\n\nres = 'Yes'\nfor i in range(len(S)):\n if S[i] == 'S':\n tmp[0] = 1\n elif S[i] == 'N':\n tmp[1] = 1\n elif S[i] == 'W':\n tmp[2] = 1\n else:\n tmp[3] = 1\n \nif tmp[0] == 1 and tmp[1] == 0:\n res = 'No'\nif tmp[1] == 1 and tmp[0] == 0:\n res = 'No'\nif tmp[2] == 1 and tmp[3] == 0:\n res = 'No'\nif tmp[3] == 1 and tmp[2] == 0:\n res = 'No'\n\nprint(res)\n\n"] | ['Wrong Answer', 'Accepted'] | ['s007278134', 's851051568'] | [3064.0, 3064.0] | [24.0, 17.0] | [438, 438] |
p04019 | u427344224 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['S = input()\n\nn = S.count("N")\ns = S.count("S")\ne = S.count("E")\nw = S.count("W")\n\nhome = False\nif n and s:\n if e and w:\n print("YES")\n elif not e and not w:\n print("YES")\n else:\n print("NO")\n\nelif not n and not s:\n if e and w:\n print("YES")\n elif not e and not w:\n print("YES")\n else:\n print("NO")\n\nelse:\n print("NO")', 'S = input()\n\nn = S.count("N")\ns = S.count("S")\ne = S.count("E")\nw = S.count("W")\n\nhome = False\nif n and s:\n if e and w:\n print("Yes")\n elif not e and not w:\n print("Yes")\n else:\n print("No")\n\nelif not n and not s:\n if e and w:\n print("Yes")\n elif not e and not w:\n print("Yes")\n else:\n print("No")\n\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s073589796', 's108133122'] | [3064.0, 3064.0] | [17.0, 17.0] | [380, 380] |
p04019 | u452512115 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['S = input()\nd = {}\nprint(S)\n\nfor s in S:\n d[s] = True\n \nif "N" in d:\n if \'S\' not in d:\n print("No")\n exit()\n \nif \'S\' in d:\n if \'N\' not in d:\n print("No")\n exit()\n\nif \'E\' in d:\n if \'W\' not in d:\n print("No")\n exit()\n \nif \'W\' in d:\n if \'E\' not in d:\n print("No")\n exit() \n \nprint("No")\n', 'S = input()\nd = {}\nprint(S)\n\nfor s in S:\n d[s] = True\n\nif \'N\' in d:\n if \'S\' not in d:\n print("No")\n exit()\n \nif "S" in d:\n if \'N\' not in d:\n print("No")\n exit()\n\nif "E" in d:\n if "W" not in d:\n print("No")\n exit()\n \nif "W" in d:\n if "E" not in d:\n print("No")\n exit() \n \nprint("Yes")\n', "S = input()\nd = {}\nfor s in S:\n d[s] = True\n \nif 'N' in d:\n if 'S' not in d:\n print 'No'\n exit()\n \nif 'S' in d:\n if 'N' not in d:\n print 'No'\n exit()\n\nif 'E' in d:\n if 'W' not in d:\n print 'No'\n exit()\n \nif 'W' in d:\n if 'E' not in d:\n print 'No'\n exit() \n \nprint 'Yes'", 'S = input()\nd = {}\n\nfor s in S:\n d[s] = True\n\nif \'N\' in d:\n if \'S\' not in d:\n print("No")\n exit()\n \nif "S" in d:\n if \'N\' not in d:\n print("No")\n exit()\n\nif "E" in d:\n if "W" not in d:\n print("No")\n exit()\n \nif "W" in d:\n if "E" not in d:\n print("No")\n exit() \n \nprint("Yes")\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s244304971', 's911866322', 's966964676', 's552858312'] | [3060.0, 3188.0, 3064.0, 3060.0] | [17.0, 19.0, 17.0, 18.0] | [324, 323, 309, 314] |
p04019 | u459233539 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s=input()\nif ("N" in s and "S" not in s) or\n\t("S" in s and "N" not in s) or\n\t("E" in s and "W" not in s) or\n ("W" in s and "E" not in s):\n print("No")\nelse:\n print("Yes")', 'S=input()\ns=set(S)\nif ("N" in s and "S" not in s) or\n("S" in s and "N" not in s) or\n("E" in s and "W" not in s) or\n("W" in s and "E" not in s):\n print("No")\nelse:\n print("Yes")', 'S = input()\ns = set(S)\nif ("N" in s and "S" not in s) \n or ("S" in s and "N" not in s)\n or ("W" in s and "E" not in s)\n or ("E" in s and "W" not in s):\n print("No")\nelse:\n print("Yes")', 'S=input()\ns=set(S)\nif ("N" in s and "S" not in s) or\n\t("S" in s and "N" not in s) or\n\t("E" in s and "W" not in s) or\n ("W" in s and "E" not in s):\n print("No")\nelse:\n print("Yes")', 's = input()\nif (("N" in s and "S" not in s) \n or ("S" in s and "N" not in s) \n or ("W" in s and "E" not in s) \n or ("E" in s and "W" not in s)):\n print("No")\nelse:\n print("Yes")'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s634815896', 's693140994', 's845586074', 's872595893', 's106509230'] | [2940.0, 2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 18.0, 18.0, 17.0, 18.0] | [179, 178, 190, 188, 185] |
p04019 | u465652095 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['N = input()\nNS = set(N)\nif len(N) or len(NS) == 1:\n print("No")\nelif "N" not in N and "S" not in N or "W" not in N and "E" not in N :\n print("Yes")\nelif "N" in N and "W" in N and "E" in N and "S" in N:\n print("Yes")\nelse:\n print("No")', 'N = input()\nNS = set(N)\nif len(N) == 1 or len(NS) == 1:\n print("No")\nelif "N" not in N and "S" not in N or "W" not in N and "E" not in N :\n print("Yes")\nelif "N" in N and "W" in N and "E" in N and "S" in N:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s220000390', 's524344270'] | [9116.0, 9016.0] | [27.0, 26.0] | [246, 251] |
p04019 | u490553751 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['#template\nfrom collections import Counter\ndef inputlist(): return [int(j) for j in input().split()]\n#template\nS = list(input())\nc = Counter(S)\nnews = [\'N\',\'E\',\'W\',\'S\']\nsa = set(S)\nif sa == {\'N\',\'S\'} or sa == {\'E\',\'W\'}:\n print("YES")\n exit()\nfor i in range(4):\n if c[news[i]] == 0:\n print("NO")\n exit()\nprint("YES")', '#template\nfrom collections import Counter\ndef inputlist(): return [int(j) for j in input().split()]\n#template\nS = list(input())\nc = Counter(S)\nnews = [\'N\',\'E\',\'W\',\'S\']\nsa = set(S)\nif sa == {\'N\',\'S\'} or sa == {\'E\',\'W\'}:\n print("Yes")\n exit()\nfor i in range(4):\n if c[news[i]] == 0:\n print("No")\n exit()\nprint("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s747241978', 's056294722'] | [3444.0, 3316.0] | [22.0, 21.0] | [337, 337] |
p04019 | u502389123 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\n\nif 'E' in s and 'W' in s:\n if 'N' in s and 'S' in s:\n print('Yes')\n elif 'N' in s or in 'S' in s:\n print('No')\n else:\n print('Yes')\nelif 'E' in s or 'W' in s:\n print('No')\nelse:\n print('Yes')\n", "s = input()\n\nif 'E' in s and 'W' in s:\n if 'N' in s and 'S' in s:\n print('Yes')\n elif 'N' in s or 'S' in s:\n print('No')\n else:\n print('Yes')\nelif 'E' in s or 'W' in s:\n print('No')\nelse:\n if 'N' in s and 'S' in s:\n print('Yes')\n elif 'N' in s or 'S' in s:\n print('No')\n else:\n print('Yes')"] | ['Runtime Error', 'Accepted'] | ['s221338311', 's210803309'] | [2940.0, 3060.0] | [17.0, 17.0] | [241, 353] |
p04019 | u503111914 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['S = input()\nprint("No" if (s.count("N") == 0 and s.count("S") > 0)\\\n\t\tor (s.count("S") == 0 and s.count("N") > 0)\\\n\t\tor (s.count("W") == 0 and s.count("E") > 0)\\\n\t\tor (s.count("E") == 0 and s.count("W") > 0)\\\n\t\telse "Yes")\n', 'S = input()\nprint("No" if(s.count("N") == 0 and s.count("S") > 0)\\\n\t\tor (s.count("S") == 0 and s.count("N") > 0)\\\n\t\tor (s.count("W") == 0 and s.count("E") > 0)\\\n\t\tor (s.count("E") == 0 and s.count("W") > 0)\\\n\t\telse "Yes")\n', 's = input()\nprint("No" if (s.count("N") == 0 and s.count("S") > 0)\\\n\t\t or (s.count("S") == 0 and s.count("N") > 0)\\\n\t or (s.count("W") == 0 and s.count("E") > 0)\\\n\t\t or (s.count("E") == 0 and s.count("W") > 0)\\\n\t\t else "Yes")\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s115968210', 's507506100', 's938351468'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [223, 222, 238] |
p04019 | u509739538 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['import math\nfrom collections import deque\nfrom collections import defaultdict\nimport itertools as it\n\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor i in range(3,math.floor(n//2)+1,2):\n\t\tif n%i==0:\n\t\t\tc = 0\n\t\t\tfor j in res:\n\t\t\t\tif i%j==0:\n\t\t\t\t\tc=1\n\t\t\tif c==0:\n\t\t\t\tres.append(i)\n\treturn res\ndef fact2(n):\n\tp = factorization(n)\n\tres = []\n\tfor i in p:\n\t\tc=0\n\t\tz=n\n\t\twhile 1:\n\t\t\tif z%i==0:\n\t\t\t\tc+=1\n\t\t\t\tz/=i\n\t\t\telse:\n\t\t\t\tbreak\n\t\tres.append([i,c])\n\treturn res\ndef fact(n):\n\tans = 1\n\tm=n\n\tfor _i in range(n-1):\n\t\tans*=m\n\t\tm-=1\n\treturn ans\ndef comb(n,r):\n\tif n<r:\n\t\treturn 0\n\tl = min(r,n-r)\n\tm=n\n\tu=1\n\tfor _i in range(l):\n\t\tu*=m\n\t\tm-=1\n\treturn u//fact(l)\ndef combmod(n,r,mod):\n\treturn (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod\ndef printQueue(q):\n\tr=copyQueue(q)\n\tans=[0]*r.qsize()\n\tfor i in range(r.qsize()-1,-1,-1):\n\t\tans[i] = r.get()\n\tprint(ans)\nclass UnionFind():\n\tdef __init__(self, n):\n\t\tself.n = n\n\t\tself.parents = [-1]*n\n\n\tdef find(self, x): # root\n\t\tif self.parents[x]<0:\n\t\t\treturn x\n\t\telse:\n\t\t\tself.parents[x] = self.find(self.parents[x])\n\t\t\treturn self.parents[x]\n\n\tdef union(self,x,y):\n\t\tx = self.find(x)\n\t\ty = self.find(y)\n\n\t\tif x==y:\n\t\t\treturn\n\n\t\tif self.parents[x]>self.parents[y]:\n\t\t\tx,y = y,x\n\n\t\tself.parents[x]+=self.parents[y]\n\t\tself.parents[y]=x\n\n\tdef size(self,x):\n\t\treturn -1*self.parents[self.find(x)]\n\n\tdef same(self,x,y):\n\t\treturn self.find(x)==self.find(y)\n\n\tdef members(self,x): # much time\n\t\troot = self.find(x)\n\t\treturn [i for i in range(self.n) if self.find(i)==root]\n\n\tdef roots(self):\n\t\treturn [i for i,x in enumerate(self.parents) if x<0]\n\n\tdef group_count(self):\n\t\treturn len(self.roots())\n\n\tdef all_group_members(self):\n\t\treturn {r: self.members(r) for r in self.roots()} # 1~n\ndef bitArr(n):\n\tx = 1\n\tzero = "0"*n\n\tans = []\n\tans.append([0]*n)\n\tfor i in range(2**n-1):\n\t\tans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))\n\t\tx+=1\n\treturn ans;\ndef arrsSum(a1,a2):\n\tfor i in range(len(a1)):\n\t\ta1[i]+=a2[i]\n\treturn a1\ndef maxValue(a,b,v):\n\tv2 = v\n\tfor i in range(v2,-1,-1):\n\t\tfor j in range(v2//a+1): \n\t\t\tk = i-a*j\n\t\t\tif k%b==0:\n\t\t\t\treturn i\n\treturn -1\ndef copyQueue(q):\n\tnq = queue.Queue()\n\tn = q.qsize()\n\tfor i in range(n):\n\t\tx = q.get()\n\t\tq.put(x)\n\t\tnq.put(x)\n\treturn nq\ndef get_sieve_of_eratosthenes(n):\n\t#data = [2]\n\tdata = [0,0,0]\n\tfor i in range(3,n+1,2):\n\t\tdata.append(i)\n\t\tdata.append(0)\n\tfor i in range(len(data)):\n\t\tinterval = data[i]\n\t\tif interval!=0:\n\t\t\tfor j in range(i+interval,n-1,interval):\n\t\t\t\tdata[j] = 0\n\t#ans = [x for x in data if x!=0]\n\tans = data[:]\n\treturn ans\n\ns = readChar()\n\nd = {"N":0,"W":0,"S":0,"E":0}\n\nfor i in s:\n\td[i]+=1\n\nflg = 1\nif !(d["N"]+d["S"]==0 or (d["N"]>0 and d["S"]>0)):\n\tflg = 0\n\nif !(d["W"]+d["E"]==0 or (d["W"]>0 and d["E"]>0)):\n\tflg = 0\n\nif flg==1:\n\tprint("Yes")\nelse:\n\tprint("No")', 'import math\nfrom collections import deque\nfrom collections import defaultdict\nimport itertools as it\n\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor i in range(3,math.floor(n//2)+1,2):\n\t\tif n%i==0:\n\t\t\tc = 0\n\t\t\tfor j in res:\n\t\t\t\tif i%j==0:\n\t\t\t\t\tc=1\n\t\t\tif c==0:\n\t\t\t\tres.append(i)\n\treturn res\ndef fact2(n):\n\tp = factorization(n)\n\tres = []\n\tfor i in p:\n\t\tc=0\n\t\tz=n\n\t\twhile 1:\n\t\t\tif z%i==0:\n\t\t\t\tc+=1\n\t\t\t\tz/=i\n\t\t\telse:\n\t\t\t\tbreak\n\t\tres.append([i,c])\n\treturn res\ndef fact(n):\n\tans = 1\n\tm=n\n\tfor _i in range(n-1):\n\t\tans*=m\n\t\tm-=1\n\treturn ans\ndef comb(n,r):\n\tif n<r:\n\t\treturn 0\n\tl = min(r,n-r)\n\tm=n\n\tu=1\n\tfor _i in range(l):\n\t\tu*=m\n\t\tm-=1\n\treturn u//fact(l)\ndef combmod(n,r,mod):\n\treturn (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod\ndef printQueue(q):\n\tr=copyQueue(q)\n\tans=[0]*r.qsize()\n\tfor i in range(r.qsize()-1,-1,-1):\n\t\tans[i] = r.get()\n\tprint(ans)\nclass UnionFind():\n\tdef __init__(self, n):\n\t\tself.n = n\n\t\tself.parents = [-1]*n\n\n\tdef find(self, x): # root\n\t\tif self.parents[x]<0:\n\t\t\treturn x\n\t\telse:\n\t\t\tself.parents[x] = self.find(self.parents[x])\n\t\t\treturn self.parents[x]\n\n\tdef union(self,x,y):\n\t\tx = self.find(x)\n\t\ty = self.find(y)\n\n\t\tif x==y:\n\t\t\treturn\n\n\t\tif self.parents[x]>self.parents[y]:\n\t\t\tx,y = y,x\n\n\t\tself.parents[x]+=self.parents[y]\n\t\tself.parents[y]=x\n\n\tdef size(self,x):\n\t\treturn -1*self.parents[self.find(x)]\n\n\tdef same(self,x,y):\n\t\treturn self.find(x)==self.find(y)\n\n\tdef members(self,x): # much time\n\t\troot = self.find(x)\n\t\treturn [i for i in range(self.n) if self.find(i)==root]\n\n\tdef roots(self):\n\t\treturn [i for i,x in enumerate(self.parents) if x<0]\n\n\tdef group_count(self):\n\t\treturn len(self.roots())\n\n\tdef all_group_members(self):\n\t\treturn {r: self.members(r) for r in self.roots()} # 1~n\ndef bitArr(n):\n\tx = 1\n\tzero = "0"*n\n\tans = []\n\tans.append([0]*n)\n\tfor i in range(2**n-1):\n\t\tans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))\n\t\tx+=1\n\treturn ans;\ndef arrsSum(a1,a2):\n\tfor i in range(len(a1)):\n\t\ta1[i]+=a2[i]\n\treturn a1\ndef maxValue(a,b,v):\n\tv2 = v\n\tfor i in range(v2,-1,-1):\n\t\tfor j in range(v2//a+1): \n\t\t\tk = i-a*j\n\t\t\tif k%b==0:\n\t\t\t\treturn i\n\treturn -1\ndef copyQueue(q):\n\tnq = queue.Queue()\n\tn = q.qsize()\n\tfor i in range(n):\n\t\tx = q.get()\n\t\tq.put(x)\n\t\tnq.put(x)\n\treturn nq\ndef get_sieve_of_eratosthenes(n):\n\t#data = [2]\n\tdata = [0,0,0]\n\tfor i in range(3,n+1,2):\n\t\tdata.append(i)\n\t\tdata.append(0)\n\tfor i in range(len(data)):\n\t\tinterval = data[i]\n\t\tif interval!=0:\n\t\t\tfor j in range(i+interval,n-1,interval):\n\t\t\t\tdata[j] = 0\n\t#ans = [x for x in data if x!=0]\n\tans = data[:]\n\treturn ans\n\ns = readChar()\n\nd = {"N":0,"W":0,"S":0,"E":0}\n\nfor i in s:\n\td[i]+=1\n\nflg = 1\nif not(d["N"]+d["S"]==0 or (d["N"]>0 and d["S"]>0)):\n\tflg = 0\n\nif not(d["W"]+d["E"]==0 or (d["W"]>0 and d["E"]>0)):\n\tflg = 0\n\nif flg==1:\n\tprint("Yes")\nelse:\n\tprint("No")'] | ['Runtime Error', 'Accepted'] | ['s768807689', 's456057608'] | [3320.0, 3572.0] | [18.0, 22.0] | [3038, 3042] |
p04019 | u537963083 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["import sys\n\ns = input()\n\nif s.find('N') != -1:\n if s.find('S') == -1:\n print('NO')\n sys.exit()\n\nif s.find('S') != -1:\n if s.find('N') == -1:\n print('NO')\n sys.exit()\n\nif s.find('W') != -1:\n if s.find('E') == -1:\n print('NO')\n sys.exit()\n\nif s.find('E') != -1:\n if s.find('W') == -1:\n print('NO')\n sys.exit()\n \nprint('YES')\n", "import sys\n\ns = input()\n\nif s.find('N') != -1:\n if s.find('S') == -1:\n print('No')\n sys.exit()\n\nif s.find('S') != -1:\n if s.find('N') == -1:\n print('No')\n sys.exit()\n\nif s.find('W') != -1:\n if s.find('E') == -1:\n print('No')\n sys.exit()\n\nif s.find('E') != -1:\n if s.find('W') == -1:\n print('No')\n sys.exit()\n \nprint('Yes')\n"] | ['Wrong Answer', 'Accepted'] | ['s218877997', 's399756327'] | [3060.0, 3064.0] | [19.0, 17.0] | [398, 398] |
p04019 | u543954314 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = input()\nif ~("N" in s ^ "S" in s) and ~("E" in s ^ "W" in s):\n print("Yes")\nelse:\n print("No")', 's = input()\nb, c = 0, 0\nif "N" in s and "S" in s:\n b = 1\nelif "N" not in s and "S" not in s:\n b = 1\nif "E" in s and "W" in s:\n c = 1\nelif "E" not in s and "W" not in s:\n c = 1\nif b and c:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s018821110', 's297872047'] | [2940.0, 3060.0] | [17.0, 18.0] | [100, 226] |
p04019 | u579699847 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["import bisect,collections,copy,heapq,itertools,math,operator,string\ndef I(): return int(input())\ndef S(): return input()\ndef LI(): return list(map(int,input().split()))\ndef LS(): return list(input().split())\n##################################################\nS = S()\ncondition1 = 'S' in S == 'N' in S\ncondition2 = 'E' in S == 'W' in S\nprint('Yes' if condition1 and condition2 else 'No')\n", "import bisect,collections,copy,heapq,itertools,math,operator,string\ndef I(): return int(input())\ndef S(): return input()\ndef LI(): return list(map(int,input().split()))\ndef LS(): return list(input().split())\n##################################################\nS = S()\ncondition1 = ('S' in S) == ('N' in S)\ncondition2 = ('E' in S) == ('W' in S)\nprint('Yes' if condition1 and condition2 else 'No')\n"] | ['Wrong Answer', 'Accepted'] | ['s092365895', 's442906149'] | [3888.0, 3896.0] | [26.0, 26.0] | [387, 395] |
p04019 | u580362735 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S = list(input())\n\nif S.count('S')!=0 and S.count('N')== 0:\n print('NO')\nelif S.count('N')!=0 and S.count('S')== 0:\n print('NO')\nelif S.count('E')!=0 and S.count('W')== 0:\n print('NO')\nelif S.count('W')!=0 and S.count('S')== 0:\n print('NO')\nelse:\n print('YES')", "S = list(input())\n\nif S.count('S')!=0 and S.count('N')== 0:\n print('NO')\nelif S.count('N')!=0 and S.count('S')== 0:\n print('NO')\nelif S.count('E')!=0 and S.count('W')== 0:\n print('NO')\nelif S.count('W')!=0 and S.count('E')== 0:\n print('NO')\nelse:\n print('YES')", "S = list(input())\n\nif S.count('S')!=0 and S.count('N')== 0:\n print('No')\nelif S.count('N')!=0 and S.count('S')== 0:\n print('No')\nelif S.count('E')!=0 and S.count('W')== 0:\n print('No')\nelif S.count('W')!=0 and S.count('E')== 0:\n print('No')\nelse:\n print('Yes')\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s432789165', 's617644749', 's548361298'] | [3060.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0] | [265, 265, 266] |
p04019 | u599547273 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s=set;print("YNeos"[s(input())in map(s,"NS","EW","NSEW")::2])', 'print("NYoe s"[set(input())in map(set,["NS","EW","NSEW"])::2])'] | ['Runtime Error', 'Accepted'] | ['s796474343', 's125061088'] | [2940.0, 2940.0] | [21.0, 18.0] | [61, 62] |
p04019 | u601018334 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\nN = 0\nS = 0\nW = 0\nE = 0\nfor i in range(len(s)) :\n str = s[i]\n if str == 'N' :\n N = 1\n elif str == 'S':\n S = 1\n elif str == 'W':\n W = 1\n elif str == 'E':\n E = 1\nif (N-S)==0 and (W-E)==0 :\n print('YES')\nelse:\n print('NO')\n", "s = input()\nN = 0\nS = 0\nW = 0\nE = 0\nfor i in range(len(s)) :\n str = s[i]\n if str == 'N' :\n N = 1\n elif str == 'S':\n S = 1\n elif str == 'W':\n W = 1\n elif str == 'E':\n E = 1\nif (N-S)==0 and (W-E)==0 :\n print('Yes')\nelse:\n print('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s162538298', 's874858441'] | [3064.0, 3064.0] | [40.0, 38.0] | [281, 281] |
p04019 | u612721349 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['def solve():\n n, e = 0, 0\n for c in input():\n if c == "N":\n n += 1\n if c == "S":\n n -= 1\n if c == "E":\n e += 1\n if c == "W":\n e -= 1\n if n == 0 and e == 0:\n print("Yes")\n else:\n print("No")\n\nif __name__=="__main__":\n solve()', 'def solve():\n n, e = 0, 0\n for c in input():\n if c == "N":\n n += 1\n if c == "S":\n n -= 1\n if c == "E":\n e += 1\n if c == "W":\n e -= 1\n\n if n == 0 and e == 0:\n print("YES")\n else:\n print("NO")\n\nif __name__=="__main__":\n solve()', 'def solve():\n n, e = 0, 0\n for c in input():\n if c == "N":\n n += 1\n if c == "S":\n n -= 1\n if c == "E":\n e += 1\n if c == "W":\n e -= 1\n if n == 0 and e == 0:\n print("YES")\n else:\n print("NO")\n\nif __name__=="__main__":\n solve()', 'from collections import Counter\nc = Counter(input())\nprint("Yes" if ((c["N"] > 0 and c["S"] > 0) or c["N"] == c["S"]) \\\n and ((c["E"] > 0 and c["W"] > 0) or c["E"] == c["W"]) else "No")'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s304887221', 's399594776', 's995203418', 's923419323'] | [3064.0, 3064.0, 3064.0, 3828.0] | [40.0, 42.0, 43.0, 59.0] | [333, 326, 333, 189] |
p04019 | u619819312 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['print(sum([1 for j in [int(input()) for i in range(int(input()))][::2] if j%2!=1]))\n', 'if ("N" in a and"S"in a)or(not"N" in a and not "S" in a):\n if ("W" in a and"E"in a)or(not"W" in a and not "E" in a):\n print("Yes")\n else:\n print("No")\nelse:\n print("No")', 'a=list(input())\nif ("N" in a and"S"in a)or(not"N" in a and not "S" in a):\n if ("W" in a and"E"in a)or(not"W" in a and not "E" in a):\n print("Yes")\n else:\n print("No")\nelse:\n print("No")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s574012198', 's922105322', 's049193528'] | [2940.0, 2940.0, 3060.0] | [17.0, 18.0, 18.0] | [84, 192, 208] |
p04019 | u623687794 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s=input()\na =["N","S","W","E"]\nflag1=0\nflag2=0\nif a[0] in s and a[1] in s:\n flag1=1\nif a[0] not in s and a[1] not in s:\n flag1=1\nif a[2] in s and a[3] in s:\n flag2=1\nif a[2] not in s and a[3] not in s:\n flag2=1\nif flag1+flag2=2:\n print("Yes")\nelse:\n print("No")', 's=input()\na =["N","S","W","E"]\nflag1=0\nflag2=0\nif a[0] in s and a[1] in s:\n flag1=1\nif a[0] not in s and a[1] not in s:\n flag1=1\nif a[2] in s and a[3] in s:\n flag2=1\nif a[2] not in s and a[3] not in s:\n flag2=1\nif flag1+flag2==2:\n print("Yes")\nelse:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s749381730', 's587788742'] | [3064.0, 3060.0] | [17.0, 17.0] | [267, 269] |
p04019 | u627417051 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['S = list(input())\nif S.count("N") == 0 and S.count("S") == 0:\n\tif S.count("E") >= 1 and S.count("W") >= 1:\n\t\tprint("Yes")\n\telse:\n\t\tprint("NO")\nelif S.count("E") == 0 and S.count("W") == 0:\n\tif S.count("N") >= 1 and S.count("S") >= 1:\n\t\tprint("Yes")\n\telse:\n\t\tprint("NO")\nelse:\n\tif S.count("N") >= 1 and S.count("S") >= 1 and S.count("W") >= 1 and S.count("E") >= 1:\n\t\tprint("Yes")\n\telse:\n\tprint("No")\t', 'S = list(input())\nif S.count("N") == 0 and S.count("S") == 0:\n\tif S.count("E") >= 1 and S.count("W") >= 1:\n\t\tprint("Yes")\n\telse:\n\t\tprint("No")\nelif S.count("E") == 0 and S.count("W") == 0:\n\tif S.count("N") >= 1 and S.count("S") >= 1:\n\t\tprint("Yes")\n\telse:\n\t\tprint("No")\nelse:\n\tif S.count("N") >= 1 and S.count("S") >= 1 and S.count("W") >= 1 and S.count("E") >= 1:\n\t\tprint("Yes")\n\telse:\n\t\tprint("No")\t'] | ['Runtime Error', 'Accepted'] | ['s617426635', 's101777806'] | [3064.0, 3064.0] | [17.0, 17.0] | [400, 401] |
p04019 | u634046173 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S = input()\n\nif 'N' in S:\n if not 'S' in S:\n print('No')\n exit()\nif 'S' in S:\n if not 'N' in S:\n print('No')\n exit()\nif 'E' in S:\n if not 'W' in S:\n print('No')\n exit()\nif 'W' in S:\n if not 'E' in S:\n print('No')\n exit()\nprint('YES')\n\n\n\n", "S = input()\n\nif 'N' in S:\n if not 'S' in S:\n print('No')\n exit()\nif 'S' in S:\n if not 'N' in S:\n print('No')\n exit()\nif 'E' in S:\n if not 'W' in S:\n print('No')\n exit()\nif 'W' in S:\n if not 'E' in S:\n print('No')\n exit()\nprint('Yes')\n\n\n\n"] | ['Wrong Answer', 'Accepted'] | ['s131984469', 's025944569'] | [9044.0, 9032.0] | [29.0, 25.0] | [265, 265] |
p04019 | u652656291 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\nN = s.count('N')\nS = s.count('S')\nE = s.count('E')\nW = s.count('W')\nif ((N >= 1 and S == 0) or (N == 0 and S >= 1) or \n (E >= 1 and W == 0) or (E == 0 and W >= 1):\n print('Yes')\nelse:\n print('No')\n", "s = input()\nN = s.count('N')\nS = s.count('S')\nE = s.count('E')\nW = s.count('W')\nif ((N >= 1 and S == 0) or (N == 0 and S >= 1) or \n (E >= 1 and W == 0) or (E == 0 and W >= 1):\n print('NO')\nelse:\n print('Yes')\n", "s = input()\nN = s.count('N')\nS = s.count('S')\nE = s.count('E')\nW = s.count('W')\nif (N >= 1 and S >= 1) or (E >= 1 and W >= 1) or s ='':\n print('Yes')\nelse:\n print('No')", "s = input()\nN = s.count('N')\nS = s.count('S')\nE = s.count('E')\nW = s.count('W')\nif ((N >= 1 and S == 0) or (N == 0 and S >= 1) or \n (E >= 1 and W == 0) or (E == 0 and W >= 1)):\n print('Yes')\nelse:\n print('No')\n", "s = input()\nN = s.count('N')\nS = s.count('S')\nE = s.count('E')\nW = s.count('W')\nif ((N >= 1 and S == 0) or (N == 0 and S >= 1) or \n (E >= 1 and W == 0) or (E == 0 and W >= 1)):\n print('No')\nelse:\n print('Yes')\n"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s239282670', 's318780710', 's476703190', 's760816476', 's158330820'] | [2940.0, 2940.0, 3064.0, 3060.0, 3064.0] | [17.0, 17.0, 18.0, 17.0, 23.0] | [214, 214, 170, 215, 215] |
p04019 | u667024514 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = str(input())\nif ("W" in s) == ("E" in s):\n if ("N" in s) == ("S" in s):\n print("YES")\n exit()\nprint("NO")', 's = str(input())\nif ("S" in s) == ("N" in s):\n if ("W" in s) == ("E" in s):\n print("Yes")\n else:\n print("No")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s598938495', 's180908491'] | [2940.0, 2940.0] | [17.0, 17.0] | [116, 151] |
p04019 | u668503853 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['S=list(input())\nans="Yes"\nn=S.count("N")\ne=S.count("E")\nw=S.count("W")\ns=S.count("S")\nif n>0 and s>0:\n if e>0 and w>0:\n pass\n elif e==0 and w==0:\n pass\n else:\n ans="No"\nelif n==0 and s==0:\n if e>0 and w>0:\n pass\n elif e==0 and w==0:\n pass\n else:\n ans="No"\nelif e>0 and w>0:\n if n>0 and s>0:\n pass\n elif n==0 and s==0:\n pass\n else:\n ans="No"\nelif e==0 and w==0:\n if n>0 and s>0:\n pass\n elif n==0 and s==0:\n pass\n else:\n ans="No"\nelse:\n ans="No"\nprint(ans)', "S=input()\nprint(['No','Yes'][('W'in S)==('E'in S)and('N'in S)==('S'in S)])"] | ['Runtime Error', 'Accepted'] | ['s674653066', 's120823327'] | [2940.0, 2940.0] | [18.0, 18.0] | [505, 74] |
p04019 | u693953100 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\nif s.count('W')==1 or s.count('S')==1 or s.count('E')==1 or s.count('N')==1:\n print('No')\nelse:\n print('Yes')", "s = input()\nN = s.count('N')\nS = s.count('S')\nW = s.count('W')\nE = s.count('E')\nif N==0 and S:\n print('No')\nelif S==0 and N:\n print('No')\nelif E==0 and W:\n print('No')\nelif W==0 and E:\n print('No')\nelse:\n print('Yes')"] | ['Wrong Answer', 'Accepted'] | ['s083608928', 's809388132'] | [2940.0, 3060.0] | [17.0, 20.0] | [127, 232] |
p04019 | u711238850 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = set(list(input()))\n\nif \'N\' in s:\n if not \'S\' in s:\n print("No")\n exit()\n elif s(len) == 2 or s(len)==4:\n print("Yes")\n exit()\n \nif \'S\' in s:\n if not \'N\' in s:\n print("No")\n exit()\n elif s(len) == 2 or s(len)==4:\n print("Yes")\n exit()\n\nif \'W\' in s:\n if not \'E\' in s:\n print("No")\n exit()\n elif s(len) == 2 or s(len)==4:\n print("Yes")\n exit()\n\nif \'E\' in s:\n if not \'W\' in s:\n print("No")\n exit()\n elif s(len) == 2 or s(len)==4:\n print("Yes")\n exit()\nprint("No")', 's = set(list(input()))\n\nif \'N\' in s:\n if not \'S\' in s:\n print("No")\n exit()\n elif len(s) == 2 or len(s)==4:\n print("Yes")\n exit()\n \nif \'S\' in s:\n if not \'N\' in s:\n print("No")\n exit()\n elif len(s) == 2 or len(s)==4:\n print("Yes")\n exit()\n\nif \'W\' in s:\n if not \'E\' in s:\n print("No")\n exit()\n elif len(s) == 2 or len(s)==4:\n print("Yes")\n exit()\n\nif \'E\' in s:\n if not \'W\' in s:\n print("No")\n exit()\n elif len(s) == 2 or len(s)==4:\n print("Yes")\n exit()\n \nprint("No")'] | ['Runtime Error', 'Accepted'] | ['s839468239', 's703398462'] | [3192.0, 3064.0] | [17.0, 17.0] | [522, 527] |
p04019 | u725133562 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\nl = len(s)\njudge = 0\nif 'N' in s:\n judge += 1\nif 'W' in s:\n judge += 1/1000\nif 'S' in s:\n judge -= 1\nif 'E' in s:\n judge -= 1/1000\n\nprint('Yes' if judge == 0 else 'No')", "s = input()\nl = len(s)\njudge = 0\nif 'N' in s:\n judge += 2\nif 'W' in s:\n judge += 1/1000\nif 'S' in s:\n judge -= 2\nif 'E' in s:\n judge -= 1/1000\n\nprint('Yes' if judge == 0 else 'No')", "s = input()\nl = len(s)\njudge = 0\nif 'N' in s:\n judge += 1000\nif 'W' in s:\n judge += 1\nif 'S' in s:\n judge -= 1000\nif 'E' in s:\n judge -= 1\n\nprint('Yes' if judge == 0 else 'No')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s290482881', 's877234796', 's110178136'] | [3064.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0] | [192, 192, 188] |
p04019 | u729133443 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s=input();f=lambda c:c in s;print(['No','Yes'][f('N')^f('S') or f('E')^f('W')])", "s=input();f=lambda c:c in s;print(['Yes','No'][f('N')^f('S') or f('E')^f('W')])"] | ['Wrong Answer', 'Accepted'] | ['s034878097', 's106249886'] | [2940.0, 2940.0] | [17.0, 17.0] | [79, 79] |
p04019 | u740157634 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['S = input()\n\nn = S.count(\'N\')\ns = S.count(\'S\')\nw = S.count(\'W\')\ne = S.count(\'E\')\na = 0\n\nif n > 0:\n a += 1\nelif s > 0:\n a -= 1\nelif w > 0:\n a += 2\nelif e > 0:\n a -= 2\n\nif a == 0:\n print("Yes")\nelse:\n print("No")\n', 'S = input()\n\nn = S.count(\'N\')\ns = S.count(\'S\')\nw = S.count(\'W\')\ne = S.count(\'E\')\na = 0\n\nif n > 0:\n a += 1\nif s > 0:\n a -= 1\nif w > 0:\n a += 2\nif e > 0:\n a -= 2\n\nif a == 0:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s842468202', 's470149684'] | [9128.0, 9056.0] | [29.0, 27.0] | [229, 223] |
p04019 | u740284863 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['k = str(input())\n\n\nn = 0\nw = 0\ns = 0\ne = 0\nfor i in range(len(k)):\n if k[i] == "N":\n n += 1\n elif k[i] == "W":\n w += 1\n elif k[i] == "S":\n s += 1\n else:\n e += 1\nif (n == 0 and s > 0) or (s == 0 and n > 0) or (e == 0 and w > 0) or (w == 0 and e > 0):\n print("No")\nelse:\n print("No")', 's = str(input())\nn = 0\nw = 0\ns = 0\ne = 0\nfor i in range(len(s)):\n if s[i] == "N":\n n += 1\n elif s[i] == "W":\n w += 1\n elif s[i] == "S":\n s += 1\n else:\n e += 1\nif (n == 0 and s > 0) or (s == 0 and n > 0) or (e == 0 and w > 0) or (w == 0 and e > 0):\n print("No")\nelse:\n print("No")', 'k = str(input())\n\n\nn = 0\nw = 0\ns = 0\ne = 0\nfor i in range(len(k)):\n if k[i] == "N":\n n += 1\n elif k[i] == "W":\n w += 1\n elif k[i] == "S":\n s += 1\n else:\n e += 1\nif (n == 0 and s > 0) or (s == 0 and n > 0) or (e == 0 and w > 0) or (w == 0 and e > 0):\n print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s332643124', 's704674214', 's392075099'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0] | [327, 325, 328] |
p04019 | u745087332 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["# coding:utf-8\n\nINF = float('inf')\n\n\ndef inpl(): return list(map(int, input().split()))\n\n\nS = input()\nS_li = list(S)\ndirection = ('N', 'W', 'S', 'E')\njudge = []\nfor di in direction:\n if di in S_li:\n judge.append(1)\n else:\n judge.append(0)\n\nprint(judge)\n\nif judge[0] ^ judge[2] == 1:\n print('No')\nelif judge[1] ^ judge[3] == 1:\n print('No')\nelse:\n print('Yes')\n", "from collections import Counter\ns = input()\n\nC = Counter(s)\nif all([C['N'], C['S']]) is any([C['N'], C['S']]) and all([C['W'], C['E']]) is any([C['W'], C['E']]):\n print('Yes')\nelse:\n print('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s222196600', 's535706260'] | [3060.0, 3316.0] | [17.0, 21.0] | [389, 201] |
p04019 | u756132450 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = input()\na = s.count("S") - s.count("N")\nb = s.count("E") - s.count("W")\nif (a == 0 && a == b):\n print ("Yes")\nelse:\n print ("No")\n', 'temp = input()\ns = temp.count("S")\nn = temp.count("N")\ne = temp.count("E")\nw = temp.count("W")\n\nif (s == n):\n if (e>=1 & w >= 1):\n print ("Yes")\n else:\n print ("No")\nelif (e == w):\n if (s >= 1 & n >= 1):\n print ("Yes")\n else:\n print ("No")\nelse:\n print ("No")'] | ['Runtime Error', 'Accepted'] | ['s008695526', 's141128569'] | [3064.0, 3064.0] | [39.0, 39.0] | [134, 263] |
p04019 | u820047642 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['Plan=input()\nN,W,S,E=Plan.count("N"),Plan.count("W"),Plan.count("S"),Plan.count("E")\nif N+S==0 and W+E==0:\n print("Yes")\nelse:\n print("No")', 'Plan=input()\nN,W,S,E=Plan.count("N"),Plan.count("W"),Plan.count("S"),Plan.count("E")\nif (N==0 and S>=1) or (N>=1 and S==0) or (W==0 and E>=1) or (W>=1 and E==0):\n print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s559315111', 's390991888'] | [3064.0, 3060.0] | [18.0, 17.0] | [145, 200] |
p04019 | u821251381 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['S = input()\n\nif S.count("N")==S.count("S") and S.count("E") == S.count("W"):\n print("YES")\nelse:\n print("NO")', 'S = input()\n\nif ((S.count("N")>0 and S.count("S")==0) or (S.count("S")>0 and S.count("N")==0)) and ((S.count("E")>0 and S.count("W")==0) or (S.count("W")>0 and S.count("E")==0)):\n print("NO")\nelse:\n print("YES")\n', 'S = input()\n\nif (S.count("W")>0 and S.count("E")==0) or (S.count("E")>0 and S.count("W")==0) or (S.count("N")>0 and S.count("S")==0) or (S.count("S")>0 and S.count("N")==0): print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s176953522', 's792646954', 's564920414'] | [2940.0, 2940.0, 8960.0] | [18.0, 18.0, 28.0] | [111, 214, 207] |
p04019 | u821262411 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["t=str(input())\nn=t.count('N')\ns=t.count('S')\nw=t.count('W')\ne=t.count('E')\n\nif n-s !=0 and n*s==0:\n print('NO')\n exit()\n \nif w-e !=0 and w*e==0:\n print('NO')\n exit()\n\nprint('YES')", "t=str(input())\nn=t.count('N')\ns=t.count('S')\nw=t.count('W')\ne=t.count('E')\n\nif n-s !=0 and n*s==0:\n print('No')\n exit()\n \nif w-e !=0 and w*e==0:\n print('No')\n exit()\n\nprint('Yes')\n"] | ['Wrong Answer', 'Accepted'] | ['s017309266', 's154281208'] | [3064.0, 3064.0] | [40.0, 37.0] | [194, 195] |
p04019 | u835482198 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['from collections import Counter\n\ns = Counter(input())\nif s[\'N\'] > 0 == s[\'S\'] > 0 and s["W"] > 0 == s[\'E\'] > 0:\n print("Yes")\nelse:\n print("No")\n', 'from collections import Counter\n\ns = Counter(input())\nif (s[\'N\'] > 0) == (s[\'S\'] > 0) and (s["W"] > 0) == (s[\'E\'] > 0):\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s979739601', 's878387522'] | [3316.0, 3316.0] | [20.0, 20.0] | [151, 159] |
p04019 | u847165882 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['import collections\nS=str(input())\n\nList=list(set(S))\nList.sort()\n\nflag=0\nif len(List)%2==0:\n if len(List)//2==1:\n if List[0]=="E" and List[1]=="W":\n flag=1\n elif List[0]=="N" and List[1]=="S":\n flag=1\n elif len(List)//2==2:\n flga=1\n \nprint("Yes" if flag==1 else "No")', 'import collections\nS=str(input())\n\nList=list(set(S))\nList.sort()\n\nflag=0\nif len(List)%2==0:\n if len(List)//2==1:\n if List[0]=="E" and List[1]=="W":\n flag=1\n elif List[0]=="N" and List[1]=="S":\n flag=1\n elif len(List)//2==2:\n flag=1\n \nprint("Yes" if flag==1 else "No")'] | ['Wrong Answer', 'Accepted'] | ['s911352269', 's861766866'] | [3316.0, 3444.0] | [22.0, 24.0] | [331, 331] |
p04019 | u848647227 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['ar = list(input())\nbr = set(ar)\nif br.count("N") == br.count("S") and br.count("W") == br.count("E"):\n print("Yes")\nelse:\n print("No")', 'ar = list(input())\nbr = set(ar)\nif len(br) == 4:\n print("Yes")\nelif len(br) == 1 or len(br) == 3:\n print("No")\nelse:\n if "N" in br and "S" in br:\n print("Yes")\n elif "E" in br and "W" in br:\n print("Yes")\n else:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s364636716', 's844052502'] | [2940.0, 3060.0] | [18.0, 17.0] | [136, 260] |
p04019 | u849229491 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S=input()\nn,w,e,s='N' in S, 'W' in S, 'E' in S, 'S' in S\nprint('Yes' if (n==s and e==w) else 'No')\n\nprint(n)\nprint(w)\nprint(e)\nprint(s)", "S=input()\nn,w,e,s='N' in S, 'W' in S, 'E' in S, 'S' in S\nprint('Yes' if (n==s and e==w) else 'No')\n\n"] | ['Wrong Answer', 'Accepted'] | ['s573516927', 's319255431'] | [9108.0, 9032.0] | [23.0, 24.0] | [135, 100] |
p04019 | u860002137 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = input()\n\nans1 = (("S" in s) and ("N" in s)) or (("S" not in s) & ("N" not in s))\nans2 = (("E" in s) and ("W" in s)) or (("E" not in s) & ("W" not in s)\n\nprint("Yes" if ans1 and ans2 else "No")', 's = input()\n\nans1 = (("S" in s) and ("N" in s)) or (("S" not in s) and ("N" not in s))\nans2 = (("E" in s) and ("W" in s)) or (("E" not in s) and ("W" not in s))\n\nprint("Yes" if ans1 and ans2 else "No")'] | ['Runtime Error', 'Accepted'] | ['s805799739', 's045798571'] | [8908.0, 9072.0] | [23.0, 31.0] | [196, 201] |
p04019 | u863370423 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['def backhome(s):\n\tif ((\'N\' in s) and (\'S\' in s)) and not ((\'W\' in s) or (\'E\' in s)):\n\t\treturn "Yes"\n\telif ((\'W\' in s) and (\'E\' in s)) and not ((\'N\' in s) or (\'S\' in s)):\n\t\treturn "Yes"\n\telif ((\'W\' in s) and (\'E\' in s)) and ((\'N\' in s) and (\'S\' in s)):\n\t\treturn "Yes"\n\telse:\n\t\treturn "No"', 'def back_home():\n S=input()\n if(\'S\'in S and \'N\' in S and \'E\'not in S and \'W\'not in S):\n print(\'YES\')\n elif(\'S\'not in S and \'N\' not in S and \'E\' in S and \'W\' in S):\n print("YES")\n elif(\'S\'in S and \'N\' in S and \'E\' in S and \'W\' in S):\n print("yes")\n else:\n print("NO")\n \nback_home()', 'def back_home():\n r=input()\n print(r)\n l = dict()\n for i in r:\n if i in l:\n l[i]=int(l[i])+1\n else:\n l[i]=1\n if (len(l)==1):\n return(\'NO\')\n elif(len(l)==2):\n if (l[\'S\']>0 and l[\'N\']>0):\n return ("yes")\n elif(l[\'E\']>0 and l[\'W\']>0):\n return("yes")\n else:\n return("NO")\n elif(len(l)==3):\n return("NO")\n else:\n return("YES")\n \nback_home()', 'def backhome():\n\ts = input()\n\tif ((\'N\' in s) and (\'S\' in s)) and not ((\'W\' in s) or (\'E\' in s)):\n\t\tprint("Yes")\n\telif ((\'W\' in s) and (\'E\' in s)) and not ((\'N\' in s) or (\'S\' in s)):\n\t\tprint("Yes")\n\telif ((\'W\' in s) and (\'E\' in s)) and ((\'N\' in s) and (\'S\' in s)):\n\t\tprint("Yes")\n\telse:\n\t\tprint("No")\n\nbackhome()'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s231744920', 's352933326', 's828645735', 's346171595'] | [3064.0, 3060.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 17.0] | [287, 332, 477, 311] |
p04019 | u866746776 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['n, w, s, e = 0\nfor c in input():\n\tif c == "N":\n\t\tn += 1\n\tif c == "W":\n\t\tw += 1\n\tif c == "S":\n\t\ts += 1\n\tif c == "E":\n\t\te += 1\nb = ((n >= 1 and s >= 1) or (n==s==0)) and ((w >= 1 and e >= 1) or (w==e==0))\nprint("Yes" if b else "No")\n\n', 'n = w = s = e = 0\nfor c in input():\n\tif c == "N":\n\t\tn += 1\n\tif c == "W":\n\t\tw += 1\n\tif c == "S":\n\t\ts += 1\n\tif c == "E":\n\t\te += 1\nb = ((n >= 1 and s >= 1) or (n==s==0)) and ((w >= 1 and e >= 1) or (w==e==0))\nprint("Yes" if b else "No")\n\n'] | ['Runtime Error', 'Accepted'] | ['s121800068', 's115636441'] | [3064.0, 3064.0] | [38.0, 39.0] | [232, 235] |
p04019 | u867826040 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s = input()\nprint(set(s))\nif 0 in [s.count("W"),s.count("E")] or 0 in [s.count("N"),s.count("S")]:\n print("No")\nelse:\n print("Yes")', 's = set(input())\nif ("W" in s and not "E" in s) or ("E" in s and not "W" in s) or ("N" in s and not "S" in s) or ("S" in s and not "N" in s):\n print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s243254191', 's838412637'] | [2940.0, 2940.0] | [17.0, 17.0] | [137, 180] |
p04019 | u886747123 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['import numpy as np\n\nS = input()\nNSEW = [S.count("N"), S.count("S"), S.count("E"), S.count("W")]\n\nif np.prod(NSEW) > 0:\n print("Yes")\nelif NSEW[0] + NSEW[1] > 0:\n if NSEW[0] == 0 or NSEW[1] == 0:\n print("No")\n exit()\nelif NSEW[2] + NSEW[3] > 0:\n if NSEW[2] == 0 or NSEW[3] == 0:\n print("No")\n exit()\nprint("Yes")', 'import numpy as np\n\nS = input()\nNSEW = [S.count("N"), S.count("S"), S.count("E"), S.count("W")]\n\nif np.prod(NSEW) > 0:\n print("Yes")\n exit()\nelif NSEW[0] + NSEW[1] > 0 and NSEW[0] * NSEW[1] == 0:\n print("No")\n exit()\nelif NSEW[2] + NSEW[3] > 0 and NSEW[2] * NSEW[3] == 0:\n print("No")\n exit()\nprint("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s499513320', 's912550295'] | [12504.0, 13216.0] | [157.0, 169.0] | [348, 323] |
p04019 | u896791216 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["s = input()\nset_s = set(s)\nans = ''\nif len(set_s) == 2:\n if 'S' in set_s and 'N' in set_s:\n ans = 'YES'\n elif 'E' in set_s and 'W' in set_s:\n ans = 'YES'\n else:\n ans = 'NO'\nelif len(set_s) == 4:\n ans = 'YES'\nelse:\n ans = 'NO'\nprint(ans)\n", "s = input()\nset_s = set(s)\nans = ''\nif s.count('N') == s.count('S') == s.count('E') == s.count('W'):\n ans = 'YES'\nelif len(set_s) == 2 and s.count('E') == s.count('W'):\n ans = 'YES'\nelif len(set_s) == 2 and s.count('N') == s.count('S'):\n ans = 'YES'\nelse:\n ans = 'NO'\nprint(ans)\n", "s = input()\nset_s = list(set(s))\nans = ''\nif set_s.count('N') == set_s.count('S') == set_s.count('E') == set_s.count('W'):\n ans = 'YES'\nelif len(set_s) == 2 and set_s.count('E') == set_s.count('W'):\n ans = 'YES'\nelif len(set_s) == 2 and set_s.count('N') == set_s.count('S'):\n ans = 'YES'\nelse:\n ans = 'NO'\nprint(ans)\n", "s = input()\nlist_s = list(set(s))\nans = ''\nif len(set(s)) == 4:\n ans = 'Yes'\nelif len(list_s) == 2 and list_s.count('E') == list_s.count('W'):\n ans = 'Yes'\nelif len(list_s) == 2 and list_s.count('N') == list_s.count('S'):\n ans = 'Yes'\nelse:\n ans = 'No'\nprint(ans)"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s123042853', 's192482966', 's235672646', 's305399906'] | [9000.0, 8944.0, 8928.0, 9144.0] | [29.0, 30.0, 29.0, 28.0] | [273, 291, 329, 275] |
p04019 | u898999125 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S=set(list(input()))\nn=0\ns=0\ne=0\nw=0\nif 'N' in S:\n n=1\nif 'S' in S:\n s=1\nif 'E' in S:\n e=1\nif 'W' in S:\n w=1\n\nif (n^s)&(e^w):\n print('Yes')\nelse:\n print('No')", "S=set(list(input()))\nn=0\ns=0\ne=0\nw=0\nif 'N' in S:\n n=1\nif 'S' in S:\n s=1\nif 'E' in S:\n e=1\nif 'W' in S:\n w=1\n\nif (n^s)|(e^w):\n print('No')\nelse:\n print('Yes')"] | ['Wrong Answer', 'Accepted'] | ['s132394134', 's955400948'] | [3060.0, 3064.0] | [17.0, 17.0] | [164, 164] |
p04019 | u922449550 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["S = input()\nn = int('N' in S)\ns = int('S' in S)\nw = int('W' in W)\ne = int('E' in E)\n\nif n + s == 1 or w + e == 1:\n print('No')\nelse:\n print('Yes')", "S = input()\nn = int('N' in S)\ns = int('S' in S)\nw = int('W' in S)\ne = int('E' in S)\n\nif n + s == 1 or w + e == 1:\n print('No')\nelse:\n print('Yes')"] | ['Runtime Error', 'Accepted'] | ['s785622903', 's263870481'] | [2940.0, 3060.0] | [17.0, 17.0] | [148, 148] |
p04019 | u940102677 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['a = list(input())\nprint("Yes" if (("N" in a) ^ ("S" in a)) and (("W" in a) ^ ("E" in a)) else "No")', 'a = set(list(input()))\nprint("Yes" if ~("N" in a ^ "S" in a) and ~("W" in a ^ "E" in a) else "No")', 'a = list(input())\nprint("No" if (("N" in a) ^ ("S" in a)) or (("W" in a) ^ ("E" in a)) else "Yes")'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s311447142', 's898238719', 's616951003'] | [3060.0, 2940.0, 3060.0] | [18.0, 18.0, 17.0] | [99, 98, 98] |
p04019 | u941438707 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ['s=set(list(input()))\nprint("Yes" if len(s)%2==0 and s in [[],["N","S"],["E","W"],["N","S","E","W"]] else "No")', 'print("Yes" if set(list(input())) in [[\'S\', \'N\'],[\'W\', \'E\'],[\'S\', \'N\', \'W\', \'E\']] else "No")', 's=set(list(input()))\nprint("Yes" if len(s)%2==0 and (("N" in s and "S" in s) or ("E" in s and "W" in s)) else "No")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s151347673', 's270059262', 's712157680'] | [3060.0, 2940.0, 3060.0] | [18.0, 17.0, 17.0] | [110, 92, 116] |
p04019 | u969848070 | 2,000 | 262,144 | Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction: * North if the i-th letter of S is `N` * West if the i-th letter of S is `W` * South if the i-th letter of S is `S` * East if the i-th letter of S is `E` He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N. | ["a = input()\nv = 0\nh = 0\nif a.count('W') >=1:\n if a.count('E') ==0:\n print('NO')\n exit()\nif a.count('E') >=1:\n if a.count('W') ==0:\n print('NO')\n exit()\nif a.count('N')>= 1:\n if a.count('S') ==0:\n print('NO')\n exit()\nif a.count('S')>= 1:\n if a.count('N')==0:\n print('NO')\n exit()\nprint('YES')", "a = input()\nv = 0\nh = 0\nif a.count('W') >=1:\n if a.count('E') ==0:\n print('NO')\n exit()\nelif a.count('E') >=1:\n if a.count('W') ==0:\n print('NO')\n exit()\nelif a.count('N')>= 1:\n if a.count('S') ==0:\n print('NO')\n exit()\nelif a.count('S')>= 1:\n if a.count('N')==0:\n print('NO')\n exit()\nprint('YES')", "a = input()\nv = 0\nh = 0\nif a.count('W') >=1:\n if a.count('E') ==0:\n print('No')\n exit()\nif a.count('E') >=1:\n if a.count('W') ==0:\n print('No')\n exit()\nif a.count('N')>= 1:\n if a.count('S') ==0:\n print('No')\n exit()\nif a.count('S')>= 1:\n if a.count('N')==0:\n print('No')\n exit()\nprint('Yes')\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s224671091', 's239499407', 's408149255'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0] | [319, 325, 320] |
p04020 | u010090035 | 2,000 | 262,144 | Snuke has a large collection of cards. Each card has an integer between 1 and N, inclusive, written on it. He has A_i cards with an integer i. Two cards can form a pair if the absolute value of the difference of the integers written on them is at most 1. Snuke wants to create the maximum number of pairs from his cards, on the condition that no card should be used in multiple pairs. Find the maximum number of pairs that he can create. | ['n=int(input())\na=[]\nans=0\nfor i in range(n):\n a.append(int(input()))\n ans+=a[-1]//2\n a[-1]//=2\n if(i>0 and a[-2]==1 and a[-1]==1):\n ans+=1\n a[-2]-=1\n a[-1]-=1\n\nprint(ans)\n', 'n=int(input())\na=[]\nans=0\nfor i in range(n):\n a.append(int(input()))\n if(i>0 and a[-2]==1 and a[-1]>0):\n ans+=1\n a[-2]-=1\n a[-1]-=1\n ans+=a[-1]//2\n a[-1]=a[-1]%2\n if(i>0 and a[-2]==1 and a[-1]==1):\n ans+=1\n a[-2]-=1\n a[-1]-=1\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s033915488', 's073135869'] | [7084.0, 3884.0] | [264.0, 278.0] | [204, 295] |
p04020 | u077291787 | 2,000 | 262,144 | Snuke has a large collection of cards. Each card has an integer between 1 and N, inclusive, written on it. He has A_i cards with an integer i. Two cards can form a pair if the absolute value of the difference of the integers written on them is at most 1. Snuke wants to create the maximum number of pairs from his cards, on the condition that no card should be used in multiple pairs. Find the maximum number of pairs that he can create. | ['# keyence2019C - Exam and Wizard\ndef main():\n N = int(input())\n A = tuple(map(int, input().split()))\n B = tuple(map(int, input().split()))\n dif = sorted(i - j for i, j in zip(A, B))\n ans, shortage = 0, 0\n for i in dif:\n if i < 0:\n ans += 1\n shortage += i\n else:\n break\n for i in dif[::-1]:\n if shortage >= 0:\n print(ans)\n return\n ans += 1\n shortage += i\n print(-1)\n\n\nif __name__ == "__main__":\n main()', '\ndef main():\n # split in subsequences when 0 appears -> sum up cur // 2\n N, *A = map(int, open(0).read().split())\n A.append(0)\n ans, cur = 0, 0\n for i in A:\n if i:\n cur += i\n else:\n ans += cur // 2\n cur = 0\n print(ans)\n\n\nif __name__ == "__main__":\n main()'] | ['Runtime Error', 'Accepted'] | ['s402488243', 's112859245'] | [3064.0, 14092.0] | [17.0, 46.0] | [518, 353] |
p04020 | u093041722 | 2,000 | 262,144 | Snuke has a large collection of cards. Each card has an integer between 1 and N, inclusive, written on it. He has A_i cards with an integer i. Two cards can form a pair if the absolute value of the difference of the integers written on them is at most 1. Snuke wants to create the maximum number of pairs from his cards, on the condition that no card should be used in multiple pairs. Find the maximum number of pairs that he can create. | ['N,*A = map(int, open(0).read().split())\nans = 0\nfor i in range(N):\n if A[i] > 2:\n if A[i] % 2 == 0:\n ans += A[i] // 2 - 1\n A[i] = 2\n else:\n ans += A[i] // 2\n A[i] = 1\nfor i in range(1,N):\n if A[i] > 0:\n if A[i-1] > 0:\n temp = min(A[i],A[i-1])\n ans += temp\n A[i] -= temp\nprint(ans)', 'N,*A = map(int, open(0).read().split())\nans = 0\ncum = 0\nfor i in range(N):\n if A[i] > 0:\n cum += A[i]\n else:\n ans += cum // 2\n cum = 0\nprint(ans+cum//2)'] | ['Wrong Answer', 'Accepted'] | ['s389795141', 's291128620'] | [20036.0, 20036.0] | [120.0, 66.0] | [384, 179] |
p04020 | u103902792 | 2,000 | 262,144 | Snuke has a large collection of cards. Each card has an integer between 1 and N, inclusive, written on it. He has A_i cards with an integer i. Two cards can form a pair if the absolute value of the difference of the integers written on them is at most 1. Snuke wants to create the maximum number of pairs from his cards, on the condition that no card should be used in multiple pairs. Find the maximum number of pairs that he can create. | ['n = int(input())\n\n\ndef f(lst):\n res = 0\n ex = 0\n for a in lst:\n ex += a\n res += ex//2\n ex %= 2\n return res\n\nA = []\nans = 0\nfor _ in range(n):\n a = int(input())\n if a%2:\n a = 1\n else:\n a = min(a, 2)\n\n if a!= 0:\n A.append(a)\n elif A:\n ans += max(f(A), f(A[::-1]))\n else:\n continue\nprint(ans)', 'n = int(input())\n\ndef f(lst):\n res = 0\n ex = 0\n for a in lst:\n ex += a\n res += ex//2\n ex %= 2\n return res\n\nA = []\nans = 0\nfor _ in range(n):\n a = int(input())\n if a%2:\n ans += a//2\n a = 1\n else:\n if a>2:\n ans += a//2-1\n a = 2\n\n if a!= 0:\n A.append(a)\n elif A:\n ans += max(f(A), f(A[::-1]))\n A = []\n else:\n continue\nelse:\n ans += max(f(A), f(A[::-1]))\nprint(ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s734367643', 's609779300'] | [5364.0, 4764.0] | [2104.0, 289.0] | [323, 414] |