Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02817 (python)

Fixed submission:
input_from = input()
strings = input_from.split(' ')
print("{0}{1}".format(strings[1], strings[0]))

Buggy submission (verdict: Runtime Error):
import math

input_from = input()
info = input_from.split(' ')
a = int(info[0])

def is_prime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for num in range(3, int(math.sqrt(n)), 2):
        if n % num == 0:
            return False
    return True

if a == 2:
    print(2)
else:
    while not is_prime(a):
        a += 1

print("{0}".format(a))

Buggy submission (verdict: Runtime Error):
input_from = input()
strings = input_from.split(' ')
print(f'{strings[1]}{strings[0]}')
Problem p02945 (python)

Fixed submission:
a, b = input().split()

seki = int(a) * int(b)
sa = int(a) - int(b)
wa = int(a) + int(b)

if wa >= seki and wa >= sa:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)

Buggy submission (verdict: Runtime Error):
a, b = input(""). split("")

seki = int(a) * int(b)
sa = int(a) - int(b)
wa = int(a) + int(b)

if wa >= seki and wa >= sa:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

seki = int(a) * int(b)
sa = int(a) - int(b)
wa = int(a) + int(b)

if wa >= seki and wa >= sa:
    print(str(wa))
elif sa >= wa and sa >= seki:
    print(str(sa))
else:
    print(str(seki))

Buggy submission (verdict: Runtime Error):
a = input('')
b = input('')

seki = int(a) * int(b)
sa = int(a) - int(b)
wa = int(a) + int(b)

if wa >= seki and wa >= sa:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

seki = int(a) * int(b)
sa = int(a) - int(b)
wa = int(a) + int(b)

if wa >= seki and wa >= sa:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

seki = a * b
sa = a - b
wa = a + b

if wa >= seki and wa >= sa:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)
Problem p02946 (python)

Fixed submission:
k, x = input() .split()
k = int(k)
x = int(x)

l = x - k + 1
m = x + k

for i in range(l, m):
    print(i)

Buggy submission (verdict: Runtime Error):
k, x = input(). split()
k = int(k)
x = int(x)

l = x - k + 1
m = x + k

for i in range(l, m)
    print(i)

Buggy submission (verdict: Runtime Error):
k, x = input(""). split("")
k = int(k)
x = int(x)

l = x - k + 1
m = x + k

for i in range(l, m):
    print(i)
Problem p02947 (python)

Fixed submission:
from collections import defaultdict
N = int(input())
# N = 1000
string_dict = defaultdict(int)

for i in range(N):
    inp = list(input())
    # inp = list("aaaa")
    inp.sort()

    string_dict["".join(inp)] += 1
# print(string_dict)

count = 0
for i in string_dict.values():
    count += i*(i-1)//2
print(count)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N = int(input())

string_dict = defaultdict(int)

for i in range(N):
    inp = list(input())
    inp.sort()

    string_dict["".join(inp)] += 1
# print(string_dict)


def kaijo(N):
    if N == 0:
        return 0
    if N == 1:
        return 0
    return N-1 + kaijo(N-1)


count = 0
for i in string_dict.values():
    if i >= 2:
        # print(kaijo(i))
        count += kaijo(i)
print(count)
Problem p02952 (python)

Fixed submission:
N = int(input())

length = len(str(N))

ans = 0

if length % 2 == 1:
    ans += N - (10**(length-1)) + 1

for i in range(1, length+1, 2):
    if i == length:
        break
    ans += 10 ** i - (10**(i-1))



print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())

length = len(str(N))

ans=0
for i in range(1, length + 1, 2):
    if i != length:
        ans += 10 ** i -(10**(i-1))
    else:
        ans += int(str(N)[1:]) + 1


print(ans)
Problem p03044 (python)

Fixed submission:
import sys

sys.setrecursionlimit(2**31-1)#ループ回数

def paint(point, color):
    colors[point] = color

    # その点とつながる点で、まだ色が塗られていない点にルールに従い色を塗る
    for friend, w in reration[point]:
        if not colors[friend]:  # 塗られてない点
            # print(str(i)+"塗る")
            nextcolor = color*(-1)**w
            paint(friend, nextcolor)


N = int(input())
reration = [[] for i in range(N)]  # その点がつながる点
colors = ["" for i in range(N)]  # 色(作業中は簡単のため1,-1の2つに塗り分ける)
for i in range(N-1):
    U, V, W = map(int, input().split())
    reration[U-1].append((V-1, W % 2))
    reration[V-1].append((U-1, W % 2))

# print(hen)
# print(reration)
for i in range(N):
    if not colors[i]:
        paint(i, 1)
for co in colors:
    print((co+1)//2)

Buggy submission (verdict: Runtime Error):
def paint(point, color):
    colors[point] = color

    # その点とつながる点で、まだ色が塗られていない点にルールに従い色を塗る
    for friend, w in reration[point]:
        if not colors[friend]:  # 塗られてない点
            # print(str(i)+"塗る")
            nextcolor = color*(-1)**w
            paint(friend, nextcolor)


N = int(input())
reration = [[] for i in range(N)]  # その点がつながる点
colors = ["" for i in range(N)]  # 色(作業中は簡単のため1,-1の2つに塗り分ける)
for i in range(N-1):
    U, V, W = map(int, input().split())
    reration[U-1].append((V-1, W % 2))
    reration[V-1].append((U-1, W % 2))

# print(hen)
# print(reration)
for i in range(N):
    if not colors[i]:
        paint(i, 1)
for co in colors:
    print((co+1)//2)
Problem p03147 (python)

Fixed submission:
import bisect


def mizuyari(flowers):
    if flowers == []:
        return 0
    # print(flowers)
    minheight = min(flowers)
    if minheight == 0:
        if max(flowers) == 0:
            return 0
        leftindex = flowers.index(0)
        # print("分割" + str(leftindex))
        if leftindex == len(flowers):
            count = mizuyari(flowers[0:leftindex])
        else:
            count = mizuyari(flowers[0:leftindex]) + \
                mizuyari(flowers[leftindex+1:])

        return count
    else:
        count = mizuyari([i - minheight for i in flowers]) + minheight
        return count


N = int(input())
h_list = list(map(int, input().split()))

print(mizuyari(h_list))

Buggy submission (verdict: Runtime Error):
import bisect


def mizuyari(flowers):
    if flowers == []:
        return 0
    # print(flowers)
    minheight = min(flowers)
    if minheight == 0:
        if max(flowers) == 0:
            return 0
        leftindex = flowers.index(0)
        # print("分割"+str(leftindex)+" "+str(rightindex))
        count = mizuyari(flowers[0:leftindex])+mizuyari(flowers[leftindex:])
        return count
    else:
        count = mizuyari([i - minheight for i in flowers]) + minheight
        return count


N = int(input())
h_list = list(map(int, input().split()))

print(mizuyari(h_list))
Problem p02748 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b,m=map(int, input().split())
    la=list(map(int,input().split()))
    lb=list(map(int,input().split()))
    lm=[list(map(int,input().split())) for i in range(m)]
    nowari=min(la)+min(lb)
    warians=10**10
    for i in range(m):
        wari=la[(lm[i][0])-1]+lb[(lm[i][1])-1]-lm[i][2]
        if wari<warians:
            warians=wari
    print(min(nowari,warians))
resolve()

Buggy submission (verdict: Runtime Error):
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2 3 1
3 3
3 3 3
1 2 1"""
        output = """5"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """1 1 2
10
10
1 1 5
1 1 10"""
        output = """10"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """2 2 1
3 5
3 5
2 2 2"""
        output = """6"""
        self.assertIO(input, output)

if __name__ == "__main__":
    unittest.main()
Problem p02760 (python)

Fixed submission:
def resolve():
    a11,a12,a13=map(int, input().split())
    a21,a22,a23=map(int, input().split())
    a31,a32,a33=map(int, input().split())
    n=int(input())
    lyo1=[a11,a12,a13]
    lyo2=[a21,a22,a23]
    lyo3=[a31,a32,a33]
    lta1=[a11,a21,a31]
    lta2=[a12,a22,a32]
    lta3=[a13,a23,a33]
    lna1=[a11,a22,a33]
    lna2=[a13,a22,a31]
    yo1=0
    yo2=0
    yo3=0
    ta1=0
    ta2=0
    ta3=0
    na1=0
    na2=0
    b=[int(input()) for i in range(n)]
    for x in range(n):
        if b[x] in lyo1:
            yo1+=1
        if b[x] in lyo2:
            yo2+=1
        if b[x] in lyo3:
            yo3+=1
        if b [x] in lta1:
            ta1+=1
        if b[x] in lta2:
            ta2+=1
        if b[x] in lta3:
            ta3+=1
        if b[x] in lna1:
            na1+=1
        if b[x] in lna2:
            na2+=1

    if yo1==3 or yo2==3 or yo3==3 or ta1==3 or ta2==3 or ta3==3 or na1==3 or na2==3:
        print('Yes')
    else:
        print('No')
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    l=[list(map(int, input().split()) )for i in range(3)]
    n=int(input())
    b=[int(input()) for i in range(n)]
    bingo='No'
    for i in range(3):
        if l[i][0] in b and l[i][1] in b and l[i][2] in b:
           bingo='Yes'
        if l[0][i] in b and l[1][i] in b and l[2][i] in b:
            bingo='Yes'
    if (l[0][0] in b and l[1][1] in b and l[2][2] in b) or (l[2][0] in b and l[[1][1] in b and l[0][2] in b]):
        bingo='Yes'
    print(bingo)
resolve()
Problem p02817 (python)

Fixed submission:
s,t=input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    ans=x
    while True:
        flag=False
        for i in range(2,int(x**0.5)):
            if ans%i==0:
                flag=True
                break
        if flag:
            ans+=1
            continue
        else:
            break
    print(ans)
resolve()
Problem p02841 (python)

Fixed submission:
def resolve():
    m1,d1=map(int, input().split())
    m2,d2=map(int, input().split())
    if m2==m1+1 and d2==1:
        print('1')
    elif m1==12 and m2==1 and d2==1:
        print('1')
    else:
        print('0')
resolve()

Buggy submission (verdict: Runtime Error):
import math
def resolve():
    n=int(input())
    ans=(':(')
    for i in range(1,n+1):
        if math.floor(i*1.08)==n:
            ans=i
    print(ans)
resolve()
Problem p02854 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    from itertools import accumulate

    N = int(input())  # len(A)
    A = list(map(int, input().split()))
    zenbu=sum(A)
    B = [0] + A
    B = list(accumulate(B))  # 累積和を格納したリスト作成


    ans=10**18
    for i in range(1, N):
        ans = min(abs(B[i]-(zenbu-B[i])),ans)
    print(ans)

resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    from itertools import accumulate

    N = int(input())  # len(A)
    A = list(map(int, input().split()))
    zenbu=sum(A)
    B = [0] + A
    B = list(accumulate(B))
    C = [zenbu]*N
    import numpy as np
    B=np.array(B[1:])
    C=np.array(C)
    D=C-B
    ans=10**18
    for i in range(1, N+1):
        ans = min(abs(B[i]-D[i]),ans)
    print(ans)
resolve()
Problem p02861 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=[list(map(int,input().split())) for i in range(n)]
    import itertools
    ans=0
    p=list(itertools.permutations(l))
    for x in p:
        z = list(x)
        for y in range(n-1):
            ans+=((z[y][0]-z[y+1][0])**2+(z[y][1]-z[y+1][1])**2)**0.5
    print(ans/len(list(p)))
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    import numpy as np
    n=int(input())
    l=[list(map(int,input().split()))]
    lkyori=[]
    for i in range(n):
        for j in range(i+1,n+1):
            a=np.array(l[i])
            b=np.array(l[j])
            lkyori.append(np.linalg.norm(a-b)/n)
    import itertools
    answer=0
    print(list(itertools.permutations(lkyori,2)))

resolve()
Problem p02909 (python)

Fixed submission:
s=input()
if s=='Sunny':
    print('Cloudy')
elif s=='Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
def resolve():
    n,k,q=map(int, input().split())
    l=[int(input()) for i in range(q)]
    a=[k-q for i in range(n)]
    for i in l:
        a[i-1]+=1
    for i in range(n):
        if a[i]<=0:
            print('No')
        else:
            print('Yes')
resolve()
Problem p02982 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    import numpy as np
    n,d=map(int, input().split())
    l=[list(map(int,input().split())) for i in range(n)]
    cnt=0
    for j in range(n-1):
        for k in range(j+1,n):
            a=np.array(l[j])-np.array(l[k])
            if (np.linalg.norm(a))%1==0:
                cnt+=1
    print(cnt)
resolve()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    import numpy as np
    n,d=map(int, input().split())
    l=[list(map(int,input().split())) for i in range(n)]
    cnt=0
    for j in range(n-1):
        for k in range(j+1,n):
            a=np.array(l[j])-np.array(l[k])
            if (np.linalg.norm(a))%1==0:
                cnt+=1
    print(cnt)
resolve()
Problem p03086 (python)

Fixed submission:
def resolve():
    s=input()
    num=0
    for i in range(len(s)):
        for j in range(len(s)+1):
            s1=s[i:j]
            if 'B' not in s1 and 'D' not in s1 and 'E' not in s1 and 'F' not in s1\
                    and 'H' not in s1 and 'I' not in s1 and 'J' not in s1 and 'K' not in s1 and 'L' not in s1 and\
                    'M' not in s1 and 'N' not in s1 and 'O' not in s1 and 'P' not in s1 and 'Q' not in s1 and\
                    'R' not in s1 and 'S' not in s1 and 'U' not in s1 and 'V' not in s1 and 'W' not in s1 and\
                    'X' not in s1 and 'Y' not in s1 and 'Z' not in s1 and len(s1)>=num:
                num=len(s1)
    print(num)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    n=int(input())
    l=list(map(int, input().split()))
    ans='YES'
    l.sort()
    for i in range(n-1):
        if l[i]==l[i+1]:
            ans='NO'
    print(ans)

resolve()
Problem p03102 (python)

Fixed submission:
def resolve():
    cnt = 0
    n, m, c = map(int, input().split())
    b_list = list(map(int, input().split()))
    for i in range(n):
        a_list = list(map(int, input().split()))
        siki = 0
        for x in range(m):
            siki += (a_list[x] * b_list[x])
        if siki+c > 0:
                cnt += 1
    print(cnt)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    cnt=0
    n,m,c=map(int, input().split())
    b_list=list(map(int, input().split()))
    for i in range(n):
        a_list=list(map(int, input().split()))
        for x in range(m):
            siki=0
            siki+=a_list[i]*b_list[i]
            if siki>-c:
                cnt+=1
    print(cnt)
resolve()
Problem p03145 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b,c=map(int, input().split())
    print(a*b//2)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    s=int(input())
    l=[s]
    for i in range(10**6):
        if l[i]%2==0:
            if l[i]//2 in l:
                print(i+2)
                break
            else:
                l.append(l[i]//2)
        else:
            if 3*l[i]+1 in l:
                print(i+2)
                break
            else:
                l.append(3 * l[i] + 1)
resolve()
Problem p03227 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    if len(s)==2:
        print(s)
    else:
        print(s[2]+s[1]+s[0])
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a,b,k=map(int, input().split())
    turn=0
    for i in range(k):
        if turn==0:
            if a%2!=0:
                a-=1
            b+=a//2
            a=a//2
            turn=1
        else:
            if b%2!=0:
                b-=1
            a+=b//2
            b=b//2
            turn=0
    print(a,b)
resolve()
Problem p03262 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,x=map(int, input().split())
    l=list(map(int,input().split()))
    ll=[]
    for i in l:
        ll.append(abs(x-i))
    from functools import reduce
    from fractions import gcd
    print(reduce(gcd,ll))
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,x=map(int, input().split())
    l=list(map(int,input().split()))
    if n==1:
        print(l[0]-x)
    else:
        l.append(x)
        l.sort()
        S=[]
        for i in range(n):
            S.append(l[i+1]-l[i])
        from functools import reduce
        from math import gcd
        print(reduce(gcd,S))
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,x=map(int, input().split())
    l=list(map(int,input().split()))
    if n==1:
        print(l[0]-x)
    else:
        l.append(x)
        l.sort()
        S=[]
        for i in range(n-1):
            S.append(l[i+1]-l[i])
        from functools import reduce
        from math import gcd
        print(reduce(gcd,S))
resolve()
Problem p03280 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b=map(int, input().split())
    print(a*b-a-b+1)
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        s=input()
        k=int(input())
        if int(s[0])!=1:
            return s[0]
        else:
            cnt=0
            for i in s:
                if int(i)==1:
                    cnt+=1
                    if cnt>=k:
                        return 1
                else:
                    if cnt>=k:
                        return 1
                    else:
                        return i
    print(main())
resolve()
Problem p03319 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    cnt=0
    if n<=k:
        print(1)
    else:

        while True:
            n-=k
            n+=1
            cnt+=1
            if n<=k:
                cnt+=1
                print(cnt)
                break
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    cnt=0
    if n<=k:
        print(1)
    else:

        while True:
            n-=k
            n+=1
            cnt+=1
            if n<=k:
                cnt+=1
                print(cnt)
                break
reso
Problem p03352 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    l=[]
    for i in range(1,33):
        for j in range(2,11):
            y=i**j
            if y<x:
                l.append(y)
            elif y==x:
                l.append(y)
                break
            else:
                break
    print(max(l))
resolve()

Buggy submission (verdict: Runtime Error):
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    l=[]
    for i in range(1,33):
        for j in range(1,11):
            if i**j>=x:
                l.append(i**(j-1))
                break
    print(max(l))
resolve()
Problem p03369 (python)

Fixed submission:
def resolve():
    s=input()
    print(700+100*s.count('o'))
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,x=map(int, input().split())
    l=[int(input()) for i in range(n)]
    print((x-sum(l))//min(l)+n)
resolve()
Problem p03633 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    S=[]
    for i in range(n):
        S.append(int(input()))
    from functools import reduce
    from fractions import gcd

    def lcm(A, B):
        return A * B // gcd(A, B)


    print(reduce(lcm, S))
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    S=[]
    for i in range(n):
        S.append(int(input()))
    from functools import reduce
    from math import gcd

    def lcm(A, B):
        return A * B // gcd(A, B)


    print(reduce(lcm, S))
resolve()
Problem p03636 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    print(s[0]+str(len(s)-2)+s[-1])
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    al=[chr(ord('A')+i) for i in range(26)]
    h,w=map(int, input().split())
    l=[list(input().split()) for i in range(h)]
    for j in range(w):
        for k in range(h):
            if l[k][j]=='snuke':
                print(al[j]+str(k+1))
resolve()
Problem p03679 (python)

Fixed submission:
def resolve():
    x,a,b=map(int, input().split())
    if b-a>=x+1:
        print('dangerous')
    elif b-a<=0:
        print('delicious')
    else:
        print('safe')
resolve()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=[int(input()) for i in range(n)]
    light=0
    cnt=0
    while True:
        if l[light]==2:
            cnt+=1
            print(cnt)
            break
        else:
            if cnt>n:
                print(-1)
                break
            else:
                light=l[light]-1
                cnt+=1
            
resolve()
Problem p04019 (python)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    ans='No'
    if 'N' in s and 'S' in s and 'W' in s and 'E' in s:
        ans='Yes'
    elif 'N' in s and 'S' in s and \
            'W' not in s and 'E' not in s:
        ans='Yes'
    elif 'N' not in s and 'S' not in s and\
            'W' in s and 'E' in s:
        ans='Yes'
    print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    if 'N' in s and 'S' in s and 'W' in s and 'E' in s:
        ans='Yes'
    elif 'N' in s and 'S' in s and 'W' not in s and 'E' not in s:
        ans='Yes'
    elif 'N' not in s and 'S' not in s and 'W' in s and 'E' in s:
        ans='Yes'
    else:
        ans='No'
    print(ans)
resolve()