Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())
nr=n//r
nb=n//b
ans=0
lb=[b*k for k in range(nb+1)]
lst=lb.copy()

for i in lb:
  ng=(n-i)//g
  for j in range(1,ng+1):
    lst.append(i+g*j)

lst.sort()
l=len(lst)

import bisect
for i in range(nr+1):
  res=n-r*i
  idx=bisect.bisect_left(lst,res)
  if idx<l and lst[idx]==res:
    ans+=lst.count(res)
print(ans)


Fixed submission:
r,g,b,n=map(int,input().split())
nr=n//r
ans=0
for i in range(nr+1):
  ng=(n-i*r)//g
  for j in range(ng+1):
    res=n-r*i-g*j
    if res%b==0:
      ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())
nr=n//r
ng=n//g
nb=n//b
ans=0
lst=[b*k for k in range(nb+1)]
l=len(lst)
import bisect
for i in range(nr+1):
  for j in range(ng+1):
    res=n-i*r-j*g
    idx=bisect.bisect_left(lst,res)
    if idx<l and lst[idx]==res:
      ans+=1
        
print(ans)

Fixed submission:
r,g,b,n=map(int,input().split())
nr=n//r
ans=0
for i in range(nr+1):
  ng=(n-i*r)//g
  for j in range(ng+1):
    res=n-r*i-g*j
    if res%b==0:
      ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())
nr=n//r
ng=n//g
nb=n//b
ans=0
for i in range(nr+1):
  for j in range(ng+1):
    for k in range(nb+1):
      if i*r+j*g+k*b==n:
        ans+=1
print(ans)

Fixed submission:
r,g,b,n=map(int,input().split())
nr=n//r
ans=0
for i in range(nr+1):
  ng=(n-i*r)//g
  for j in range(ng+1):
    res=n-r*i-g*j
    if res%b==0:
      ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[int(i) for i in input().split()]
l.extend(l)
from fractions import gcd
from functools import reduce
ans=1
def gcd_list(numbers):
    return reduce(gcd, numbers)
for i in range(n):
  ans=max(ans,gcd_list(l[i:i+n-1]))
print(ans)
  

Fixed submission:
n=int(input())
l=[int(i) for i in input().split()]
l.extend(l)
from fractions import gcd
lst1=[l[0]]
lst2=[l[-1]]
for i in range(1,n):
    lst1.append(gcd(lst1[-1],l[i]))
for i in range(n-1,-1,-1):
    lst2.append(gcd(lst2[-1],l[i]))
lst2=lst2[::-1]
lst=[]
for i in range(n):
    if i==0:
        lst.append(lst2[1])
    if i==n-1:
        lst.append(lst1[-2])
    else:
        lst.append(gcd(lst1[i-1],lst2[i+1]))
print(max(lst))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
lst=[1]
for i in range(1,n):
    if s[i]!=s[i-1]:
        lst.append(1)
    else:
        lst[-1]=lst[-1]+1
p=2*k
L=[0]
for i in lst:
  L.append(L[-1]+i)
l=len(L)
ans=0
if s=='1'*n:
    ans=n
else:
    if s[0]=='1':
        if l%2==0:
            q=(l-p)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
        else:
            L.append(0)
            q=(l-p+1)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
    else:
        L.insert(0,0)
        if l%2==1:
            L.insert(0,0)
            q=(l-p+1)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
        else:
            L.append(0)
            q=(l-p+2)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
print(ans)
    


Fixed submission:
a,b=map(int,input().split())
print(max(a+a-1,a+b,b+b-1))

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):
n=int(input())
lst=[int(input()) for i in range(5)]
l=[0]*5
l.insert(0,n)
def counting(l,lst,ans):
    if l[5]==n:
        return ans
    else:
        for i in range(5,0,-1):
            res=min(l[i-1],lst[i-1])
            l[i]+=res
            l[i-1]-=res
        ans+=1
        return counting(l,lst,ans)
print(counting(l,lst,0))

Fixed submission:
n=int(input())
lst=[int(input()) for i in range(5)]
m=min(lst)
import math
print(math.ceil(n/m)+4)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=int(input())
  lst=[int(input()) for i in range(5)]
  l=[0]*5
  l.insert(0,n)
  ans=0
  while l[5]!=n:
    for i in range(5,0,-1):
      if l[i-1]!=0:
        res=min(l[i-1],lst[i-1])
        l[i]+=res
        l[i-1]-=res
    ans+=1
  print(ans)
if __name__=='__main__':
  main()

Fixed submission:
n=int(input())
lst=[int(input()) for i in range(5)]
m=min(lst)
import math
print(math.ceil(n/m)+4)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lst=[int(input()) for i in range(5)]
l=[0]*5
l.insert(0,n)
ans=0
while l[5]!=n:
    for i in range(5,0,-1):
        if l[i-1]!=0:
            res=min(l[i-1],lst[i-1])
            l[i]+=res
            l[i-1]-=res
        
    ans+=1
   
print(ans)

Fixed submission:
n=int(input())
lst=[int(input()) for i in range(5)]
m=min(lst)
import math
print(math.ceil(n/m)+4)
Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
cl=[int(i) for i in input().split()]
lst=[]
for i in al:
  for j in bl:
    lst.append(i+j)
lst.sort(reverse=True)
num=min(x*y,k)
lst=lst[:num]
L=[]
for i in cl:
  for j in lst:
    L.append(i+j)
L.sort(reverse=True)
for i in range(k):
  print(L[i])

Fixed submission:
x,y,z,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
cl=[int(i) for i in input().split()]
lst=[i+j for i in al for j in bl]
lst.sort(reverse=True)
num=min(x*y,k)
lst=lst[:num]
L=[i+j for i in cl for j in lst]
L.sort(reverse=True)
for i in range(k):
  print(L[i])

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
cl=[int(i) for i in input().split()]
lst=[]
for i in al:
  for j in bl:
    lst.append(i+j)
lst.sort(reverse=True)
num=min(x*y,k)
lst=lst[:k]
L=[]
for i in cl:
  for j in lst:
    L.append(i+j)
L.sort(reverse=True)
for i in range(k):
  print(L[i])

Fixed submission:
x,y,z,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
cl=[int(i) for i in input().split()]
lst=[i+j for i in al for j in bl]
lst.sort(reverse=True)
num=min(x*y,k)
lst=lst[:num]
L=[i+j for i in cl for j in lst]
L.sort(reverse=True)
for i in range(k):
  print(L[i])
Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
slst=[]
cnt=[]
for i in range(n-1):
  slst.append(s[i:i+2])
for a,b in enumerate(slst):
  if b=='AC':
    cnt.append(a)
l=[]
for i in range(q):
  x,y=map(int,input().split())
  num=0
  for j in cnt:
    if x-1<=j<=y-2:
      num+=1
  print(num)

Fixed submission:
import bisect
n,q=map(int,input().split())
s=input()
slst=[]
cnt=[]
for i in range(n-1):
  slst.append(s[i:i+2])
for a,b in enumerate(slst):
  if b=='AC':
    cnt.append(a)
l=[]
for i in range(q):
  x,y=map(int,input().split())
  M=bisect.bisect_left(cnt,x-1)
  N=bisect.bisect_right(cnt,y-2)
  print(N-M)

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
l=[]
for i in range(q):
  l.append(tuple(map(int,input().split())))
for j in range(q):
  x,y=l[j]
  a=s[x-1:y]
  num=a.count('AC')
  print(num)

Fixed submission:
import bisect
n,q=map(int,input().split())
s=input()
slst=[]
cnt=[]
for i in range(n-1):
  slst.append(s[i:i+2])
for a,b in enumerate(slst):
  if b=='AC':
    cnt.append(a)
l=[]
for i in range(q):
  x,y=map(int,input().split())
  M=bisect.bisect_left(cnt,x-1)
  N=bisect.bisect_right(cnt,y-2)
  print(N-M)

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
l=[]
for i in range(q):
  l.append(tuple(map(int,input().split())))
for j in range(q):
  x,y=l[j]
  counting=0
  a=s[x-1:y]
  for i in range(y-x):
    if a[i:i+2]=='AC':
      counting+=1
  print(counting)

Fixed submission:
import bisect
n,q=map(int,input().split())
s=input()
slst=[]
cnt=[]
for i in range(n-1):
  slst.append(s[i:i+2])
for a,b in enumerate(slst):
  if b=='AC':
    cnt.append(a)
l=[]
for i in range(q):
  x,y=map(int,input().split())
  M=bisect.bisect_left(cnt,x-1)
  N=bisect.bisect_right(cnt,y-2)
  print(N-M)
Buggy python submission (verdict: Runtime Error):
N=int(input())
lst=[0]
mod=10**9+7

for i in range(N):
  a=int(input())
  if lst[-1]==a:#直前と同じ色はlstに入れない（圧縮）
    continue　
  else:
    lst.append(a)
#今、lstのindexと石の個数は等しい
    
length=len(lst)

#全色のリストL、初期値０にしておく
#DPをDP[0]を１に、残りlength-1個を０にしたリストとする
L=[0]*(2*10**5+1)
DP=[0]*(length-1)
DP.insert(0,1)
for i in range(1,length):
  if L[lst[i]]==0:#色がまだ出ていないとき
    DP[i]=DP[i-1]%mod
    L[lst[i]]=i#色のリストLに今のindexを記録
  else:#同じ色が出ているとき
    j=L[lst[i]]#直前の色のindexはj
    DP[i]=(DP[i-1]+DP[j])%mod
    L[lst[i]]=i#色のリストLに今のindexを記録
print(DP[-1])


Fixed submission:
N=int(input())
lst=[0]
mod=10**9+7
for i in range(N):
  a=int(input())
  if lst[-1]==a:
    continue
  else:
    lst.append(a)
length=len(lst)
L=[0]*(2*10**5+1);DP=[0]*(length-1)
DP.insert(0,1)
for i in range(1,length):
  if L[lst[i]]==0:
    DP[i]=DP[i-1]%mod
    L[lst[i]]=i
  else:
    j=L[lst[i]]
    DP[i]=(DP[i-1]+DP[j])%mod
    L[lst[i]]=i
print(DP[-1])

Buggy python submission (verdict: Runtime Error):
N=int(input())
lst=[0]
mod=10**9+7

for i in range(N):
  a=int(input())
  if lst[-1]==a:#直前と同じ色はlstに入れない（圧縮）
    continue　
  else:
    lst.append(a)
#今lstのindexと石の個数は等しい
    
length=len(lst)

#全色のリストL、初期値０にしておく
#DPをDP[0]を１に、残りlength-1個を０にしたリストとする
L=[0]*(2*10**5+1)
DP=[0]*(length-1)
DP.insert(0,1)
for i in range(1,length):
  if L[lst[i]]==0:#色がまだ出ていないとき
    DP[i]=DP[i-1]%mod
    L[lst[i]]=i#色のリストLに今のindexを記録
  else:#同じ色が出ているとき
    j=L[lst[i]]#直前の色のindexはj
    DP[i]=(DP[i-1]+DP[j])%mod
    L[lst[i]]=i#色のリストLに今のindexを記録
print(DP[-1])


Fixed submission:
N=int(input())
lst=[0]
mod=10**9+7
for i in range(N):
  a=int(input())
  if lst[-1]==a:
    continue
  else:
    lst.append(a)
length=len(lst)
L=[0]*(2*10**5+1);DP=[0]*(length-1)
DP.insert(0,1)
for i in range(1,length):
  if L[lst[i]]==0:
    DP[i]=DP[i-1]%mod
    L[lst[i]]=i
  else:
    j=L[lst[i]]
    DP[i]=(DP[i-1]+DP[j])%mod
    L[lst[i]]=i
print(DP[-1])
Buggy python submission (verdict: Runtime Error):
A,B,K=(int(i) for i in input().split()) 
j=1
L=[]

for i in range(1,min(A,B)):
  if A%i==0 and B%i==0:
    L.append(i)
   
     
print(L[K-1])

Fixed submission:
A,B,K=(int(i) for i in input().split()) 
L=[]
 
for i in range(1,min(A,B)+1):
  if A%i==0 and B%i==0:
    L.append(i)
L=L[::-1]
print(L[K-1])
Buggy python submission (verdict: Runtime Error):
N,M=(int(i) for i in input().split())
L=[]
for i in range(N):
  L.append([int(i) for i in input().split()])
s=set(L[0][1:L[0][0]])
for i in range(N):
  s=s&set(L[i][1:L[i][0]])
print(len(list(s))
   

Fixed submission:
N,M=(int(i) for i in input().split())
S=set(int(i+1) for i in range(M))

for i in range(N):
    L=[int(i) for i in input().split()]
    S=S&set(L[1:])
print(len(list(S)))
Buggy python submission (verdict: Runtime Error):
T X=(int(i) for i in input().split()) 
print(T/X)

Fixed submission:
T,X=(int(i) for i in input().split()) 
print(T/X)
Buggy python submission (verdict: Runtime Error):
N=int(input())
L=[int(i) for i in input().split()]
M=max(L)
del L[M]
if M>=sum(L):
  print('No')
else:
  print('Yes')

Fixed submission:
N=int(input())
L=[int(i) for i in input().split()]
M=max(L)
L.remove(M)
if M>=sum(L):
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
a,b,c=(int(i) for i in input().split())
t=[a,b,c].sort()
print(t[0]*t[1]/2)

Fixed submission:
a,b,c=(int(i) for i in input().split())
t=sorted([a,b,c])
print(int(t[0]*t[1]/2))
Buggy python submission (verdict: Runtime Error):
A,B,C,D=(int(i) for i in input().split())
if {A,B,C,D}=={1,9,7,4}:
    print("Yes")
elif:
    print("No")

Fixed submission:
A,B,C,D=(int(i) for i in input().split())
if {A,B,C,D}=={1,9,7,4}:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
wlist=[ i for i in input()]
klist=["k","e","y","e","n","c","e"]
a=0
b=0
while b<=6:
    if wlist[a]==klist[b]:
        a+=1
        b+=1
    else:
        a+=1
if b==7:
    print("YES")
else:
    print("NO")

Fixed submission:
wlist=[ i for i in input()]
klist=["k","e","y","e","n","c","e"]
a=[]
for i in range(len(wlist)-1):
    for j in range(i+1,len(wlist)):
        if wlist[0:i+1]+wlist[j:]==klist:
                a.append(1)
        else:
                a.append(0)
                
if 1 in a:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
S=input()[::-1]
ans,tmp=0,0
for i in S:
  if i=='W'
    tmp+=1
  else:
    ans+=tmp
print(ans)

Fixed submission:
S=input()[::-1]
ans,tmp=0,0
for i in S:
  if i=='W':
    tmp+=1
  else:
    ans+=tmp
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
a=0
for i in range(len(S)):
  if S[i]=='W':
    a+=S[:i].count('B')
print(a)

Fixed submission:
S=input()[::-1]
ans,tmp=0,0
for i in S:
  if i=='W':
    tmp+=1
  else:
    ans+=tmp
print(ans)

Buggy python submission (verdict: Runtime Error):
S=list(input())
a=0
for i in range(len(S):
  if S[i]=='W':
    a+=L[:i].count('B')
print(a)
    
    

Fixed submission:
S=input()[::-1]
ans,tmp=0,0
for i in S:
  if i=='W':
    tmp+=1
  else:
    ans+=tmp
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()[::-1]
B='BW';A='WB'
a=0
L=len(S)
i=0
while i<=L-2:
  if S[i:i+2]==A:
    S=S[0:i]+B+S[i+2:]
    a+=1
    i=0
  i+=1
print(a)

Fixed submission:
S=input()[::-1]
ans,tmp=0,0
for i in S:
  if i=='W':
    tmp+=1
  else:
    ans+=tmp
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K=(int(i) for i in input().split())
hlist=[int(input()) for l in range(N)]
hlist.sort()
for j in range(N-K+2):
    dif=[hlist[j+k]-hlist[j]]
print(min(dif))

Fixed submission:
D=input()
if D=='25':
  print('Christmas')
elif D=='24':
  print('Christmas Eve')
elif D=='23':
  print( 'Christmas Eve Eve')
elif D=='22':
  print('Christmas Eve Eve Eve')

Buggy python submission (verdict: Runtime Error):
N=int(input())
price=[int(input()) for i in range(N)]
price.sort(reverse=True)
price[0]=price[0]//2
sum(price)


Fixed submission:
D=input()
if D=='25':
  print('Christmas')
elif D=='24':
  print('Christmas Eve')
elif D=='23':
  print( 'Christmas Eve Eve')
elif D=='22':
  print('Christmas Eve Eve Eve')

Buggy python submission (verdict: Runtime Error):
N=int(input())
price=[]
for i in range(N):
    price.append(int(input()))
price.sort(reverse=True)
price[0]=price[0]//2
sum(price)


Fixed submission:
D=input()
if D=='25':
  print('Christmas')
elif D=='24':
  print('Christmas Eve')
elif D=='23':
  print( 'Christmas Eve Eve')
elif D=='22':
  print('Christmas Eve Eve Eve')
Buggy python submission (verdict: Runtime Error):
N=int(input())
price=[]
for i in range(N):
    price.append(int(input()))
price.sort(Reverse=True)
price[0]=price[0]//2
sum(price)
           
           

Fixed submission:
N=int(input())
price=[int(input()) for i in range(N)]
price.sort(reverse=True)
price[0]=price[0]//2
a=sum(price)
print(a)

Buggy python submission (verdict: Runtime Error):
N=int(input())
price=[int(input() for i in range(N)]
price.sort()
price[0]=price[0]//2
sum(price)

Fixed submission:
N=int(input())
price=[int(input()) for i in range(N)]
price.sort(reverse=True)
price[0]=price[0]//2
a=sum(price)
print(a)
Buggy python submission (verdict: Runtime Error):
N,K=(int(i) for i in input().split())
hlist=[int(input()) for l in range(N)]
hlist.sort()
for j in range(N-K+2):
    dif=[hlist[j+k]-hlist[j]]
print(min(dif))

Fixed submission:
N,K=(int(i) for i in input().split())
hlist=[int(input()) for i in range(N)]
hlist.sort()
dif=[]
for j in range(N-K+1):
    dif.append(hlist[j+K-1]-hlist[j])
print(min(dif))

Buggy python submission (verdict: Runtime Error):
N,K=(int(i) for i in input().split())
hlist=[]
for _ in range(N):
    hlist.append(int(input()))
hlist.sort()
for j in range(N-K+2):
    dif=[hlist[j+k]-hlist[j]]
print(min(dif))

Fixed submission:
N,K=(int(i) for i in input().split())
hlist=[int(input()) for i in range(N)]
hlist.sort()
dif=[]
for j in range(N-K+1):
    dif.append(hlist[j+K-1]-hlist[j])
print(min(dif))
Buggy python submission (verdict: Runtime Error):
N=int(input())
T,A=(int(i) for i in input().split())
Temp=[T-0.006*int(input()) for i in range(N)]
dif=[abs(A-Temp[j]) for j in range (N)]
print(dif.index(min(dif))+1)


Fixed submission:
N=int(input())
T,A=(int(i) for i in input().split())
Hlist=[int(i) for i in input().split()]
Temp=[T-0.006*Hlist[i] for i in range(N)]
dif=[abs(A-Temp[j]) for j in range (N)]
print(dif.index(min(dif))+1)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
N.M=(int(i) for i in input.split())
S=input()
T=input()
gcd_NM=gcd(N,M)
lcm_NM=(N*M//gcd_NM)
A=True
for i in range(gcd_NM):
  if S[(N//gcd_NM)*i]!=T[(M//gcd_NM)*i]:
    A=False 
    break
if A:
  print(lcm_NM)
else:
  print(-1)

Fixed submission:
from fractions import gcd
N,M=(int(i) for i in input().split())
S=input()
T=input()
gcd_NM=gcd(N,M)
lcm_NM=(N*M//gcd_NM)
A=True
for i in range(gcd_NM):
  if S[(N//gcd_NM)*i]!=T[(M//gcd_NM)*i]:
    A=False 
    break
if A:
  print(lcm_NM)
else:
  print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
N,M=(int(i) for i in input().split())
S=input()
T=input()
gcd_NM=gcd(N,M)
L=(N*M//gcd_NM)
LN=[1+(L//N)*i for i in range(N)]
LM=[1+(L//M)*i for i in range(M)]
L_NM=list(set(LN)&set(LM))
A=True
for i in L_NM:
  if S[LN.index(i)]!=T[LM.index(i)]:
    A=False
    break
if A is True:
  print(L)
else:
  print(-1)

Fixed submission:
from fractions import gcd
N,M=(int(i) for i in input().split())
S=input()
T=input()
gcd_NM=gcd(N,M)
lcm_NM=(N*M//gcd_NM)
A=True
for i in range(gcd_NM):
  if S[(N//gcd_NM)*i]!=T[(M//gcd_NM)*i]:
    A=False 
    break
if A:
  print(lcm_NM)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
N,M,X,Y=(int(i) for i in input().split())
xlist=[].append(int(input()) for i in range(N))
ylist=[].append(int(input()) for i in range(M))
xmax=max(xlist)
ymin=min(ylist)
if xmax<ymin:
  if xmax<Y and X<ymin:
    print('No War')
  else:
    print('War')
else:
  print('War')

Fixed submission:
N,M,X,Y=(int(i) for i in input().split())
xlist=[int(i) for i in input().split()]
ylist=[int(i)for i in input().split()]
xmax=max(xlist)
ymin=min(ylist)
if xmax<ymin:
  if xmax<Y and X<ymin:
    print('No War')
  else:
    print('War')
else:
  print('War')

Buggy python submission (verdict: Runtime Error):
N,M,X,Y=(int(i) for i in input().split())
xlist=[int(input()) for i in range(N)]
ylist=[int(input()) for i in range(M)]
xmax=max(xlist)
ymin=min(ylist)
if xmax<ymin:
  if xmax<Y and X<ymin:
    print('No War')
  else:
    print('War')
else:
  print('War')
    

Fixed submission:
N,M,X,Y=(int(i) for i in input().split())
xlist=[int(i) for i in input().split()]
ylist=[int(i)for i in input().split()]
xmax=max(xlist)
ymin=min(ylist)
if xmax<ymin:
  if xmax<Y and X<ymin:
    print('No War')
  else:
    print('War')
else:
  print('War')
Buggy python submission (verdict: Runtime Error):
N=int(input())
L=[]
a=True
for i in range(n):
  L.append(input())
if len(L)!=len(set(L)):
  print('No')
else:
  for i in range(1,len(L)):
    if L[i][0]==L[i-1][-1]:
      continue
    else:
      a=False
  if a is True:
    print('Yes')
  else:
    print('No')



Fixed submission:
n=int(input())
L=[]
a=True
for i in range(n):
  L.append(input())
if len(L)!=len(set(L)):
  print('No')
else:
  for i in range(1,len(L)):
    if L[i][0]==L[i-1][-1]:
      continue
    else:
      a=False
  if a is True:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
K=int(input())
if K%2==0:
  print((L//2)**2)
else:
  print(L//2*(L//2+1))

Fixed submission:
K=int(input())
if K%2==0:
  print((K//2)**2)
else:
  print(K//2*(K//2+1))
Buggy python submission (verdict: Runtime Error):
N=int(input())
import fractions 
print(2*N//fractions.gcd(2,N))

Fixed submission:
L=[int(i) for i in input().split()]
A=abs(L[0]-L[1])
B=abs(L[1]-L[2])
C=abs(L[2]-L[0])
S=[A+B,A+C,B+C]
print(min(S))
Buggy python submission (verdict: Runtime Error):
N=int(input())
import fraction
print(2*N//fraction.gcd(2,N))

Fixed submission:
N=int(input())
from fractions import gcd
print(2*N//gcd(2,N))

Buggy python submission (verdict: Runtime Error):
N=int(input())
import math
print(2*N//math.gcd(2,N))

Fixed submission:
N=int(input())
from fractions import gcd
print(2*N//gcd(2,N))

Buggy python submission (verdict: Runtime Error):
N=int(input())
import math
print(2*n//math.gcd(2,N))

Fixed submission:
N=int(input())
from fractions import gcd
print(2*N//gcd(2,N))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(i) for i in input()]
maxv=A[0]
minv=A[0]
for i in range(N):
  maxv=max(maxv,A[i])
  minv=min(minv,A[i])
print(maxv-minv)

Fixed submission:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
print(A[-1]-A[0])

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(i) for i in input()]
maxv=A[0]
minv=A[1]-A[0]
for i in range(N):
  maxv=max(maxv,abs(A[i]-minv))
  minv=min(minv,A[i])
print(maxv)

Fixed submission:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
print(A[-1]-A[0])

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(i) for i in input()]
maxv=A[0]
minv=A[1]-A[0]
for i in range(N):
  maxv=max(maxv,A[i]-minv)
  minv=min(minv,A[i])
print(maxv)

Fixed submission:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
print(A[-1]-A[0])
Buggy python submission (verdict: Runtime Error):
S=list(input())
a=0
for i in S:
  if i==='+':
    a+=1
  else:
    a-=1
print(a)

Fixed submission:
S=input()
a=0
for i in S:
  if i=='+':
    a+=1
  else:
    a-=1
print(a)

Buggy python submission (verdict: Runtime Error):
S=input()
a=0
for i in S:
  if i==='+':
    a+=1
  else:
    a-=1
print(a)
    

Fixed submission:
S=input()
a=0
for i in S:
  if i=='+':
    a+=1
  else:
    a-=1
print(a)

Buggy python submission (verdict: Runtime Error):
S=input()
a=0
for i in range(4):
  if i==='+':
    a+=1
  else:
    a-=1
print(a)
    

Fixed submission:
S=input()
a=0
for i in S:
  if i=='+':
    a+=1
  else:
    a-=1
print(a)
Buggy python submission (verdict: Runtime Error):
X=int(input())
i=2
L=[]
import math
while math.floor(X**(1/i))!=1:
    L.append(math.floor(X**(1/i))**2)
    i+=1
print(max(L))

Fixed submission:
N=int(input())
S=input()
L=[]
for i in range(0,N):
  L1=list(S[0:i]);L2=list(S[i:N])
  L.append(len(list(set(L1)&set(L2))))
print(max(L))

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
L=[]
len_s=len(S)
for i in range(2,len_s-1):
  L1=list(S[1:i]);L2=list(S[i:len_s])
  L.append(len(list(set(L1)&set(L2))))
print(max(L))

Fixed submission:
N=int(input())
S=input()
L=[]
for i in range(0,N):
  L1=list(S[0:i]);L2=list(S[i:N])
  L.append(len(list(set(L1)&set(L2))))
print(max(L))

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
L=[]
len_s=len(S)
for i in range(2,len_s):
  L1=list(S[1:i]);L2=list(S[i:len_s])
  L.append(len(list(set(L1)&set(L2))))
print(max(L))

Fixed submission:
N=int(input())
S=input()
L=[]
for i in range(0,N):
  L1=list(S[0:i]);L2=list(S[i:N])
  L.append(len(list(set(L1)&set(L2))))
print(max(L))
Buggy python submission (verdict: Runtime Error):
a,b,c,k=(int(i) for i in input().split())
def ans(x):
  if abs(x)>=10e18:
    return 'Unfair'
  else:
    return x
if k==0
  print(ans(a-b))
else:
  print(ans(b-a))
  

Fixed submission:
a,b,c,k=(int(i) for i in input().split())
def ans(x):
  if abs(x)>=10e18:
    return 'Unfair'
  else:
    return x
if k%2==0:
  print(ans(a-b))
else:
  print(ans(b-a))
Buggy python submission (verdict: Runtime Error):
X=int(input())
i=2
L=[]
import math
while math.floor(X**(1/i))!=1:
    L.append(math.floor(X**(1/i))**i)
    i+=1
print(max(L))

Fixed submission:
X=int(input())
L=[1]
for i in range(2,X+1):
  j=2
  while i**j<=X:
    L.append(i**j)
    j+=1
print(max(L))

Buggy python submission (verdict: Runtime Error):
X=int(input())
i=2
L=[]
import math
while math.floor(X**(1/i))!=1:
    L.append(math.floor(X**(1/i))**2)
    i+=1
print(max(L))

Fixed submission:
X=int(input())
L=[1]
for i in range(2,X+1):
  j=2
  while i**j<=X:
    L.append(i**j)
    j+=1
print(max(L))