Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l.sort()

count = 0
for i in range(n-1):
    for j in range(i+1, n):
        for k in range(j+1,n):
            if l[k] < l[i] + l[j]:
                count += 1

print(count)

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

import bisect

count = 0
for i in range(n-1):
    for j in range(i+1, n):
            ab = l[i] + l[j]
            right = bisect.bisect(l, ab-1)
            left = j + 1
            count += (right - left)

print(count)

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

count = 0
for i in range(n-1):
    for j in range(i+1, n):
        for k in range(j+1,n):
            if l[j] - l[i] < l[k] and l[k] < l[i] + l[j]:
                count += 1

print(count)

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

import bisect

count = 0
for i in range(n-1):
    for j in range(i+1, n):
            ab = l[i] + l[j]
            right = bisect.bisect(l, ab-1)
            left = j + 1
            count += (right - left)

print(count)

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

count = 0
for i in range(n-1):
    for j in range(i+1, n):
        for k in range(j+1,n):
            if l[j] - l[i] < l[k] and l[k] < l[i] + l[j]:
                count += 1

print(count)

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

import bisect

count = 0
for i in range(n-1):
    for j in range(i+1, n):
            ab = l[i] + l[j]
            right = bisect.bisect(l, ab-1)
            left = j + 1
            count += (right - left)

print(count)

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

count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            flag = True
            if l[i] >= l[j] + l[k]:
                flag = False
            if l[j] >= l[i] + l[k]:
                flag = False
            if l[k] >= l[j] + l[i]:
                flag = False
            if flag == True:
                count += 1

print(count)


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

import bisect

count = 0
for i in range(n-1):
    for j in range(i+1, n):
            ab = l[i] + l[j]
            right = bisect.bisect(l, ab-1)
            left = j + 1
            count += (right - left)

print(count)
Buggy python submission (verdict: Runtime Error):
s = str(input())
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy'):
    print('Rainy')
else:
    print('Sunny')


Fixed submission:
s = str(input())
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []


for i in range(n):
    x = list(str(input()))
    x.sort()
    s.append(''.join(x))

count = 0
for i in range(n):
    for j in range(i+1, n):
        if s[i] == s[j]:
            count += 1

            
print(count)

Fixed submission:
n = int(input())
s = []


for i in range(n):
    x = list(str(input()))
    x.sort()
    s.append(''.join(x))

    
s.sort()
count = 0
ans = 0

import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

import math
for i in range(n-1):
    if s[i] == s[i+1]:
        count += 1
        if i == n-2:
            ans += comb(count+1,2)
    else:
        if count != 0:
            ans += comb(count+1,2)
        count = 0

print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(str(input()))

if s[0] == s[1] or a[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')


Fixed submission:
s = list(str(input()))

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')

Buggy python submission (verdict: Runtime Error):
s = list(str(input()))

if s[0] == s[1] and a[1] == s[2] and s[2] == s[3]:
    print('Bad')
else:
    print('Good')


Fixed submission:
s = list(str(input()))

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())


x = ((b+1) // c) - ((a+1) // c)
y = ((b+1) // d) - ((a+1) // d)


import math
e = int(c * d / math.gcd(c,d))


z = ((b+1) // e) - ((a+1) // e)


print((b-a) - (x+y-z) + 1)


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


x = b // c
y = b // d


import fractions
e = int(c * d / fractions.gcd(c,d))


z = b // e

x2 = (a-1) // c
y2 = (a-1) // d


e2 = int(c * d / fractions.gcd(c,d))


z2 = (a-1) // e2


print((b - (x + y - z)) - (a - 1 - (x2 + y2 - z2)))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [0] * m
for i in range(m):
    a[i] = int(input())

dp = [0] * (n + 1)
if 0 not in a:
    dp[0] = 1
if 1 not in a:
    dp[1] = 1
if 2 not in a:
    if 1 in a:
        dp[2] = 1
    else:
        dp[2] = 2

mod = 10**9+7

for i in range(3,n+1):
    if i-1 in a and i-2 in a:
        dp[i] = 0
    elif i-1 in a:
        dp[i] = dp[i-2] % mod
    elif i-2 in a:
        dp[i] = dp[i-1] % mod
    else:
        dp[i] = (dp[i-1] + dp[i-2]) % mod

print(dp[-1])


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

dp = [999] * (n + 1)
if 0 not in a:
    dp[0] = 1
if 1 not in a:
    dp[1] = 1
if 2 not in a and n >= 2:
    if 1 in a:
        dp[2] = 1
    else:
        dp[2] = 2

mod = 10**9+7

for i in range(len(a)):
    dp[a[i]] = 0

for i in range(3,n+1):
    if dp[i] != 0:
        dp[i] = (dp[i-1] + dp[i-2]) % mod

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

import itertools
bit = list(itertools.product([0,1], repeat=n))

ans = []
for i in range(2 ** n):
    arr = list(bit[i])
    x = 0
    y = 0
    for j in range(len(arr)):
        if arr[j] == 1:
            x += v[j]
            y += c[j]
    ans.append(x-y)
print(max(ans))


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

count = 0
for i in range(n):
    if v[i] >= c[i]:
        count += v[i] - c[i]

print(count)
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = list(str(input()))


t = [0] * (n+1)
for i in range(n):
    if s[i] == 'A' and s[i+1] == 'C':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]
        

for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

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


t = [0] * (n+1)
for i in range(n):
    if s[i:i+2] == 'AC':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]

        
for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = list(str(input()))


t = [0] * (n+1)
for i in range(n):
    if s[i] == 'A' and s[i+1] == 'C':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]
        

for i in range(q):
    l, r = map(int,input().split())
    print(t[r-1] - t[l-1])

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


t = [0] * (n+1)
for i in range(n):
    if s[i:i+2] == 'AC':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]

        
for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

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


for i in range(q):
    l, r = map(int,input().split())
    subs = s[l-1:r]
    subs = ''.join(subs)
    print(subs.count('AC'))

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


t = [0] * (n+1)
for i in range(n):
    if s[i:i+2] == 'AC':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]

        
for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
Buggy python submission (verdict: Runtime Error):
arr = list(map(int,input()))
print(int(arr[0]*arr[1]*0.5))


Fixed submission:
arr = list(map(int,input().split()))
print(int(arr[0]*arr[1]*0.5))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
p = [0] * m
y = [0] * m

for i in range(m):
    p[i], y[i] = map(int, input().split())

arr = [[] * n for i in range(n)]
for i in range(m):
    arr[p[i]-1].append(y[i])

for i in range(len(arr)):
    arr[i].sort()


for i in range(m):
    tmp = arr[p[i]-1]
    index = 1
    for l in tmp:
        if l == y[i]:
            break
        else:
            index += 1
    s_p = str(p[i]).zfill(6)
    y_p = str(index).zfill(6)
    print(s_p + y_p)


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

arr = [[] for _ in range(n)] 

p = [0] * m
y = [0] * m

for i in range(m):
    p[i], y[i] = map(int, input().split())
    arr[p[i]-1].append(y[i])    

for i in range(n):
    arr[i].sort()

import bisect
for i in range(m):
    num = bisect.bisect_left(arr[p[i]-1], y[i]) + 1
    a = str(p[i])
    b = str(num)
    print(a.zfill(6) + b.zfill(6))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
p = [0] * m
y = [0] * m
dict = {}
for i in range(m):
    p[i], y[i] = map(int, input().split())

arr = [[] * n for i in range(n)]
for i in range(m):
    arr[p[i]-1].append(y[i])

for i in range(len(arr)):
    arr[i].sort()


for i in range(m):
    tmp = arr[p[i]-1]
    index = 1
    for j in range(len(tmp)):
        if tmp[j] == y[i]:
            break
        else:
            index += 1
    s_p = str(p[i]).zfill(6)
    y_p = str(index).zfill(6)
    print(s_p + y_p)


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

arr = [[] for _ in range(n)] 

p = [0] * m
y = [0] * m

for i in range(m):
    p[i], y[i] = map(int, input().split())
    arr[p[i]-1].append(y[i])    

for i in range(n):
    arr[i].sort()

import bisect
for i in range(m):
    num = bisect.bisect_left(arr[p[i]-1], y[i]) + 1
    a = str(p[i])
    b = str(num)
    print(a.zfill(6) + b.zfill(6))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
p = [0] * m
y = [0] * m
dict = {}
for i in range(m):
    p[i], y[i] = map(int, input().split())

arr = [[] * n for i in range(n)]
for i in range(m):
    arr[p[i]-1].append(y[i])

for i in range(len(arr)):
    arr[i].sort()


for i in range(m):
    tmp = arr[p[i]-1]
    index = 1
    for j in range(len(tmp)):
        if tmp[j] == y[i]:
            break
        else:
            index += 1
    s_p = str(p[i]).zfill(6)
    y_p = str(index).zfill(6)
    print(s_p + y_p)


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

arr = [[] for _ in range(n)] 

p = [0] * m
y = [0] * m

for i in range(m):
    p[i], y[i] = map(int, input().split())
    arr[p[i]-1].append(y[i])    

for i in range(n):
    arr[i].sort()

import bisect
for i in range(m):
    num = bisect.bisect_left(arr[p[i]-1], y[i]) + 1
    a = str(p[i])
    b = str(num)
    print(a.zfill(6) + b.zfill(6))
Buggy python submission (verdict: Runtime Error):
k = int(input())
if k % 2 == 0:
    print((k//2) * (k//2))
else:
    print((k//2) * (k//2+1))


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

flag = False
for c in range(1,4):
    if a*b*c % 2 == 1:
        flag = True

if flag:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

arr = []
for i in range(n):
    arr.append(a[i] - (i+1))

arr.sort()

ans = []

s = 0
b = arr[n//2]
for i in range(n):
    s += abs(a[i] - (b + (i+1)))
ans.append(s)

s = 0
b = arr[n//2 + 1]
for i in range(n):
    s += abs(a[i] - (b + (i+1)))
ans.append(s)

print(min(ans))

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

arr = []
for i in range(n):
    arr.append(a[i] - (i+1))

arr.sort()

ans = []

s = 0
b = arr[n//2]
for i in range(n):
    s += abs(a[i] - (b + (i+1)))
ans.append(s)

if n == 1:
    print(ans[0])
    exit()
    
s = 0
b = arr[n//2 + 1]
for i in range(n):
    s += abs(a[i] - (b + (i+1)))
ans.append(s)

print(min(ans))
Buggy python submission (verdict: Runtime Error):
c = 0
for i in range(len(s)):
    if s[i] == '+':
        c += 1
    else:
        c -= 1

print(c)


Fixed submission:
s = list(str(input()))
c = 0
for i in range(len(s)):
    if s[i] == '+':
        c += 1
    else:
        c -= 1

print(c)
Buggy python submission (verdict: Runtime Error):
arr = input().split()
arr = list(map(int, arr))

if a <= x and x <= a+b:
    print('YES')
else:
    print('NO')


Fixed submission:
arr = input().split()
arr = list(map(int, arr))
a = arr[0]
b = arr[1]
x = arr[2]

if a <= x and x <= a+b:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
     
ans=[]
     
for i in range(k):
    if a <= a+i <= b:
        ans.append(a+i)
    if a <= b-i <= b:    
        ans.append(b-i)
     
ans.sort(list(set(ans)))
     
for x in ans:
    print(x)


Fixed submission:
a,b,k = (int(i) for i in input().split())
x = set()
y = []
for i in range(a,min(b+1,a+k)):
    x.add(i)
for i in range(b,max(a-1,b-k),-1):
    x.add(i)
for i in x:
    y.append(i)
y.sort()
for ans in y:
    print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,k = map(int, input().split())

arr = []

x = list(range(a,b+1))

for i in range(k):
    arr.append(x[i])

for i in range(k):
    arr.append(x[-1-i])

arr = list(set(arr))

arr.sort()

for i in range(len(arr)):
    print(arr[i])


Fixed submission:
a,b,k = (int(i) for i in input().split())
x = set()
y = []
for i in range(a,min(b+1,a+k)):
    x.add(i)
for i in range(b,max(a-1,b-k),-1):
    x.add(i)
for i in x:
    y.append(i)
y.sort()
for ans in y:
    print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,k = map(int, input().split())

arr = []

whole = list(range(a,b+1))
arr = whole[:k] + whole[len(whole)-k:]
arr = list(set(arr))
arr.sort()
for i in range(len(arr)):
    print(arr[i])


Fixed submission:
a,b,k = (int(i) for i in input().split())
x = set()
y = []
for i in range(a,min(b+1,a+k)):
    x.add(i)
for i in range(b,max(a-1,b-k),-1):
    x.add(i)
for i in x:
    y.append(i)
y.sort()
for ans in y:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-
import sys

n, y = map(int,input().split())

a, b, c = 0, 0, 0

am = y // 10000
bm = y // 5000
cm = y // 1000

for i in range(am+1):
    for j in range(bm+1):
        if (9000*i + 4000*j + 1000*n == y) and (n-i-j >= 0):
            print(i, j ,n-i-j)
            sys.exit()
        if (y - 1000*n - 4000*j < 0):
            break

print(-1,-1,-1)


Fixed submission:
# -*- coding:utf-8 -*-
import sys

n, y = map(int,input().split())

a, b, c = 0, 0, 0

am = y // 10000
bm = y // 5000
cm = y // 1000

for i in range(am+1):
    for j in range(bm+1):
        if (9000*i + 4000*j + 1000*n == y) and (n-i-j >= 0):
            print(i, j ,n-i-j)
            sys.exit()
        if (y - 1000*n - 4000*j < 0):
            break
        if (n-i-j < 0):
            break

print(-1,-1,-1)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-

n, y = map(int,input().split())

a, b, c = 0, 0, 0

am = y // 10000
bm = y // 5000
cm = y // 1000

flag = 0
for i in range(am+1):
    if flag == 1:
        break
    for j in range(bm+1):
        if flag == 1:
            break
        if (9000*i + 4000*j + 1000*n == y) and (n-i-j >= 0):
            print(i, j ,n-i-j)
            flag = 1

if flag == 0:
    print(-1,-1,-1)


Fixed submission:
# -*- coding:utf-8 -*-
import sys

n, y = map(int,input().split())

a, b, c = 0, 0, 0

am = y // 10000
bm = y // 5000
cm = y // 1000

for i in range(am+1):
    for j in range(bm+1):
        if (9000*i + 4000*j + 1000*n == y) and (n-i-j >= 0):
            print(i, j ,n-i-j)
            sys.exit()
        if (y - 1000*n - 4000*j < 0):
            break
        if (n-i-j < 0):
            break

print(-1,-1,-1)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-

n, y = map(int,input().split())

a, b, c = 0, 0, 0

am = y // 10000
bm = y // 5000
cm = y // 1000

flag = 0
for i in range(am+1):
    if flag == 1:
        break
    for j in range(bm+1):
        if flag == 1:
            break
        for k in range(cm+1):
            if (10000*i + 5000*j + 1000*k == y) and (i + j + k == n):
                print(i, j ,k)
                flag = 1
                break

if flag == 0:
    print(-1,-1,-1)


Fixed submission:
# -*- coding:utf-8 -*-
import sys

n, y = map(int,input().split())

a, b, c = 0, 0, 0

am = y // 10000
bm = y // 5000
cm = y // 1000

for i in range(am+1):
    for j in range(bm+1):
        if (9000*i + 4000*j + 1000*n == y) and (n-i-j >= 0):
            print(i, j ,n-i-j)
            sys.exit()
        if (y - 1000*n - 4000*j < 0):
            break
        if (n-i-j < 0):
            break

print(-1,-1,-1)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-

n, h = map(int, input().split())
a = []
b = []

for i in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)

a.sort()
b.sort()

x = a[-1]

count = 0
while(h > 0):    
    if b[-1] > x:
        h -= b.pop()
        count += 1;
        if not b:
            b.append(-100)
    else:
        if a[-1] == 1:
            count += h
            break
        else:
            h -= a[-1]
            count += 1;

print(count)


Fixed submission:
# -*- coding:utf-8 -*-

n, h = map(int, input().split())
a = []
b = []

for i in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)

a.sort()
b.sort()

x = a[-1]

count = 0
while(h > 0):    
    if b[-1] > x:
        h -= b.pop()
        count += 1;
        if not b:
            b.append(-100)
    else:
        #h -= a[-1]
        #count += 1;
        count += (h // a[-1])
        h -= a[-1] * (h//a[-1])
        break
if h > 0:
    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())

a.sort()

checked = []
ans = 0
for i in range(n):
    count = 0
    if not a[i] in checked:
        for j in range(i,n):
            if a[j] == a[i]:
                count += 1
            else:
                break
        if count % 2 == 0:
            pass
        else:
            ans += 1
        checked.append(a[i])
print(ans)


Fixed submission:
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())

a.sort()

pre = 0
ans = 0
for i in range(n):
    count = 0
    if a[i] != pre:
        for j in range(i,n):
            if a[j] == a[i]:
                count += 1
            else:
                break
        if count % 2 == 0:
            pass
        else:
            ans += 1
        pre = a[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
a = list(map(int,a))

arr = []
for x in range(10**5):
    count = 0
    for i in range(n):
        if a[i] == x-1 or a[i] == x or a[i] == x+1:
            count += 1
    arr.append(count)

print(max(arr))


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

arr = [0] * (10**5 + 2)
for i in range(n):
    arr[a[i]] += 1
ans = []
for x in range(1,10**5):
    ans.append(arr[x-1] + arr[x] + arr[x+1])

print(max(ans))
Buggy python submission (verdict: Runtime Error):
#! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())

if a % 2 == 0 and b % 2 == 0 and c % 2 == 1:
    print('NO')    
elif a % 2 == 1 and b % 2 == 0 and c %2 == 0:
    print('NO')
elif c == 0:
    print('YES')
elif a == 1:
    print('YES')
elif a % 2 == 0 and b % 2 == 1 and c % 2 = 1:
    print('NO')
#elif a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
#    if a % b == 0:
#        if (c/2) % (a/b) == 0:
#            print('YES')
#        else:
#            print('NO')
#    else:
#        print('YES')
else:
    print('YES')


Fixed submission:
arr = input().split()
arr = list(map(int,arr))
a = arr[0]
b = arr[1]
c = arr[2]

flag = False
for k in range(a,b*a+1):
    if (k*a) % b == c:
        flag = True

if flag == True:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
#! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())

if a % 2 == 0 and b % 2 == 0 and c % 2 == 1:
    print('NO')    
elif a % 2 == 1 and b % 2 == 0 and c %2 == 0:
    print('NO')
elif a == 1:
    print('YES')
elif a % 2 ==0 and b % 2 == 0 and a >= c:
    pritn('NO')
else:
    print('YES')


Fixed submission:
arr = input().split()
arr = list(map(int,arr))
a = arr[0]
b = arr[1]
c = arr[2]

flag = False
for k in range(a,b*a+1):
    if (k*a) % b == c:
        flag = True

if flag == True:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
#! -*- coding:utf-8 -*-
import math
import sys
a,b,c = map(int,input().split())
x = b - a
y = c - b
if x/y == 1:
    print('YES')
else:
    print('NO')


Fixed submission:
#! -*- coding:utf-8 -*-
import math
import sys
a,b,c = map(int,input().split())
x = b - a
y = c - b
if x == y:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
#! -*- coding:utf-8 -*-
O = str(input())
E = str(input())
O = list(O)
E = list(E)
n = 0
arr = []
for i in range(len(O)*2):
    if n % 2 == 0:
        arr.append(O.pop(0))
    else:
        arr.append(E.pop(0))
    n += 1
    
for i in range(len(arr)-1):
    print(arr[i],end = '')
print(arr[-1])


Fixed submission:
#! -*- coding:utf-8 -*-
O = str(input())
E = str(input())
O = list(O)
E = list(E)
n = 0
arr = []
for i in range(len(O)*2):
    if n % 2 == 0:
        try:
            arr.append(O.pop(0))
        except:
            pass
    else:
        try:
            arr.append(E.pop(0))
        except:
            pass        
    n += 1
try:
    arr.append(O.pop(0))
except:
    pass

for i in range(len(arr)-1):
    print(arr[i],end = '')

print(arr[-1])
Buggy python submission (verdict: Runtime Error):
arr = input().split()
arr = list(map(str,arr))
if a == 'H' and b == 'H':
    print('H')
elif a == 'D' and b == 'H':
    print('D')
elif a == 'D' and b == 'D':
    print('H')
elif a == 'H' and b == 'D':
    print('D')


Fixed submission:
arr = input().split()
arr = list(map(str,arr))
a = arr[0]
b = arr[1]
if a == 'H' and b == 'H':
    print('H')
elif a == 'D' and b == 'H':
    print('D')
elif a == 'D' and b == 'D':
    print('H')
elif a == 'H' and b == 'D':
    print('D')
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
m = 10**9+7
sum = 1
for i in range(2,n+1):
    sum *= (i%m)

print(sum%m)

Fixed submission:
import math

def range_prod(lo,hi):
    if lo+1 < hi:
        mid = (hi+lo)//2
        return range_prod(lo,mid) * range_prod(mid+1,hi)
    if lo == hi:
        return lo
    return lo*hi

def treefactorial(n):
    if n < 2:
        return 1
    return range_prod(1,n)
n = int(input())
m = 10**9+7
print(treefactorial(n%m)%m)