Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
Q = int(input())
query = [input().split() for _ in range(Q)]
reverse = False
for q in query:
    if q[0] == '1':
        reverse = not reverse
    else:
        if q[1] == '1':
            S.append(q[2]) if reverse else S.insert(0, q[2])
        else:
            S.insert(0, q[2]) if reverse else S.append(q[2])
if reverse:
    S.reverse()
print(''.join(S))


Fixed submission:
from collections import deque
S = deque(input())
Q = int(input())
query = [input().split() for _ in range(Q)]
reverse = False
for q in query:
    if q[0] == '1':
        reverse = not reverse
    else:
        if q[1] == '1':
            if not reverse:
                S.appendleft(q[2])
            else:
                S.append(q[2])
        else:
            if not reverse:
                S.append(q[2])
            else:
                S.appendleft(q[2])
if reverse:
    S.reverse()
print(''.join(S))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

S = deque(input())
Q = int(input())
query = [input().split() for _ in range(Q)]
for q in query:
    if q[0] == '1':
        S.reverse()
    else:
        if q[1] == '1':
            S.appendleft(q[2])
        else:
            S.append(q[2])

print(''.join(S))


Fixed submission:
from collections import deque
S = deque(input())
Q = int(input())
query = [input().split() for _ in range(Q)]
reverse = False
for q in query:
    if q[0] == '1':
        reverse = not reverse
    else:
        if q[1] == '1':
            if not reverse:
                S.appendleft(q[2])
            else:
                S.append(q[2])
        else:
            if not reverse:
                S.append(q[2])
            else:
                S.appendleft(q[2])
if reverse:
    S.reverse()
print(''.join(S))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

S = deque(input())
Q = int(input())
query = [input().split() for _ in range(Q)]
for q in query:
    if q[0] == '1':
        S.reverse()
    else:
        if q[1] == '1':
            S.appendleft(q[2])
        else:
            S.append(q[2])

print(''.join(S))

Fixed submission:
from collections import deque
S = deque(input())
Q = int(input())
query = [input().split() for _ in range(Q)]
reverse = False
for q in query:
    if q[0] == '1':
        reverse = not reverse
    else:
        if q[1] == '1':
            if not reverse:
                S.appendleft(q[2])
            else:
                S.append(q[2])
        else:
            if not reverse:
                S.append(q[2])
            else:
                S.appendleft(q[2])
if reverse:
    S.reverse()
print(''.join(S))
Buggy python submission (verdict: Runtime Error):
A = []
[A.extend(map(int, input().split())) for _ in range(3)]
_, *B = map(int, open(0).read().split())
for b in B:
    try:
        i = A.index(b)
        A[i] = 0
    except:
        pass
lines = [
    [0, 1, 2],
    [3, 4, 5],
    [6, 7, 8],
    [0, 3, 6],
    [1, 4, 7],
    [2, 5, 8],
    [0, 4, 8],
    [2, 4, 6],
]
ans = "No"
for line in lines:
    a, b, c = line
    if A[a] == 0 and A[a] == A[b] and A[a] == A[c]:
        ans = "Yes"
print(ans)


Fixed submission:
A = []
[A.extend(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
for b in B:
    try:
        i = A.index(b)
        A[i] = 0
    except:
        pass
lines = [
    [0, 1, 2],
    [3, 4, 5],
    [6, 7, 8],
    [0, 3, 6],
    [1, 4, 7],
    [2, 5, 8],
    [0, 4, 8],
    [2, 4, 6],
]
ans = "No"
for line in lines:
    a, b, c = line
    if A[a] == 0 and A[a] == A[b] and A[a] == A[c]:
        ans = "Yes"
print(ans)

Buggy python submission (verdict: Runtime Error):
A = []
[A.extend(map(int, input().split())) for _ in range(3)]
_, *B = map(int, open(0).read().split())
for b in B:
    try:
        i = A.index(b)
        A[i] = 0
    except Exception:
        pass
lines = [
    [0, 1, 2],
    [3, 4, 5],
    [6, 7, 8],
    [0, 3, 6],
    [1, 4, 7],
    [2, 5, 8],
    [0, 4, 8],
    [2, 4, 6],
]
ans = "No"
for line in lines:
    a, b, c = line
    if A[a] == 0 and A[a] == A[b] and A[a] == A[c]:
        ans = "Yes"
print(ans)


Fixed submission:
A = []
[A.extend(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
for b in B:
    try:
        i = A.index(b)
        A[i] = 0
    except:
        pass
lines = [
    [0, 1, 2],
    [3, 4, 5],
    [6, 7, 8],
    [0, 3, 6],
    [1, 4, 7],
    [2, 5, 8],
    [0, 4, 8],
    [2, 4, 6],
]
ans = "No"
for line in lines:
    a, b, c = line
    if A[a] == 0 and A[a] == A[b] and A[a] == A[c]:
        ans = "Yes"
print(ans)
Buggy python submission (verdict: Runtime Error):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    A -= 1
else:
    B -= 1
print(f'{A} {B}')

Fixed submission:
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    A -= 1
else:
    B -= 1
print('{} {}'.format(A, B))
Buggy python submission (verdict: Runtime Error):
from math import gcd
a,b=map(int,input().split())
print(a*b//gcd(a,b))

Fixed submission:
from fractions import gcd
a,b=map(int,input().split())
print(a*b//gcd(a,b))
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = input()

if a >= 3200:
    print(s)
else
    print("red")


Fixed submission:
a = int(input())
s = input()
print(s if a >= 3200 else "red")

Buggy python submission (verdict: Runtime Error):
a = input("a: ")
s = input("s: ")

if a >= 3200:
  print(s)
else
  print("red")


Fixed submission:
a = int(input())
s = input()
print(s if a >= 3200 else "red")
Buggy python submission (verdict: Runtime Error):
x = input().split()
N = int(x[0])
M = int(x[1])
w = []
v = [] 
for i in range(N):
    temp = input().split()
    w.append(int(temp[0]))
    v.append(int(temp[1]))

mem = [-1] * (M+1)

def maxVal(i,C):
            # index i, capacity C
    if mem[C] == -1:
        if i == N:
            return 0
        else:
            skip = maxVal(i+1,C)
            if w[i] <= C:   # w[i] does not exceed capacity
                take = v[i] + maxVal(i+1,C-w[i])
            else:
                take = -1
            mem[C] =  max(skip, take)
    return mem[C]
    

print(maxVal(0,M))

Fixed submission:

class obj:
    def __init__(self,w,v):
        self.w = w
        self.v = v
        self.r = v/w

x = input().split()
N = int(x[0])
M = int(x[1])
item = []
item = []
for i in range(N):
    x = input().split()
    item.append(obj(int(x[0]),int(x[1])))

maxV = 0


def getKey(x):
    return x.r


item.sort(key=getKey, reverse=True)
	
def Bound(i, C):	# object i -> n-1, capacity = C
    global item, N
    
    sw = 0
    sv = 0
    j = i
    f = 1.0
    while j < N and f == 1.0:
        wj = min(C-sw, item[j].w)
        f = float(wj)/item[j].w
        sw += f*item[j].w
        sv += f*item[j].v
        j += 1
    return sv



def dfsv4(i, sumW, sumV):
    """prning bounding, branching"""
    global maxV, item, N, M
    if i == N:
        if sumW <= M:
            maxV = max(maxV, sumV)
    else:   
        temp1 = Bound(i+1, M-sumW) + sumV
        temp2 = Bound(i,M-sumW) + sumV
        is1 = False

        if temp1 > temp2:
            is1 = True

        if is1:
            if temp1 > maxV:
                dfsv4(i+1, sumW, sumV)
            if sumW + item[i].w <= M:
                if temp2 > maxV:
                    dfsv4(i+1, sumW+item[i].w, sumV+item[i].v)
        else:
            if sumW + item[i].w <= M:
                if temp2 > maxV:
                    dfsv4(i+1, sumW+item[i].w, sumV+item[i].v)
            if temp1 > maxV:
                dfsv4(i+1, sumW, sumV)


dfsv4(0,0,0)

print(maxV)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

n = int(input())
counts = defaultdict(int)

for _ in range(n):
    counts[input().strip()] += 1

vec = sorted([(-value, key) in counts.items()], reverse=True)
best = vec[0][0]
for v, s in vec:
    if v != best:
        break
    print(s)


Fixed submission:
from collections import defaultdict

n = int(input())
counts = defaultdict(int)

for _ in range(n):
    counts[input().strip()] += 1

vec = sorted([(value, key) for key, value in counts.items()])
best = vec[-1][0]
keys = sorted([key for value, key in vec if value == best])
for key in keys:
    print(key)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().strip().split())

h, w = 100, 100
lines = []

orig_a = a

while a > 50:
    lines.append(list(".#" * 50))
    lines.append(list("#" * 100))
    a -= 50

if a > 1:
    left = ".#" * (a - 1)
    right = "#" * (100 - len(left))
    lines.append(list(left + right))
    lines.append(list("#" * 100))

while len(lines) < 100:
    lines.append(list("." * 100))

if orig_a != 1:
    b -= 1
cl = 99

while b > 49:
    for i in xrange(50):
        lines[cl][2 * i] = "#"
    b -= 50
    cl -= 2

if b > 0:
    for i in xrange(b):
        lines[cl][2 * i] = "#"

print h, w
for line in lines:
    print "".join(line)


Fixed submission:
a = int(raw_input().strip())
b = int(raw_input().strip())
c = int(raw_input().strip())
d = int(raw_input().strip())

print min(a, b) + min(c, d)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input().strip())
ais = map(int, raw_input().strip().split())

curr = [0 for _ in xrange(n)]
total = [0 for _ in xrange(n)]

for i in xrange(n):
    for j in xrange(n):
        if i == j:
            continue
        total[j] += abs(curr[j] - ais[i])
        curr[j] = ais[i]

for i in xrange(n):
    total[i] += abs(curr[i])
    print total[i]


Fixed submission:
n = int(raw_input().strip())
ais = map(int, raw_input().strip().split())

sp = abs(ais[0]) + abs(ais[-1]) + sum([abs(ais[i + 1] - ais[i]) for i in xrange(n - 1)])

total = [sp for _ in xrange(n)]
for i in xrange(n):
    if i == 0:
        total[i] -= abs(ais[0] - 0)
        total[i] -= abs(ais[1] - ais[0])
    elif i == n - 1:
        total[i] -= abs(0 - ais[n - 1])
        total[i] -= abs(ais[n - 1] - ais[n - 2])
    else:
        total[i] -= abs(ais[i + 1] - ais[i])
        total[i] -= abs(ais[i] - ais[i - 1])

    if i == n - 1:
        total[i] += abs(0 - ais[n - 2])
    elif i == 0:
        total[i] += abs(ais[1] - 0)
    else:
        total[i] += abs(ais[i + 1] - ais[i - 1])

    print total[i]
Buggy python submission (verdict: Time Limit Exceeded):
s = raw_input().strip()
n = len(s)
x, y = map(int, raw_input().strip().split())

st = 0
while st < n and s[st] == "F":
    st += 1

x -= st

X, Y = range(2)

x_blocks = []
y_blocks = []
curr = 0
cdi = X

for i in xrange(st, n):
    ch = s[i]
    if ch == "F":
        curr += 1
    else:
        if curr != 0:
            if cdi == X:
                x_blocks.append(curr)
            else:
                y_blocks.append(curr)
        curr = 0
        cdi = (cdi + 1) % 2
if curr != 0:
    if cdi == X:
        x_blocks.append(curr)
    else:
        y_blocks.append(curr)

x, y = abs(x), abs(y)
lxb, lyb = len(x_blocks), len(y_blocks)
sxb, syb = sum(x_blocks), sum(y_blocks)
x_blocks = sorted(x_blocks)
y_blocks = sorted(y_blocks)

if sum(x_blocks) < x or sxb % 2 != x % 2 or sum(y_blocks) < y or syb % 2 != y % 2:
    print "No"
    exit()

tx = (x + sxb) / 2
stack = [([0] * lxb, 0, -1)]
xgood = False

while stack:
    curr, val, top = stack.pop()
    if val == tx:
        xgood = True
        break
    for i in xrange(top + 1, lxb):
        if val + x_blocks[i] > tx:
            break
        nxt = curr[::]
        nxt[i] = 1
        stack.append((nxt, val + x_blocks[i], i))
    if xgood:
        break

if not xgood:
    print "No"
    exit()

ty = (y + syb) / 2
stack = [([0] * lyb, 0, -1)]
ygood = False

while stack:
    curr, val, top = stack.pop()
    if val == ty:
        ygood = True
        break
    for i in xrange(top + 1, lyb):
        if val + y_blocks[i] > ty:
            break
        nxt = curr[::]
        nxt[i] = 1
        stack.append((nxt, val + y_blocks[i], i))
    if ygood:
        break

if not ygood:
    print "No"
else:
    print "Yes"


Fixed submission:
from collections import defaultdict as dd

s = raw_input().strip()
n = len(s)
x, y = map(int, raw_input().strip().split())

stx = 0
while stx < n and s[stx] == "F":
    stx += 1

sty = 0

X, Y = range(2)

x_blocks = []
y_blocks = []
curr = 0
cdi = X

for i in xrange(stx, n):
    ch = s[i]
    if ch == "F":
        curr += 1
    else:
        if curr != 0:
            if cdi == X:
                x_blocks.append(curr)
            else:
                y_blocks.append(curr)
        curr = 0
        cdi = (cdi + 1) % 2
if curr != 0:
    if cdi == X:
        x_blocks.append(curr)
    else:
        y_blocks.append(curr)

curr = dd(int)
curr[stx] = 1

for xb in x_blocks:
    nxt = dd(int)

    for key in curr.iterkeys():
        nxt[key + xb] += 1
        nxt[key - xb] += 1

    curr = nxt

if x not in curr:
    print "No"
    exit()

curr = dd(int)
curr[sty] = 1

for yb in y_blocks:
    nxt = dd(int)

    for key in curr.iterkeys():
        nxt[key + yb] += 1
        nxt[key - yb] += 1

    curr = nxt

if y not in curr:
    print "No"
else:
    print "Yes"
Buggy python submission (verdict: Runtime Error):
from heapq import heappop as pop, heappush as push

peak, curr = 0, 0

stuff = []
n, c = map(int, raw_input().split())
for _ in xrange(n):
  stuff.append(map(float, raw_input().split()))
  
stuff = sorted(stuff)
has_camera = [False] * c
ending = []
for st, end, ch in stuff:
  while ending[0][0] <= st - 0.5:
    _, cch = pop(ending)
    has_camera[cch] = False
    curr -= 1
  if not has_camera[ch]:
    curr += 1
  push(ending, (end, ch))
  peak = max(peak, curr)
  
 print peak

Fixed submission:
from heapq import heappop as pop, heappush as push

peak, curr = 0, 0

stuff = []
n, c = map(int, raw_input().split())
for _ in xrange(n):
  stuff.append(map(float, raw_input().split()))
  stuff[-1][-1] = int(stuff[-1][-1]) - 1
  
stuff = sorted(stuff)
has_camera = [False] * c
last_ending = [-1] * c
ending = []
for st, end, ch in stuff:
  while ending and ending[0][0] <= st - 0.5:
    cend, cch = pop(ending)
    if last_ending[cch] == cend:
        has_camera[cch] = False
        curr -= 1
  if not has_camera[ch]:
    has_camera[ch] = True
    curr += 1
  push(ending, (end, ch))
  last_ending[ch] = end
  peak = max(peak, curr)
  
print peak
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict as dd
from itertools import izip


def sol(n, w, wis, vis):
    rv = 0
    best = dd(int)
    for i, (wi, vi) in enumerate(izip(wis, vis)):
        if wi < w:
            best[(wi, i)] = max(best[(wi, i)], vi)
            rv = max(vi, rv)

    frontline = [(i, wis[i], vis[i]) for i in xrange(n - 1, -1, -1)]
    while frontline:
        last, cw, cv = frontline.pop()
        for i in xrange(last + 1, n):
            nw, nv = cw + wis[i], cv + vis[i]
            if nw <= w and best[(nw, i)] < nv:
                best[(nw, i)] = nv
                frontline.append((i, nw, nv))
                rv = max(rv, nv)

    return rv


if __name__ == "__main__":
    n, w = map(int, raw_input().strip().split())
    wis, vis = [], []
    for _ in xrange(n):
        wi, vi = map(int, raw_input().strip().split())
        wis.append(wi)
        vis.append(vi)
    print sol(n, w, wis, vis)



Fixed submission:
def sol(t, tis):
    flow = 0
    ret = 0
    for ti in tis:
        ret += min(ti + t - flow, t)
        flow = ti + t

    return ret


if __name__ == "__main__":
    n, t = map(int, raw_input().strip().split())
    tis = map(int, raw_input().strip().split())
    print sol(t, tis)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict as dd
from itertools import izip


def sol(n, w, wis, vis):
    rv = 0
    best = dd(int)
    for i, (wi, vi) in enumerate(izip(wis, vis)):
        if wi < w:
            best[(wi, i)] = max(best[(wi, i)], vi)
            rv = max(vi, rv)

    frontline = [(i, wis[i], vis[i]) for i in xrange(n - 1, -1, -1)]
    while frontline:
        last, cw, cv = frontline.pop()
        for i in xrange(last + 1, n):
            nw, nv = cw + wis[i], cv + vis[i]
            if nw <= w and best[(nw, i)] < nv:
                best[(nw, i)] = nv
                frontline.append((i, nw, nv))
                rv = max(rv, nv)

    return rv


if __name__ == "__main__":
    n, w = map(int, raw_input().strip().split())
    wis, vis = [], []
    for _ in xrange(n):
        wi, vi = map(int, raw_input().strip().split())
        wis.append(wi)
        vis.append(vi)
    print sol(n, w, wis, vis)



Fixed submission:
from itertools import izip


def sol(n, w, wis, vis):
    rv = 0
    w1 = wis[0]
    coll = [[] for _ in xrange(n)]
    for wi, vi in izip(wis, vis):
        coll[wi - w1].append(vi)
    coll = map(lambda x: sorted(x, reverse=True), coll)
    lis = map(len, coll)
    for k1 in xrange(min(lis[0] + 1, n + 1)):
        for k2 in xrange(min(lis[1] + 1, n + 1 - k1)):
            for k3 in xrange(min(lis[2] + 1, n + 1 - k1 - k2)):
                for k4 in xrange(min(lis[3] + 1, n + 1 - k1 - k2 - k3)):
                    kis = [k1, k2, k3, k4]
                    if sum([(w1 + i) * kis[i] for i in xrange(4)]) > w:
                        continue
                    rv = max(rv, sum([sum(coll[i][:kis[i]]) for i in xrange(4)]))

    return rv


if __name__ == "__main__":
    n, w = map(int, raw_input().strip().split())
    wis, vis = [], []
    for _ in xrange(n):
        wi, vi = map(int, raw_input().strip().split())
        wis.append(wi)
        vis.append(vi)
    print(sol(n, w, wis, vis))
Buggy python submission (verdict: Runtime Error):
userData = input()

userDatas = input()

if userData == useDatas[0:-1]:
  print("Yes")
else:
  print("No")

Fixed submission:
userData = input()

userDatas = input()

if userData == userDatas[0:-1]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
s = list(stdin.readline().rstrip())
q = int(stdin.readline().rstrip())
t = []
for i in range(q):
    t.append([x for x in stdin.readline().rstrip().split()])
r = 0
for i in range(q):
    if int(t[i][0]) == 1:
        if r == 1:
            r = 0
        else:
            r = 1
    else:
        if (int(t[i][1]) + r) % 2 == 0:
            s.append(t[i][2])
        else:
            s.insert(0,t[i][2])
if r == 1:
    s = list(reversed(s))
s = ''.join(s)
print(s)

Fixed submission:
from sys import stdin
s = list(stdin.readline().rstrip())
q = int(stdin.readline().rstrip())
t = []
k = []
for i in range(q):
    t.append([x for x in stdin.readline().rstrip().split()])
r = 0
for i in range(q):
    if int(t[i][0]) == 1:
        if r == 1:
            r = 0
        else:
            r = 1
    else:
        if (int(t[i][1]) + r) % 2 == 0:
            s.append(t[i][2])
        else:
            k.append(t[i][2])
k = list(reversed(k))
k.extend(s)
if r == 1:
    k = list(reversed(k))
k = ''.join(k)
print(k)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
s = list(stdin.readline().rstrip())
q = int(stdin.readline().rstrip())
t = []
for i in range(q):
    t.append([x for x in stdin.readline().rstrip().split()])
r = 0
for i in range(q):
    if int(t[i][0]) == 1:
        if r == 1:
            r = 0
        else:
            r = 1
    else:
        if (int(t[i][1]) + r) % 2 == 0:
            s.append(t[i][2])
        else:
            s.insert(0,t[i][2])
if r == 1:
    s = list(reversed(s))
s = ''.join(s)
print(s)

Fixed submission:
from sys import stdin
s = list(stdin.readline().rstrip())
q = int(stdin.readline().rstrip())
t = []
k = []
for i in range(q):
    t.append([x for x in stdin.readline().rstrip().split()])
r = 0
for i in range(q):
    if int(t[i][0]) == 1:
        if r == 1:
            r = 0
        else:
            r = 1
    else:
        if (int(t[i][1]) + r) % 2 == 0:
            s.append(t[i][2])
        else:
            k.append(t[i][2])
k = list(reversed(k))
k.extend(s)
if r == 1:
    k = list(reversed(k))
k = ''.join(k)
print(k)
Buggy python submission (verdict: Runtime Error):
from sys import stdin 
import math
a,b = [int(x) for x in stdin.readline().rstrip().split()]
answer = a * b // math.gcd(a, b)
print(answer)

Fixed submission:
from sys import stdin 
import fractions
a,b = [int(x) for x in stdin.readline().rstrip().split()]
answer = a * b // fractions.gcd(a, b)
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin 
n = int(stdin.readline().rstrip())
l = [int(x) for x in stdin.readline().rstrip().split()]
l.sort()
answer = 0
for i in range(len(l)):
    for j in range(i):
        if i != j:
            low = i+1
            high = n
            c = l[i] + l[j]
            while low < high:
                mid = (low + high) // 2
                if l[mid] < c:
                    low = mid + 1
                else:
                    high = mid
            answer += low - i - 1
print(answer)



Fixed submission:
from sys import stdin 
from bisect import bisect_left
n = int(stdin.readline().rstrip())
l = [int(x) for x in stdin.readline().rstrip().split()]
l.sort()
answer = 0
for i in range(len(l)):
    for j in range(i):
        if i != j:
            k = bisect_left(l, l[i]+ l[j])
            answer += k - i - 1
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin 
n = int(stdin.readline().rstrip())
s = [int(x) for x in stdin.readline().rstrip().split()]
a = 0
for i in range(len(s)):
    for j in range(i):
        for k in range(j):
            if i != j and j != k and k != i:
                if s[i] < s[j] + s[k] and s[j] < s[k] + s[i] and s[k] < s[i] + s[j]:
                    a += 1
print(a)


Fixed submission:
from sys import stdin 
from bisect import bisect_left
n = int(stdin.readline().rstrip())
l = [int(x) for x in stdin.readline().rstrip().split()]
l.sort()
answer = 0
for i in range(len(l)):
    for j in range(i):
        if i != j:
            k = bisect_left(l, l[i]+ l[j])
            answer += k - i - 1
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin 
n = int(stdin.readline().rstrip())
s = [int(x) for x in stdin.readline().rstrip().split()]
a = 0
for i in range(len(s)):
    for j in range(i):
        for k in range(j):
            if i != j and j != k and k != i:
                if s[i] < s[j] + s[k] and s[j] < s[k] + s[i] and s[k] < s[i] + s[j]:
                    a += 1
print(a)


Fixed submission:
from sys import stdin 
from bisect import bisect_left
n = int(stdin.readline().rstrip())
l = [int(x) for x in stdin.readline().rstrip().split()]
l.sort()
answer = 0
for i in range(len(l)):
    for j in range(i):
        if i != j:
            k = bisect_left(l, l[i]+ l[j])
            answer += k - i - 1
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
b = []
for i in range(n):
    for j in range(n):
        if i+1 == a[j]:
            b.append(j + 1)
b = [str(i) for i in b]
b = ' '.join(b)
print(b)


Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
b = [0] * n
for i in range(n):
    b[a[i] - 1] = i + 1
b = [str(x) for x in b]
b = ' '.join(b)
print(b)