Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
box = []
acnt,wcnt,tmp = 0,0,0
if m == 0:
	print(0,0)
	sys.exit()
inx = 0
for i in range(m):
	if p[i][0] != inx
		if p[i][1] == 'AC':
				inx =p[i][0]
				acnt += 1
				wcnt += tmp
				tmp = 0
		else:
			tmp += 1
print(acnt,wcnt)

Fixed submission:
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
ac =[0]*(n+1)
wa =[0]*(n+1)
for i in range(m):
    question =int(p[i][0])
    if p[i][1] == "AC" and ac[question] == 0:
        ac[question] = 1
    elif p[i][1] == "WA" and ac[question] == 0:
        wa[question] += 1
for j in range(n+1):
    if ac[j] == 0:
        wa[j] = 0
       # print(wa)
print(sum(ac),sum(wa))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
box = []
acnt,wcnt,tmp = 0,0,0
inx = p[0][0]
for i in range(m):
	if not p[i][0] in box:
		if p[i][1] == 'AC':
				box.append(inx)
				acnt += 1
				wcnt += tmp
				tmp = 0
		else:
			tmp += 1
print(acnt,wcnt)

Fixed submission:
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
ac =[0]*(n+1)
wa =[0]*(n+1)
for i in range(m):
    question =int(p[i][0])
    if p[i][1] == "AC" and ac[question] == 0:
        ac[question] = 1
    elif p[i][1] == "WA" and ac[question] == 0:
        wa[question] += 1
for j in range(n+1):
    if ac[j] == 0:
        wa[j] = 0
       # print(wa)
print(sum(ac),sum(wa))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
box = []
acnt,wcnt,tmp = 0,0,0
inx = p[0][0]
for i in range(m):
		if p[i][1] == 'AC':
			if not p[i][0] in box:
				box.append(inx)
				acnt += 1
				wcnt += tmp
				tmp = 0
		else:
			tmp += 1
print(acnt,wcnt)
		

Fixed submission:
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
ac =[0]*(n+1)
wa =[0]*(n+1)
for i in range(m):
    question =int(p[i][0])
    if p[i][1] == "AC" and ac[question] == 0:
        ac[question] = 1
    elif p[i][1] == "WA" and ac[question] == 0:
        wa[question] += 1
for j in range(n+1):
    if ac[j] == 0:
        wa[j] = 0
       # print(wa)
print(sum(ac),sum(wa))
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()

ans = 6 - (A+B)
print(ans)

Fixed submission:
A = int(input())
B = int(input())

ans = 6 - (A+B)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
print(int((A*B)/math.gcd(A,B)))

Fixed submission:
import fractions
A,B = map(int,input().split())
print((A*B)//fractions.gcd(A,B))

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
ans = (A*B)//(math.gcd(A,B))
print(ans)


Fixed submission:
import fractions
A,B = map(int,input().split())
print((A*B)//fractions.gcd(A,B))

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
print((A*B) // math.gcd(A,B))


Fixed submission:
import fractions
A,B = map(int,input().split())
print((A*B)//fractions.gcd(A,B))

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
print((A*B)//math.gcd(A,B))

Fixed submission:
import fractions
A,B = map(int,input().split())
print((A*B)//fractions.gcd(A,B))
Buggy python submission (verdict: Runtime Error):
S = input()
S = list(S)
N = len(S)
count = 0

for i in range(len(S)//2):
  if S[i] != S[N-i]:
    S[i] = S[N-i]
    count += 1

print(count)

Fixed submission:
S = input()
S = list(S)
N = len(S)
count = 0

for i in range(N//2):
	if S[i] != S[(N-1)-i]:
		S[i] = S[(N-1)-i]
		count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
day = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
S = 7 - index(input())
print(day[S])


Fixed submission:
day = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
S = 7 - day.index(input())
print(S)
Buggy python submission (verdict: Runtime Error):
Alp =[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]*2
N = int(input())
S = list(input())
for i in range(len(S)):
  Anum = Alp.index(S[i])
  S.replace(S[i],Alp[Anum+N])
print("".join(S))


Fixed submission:
Alp =["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]*2
N = int(input())
S = list(input())
for i in range(len(S)):
	Anum = Alp.index(S[i])
	S[i] = Alp[Anum+N]
print("".join(S))

Buggy python submission (verdict: Runtime Error):
Alp =[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]*2
N = int(input())
S = list(input())
for i in range(len(S)):
	Anum = Alp.index(S[i])
    S.replace(S[i],Alp[Anum+N])
print("".join(S))

Fixed submission:
Alp =["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]*2
N = int(input())
S = list(input())
for i in range(len(S)):
	Anum = Alp.index(S[i])
	S[i] = Alp[Anum+N]
print("".join(S))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
if N == 1:
  print("No")
if S[:(N//2) == S[(N//2+1):]:
  print("Yes")
else:
  print("No")


Fixed submission:
N = int(input())
S = input()
if S[:(N//2)] == S[(N//2):]:
	print("Yes")
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
if S[:(N//2) == S[(N//2+1):]:
     print("Yes")
else:
     print("No")


Fixed submission:
N = int(input())
S = input()
if S[:(N//2)] == S[(N//2):]:
	print("Yes")
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(input())
if S[:(N//2) == S[(N//2+1):]:
     print("Yes")
else:
     print("No")

Fixed submission:
N = int(input())
S = input()
if S[:(N//2)] == S[(N//2):]:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
A,B = int(input())
print(A*B if A<= 9 and B <=9 else -1)

Fixed submission:
A,B = map(int,input().split())
print(A*B if A<= 9 and B <=9 else "-1")
Buggy python submission (verdict: Runtime Error):
n = int(input())
bol = 0
for i in range(1,10):
  for j in range(1:10):
    if i*j == n:
      bol = 1
      break
if bol == 1:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
bol = 0
for i in range(1,10):
  for j in range(1,10):
    if i*j == n:
      bol = 1
      break
if bol == 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N、K = map(int,input().split())
H = list(map(int,input().split()))
count = 0
for i in range(N):
  if H[i] >= K:
    count += 1
print(count)


Fixed submission:
N,K = map(int,input().split())
H = list(map(int,input().split()))
count = 0
for i in range(N):
  if H[i] >= K:
    count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N、K = map(int,input().split())
H = list(map(int,input().split()))
count = 0

for i in range(N):
  if H[i] >= K:
    count += 1
    
print(count)

Fixed submission:
N,K = map(int,input().split())
H = list(map(int,input().split()))
count = 0
for i in range(N):
  if H[i] >= K:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
wet = ["Sunny","Cloudy","Rainy"]
s = wet.index(input())
print(wet[s+1] if s != 2 else s[1])

Fixed submission:
wet = ["Sunny","Cloudy","Rainy"]
s = wet.index(input())
print(wet[s+1] if s != 2 else wet[0])
Buggy python submission (verdict: Runtime Error):
import sys
S = list(input())
S.insert(0,"X")

for i in range(1,len(S)-1,2):
  if S[i] == "L":
    print("No")
    sys.exit()
for j in range(2,len(S)-1,2):
  if S[i] == "R":
    print("No")
    sys.exit()
print"Yes")
    

Fixed submission:
import sys
S = list(input())
S.insert(0,"X")

#文字列の奇数番目をチェック
for i in range(1,len(S),2):
  if S[i] == "L":
    print("No")
    sys.exit()
#文字列の偶数番目をチェック
for j in range(2,len(S),2):
  if S[j] == "R":
    print("No")
    sys.exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
count = 1
for i in range(N):
  if N = 0:
    print(count)
  else:
  	count *= N
  	N = N -1 

Fixed submission:
N = int(input())
print(N**3)
Buggy python submission (verdict: Runtime Error):
import sys
A,B = map(int,input(.split())
for i in range(1,20):
  if (1+(A-1)*i) >= B:
    print(i)
    sys.exit()


Fixed submission:
import sys
A,B = map(int,input().split())
if B == 1:
  print(0)
  sys.exit()
  
for i in range(1,20):
  if (1+(A-1)*i) >= B:
    print(i)
    sys.exit()
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
counter =[]
cnt = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    cnt += 1
  else:
    counter.append(cnt)
    cnt = 0
print(max(counter))

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
counter =[]
cnt = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    cnt += 1
  else:
    counter.append(cnt)
    cnt = 0
counter.append(cnt)
print(max(counter))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
if n <= 1000:
	for i in range(n):
		ans += i
else:
	for j in range(500500,n):
		ans += i
print(ans)

Fixed submission:
n = int(input())
print(n*(n-1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(n):
	ans += i
print(ans)

Fixed submission:
n = int(input())
print(n*(n-1)//2)
Buggy python submission (verdict: Runtime Error):
A,B = int(input())
print(max(A+B,A-B,A*B))

Fixed submission:
A,B = map(int,input().split())
print(max(A+B,A-B,A*B))
Buggy python submission (verdict: Runtime Error):
k,x = map(int,input().split())
c =[]
for i in range(x-k,x+k):
  c.append(i)
print(" ".join(c))

Fixed submission:
k,x = map(int,input().split())
c =[]
for i in range(x-k+1,x+k):
  c.append(i)
print(' '.join(map(str,c)))
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
s = [list(input()) for S in range(n)]
cnt = 0
for i in range(n):
	s[i].sort()
duplicated_data = [tuple(d) for d in s]
unique_data = set(duplicated_data)
s_set = [list(d) for d in unique_data]
for j in range(len(s_set)):
	if s.count(s_set[j]) >= 2:
		k = s.count(s_set[j])
		cnt += math.factorial(k)//(math.factorial(k-2)*math.factorial(2))
print(cnt)

Fixed submission:
n = int(input())
#文字列を同一か判別するために全てsortして格納する
#インプットした文字列をソートして文字列として格納する
s = [''.join(sorted(input())) for _ in range(n)]
#babacaba >>> aaaabbbcとする
######################
#同一性を判定するのにはハッシュテーブルを活用すると良い
#辞書はハッシュテーブルとして高速なために使用
s_dict = {}
for i in range(n):
	if s[i] in s_dict:
		s_dict[s[i]] += 1
	else:
		s_dict[s[i]] = 1
		#辞書内になくとも自動で追加される
		#>>>{xxx:1 yyy:1 zzz:1}
ans = 0
#辞書内の加算された数字についてnCrで2つの組み合わせを検討する
for j in s_dict.values():
	ans += j*(j-1)//2
	#xxxについて、2以上あれば1組は存在するということで+
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
H = list(map(int,input().split()))
C = 0

if sorted(H) == H:
  print("YES")
  sys.exit()
  
for i in range(0,N-1):
  for j in range(1,N):
    tmp = H.replace(H[i],H[j])
    if tmp == sorted(H):
      print("YES")
      sys.exit()
print("NO")

Fixed submission:
import copy
import sys
N = int(input())
H = list(map(int,input().split()))
C = 0

if sorted(H) == H:
	print("YES")
	sys.exit()

for i in range(0,N-1):
	for j in range(1,N):
		L = copy.copy(H)
		L[i],L[j] = L[j],L[i] 
		if L == sorted(H):
			print("YES")
			sys.exit()
print("NO")
Buggy python submission (verdict: Runtime Error):
import math
N,D = map(int,input().split())
print(math.ceil(N/(D**2+1))

Fixed submission:
import math
N,D = map(int,input().split())
print(math.ceil(N/((D*2+1))))
Buggy python submission (verdict: Runtime Error):
N,L = map(int,input().split())
taste = tmp = []
for i in range(1,N):
  tmp.append(abs(L + i -1))
  taste.append((L + i -1))
num = tmp.index(min(tmp)) 
taste.index(num) = 0
print(sum(taste))

Fixed submission:
N,L = map(int,input().split())
taste = []
tmp = []
for i in range(1,N+1):
	tmp.append(abs(L + i -1))
	taste.append((L + i -1))
num = tmp.index(min(tmp)) 
taste[num] = 0
print(sum(taste))
Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
L = list(map(int,input().split()))
D,i,cnt = 0,0,0
while(D <= X and cnt <= N):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)

Fixed submission:
N,X = map(int,input().split())
L = list(map(int,input().split()))
L.append(0)
D,i,cnt = 0,0,0
while(D <= X and cnt <= N):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
L = list(map(int,input().split()))
D,i,cnt = 0,0,0
while(D <= X or cnt < N+1):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)

Fixed submission:
N,X = map(int,input().split())
L = list(map(int,input().split()))
L.append(0)
D,i,cnt = 0,0,0
while(D <= X and cnt <= N):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
L = list(map(int,input().split()))
D,i,cnt = 0,0,0
while(D <= X):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)

Fixed submission:
N,X = map(int,input().split())
L = list(map(int,input().split()))
L.append(0)
D,i,cnt = 0,0,0
while(D <= X and cnt <= N):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
L = list(map(int,input().split()))
D,i,cnt = 0,0,1 
while(D <= X):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)

Fixed submission:
N,X = map(int,input().split())
L = list(map(int,input().split()))
L.append(0)
D,i,cnt = 0,0,0
while(D <= X and cnt <= N):
  D = D + L[i]
  cnt +=1
  i += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = list(map(int,input().split()))
S = 1000
for i in range(1,N):
  S = min(S,abs(sum(range(W[1],[i]))-sum(range(i+1,N))))
print(S)

Fixed submission:
N = int(input())
W = list(map(int,input().split()))
W.insert(N,0)
left,right = 0,0
S = 1000
for i in range(0,N):
	left += W[i]
	right = sum(W) - left
	S =min(S,abs(left - right))
print(S)
Buggy python submission (verdict: Runtime Error):
import sys
a = int(input())

if a >= 13:
  print(a)
  sys.exit()
elif a >= 6 and a <= 12:
  print(int(a/2))
  sys.exit()
else:
  print(0)


Fixed submission:
import sys
a,b = map(int,input().split())

if a >= 13:
  print(b)
elif a >= 6 and a <= 12:
  print(b//2)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
import sys
a = int(input())

if a >= 13:
  print(a)
elif a >= 6 and a <= 12:
  print(a//2)
else:
  print(0)


Fixed submission:
import sys
a,b = map(int,input().split())

if a >= 13:
  print(b)
elif a >= 6 and a <= 12:
  print(b//2)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
lr= [list(map(int,input().split()))for a in range(m)]
ans = set(list(range(lr[0][0],lr[0][1]+1)))
for i in range(1,m):
	b = set(list(range(lr[i][0],lr[i][1]+1)))
	ans &= b
print(len(ans))


Fixed submission:
n,m = map(int,input().split())
lr= [list(map(int,input().split()))for a in range(m)]
l,r = [list(b) for b in zip(*lr)]
left,right = max(l),min(r)
cnt = 0
for i in range(1,n+1):
	if left <= i and i <= right:
		cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
lr= [list(map(int,input().split()))for a in range(m)]
ans = set(list(range(lr[0][0],lr[0][1]+1)))
for i in range(1,m):
	b = set(list(range(lr[i][0],lr[i][1]+1)))
	ans &= b
print(len(ans))

Fixed submission:
n,m = map(int,input().split())
lr= [list(map(int,input().split()))for a in range(m)]
l,r = [list(b) for b in zip(*lr)]
left,right = max(l),min(r)
cnt = 0
for i in range(1,n+1):
	if left <= i and i <= right:
		cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n,k = int(input().split())
s = list(input())
s[k-1] = s[k-1].lower()
print(str(s))

Fixed submission:
n,k = map(int,input().split())
s = list(input())
s[k-1] = s[k-1].lower()
print("".join(s)) #"".join()にてリストを文字列に変換できる
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(max(A+A-1,A+B,B+B-1))

Fixed submission:
a,b = map(int,input().split())
print(max(a+a-1,a+b,b+b-1))
Buggy python submission (verdict: Runtime Error):
cnt,ans = 0,[]
agct = ["A","G","C","T"]
for i in range(len(s)):
    if s[i] in agct:
        cnt += 1
    else:
         ans.append(cnt)
         cnt = 0
if ans == []:
    ans.append(0)
print(max(ans))

Fixed submission:
s = list(input())
cnt,ans = 0,[]
agct = ["A","G","C","T"]
for i in range(len(s)):
    if s[i] in agct:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
if cnt > 0:
  ans.append(cnt)
print(max(ans))

Buggy python submission (verdict: Runtime Error):
s = list(input())
cnt,ans = [],0
agct = ["A","G","C","T"]
for i in range(len(s)):
    if s[i] in agct:
        cnt += 1
    else:
         ans.append(cnt)
         cnt = 0
if ans == []:
    ans.append(0)
print(max(ans))

Fixed submission:
s = list(input())
cnt,ans = 0,[]
agct = ["A","G","C","T"]
for i in range(len(s)):
    if s[i] in agct:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
if cnt > 0:
  ans.append(cnt)
print(max(ans))
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
h,w = map(int,input().split())
tot = H*W 
print(tot - {(h*W)+(w*H)-(h*w)})

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split()) 
print(H*W - ((h*W)+(w*H)-(h*w)))
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
div = []

for i in range(1,100):
  if a%i == 0 and b%i == 0:
    div.append(i)
    break
print(sorted(div)[-K]

Fixed submission:
A,B,K = map(int,input().split())
div = []

for i in range(1,101):
	if A%i == 0 and B%i == 0:
		div.append(i)
print(sorted(div)[-K])
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
ans = "inf"
for i in range(N-2):
  tmp = abs(753 - int(S[i:i+2])
  ans = min(ans,tmp)
print(ans)

Fixed submission:
S = input()
N = len(S)
ans = 1000
for i in range(N-2):
	tmp = abs(753 -(int(S[i:i+3])))
	ans = min(ans,tmp)
print(ans)
Buggy python submission (verdict: Runtime Error):
import collections
import sys
n = int(input())
a = list(map(int,input().split()))
#if len(set(a)) == 1:
 # print(n//2)
 # sys.exit()
a1 = [a[x] for x in range(0,n,2)]
l_a1 = len(a1)
a2 = [a[y] for y in range(1,n,2)]
l_a2 = len(a2)
c1 = collections.Counter(a1)
c2 = collections.Counter(a2)
K_a1 = c1.most_common()[0][0]
#print(K_a1)
K_a2 = c2.most_common()[0][0]
#print(K_a2)
F_a1 = c1.most_common(1)[0][1]
F_a2 = c2.most_common(1)[0][1]
if K_a1 == K_a2:
  if  c1.most_common(2)[0][1] >= c2.most_common(2)[0][1]:
    F_a2 = c2.most_common()[1][1]
  else:
    F_a1 = c1.most_common()[1][1]
   # print(F_a1)
print((l_a1 - F_a1)+(l_a2 - F_a2))

Fixed submission:
import collections
import sys
n = int(input())
a = list(map(int,input().split()))
if len(set(a)) == 1:
  print(n//2)
  sys.exit()
a1 = [a[x] for x in range(0,n,2)]
l_a1 = len(a1)
a2 = [a[y] for y in range(1,n,2)]
l_a2 = len(a2)
c1 = collections.Counter(a1)
c2 = collections.Counter(a2)
K_a1 = c1.most_common()[0][0]
K_a2 = c2.most_common()[0][0]
F_a1 = c1.most_common()[0][1]
F_a2 = c2.most_common()[0][1]
if K_a1 == K_a2:
  if  F_a1 > F_a2:
    F_a2 = c2.most_common()[1][1]
  elif F_a1 == F_a2:
    if  c1.most_common()[1][1] >  c2.most_common()[1][1]:
      F_a1 =  c1.most_common()[1][1]
    else:
      F_a2 =  c2.most_common()[1][1]
  else:
    F_a1 = c1.most_common()[1][1]
print((l_a1 - F_a1)+(l_a2 - F_a2))
Buggy python submission (verdict: Runtime Error):
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
D = min(y) - max(x)
if D >= 0 and max(x)+D <= min(y) 
	print("No War")
else:
	print("War")


Fixed submission:
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(x) < min(y) and X < min(y) <= Y:
	print("No War")
else:
	print("War")

Buggy python submission (verdict: Runtime Error):
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(x) < min(y) and min(y) != M and max(x) != N
  print("No War")
else:
  print("War")


Fixed submission:
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(x) < min(y) and X < min(y) <= Y:
	print("No War")
else:
	print("War")
Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
a = list(map(int,input().split()))
res,ans = [],0
for i in range(n):
	res.append(abs(a[i]-x))
#print(min(res))
res.sort()
bol = False
s = 0
while(bol==False):
	tmp = res[s]
	cnt = 0
	for j in range(n-1):
		if a[j]%tmp == a[j+1]%tmp:
			cnt += 1
	if cnt == n-1:
		bol = True
		ans = tmp
	else:
		s += 1
print(ans)

Fixed submission:
import fractions
n,x = map(int,input().split())
a = list(map(int,input().split()))
res,ans = [],0
for i in range(n):
	res.append(abs(a[i]-x))
if len(res) > 3:
	D = fractions.gcd(res[0],res[1])
	for j in range(2,len(res)-2):
		D = fractions.gcd(D,res[j])
	ans = D
else:
	ans = min(res)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
s = input()
n = int(input())
if n == 1:
	print(s[0])
	sys.exit()
if 
for i in s:
	if i != '1':
		print(i)
		sys.exit()
print(1)

Fixed submission:
import sys
s = input()
n = int(input())
cnt = 0
if n == 1:
	print(s[0])
	sys.exit()
for i in s:
	if i == '1':
		cnt += 1
	else:
		break
if n <= cnt:
	print(1)
	sys.exit()
	
for i in s:
	if i != '1':
		print(i)
		sys.exit()
print(1)
Buggy python submission (verdict: Runtime Error):
import sys
S = list(input())
C_cnt,low,upp = 0,0,0
if S[0] != "A" or S[-1].isupper()
  print("WA")
  sys.exit()
for i in range(1,len(S)-1):
  if S[i] == "C":
    C_cnt += 1
  elif S[i].islower():
    low += 1
  elif S[i].isupper():
    upp += 1
if C_cnt = 1 and low = len(S)-3 and upp = 0:
  print("AC")
else :
  print("WA")

Fixed submission:
import sys
S = list(input())
C_cnt,low,upp = 0,0,0
if S[0] != "A" or S[-1].isupper() or S[1].isupper():
  print("WA")
  sys.exit()
for i in range(2,len(S)-1):
  if S[i] == "C":
    C_cnt += 1
  elif S[i].islower():
    low += 1
  elif S[i].isupper():
    upp += 1
if C_cnt == 1 and low == len(S)-4 and upp == 0:
  print("AC")
else :
  print("WA")
Buggy python submission (verdict: Runtime Error):
import sys
S,T = map(str,input().split())
for i in range(len(S)):
  tmp = S[-1]
  S[-1] = ""
  S.insert(0,tmp)
  if S == T:
    print("Yes")
    sys.exit()
print("No")
    

Fixed submission:
import sys
S = input()
T = input()
for i in range(len(S)):
  tmp = S[-1]
  S = tmp + S[:-1]
  if S == T:
    print("Yes")
    sys.exit()
print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
n = list(str(N))
print("Yes" if N%(sum(n)==0 else "No")

Fixed submission:
N = int(input())
NL = list(str(N))
n = [int(i) for i in NL]
print("Yes" if N%(sum(n))==0 else "No")