Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,m=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
a.sort(reverse=True)
d=[]
for i in range(m):
  b,c=[int(x) for x in input().rstrip().split()]
  d.extend([c]*b)
d.sort(reverse=True)
a+=d
a.sort(reverse=True)
print(sum(a[:n]))


Fixed submission:
n,m=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
a.sort(reverse=True)
d=[]
bc=[]
for i in range(m):
  b,c=[int(x) for x in input().rstrip().split()]
  bc.append([b,c])

cnt=0
bc.sort(key=lambda x:x[1],reverse=True)
for b,c in bc:

  d.extend([c]*b)
  cnt+=b
  if n<cnt:
    break
  
d.sort(reverse=True)
a+=d
a.sort(reverse=True)
print(sum(a[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
a.sort(reverse=True)
for i in range(m):
  b,c=[int(x) for x in input().rstrip().split()]
  a.extend([c]*b)
a.sort(reverse=True)
print(sum(a[:n]))


Fixed submission:
n,m=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
a.sort(reverse=True)
d=[]
bc=[]
for i in range(m):
  b,c=[int(x) for x in input().rstrip().split()]
  bc.append([b,c])

cnt=0
bc.sort(key=lambda x:x[1],reverse=True)
for b,c in bc:

  d.extend([c]*b)
  cnt+=b
  if n<cnt:
    break
  
d.sort(reverse=True)
a+=d
a.sort(reverse=True)
print(sum(a[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]

for i in range(m):
  b,c=[int(x) for x in input().rstrip().split()]
  a.extend([c]*b)
a.sort(reverse=True)
print(sum(a[:n]))


Fixed submission:
n,m=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
a.sort(reverse=True)
d=[]
bc=[]
for i in range(m):
  b,c=[int(x) for x in input().rstrip().split()]
  bc.append([b,c])

cnt=0
bc.sort(key=lambda x:x[1],reverse=True)
for b,c in bc:

  d.extend([c]*b)
  cnt+=b
  if n<cnt:
    break
  
d.sort(reverse=True)
a+=d
a.sort(reverse=True)
print(sum(a[:n]))
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
// #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);i++)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}


int main() {
  string s;cin >> s;
  int k;cin >> k;
  rep(i,k+3){
    if (s[i]!='1'){
      cout<<s[i]<<endl;
      return 0;
    }
  }
  cout<<1<<endl;  
}


Fixed submission:
import sys
s=input()
k=int(input())
for i in range(k):
  if s[i]!="1":
    print(s[i])
    sys.exit()
print(1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())

for h in range(1,3501):
  for n in range(1,3501):
    bb=(4*h*n-N*n-N*h)
    bs=(N*h*n)
    if bb==0:
      continue

    if bs%bb==0 and 1<=bs//bb:
      print(h,n,bs//bb)
      sys.exit()

Fixed submission:
import sys
N=int(input())

for h in range(1,3501):
  for n in range(1,3501):
    bb=(4*h*n-N*n-N*h)
    bs=(N*h*n)
    if bb==0:
      continue

    if bs%bb==0 and 1<=bs//bb:
      print(h,n,bs//bb)
      sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(x) for x in input().rstrip().split()]

ans=[]
for i in range(n):
  if (i+1)%2==1:
    ans=[str(a[i])]+ans
  else:
    ans=ans+[str(a[i])]

if n%2==0:
  print(*ans[::-1])
else:
  print(*ans)

Fixed submission:
from collections import deque
n=int(input())
a=[int(x) for x in input().rstrip().split()]

ans=deque()
for i in range(n):
  if (i+1)%2==1:
    ans.appendleft(str(a[i]))
  else:
    ans.append(str(a[i]))

ans=list(ans)
if n%2==0:
  print(*ans[::-1])
else:
  print(*ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
    l = list(map(int, input().split()))
    ans = 0

    for i in range(n - 2):
        for j in range(i + 1, n - 1):
            for k in range(j + 1, n):
                if len(set([l[i], l[j], l[k]])) == 3 and max(l[i], l[j], l[k]) < sum([l[i], l[j], l[k]]) - max(l[i], l[j], l[k]):
                    ans += 1
    print(ans)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            if len(set([l[i], l[j], l[k]])) == 3 and max(l[i], l[j], l[k]) < sum([l[i], l[j], l[k]]) - max(l[i], l[j], l[k]):
                ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
l = list(map(int, input().split()))
tmp = 1
for i in range(k):
    tmp *= l[i]
for i in range(1, n - k + 1):
    check = tmp < tmp / l[i - 1] * l[i + k - 1]
    print("Yes" if check else "No")
    tmp = tmp / l[i - 2] * l[i]

Fixed submission:
n, k = map(int, input().split())
l = list(map(int, input().split()))
for i in range(1, n - k + 1):
    print("Yes" if l[i - 1] < l[i + k - 1] else "No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= l[i]
if ans > 1000000000000000000:
  ans = -1
print(ans)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
ans = 1
if 0 in l:
    print(0)
else:
  for i in range(n):
      ans *= l[i]
      if ans > 1000000000000000000:
        ans = -1
        break
  print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())
ax = a * math.cos(math.radians((h/12 + 1/12 * m/60) * 360))
ay = a * math.sin(math.radians((h/12 + 1/12 * m/60) * 360))
bx = b * math.cos(math.radians(m/60 * 360))
by = b * math.sin(math.radians(m/60 * 360))
print(math.sqrt((ax-bx)**2 + (ay-by)**2))

Fixed submission:
n = int(input())
n = n % 10
if n in [2, 4, 5, 7, 9]:
  print("hon")
elif n in [0,1,6,8]:
  print("pon")
else:
  print("bon")
Buggy python submission (verdict: Runtime Error):
a, b, h, m = map(int, input().split())
ax = a * math.cos(math.radians((h/12 + 1/12 * m/60) * 360))
ay = a * math.sin(math.radians((h/12 + 1/12 * m/60) * 360))
bx = b * math.cos(math.radians(m/60 * 360))
by = b * math.sin(math.radians(m/60 * 360))
print(math.sqrt((ax-bx)**2 + (ay-by)**2))

Fixed submission:
import math
a, b, h, m = map(int, input().split())
ax = a * math.cos(math.radians((h/12 + 1/12 * m/60) * 360))
ay = a * math.sin(math.radians((h/12 + 1/12 * m/60) * 360))
bx = b * math.cos(math.radians(m/60 * 360))
by = b * math.sin(math.radians(m/60 * 360))
print(math.sqrt((ax-bx)**2 + (ay-by)**2))
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
n = int(input())
ans = 0
for i in range(1,n + 1):
    for j in range(1, n + 1):
        f = fractions.gcd(i, j)
        for k in range(1, n + 1):
            ans += fractions.gcd(f, k)
print(ans)

Fixed submission:
from math import gcd
n = int(input())
ans = 0
for i in range(1,n + 1):
    for j in range(1, n + 1):
        f = gcd(i, j)
        for k in range(1, n + 1):
            ans += gcd(f, k)
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n + 1):
    for j in range(1, n + 1):
        f = fractions.gcd(i, j)
        for k in range(1, n + 1):
            ans += fractions.gcd(f, k)
print(ans)

Fixed submission:
from math import gcd
n = int(input())
ans = 0
for i in range(1,n + 1):
    for j in range(1, n + 1):
        f = gcd(i, j)
        for k in range(1, n + 1):
            ans += gcd(f, k)
print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = list(map(int,input().split()))
l = sorted(l)[::-1]
check = l[m - 1] > (sum(l) / 4 / m)
print("Yes" if check else "No")

Fixed submission:
a, b, c = map(int, input().split())
print(c,a,b)
Buggy python submission (verdict: Runtime Error):
import numpy as np

a, b, c = map(int, input().split())
print("Yes" if np.sqrt(a) + np.sqrt(b) < np.sqrt(c) else "No")

Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[int(input())-1])
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print("Yes" if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) else "No")

Fixed submission:
from decimal import *
a, b, c = map(int, input().split())
print("Yes" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else "No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
check = True
for i in range(n):
    if l.count(l[i]) > 1:
        check = False
        break
if check:
    print("YES")
else:
    print("NO")

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
m = list(set(l))
if len(l) == len(m):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
l = list(map(int, input().split()))
max_l = 0
max_i = 0
ans = 0
if k == 1:
    a = max(l)
    print(a * (a + 1) / 2 / a)
else:
    for i in range(n - k + 1):
        hikaku = 0
        for j in range(k):
            hikaku += l[i+j]
        if max_l < hikaku:
            max_i = i
            max_l = hikaku
    for i in range(k):
        a = l[max_i + i]
        ans += a * (a + 1) / 2 / a
    print(ans)

Fixed submission:
n, k = map(int, input().split())
l = list(map(int, input().split()))
at = l[0]
ans = 0
max_i = 0
max_l = sum(l[:k])
hikaku = sum(l[:k])
if k == 1:
    a = max(l)
    print(a * (a + 1) / 2 / a)
else:
    for i in range(1, n - k + 1):
        hikaku = hikaku - at + l[i + k - 1]
        at = l[i]
        if max_l < hikaku:
            max_i = i
            max_l = hikaku
    for i in range(k):
        a = l[max_i + i]
        ans += a * (a + 1) / 2 / a
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
l = list(map(int, input().split()))
max_l = 0
max_i = 0
ans = 0
if k == 1:
    a = max(l)
    print(a * (a + 1) / 2 / a)
else:
    for i in range(n - k + 1):
        hikaku = sum(l[i:i+k])
        if max_l < hikaku:
            max_i = i
            max_l = hikaku
    for i in range(k):
        a = l[max_i + i]
        ans += a * (a + 1) / 2 / a
    print(ans)

Fixed submission:
n, k = map(int, input().split())
l = list(map(int, input().split()))
at = l[0]
ans = 0
max_i = 0
max_l = sum(l[:k])
hikaku = sum(l[:k])
if k == 1:
    a = max(l)
    print(a * (a + 1) / 2 / a)
else:
    for i in range(1, n - k + 1):
        hikaku = hikaku - at + l[i + k - 1]
        at = l[i]
        if max_l < hikaku:
            max_i = i
            max_l = hikaku
    for i in range(k):
        a = l[max_i + i]
        ans += a * (a + 1) / 2 / a
    print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
l = []
for _ in range(n):
    m = int(input())
    l.append([list(map(int, input().split())) for _ in range(m)])
# for i in range(1):
for i in range(2 ** n - 1):
    sj = [True] * n
    bin_i = format(i, 'b').rjust(n, "0")
    for j in range(n):
        sj[j] = (bin_i[j] == "0")
        for k in range(n):
            check = True
            for x in range(len(l[k])):
                # print(j, k, x)
                if sj[k] and sj[l[k][x][0]] and l[k][x][1] == 0:
                    check = False
                    break
                elif sj[k] and not(sj[l[k][x][0]]) and l[k][x][1] == 1:
                    check = False
                    break
                elif (not (sj[k])) and (not(sj[l[k][x][0]])) and l[k][x][1] == 1:
                    check = False
                    break
                elif (not (sj[k])) and (sj[l[k][x][0]]) and l[k][x][1] == 0:
                    check = False
                    break
    if check:
        print(n - i)
        exit()
print(0)

Fixed submission:
n = int(input())
l = []
ans = 0
check = True
for _ in range(n):
    m = int(input())
    l.append([list(map(int, input().split())) for _ in range(m)])
for i in range(2 ** n):
    bin_i = format(i, 'b').rjust(n, "0")
    check = True
    for k in range(n):
        for x in range(len(l[k])):
            if bin_i[k] == "1":
                if (bin_i[l[k][x][0] - 1] == "1") and (l[k][x][1] == 0):
                    check = False
                elif (bin_i[l[k][x][0]-1] == "0") and (l[k][x][1] == 1):
                    check = False
    if check:
        ans = max(ans, bin_i.count("1"))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = n // 100
b = n % 100
check = a >= 20 or b / 5 <= a
print("1" if check else "0")

Fixed submission:
a, b = map(int, input().split())
c, d = map(int, input().split())
print("0" if a == c else "1")
Buggy python submission (verdict: Time Limit Exceeded):

import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        ans += bisect.bisect_left(l[j+1:], l[i] + l[j])
print(ans)

Fixed submission:
import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        ans += max(bisect.bisect_left(l, l[i] + l[j])-j-1, 0)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
ans = 0
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        ans += sum(1 for x in l[j+1:] if x < l[i] + l[j])
print(ans)

Fixed submission:
import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        ans += max(bisect.bisect_left(l, l[i] + l[j])-j-1, 0)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
sum = 0
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        for k in range(j + 1, len(l)):
            if l[k] < l[i] + l[j]:
                sum += 1
            else:
                break
print(sum)

Fixed submission:
import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        ans += max(bisect.bisect_left(l, l[i] + l[j])-j-1, 0)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
sum = 0
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        for k in range(j + 1, len(l)):
            if l[k] < l[i] + l[j]:
                sum += 1
print(sum)

Fixed submission:
import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        ans += max(bisect.bisect_left(l, l[i] + l[j])-j-1, 0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
a, b = map(int, input().split())
l = []
x = fractions.gcd(a, b)
i = 1
# while i * i <= x:
#     if x % i == 0:
#         l.append(i)
#         l.append(x//i)
#     i += 1
# table = list(set(l))
for i in range(1, int(x**0.5)+1):
    if x % i == 0:
        l.append(i)
        if i**2 == x:
            continue
        l.append(x//i)
table = l
ans = []
for i in range(len(table)):
    check = True
    for j in range(2, int(table[i]**0.5)+1):
        if table[i] % j == 0:
            check = False
    if check:
        ans.append(table[i])
print(len(ans))

Fixed submission:
import fractions
a, b = map(int, input().split())
n = fractions.gcd(a, b)
i = 1
ass = [1]
for i in range(2, int(n**0.5)+1):
    while n % i == 0:
        ass.append(i)
        n = n//i
if n != 1:
    ass.append(n)
print(len(set(ass)))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
l = []
x = fractions.gcd(a, b)
i = 1
# while i * i <= x:
#     if x % i == 0:
#         l.append(i)
#         l.append(x//i)
#     i += 1
# table = list(set(l))
for i in range(1, int(x**0.5)+1):
    if x % i == 0:
        l.append(i)
        if i**2 == x:
            continue
        l.append(x//i)
table = l
ans = []
for i in range(len(table)):
    check = True
    for j in range(2, int(table[i]**0.5)+1):
        if table[i] % j == 0:
            check = False
    if check:
        ans.append(table[i])
print(len(ans))

Fixed submission:
import fractions
a, b = map(int, input().split())
n = fractions.gcd(a, b)
i = 1
ass = [1]
for i in range(2, int(n**0.5)+1):
    while n % i == 0:
        ass.append(i)
        n = n//i
if n != 1:
    ass.append(n)
print(len(set(ass)))

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

a, b = map(int, input().split())
l = []
x = fractions.gcd(a, b)
i = 1
while i * i <= x:
    if x % i == 0:
        l.append(i)
        l.append(x//i)
    i += 1
table = list(set(l))
ans = []
for i in range(len(table)):
    check = True
    for j in range(2, int(table[i]**0.5)+1):
        if table[i] % j == 0:
            check = False
    if check:
        ans.append(table[i])
print(len(ans))

Fixed submission:
import fractions
a, b = map(int, input().split())
n = fractions.gcd(a, b)
i = 1
ass = [1]
for i in range(2, int(n**0.5)+1):
    while n % i == 0:
        ass.append(i)
        n = n//i
if n != 1:
    ass.append(n)
print(len(set(ass)))
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
points = [None for _ in range(n + 1)]
for i in range(1, n+1):
    points[i] = k
for j in range(q):
    answer = int(input())
    for i in range(1, n + 1):
        if i == answer:
            continue
        else:
            points[i] -= 1
for i in range(1, n+1):
    if points[i] > 0:
        print("Yes")
    else:
        print('No')

Fixed submission:
n, k, q = map(int, input().split())
points = [0 for _ in range(n + 1)]
for i in range(q):
    answer = int(input())
    points[answer] += 1
for i in range(1, n + 1):
    if (points[i] + k - q) > 0:
        print("Yes")
    else:
        print('No')

Buggy python submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
points = []
for i in range(1, n+1):
    points[i] = k
for j in range(q):
    answer = int(input())
    for i in range(1, n + 1):
        if i == answer:
            continue
        else:
            points[i] -= 1
for i in range(1, n+1):
    if points[i] > 0:
        print("Yes")
    else:
        print('No')

Fixed submission:
n, k, q = map(int, input().split())
points = [0 for _ in range(n + 1)]
for i in range(q):
    answer = int(input())
    points[answer] += 1
for i in range(1, n + 1):
    if (points[i] + k - q) > 0:
        print("Yes")
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
print(int((a+b)*c/2))

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

while (len(b) > 1):
	b = sorted(b)
    x = b.pop(0)
    y = b.pop(0)
    b.append((x+y)/2)
print(b[0])
pass

Fixed submission:
a = int(input())
b = list(map(int, input().split()))
while (len(b) > 1):
    b = sorted(b)
    x = b.pop(0)
    y = b.pop(0)
    b.append((x+y)/2)
print(b[0])
Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
count = [0] * (N + 1)
g = [[] for _ in range(N+1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
for _ in range(Q):
    v, val = map(int, input().split())
    count[v] += val
q = collections.deque()
q.append(1)
check = [0] * (N + 1)
while q:
    v = q.pop()
    check[v] = 1
    for u in g[v]:
        if check[u] == 1:
            continue
        count[u] += count[v]
        q.append(u)
print(*count[1:])

Fixed submission:
import collections
N, Q = map(int, input().split())
count = [0] * (N + 1)
g = [[] for _ in range(N+1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
for _ in range(Q):
    v, val = map(int, input().split())
    count[v] += val
q = collections.deque()
q.append(1)
check = [0] * (N + 1)
while q:
    v = q.pop()
    check[v] = 1
    for u in g[v]:
        if check[u] == 1:
            continue
        count[u] += count[v]
        q.append(u)
print(*count[1:])
Buggy python submission (verdict: Runtime Error):
a= int(input())
b= int(input())
c = a+b
d = a-b
e = a*b
print(max(c,d,e))

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

c = a+b
d = a-b
e = a*b
print(max(c,d,e))

Buggy python submission (verdict: Runtime Error):
a= int(input())
b= int(input())
print(max(a+b,a-b,a*b))

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

c = a+b
d = a-b
e = a*b
print(max(c,d,e))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
count = 0
for _ in range(n):
    l.append(sorted(input()))
while len(l) > 0:
    count += l.count(l[0]) - 1
    l = l[1:]
print(count)

Fixed submission:
N = int(input())
dic = {}
 
for i in range(N):
    s = list(input())
    s.sort()
    key = str(s)
    if key in dic:
        dic[key] += 1
    else:
        dic[key] = 1
 
ans = 0
for value in dic.values():
    ans += value*(value-1) / 2
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
count = 0
for _ in range(n):
    l.append(list(map(lambda x: sorted(x), input().split())))
    for j in range(len(l) - 1):
        if l[-1] == l[j]:
            count += 1
print(count)

Fixed submission:
N = int(input())
dic = {}
 
for i in range(N):
    s = list(input())
    s.sort()
    key = str(s)
    if key in dic:
        dic[key] += 1
    else:
        dic[key] = 1
 
ans = 0
for value in dic.values():
    ans += value*(value-1) / 2
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [list(map(lambda x:sorted(x), input().split())) for _ in range(n)]
count = 0
for i in range(n):
    for j in range(i + 1, n):
        if l[i] == l[j]:
            count += 1
print(count)

Fixed submission:
N = int(input())
dic = {}
 
for i in range(N):
    s = list(input())
    s.sort()
    key = str(s)
    if key in dic:
        dic[key] += 1
    else:
        dic[key] = 1
 
ans = 0
for value in dic.values():
    ans += value*(value-1) / 2
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())
ans = 9999
for i in range(l, min(r, (l + 4038))):
    for j in range(l + 1, min(r+1, (l + 4038))):
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019
print(ans)

Fixed submission:
l, r = map(int, input().split())
ans = 9999
r = min(r, l+4038)
for i in range(l, r):
    for j in range(i + 1, r+1):
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())
ans = 9999
for i in range(l, r):
    for j in range(l + 1, min(r+1, (l + 4038))):
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019
print(ans)

Fixed submission:
l, r = map(int, input().split())
ans = 9999
r = min(r, l+4038)
for i in range(l, r):
    for j in range(i + 1, r+1):
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())
ans = 9999
for i in range(l, r):
    for j in range(l + 1, r + 1):
        # print(i, j, (i*j) % 2019)
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019
print(ans)

Fixed submission:
l, r = map(int, input().split())
ans = 9999
r = min(r, l+4038)
for i in range(l, r):
    for j in range(i + 1, r+1):
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019
print(ans)