Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
B - Palindromic Numbers
https://beta.atcoder.jp/contests/abc090/tasks/abc090_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A, B):
    ans = 0
for i in range(A, B+1):
        s1 = str(i)
        s2 = s1[::-1]
        if s1 == s2:
            ans += 1
    return ans


def main(args):
    A, B = map(int, input().split())
    ans = solve(A, B)
    print(ans)

if __name__ == '__main__':
    main(sys.argv[1:])


Fixed submission:
# -*- coding: utf-8 -*-
"""
B - Palindromic Numbers
https://beta.atcoder.jp/contests/abc090/tasks/abc090_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A, B):
    ans = 0
    for i in range(A, B+1):
        s1 = str(i)
        s2 = s1[::-1]
        if s1 == s2:
            ans += 1
    return ans


def main(args):
    A, B = map(int, input().split())
    ans = solve(A, B)
    print(ans)

if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc084/tasks/abc084_c

"""
import sys
from sys import stdin
from collections import namedtuple
from math import ceil
input = stdin.readline


def solve(trains, N):
    arrives = []

    for i in range(N-1):
        arrives.append(0)
        for j in range(len(arrives)):
            dt = trains[i].S
            while dt < arrives[j]:
                dt += trains[i].F
            arrives[j] = dt + trains[i].C

    arrives.append(0)
    return arrives


T = namedtuple('T', ['C', 'S', 'F'])
def main(args):
    trains = []
    N = int(input())
    for _ in range(N-1):
        c, s, f = map(int, input().split())
        trains.append(T(c, s, f))
    ans = solve(trains, N)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])


Fixed submission:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc084/tasks/abc084_c

"""
import sys
from sys import stdin
from collections import namedtuple
from math import ceil
input = stdin.readline


def solve(trains, N):
    arrives = []

    for i in range(N-1):
        arrives.append(0)
        for j in range(len(arrives)):
            t = arrives[j] - trains[i].S
            dt = max(trains[i].S, (trains[i].S + ceil(t/trains[i].F)*trains[i].F ))
            arrives[j] = dt + trains[i].C

    arrives.append(0)
    return arrives


T = namedtuple('T', ['C', 'S', 'F'])
def main(args):
    trains = []
    N = int(input())
    for _ in range(N-1):
        c, s, f = map(int, input().split())
        trains.append(T(c, s, f))
    ans = solve(trains, N)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
http://tenka1-2017-beginner.contest.atcoder.jp/tasks/tenka1_2017_c

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    N = int(input())

    found = False
    for h in range(1, 3500+1):
        if found:
            break
        for n in range(1, 3500+1):
            try:
                w = h*n / (4*h*n/N - n - h)
            except ZeroDivisionError:
                continue
            if w > 0 and w == int(w):
                print(h, n, int(w))
                found = True
                break


if __name__ == '__main__':
    main(sys.argv[1:])
    


Fixed submission:
# -*- coding: utf-8 -*-
"""
http://tenka1-2017-beginner.contest.atcoder.jp/tasks/tenka1_2017_c

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    N = int(input())

    found = False
    for h in range(1, 3500+1):
        if found:
            break
        for n in range(1, h+1):
            try:
                w = h*n / (4*h*n/N - n - h)
            except ZeroDivisionError:
                continue
            if w > 0 and w == int(w):
                print(h, n, int(w))
                found = True
                break


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
"""


Memo = []
def solve(data):
    global Memo
    for d in data:
        if d in Memo:
            Memo.remove(d)
        else:
            Memo.append(d)
    return len(Memo)


def main():
    N = int(input())
    data = [int(input()) for _ in range(N)]
    result = solve(data)
    print(result)


if __name__ == '__main__':
    main()
    


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


Memo = []
def solve(data):
    global Memo
    for d in data:
        if d in Memo:
            Memo.remove(d)
        else:
            Memo.append(d)
    return len(Memo)


def solve2(data):
    from collections import Counter
    c = Counter(data).most_common()
    remaining = [x for x in c if x[1]%2==1]
    return len(remaining)


def main():
    N = int(input())
    data = [int(input()) for _ in range(N)]
    result = solve2(data)
    print(result)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
http://abc063.contest.atcoder.jp/tasks/arc075_b
TLE
"""
import sys
from sys import stdin
from math import ceil
input = stdin.readline


def Cond(monsters, A, B, mid):
    t = [x - (B * mid) for x in monsters]
    t.sort(reverse=True)
    additional_damage = (A - B)

    total_count = 0
    for m in t:
        if m < 1:
            break
        total_count += ceil(m / additional_damage)

    if total_count <= mid:
        return True
    else:
        return False


def main(args):
    # N = 2
    # A = 10
    # B = 4
    # monsters = [20, 20]
    N, A, B = map(int, input().split())
    monsters = [int(input()) for _ in range(N)]

    total_count = 0
    if N == 1:
        total_count = ceil(monsters[0] / A)
    else:
        monsters.sort(reverse=True)
        lb = ceil(monsters[0] / A)
        ub = ceil(monsters[0] / B)
        # lb = 0
        # ub = 1e10

        for _ in range(100):
            mid = (lb + ub) // 2
            if Cond(monsters, A, B, mid):
                ub = mid
            else:
                lb = mid
        total_count = int(ub)

    print(total_count)


if __name__ == '__main__':
    main(sys.argv[1:])

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://abc063.contest.atcoder.jp/tasks/arc075_b
TLE
"""
import sys
from sys import stdin
from math import ceil
input = stdin.readline


def Cond(monsters, A, B, mid):
    t = [x - (B * mid) for x in monsters]
    t.sort(reverse=True)
    additional_damage = (A - B)

    total_count = 0
    for m in t:
        if m < 1:
            break
        total_count += ceil(m / additional_damage)

    if total_count <= mid:
        return True
    else:
        return False


def main(args):
    # N = 2
    # A = 10
    # B = 4
    # monsters = [20, 20]
    N, A, B = map(int, input().split())
    monsters = [int(input()) for _ in range(N)]

    total_count = 0
    if N == 1:
        total_count = ceil(monsters[0] / A)
    else:
        monsters.sort(reverse=True)
        lb = ceil(monsters[0] / A)
        ub = ceil(monsters[0] / B)
        # lb = 0
        # ub = 1e10

        for _ in range(30):
            mid = (lb + ub) // 2
            if Cond(monsters, A, B, mid):
                ub = mid
            else:
                lb = mid
        total_count = int(ub)

    print(total_count)


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
http://abc062.contest.atcoder.jp/tasks/arc074_b

"""
import sys
from sys import stdin
from heapq import heappop, heappush
input = stdin.readline


def solve(A, N):
    red_pq = []
    blue_pq = []

    for a in A[:N]:
        heappush(red_pq, a)
    red_total = sum(A[:N])

    temp = A[N:]
    temp.sort()
    blue_total = sum(temp[:N])
    best_ans = red_total - blue_total


    for k in range(N, 2*N):
        t1 = A[k]
        heappush(red_pq, t1)
        t2 = heappop(red_pq)
        red_total += (t1 - t2)

        temp = A[k+1:]
        temp.sort()
        blue_total = sum(temp[:N])

        ans = red_total - blue_total
        best_ans = max(best_ans, ans)

    return best_ans


def main(args):
    N = int(input())
    A = [int(x) for x in input().split()]
    result = solve(A, N)
    print(result)


if __name__ == '__main__':
    main(sys.argv[1:])


Fixed submission:
# -*- coding: utf-8 -*-
"""
http://abc062.contest.atcoder.jp/tasks/arc074_b

"""
import sys
from sys import stdin
from heapq import heappop, heappush
input = stdin.readline


def solve(A, N):
    red_pq = []
    blue_pq = []

    for a in A[:N]:
        heappush(red_pq, a)
    red_total = sum(A[:N])

    blue_total = 0
    for a in A[2*N:]:
        heappush(blue_pq, -a)
        blue_total += a

    blue_lut = [0] * (3*N)
    blue_lut[2*N] = blue_total
    for k in range(2*N - 1, N - 1, -1):
        t1 = A[k]
        heappush(blue_pq, -t1)
        t2 = heappop(blue_pq)
        blue_total += (t1 + t2)
        blue_lut[k] = blue_total

    best_ans = red_total - blue_total

    for k in range(N, 2*N):
        t1 = A[k]
        heappush(red_pq, t1)
        t2 = heappop(red_pq)
        red_total += (t1 - t2)

        ans = red_total - blue_lut[k+1]
        best_ans = max(best_ans, ans)

    return best_ans


def main(args):
    N = int(input())
    A = [int(x) for x in input().split()]
    result = solve(A, N)
    print(result)


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
A - Sorted Arrays
https://atcoder.jp/contests/agc013/tasks/agc013_a

"""
import sys
from typing import List


def solve(N, array):
    ans = 1
    prev = None
    direction = None

    for a in array:
        if prev == None:
            pass
        elif a > prev:
            if direction == 'd':
                ans += 1
                direction = None
            else:
                if a > prev:
                    direction = 'u'
        elif a < prev:
            if direction == 'u':
                ans += 1
                direction = None
            else:
                if a < prev:
                    direction = 'd'
        prev = a
    return ans


def main(args):
    N = int(input())
    array = [int(a) for a in input().split()]
    ans = solve(N, array)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Fixed submission:
# -*- coding: utf-8 -*-
"""
A - Sorted Arrays
https://atcoder.jp/contests/agc013/tasks/agc013_a

"""
import sys


def solve(N, array):
    ans = 1
    prev = None
    direction = None

    for a in array:
        if prev == None:
            pass
        elif a > prev:
            if direction == 'd':
                ans += 1
                direction = None
            else:
                if a > prev:
                    direction = 'u'
        elif a < prev:
            if direction == 'u':
                ans += 1
                direction = None
            else:
                if a < prev:
                    direction = 'd'
        prev = a
    return ans


def main(args):
    N = int(input())
    array = [int(a) for a in input().split()]
    ans = solve(N, array)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc044/tasks/arc060_a

"""
import sys
from sys import stdin
from copy import copy, deepcopy
input = stdin.readline


def solve(N, A, cards):
    ans = 0
    cards.append(0)
    cards.sort()
    W = max(cards) * N

    # dp[j][k][s]: j番目までのカードをk枚使って合計をsにする組み合わせ
    dp = [[[0] * (W+1) for _ in range(N+1)] for _ in range(N+1)]
    for j in range(N+1):
        dp[j][0][0] = 1

    for j in range(1, N+1):
        card = cards[j]
        for k in range(1, N+1):
            for s in range(1, W+1):
                if s < card:
                    dp[j][k][s] = dp[j-1][k][s]
                else:
                    dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-card]

    for k in range(1, N+1):
        ans += dp[N][k][k*A]
    return ans


def main(args):
    N, A = map(int, input().split())
    cards = [int(x) for x in input().split()]
    ans = solve(N, A, cards)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Fixed submission:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc044/tasks/arc060_a

"""
import sys
from sys import stdin
input = stdin.readline


def solve(N, A, cards):
    ans = 0
    cards.append(0)
    cards.sort()
    W = sum(cards)

    # dp[j][k][s]: j番目までのカードをk枚使って合計をsにする組み合わせ
    dp = [[[0] * (W+1) for _ in range(N+1)] for _ in range(N+1)]
    for j in range(N+1):
        dp[j][0][0] = 1

    for j in range(1, N+1):
        card = cards[j]
        for k in range(1, N+1):
            for s in range(1, W+1):
                if s < card:
                    dp[j][k][s] = dp[j-1][k][s]
                else:
                    dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-card]

    for k in range(1, N+1):
        if k*A <= W:
            ans += dp[N][k][k*A]
    return ans


def main(args):
    N, A = map(int, input().split())
    cards = [int(x) for x in input().split()]
    ans = solve(N, A, cards)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
c=int(a*b//math.gcd(a,b))
print(c)

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

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

Fixed submission:
from fractions import gcd
a,b=map(int,input().split())
c=int(a*b//gcd(a,b))
print(c)
Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
s=sum(l)
if(l<=21):
  print("win")
else:
  print("bust")

Fixed submission:
l=list(map(int,input().split()))
s=sum(l)
if(s<=21):
  print("win")
else:
  print("bust")
Buggy python submission (verdict: Runtime Error):
d=input()
if(d=="SAT"):
  print(1)
elif(d=="FRI")
  print(2)
elif(d=="THU")
  print(3)
elif(d=="WED")
  print(4)
elif(d=="TUE")
  print(5)
elif(d=="MON")
  print(6)
else:
  print(7)

Fixed submission:
d=input()
if(d=="SAT"):
  print(1)
elif(d=="FRI"):
  print(2)
elif(d=="THU"):
  print(3)
elif(d=="WED"):
  print(4)
elif(d=="TUE"):
  print(5)
elif(d=="MON"):
  print(6)
else:
  print(7)

Buggy python submission (verdict: Runtime Error):
d=str(input())
if(d="SAT"):
   print(1)
elif(d="FRI"):
  print(2)
elif(d="THU"):
  print(3)
elif(d="WED"):
  print(4)
elif(d="TUE"):
  print(5)
elif(d="MON"):
  print(6)
else:
  print(7)

Fixed submission:
d=input()
if(d=="SAT"):
  print(1)
elif(d=="FRI"):
  print(2)
elif(d=="THU"):
  print(3)
elif(d=="WED"):
  print(4)
elif(d=="TUE"):
  print(5)
elif(d=="MON"):
  print(6)
else:
  print(7)

Buggy python submission (verdict: Runtime Error):
d=input()
if(d="SAT"):
   print(1)
elif(d="FRI"):
  print(2)
elif(d="THU"):
  print(3)
elif(d="WED"):
  print(4)
elif(d="TUE"):
  print(5)
elif(d="MON"):
  print(6)
else:
  print(7)

Fixed submission:
d=input()
if(d=="SAT"):
  print(1)
elif(d=="FRI"):
  print(2)
elif(d=="THU"):
  print(3)
elif(d=="WED"):
  print(4)
elif(d=="TUE"):
  print(5)
elif(d=="MON"):
  print(6)
else:
  print(7)

Buggy python submission (verdict: Runtime Error):
d=input()
if(d="SAT"):
   print(1)
elif(d="FRI"):
  print(2)
elif(d="THU"):
  print(3)
elif(d="WED"):
  print(4)
elif(d="TUE"):
  print(5)
elif(d="MON"):
  print(6)
else:
  print(7)

Fixed submission:
d=input()
if(d=="SAT"):
  print(1)
elif(d=="FRI"):
  print(2)
elif(d=="THU"):
  print(3)
elif(d=="WED"):
  print(4)
elif(d=="TUE"):
  print(5)
elif(d=="MON"):
  print(6)
else:
  print(7)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
l=list(s)
newcome=[]
alp=[chr(ord('A') + i) for i in range(26)]
for i in l:
  a=alp.index(i)
  if (a+n)<=26:
    t=alp[a+n]
  else:
    t=alp[a+n-26]
  newcome.append(t)
print("".join(newcome))

Fixed submission:
n=int(input())
s=input()
l=list(s)
newcome=[]
alp=[chr(ord('A') + i) for i in range(26)]
for i in l:
  a=alp.index(i)
  if (a+n)<26:
    t=alp[a+n]
  else:
    t=alp[a+n-26]
  newcome.append(t)
print("".join(newcome))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
l=list(s)
newcome=[]
alp=[chr(ord('A') + i) for i in range(26)]
for i in l:
  a=alp.index(i)
  if (a+n)<=26:
    t=alp[a+n]
  else:
    t=alp[a+n-26]
  newcome.append(t)
print("".join(newcome))

Fixed submission:
n=int(input())
s=input()
l=list(s)
newcome=[]
alp=[chr(ord('A') + i) for i in range(26)]
for i in l:
  a=alp.index(i)
  if (a+n)<26:
    t=alp[a+n]
  else:
    t=alp[a+n-26]
  newcome.append(t)
print("".join(newcome))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
if(n%2!=0):
  print("No")
else:
  v=[s[i: i+n/2] for i in range(0, len(s), n/2)]
  if(len(set(v))==1):
    print("Yes")
  else:
    print("No")

Fixed submission:
n=int(input())
s=input()
if(n%2!=0):
  print("No")
else:
  v=[s[i: i+n//2] for i in range(0, len(s), n//2)]
  if(len(set(v))==1):
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
v=[s[i: i+n/2] for i in range(0, len(s), n/2)]
if(len(set(v))==1):
  print("Yes")
else:
  print("No")

Fixed submission:
n=int(input())
s=input()
if(n%2!=0):
  print("No")
else:
  v=[s[i: i+n//2] for i in range(0, len(s), n//2)]
  if(len(set(v))==1):
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from math import sqrt
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
result=0
nums=[x for x in range(n)]
for i in nums:
  for j in nums:
    if(i!=j):
      result += sqrt((xy[i][0] - xy[j][0]) * (xy[i][0] - xy[j][0]) + (xy[i][1] - xy[j][1]) * (xy[i][1] - xy[j][1]))
print(result/n)
      

Fixed submission:
from math import sqrt
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
result=0
nums=[x for x in range(n)]
for i in nums:
  for j in nums:
    if(i!=j):
      result += sqrt((l[i][0] - l[j][0]) * (l[i][0] - l[j][0]) + (l[i][1] - l[j][1]) * (l[i][1] - l[j][1]))
print(result/n)

Buggy python submission (verdict: Runtime Error):
from math import sqrt
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
result=0
nums=[x for x in range(n)]
for i in nums:
  for j in nums:
    if(i!=j):
      result += sqrt((xy[i][0] - xy[j][0]) * (xy[i][0] - xy[j][0]) + (xy[i][1] - xy[j][1]) * (xy[i][1] - xy[j][1]))
print(result/n)
      

Fixed submission:
from math import sqrt
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
result=0
nums=[x for x in range(n)]
for i in nums:
  for j in nums:
    if(i!=j):
      result += sqrt((l[i][0] - l[j][0]) * (l[i][0] - l[j][0]) + (l[i][1] - l[j][1]) * (l[i][1] - l[j][1]))
print(result/n)
Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
if !(all[i<=9 for i in l]):
  print (-1)
else:
  print(l[0]*l[1])

Fixed submission:
l=list(map(int,input().split()))
a=l[0]
b=l[1]
if(a<=9 and b<=9):
  print(a*b)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
if !all[i<=9 for i in l]:
  print (-1)
else:
  print(l[0]*l[1])

Fixed submission:
l=list(map(int,input().split()))
a=l[0]
b=l[1]
if(a<=9 and b<=9):
  print(a*b)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
d=[0]*n
for i,val in enumerate(l):
  d[v-1]=i+1
print(d)
  


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())
l=list(map(int,input().split()))
d=[x+1 for x in range(n)]
for i in d:
  print(l.index(i)+1)

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):
from numpy import array
l=list(map(int,input().split()))
ans=[int(input()) for i in range(l[2])]
n=l[0]
k=l[1]
q=l[2]
p=array([k]*n)
for num in ans:
  minus=[-1]*(num-1)+[0]+[-1]*(n-num)
  v2=array(minus)
  p=p+v2
for m in p:
  if(m<=0):
    print("No")
  else:
    print("Yes")

Fixed submission:
l=list(map(int,input().split()))
ans=[int(input()) for i in range(l[2])]
n=l[0]
k=l[1]
q=l[2]
p=[k-q]*n
for num in ans:
  r=p[num-1]+1
  p[num-1]=r
for a in p:
  if(a<=0):
    print("No")
  else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
a=l[0]
b=l[1]
nums=[i for i in range(20)]
for n in nums:
  if(b<=a*(i+1)-i):
    print(i+1)
    break
  

Fixed submission:
l=list(map(int,input().split()))
a=l[0]
b=l[1]
c=a-1
cnt=1
if(a>b and b==1):
  print(0)
else:
  while a<b:
    a=a+c
    cnt+=1
  print (cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
cnt=0
t=0
for i in range(n-1):
  if(l[i]>=l[i+1]):
    cnt+=1
  else:
    t=max(cnt,t)
    cnt=0
t=max(cnt,%tb)
print(t)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
cnt=0
t=0
for i in range(n-1):
  if(l[i]>=l[i+1]):
    cnt+=1
  else:
    t=max(cnt,t)
    cnt=0
t=max(cnt,t)
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[list(str(input())) for i in range(n)]
for k in l:
  k.sort()
  k="".join(k)
nums=[x for x in range(n-1)]
cnt=0
for i in nums:
  for j in l[i+1:]:
    if(l[i]==j):
      cnt+=1
print(cnt)

Fixed submission:
from collections import Counter
n=int(input())
l=["".join(sorted(list(str(input())))) for i in range(n)]
cnt=Counter(l)
ans=0
for i in set(l):
  n=cnt[i]
  ans+=n*(n-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
l=[list(str(input())) for i in range(n)]
nums=[x for x in range(n-1)]
cnt=0
for i in nums:
  for j in l[i+1:]:
    if(Counter(l[i])==Counter(j)):
      cnt+=1
print(cnt)

Fixed submission:
from collections import Counter
n=int(input())
l=["".join(sorted(list(str(input())))) for i in range(n)]
cnt=Counter(l)
ans=0
for i in set(l):
  n=cnt[i]
  ans+=n*(n-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[list(str(input())) for i in range(n)]
cnt=0
nums=[x for x in range(n)]
for m in l:
  m.sort()
for i in nums[:n-1]:
  for j in l[i+1:]:
    if(l[i]==j):
      cnt+=1
print(cnt)

Fixed submission:
from collections import Counter
n=int(input())
l=["".join(sorted(list(str(input())))) for i in range(n)]
cnt=Counter(l)
ans=0
for i in set(l):
  n=cnt[i]
  ans+=n*(n-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

l=list(map(int,input().split()))
n=l[0]
d=l[1]
print(math.ceil(n/(2d+1)))
  

Fixed submission:
import math

l=list(map(int,input().split()))
n=l[0]
d=l[1]
print(math.ceil(n/(2*d+1)))