Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
K, X = [int(n) for n in input().split()]
print(" ".join([n for n in range(X-(K-1), X+(K-1))]))

Fixed submission:
K, X = [int(n) for n in input().split()]
print(" ".join([str(n) for n in range(X-(K-1), X+(K))]))

Buggy python submission (verdict: Runtime Error):
K, X = [int(n) for n in input().split()]
print(" ".join([n for n in range(X-(K-1), X+(K-1)]))

Fixed submission:
K, X = [int(n) for n in input().split()]
print(" ".join([str(n) for n in range(X-(K-1), X+(K))]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [sorted(input()) for _ in range(N)]
c = 0
print(sum([1 for i in range(N-1) for j in range(i+1, N) if s[i]==s[j]]))

Fixed submission:
N = int(input())
o = {}
c = 0
for _ in range(N):
    k = "".join(sorted(input()))
    if k not in o:
        o[k] = 0
    else:
        o[k] += 1
        c += o[k]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [sorted(input()) for _ in range(N)]
c = 0
for i in range(N-1):
  for j in range(i+1, N):
    if s[i]==s[j]:
      c += 1
print(c)

Fixed submission:
N = int(input())
o = {}
c = 0
for _ in range(N):
    k = "".join(sorted(input()))
    if k not in o:
        o[k] = 0
    else:
        o[k] += 1
        c += o[k]
print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [int(n) for n in input().split()]
m = H[N-1]
for i in range(0, N-1)[::-1]:
    if H[i] > m+1:
        return 'No'
    else:
        m = H[i]
return 'Yes'


Fixed submission:
N = int(input())
H = [int(n) for n in input().split()]
m = H[N-1]
ans = 'Yes'
for i in range(0, N-1)[::-1]:
    if H[i] > m+1:
        ans = 'No'
        break
    elif H[i] == m+1:
        m = H[i]-1
    else:
        m = H[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
x, a = [int(n) for n in input().split()]
return 0 if x < a else 10

Fixed submission:
x, a = [int(n) for n in input().split()]
print(0 if x < a else 10)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(n) for n in input().split()]
S = set(range(1, N+1))
for i in range(M):
    l, r = [int(n) for n in input().split()]
    S &= set(range(l, r+1))
print(len(S))


Fixed submission:
N, M = [int(n) for n in input().split()]
L, R = (1, N)
for i in range(M):
    l, r = [int(n) for n in input().split()]
    L, R = (max(l, L), min(r, R))
print(max(0, R-L+1))
Buggy python submission (verdict: Runtime Error):
N,Q=[int(n) for n in input().split(' ')]
S=input()
a=''
for i in range(Q):
  l,r=[int(n) for n in input().split(' ')]
  a=a+str(S[l-1:r].count('AC'))+'\n'
print(a)


Fixed submission:
o = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'}
b = input()
print(o[b])
Buggy python submission (verdict: Runtime Error):
from math import gcd

N = int(input())
A = sorted([int(n) for n in input().split()], reverse=True)

x = A[0]
for i in range(1, N):
    x = gcd(x, A[i])
print(x)


Fixed submission:
from fractions import gcd

N = int(input())
A = sorted([int(n) for n in input().split()], reverse=True)

x = A[0]
for i in range(1, N):
    x = gcd(x, A[i])
print(x)
Buggy python submission (verdict: Runtime Error):
a,b,c = [int(n) for n in input.split(" ")]
print(a*b/2)

Fixed submission:
# -*- coding: utf-8 -*-
a,b,c = map(int, input().split())
print(a*b//2)
Buggy python submission (verdict: Runtime Error):
D = int(input())
print(f"Christmas {Eve*(25-D)}")

Fixed submission:
D = int(input())
print("Christmas" + " Eve"*(25-D))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N, K = [int(n) for n in input().split()]
h = [int(input()) for _ in range(N)]
ans = 10**9+1
for c in combinations(h, K):
    mc = max(c)-min(c)
    if ans > mc:
      ans = mc
print(ans)


Fixed submission:
N, K = [int(n) for n in input().split()]
h = sorted([int(input()) for _ in range(N)])
ans = 10**9
for i in range(N-K+1):
    ans = min(ans, h[i+K-1]-h[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N, K = [int(n) for n in input().split()]
h = sorted([int(input()) for _ in range(N)])
ans = []
for c in combinations(h, K):
    ans.append(c[K-1]-c[0])
print(min(ans))


Fixed submission:
N, K = [int(n) for n in input().split()]
h = sorted([int(input()) for _ in range(N)])
ans = 10**9
for i in range(N-K+1):
    ans = min(ans, h[i+K-1]-h[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
from itertools import combinations

N, K = [int(n) for n in input().split()]
h = sorted([int(input()) for _ in range(N)])
ans = []
for c in combinations(h, K):
    ans.append(c[2]-c[0])
print(min(ans))


Fixed submission:
N, K = [int(n) for n in input().split()]
h = sorted([int(input()) for _ in range(N)])
ans = 10**9
for i in range(N-K+1):
    ans = min(ans, h[i+K-1]-h[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(n) for n in input().split()]
print(sum([1 for X in range(K+1) for Y in range(K+1) for Z in range(K+1) if X+Y+Z==S]))

Fixed submission:
K, S = [int(n) for n in input().split()]
print(sum([1 for X in range(K+1) for Y in range(K+1) if 0<=S-X-Y<=K]))

Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(n) for n in input().split()]
c = 0
for X in range(K+1):
  for Y in range(K+1):
    for Z in range(K+1):
      if X+Y+Z == S:
        c += 1
print(c)

Fixed submission:
K, S = [int(n) for n in input().split()]
print(sum([1 for X in range(K+1) for Y in range(K+1) if 0<=S-X-Y<=K]))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
tmp=1
for i in range(k):
    tmp*=a[i]
for i in range(n-k):
    tmp1=tmp//a[i]*a[i+k]
    if tmp1>tmp:
        print("Yes")
        tmp=tmp1
    else:
        print("No")
        tmp=tmp1

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

for i in range(n-k):
    tmp=a[i]
    tmp1=a[i+k]
    if tmp1>tmp:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input()) ans='' whileN>0:
N -= 1
ans += chr(ord('a') + N % 26) N //= 26
print(ans[::-1])

Fixed submission:
N = int(input()) 
ans=""
while N>0:
    N -= 1
    ans += chr(ord('a') + N % 26) 
    N //= 26
print(ans[::-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=[0 for i in range(10001)]
for i in range(n):
    ans[a[i]-1]+=1
tmp=0
for i in range(10001):
    tt=(i+1)*ans[i]
    tmp+=tt
q=int(input())
for i in range(q):
    b,c=map(int,input().split())
    tt=-ans[b-1]*b+ans[b-1]*c
    ans[c-1]+=ans[b-1]
    ans[b-1]=0
    tmp+=tt
    print(tmp)

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

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=[0 for i in range(10000)]
for i in range(n):
    ans[a[i]-1]+=1
tmp=0
for i in range(10000):
    tt=(i+1)*ans[i]
    tmp+=tt
q=int(input())
for i in range(q):
    b,c=map(int,input().split())
    tt=-ans[b-1]*b+ans[b-1]*c
    ans[c-1]+=ans[b-1]
    ans[b-1]=0
    tmp+=tt
    print(tmp)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0 for i in range(100001)]
for i in range(n):
    ans[a[i]-1]+=1
tmp=0
for i in range(100001):
    tt=(i+1)*ans[i]
    tmp+=tt
q=int(input())
for i in range(q):
    b,c=map(int,input().split())
    tt=-ans[b-1]*b+ans[b-1]*c
    ans[c-1]+=ans[b-1]
    ans[b-1]=0
    tmp+=tt
    print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import *
from copy import *
n=int(input())
a=sorted(list(map(int,input().split())))
l=Counter(a)
m=l.most_common()
f=[False for i in range(max(a)+1)]
ans=0
for i,j in m:
    t=deepcopy(i)
    if f[t]==False and j==1:
               
        ans+=1
        while t<=max(a):
            f[t]=True
            t+=i
    elif f[t]==False and j!=1:
        while t<=max(a):
            f[t]=True
            t+=i
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
dp=[0]*(a[-1]+1)

for i in a :
    dp[i]+=1

for i in a :
    if dp[i] :
        for j in range(i*2,a[-1]+1,i) :
            dp[j]=0

print(dp.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=sorted(list(map(int,input().split())))
f=[False for i in range(max(a)+1)]

ans=0
for i in range(n):
    t=a[i]
    if i!=n-1:
        if f[t]==False and t!=a[i+1]:       
            ans+=1
            while t<=max(a):
                f[t]=True
                t+=a[i]
        elif f[t]==False and t==a[i+1]:
            while t<=max(a):
                f[t]=True
                t+=a[i]
    if i==n-1:
        if f[t]==False:       
            ans+=1

print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
dp=[0]*(a[-1]+1)

for i in a :
    dp[i]+=1

for i in a :
    if dp[i] :
        for j in range(i*2,a[-1]+1,i) :
            dp[j]=0

print(dp.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=sorted(list(map(int,input().split())))
f=[False for i in range(max(a)+1)]

ans=0
for i in range(n):
    t=a[i]
    if i!=n-1:
        if f[t]==False and t!=a[i+1]:       
            ans+=1
    if i==n-1:
        if f[t]==False:       
            ans+=1
    while t<=max(a):
        f[t]=True
        t+=a[i]
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
dp=[0]*(a[-1]+1)

for i in a :
    dp[i]+=1

for i in a :
    if dp[i] :
        for j in range(i*2,a[-1]+1,i) :
            dp[j]=0

print(dp.count(1))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
tmp=set()
onaji=set()
if a[0]!=a[1]:
    tmp.add(a[0])
for i in range(1,n-1):
    flg=True
    if a[i]==a[i+1] or a[i]==a[i-1]:
        flg=False
    for j in tmp:
        if a[i]%j==0:
            flg=False
    if flg:
        tmp.add(a[i])
flg=True
if a[n-1]==a[n-2]:
    flg=False
for i in tmp:
    if a[n-1]%i==0:
        flg=False
if flg:
    tmp.add(a[n-1])
print(len(tmp))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
dp=[0]*(a[-1]+1)

for i in a :
    dp[i]+=1

for i in a :
    if dp[i] :
        for j in range(i*2,a[-1]+1,i) :
            dp[j]=0

print(dp.count(1))
Buggy python submission (verdict: Runtime Error):
import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a=b:
    print("YES")
    sys.exit()
if a<b and a+v*t>=b+w*t:
    print("YES")
elif a>b and a-v*t<b-w*t:
    print("YES")
else:
    print("NO")

Fixed submission:
import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a==b:
    print("YES")
    sys.exit()
if a<b and a+v*t>=b+w*t:
    print("YES")
elif a>b and a-v*t<=b-w*t:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a=b:
    print("YES")
    sys.exit()
if a<b and a+v*t>=b+w*t:
    print("YES")
elif a>b and a-v*t<b-w*t:
    print("YES")
else:
    print("NO")

Fixed submission:
import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a==b:
    print("YES")
    sys.exit()
if a<b and a+v*t>=b+w*t:
    print("YES")
elif a>b and a-v*t<=b-w*t:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(k):
    ans=[0]*(n)
    for j in range(n):
        l=max(0,j-a[j])
        r=j+1+a[j]
        ans[l]+=1
        if r<n:
            ans[r]-=1
    for z in range(n-1):
        ans[z+1]+=ans[z]
    a=ans
    if ans[0]==n and ans[n-1]==0:
        print(" ".join(list(map(str,ans))))
        sys.exit()
print(" ".join(list(map(str,ans))))

Fixed submission:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(min(k,500)):
    ans=[0]*(n)
    for j in range(n):
        l=max(0,j-a[j])
        r=j+1+a[j]
        ans[l]+=1
        if r<n:
            ans[r]-=1
    for z in range(n-1):
        ans[z+1]+=ans[z]
    a=ans
print(" ".join(list(map(str,ans))))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(k):
    ans=[0]*(n)
    for j in range(n):
        l=max(0,j-a[j])
        r=j+1+a[j]
        ans[l]+=1
        if r<n:
            ans[r]-=1
    for z in range(n-1):
        ans[z+1]+=ans[z]
    a=ans
print(" ".join(list(map(str,ans))))

Fixed submission:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(min(k,500)):
    ans=[0]*(n)
    for j in range(n):
        l=max(0,j-a[j])
        r=j+1+a[j]
        ans[l]+=1
        if r<n:
            ans[r]-=1
    for z in range(n-1):
        ans[z+1]+=ans[z]
    a=ans
print(" ".join(list(map(str,ans))))

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

for i in range(k):
    ans=[0]*(n)
    for j in range(n):
        l=max(0,j-a[j])
        r=j+1+a[j]
        ans[l]+=1
        if r<n:
            ans[r]-=1
    for z in range(n-1):
        ans[z+1]+=ans[z]
    a=ans
print(" ".join(list(map(str,ans))))

Fixed submission:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(min(k,500)):
    ans=[0]*(n)
    for j in range(n):
        l=max(0,j-a[j])
        r=j+1+a[j]
        ans[l]+=1
        if r<n:
            ans[r]-=1
    for z in range(n-1):
        ans[z+1]+=ans[z]
    a=ans
print(" ".join(list(map(str,ans))))

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

for i in range(k):
    ans=[0]*(n)
    for j in range(n):
        l=max(0,j-a[j])
        r=j+1+a[j]
        ans[l]+=1
        if r<n:
            ans[r]-=1
    for z in range(n-1):
        ans[z+1]+=ans[z]
    a=ans
print(" ".join(list(map(str,ans))))

Fixed submission:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(min(k,500)):
    ans=[0]*(n)
    for j in range(n):
        l=max(0,j-a[j])
        r=j+1+a[j]
        ans[l]+=1
        if r<n:
            ans[r]-=1
    for z in range(n-1):
        ans[z+1]+=ans[z]
    a=ans
print(" ".join(list(map(str,ans))))
Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
if n==1:
    print(0)
    sys.exit()
def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
tmp=f(n)
ans=0
for i in tmp:
    dd=i[1]
    tt=1
    while dd>0:
        if dd-tt>=0:
            dd-=tt
            tt+=1
            ans+=1
        else:
            break
print(ans)=0:
            dd-=tt
            tt+=1
            ans+=1
print(ans)

Fixed submission:
import sys
n=int(input())
if n==1:
    print(0)
    sys.exit()
def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
tmp=f(n)
ans=0
for i in tmp:
    dd=i[1]
    tt=1
    while dd>0:
        if dd-tt>=0:
            dd-=tt
            tt+=1
            ans+=1
        else:
            break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n=int(input())
if n==1:
    print(0)
    sys.exit()
def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
tmp=f(n)
ans=0
for i in tmp:
    dd=i[1]
    tt=1
    while dd>0:
        if dd-tt>=0:
            dd-=tt
            tt+=1
            ans+=1
print(ans)

Fixed submission:
import sys
n=int(input())
if n==1:
    print(0)
    sys.exit()
def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
tmp=f(n)
ans=0
for i in tmp:
    dd=i[1]
    tt=1
    while dd>0:
        if dd-tt>=0:
            dd-=tt
            tt+=1
            ans+=1
        else:
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
n,k=map(int,input().split())
a=list(map(int,input().split()))
l=set()
l.add(1)
t=1
ans=[]
if k==1:
    print(a[0])
    sys.exit()
while k>0:
    tt=a[t-1]
    k-=1
    if k==0:
        print(a[tt-1])
        sys.exit()
    if tt not in l:
        l.add(tt)
        t=tt
    elif tt in l:
        ans.append(tt)
        break
tmp=0
while k>0:
    if a[tt-1] not in ans:
        ans.append(a[tt-1])
        k-=1
        if k==0:
            print(a[tt-1])
            sys.exit()
        tt=a[tt-1]
        tmp+=1
    if a[tt-1] in ans:
        print(ans[k%tmp])
        sys.exit()

Fixed submission:
n, k = map(int, input().split())
a = [0]+list(map(int, input().split()))

num = 1
li = [1]
flag = [True] * n
flag[0] = False

for i in range(k):
    num = a[num]
    if flag[num-1]:
        li.append(num)
        flag[num-1] = False
    else:
        break

d = li.index(num)
ans = (k-d)%(len(li)-d)+d

print(li[ans])
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans+=gcd(i,j,k)
print(ans)

Fixed submission:
from math import gcd
k = int(input())
ans = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    p = gcd(a,b)
    for c in range(1,k+1):
      ans += gcd(p,c)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n,k=map(int,input().split())
if n==0 or n%k==0:
    print(0)
    sys.exit()
tmp=abs(n-k)
while tmp<n:
    n=tmp
    tmp=abs(n-k)
print(n)

Fixed submission:
import sys
n,k=map(int,input().split())
if n==0 or n%k==0:
    print(0)
    sys.exit()
n=n%k
tmp=abs(n-k)
while tmp<n:
    n=tmp
    tmp=abs(n-k)
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n,k=map(int,input().split())
if n==0 or n%k==0:
    print(0)
    sys.exit()
tmp=abs(n-k)
while tmp<n:
    n=tmp
    tmp=abs(n-k)
print(n)

Fixed submission:
import sys
n,k=map(int,input().split())
if n==0 or n%k==0:
    print(0)
    sys.exit()
n=n%k
tmp=abs(n-k)
while tmp<n:
    n=tmp
    tmp=abs(n-k)
print(n)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y=map(int,input().split())
x,y=x-1,y-1
adj=[[float("inf")]*n for i in range(n)]
for i in range(n):
    for j in range(n):
        adj[i][j]=abs(i-j)
adj[x][y]=adj[y][x]=1
for i in range(n):
    for j in range(n):
        for k in range(n):
            adj[j][k]=min(adj[j][k],adj[j][i]+adj[i][k])
ans=[0 for i in range(n)]
for i in range(n-1):
    for j in range(i+1,n):
        ans[adj[i][j]]+=1
for i in range(1,n):
    print(ans[i])

Fixed submission:
n,x,y=map(int,input().split())
x,y=x-1,y-1
adj=[[float("inf")]*n for i in range(n)]
adj[x][y]=adj[y][x]=1
for i in range(n):
    for j in range(n):
        adj[i][j]=min(abs(i-j),abs(i-x)+1+abs(y-j),abs(i-y)+1+abs(y-j))
ans=[0 for i in range(n)]
for i in range(n-1):
    for j in range(i+1,n):
        ans[adj[i][j]]+=1
for i in range(1,n):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
if h==w==1:
    print(1)
    sys.exit()
if h%2==0 and w%2==0:
    print(int(h*w/2))
elif h%2==1 and w%2==1:
    print(int(h*w/2)+1)
else:
    print(int(h*w/2))

Fixed submission:
import sys
h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
    sys.exit()
if h%2==0 and w%2==0:
    print(int(h*w/2))
elif h%2==1 and w%2==1:
    print(int(h*w/2)+1)
else:
    print(int(h*w/2))
Buggy python submission (verdict: Runtime Error):
from math import *
from decimal import *
a,b,c=map(int,input().split())
if Decimal( a**2+ b**2+2*a+2*b+2*sqrt(a)*sqrt(b)))<Decimal(c**2):
    print("Yes")
else:
    print("No")

Fixed submission:
from math import *
from decimal import *
a,b,c=map(int,input().split())
if 4*a*b<(c-a-b)**2 and c-a-b>0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
for i in range(q):
    a=list(map(str,input().split()))
    if a[0]=="1":
        s=s[::-1]
    if a[0]=="2":
        if a[1]=="1":
            s=a[2]+s
        if a[1]=="2":
            s=s+a[2]           
print(s)

Fixed submission:
s=input()
q=int(input())
mae=""
usr=""
flg=True
for i in range(q):    
    a=list(map(str,input().split()))
    if a[0]=="1":
        if flg:
            flg=False
        elif flg==False:
            flg=True
    if a[0]=="2":
        if a[1]=="1":
            if flg:
                mae=a[2]+mae
            else:
                usr=usr+a[2]
        if a[1]=="2":
            if flg:
                usr=usr+a[2]
            else:
                mae=a[2]+mae
if flg:
    ans=mae+s+usr
else:
    ans=usr[::-1]+s[::-1]+mae[::-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[0 for i in range(n)]
f=[[True] for i in range(n)]
for i in range(m):
    s,c=map(int,input().split())
    if f[s-1]==False:
        if ans[s-1]!=c:
            print(-1)
            sys.exit()
    if f[s-1]:
        f[s-1]=False
    ans[s-1]=c
if ans[0]==0:
    print(-1)
    sys.exit()
a=map(str,ans)
print("".join(a))

Fixed submission:
import sys
n,m=map(int,input().split())
ans=[0 for i in range(n)]
f=[[True] for i in range(n)]
if n==1:
    for i in range(m):
        s,c=map(int,input().split())
        if f[s-1]==False:
            if ans[s-1]!=c:
                print(-1)
                sys.exit()
        if f[s-1]:
            f[s-1]=False
        ans[s-1]=c
    
    a=map(str,ans)
    print("".join(a))
    sys.exit()

for i in range(m):
    s,c=map(int,input().split())
    if s==1 and c==0:
        print(-1)
        sys.exit()
    if f[s-1]==False:
        if ans[s-1]!=c:
            print(-1)
            sys.exit()
    if f[s-1]:
        f[s-1]=False
    ans[s-1]=c
if ans[0]==0:
    ans[0]=1
a=map(str,ans)
print("".join(a))
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
from decimal import Decimal
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[]
tmp=0
for i in range(n):
    p[i]=Decimal((p[i]+1)/2)
    tmp+=p[i]
    l.append(tmp)
ans=l[k]
for i in range(k,n):
    tmp=l[i]-l[i-k]
    if tmp>ans:
        ans=tmp
print(Decimal(ans))

Fixed submission:
from itertools import accumulate
from decimal import Decimal
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[0]
tmp=0
for i in range(n):
    p[i]=Decimal((p[i]+1)/2)
    tmp+=p[i]
    l.append(tmp)
ans=0
for i in range(k,n+1):
    tmp=l[i]-l[i-k]
    if tmp>ans:
        ans=tmp
print(Decimal(ans))
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
print(max(0,a-k),max(0,b-max(0, k-a)))

Fixed submission:
s,t=input().split()
print(t,s,sep="")