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

mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    ones = 0
    for a in A:
        # 数列Aの全要素の(二進法表記の)i桁目の１の数を集計する
        if a & (1 << i):
            ones += 1
    # Aの要素から任意の2つを選んで排他的論理和をとってできた数列をBとすると、
    # 数列Bの全要素のi桁目の合計は、(Aのi桁目の１の数)*(0の数)となる
    # 選んだ２つのAの要素が(0,1)の組み合わせになっている場合(XOR)だけに、Bの桁を構成する要素になるため
    ans = (ans + ones * (N - ones) * (1 << i)) % mod

print(ans)


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

mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    ones = 0
    for a in A:
        # 数列Aの全要素の(二進法表記の)i桁目の１の数を集計する
        if a & (1 << i):
            ones += 1
    # Aの要素から任意の2つを選んで排他的論理和をとってできた数列をBとすると、
    # 数列Bの全要素のi桁目の合計は、(Aのi桁目の１の数)*(0の数)となる
    # 選んだ２つのAの要素が(0,1)の組み合わせになっている場合(XOR)だけに、Bの桁を構成する要素になるため
    ans = (ans + ones * (N - ones) * (1 << i)) % mod

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    ones = 0
    for a in A:
        # 数列Aの全要素の(二進法表記の)i桁目の１の数を集計する
        if a & (1 << i):
            ones += 1
    # Aの要素から任意の2つを選んで排他的論理和をとってできた数列をBとすると、
    # 数列Bの全要素のi桁目の合計は、(Aのi桁目の１の数)*(0の数)となる
    # 選んだ２つのAの要素が(0,1)の組み合わせになっている場合(XOR)だけに、Bの桁を構成する要素になるため
    ans = (ans + ones * (N - ones) * (1 << i)) % mod

print(ans)


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

mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    ones = 0
    for a in A:
        # 数列Aの全要素の(二進法表記の)i桁目の１の数を集計する
        if a & (1 << i):
            ones += 1
    # Aの要素から任意の2つを選んで排他的論理和をとってできた数列をBとすると、
    # 数列Bの全要素のi桁目の合計は、(Aのi桁目の１の数)*(0の数)となる
    # 選んだ２つのAの要素が(0,1)の組み合わせになっている場合(XOR)だけに、Bの桁を構成する要素になるため
    ans = (ans + ones * (N - ones) * (1 << i)) % mod

print(ans)
Buggy python submission (verdict: Runtime Error):
al = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N = int(input())
S = list(input())

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c <= 25:
      S[i] = al[c]
  else:
      S[i] = al[c-25]
      
print("".join(S))

Fixed submission:
al = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N = int(input())
S = list(input())

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c <= 25:
      S[i] = al[c]
  else:
      S[i] = al[c-26]
      
print("".join(S))

Buggy python submission (verdict: Runtime Error):
al = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N = int(input())
S = list(input())

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c < 25:
      S[i] = al[c]
  else:
      S[i] = al[c-25]
      
print("".join(S))

Fixed submission:
al = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N = int(input())
S = list(input())

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c <= 25:
      S[i] = al[c]
  else:
      S[i] = al[c-26]
      
print("".join(S))

Buggy python submission (verdict: Runtime Error):
al = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N = int(input())
S = list(input())

for i in S:
  x = al.index(S[i])
  c = x+N
  if c < 25:
      S[i] = al[c]
  else:
      S[i] = al[c-25]
      
print(S)

Fixed submission:
al = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N = int(input())
S = list(input())

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c <= 25:
      S[i] = al[c]
  else:
      S[i] = al[c-26]
      
print("".join(S))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

total = sum(a)

ans = float("INF")
for i in range(n-1):
    former = sum(a[:i+1])
    ans = min(ans, abs(former - (total - former)))
print(ans)

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

a = list(itertools.accumulate(a))

target = a[-1]
for i in a:
    target = min(abs(a[-1] - i * 2), target)

print(target)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = [0]*n

for i in range(n):
  b[i] = a.index(i+1)+1
  
  
print(*b)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
d=[0]*n
for i,val in enumerate(l):
  d[val-1]=i+1
print(*d)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = [0]*n

for i in range(n):
  b[i] = a.index(i+1)+1
  
  
print(" ".join(map(str, b)))

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
d=[0]*n
for i,val in enumerate(l):
  d[val-1]=i+1
print(*d)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = [0]*n

for i in range(1, n+1):
  b[i-1] = a.index(i)+1
  
  
print(*b)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
d=[0]*n
for i,val in enumerate(l):
  d[val-1]=i+1
print(*d)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = [0]*n

for i in range(1, n+1):
  b[i-1] = a.index(i)+1
  
  
print(" ".join(map(str, b)))

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
d=[0]*n
for i,val in enumerate(l):
  d[val-1]=i+1
print(*d)

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

for i in range(1, n+1):
  b.append(a.index(i)+1)
  
  
print(" ".join(map(str, b)))

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
d=[0]*n
for i,val in enumerate(l):
  d[val-1]=i+1
print(*d)
Buggy python submission (verdict: Runtime Error):
s = input()
l = ["Sunny", "Cloudy", "Rainy"]

print(l[l.index(s)+1])

Fixed submission:
s = input()
l =["Sunny", "Cloudy", "Rainy", "Sunny"]

print(l[l.index(s)+1])
Buggy python submission (verdict: Runtime Error):
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k-q]*n

for i in range(q):
    p[a[i]] += 1

      
for n in p:
  if n>0:
    print("Yes")
  else:
    print("No")

Fixed submission:
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k-q]*n

for i in range(q):
    p[a[i]-1] += 1
    
for n in p:
  if n>0:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
m = 0
 
for i in range(n):
  m += b[a[i]-1]
  if i==0:
    continue
  if a[i] == a[i-1]+1:
    m += c[i]
    
print(m)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
m = 0
 
for i in range(n):
  m += b[a[i]-1]
  if i==0:
    continue
  if a[i] == a[i-1]+1:
    m += c[a[i]-2]
    
print(m)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
ans = []

for i in range(n-1):
    if h[i]>=h[i+1]:
        ans.append(1)
    else:
        ans.append(0)

count = 0
s = []
for i in range(len(ans)):
    if ans[i]==1:
        count += 1
    else:
        s.append(count)
        count = 0
        continue
    s.append(count)

print(max(s))

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
ans = []

for i in range(n-1):
    if h[i]>=h[i+1]:
        ans.append(1)
    else:
        ans.append(0)

count = 0
s = []
for i in range(len(ans)):
    if ans[i]==1:
        count += 1
    else:
        s.append(count)
        count = 0
        continue
    s.append(count)

if s:
    print(max(s))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
num = 0
now = 0
ans = []

for i in range(n-1):
    now = h[i]
    for j in range(i+1, n):
      if now >= h[j]:
        now = h[j]
        num += 1
      else:
        continue
    ans.append(num)
    num = 0

print(max(ans))

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
ans = []

for i in range(n-1):
    if h[i]>=h[i+1]:
        ans.append(1)
    else:
        ans.append(0)

count = 0
s = []
for i in range(len(ans)):
    if ans[i]==1:
        count += 1
    else:
        s.append(count)
        count = 0
        continue
    s.append(count)

if s:
    print(max(s))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

l = [i for i in range(n)]

print(sum(l))

Fixed submission:
n = int(input())

print((n-1) * (n - 1 + 1) // 2)
Buggy python submission (verdict: Runtime Error):
from collections import deque
N, Q = map(int, input().split())
G = [[] * N]
for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

count = [0] * N
for j in range(Q):
    p, x = map(int, input().split())
    count[p-1] += x

visited = [False] * N
que = deque([0])

while que:
    now = que.pop()
    visited[now] = True
    for nxt in G[now]:
        if visited[nxt]:
            continue
        count[nxt] += count[now]
        que.appendleft(nxt)

print(*count)

Fixed submission:
from collections import deque
N, Q = map(int, input().split())
G = [[] for _ in range(N)]
count = [0] * N
for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

for j in range(Q):
    p, x = map(int, input().split())
    count[p-1] += x

que = deque([0])
flag = [False] * N

while que:
    v = que.pop()
    flag[v] = True
    for e in G[v]:
        if flag[e]:
            continue
        count[e] += count[v]
        que.appendleft(e)

print(*count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]

m = max(a)

for i in range(n):
  if a[i]!=m:
    print(m)
  else:
    ans = max([x for j, x in enumerate(a) if j!=i])
    print(ans)

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

b = sorted(a, reverse=True)

for i in range(n):
    if a[i] == b[0]:
        print(b[1])
    else:
        print(b[0])

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]

m = max(a)

for i in range(n):
  if a[i]!=m:
    print(m)
  else:
    print(max([j for j in a if index(j)==i ]))

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

b = sorted(a, reverse=True)

for i in range(n):
    if a[i] == b[0]:
        print(b[1])
    else:
        print(b[0])
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input.split())

print(min(n*a, b))

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

print(min(n*a, b))
Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())

ans = 2019
for i in range(l, r):
    for j in range(l+1, r+1):
        if ans == 0:
            break
        ans = min(ans, (i * j) % 2019)
print(ans)

Fixed submission:
l, r = map(int, input().split())

ans = 2019
if r - l >= 2019:
    print(0)
    exit()
else:
    for i in range(l, r):
        for j in range(i+1, r+1):
            ans = min(ans, (i*j)%2019)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=int(input())

for i in range(3):
  if s[i] == s[i+1]:
    print("Bad")
    exit()
else:
  print("Good")

Fixed submission:
s=input()

for i in range(3):
  if s[i] == s[i+1]:
    print("Bad")
    exit()
else:
  print("Good")
Buggy python submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())

print(b - b//c - b//d + b//((c*d)//math.gcd(c, d)) - (a-1 - (a-1)//c - (a-1)//d + (a-1)//((c*d)//math.gcd(c, d))))

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

c_count = b//c
d_count = b//d
# 最小公倍数で割る
c_d = b//(c*d//gcd(c, d))

print(b - c_count - d_count + c_d - (a-1 - (a-1)//c - (a-1)//d + (a-1)//(c*d//gcd(c, d))))

Buggy python submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())

c_count = b//c
d_count = b//d
# 最小公倍数で割る
c_d = b//(c*d//math.gcd(c, d))

print(b - c_count - d_count + c_d - (a-1 - (a-1)//c - (a-1)//d + (a-1)//(c*d//math.gcd(c, d))))

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

c_count = b//c
d_count = b//d
# 最小公倍数で割る
c_d = b//(c*d//gcd(c, d))

print(b - c_count - d_count + c_d - (a-1 - (a-1)//c - (a-1)//d + (a-1)//(c*d//gcd(c, d))))

Buggy python submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())

c_count = b//c
d_count = b//d
# 最小公倍数で割る
c_d = b//(c*d//math.gcd(c, d))

print(b - c_count - d_count + c_d - (a-1 - (a-1)//c - (a-1)//d + (a-1)//(c*d//math.gcd(c, d))))

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

c_count = b//c
d_count = b//d
# 最小公倍数で割る
c_d = b//(c*d//gcd(c, d))

print(b - c_count - d_count + c_d - (a-1 - (a-1)//c - (a-1)//d + (a-1)//(c*d//gcd(c, d))))
Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())

cnt = 0
for i in range(-(-n // r)+1):
    for j in range(-(-n // g)+1):
        if (n-i*r-j*g) % b == 0 and (n-i*r-j*g) // b >= 0:
            cnt += 1

print(cnt)

Fixed submission:
r, g, b, n = map(int, input().split())

cnt = 0
for i in range(3001):
    for j in range(3001):
        if (n-i*r-j*g) % b == 0 and (n-i*r-j*g) // b >= 0:
            cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
from functools import reduce
from operator import mul
N = int(input())


def factorization(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


A = factorization(N)
l = []
for a in A:
    l += [a[0]] * a[1]

ans = 0
for i in range(1, len(l)+1):
    for s in set(combinations(l, i)):
        r = reduce(mul, s) - 1
        if r == 0:
            continue
        if N // r == N % r:
            ans += r

print(ans)

Fixed submission:
N = int(input())


def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


A = divisor(N)
A = [i - 1 for i in A]

ans = 0
for a in A:
    if a == 0:
        continue
    if N // a == N % a:
        ans += a

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

ac = [0] * n
for i in range(n):
    ac[i] = s[:i+1].count("AC")

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

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

ac = [0] * n
for i in range(n-1):
    if s[i] == "A":
        if s[i+1] == "C":
            ac[i+1] = 1
i = itertools.accumulate(ac)
ac = list(i)

for j in range(q):
    l, r = map(int, input().split())
    l, r = l-1, r-1
    print(ac[r] - ac[l])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
origin = len(s)

for i in range(origin//2):
    s = s.replace("01", "")
    s = s.replace("10", "")

print(origin - len(s))

Fixed submission:
s = input()

c0 = s.count("0")
c1 = s.count("1")

print(min(c0, c1)*2)
Buggy python submission (verdict: Runtime Error):
a, b c = map(int, input().split())

print(a*b // 2)

Fixed submission:
a, b, c = map(int, input().split())
 
print(a*b // 2)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

count = 0
for i,c in enumerate(s):
    if c == "W":
        count += s[:i+1].count("B")

print(count)

Fixed submission:
s = input()

ans = 0
b_count = 0
for i,c in enumerate(s):
    if c == "W":
        ans += b_count
    else:
        b_count += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(int(input()) for _ in range(n))

h.sort()

m = 10 ** 9
for i in range(n-2):
    temp = h[i+k-1] - h[i]
    m = min(m, temp)

print(m)

Fixed submission:
n, k = map(int, input().split())
h = list(int(input()) for _ in range(n))

h.sort()

m = 10 ** 9
for i in range(n-k+1):
    temp = h[i+k-1] - h[i]
    m = min(m, temp)

print(m)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
v = [[] for _ in range(10**5+1)]
cities = []

for _ in range(M):
    p, y = map(int, input().split())
    cities.append([p, y])
    v[p].append(y)

for i in v:
    i.sort()

for p, y in cities:
    num = v[p].index(y) + 1
    ans = format(str(p), "0>6") + format(str(num), "0>6")
    print(ans)


Fixed submission:
N, M = map(int, input().split())
V = [[] for _ in range(N)]
ans = [0] * M

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

for i, v in enumerate(V, start=1):
    v.sort()
    for k, (y, j) in enumerate(v, start=1):
        ans[j] = format(str(i), "0>6") + format(str(k), "0>6")

for a in ans:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
v = [[] for _ in range(10**5+1)]
cities = []

for _ in range(M):
    p, y = map(int, input().split())
    cities.append([p, y])
    v[p].append(y)

for i in v:
    i.sort()

for p, y in cities:
    num = v[p].index(y) + 1
    ans = format(str(p), "0>6") + format(str(num), "0>6")
    print(ans)


Fixed submission:
N, M = map(int, input().split())
V = [[] for _ in range(N)]
ans = [0] * M

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

for i, v in enumerate(V, start=1):
    v.sort()
    for k, (y, j) in enumerate(v, start=1):
        ans[j] = format(str(i), "0>6") + format(str(k), "0>6")

for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())

while True:
  s = str(n)
  if s.count(s[0])==len(s):
    print(m)
    exit()
  else:
    n += 1

Fixed submission:
n = int(input())
 
while True:
  s = str(n)
  if s.count(s[0])==len(s):
    print(n)
    exit()
  else:
    n += 1
Buggy python submission (verdict: Runtime Error):
import numpy as np
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

a = np.array(a).reshape(h, w)
for i, v in enumerate(a):
    if "#" not in v:
        a = np.delete(a, i, 0)

a = np.rot90(a)
for i, v in enumerate(a):
    if "#" not in v:
        a = np.delete(a, i, 0)

a = np.rot90(a, 3)
for i in a:
    print(*i)

Fixed submission:
h, w = map(int, input().split())
a = list(input() for i in range(h))

a = list(zip(*[i for i in a if "#" in i]))
a = list(zip(*[i for i in a if "#" in i]))

for i in a:
    print("".join(i))
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

for i, v in enumerate(s):
  if i == k:

if s[0] != 1:
  print(s[0])
elif k != 1:
  print(s[1])
else:
  print("1")

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

for i, v in enumerate(s):
  if i == k-1:
      print(v)
      exit()
  elif v != "1": 
      print(v)
      exit()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(int, input().split())

print(sum(a)-n)

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

print(sum(a)-n)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split())

print(max(a) - min(a))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
print(max(a) - min(a))
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
a = list(map(int, input().split()))


def trial_division(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    if not factor:
        return [n]
    else:
        factor.append(n)
        return factor


count = 0
for i in a:
    temp = trial_division(i)
    count += temp.count(2)

print(count)

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


def trial_division(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for _ in range(2,tmp):
        while n % 2 == 0:
            n //= 2
            factor.append(2)
    if not factor:
        return [n]
    else:
        factor.append(n)
        return factor


count = 0
for i in a:
    temp = trial_division(i)
    count += temp.count(2)

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
x_sorted = sorted(x)

cs = x_sorted[n // 2 - 1]
cb = x_sorted[n // 2]

for i, v in enumerate(x):
    if x_sorted.index(v) < n // 2:
        print(cb)
    else:
        print(cs)


Fixed submission:
n = int(input())
x = list(map(int, input().split()))
x_sorted = sorted(x)

cs = x_sorted[n // 2 - 1]
cb = x_sorted[n // 2]

for i, v in enumerate(x):
    if v <= cs:
        print(cb)
    else:
        print(cs)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

l = [i for i in range(a, b+1)]

if b - a < k*2:
    for i in l:
        print(i)
else:
    for i in l[:k]:
        print(i)
    for i in l[-k:]:
        print(i)

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

if b - a < k*2:
    for j in [i for i in range(a, b+1)]:
        print(j)
else:
    for j in [i for i in range(a, a+k)]:
        print(j)
    for j in [i for i in range(b-k+1, b+1)]:
        print(j)

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

l = [i for i in range(a, b+1)]
l = sorted(set(l[:k] + l[-k:]))

for i in l:
  print(i)

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

if b - a < k*2:
    for j in [i for i in range(a, b+1)]:
        print(j)
else:
    for j in [i for i in range(a, a+k)]:
        print(j)
    for j in [i for i in range(b-k+1, b+1)]:
        print(j)
Buggy python submission (verdict: Runtime Error):
import statistics
a, b, c = map(int, input().split())

mn = min(a, b, c)
md = statistics.median([a, b, c])
mx = max(a, b, c)

if (md - mn) % 2 == 0:
    print((md - mn) // 2 + (mx - md))
else:
    print((md+1) // mn + (mx - 2 - md) + 2)

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

l.sort()

count = 0
while l[2] - l[0] > 1:
    l[0] += 2
    count += 1
    l.sort()

if l[2] == l[1] != l[0]:
    count += 2
elif l[0] == l[1] != l[2]:
    count += 1

print(count)

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

mn = min(a, b, c)
md = statistics.median([a, b, c])
mx = max(a, b, c)

if (md - mn) % 2 == 0:
    print((md - mn) // 2 + (mx - md))
else:
    print((md+1) // mn + (mx - 2 - md) + 2)

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

l.sort()

count = 0
while l[2] - l[0] > 1:
    l[0] += 2
    count += 1
    l.sort()

if l[2] == l[1] != l[0]:
    count += 2
elif l[0] == l[1] != l[2]:
    count += 1

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

print("Even" if a*b%==0 else "Odd")

Fixed submission:
a, b = map(int, input().split())
 
print("Even" if a*b%2==0 else "Odd")
Buggy python submission (verdict: Runtime Error):
n = str(input())

if s[0]==s[1]==s[2] or s[1]==s[2]==s[3]:
  print("Yes")
else:
  print("No")

Fixed submission:
n = str(input())
 
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

cnt = 0
for a in A:
    index_b = bisect.bisect_right(B, a)
    for b in B[index_b:]:
        index_c = bisect.bisect_right(C, b)
        cnt += n-index_c

print(cnt)

Fixed submission:
import bisect
n = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

cnt = 0
for b in B:
    index_a = bisect.bisect_left(A, b)
    index_c = bisect.bisect_right(C, b)
    cnt += index_a * (n - index_c)

print(cnt)
Buggy python submission (verdict: Runtime Error):
s = input()

if s[:4] == "YAKI"
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()

if s[:4] == "YAKI":
    print("Yes")
else:
    print("No")