Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())

def decompose(s):
    l = []
    N = len(s)
    i = 0
    while i < N:
        j = i
        while j <= N:
            l.append(s[i:j])
            j += 1
        i += 1
    l = list(set(l))
    l.sort()
    return l
print(decompose(s)[k])

Fixed submission:
s=input()
k=int(input())

def decompose(s):
    l = []
    N = len(s)
    i = 1
    while i <= N:
        l.append(s[:i])
        i += 1
    l = list(set(l))
    l.sort()
    return l

def answer(slist,smin,k):
    indices = [i for i, x in enumerate(slist) if x == smin]
    ans = []
    for ind in indices:
        ans.extend(decompose(s[ind:min(ind+k,len(s))]))
    ans = list(set(ans))
    ans.sort()
    if len(ans) >= k:
        return ans[k-1]
    else:
        s_temp = slist.copy()
        k -= len(ans)
        for r in range(len(indices)):
            s_temp.remove(min(slist))
        smin = min(s_temp)
        j = answer(slist,smin,k)
        return j

s=answer(list(s),min(list(s)),k)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(1.0e+18)
x,y=map(int,input().split(' '))
X = n//x
if x%y==0:
    print('-1')
else:
    i=2
    while i < X:
        if x*i % y != 0:
            print(str(x*i))
        else:
            i+=1
    if i >= X:
        print('-1')

Fixed submission:
n=int(1.0e+18)
x,y=map(int,input().split(' '))
X = n//x
if x%y==0:
    print('-1')
else:
    i=2
    while i < X:
        if (x*i)%y!=0:
            print(str(x*i))
            break
        i+=1
    if i >= X:
        print('-1')
Buggy python submission (verdict: Runtime Error):
l0 = input().split(' ')
N = int(l0[0])
H = int(l0[1])
L = []
i=0
while i < N:
    l1 = input().split(' ')
    l2 = [int(l1[0]), int(l1[1])]
    L.append(l2)
    i += 1
L.sort(key = lambda x:x[1])
#b_iの順に並び変え
L2 = L.copy()
L2.sort()
Amax = L2[N-1][0]
p=N-1
while p >= 0:
    if L[p][1] > Amax:
        p -= 1
    else:
        break
p += 1
Btot = 0
counter = 0
while p < N:
    Btot += L[p][1]
    p += 1
    counter += 1

rem = H - Btot
counter += rem // a
if rem % a != 0:
    counter += 1
print(counter)

Fixed submission:
l0 = input().split(' ')
N = int(l0[0])
H = int(l0[1])
L = []
i=0
while i < N:
    l1 = input().split(' ')
    l2 = [int(l1[0]), int(l1[1])]
    L.append(l2)
    i += 1
L.sort(key = lambda x:x[1])
#b_iの順に並び変え
L2 = L.copy()
L2.sort()
Amax = L2[N-1][0]
p=N-1
while p >= 0:
    if L[p][1] > Amax:
        p -= 1
    else:
        break
k=N-1
Btot = 0
c=0
counter = 0
while k > p:
    H -= L[k][1]
    k -= 1
    counter += 1
    if H <= 0:
        c = counter
        break

st =  H // Amax
counter += st
if st * Amax != H:
    counter += 1
if c ==0:
    print(counter)
else:
    print(c)
Buggy python submission (verdict: Time Limit Exceeded):
def F(Arri,S,F,C):
    k=0
    while Arri > (S+F*k):
        k+=1
    return S+F*k+C

N=int(input())
n=0
L=[]
l = [0,0,0]
while n < N-1:
    l[0],l[1],l[2] = map(int,input().split(' '))
    L.append(l.copy())
    n+=1
T = []
j = 0
while j < N-1:
    t=0
    t += L[j][0]+L[j][1]
    q=j+1
    while q < N-1:
        t = F(t,L[q][1],L[q][2],L[q][0])
        q += 1
    T.append(t)
    j += 1
T.append(0)
for i in T:
    print(i)

Fixed submission:
def F(Arri,S,F,C):
    if (Arri-S) <= 0:
        k=0
    else:
        k = (Arri-S) // F
        if (Arri-S) % F !=0:
            k += 1
    return S+F*k+C

N=int(input())
n=0
L=[]
l = [0,0,0]
while n < N-1:
    l[0],l[1],l[2] = map(int,input().split(' '))
    L.append(l.copy())
    n+=1
T = []
j = 0
while j < N-1:
    t=0
    t += L[j][0]+L[j][1]
    q=j+1
    while q < N-1:
        t = F(t,L[q][1],L[q][2],L[q][0])
        q += 1
    T.append(t)
    j += 1
T.append(0)
for i in T:
    print(i)
Buggy python submission (verdict: Runtime Error):
S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k+1,len(S)-k-1))
            k += 1
        else:
            k += 1
    L.sort()
    print(L[0])

Fixed submission:
S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k+1,len(S)-k-1))
            k += 1
        else:
            k += 1
    L.sort()
    if len(L)==0:
        print(len(S))
    else:
        print(L[0])

Buggy python submission (verdict: Runtime Error):
S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k,len(S)-k))
            k += 1
        else:
            k += 1
    L.sort()
    print(L[0])

Fixed submission:
S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k+1,len(S)-k-1))
            k += 1
        else:
            k += 1
    L.sort()
    if len(L)==0:
        print(len(S))
    else:
        print(L[0])
Buggy python submission (verdict: Runtime Error):
3 5
0 4 3 6 2 7 2 5 3 3
4 0 5 3 7 5 3 7 2 7
5 7 0 7 2 9 3 2 9 1
3 6 2 0 2 4 6 4 2 3
3 5 7 4 0 6 9 7 6 7
9 8 5 2 2 0 4 7 6 5
5 4 6 3 2 3 0 5 4 3
3 6 2 3 4 2 4 0 8 9
4 6 5 4 3 5 3 2 0 8
2 1 3 4 5 7 8 6 4 0
3 5 2 6 1
2 5 3 2 1
6 9 2 5 6

Fixed submission:
def Pto1(C):
    d = C.copy()
    for q in range(0,10):
        for i in range(0,10):
            for j in range(0,10):
                d[i][j] = min(d[i][j], d[i][q]+d[q][j])
    return [d[0][1],d[1][1],d[2][1],d[3][1],d[4][1],d[5][1],d[6][1],d[7][1],d[8][1],d[9][1]]

H,W = map(int,input().split(' '))
C = []
for i in range(0,10):
    cline = list(map(int,input().split(' ')))
    C.append(cline)
C1 = Pto1(C)
A = []
for j in range(0,H):
    aline = list(map(int,input().split(' ')))
    A.append(aline)
h=0
w=0
counter=[0]*10
while h<H:
    w=0
    while w<W:
        if A[h][w]>=0:
            counter[A[h][w]] += 1
        w+=1
    h+=1
Cmin = 0
for k in range(0,10):
    Cmin += C1[k]*counter[k]
print(int(Cmin))
Buggy python submission (verdict: Runtime Error):
A,B,C=map(str,input().split(' '))
D,E,F=map(str,input().split(' '))
if (A==F) and (B==E) and (C==D):
    print('YES')
else:
    print('NO')

Fixed submission:
A=input()
B=input()
C=B[2]+B[1]+B[0]
if A==C:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A = [[]]*341
count = 0
i = 0
while i < n:
    a0 = int(input())
    r = a0%341
    if a0 in A[r]:
        A[r].remove(a0)
        count -= 1
    else:
        A[r].append(a0)
        count += 1
    i += 1
print(count)

Fixed submission:
n=int(input());A=[]
for i in range(n):
    A.append(int(input()))
A.sort()
i = 1
count = 0
odd = 1
value = A[0]
while i < n:
    if value != A[i]:
        count += odd%2
        odd = 1
        value = A[i]
    else:
        odd += 1
    i += 1
count+= odd%2
print(count)
Buggy python submission (verdict: Runtime Error):
n=int(input());A = list(map(int,input().split(' ')))
x = [0]*10001
for a in A:
    if a != 0:
        x[a-1]+=1;x[a]+=1;x[a+1]+=1
    else:
        x[a]+=1;x[a+1]+=1
print(max(x))

Fixed submission:
n=int(input());A = list(map(int,input().split(' ')))
x = [0]*100001
for a in A:
    if a != 0:
        x[a-1]+=1;x[a]+=1;x[a+1]+=1
    else:
        x[a]+=1;x[a+1]+=1
print(max(x))
Buggy python submission (verdict: Time Limit Exceeded):
[n,m] = list(map(int,input().split(' ')))
L1 = []
Ln = []
i=0
while i < m:
    l = list(map(int,input().split(' ')))
    if l[0] == 1:
        L1.append(l[1])
    elif l[1] == n:
        Ln.append(l[0])
    i += 1
q=0
for j in L1:
    if j in Ln:
        print("POSSIBLE")
        q = 1
        break
if q == 0:
    print('IMPOSSIBLE')

Fixed submission:
[n,m] = list(map(int,input().split(' ')))
L1 = [0]*n
Ln = [0]*n
i=0
while i < m:
    l0 = list(map(int,input().split(' ')))
    if l0[0] == 1:
        L1[l0[1]] = 1
    elif l0[1] == n:
        Ln[l0[0]] = 1
    i += 1
q = 0
while q < n:
    if L1[q] * Ln[q] == 1:
        print('POSSIBLE')
        q = 0
        break
    else:
        q += 1
if q != 0:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = []
i = 0 
while i < n:
    A.append(int(input())-1)
    i += 1
used_list = [0]
count = 0
t = 0
while count < n:
    t1 = A[t] 
    count += 1
    if t1 == 1:
        break
    if t1 in used_list:
        count = -1
        break
    used_list.append(t1)
    t = t1
print(count)

Fixed submission:
n = int(input())
A = []
i = 0 
while i < n:
    A.append(int(input())-1)
    i += 1
used_list = [0]
count = 0
t = 0
while count < n:
    t1 = A[t] 
    count += 1
    if t1 == 1:
        break
#    if t1 in used_list:
#        count = -1
#        break
    used_list.append(t1)
    t = t1
if t1 != 1:
    count = -1
print(count)
Buggy python submission (verdict: Runtime Error):
import math
A, B, N = list(map(int, input().split(" ")))
if B > N:
    print(math.floor(A*i/B) - A * math.floor(i/B))
else:
    print(math.floor(A*(B-1)/B))

Fixed submission:
import math
A, B, N = list(map(int, input().split(" ")))
if B > N:
    print(math.floor(A*N/B) - A * math.floor(N/B))
else:
    print(math.floor(A*(B-1)/B))
Buggy python submission (verdict: Runtime Error):
from decimal import *
getcontext().prec = 10000

a, b, c = list(map(int, input().split()))
aa = Decimal(a).sqrt()
bb = Decimal(b).sqrt()
cc = Decimal(c).sqrt()
d = c - a - b -Decimal(2)*aa*bb
print(d)

if d > 0:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
import copy

def nex(lis):
    li = copy.copy(lis)
    if len(li) == N:
        print(''.join([chr(97+i) for i in li]))
        return 

    for x in range(max(li)+2):
        li2 = copy.copy(li)
        li2.append(x)
        nex(li2)
        
nex([0])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())
def cal(a, b, c):
    x = a[0]
    for bb in b:
        if bb > x:
            y = bb
            for cc in c:
                if cc > y:
                    return 1
    return 0
li = [[] for _ in range(10)]
for i, n in enumerate(S):
    num = int(n)
    li[num].append(i)
cnt = 0
for i in range(10):
    if len(li[i]) > 0:
        for j in range(10):
            if len(li[j]) > 0:
                for k in range(10):
                    if len(li[k]) > 0:
                        cnt += cal(li[i], li[j], li[k])
print(cnt)

Fixed submission:
N = int(input())
S = list(input())

def cal(x, a):
    for aa in a:
        if aa > x:
            return aa
    return False

li = [[] for _ in range(10)]
for i, n in enumerate(S):
    num = int(n)
    li[num].append(i)
    
cnt = 0
flag = True
for i in range(10):
    if len(li[i]) > 0:
        for j in range(10):
            if len(li[j]) > 0:
                ret = cal(li[i][0], li[j])
                if  ret == False:
                    flag = False
                else: 
                    flag = True
                for k in range(10):
                    if len(li[k]) > 0 and flag == True:
                        ret2=cal(ret, li[k]) 
                        if  ret2 != False:
                            cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(input())
def cal(a, b, c):
    x = a[0]
    for bb in b:
        if bb > x:
            y = bb
            for cc in c:
                if cc > y:
                    return 1
    return 0
li = [[] for _ in range(10)]
for i, n in enumerate(S):
    num = int(n)
    li[num].append(i)
cnt = 0
for i in range(10):
    if len(li[i]) > 0:
        for j in range(10):
            if len(li[j]) > 0:
                for k in range(10):
                    if len(li[k]) > 0:
print(cnt)

Fixed submission:
N = int(input())
S = list(input())

def cal(x, a):
    for aa in a:
        if aa > x:
            return aa
    return False

li = [[] for _ in range(10)]
for i, n in enumerate(S):
    num = int(n)
    li[num].append(i)
    
cnt = 0
flag = True
for i in range(10):
    if len(li[i]) > 0:
        for j in range(10):
            if len(li[j]) > 0:
                ret = cal(li[i][0], li[j])
                if  ret == False:
                    flag = False
                else: 
                    flag = True
                for k in range(10):
                    if len(li[k]) > 0 and flag == True:
                        ret2=cal(ret, li[k]) 
                        if  ret2 != False:
                            cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
 
mi = 10**10
 
for a in range(int(math.sqrt(N)), N+1, 1):
  if N % a == 0:
    b = N//a
    if mi > a+b-2:
      mi = a+b-2
print(mi)

Fixed submission:
import math

N = int(input())
 
mi = 10**100

for a in range(1, int(math.sqrt(N))+1, 1):
  if N % a == 0:  
    b = N//a
    if mi > a+b-2:
      mi = a+b -2
print(mi)

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
mi = 10**10
 
for a in range(int(math.sqrt(N)), N+1, 1):
  N % a == 0:
    b = N//a
    if mi > a+b-2:
      mi = a+b-2
print(mi)

Fixed submission:
import math

N = int(input())
 
mi = 10**100

for a in range(1, int(math.sqrt(N))+1, 1):
  if N % a == 0:  
    b = N//a
    if mi > a+b-2:
      mi = a+b -2
print(mi)

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

mi = 10**10

for a in range(N):
  for b in range(a):
    if a*b = N:
      if mi < a*b-2:
        mi == a*b-2
print(mi)
      

Fixed submission:
import math

N = int(input())
 
mi = 10**100

for a in range(1, int(math.sqrt(N))+1, 1):
  if N % a == 0:  
    b = N//a
    if mi > a+b-2:
      mi = a+b -2
print(mi)
Buggy python submission (verdict: Runtime Error):
import heapq

N, M = tuple(map(int, input().split()))
A = list(map(lambda a: -1*int(a), input().split()))
heapq.heapify(A)

for _ in range(M):
    x = heapq.heappop(A)
    heapq.heappush(A, -(-x//2))

print(-1*sum(A))

Fixed submission:
S  = list(input())

a = S[0]

if a =="S":
    print("Cloudy")
elif a == "C":
    print("Rainy")
else:
    print("Sunny")
Buggy python submission (verdict: Runtime Error):
a = "Yes"
for i,s in enumerate(S):
    if i % 2 == 0:
        if s in ["R", "U", "D"]:
            pass
        else:
            a = "No"
            break
    else:
        if s in ["L", "U", "D"]:
            pass
        else:
            a = "No"
            break
            
print(a)
      

Fixed submission:
S  = list(input())

a = "Yes"
for i,s in enumerate(S):
    if i % 2 == 0:
        if s in ["R", "U", "D"]:
            pass
        else:
            a = "No"
            break
    else:
        if s in ["L", "U", "D"]:
            pass
        else:
            a = "No"
            break
            
print(a)
Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

def cal(A, N):
    cnt1 = 0
    cnt2 = 0
    for i in range(N):
        for j in range(i+1,N):
            if A[N-1-j] > A[N-1-i]:
                cnt1 += 1
    for i in range(N):
        for j in range(N):
            if A[N-1-i] < A[j]:
                cnt2 += 1
    
    return int(cnt1), int(cnt2)
    
    
x, y = cal(A,N)
R = int(1*10**9 +7)
tmp = int(K*(K-1)/2)
ans =  tmp*y + x*K
print(int(ans%R))






Fixed submission:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

def cal(A, N):
    cnt1 = 0
    cnt2 = 0
    for i in range(N):
        for j in range(i+1,N):
            if A[N-1-j] > A[N-1-i]:
                cnt1 += 1
    for i in range(N):
        for j in range(N):
            if A[N-1-i] < A[j]:
                cnt2 += 1
    
    return int(cnt1), int(cnt2)
    
    
x, y = cal(A,N)
R = int(1*10**9 +7)
tmp = K*(K-1)//2
ans =  tmp*y + x*K
print(int(ans%R))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

S = []
cnt = 0

for i in range(N):
    s = "".join(sorted(list(input())))
    cnt += S.count(s)
    S.append(s)

print(cnt)

Fixed submission:
N = int(input())

S = []
cnt = 0
c = {}

for i in range(N):
    s = "".join(sorted(list(input())))
    if s not in c.keys():
        c[s] = 1
    else:
        c[s] += 1
        cnt += c[s]-1
        
    S.append(s)

print(cnt)

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

S = []
for i in range(N):
    S.append("".join(sorted(list(input()))))

cnt = 0
for i in range(N):
    cnt += S[i+1:].count(S[i])
    
print(cnt)

Fixed submission:
N = int(input())

S = []
cnt = 0
c = {}

for i in range(N):
    s = "".join(sorted(list(input())))
    if s not in c.keys():
        c[s] = 1
    else:
        c[s] += 1
        cnt += c[s]-1
        
    S.append(s)

print(cnt)

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

S = []
for i in range(N):
    S.append(sorted(list(input())))

cnt = 0
for i in range(N-1):
    for j in range(i+1,N):
        if S[i] == S[j]:
            cnt += 1
            
print(cnt)
        

Fixed submission:
N = int(input())

S = []
cnt = 0
c = {}

for i in range(N):
    s = "".join(sorted(list(input())))
    if s not in c.keys():
        c[s] = 1
    else:
        c[s] += 1
        cnt += c[s]-1
        
    S.append(s)

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, M = list(map(int, input().split()))
jobs = [[] for _ in range(M)]

for i in range(N):
    d, r = list(map(int, input().split()))
    if d-1 < M:
        jobs[d-1].append(r)

rewords = 0
li = []
for i in range(M):
    li.extend(jobs[i])
    if len(li) >0:
        reword = np.max(li)
        rewords += reword
        li.remove(reword)
    
print(rewords)

Fixed submission:
import heapq

N, M = list(map(int, input().split()))
jobs = [[] for _ in range(M)]

for i in range(N):
    d, r = list(map(int, input().split()))
    if d-1 < M:
        jobs[d-1].append(-r)

rewords = 0
heap = []

for i in range(M):
    for reword in jobs[i]:
        heapq.heappush(heap, reword)
    if len(heap) >0:
        r = heapq.heappop(heap)
        rewords -= r

print(rewords)
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())

def search(now, i, S):
    cnt = 1
    while True:
            if now == "L":
                if S[i-cnt] == "R":
                    if cnt %2 == 0:
                        return i-cnt
                    else:
                        return i-cnt+1
                else:
                    cnt += 1
            elif now == "R":
                if S[i+cnt] == "L":
                    if cnt %2 == 0:
                        return i+cnt
                    else:
                        return i+cnt-1
                else:
                    cnt += 1
        
l = len(S)
ans = [0 for _ in range(l)]
for i in range(l):
    now = S[i]
    index = search(now, i, S)
    ans[index] += 1

print(" ".join([str(s) for s in ans]))

Fixed submission:
S = list(input())

def search(now, i, S):
    cnt = 1
    while True:
            if now == "L":
                if S[i-cnt] == "R":
                    if cnt %2 == 0:
                        return i-cnt, i-cnt+1
                    else:
                        return i-cnt+1, i-cnt
                else:
                    cnt += 1
            elif now == "R":
                if S[i+cnt] == "L":
                    if cnt %2 == 0:
                        return i+cnt, i+cnt-1
                    else:
                        return i+cnt-1, i+cnt
                else:
                    cnt += 1
        
l = len(S)
ans = [0 for _ in range(l)]
before = 0
for i in range(l):
    now = S[i]
    if before == now:
        tmp = index
        index = nex
        nex = tmp
    else:
        index, nex = search(now, i, S)
    ans[index] += 1
    before = now

print(" ".join([str(s) for s in ans]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = []
for _ in range(N):
    li.append(int(input()))

max_indexs =  [i for i, x in enumerate(li) if x == max(li)]
li.sort()
max_val = li[-1]

if len(max_indexs) == 1:
    for i in range(N):
        if i == max_indexs[0]:
            print(li[-2])
        else:
            print(max_val)
else:
    for i in range(N):
        print(max_val)

Fixed submission:
N = int(input())
li = []
for _ in range(N):
    li.append(int(input()))

li2 = sorted(li)
max1 = li2[-1]
max2 = li2[-2]
max_index = li.index(max1)

if max1 != max2:
    for i in range(N):
        if i == max_index:
            print(max2)
        else:
            print(max1)
else:
    for i in range(N):
        print(max1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = []
for _ in range(N):
    li.append(int(input()))
    
for i in range(N):
    if i != 0:
        a = max(li[:i])
    else:
        a = 0
    
    if i != N-1:
        b = max(li[i+1:])
    else:
        b = 0
    print(max([a,b]))

Fixed submission:
N = int(input())
li = []
for _ in range(N):
    li.append(int(input()))

li2 = sorted(li)
max1 = li2[-1]
max2 = li2[-2]
max_index = li.index(max1)

if max1 != max2:
    for i in range(N):
        if i == max_index:
            print(max2)
        else:
            print(max1)
else:
    for i in range(N):
        print(max1)
Buggy python submission (verdict: Runtime Error):
w, h, x, y = list(map(int, input().split(" ")))

if w == 0 or y == 0:
	print(0,"0")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

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

if x*2 == w  and y*2 == h:
	print(w*h/2.0, "1")
else:
	print(w*h/2.0, "0")

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

if w == 0 and y == 0:
	print(0,"1")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

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

if x*2 == w  and y*2 == h:
	print(w*h/2.0, "1")
else:
	print(w*h/2.0, "0")

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

if w == 0 and y == 0:
	print(0,"0")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

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

if x*2 == w  and y*2 == h:
	print(w*h/2.0, "1")
else:
	print(w*h/2.0, "0")

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

if w%x == 0 and h%y == 0:
	print(w*h/2.0, "1")
else:
	print(w*h/2.0, "0")

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

if x*2 == w  and y*2 == h:
	print(w*h/2.0, "1")
else:
	print(w*h/2.0, "0")
Buggy python submission (verdict: Runtime Error):
n = int(input())

li = []

for _ in range(n):
    x, y = list(map(int, input().split(" ")))
    li.append([x, y])

li.sort()

def cal(li):
    n = len(li)
    Route = []
    for s in range(n-1):
        x1, y1 = li[s]
        route = {}
        for i in range(s+1,n):
            xi, yi = li[i]

            if xi != x1:
                diff = (yi - y1)/(xi - x1)
            else:
                diff = 10e10

            if diff in route.keys():
                route[diff].append([xi, yi])
            else:
                route[diff] = [[x1,y1], [xi, yi]]

        Route.extend(route.values())
    return Route

cost = 0
route = cal(li)

def check(A,B):
    for a in A:
        if a not in B:
            return False
    
    return True

def max_cal(route, li):
    n = len(li)
    l_max = 0
    max_li = []
    for r in route:
        if check(r,li):
            l = len(r)
            if l > l_max:
                 max_li = r
                 l_max = l
    return l_max, max_li

while True:
    l, cand = max_cal(route, li)
    if l == 0:
        cost += len(li)-1
        break
    else:
        route.remove(cand)
        for c in cand:
            li.remove(c)
        n -= l
        cost += 1

print(cost)




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

if k == 1:
  print(0)
else:
  print(n - k)