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

Fixed submission:
n = int(input())
h = list(map(int, input().split()))[::-1]
if n ==1:
    print('Yes')
else:
    for i in range(1,n):
        if h[i] > (h[i - 1] + 1):
            print('No')
            break
        elif h[i] == (h[i - 1] + 1):
            h[i] = h[i - 1]
    else:
        print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))[::-1]
if n ==1:
    print('Yes')
else:
    for i in range(1,n):
        if h[i] > (h[i - 1] + 1):
            print('No')
            break
        elif h[i] == (h[i - 1] + 1):
            h[i] = h[i - 1]
        print(h)
    else:
        print('Yes')
Problem p02960 (python)

Fixed submission:
mod = 10 ** 9 + 7
s = input()
n = len(s)
dp = [[0 for _ in range(13)] for _ in range(n + 1)]
dp[0][0]=1
for i in range(n):
    if s[i] == '?': 
        for j in range(10):
            for k in range(13):
                dp[i + 1][(k * 10 + j) % 13]+=dp[i][k] % mod
    else:
        for k in range(13): 
            dp[i + 1][(k * 10+ int(s[i])) % 13]+=dp[i][k] % mod
print(dp[-1][5] % mod)

Buggy submission (verdict: Runtime Error):
mod = 10 ** 9 + 7
s = input()
dp =[[0 for _ in range(13)] for _ in range(l+1)]
dp[0][0] =1
for i in range(l):
    obj =s[l - i - 1]
    if obj == "?":
        for j in range(10):
            for k in range(13):
                dp[i + 1][(j * (10 ** i) + k) % 13] +=dp[i][k] % mod
    else:
        for k in range(13):
            dp[i + 1][(int(obj) * (10 ** i) + k) % 13] +=dp[i][k] % mod
print(dp[-1][5] % mod)

Buggy submission (verdict: Runtime Error):
s = input()[::-1]
l = len(s)
dp =[[0 for _ in range(13)] for _ in range(l+1)]
dp[0][0] =1
for i in range(l):
    if s[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i + 1][((j * (10 ** i)) % 13 + k) % 13] +=dp[i][k] % mod
    else:
        for k in range(13):
            dp[i + 1][((int(s[i]) * (10 ** i)) % 13 + k) % 13] +=dp[i][k] % mod
print(dp[-1][5] % mod)
Problem p03031 (python)

Fixed submission:
n, m = map(int, input().split())
switch = [0] * m
for i in range(m):
    s = list(map(int, input().split()))
    for j in s[1:]:
        switch[i] |= 1 << (j - 1)
p = list(map(int, input().split()))
ans = 0
for bit in range(1 << n):
    for i in range(m):
        if bin(bit & switch[i]).count('1') % 2 != p[i]:
            break
    else:
        ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
switch = [0] * n
for i in range(m):
    s = list(map(int, input().split()))
    for j in s[1:]:
        switch[i] |= 1 << (j - 1)
p = list(map(int, input().split()))
ans = 0
for bit in range(1 << n):
    for i in range(m):
        if bin(bit & switch[i]).count('1') % 2 != p[i]:
            break
    else:
        ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
switch = [0] * n
for m_ in range(m):
    s = list(map(int, input().split()))
    for s_ in s[1:]:
        switch[m_] |= 1 << s_ - 1
p = list(map(int, input().split()))
ans = 0
for bit in range(1 << n):
    for i in range(m):
        if bin(bit & switch[i]).count('1') % 2 != p[i]:
            break
    else:
        ans +=1
print(ans)
Problem p03078 (python)

Fixed submission:
from heapq import heappop,heappush
from collections import defaultdict
x, y, z, K = map(int,input().split())
a = sorted(list(map(int, input().split())),reverse=True)
b = sorted(list(map(int, input().split())),reverse=True)
c = sorted(list(map(int, input().split())),reverse=True)
q =[]
ans = []
sc = defaultdict(bool)
heappush(q,(-a[0] - b[0] - c[0], 0, 0, 0))

while len(ans) < K:
    deli, i, j, k = heappop(q)
    print(-deli)
    ans.append(-deli)
    
    if i + 1 < x and not sc[(i + 1, j, k)]:
        heappush(q,(-a[i + 1] - b[j] - c[k], i + 1, j, k))
        sc[(i + 1, j, k)] = True
    
    if j + 1 < y and not sc[(i, j + 1, k)]:
        heappush(q,(-a[i] - b[j + 1] - c[k], i, j + 1, k))
        sc[(i, j + 1, k)] = True
    
    if k + 1 < z and not sc[(i, j, k + 1)]:
        heappush(q,(-a[i] - b[j] - c[k + 1], i, j, k + 1))
        sc[(i, j, k + 1)] = True

Buggy submission (verdict: Runtime Error):
from heapq import heappop,heappush
from collections import defaultdict
x, y, z, K = map(int,input().split())
a = sorted(list(map(int, input().split())),reverse=True)
b = sorted(list(map(int, input().split())),reverse=True)
c = sorted(list(map(int, input().split())),reverse=True)
q =[]
ans = []
sc = defaultdict(bool)
heapq.heappush(q,(-a[0] - b[0] - c[0], 0, 0, 0))

while len(ans) < K:
    deli, i, j, k = heappop(q)
    print(-deli)
    ans.append(-deli)
    
    if i + 1 < x and not sc[(i + 1, j, k)]:
        heapq.heappush(q,(-a[i + 1] - b[j] - c[k], i + 1, j, k))
        sc[(i + 1, j, k)] = True
    
    if j + 1 < y and not sc[(i, j + 1, k)]:
        heapq.heappush(q,(-a[i] - b[j + 1] - c[k], i, j + 1, k))
        sc[(i, j + 1, k)] = True
    
    if k + 1 < z and not sc[(i, j, k + 1)]:
        heapq.heappush(q,(-a[i] - b[j] - c[k + 1], i, j, k + 1))
        sc[(i, j, k + 1)] = True
Problem p03101 (python)

Fixed submission:
H, W =[int(i) for i in input().split()]
h, w =[int(i) for i in input().split()]
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
H, W =int(input().split())
h, w =int(input().split())
print((H-h)*(W-w))
Problem p03162 (python)

Fixed submission:
n = int(input())
a = [0] * (n + 1)
b = [0] * (n + 1)
c = [0] * (n + 1)
for i in range(1, n + 1):
    a[i], b[i], c[i] = map(int, input().split())
    a[i] = a[i] + max(b[i - 1], c[i - 1])
    b[i] = b[i] + max(c[i - 1], a[i - 1])
    c[i] = c[i] + max(a[i - 1], b[i - 1])
print(max(a[n], b[n], c[n]))

Buggy submission (verdict: Runtime Error):
n =　int(input())
a = [0] * ( n + 1)
b = [0] * ( n + 1)
c = [0] * ( n + 1)
for i in range(1, n + 1):
    a[i], b[i], c[i] = map(int, input().split())
    a[i] = a[i] + max(b[i - 1], c[i - 1])
    b[i] = b[i] + max(c[i - 1], a[i - 1])
    c[i] = c[i] + max(a[i - 1], b[i - 1])
print(max(a[n], b[n], c[n]))
Problem p03163 (python)

Fixed submission:
n,W = map(int,input().split())
w,v = [0] * n ,[0] * n
for i in range(n):
    w[i] ,v[i] = map(int,input().split())

import numpy as np
ndp = np.zeros(W+1,dtype= np.int64)
for w,v in zip(w,v):
    np.maximum(ndp[:-w] + v, ndp[w:], out = ndp[w:])
print(ndp[-1])

Buggy submission (verdict: Runtime Error):
from numpy as np
N,W = map(int,input().split())
ndp = np.zeros(W+1,dtype= np.int64)
for _ in range(N):
    w,v = map(int,input().split())
    np.maximum(ndp[:-w] + v, ndp[w:], out = ndp[w:])
print(ndp[-1])
Problem p03166 (python)

Fixed submission:
n , m = map(int, input().split())
edge=[[] for _ in range(n)]
deg=[0] * n
for i in range(m):
    x, y =map(int, input().split())
    edge[x - 1 ].append(y - 1)
    deg[y - 1] +=1 

from collections import deque

que =deque()
for i in range(n):
    if deg[i] == 0:
        que.append(i)
dp = [0] *n

while que:
    v = que.popleft()
    nv = edge[v]
    for nv in nv:
        deg[nv] -=1
        if deg[nv] ==0:
            que.append(nv)
            dp[nv] = max(dp[v] + 1 ,dp[nv])
print(max(dp))

Buggy submission (verdict: Runtime Error):
n , m = map(int, input().split())
edge=[[] for _ in range(n)]
deg=[0] * n
for i in range(m):
    x, y =map(int, input().split())
    edge[x - 1 ].append(y - 1)
    deg[y - 1] +=1 

from collections import deque

que =deque()
for i in range(n):
    if deg[i] == 0:
        que.append(i)
dp = [0] *n

while que:
    v = que.popleft()
    nv = edge[v]
    for nv in nv:
        deg[nv] -=1
        if deg[nv] ==0:
            que.append(nv)
            dp[nv] = max(dp[v] + 1 ,dp[nv])
print(max(dp)
Problem p03607 (python)

Fixed submission:
from collections import Counter
a =[]
n = int(input())
for _ in range(n):
    a.append(int(input()))
b = Counter(a).values()
print(sum([i % 2 for i in b]))

Buggy submission (verdict: Runtime Error):
a =set()
n = int(input())
for _ in range(n):
    tmp = int(input()) 
    if tmp in a:
        a.remove(tmp)
    else:
        a.append(tmp)
print(len(a))
Problem p03739 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [a_ for a_ in a]
 
ans = 10**14
for a0 in [-1,a[0],1]:
    if a0 == 0:
        continue
    ans_ = abs(a[0]-a0)
    b[0] = a0
    sign = b[0] > 0
    for i in range(1,n):
        b[i] = a[i]+b[i-1]
        if sign:
            if b[i] >= 0:
                ans_ += b[i]+1
                b[i] = -1
        else:
            if b[i] <= 0:
                ans_ += 1-b[i]
                b[i] = 1
        sign = not sign
    ans = min(ans, ans_)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
cnt = 0
w = A[0]
for i in range(n - 1):
    nw = w + A[i + 1]
    if w > 0:
        if nw >= 0:
            cnt += nw + 1
            chg = -(nw  + 1)
    else:
        if nw <= 0:
            cnt += 1 - nw
            chg = 1 - nw
    w = nw + chg
    chg = 0
    
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
cnt = 0
w = A[0]
for i in range(n - 1):
    nw = w + A[i + 1]
    if w > 0:
        if nw >= 0:
            cnt += nw + 1
            chg = -(nw  + 1)
    elif w < 0:
        if nw <= 0:
            cnt += 1 - nw
            chg = 1 - nw
    w = nw + chg
    chg = 0
    
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))

def ssa(n):
    arr = A
    memo =['inf'] * (n + 1)
    def _ssa(n):
        if n == 0:
            return arr[0]
        if memo[n] != 'inf':
            return memo[n]
        memo[n] = _ssa(n -1) + arr[n]
        return memo[n]
    return _ssa(n)

cnt = 0
chg = 0
for i in range(n - 1):
    if ssa(i) + chg > 0:
        if ssa(i + 1) + chg >= 0:
            cnt += ssa(i + 1) + chg + 1
            chg += -(ssa(i + 1)+ chg  + 1)
    elif ssa(i) + chg < 0:
        if ssa(i + 1) + chg <= 0:
            cnt += 1 - ssa(i + 1) - chg
            chg += 1 - ssa(i + 1) - chg

if ssa(n - 1) + chg == 0:
    cnt +=1

print(cnt)
Problem p03944 (python)

Fixed submission:
import numpy as np
w,h,n = map(int,input().split())
cl = np.zeros((w, h) , dtype = int)
for i in range(n):
    x, y, a, = map(int,input().split())
    if a ==1: 
        cl[:x, :] = 1
    if a ==2: 
        cl[x:, :] = 1
    if a ==3:
        cl[:, :y] = 1
    if a ==4:
        cl[:, y:] = 1
print(w * h - np.sum(cl))

Buggy submission (verdict: Runtime Error):
w,h,n = map(int,input().split())
cl = np.zeros((w, h) , dtype = int)
for i in range(n):
    x, y, a, = map(int,input().split())
    if a ==1: 
        cl[:x, :] = 1
    if a ==2: 
        cl[x:, :] = 1
    if a ==3:
        cl[:, :y] = 1
    if a ==4:
        cl[:, y:] = 1
print(w * h - np.sum(cl))
Problem p04002 (python)

Fixed submission:
h, w, n = map(int,input().split())
from collections import defaultdict
m3x3 =defaultdict(list)
for _ in range(n):
    a, b = map(int,input().split())
    for i in range(max(0, a - 3),min(h - 2, a)):
        for j in range(max(0, b - 3),min(w - 2, b)):
            if (i,j) in  m3x3:
                m3x3[(i,j)] +=1
            else:
                m3x3[(i,j)] =1
v = list(m3x3.values())
k = m3x3.keys()
print((w-2)*(h-2)-len(k))
for j in range(1,10):
    print(v.count(j))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import sys
h, w, n = int(sys.stdin.readline().split())

m3x3 =defaultdict(list)
for _ in range(n):
    a, b = int(sys.stdin.readline().split())
    for i in range(max(0, a - 3),min(h - 2, a)):
        for j in range(max(0, b - 3),min(w - 2, b)):
            if (i,j) in  m3x3:
                m3x3[(i,j)] +=1
            else:
                m3x3[(i,j)] =1
v = list(m3x3.values())
k = m3x3.keys()
print((w-2)*(h-2)-len(k))
for j in range(1,10):
    print(v.count(j))
Problem p03109 (python)

Fixed submission:
S = input()
if int(S[5:7]) <= 4:
	print('Heisei')
else:
	print('TBD')

Buggy submission (verdict: Runtime Error):
S = input()
if int(S[6]) <= '4':
	print('Heisei')
else:
	print('TBD')
Problem p03126 (python)

Fixed submission:
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N == 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].remove(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == {}:
			
			break
			exit()
		i += 1
	print(len(list(foods)))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N = 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].pop(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == set():
			break
		
		else:
			i += 1
	print(len(list(foods)))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N = 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].pop(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == set():
			break
		
		else:
			i += 1
	print(len(list(foods)))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N = 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].pop(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == set():
			break
		
		else:
			i += 1
	print(len(list(foods)))
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(max(a+b, a-b a*b))
Problem p02971 (python)

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
amax = max(a)
amax2 = sorted(a)[-2]
for i in range(len(a)):
  if a[i]==amax:
    print(amax2)
  else:
    print(amax)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N)]
a.sort(reverse=True)
amax = a[0]
for i in range(len(a)):
  if a[i]==amax:
    print(a[i+1])
  else:
    print(amax)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = set8int(input()) for i in range(N))
for i in range(len(list(a))):
  b = a.copy()
  del b[i]
  print((max(b)))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N)]
for i in range(len(a)):
  b = a.copy()
  del b[i]
  print((max(b)))
Problem p02981 (python)

Fixed submission:
n,a,b=map(int, input().split())
print(min(n*a, b))

Buggy submission (verdict: Runtime Error):
import numpy as np
n,a,b=map(int, input().split())
print([n*a, n*b].min())

Buggy submission (verdict: Runtime Error):
n,a,b = list(map(int, input().split()))
d = n*a
t = n*b
print(int(np.min([d, t])))

Buggy submission (verdict: Runtime Error):
n,a,b = list(map(int, input().split()))
d = n*a
t = n*b
print(np.min([d, t]))

Buggy submission (verdict: Runtime Error):
n,a,b = list(map(int, input().split()))
taxi = n*a
densya = n*b
print(np.min([taxi, densya]))
Problem p02993 (python)

Fixed submission:
S = list(map(int, input().rstrip()))
for i in range(3):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")

Buggy submission (verdict: Runtime Error):
S = list(map(int, input().rstrip()))
for i in range(4):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")

Buggy submission (verdict: Runtime Error):
S = list(map(int, input().rstrip()))
for i in range(4):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
S = list(input().split())
for i in range(4):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")
Problem p03030 (python)

Fixed submission:
N = int(input())
mydict = []
for i in range(1, N+1):
  a, b=input().split()
  mydict.append([str(a), int(b), i])
mydict = sorted(mydict, key=lambda x:x[1], reverse=True)
mydict = sorted(mydict, key=lambda x:x[0])
for i in mydict:
  print(i[2])

Buggy submission (verdict: Runtime Error):
N = int(input())
mydict = []
for i in range(1, N+1):
  a, b=input().split()
  mydict.append([str(a), int(b), i])
mydict = sorted(mydict, key=lambda x:(x[0][1]))
for i in mydict:
  print(i[2])

Buggy submission (verdict: Runtime Error):
N = int(input())
mydict = []
for i in range(N):
  a, b=input().split()
  mydict.append([str(a), int(b)])
mydict.sort()
fot i in range(N):
  print(mydict[i][1])

Buggy submission (verdict: Runtime Error):
N = int(input())
mydict = []
for i in range(N):
  a, b=input().split()
  mydict.append([str(a), int(b)])
mydict.sort()
print(mydict[0], mydict[1])
Problem p02886 (python)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
more = N - 1
total = 0
for i in range(N):
  for j in range(more):
    try:
      total +=  int(d[i]) * int(d[i + j + 1])
    except IndexError:
      break
  more -= 1
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = map(int, input().split())
more = N - 1
total = 0
for i in range(N):
  for j in range(more):
    try:
      total +=  int(d[i]) * int(d[i + j + 1])
    except IndexError:
      break
  more -= 1
print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = map(int, input().split())
more = N - 1
total = 0
for i in range(N):
  for j in range(more):
    try:
      total +=  int(d[i]) * int(d[i + j + 1])
    except IndexError:
      break
  more -= 1
print(total)
Problem p02898 (python)

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split)
A = N
h = list(map(int, input().split()))
for hantei in h:
    if K > hantei:
        A -= 1
    else:
        pass
print(A)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split)
h = [int(i) for i in input().split()] 
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split)
h = list(map(int, input().split()))
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split)
h = list(map(int, input().split()))
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split)
h = map(int, input().split())
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split)
h = list(map(int, input().split()))
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(str.N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split)
h = map(int, input().split())
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(str.N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split)
h = []
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(str.N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split)
h = []
for hantei in h:
    if K > hantei:
        N -= 1
    else:
        pass
print(str.N)
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 1
for i in L:
  D += i
  if X < D:
    break
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 1
for i in L
  D += i
  if X < D:
    break
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 1
for i in L
  D = D + i
  if X < D:
    break
  count += 1
print(count)
Problem p02924 (python)

Fixed submission:
N = int(input())

if N == 0:
    print(1)
else:
    print(int(N * (N - 1) // 2))

Buggy submission (verdict: Runtime Error):
N = int(input())
 
P = list(range(2, N+1)) + [1]
I = range(1, N+1)
 
total = 0
for i in range(1, N+1):
    p = (i + 1) if i < N else 1
    total += i % p
print(total)

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

print(sum(range(N))

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

print(sum(range(N))

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

P = list(range(2, N+1)) + [1]
I = range(1, N+1)

print(sum((i % p) for p, i in zip(P, I)))
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())

S = W * H / 2
multi = 2 * x == W and 2 * y == H

print(S, int(multi))

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if x in [0, W] and y in [0, H]:
    S = 0
    print(0, 1)
    exit()

if (x == W / 2 and y == H / 2):
    S = W * H / 2
    print(S, 1)
    exit()

if x in [0, W]:
    S = W * min(y, H - y)
    print(S, 0)
    exit()

if y in [0, H]:
    S = min(x, W - x) * H
    print(S, 0)
    exit()

X1 = x
X2 = (W - x)
Y1 = y
Y2 = (H - y)

X = min(X1, X2)
Y = min(Y1, Y2)

if X * H == W * Y:
    multi = 1

S = max(X * H, W * Y)

print(S, multi)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

# print(W, H, x, y)

multi = 0

# print(x / W, y / H)

if x / W == y / H:
    multi = 1
elif x / W <= y / H:
    S = x * H
elif x / W >= y / H:
    S = W * y

print(S, multi)