Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))

a.sort()

plus = a[a > 0]
minus = a[a < 0]
zero = a[a == 0]

#infだと割ってもinf
left = -10 ** 18
right = 10 ** 18

while left + 1 < right:
    x = (left + right) // 2
    cnt = 0
    if x >= 0:
        cnt += n * len(zero)
    cnt += a.searchsorted(x // plus, side="right").sum()
    cnt += (n - a.searchsorted(-(-x // minus), side="left")).sum()
    cnt -= np.count_nonzero(a * a <= x)
    cnt //= 2

    if cnt >= k:
        right = x
    else:
        left = x

print(right)


Fixed submission:
import numpy as np
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))

a.sort()

plus = a[a > 0]
minus = a[a < 0]
zero = a[a == 0]

#infだと割ってもinf
left = -10 ** 18
right = 10 ** 18

while left + 1 < right:
    x = (left + right) // 2
    cnt = 0
    if x >= 0:
        cnt += n * len(zero)
    cnt += a.searchsorted(x // plus, side="right").sum()
    cnt += (n - a.searchsorted(-(-x // minus), side="left")).sum()
    cnt -= np.count_nonzero(a * a <= x)
    cnt //= 2

    if cnt >= k:
        right = x
    else:
        left = x

print(right)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

m = max(p)
l = [0]
for i in range(1,m + 1):
    l.append(l[-1] + i)
for i in range(1,len(l)):
    l[i]/=i
for i in range(n):
    p[i] = l[p[i]]

ans = 0
for i in range(len(p) - k + 1):
    ans = max(ans,sum(p[i:i + k]))

print(ans)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

m = max(p)
l = [0]
for i in range(1,m + 1):
    l.append(l[-1] + i)
for i in range(1,len(l)):
    l[i]/=i
for i in range(n):
    p[i] = l[p[i]]

#累積和
for i in range(1,len(p)):
    p[i]+=p[i - 1]
p=[0]+p

ans = 0
for i in range(len(p) - k):
    ans = max(ans,p[i + k] - p[i])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans=0
for i in range(10):
    for j in range(10):
        a = 0
        b = 0
        for k in range(1,n+1):
            if str(k)[0] == str(i) and str(k)[-1] == str(j):
                a+=1
            if str(k)[0] == str(j) and str(k)[-1] == str(i):
                b+=1
        ans+=a*b
print(ans)

Fixed submission:
n = int(input())
ans = 0

c = [[0] * 10 for _ in range(10)]

for i in range(1,n + 1):
    c[int(str(i)[0])][int(str(i)[-1])]+=1

for i in range(10):
    for j in range(10):
        ans+=c[i][j] * c[j][i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
ans=0
for i in range(10):
    for j in range(10):
        a = 0
        b = 0
        #print(i,j)
        for k in range(1,n+1):
            if str(k)[0] == str(i) and str(k)[-1] == str(j):
                #sys.stdout.write(str(k)+",")
                a+=1
            if str(k)[0] == str(j) and str(k)[-1] == str(i):
                b+=1
                #print(k)
        ans+=a*b
print(ans)

Fixed submission:
n = int(input())
ans = 0

c = [[0] * 10 for _ in range(10)]

for i in range(1,n + 1):
    c[int(str(i)[0])][int(str(i)[-1])]+=1

for i in range(10):
    for j in range(10):
        ans+=c[i][j] * c[j][i]
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
mod = 10 ** 9 + 7

x,y = map(int,input().split())
dp = [[0] * (y + 1) for _ in range(x + 1)]
dp[0][0] = 1

que = deque()
a = 0
b = 0
que.append([a,b])

while a != x or b != y:
    if not que:
        break
    else:
        a,b = que.popleft()
    if a + 1 <= x and b + 2 <= y:
        que.append([a + 1,b + 2])
        dp[a + 1][b + 2]+=dp[a][b]
        dp[a + 1][b + 2]%=mod
    if a + 2 <= x and b + 1 <= y:
        que.append([a + 2,b + 1])
        dp[a + 2][b + 1]+=dp[a][b]
        dp[a + 2][b + 1]%=mod

print(dp[x][y]%mod)

Fixed submission:
#組み合わせ総数
mod = 10 ** 9 + 7
def comb(n, k):
    res = 1
    for i in range(n - k + 1, n + 1):
        res = res * i % mod
    for i in range(1, k + 1):
        res = res * pow(i, mod - 2, mod) % mod
    return res

x,y = map(int,input().split())

if (x + y) % 3 != 0:
    print(0)
    exit()

m = (2 * x - y) // 3
n = x - 2 * m

if n >= 0 and m >= 0:
    print(comb(m + n,min(m,n)))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
print(sum([i for i in range(1,n)]))

Fixed submission:
n=int(input())
print(n*(n-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10 ** 9 + 7
inf = float("inf")

s = list(input())
n = len(s)

dp = [[0 for _ in range(13)] for _ in range(n+1)]
dp[0][0] = 1

for i in range(n):
    c = inf
    if s[i] == "?":
        c = -1
    else:
        c = ord(s[i]) - ord('0')
    for j in range(10):
        if c != -1 and c != j:
            continue
        for k in range(13):
            dp[i + 1][(k * 10 + j) % 13] += dp[i][k]
    for j in range(13):
        dp[i + 1][j] %= mod
        
print(dp[n][5])

Fixed submission:
mod = 10 ** 9 + 7
inf = float("inf")

s = list(input())
n = len(s)

dp = [[0 for _ in range(13)] for _ in range(n+1)]
dp[0][0] = 1

for i in range(n):
    c = inf
    if s[i] == "?":
        c = -1
    else:
        c = ord(s[i]) - ord('0')
    for j in range(10):
        if c != -1 and c != j:
            continue
        for k in range(13):
            dp[i + 1][(k * 10 + j) % 13] += dp[i][k]
    for j in range(13):
        dp[i + 1][j] %= mod
        
print(dp[n][5])
Buggy python submission (verdict: Runtime Error):
mod = 10 ** 9 + 7
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n, k = map(int, input().split())

for i in range(1, k + 1):
    print(int(cmb(n - k + 1, i) * cmb(k - 1, i - 1)) % mod)

Fixed submission:
mod = 10 ** 9 + 7
from operator import mul
from functools import reduce

def modcomb(n, k):
    x, y = 1, 1
    for i in range(k):
        x = x * (n - i) % mod
        y = y * (k - i) % mod
    return x * pow(y, mod - 2, mod) % mod

n, k = map(int, input().split())

for i in range(1, k + 1):
    #入れる場所
    print(int(modcomb(n - k + 1, i) * modcomb(k - 1, i - 1)) % mod)
    #分け方
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))

a.sort()
bc = [list(map(int,input().split())) for _ in range(m)]
bc.sort(key=lambda x:x[1],reverse=True)
l = []
[l.extend([i[1]] * i[0]) for i in bc]

for i in range(min(len(a),len(l))):
    a[i]=max(a[i],l[i])
print(sum(a))

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))

a.sort()
bc = [list(map(int,input().split())) for _ in range(m)]
bc.sort(key=lambda x:x[1],reverse=True)
l = []
for i in bc:
    l.extend([i[1]] * i[0])
    if len(l) > len(a):
        break

for i in range(min(len(a),len(l))):
    a[i] = max(a[i],l[i])
print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
#自然数m以下の素数を返す
def prime_numbers(m):
    primes = set()
    n = 2
    while n <= m:
        if all(n % i != 0 for i in primes):
            primes.add(n)
        n += 1
    return primes

q = int(input())
l = []
r = []
for i in range(q):
    L,R = map(int,input().split())
    l.append(L)
    r.append(R)

p = prime_numbers(max(r))
cnt = [0 for i in range(max(r)+1)]
for i in p:
    if (i + 1) // 2 in p:
        cnt[i]+=1

for i in range(1,len(cnt)):
    cnt[i]+=cnt[i - 1]

for i in range(q):
    print(cnt[r[i]] - cnt[l[i] - 1])

Fixed submission:
#素数列挙
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

q = int(input())
l = []
r = []
for i in range(q):
    L,R = map(int,input().split())
    l.append(L)
    r.append(R)

p = primes(max(r))
cnt = [0 for i in range(max(r)+1)]
for i in p:
    if (i + 1) // 2 in p:
        cnt[i]+=1

for i in range(1,len(cnt)):
    cnt[i]+=cnt[i - 1]

for i in range(q):
    print(cnt[r[i]] - cnt[l[i] - 1])
Buggy python submission (verdict: Runtime Error):
import math
import sys
import numpy

N,K = int(input())
ans = 0.000000000
for i in range(1,N+1):
    if i >= K:
        ans += 1
    else :
        ans += math.log2(K/i)/2

ans /= N
print(ans)

Fixed submission:
import math
import sys
import numpy

N,K = map(int, input().split())
a = 0.000000000
b = 1
for i in range(1,N+1):
    b = 1
    if i >= K:
        a += 1/N
    else :
        tmp = i
        while tmp < K:
            tmp *= 2
            b /= 2
        a += b/N
print(a)

Buggy python submission (verdict: Runtime Error):
import math
import sys
import numpy

N,K = int(input())
ans = 0.000000000
for i in range(1,N+1):
    if i >= K:
        ans += 1
    else :
        ans += math.log(K/i,2)/2

ans /= N
print(ans)

Fixed submission:
import math
import sys
import numpy

N,K = map(int, input().split())
a = 0.000000000
b = 1
for i in range(1,N+1):
    b = 1
    if i >= K:
        a += 1/N
    else :
        tmp = i
        while tmp < K:
            tmp *= 2
            b /= 2
        a += b/N
print(a)

Buggy python submission (verdict: Runtime Error):
import math
import sys

N,K = int(input())
ans = 0.000000000
for i in range(1,N+1):
    tmp = i
    q = 1.0000000/N
    while(tmp < K):
        q /= 2.00000000
        tmp *= 2
print(ans*1.0000000000000000000)

Fixed submission:
import math
import sys
import numpy

N,K = map(int, input().split())
a = 0.000000000
b = 1
for i in range(1,N+1):
    b = 1
    if i >= K:
        a += 1/N
    else :
        tmp = i
        while tmp < K:
            tmp *= 2
            b /= 2
        a += b/N
print(a)

Buggy python submission (verdict: Runtime Error):
import math
import sys

N,K = int(input())
ans = 0.000000000
for i in range(1,N+1):
    tmp = i
    q = 1.0000000/N
    while(tmp < K):
        q /= 2.00000000
        tmp *= 2
print(ans*1.0000000000000000000)

Fixed submission:
import math
import sys
import numpy

N,K = map(int, input().split())
a = 0.000000000
b = 1
for i in range(1,N+1):
    b = 1
    if i >= K:
        a += 1/N
    else :
        tmp = i
        while tmp < K:
            tmp *= 2
            b /= 2
        a += b/N
print(a)

Buggy python submission (verdict: Runtime Error):
import math
import sys

N,K = int(input())
ans = 0.000000000
for i in range(1,N+1):
    tmp = i
    q = 1.0000000/N
    while(tmp < K):
        q /= 2.00000000
        tmp *= 2
print(ans*1.0000000000000000000)

Fixed submission:
import math
import sys
import numpy

N,K = map(int, input().split())
a = 0.000000000
b = 1
for i in range(1,N+1):
    b = 1
    if i >= K:
        a += 1/N
    else :
        tmp = i
        while tmp < K:
            tmp *= 2
            b /= 2
        a += b/N
print(a)
Buggy python submission (verdict: Runtime Error):
import math
import sys
a,b,c = map(int(input().split()))
if a < c and c < b:
    print("Yes")
elif b < c and c < a:
    print("Yes")
else:
    print("No")


Fixed submission:
import math
import sys
a,b,c = map(int,input().split())
if a < c and c < b:
    print("Yes")
elif a > c and c > b:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import math
import sys
a,b,c = int(input().split())
if a < c and c < b:
    print("Yes")
elif b < c and c < a:
    print("Yes")
else:
    print("No")


Fixed submission:
import math
import sys
a,b,c = map(int,input().split())
if a < c and c < b:
    print("Yes")
elif a > c and c > b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
import sys
N = int(input())
s = input()
k = int(input())
t = s[k-1]
u = ""
for i in s:
    if s[i] == t:
        u += s[i]
    else :
        u += '*'
print(u)



Fixed submission:
import math
import sys
N = int(input())
s = input()
k = int(input())
t = s[k-1]
u = ""
for i in s:
    if i == t:
        u += i
    else :
        u += '*'
print(u)
Buggy python submission (verdict: Runtime Error):
N = int(input())
h = map(int,input().split())
mx = h[0]
ans = 1
for i in range(1,N):
    if h[i] >= mx:
        mx = h[i]
        ans += 1
print(ans)

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
mx = 0
ans = 0
for i in h:
    if mx <= i:
        ans += 1
        mx = i
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import sys
import numpy

a = list(mat(int,input().split()))
b = []
for i in range(5):
    b.append(a[i]%10)
mx = min(b)
ans = 0
for i in range(5):
    if mx == a[i]:
        continue
    else :
        ans += (a[i]+10-(a[i]%10))
ans += mx
print(ans)

Fixed submission:
import math
import sys
import numpy

a = []
for _ in range(5):
    a.append(int(input()))

ans = 0
Q = []
for i in a:
    if i % 10 != 0:
        Q.append(10 - i%10)
    ans += i
Q.sort(reverse=True)
print(ans + sum(Q[1:]))
Buggy python submission (verdict: Runtime Error):
H = int(input())
W = int(input())
h = int(input())
w = int(input())
print((H-h)*(W-w))

Fixed submission:
import numpy as np
H,W = map(int, input().split())
h,w = map(int, input().split())
print((H-h)*(W-w))

Buggy python submission (verdict: Runtime Error):
H = int(input())
W = int(input())
h = int(input())
w = int(input())
tate = H-h
yoko = W-w
print(tate*yoko)

Fixed submission:
import numpy as np
H,W = map(int, input().split())
h,w = map(int, input().split())
print((H-h)*(W-w))

Buggy python submission (verdict: Runtime Error):
H = input()
W = input()
h = input()
w = input()
tate = H-h
yoko = W-w
print(tate*yoko)

Fixed submission:
import numpy as np
H,W = map(int, input().split())
h,w = map(int, input().split())
print((H-h)*(W-w))
Buggy python submission (verdict: Runtime Error):
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    a = list(map(int,input().split()))
    num = 0
    for j in range(m):
        num += a[j]*b[j]
    num += C
    if num > 0:
        ans += 1
print(ans)

Fixed submission:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
cnt = 0
for i in range(n):
    sum = 0
    a = list(map(int,input().split()))
    for j in range(m):
        sum += a[j]*b[j]
    if sum + c > 0:
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
ab = [0]
num = m
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
ab.sort()
ans = 0
for i in ab:
    if i[1] >= num:
        ans += i[0]*num
        break
    else:
        ans += i[0]*i[1]
        num -= i[1]
print(ans)
        

Fixed submission:
n,m = map(int,input().split())
ab = []
num = m
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
ab.sort()
ans = 0
for i in ab:
    if i[1] >= num:
        ans += i[0]*num
        break
    else:
        ans += i[0]*i[1]
        num -= i[1]
print(ans)
Buggy python submission (verdict: Runtime Error):
s = str(input())
n = s.size()
cntz = 0
cnto = 0
for i in range(n):
    if s[i] == '0':
        cntz += 1
    elif s[i] == '1':
        cnto += 1
print(min(cnto,cntz))


Fixed submission:
s = str(input())
cntz = 0
cnto = 0
for i in s:
    if i == '0':
        cntz += 1
    elif i == '1':
        cnto += 1
ans = 2*min(cnto,cntz)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
    x, u = map(str,input())
    x = float(x)
    if u == 'JPY':
        ans += x
    else:
        ans += x*380000

print(ans)

Fixed submission:
N = int(input())
mo = 0
for i in range(N):
    x,y = map(str,input().split())
    x = float(x)
    if y == 'JPY':
        mo += x
    else:
        tmp = x*380000
        mo += tmp
print(mo)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
    x, u = str(int,input())
    x = float(x)
    if u == 'JPY':
        ans += x
    else:
        ans += x*380000

print(ans)

Fixed submission:
N = int(input())
mo = 0
for i in range(N):
    x,y = map(str,input().split())
    x = float(x)
    if y == 'JPY':
        mo += x
    else:
        tmp = x*380000
        mo += tmp
print(mo)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input())
num = [list(map(int,input().split())) for i in range(n)]
l = [0]*m
for i in range(n):
    for j in num[i][1:]:
        l[j-1] += 1
print(l.count(n))

Fixed submission:
n,m = map(int,input().split())
num = [list(map(int,input().split())) for i in range(n)]
l = [0]*m
for i in range(n):
    for j in num[i][1:]:
        l[j-1] += 1
print(l.count(n))
Buggy python submission (verdict: Runtime Error):
import numpy as np
T,X = map(int, input().split())
print(T/x*1.00000)

Fixed submission:
import numpy as np
T,X = map(int, input().split())
print(T/X*1.00000)
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x == 3 or x == 5 or x == 7:
    print("YES")
else print("NO")

Fixed submission:
x = int(input())
if x == 3 or x == 5 or x == 7:
    print("YES")
else :
    print("NO")

Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ll n; cin >> n;
    if(n == 3 || n == 5 || n== 7){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Fixed submission:
x = int(input())
if x == 3 or x == 5 or x == 7:
    print("YES")
else :
    print("NO")
Buggy python submission (verdict: Runtime Error):
s = input()
ans = []
for i in range(len(s) - 2):
    ans.append(abs(s[i:i+3] - 753))
print(min(ans))

Fixed submission:
s = str(input())
ans = 1000
for i in range(len(s)-2):
    x = int(s[i:i+3])
    ans = min(ans, abs(x-753))
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = []
for i in range(len(s) - 2):
    ans.append(abs(s[i:i+3]) - 753)
print(min(ans))

Fixed submission:
s = str(input())
ans = 1000
for i in range(len(s)-2):
    x = int(s[i:i+3])
    ans = min(ans, abs(x-753))
print(ans)

Buggy python submission (verdict: Runtime Error):
s = str(input())
ans = []
for i in range(len(s) - 2):
    ans.append(abs(s[i:i+3]) - 753)
print(min(ans))

Fixed submission:
s = str(input())
ans = 1000
for i in range(len(s)-2):
    x = int(s[i:i+3])
    ans = min(ans, abs(x-753))
print(ans)

Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    string s; cin >> s;
    int a, b;
    int ans = 1000;
    for(int i = 0; i < s.size() -2; i++){
        a = (s[i] - '0')*100 + (s[i+1] - '0')*10 + s[i+2];
        b = abs(a - 753);
        ans = min(b, ans);
    }
    cout << ans << endl;
}


Fixed submission:
s = str(input())
ans = 1000
for i in range(len(s)-2):
    x = int(s[i:i+3])
    ans = min(ans, abs(x-753))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t,a = map(int, input().split())
h = list(map(int,input().split()))
ans = 1000000
for i in n:
    x = t - h[i]*0.006
    ans = min(ans, abs(x-a))
print(ans)  

Fixed submission:
n = int(input())
t,a = map(int, input().split())
h = list(map(int,input().split()))
ans = -1
mn = 10**9
for i in range(n):
    x = abs(t - h[i]*0.006 - a)
    if x < mn:
        mn = x
        ans = i+1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())

if N == 1:
  print("Hello World")
  
elif N == 2:
  print(A + B)

Fixed submission:
N = int(input())

if N == 1:
  print("Hello World")
  
elif N == 2:
  A = int(input())
  B = int(input())
  print(A + B)

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

if N == 1:
  print("Hello World")
  
elif N == 2:
  print(A + B)

Fixed submission:
N = int(input())

if N == 1:
  print("Hello World")
  
elif N == 2:
  A = int(input())
  B = int(input())
  print(A + B)
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()))
x.sort()
y.sort()
if x[n-1] < y[0] and X < y[0] and y < x[n-1]:
    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()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
print('No War' if x[-1] < y[0] else 'War')

Buggy python submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
list1 = [int(input()) for i in range(N)]
list2 = [int(input()) for h in range(M)]

if X >= min(list1) or Y <= max(list2):
  print("War")
  
else:
  print("No War")

Fixed submission:
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
print('No War' if x[-1] < y[0] else 'War')

Buggy python submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
list_xi = [int(input()) for i in range(N)]
list_yi = [int(input()) for h in range(M)]

if X >= min(list_yi) or Y <= max(list_xi):
  print("War")
  
else:
  print("No War")

Fixed submission:
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
print('No War' if x[-1] < y[0] else 'War')

Buggy python submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
list_xi = [int(input()) for i in range(N)]
list_yi = [int(input()) for h in range(M)]

if X >= min(list_yi) or Y <= max(list_xi):
  print("War")
  
else:
  print("No War")

Fixed submission:
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
print('No War' if x[-1] < y[0] else 'War')