Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b, x = list(map(int, input().split()))
import math
if x/a <= s:
    h = 2 * x / a / b
    ans = math.degrees(math.atan2(b, h))
else:
    h = 2 * (b - x / a / a)
    ans = math.degrees(math.atan2(h, a))

print(ans)

Fixed submission:
import math
a, b, x = list(map(int, input().split()))
s = 0.5 * a * b
if x/a <= s:
    h = 2 * x / a / b
    ans = math.degrees(math.atan2(b, h))
else:
    h = 2 * (b - x / a / a)
    ans = math.degrees(math.atan2(h, a))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    print(str(A.index(i+1)+1), end=' ')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A_dict = dict(zip(A,range(1, N+1)))

for i in range(N):
  print(A_dict[i+1], end=' ')
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = []
for _ in range(Q):
    A.append(int(input()))

pts = [K - Q]*N
for ai in A:
    for i, _ in enumerate(pts):
        if (i+1)==ai:
            pts[i] += 1

for p in pts:
    if p>0:
        print('Yes')
    else:
        print('No')

Fixed submission:
N, K, Q = map(int, input().split())
A = []
for _ in range(Q):
    A.append(int(input()))
    
pts = [K - Q]*N
for ai in A:
    pts[ai-1] += 1

for p in pts:
    if p>0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = []
for _ in range(Q):
  A.append(int(input()))

# print(A)

pts = [K]*N
for ai in A:
    for i, _ in enumerate(pts):
        if (i+1)!=ai:
            pts[i] -= 1

for p in pts:
    if p>0:
        print('Yes')
    else:
        print('No')

Fixed submission:
N, K, Q = map(int, input().split())
A = []
for _ in range(Q):
    A.append(int(input()))
    
pts = [K - Q]*N
for ai in A:
    pts[ai-1] += 1

for p in pts:
    if p>0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
for _ in range(M):
    A[0] = A[0]//2
    A = sorted(A, reverse=True)

print(sum(A))

Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [-a for a in A]
A = sorted(A)
heapq.heapify(A)
for _ in range(M):
    ma = heapq.heappop(A)
    ma = -((-ma)//2)
    heapq.heappush(A, ma)
    # print(A, ma)
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
while M>0:
    d = max(A[0]//A[1], 1)
    A[0] = A[0]//2**d
    M -= d
    A = sorted(A, reverse=True)
    # print(A, M)

print(sum(A))

Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [-a for a in A]
A = sorted(A)
heapq.heapify(A)
for _ in range(M):
    ma = heapq.heappop(A)
    ma = -((-ma)//2)
    heapq.heappush(A, ma)
    # print(A, ma)
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
while M>0:
    d = A[0]//A[1]
    A[0] = A[0]//2**d
    M -= d
    A = sorted(A, reverse=True)
    # print(A, M)

print(sum(A))

Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [-a for a in A]
A = sorted(A)
heapq.heapify(A)
for _ in range(M):
    ma = heapq.heappop(A)
    ma = -((-ma)//2)
    heapq.heappush(A, ma)
    # print(A, ma)
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
for _ in range(M):
    ma = max(A)
    mai = A.index(ma)
    A[mai] = ma//2
print(sum(A))

Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [-a for a in A]
A = sorted(A)
heapq.heapify(A)
for _ in range(M):
    ma = heapq.heappop(A)
    ma = -((-ma)//2)
    heapq.heappush(A, ma)
    # print(A, ma)
print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
print(sum(range(1, N)))

Fixed submission:
N = int(input())
print(sum(range(1, N)))

Buggy python submission (verdict: Runtime Error):
N = int(input())
print(sum(range(1, N))

Fixed submission:
N = int(input())
print(sum(range(1, N)))
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
arr = [[0 for _ in range(n)] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    arr[a-1][b-1] += 1
    
ans = [0 for _ in range(n)] 

for _ in range(q):
    p, x = map(int, input().split())
    ans[p-1] += x
    
for i, c in enumerate(ans):
    for j, x in enumerate(arr[i]):
        if arr[i][j]==1:
            ans[j] += c
            
print(*ans)
            
        

Fixed submission:
n, q = map(int, input().split())
arr = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    arr[a-1].append(b)
    
ans = [0 for _ in range(n)] 

for _ in range(q):
    p, x = map(int, input().split())
    ans[p-1] += x
    
for i, c in enumerate(ans):
    for j in arr[i]:
        ans[j-1] += c
            
print(*ans)
Buggy python submission (verdict: Runtime Error):
# B - Two Colors Card Game
from collections import Counter
n = int(input())
n_dict = {}
for _ in range(n):
    ns = str(input())
    if ns not in n_dict.keys():
        n_dict[ns] = 1
    else:
        n_dict[ns] += 1

m = int(input()
m_dict = {}
for _ in range(n):
    ms = str(input())
    if ms not in m_dict.keys():
        n_dict[ms] = 1
    else:
        n_dict[ms] += 1

delta = dict(Counter(n_dict) - Counter(m_dict))
ans = max(delta.values())
print(ans)

Fixed submission:
# B - Two Colors Card Game
from collections import Counter
n = int(input())
n_dict = {}
for _ in range(n):
    ns = str(input().split())
    if ns not in n_dict.keys():
        n_dict[ns] = 1
    else:
        n_dict[ns] += 1

m = int(input())
m_dict = {}
for _ in range(m):
    ms = str(input().split())
    if ms not in m_dict.keys():
        m_dict[ms] = 1
    else:
        m_dict[ms] += 1

delta = dict(Counter(n_dict) - Counter(m_dict))
if len(delta)>0:
  ans = max(delta.values())
else:
  ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
s = str(input())
if len(s)==(len(set(s)):
    ans = "yes"
else:
    ans = "no"
print(ans)

Fixed submission:
s = str(input())
if len(s)==len(set(s)):
    ans = "yes"
else:
    ans = "no"
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
res = 0
while n >= k:
  res += 1
  n //= k
print(res+1)

Fixed submission:
n, r = map(int, input().split(' '))
if n < 10:
  ans = r + 100 * (10-n)
else:
  ans = r
print(ans)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
res = 0
while n >= k:
  res += 1
  n //= k
print(res+1)

Fixed submission:
n, r = map(int, input().split(' '))
if n < 10:
  ans = r + 100 * (10-n)
else:
  ans = r
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
f = s
while True:
    s = s.replace('10', '')
    s = s.replace('01', '')
    t = list(s)
    if all(map(lambda x:x=="1", t)):
        break
    if all(map(lambda x:x=="0", t)):
        break
print(len(f)-len(s))

Fixed submission:
s = input()
one = s.count('1')
zero = s.count('0')

print(min(one, zero)*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
f = s
while True:
    s = s.replace('10', '')
    s = s.replace('01', '')
    if(all(map(int, list(s)))):
        break
print(len(f)-len(s))

Fixed submission:
s = input()
one = s.count('1')
zero = s.count('0')

print(min(one, zero)*2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
people=[]
cost=[]

for i in range(N):
  people.append(int(input())
                
for p in range(len(people)):
  cost.append(0)
  for person in people:
    cost[-1]+=(person-p)**2
                
print(min(cost))

Fixed submission:
N=int(input())
people=[]
cost=[]
 
people=list(map(int,input().split()))

for p in range(101):
    cost.append(0)
    for person in people:
      cost[-1]+=(person-(p+1))**2

print(min(cost))
Buggy python submission (verdict: Runtime Error):
import string
numbers = "0123456789"
alphabets = string.ascii_letters # a-z+A-Zをロード
characters = numbers + alphabets
NK=list(map(int,input().split()))
n=NK[0]
k=NK[1]
result = ''
while n>=k:
    idx=n%k
    result=characters[idx]+result
    n=int(n/k)
    idx=n%k
    result=characters[idx]+result
result=str(result)
print(len(result))

Fixed submission:
NR=list(map(int,input().split()))
if NR[0]>=10:
    inR=NR[1]
    print(inR)
else:
    inR=int(NR[1]+100*(10-NR[0]))
    print(inR)
Buggy python submission (verdict: Runtime Error):
[a,b,c]=list(map(int,input().split())
if a<b<c
  print("true")

Fixed submission:
[a,b,c]=list(map(int,input().split()))
if a<=c<=b:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
[a,b,c]=list(map(int,input().split())
if a<b<c
  print:{"true"}

Fixed submission:
[a,b,c]=list(map(int,input().split()))
if a<=c<=b:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
[a,b,c]=list(map(int,input().split()))
if a<b<c
  print:{"true"}

Fixed submission:
[a,b,c]=list(map(int,input().split()))
if a<=c<=b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

NumArr = [int(num) for num in input().split()]

ans = 'YES'
for num in NumArr:
    matchCount = NumArr.count(num)
    if matchCount > 1:
        ans = 'NO'
        break

print(ans)


Fixed submission:
N = int(input())

NumArr = [int(num) for num in input().split()]

flg = len(NumArr) == len(set(NumArr))

if flg:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
INPUT = list(map(int, input().split()))

N = INPUT[0]
X = INPUT[1]

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

count = 0

i = 0
value = 0
while(i <= N):
    if(value <= X):
        count += 1
        value += L[i]
    i += 1
print(count)

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

N = INPUT[0]
X = INPUT[1]

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

vvv = 0
i = 0
while(vvv <= X):
    count += 1
    if(i >= N):
        break
    vvv += L[i]
    i += 1

print(count)
Buggy python submission (verdict: Runtime Error):
def nCrModpDP(n, r, p): 
    C = [0] * (n + 1); 
    C[0] = 1;  
    for i in range(1, (n + 1)): 
        j = min(i, r);  
        while(j > 0): 
            C[j] = (C[j] + C[j - 1]) % p; 
            j -= 1; 
    return C[r]; 
def nCrModpLucas(n, r, p): 
    if (r == 0): 
        return 1; 
    ni = int(n % p); 
    ri = int(r % p); 
    return (nCrModpLucas(int(n / p), int(r / p), p) * 
            nCrModpDP(ni, ri, p)) % p; # Remaining digits 
p = int(10**9+7)
n,a,b= map(int,input().split())
if a>n/2:
    a=n-a
if b>n/2:
    b=n-b
nca = nCrModpLucas(n,a,p)
ncb = nCrModpLucas(n,b,p)
print(int(2**n - 1 - nca - ncb)%(10**9+7))

Fixed submission:
n,r = map(int,input().split())
if n < 10:
    print(int(r + 100*(10-n)))
else:
    print(r)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
from decimal import Decimal

def expectval(num):
    up = [Decimal(str(n)) for n in range(1, num+1)]
    return sum(up) / Decimal(str(num))

n, k = tuple(map(int, input().split()))
l = list(map(int, input().split()))

ans = Decimal("-1")
for idx in range(len(l)):
    comb = l[idx:idx+k]
    _sum = 0
    for n in comb:
        _sum += expectval(n)
    if _sum > ans:
        ans = _sum

print("{:.12f}".format(ans))



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

sums = [0 for _ in range(n+1)]
for i in range(n):
    exp = (1 + l[i]) / 2
    sums[i+1] = sums[i] + exp

ans = 0
for idx in range(n-k+1):
    diff = sums[idx+k] - sums[idx]
    ans = max(ans, diff)

print(ans)

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

def expectval(num):
    up = [Decimal(str(n)) for n in range(1, num+1)]
    return sum(up) / Decimal(str(num))

n, k = tuple(map(int, input().split()))
l = list(map(int, input().split()))

ans = Decimal("-1")
for idx in range(len(l)):
    comb = l[idx:idx+k]
    _sum = sum(map(expectval, comb))
    if _sum > ans:
        ans = _sum

print("{:.12f}".format(ans))



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

sums = [0 for _ in range(n+1)]
for i in range(n):
    exp = (1 + l[i]) / 2
    sums[i+1] = sums[i] + exp

ans = 0
for idx in range(n-k+1):
    diff = sums[idx+k] - sums[idx]
    ans = max(ans, diff)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

_ = input()

heads = list(sorted(map(int,input().split())))
bodies = list(map(int,input().split()))
legs = list(sorted(map(int,input().split())))


cnt = 0
for body in bodies:
    #  頭は、体より小さくなければならない
    head_idx = bisect.bisect_left(heads, body)
    head_cnt = len(heads[:head_idx])

    #  足は、体より大きくなければならない
    leg_idx = bisect.bisect_right(legs, body)
    leg_cnt = len(legs[leg_idx:])

    cnt += head_cnt * leg_cnt # 組み合わせの掛け算

print(cnt)


Fixed submission:
import bisect

N = int(input(), 10)

heads = list(sorted(map(int,input().split())))
bodies = list(map(int,input().split()))
legs = list(sorted(map(int,input().split())))


cnt = 0
for body in bodies:
    #  頭は、体より小さくなければならない
    head_cnt = bisect.bisect_left(heads, body)
    #  足は、体より大きくなければならない
    leg_cnt = N - bisect.bisect_right(legs, body)

    cnt += head_cnt * leg_cnt # 組み合わせの掛け算

print(cnt)

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

_ = input()

heads = list(sorted(map(int,input().split())))
bodies = list(map(int,input().split()))
legs = list(sorted(map(int,input().split())))


cnt = 0
for body in bodies:
    #  頭は、体より小さくなければならない
    head_idx = bisect.bisect_left(sorted_heads, body)
    head_cnt = len(sorted_heads[:head_idx])

    #  足は、体より大きくなければならない
    leg_idx = bisect.bisect_right(sorted_legs, body)
    leg_cnt = len(sorted_legs[leg_idx:])

    cnt += head_cnt * leg_cnt # 組み合わせの掛け算

print(cnt)


Fixed submission:
import bisect

N = int(input(), 10)

heads = list(sorted(map(int,input().split())))
bodies = list(map(int,input().split()))
legs = list(sorted(map(int,input().split())))


cnt = 0
for body in bodies:
    #  頭は、体より小さくなければならない
    head_cnt = bisect.bisect_left(heads, body)
    #  足は、体より大きくなければならない
    leg_cnt = N - bisect.bisect_right(legs, body)

    cnt += head_cnt * leg_cnt # 組み合わせの掛け算

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

_ = input()

heads = list(map(int,input().split()))
bodies = list(map(int,input().split()))
legs = list(map(int,input().split()))


cnt = 0
sorted_heads = list(sorted(heads))
sorted_legs = list(sorted(legs))

for body in bodies:
    #  頭は、体より小さくなければならない
    head_idx = bisect.bisect_left(sorted_heads, body)
    head_cnt = len(sorted_heads[:head_idx])

    #  足は、体より大きくなければならない
    leg_idx = bisect.bisect_right(sorted_legs, body)
    leg_cnt = len(sorted_legs[leg_idx:])

    cnt += head_cnt * leg_cnt # 組み合わせの掛け算

print(cnt)


Fixed submission:
import bisect

N = int(input(), 10)

heads = list(sorted(map(int,input().split())))
bodies = list(map(int,input().split()))
legs = list(sorted(map(int,input().split())))


cnt = 0
for body in bodies:
    #  頭は、体より小さくなければならない
    head_cnt = bisect.bisect_left(heads, body)
    #  足は、体より大きくなければならない
    leg_cnt = N - bisect.bisect_right(legs, body)

    cnt += head_cnt * leg_cnt # 組み合わせの掛け算

print(cnt)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if(a <= 10):
    b = 100 * (10 - a) + b
# 出力
print("{}".form

Fixed submission:
a, b = map(int, input().split())
if(a <= 10):
    b = 100 * (10 - a) + b
# 出力
print("{}".format(b))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if(a <= 10):
    b = 100 * (10 - a) + b
# 出力
print("{}

Fixed submission:
a, b = map(int, input().split())
if(a <= 10):
    b = 100 * (10 - a) + b
# 出力
print("{}".format(b))

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


def comb(n, x):
    return factorial(n) // (factorial(x) * factorial(n - x))


def main():
    N, A, B = [int(x) for x in stdin.readline().rstrip().split()]
    result = sum([comb(N, i) for i in range(1, N + 1) if i != A and i != B])
    print(int(result % (1e9+7)))


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin

N, R = [int(x) for x in stdin.read().rstrip().split()]

def main(N, R):
  innerRate = 0
  if N >= 10:
    innerRate = R
  else:
    innerRate = R + 100 * (10 - N)
  return innerRate

print(main(N, R))
Buggy python submission (verdict: Runtime Error):
from sys import stdin


def calc_cost(p, x):
    return (x - p)**2


def min_cost(n, data):
    cost = 1_000_000
    for p in range(1, 100 + 1):
        tmp_cost = sum([calc_cost(p, x) for x in data])
        if tmp_cost < cost:
            cost = tmp_cost
    return cost


def main():
    N = [int(x) for x in stdin.readline().rstrip()]
    CORP = [int(x) for x in stdin.readline().rstrip().split()]
    cost = min_cost(N, CORP)
    print(cost)


main()


Fixed submission:
from sys import stdin


def calc_cost(p, x):
    return (x - p)**2


def min_cost(n, data):
    cost = 1000000
    for p in range(1, 100 + 1):
        tmp_cost = sum([calc_cost(p, x) for x in data])
        if tmp_cost < cost:
            cost = tmp_cost
    return cost


def main():
    N = [int(x) for x in stdin.readline().rstrip()]
    CORP = [int(x) for x in stdin.readline().rstrip().split()]
    cost = min_cost(N, CORP)
    print(cost)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin


def calc_cost(p, x):
    return (x - p)**2


def min_cost(n, data):
    cost = 1_000_000
    for p in range(1, 100 + 1):
        tmp_cost = sum([calc_cost(p, x) for x in data])
        if tmp_cost < cost:
            cost = tmp_cost
    return cost


def main():
    N = [int(x) for x in stdin.readline().rstrip()]
    CORP = [int(x) for x in stdin.readline().rstrip().split()]
    cost = min_cost(N, CORP)
    print(cost)


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin


def calc_cost(p, x):
    return (x - p)**2


def min_cost(n, data):
    cost = 1000000
    for p in range(1, 100 + 1):
        tmp_cost = sum([calc_cost(p, x) for x in data])
        if tmp_cost < cost:
            cost = tmp_cost
    return cost


def main():
    N = [int(x) for x in stdin.readline().rstrip()]
    CORP = [int(x) for x in stdin.readline().rstrip().split()]
    cost = min_cost(N, CORP)
    print(cost)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from functools import reduce

def cmb(n, r, mod):
    r = min(r, n-r)
    num = reduce(lambda x, y: x * y % mod, range(n, n-r, -1))
    den = reduce(lambda x, y: x * y % mod, range(1, r+1))
    return num * pow(den, mod-2, mod) % mod

n, a, b = map(int, input().split())
mod = 10**9 + 7

temp = pow(2, n, mod) - 1 - cmb(n, a, mod) - cmb(n, b, mod)
ans = temp % mod

print(ans)

Fixed submission:
from functools import reduce

def cmb(n, r, mod):
    r = min(r, n-r)
    if r == 0: return 1
    num = reduce(lambda x, y: x * y % mod, range(n, n-r, -1))
    den = reduce(lambda x, y: x * y % mod, range(1, r+1))
    return num * pow(den, mod-2, mod) % mod

n, a, b = map(int, input().split())
mod = 10**9 + 7

temp = pow(2, n, mod) - 1 - cmb(n, a, mod) - cmb(n, b, mod)
ans = temp % mod

print(ans)
Buggy python submission (verdict: Runtime Error):
N, p = map(int,input().split())
if N < 10:
    K = 100 * (10 - N)
    print(p + K)
else:
    print(P)

Fixed submission:
N, p = map(int,input().split())
if N < 10:
    K = 100 * (10 - N)
    print(p + K)
else:
    print(p)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from collections import defaultdict

def main():
    n = int(stdin.readline().rstrip())
    D = [int(i) for i in input().split()]
    hash = defaultdict(int)
    for i in D:
        hash[i] += 1
    count = hash[0]
    for i in range(1, n):
        count *= hash[i-1] ** hash[i]
    print(count/998244353)
    
if __name__ == '__main__':
    main()


Fixed submission:
from sys import stdin
import collections
def main():
    n = int(stdin.readline().rstrip())
    D = [int(i) for i in input().split()]
    hash = collections.Counter(D)
    count = hash[0]
    if(count != 1 or D[0] != 0):
        print(0)
        return
    for i in range(1, max(D)+1):
        count *= hash[i-1] ** hash[i]
    print(count%998244353)
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin

n = int(stdin.readline().rstrip())
xs = [int(x) for x in stdin.readline().rstrip().split()]
ys = [int(x) for x in stdin.readline().rstrip().split()]

count = 0

for i in range(n):
   r = min(xs[i], ys[i])
   xs[i] -= r
   ys[i] -= r
   count += r
   r = min(xs[i+1], ys[i])
   xs[i+1] -= r
   count += r
   
print(count)

Fixed submission:
from sys import stdin

A, B = [int(x) for x in stdin.readline().rstrip().split()]

if (A + B) % 2 == 0:
    print((A + B) // 2)
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lis = [sorted(set((str(i)))) for i in range(357, N+1)]
print(lis.count(['3', '5', '7']))

Fixed submission:
from itertools import product

N = int(input())

count = 0
for i in range(2, len(str(N))):
  for p in set(product('753', repeat=i+1)):
    if int(''.join(p)) > N:
      continue
    if all(p.count(s) > 0 for s in '753'):
      count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())
dis1 = x2 - x1
dis2 = y2 - y1
print('{} {} {} {}').format(x2-dis2, y2+dis1, x1-dis2, y1+dis1)

Fixed submission:
x1, y1, x2, y2 = map(int, input().split())
dis_x = x2 - x1
dis_y = y2 - y1
print(x2-dis_y, y2+dis_x, x1-dis_y, y1+dis_x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lines = [i for i in range(24, n+1) if i % 2 != 0]

ans = 0
for i in lines:
    cnt = 0
    for j in range(1, i+1):
        if i % j == 0:
            cnt += 1
        if cnt == 8:
            ans += 1
print(ans)


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

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

ans = 0
for i in range(1, n+1):
    cnt = 0
    for j in range(1, i+1):
        if i % 2 != 0 and i % j == 0:
            cnt += 1
            if cnt == 8:
                ans += 1
print(ans)

Fixed submission:
a, b = map(int, input().split())
print((a-1) * (b-1))
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

def combo(n, r):
    return factorial(n)//(factorial(n-r)*factorial(r))

n = int(input())
a = sorted(list(map(int, input().split())))

result = {}
for i in range(n):
    for j in range(i+1, n):
        x = combo(a[j], a[i])
        s = ' '.join(map(str, [a[j], a[i]]))
        result[s] = x

print(max(result, key=result.get))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = max(a)
l = m/2
x, v = abs(a[0]-l), 0
for i in range(n):
    s = abs(a[i]-l)
    if x > s:
        x, v = s, i
if a[v] == m:
    print(m, 0)
else:
    print(m, a[v])
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b+1))
x = sorted(set(l[:k] + l[-k:]), key=l.index)
print('\n'.join(map(str, x)))

Fixed submission:
a, b, k = map(int, input().split())
L = range(a, b+1)
for l in sorted(set(L[:k])|set(L[-k:])):
    print(l)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    x = a.pop(i)
    ans, c = 0, 0
    for j in a:
        ans += abs(c-j)
        c = j
    a.insert(i, x)
    ans += abs(c-0)
    print(ans)


Fixed submission:
n = int(input())
a = [0] + list(map(int, input().split())) + [0]
s = sum([abs(a[i]-a[i-1]) for i in range(1, n+2)])
for i in range(1, n+1):
    x = abs(a[i]-a[i-1])
    y = abs(a[i+1]-a[i])
    z = abs(a[i+1]-a[i-1])
    print(s-x-y+z)