Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = [list(map(int,input().split())) for _ in range(n)]

ans = 0
cnt = 0
li.sort()
temp = []

while True:
    arr = []
    check = -10**10
    if len(temp) == 0:
        for i in range(n):
            s = li[i][0] - li[i][1]
            if check > s:
                arr.append(i-1)
                arr.append(i)
            check = li[i][0] + li[i][1]
    else:
        for i in temp:
            s = li[i][0] - li[i][1]
            if check > s:
                arr.append(i-1)
                arr.append(i)
            check = li[i][0] + li[i][1]
    if len(arr) == 0:
        break
    arr = list(set(arr))
    temp = arr
    t = -2
    for index,i in enumerate(arr):
        if t == -2:
            t = i
        elif t+1 == i:
            del temp[index]
            t = -2
            ans += 1
        else:
            t = i

print(n-ans)

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

if s >= 10**9:
    ans = [1]*n
else:
    ans = [10**9] * n

for i in range(k):
    ans[i] = s

print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
leng = len(t)
ans = 0


for i in range(leng):
    if i >= k:
    
        if t[i] == t[i-k]:
            check = 2
            while True:
                if i < k*check:
                    break
                
                if t[i] == t[i-k*check]:
                    check += 1
                    continue
                else:
                    break
            
            if check%2 == 0:
                continue
            else:
                pass
        
    if t[i] == "r":
        ans += p
        
    elif t[i] == "s":
        ans += r

        
    elif t[i] == "p":
        ans += s
        
print(ans)

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

ans = 0

for i in range(n):
    valian = t[i]
    if valian == 'r':
        ans += p
    elif valian == 's':
        ans += r
    else:
        ans += s
        
for i in range(k):
    check = ''
    for j in range(i, n, k):
        if check == '':
            check = t[j]
            continue
        
        if check == t[j]:
            if t[j] == 'r':
                ans -= p
            elif t[j] == 's':
                ans -= r
            else:
                ans -= s
            check = ''
        else:
            check = t[j]
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
leng = len(t)
ans = 0
dic = {"r":0, "s":0, "p":0, "cr":0, "cs":0, "cp":0}


for i in range(leng):
    if i >= k:
    
        if t[i] == t[i-k]:
            check = 2
            while True:
                if i < k*check:
                    break
                
                if t[i] == t[i-k*check]:
                    check += 1
                    continue
                else:
                    break
            
            if check%2 == 0:
                continue
            else:
                pass
        
    if t[i] == "r":
        ans += p
        dic["r"] = 1
        dic["cr"] = i
        
    elif t[i] == "s":
        ans += r
        dic["s"] = 1
        dic["cs"] = i

        
    elif t[i] == "p":
        ans += s
        dic["p"] = 1
        dic["cp"] = i
        
print(ans)

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

ans = 0

for i in range(n):
    valian = t[i]
    if valian == 'r':
        ans += p
    elif valian == 's':
        ans += r
    else:
        ans += s
        
for i in range(k):
    check = ''
    for j in range(i, n, k):
        if check == '':
            check = t[j]
            continue
        
        if check == t[j]:
            if t[j] == 'r':
                ans -= p
            elif t[j] == 's':
                ans -= r
            else:
                ans -= s
            check = ''
        else:
            check = t[j]
        
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

a, b = map(int,input().split())

def lcm(a,b):
    return (a*b) // math.gcd(a, b)
    
print(lcm(a,b))

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

#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)
    
print(lcm(a,b))
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
ans = 0

if x == 1 and y == 1:
    ans += 400000
    
li = [0,300000, 200000, 100000]

if x <= 3:
    ans += li[x]
if y <= 3
    ans += li[y]

print(ans)

Fixed submission:
x,y = map(int,input().split())
ans = 0

if x == 1 and y == 1:
    ans += 400000
    
li = [0,300000, 200000, 100000]

if x <= 3:
    ans += li[x]
if y <= 3:
    ans += li[y]

print(ans)

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
ans = 0

if x == 1 and y == 1:
    ans += 400000
    
li = [0,300000, 200000, 100000]

ans += li[x]
ans += li[y]

print(ans)

Fixed submission:
x,y = map(int,input().split())
ans = 0

if x == 1 and y == 1:
    ans += 400000
    
li = [0,300000, 200000, 100000]

if x <= 3:
    ans += li[x]
if y <= 3:
    ans += li[y]

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

ans = 10**10
s = sum(a_li)

for i in range(1,n):
    
    tmp = abs(s - 2*sum(a_li[i:]))
    ans = min(ans,tmp)
    
print(ans)

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

ans = 10**10
s = sum(a_li)
tmp = 0

for i in range(n):
    tmp += a_li[i]
    res = abs(s - 2*tmp)
    ans = min(ans,res)
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_li = list(map(int,input().split()))

ans = 10**10

for i in range(1,n):
    s = abs(sum(a_li[:i]) - sum(a_li[i:]))
    ans = min(ans,s)
    
print(ans)

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

ans = 10**10
s = sum(a_li)
tmp = 0

for i in range(n):
    tmp += a_li[i]
    res = abs(s - 2*tmp)
    ans = min(ans,res)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
def combination(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
    
x,y = map(int,input().split())


if (x+y)%3 != 0 or not(X <= 2*Y and Y <= 2*X):
    print(0)
    exit()
else:
    s = (x+y)//3
 
t = min((x-s),(y-s))

print(combination(s,t))

Fixed submission:
def combination(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
    
x,y = map(int,input().split())


if (x+y)%3 != 0 or not(x <= 2*y and y <= 2*x):
    print(0)
    exit()
else:
    s = (x+y)//3
 
t = min((x-s),(y-s))

print(combination(s,t))

Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

x,y = map(int,input().split())
mod = 10**9 + 7

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)

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

t = min((x-s),(y-s))


print(cmb(s,t)%mod)

Fixed submission:
def combination(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
    
x,y = map(int,input().split())


if (x+y)%3 != 0 or not(x <= 2*y and y <= 2*x):
    print(0)
    exit()
else:
    s = (x+y)//3
 
t = min((x-s),(y-s))

print(combination(s,t))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
bar = list(map(int,input().split()))

bar.sort(reverse=True)
ans = 0

while len(bar) > 1:
    a = bar.pop()
    cnt = 0
    for i in range(len(bar)-1,-1,-1):
        b = bar[i]
        cnt += 1
        for j in range(len(bar)-1-cnt,-1,-1):
            c = bar[j]
            if c < (a+b):
                ans += 1
            else:
                break
print(ans)

Fixed submission:
import bisect

n=int(input())
L=list(map(int,input().split()))
L.sort()
count=0

for i in range(n):
    for j in range(i+1,n):
        T=bisect.bisect_left(L,L[i]+L[j])
        count += T-j-1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())
bar = list(map(int,input().split()))

bar.sort()
bar = deque(bar)
ans = 0

while len(bar) > 1:
    a = bar.popleft()
    for i in range(len(bar)-1):
        b = bar[i]
        for j in range(i+1, len(bar)):
            c = bar[j]
            if c < (a+b):
                ans += 1
            else:
                break
print(ans)

Fixed submission:
import bisect

n=int(input())
L=list(map(int,input().split()))
L.sort()
count=0

for i in range(n):
    for j in range(i+1,n):
        T=bisect.bisect_left(L,L[i]+L[j])
        count += T-j-1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())
bar = list(map(int,input().split()))

bar.sort()
bar = deque(bar)
ans = 0

while len(bar) > 1:
    a = bar.popleft()
    for i in range(len(bar)-1):
        b = bar[i]
        for j in range(i+1, len(bar)):
            c = bar[j]
            if c < (a+b):
                ans += 1
            else:
                break

print(ans)

Fixed submission:
import bisect

n=int(input())
L=list(map(int,input().split()))
L.sort()
count=0

for i in range(n):
    for j in range(i+1,n):
        T=bisect.bisect_left(L,L[i]+L[j])
        count += T-j-1

print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
 
if n%2 == 0:
    print(0.5)    #整数Nが偶数のとき
else:
    s = (n-1)/2    #偶数の数を確認
    s /= n　　　#nで割って偶数の確率を求める
    print(1-s)    #全体から偶数の確率を引いて奇数の確率を求める

Fixed submission:
n = int(input())

if n%2 == 0:
    print(0.5)
else:
    print(1-(n-1)/2/n)

Buggy python submission (verdict: Runtime Error):
n = int(input())
 
if n%2 == 0:
    print(0.5)   
else:
    s = (n-1)/2   
    s /= n　　　
print(1-s)   

Fixed submission:
n = int(input())

if n%2 == 0:
    print(0.5)
else:
    print(1-(n-1)/2/n)

Buggy python submission (verdict: Runtime Error):
n = int(input())
 
if n%2 == 0:
    print(0.5)   
else:
    s = (n-1)/2   
    s /= n　　　
    print(1-s)    

Fixed submission:
n = int(input())

if n%2 == 0:
    print(0.5)
else:
    print(1-(n-1)/2/n)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
max_gcd = gcd(a,b)

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return table
    
table = sieve(max_gcd)

def cf(x,y):
    number = [1]
    for i in table:
        if x%i == 0 and y%i == 0:
            number.append(i)
        if i > max_gcd:
            break
    return number

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

s = cf(a,b)
cnt = 1
for i in s:
    t = is_prime(i)
    if t == True:
        cnt += 1

print(cnt)

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

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
  
s = set(prime_decomposition(a))
t = set(prime_decomposition(b))

print(len(s&t) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
item = list(map(int,input().split()))
 
item.sort(reverse=True)
s = 0
 
while s == 0:
    for i in range(n):
        if i == 0:
            item[i] = int(item[i]/2)
            m -= 1
            temp = item[i]
            if m == 0:
                s = 1
                break
            continue

        item.sort(reverse=True)
        break
        
 
print(sum(item))

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

item.sort(reverse=True)
s = 0

while s == 0:
    for i in range(n):
        if i == 0:
            item[i] = int(item[i]/2)
            m -= 1
            temp = item[i]
            if m == 0:
                s = 1
                break
            continue
        if item[i] > temp:
            item[i] = int(item[i]/2)
            m -= 1
            if m == 0:
                s = 1
                break
            continue
        item.sort(reverse=True)
        break
        

print(sum(item))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

ans = 0

for i in range(1,n):
    ans += i
    
print(ans)

Fixed submission:
n = int(input())

print((n-1)*n // 2)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from math import factorial

n = int(input())
s = []

for i in range(n):
    t = list(input())
    t.sort()
    s += [t]

for i in range(n):
    s[i] = ",".join(s[i])
    s[i] = s[i].replace(",","")
    
d = defaultdict(int)

for key in s:
    d[key] += 1
    
cnt = 0

for key, val in d.items():
    if val >= 2:
        cnt += factorial(val) / factorial(2) / factorial(val - 2)

print(int(cnt))

Fixed submission:
from collections import defaultdict
from math import factorial

n = int(input())
s = []

for i in range(n):
    t = list(input())
    t.sort()
    s += [t]

for i in range(n):
    s[i] = ",".join(s[i])
    s[i] = s[i].replace(",","")
    
ans = 0

d = defaultdict(int)

for key in s:
    if key in d:
        ans += d[key]
    d[key] += 1
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())

ans = [1] * len(s)

cnt = 0

while cnt < 100000:
    temp = ans.copy()
    for i in range(len(s)):
        if s[i] == "R" and temp[i] > 0:
            ans[i] -= temp[i]
            ans[i+1] += temp[i]
        elif s[i] == "L" and temp[i] > 0:
            ans[i] -= temp[i]
            ans[i-1] += temp[i]
    cnt += 1
    if temp == ans:
        print(*ans)
        exit()

print(*ans)



Fixed submission:
s = list(input())

ans = [0] * len(s)

cnt = 0
r_temp = 0
l_temp = 0
temp = "R"

for i in range(len(s)):
    if temp != s[i] and temp == "R":
        r_temp = cnt
        cnt = 0
        temp = "L"
    if temp != s[i] and temp == "L":
        l_temp = cnt
        cnt = 0
        temp = "R"
        
        if (r_temp-l_temp)%2 == 0:
            ans[i-l_temp] = (r_temp+l_temp)//2
            ans[i-l_temp-1] = (r_temp+l_temp)//2
        elif r_temp > l_temp:
            if r_temp%2 == 0:
                ans[i-l_temp] = ((r_temp+l_temp-1)//2)+1
                ans[i-l_temp-1] = (r_temp+l_temp-1)//2
            else:
                ans[i-l_temp] = (r_temp+l_temp-1)//2
                ans[i-l_temp-1] = ((r_temp+l_temp-1)//2)+1
        elif r_temp < l_temp:
            if l_temp%2 == 0:
                ans[i-l_temp] = (r_temp+l_temp-1)//2
                ans[i-l_temp-1] = ((r_temp+l_temp-1)//2)+1
            else:
                ans[i-l_temp] = ((r_temp+l_temp-1)//2)+1
                ans[i-l_temp-1] = (r_temp+l_temp-1)//2
            
    if i == len(s)-1:
        l_temp = cnt + 1
        #print(r_temp)
        #print(cnt)
        if (r_temp-l_temp)%2 == 0:
            ans[i-l_temp+1] = (r_temp+l_temp)//2
            ans[i-l_temp] = (r_temp+l_temp)//2
        elif r_temp > l_temp:
            if r_temp%2 == 0:
                ans[i-l_temp+1] = ((r_temp+l_temp-1)//2)+1
                ans[i-l_temp] = (r_temp+l_temp-1)//2
            else:
                ans[i-l_temp+1] = (r_temp+l_temp-1)//2
                ans[i-l_temp] = ((r_temp+l_temp-1)//2)+1
        elif r_temp < l_temp:
            if l_temp%2 == 0:
                ans[i-l_temp+1] = (r_temp+l_temp-1)//2
                ans[i-l_temp] = ((r_temp+l_temp-1)//2)+1
            else:
                ans[i-l_temp+1] = ((r_temp+l_temp-1)//2)+1
                ans[i-l_temp] = (r_temp+l_temp-1)//2
        
    cnt += 1
        
        

print(*ans)
Buggy python submission (verdict: Runtime Error):
s = int(input())

x1 = 0
y1 = 0

def divisor(n):
    i = s//10 ** 9 + 1
    while i*i <= n:
        if n%i == 0:
            if n//i < 10 ** 9:
                a = i
                b = n//i
                break
        i += 1
    return a,b

if s == int(s ** 0.5) ** 2:
    a = int(s**0.5)
    b = int(s**0.5)

else:
    a,b = divisor(s)

x2 = a
y2 = 0
x3 = 0
y3 = b

print(x1,y1,x2,y2,x3,y3)

Fixed submission:
S = int(input())

M = 10**9
t = (-S) % M  #M - S%M
x = (S + t) // M

answer = [0,0,1,M,x,t]

print(*answer)

Buggy python submission (verdict: Time Limit Exceeded):
s = int(input())

x1 = 0
y1 = 0

def divisor(n):
    i = 1
    while i*i <= n:
        if n%i == 0:
            if n//i < 10 ** 9:
                a = i
                b = n//i
                break
        i += 1
    return a,b

if s == int(s ** 0.5) ** 2:
    a = int(s**0.5)
    b = int(s**0.5)

else:
    a,b = divisor(s)

x2 = a
y2 = 0
x3 = 0
y3 = b

print(x1,y1,x2,y2,x3,y3)

Fixed submission:
S = int(input())

M = 10**9
t = (-S) % M  #M - S%M
x = (S + t) // M

answer = [0,0,1,M,x,t]

print(*answer)

Buggy python submission (verdict: Time Limit Exceeded):
s = int(input())

x1 = 0
y1 = 0

def divisor(n):
    i = 1
    table = []
    while i*i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
            if n//i < 10 ** 9:
                break
        i += 1
    table = list(set(table))
    return table

if s == int(s ** 0.5) ** 2:
    a = int(s**0.5)
    b = int(s**0.5)

else:
    table = divisor(s)
    t = len(table)//2
    a = table[t-1]
    b = table[t]
    
x2 = a
y2 = 0
x3 = 0
y3 = b

print(x1,y1,x2,y2,x3,y3)

Fixed submission:
S = int(input())

M = 10**9
t = (-S) % M  #M - S%M
x = (S + t) // M

answer = [0,0,1,M,x,t]

print(*answer)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

dam = list(map(int,input().split()))

yama = [10**8 for _ in range(n)]

ans = [10**8 for _ in range(n)]

for i in range(n):
    if i == 0:
        yama[i] = min(dam[i], dam[-1]) * 2
    else:
        yama[i] = min(dam[i-1], dam[i]) * 2


for i in range(0,yama[0]+1,2):
    for j in range(n):
        if j == 0:
            ans[j] = i
        else:
            ans[j] = (dam[j-1] - ans[j-1]//2) * 2
            if ans[j] > yama[j]:
                break
    else:
        if (ans[0] + ans[-1])//2 == dam[-1]:
            print(*ans)
            exit()

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

x = 0

for i in range(n):
    if i%2 == 0:
        x += li[-i-1]
    else:
        x -= li[-i-1]

ans = [x]

tmp = x

for i in range(n-1):
    s = 2*li[i] - tmp
    ans.append(s)
    tmp = s
    
print(*ans)
Buggy python submission (verdict: Runtime Error):
import math

def combination_count(n,k):
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u)
    
n,k = map(int,input().split())
mod = 10**9 + 7

for i in range(1,k+1):
    x = combination_count(n-k+1, i) 
    y = combination_count(k-1, i-1)
    z = (x*y) % mod
    print(z)

Fixed submission:
import math

def combination_count(n,k):
    if k < 0 or k > n:
        return 0
    if n == 0 or k == 0:
        return 1
    
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u) 
    
n,k = map(int,input().split())
mod = 10**9 + 7

for i in range(1,k+1):
    x = combination_count(n-k+1, i) 
    y = combination_count(k-1, i-1)
    z = (x*y) % mod
    print(z)

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

def combination_count(n,k):
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u)
    
n,k = map(int,input().split())

for i in range(1,k+1):
    print(combination_count(n-k+1, i) * combination_count(k-1, i-1) % (10**9 +7))

Fixed submission:
import math

def combination_count(n,k):
    if k < 0 or k > n:
        return 0
    if n == 0 or k == 0:
        return 1
    
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u) 
    
n,k = map(int,input().split())
mod = 10**9 + 7

for i in range(1,k+1):
    x = combination_count(n-k+1, i) 
    y = combination_count(k-1, i-1)
    z = (x*y) % mod
    print(z)
Buggy python submission (verdict: Runtime Error):
import math

a,b,c,d = map(int,input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

v = lcm(c, d)

s = b//c - (a-1)//c
t = b//d - (a-1)//d
u = b//v - (a-1)//v

print((b-a+1) - (s+t-u))


Fixed submission:


a,b,c,d = map(int,input().split())

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


v = c*d//gcd(c,d)

s = b//c - (a-1)//c
t = b//d - (a-1)//d
u = b//v - (a-1)//v

print((b-a+1) - (s+t-u))
Buggy python submission (verdict: Runtime Error):
w,h,x,y = map(int,input().split())

a = min(x,w-x)
s = h*a

b = min(y, h-y)
t = w*b

result = 0

if x == w/2 and y == h/2:
    result = 1

u = 0
if w == x and h == y:
    u = w*h/2
if x == 0 and y == h:
    u = w*h/2
if x == 0 and y == 0:
    u = w*h/2
if x == w and y == 0:
    u = w*h/2
 
v = 0
if x == 0 or x == w:
    temp = max(h-y,y)
    v = h*w/2

c = 0
if y/x == h/w:
    c = h*w/2

z = 0
try:
    if y == -h/w*x + h:
        z = h*w/2
except:
    pass

print(max(s,t,u,v,c,z),result)


Fixed submission:
w,h,x,y = map(int,input().split())

a = min(x,w-x)
s = h*a

b = min(y, h-y)
t = w*b

result = 0

if x == w/2 and y == h/2:
    result = 1

print(h*w/2,result)

Buggy python submission (verdict: Runtime Error):
w,h,x,y = map(int,input().split())

a = min(x,w-x)
s = h*a

b = min(y, h-y)
t = w*b

result = 0

if x == w/2 and y == h/2:
    result = 1

u = 0
if x == 0 or x == w or y == 0 or y == h:
    u = h*w/2

v = 0
if y/x == h/w or y == -h/w + h:
    v = h*w/2

print(max(s,t,u,v),result)


Fixed submission:
w,h,x,y = map(int,input().split())

a = min(x,w-x)
s = h*a

b = min(y, h-y)
t = w*b

result = 0

if x == w/2 and y == h/2:
    result = 1

print(h*w/2,result)
Buggy python submission (verdict: Runtime Error):
s = input()

x = int(s[0:2])
y = int(s[3:])

if x > 12:
    if y > 12:
        print("NA")
    elif y >= 1:
        print("YYMM")
    else:
        print("NA")
elif x >= 1
    if y > 12:
        print("MMYY")
    elif y >= 1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if y > 12:
        print("NA")
    if y >= 1:
        print("YYMM")
    else:
        print("NA")
        

Fixed submission:
s = input()

x = int(s[0:2])
y = int(s[2:])

if x > 12:
    if y > 12:
        print("NA")
    elif y >= 1:
        print("YYMM")
    else:
        print("NA")
elif x >= 1:
    if y > 12:
        print("MMYY")
    elif y >= 1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if y > 12:
        print("NA")
    if y >= 1:
        print("YYMM")
    else:
        print("NA")
Buggy python submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())

cnt = 0

for i in range(N//R + 1):
    for j in range(N//G + 1):
        sum = N - i * R - j * G
        if sum >= 0 and sum % B == 0:
            cnt += 1

print(cnt)

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

print(n - k + 1)