Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
A,B,N=map(int,input().split())
range_list=list(range(0,N+1))
data2 = list(map(lambda x: math.floor(A*x/B)-(A*math.floor(x/B)), range_list))
print(max(data2))

Fixed submission:
A,B,N=map(int,input().split())
if B<=N:
    print(int(A*(B-1)/B)-A*int((B-1)/B))
else:
    print(int(A*(N)/B)-A*int(N/B))

Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
A,B,N=map(int,input().split())
range_list=list(range(0,N+1))
data2 = np.array(list(map(lambda x: A*math.floor(x/B), range_list)))
data1 = np.array(list(map(lambda x: math.floor(A*x/B), range_list)))

print(max(data1-data2))


Fixed submission:
A,B,N=map(int,input().split())
if B<=N:
    print(int(A*(B-1)/B)-A*int((B-1)/B))
else:
    print(int(A*(N)/B)-A*int(N/B))

Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
A,B,N=map(int,input().split())
range_list=list(range(1,N+1))
data2 = np.array(list(map(lambda x: A*math.floor(x/B), range_list)))
data1 = np.array(list(map(lambda x: math.floor(A*x/B), range_list)))

print(max(data1-data2))


Fixed submission:
A,B,N=map(int,input().split())
if B<=N:
    print(int(A*(B-1)/B)-A*int((B-1)/B))
else:
    print(int(A*(N)/B)-A*int(N/B))

Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
A,B,N=map(int,input().split())
range_list=list(range(1,N))
data2 = np.array(list(map(lambda x: A*math.floor(x / B), range_list)))
data1 = np.array(list(map(lambda x: math.floor(A*x / B), range_list)))

print(max(data1-data2))


Fixed submission:
A,B,N=map(int,input().split())
if B<=N:
    print(int(A*(B-1)/B)-A*int((B-1)/B))
else:
    print(int(A*(N)/B)-A*int(N/B))

Buggy python submission (verdict: Time Limit Exceeded):
import math
A,B,N=map(int,input().split())
range_list=range(N+1)
max_value=0
for i in range(N+1):
    check_value=math.floor(A*i/B)-A*math.floor(i/B)
    if(max_value<=check_value):
        max_value=check_value
print(max_value)


Fixed submission:
A,B,N=map(int,input().split())
if B<=N:
    print(int(A*(B-1)/B)-A*int((B-1)/B))
else:
    print(int(A*(N)/B)-A*int(N/B))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A= list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i))


Fixed submission:
N=int(input())
A= list(map(int,input().split()))
L = [0]*(N+1)
for i in A:
    L[i]+=1
for i in L[1:]:
    print(i)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
color = []
if(A==0):
    print(0)
else:
    while len(color)<N:
        color.extend([1]*A)
        color.extend([0]*B)
    print(color[:N].count(1))

Fixed submission:
N,A,B = map(int,input().split())
count=N//(A+B)
plus = N%(A+B)
print(A*count+min(A,plus))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))
ans_count=N
for i in range(1,N):
    if(P[i]>=min(P[:i])):
        ans_count-=1
print(ans_count)



Fixed submission:
N = int(input())
P = list(map(int,input().split()))
minP = P[0]
ans = 1
for i in P[1:]:
    if(i<=minP):
        minP = i
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))
ans_count=[True]*N
for i in range(1,N):
    if(P[i]>=min(P[:i])):
        ans_count[i]=False
print(ans_count.count(True))



Fixed submission:
N = int(input())
P = list(map(int,input().split()))
minP = P[0]
ans = 1
for i in P[1:]:
    if(i<=minP):
        minP = i
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))
ans_count=[True]*N
for i in range(1,N):
    if(P[i]>=min(P[:i])):
        ans_count[i]=False
print(ans_count.count(True))


Fixed submission:
N = int(input())
P = list(map(int,input().split()))
minP = P[0]
ans = 1
for i in P[1:]:
    if(i<=minP):
        minP = i
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))
ans_count=[True]*N
for i in range(N):
    for j in range(i):
        if(P[i]>=P[j]):
            ans_count[i]=False
print(ans_count.count(True))


Fixed submission:
N = int(input())
P = list(map(int,input().split()))
minP = P[0]
ans = 1
for i in P[1:]:
    if(i<=minP):
        minP = i
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans_list=[0]*N

for i in range(1,N+1):
    ans_list[i-1]=A.index(i)+1
print(' '.join(map(str,ans_list)))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans_list=[0]*N

for i in range(N):
    ans_list[A[i]-1]= i+1
print(' '.join(map(str,ans_list)))
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = [0]*(N+1)
pass_list = [0]*(N+1)
for i in range(M):
    b = int(input())
    a[b] = 1
if(a[1] !=1):
    pass_list[1]=1
if(a[2] !=1):
    pass_list[2]=1
for i in range(2,N+1):
    if(a[i] != 1):
        pass_list[i] += pass_list[i-1]+pass_list[i-2]
print(pass_list[N]%1000000007)


Fixed submission:
N,M = map(int,input().split())
a = [0]*(N+2)
pass_list = [0]*(N+2)

for i in range(M):
    b = int(input())
    a[b] = 1
if(a[1] !=1):
    pass_list[1]=1
if(a[2] !=1):
    pass_list[2]=1
for i in range(2,N+1):
    if(a[i] != 1):
        pass_list[i] += pass_list[i-1]+pass_list[i-2]
print(pass_list[N]%1000000007)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
check = False
a = []
pass_list = [0]*(N+1)
a.append(int(input()))
for i in range(1,M):
    a.append(int(input()))
    
if(1 not in a):
    pass_list[1]=1
if(2 not in a):
    pass_list[2]=1
for i in range(2,N+1):
    if(i not in a):
        pass_list[i] += pass_list[i-1]+pass_list[i-2]
print(pass_list[N]%1000000007)


Fixed submission:
N,M = map(int,input().split())
a = [0]*(N+2)
pass_list = [0]*(N+2)

for i in range(M):
    b = int(input())
    a[b] = 1
if(a[1] !=1):
    pass_list[1]=1
if(a[2] !=1):
    pass_list[2]=1
for i in range(2,N+1):
    if(a[i] != 1):
        pass_list[i] += pass_list[i-1]+pass_list[i-2]
print(pass_list[N]%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = input()
ans = [0]*Q
for i in range(Q):
    l,r = map(int,input().split())
    print(S[l-1:r].count("AC"))


Fixed submission:
N,Q = map(int,input().split())
S = input()
t = [0]*(N+1)
l = [0]*Q
r = [0]*Q
for i in range(N-1):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = input()
ans = [0]*Q
for i in range(Q):
    l,r = map(int,input().split())
    ans[i]=S[l-1:r].count("AC")
for i in range(Q):
    print(ans[i])

Fixed submission:
N,Q = map(int,input().split())
S = input()
t = [0]*(N+1)
l = [0]*Q
r = [0]*Q
for i in range(N-1):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
x = list(map(int,input().split()))
ans = float('inf')
if(0 in x):
    K=K-1
    x.remove(0)
for i in range(0,N-K):
    if((x[i]<0)):
        if(x[i+K-1]>0):
            ans = min(ans,abs(x[i])*2+x[i+K-1],abs(x[i])+x[i+K-1]*2)
        else:
            ans = min(ans,abs(x[i])*2)
    else:
            ans = min(ans,x[i+K-1])
print(ans)

Fixed submission:
N,K = map(int,input().split())
x = list(map(int,input().split()))
ans = float('inf')
if(0 in x):
    K=K-1
    x.remove(0)
    if(K==0):
        print(0)
        exit()
for i in range(0,N-K+1):
    if((x[i]<0)):
        if(x[i+K-1]>0):
            ans = min(ans,abs(x[i])*2+x[i+K-1],abs(x[i])+x[i+K-1]*2)
        else:
            ans = min(ans,abs(x[i]))
    else:
            ans = min(ans,x[i+K-1])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())
ans = N
for i in range(N):
    ans=min(ans,S[i+1:].count('E')+S[:i].count('W'))
print(ans)

Fixed submission:
N = int(input())
S = list(input())
e=S[1:].count('E')
w=S[:0].count('W')
ans = e+w
for i in range(1,N):
    if(S[i]=='E'):
        e=e-1
    if(S[i-1]=='W'):
        w=w+1
    ans=min(ans,e+w)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N,K = map(int,input().split())
A = list(map(int,input().split()))

c = collections.Counter(A)
ans = 0
len_A=len(set(A))
if(len_A<=K):
    print(ans)
else:
    for i in range(len_A-K):
        ans +=c.most_common()[-1*(i+1)][1]
    print(ans)

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

c = collections.Counter(A)
ans = 0
d=c.most_common()
len_A=len(set(A))
if(len_A<=K):
    print(ans)
else:
    for i in range(len_A-K):
        ans +=d[-1*(i+1)][1]
    print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
check = N%2==0
for i,j in enumerate(a[1:]):
    if(check):
        if(i%2==0):
            ans.insert(0,j)
        else:
            ans.append(j)
    else:
        if(i%2==1):
            ans.insert(0,j)
        else:
            ans.append(j)
print(" ".join(map(str,ans)))

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

ans = [a[0]]
check = N%2==0
for i,j in enumerate(a[1:]):
    if(check):
        if(i%2==0):
            ans.insert(0,j)
        else:
            ans.append(j)
    else:
        if(i%2==1):
            ans.insert(0,j)
        else:
            ans.append(j)
print(" ".join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
ans = [a[0]]
for i,j in enumerate(a[1:]):
    if(N%2==0):
        if(i%2==0):
            ans.insert(0,j)
        else:
            ans.append(j)
    else:
        if(i%2==1):
            ans.insert(0,j)
        else:
            ans.append(j)
print(" ".join(map(str,ans)))

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

ans = [a[0]]
check = N%2==0
for i,j in enumerate(a[1:]):
    if(check):
        if(i%2==0):
            ans.insert(0,j)
        else:
            ans.append(j)
    else:
        if(i%2==1):
            ans.insert(0,j)
        else:
            ans.append(j)
print(" ".join(map(str,ans)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
color = [False]*8
over_human = 0
for i in a:
    if(i<=399):
        color[0]=True
    elif(i<=799):
        color[1]=True
    elif(i<=1199):
        color[2]=True
    elif(i<=1599):
        color[3]=True
    elif(i<=1999):
        color[4]=True
    elif(i<=2399):
        color[5]=True
    elif(i<=2799):
        color[6]=True
    elif(i<=3199):
        color[7]=True
    elif(i>=3200):
        over_human += 1
if(color.count(True)==0):
    print(1,color.count(True)+over_human))
else:
    print(color.count(True),color.count(True)+over_human))


Fixed submission:
N = int(input())
a = list(map(int,input().split()))
color = [False]*8
over_human = 0
for i in a:
    if(i<=399):
        color[0]=True
    elif(i<=799):
        color[1]=True
    elif(i<=1199):
        color[2]=True
    elif(i<=1599):
        color[3]=True
    elif(i<=1999):
        color[4]=True
    elif(i<=2399):
        color[5]=True
    elif(i<=2799):
        color[6]=True
    elif(i<=3199):
        color[7]=True
    elif(i>=3200):
        over_human += 1
if(color.count(True)==0):
    print(1,color.count(True)+over_human)
else:
    print(color.count(True),color.count(True)+over_human)
Buggy python submission (verdict: Runtime Error):
n = int(input())
seen = set()
ans = 0
res = 7%n
seen.add(res)
ans += 1
while res != 0:
	new = (res*10 + 7)%n
    if new not in seen:
		seen.add(new)
        res = new
        ans += 1
	else:
    	print(-1):
        exit()
print(ans)

Fixed submission:
k = int(input())
ans = 1
seen = set()
mod = 7%k
while mod != 0 and mod not in seen:
    seen.add(mod)
    mod = (10*mod + 7)%k
    ans += 1

if mod == 0:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
data = list(map(int, input().split()))

table = [0] * 100
for a in data:
    a -= 1
    table[a] = 1

x -= 1
left = None
idx = x
while idx > 0:
    if table[idx] == 0:
       left = idx
       break
    idx -= 1
idx = x
right = None
while idx < 100:
    if table[idx] == 0:
        right = idx
        break
    idx += 1

lscore = abs(x-left)
rscore = abs(x-right)

if lscore <= rscore:
    print(left+1)
else:
    print(right+1)

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

table = [0] * 102
for a in data:
    table[a] = 1

left = None
idx = x
while idx >= 0:
    if table[idx] == 0:
       left = idx
       break
    idx -= 1
idx = x
right = None
while idx < 102:
    if table[idx] == 0:
        right = idx
        break
    idx += 1

lscore = abs(x-left)
rscore = abs(x-right)

if lscore <= rscore:
    print(left)
else:
    print(right)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
data = list(map(int, input().split()))
ans = 1
for i in data:
    ans*=i
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
import numpy as np
n = int(input())
data = list(map(int, input().split()))
if 0 in data:
    print(0)
    exit()
ans = 1
for a in data:
    ans*=a
    if ans > 10**18:
        print(-1)
        exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from queue import Queue
def bfs(target, graph, ans):
    visited = [False]*len(graph)
    que = Queue()
    que.put(target)
    visited[target] = True
    distance = [0]*len(graph)
    while not que.empty():
        root = que.get()
        for dst in graph[root]:
            if visited[dst] is False:
                visited[dst] = True
                que.put(dst)
                dist = distance[root] + 1
                distance[dst] = dist
                ans[dist-1] += 1 

n, x, y = map(int, input().split())
graph = {i:[] for i in range(n)}
for i in range(n-1):
    graph[i].append(i+1)
    graph[i+1].append(i)
graph[x-1].append(y-1)
graph[y-1].append(x-1)
ans = [0]*(n-1)
for target in range(n):
    bfs(target, graph, ans)

for a in ans:
    print(a//2)

Fixed submission:
n, x, y = map(int, input().split())
x -= 1
y -= 1
dist = [0]*(n-1)
for start in range(n):
    for end in range(start+1, n):
        dst = min(end-start, abs(x-start) + abs(end-y) + 1)
        dist[dst-1] += 1

for d in dist:
    print(d)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
r, ss, p = map(int, input().split())
s = input()
hands = [None]*n
wins = {'r':'p', 's':'r', 'p':'s'}
h_s = {'r':r, 's':ss, 'p':p}
ans = 0
for i, c in enumerate(s):
    if i - k >= 0:
        if wins[c] == hands[i-k]:æ
            hs = set(wins.keys())
            hs.remove(wins[c])
            if i + k < n:
                if wins[s[i+k]] in hs:
                    hs.remove(wins[s[i+k]])
            hands[i] = hs.pop()
            continue
    hand = wins[c]
    hands[i] = hand
    ans += h_s[hand]

print(ans)
        




Fixed submission:
n, k = map(int, input().split())
r, ss, p = map(int, input().split())
s = input()
hands = [None]*n
wins = {'r':'p', 's':'r', 'p':'s'}
h_s = {'r':r, 's':ss, 'p':p}
ans = 0
for i, c in enumerate(s):
    if i - k >= 0:
        if wins[c] == hands[i-k]:
            hs = set(wins.keys())
            hs.remove(wins[c])
            if i + k < n:
                if wins[s[i+k]] in hs:
                    hs.remove(wins[s[i+k]])
            hands[i] = hs.pop()
            continue
    hand = wins[c]
    hands[i] = hand
    ans += h_s[hand]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import re
n = int(input())
s = input()
ans = 0
for i in range(1000):
    i = str(i).zfill(3)
    if re.search('{}.*{}.*{}'.format(i[0],i[1],i[2]), s):
        ans += 1

print(ans)


Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    idx = 0
    target = key[idx]
    for ii in s:
        if target == ii:
            idx += 1
            if idx > 2:
                ans += 1
                break
            target = key[idx]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import re
n = int(input())
s = input()
ans = 0
for i in itertools.product(range(10),repeat=3):
    if re.search('{}.*{}.*{}'.format(i[0],i[1],i[2]), s):
        ans += 1

print(ans)


Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(1000):
    key = str(i).zfill(3)
    idx = 0
    target = key[idx]
    for ii in s:
        if target == ii:
            idx += 1
            if idx > 2:
                ans += 1
                break
            target = key[idx]
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import atan, radians, degrees

a, b, x = map(int, input().split())
h = x/(a**2)
he = b - h

if 2*h >= b:
    ans = degrees(atan((2*b-2*h)/a))
    print(ans)

else 2*he >= a:
    ans = degrees(atan(b**2/(2*h*a)))
    print(ans)


Fixed submission:
from math import atan, radians, degrees

a, b, x = map(int, input().split())
h = x/(a**2)
he = b - h

if 2*h >= b:
    ans = degrees(atan((2*b-2*h)/a))
    print(ans)

else:
    ans = degrees(atan(b**2/(2*h*a)))
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def __bisect_left(data, x, left, right):
    if left >= right:
        return right
    mid = (left+right)//2
    if data[mid] >= x:
        return __bisect_left(data, x, left, mid-1)
    else:
        return __bisect_left(data, x, mid+1, right)

def bisect_left(data, x, left):
    return __bisect_left(data, x, left, len(data))
    
n = int(input())
sides = list(map(int, input().split()))
sides.sort()
ans = 0
for a in range(len(sides)):
    for b in range(a+1,len(sides)):
        bound = bisect_left(sides, sides[a]+sides[b], b+1)
        if bound >= n:
            ans += bound - b - 1
        elif sides[bound] < sides[b]:
            ans += bound - b
        elif bound > b+1:
            ans += bound - b - 1

print(ans)
           

Fixed submission:
from bisect import bisect_left
n = int(input())
sides = list(map(int, input().split()))
sides.sort()
ans = 0
for a in range(len(sides)):
    for b in range(a+1,len(sides)):
        bound = bisect_left(sides, sides[a]+sides[b], b+1)
        if bound >= n:
            ans += bound - b - 1
        elif sides[bound] < sides[b]:
            ans += bound - b
        elif bound > b+1:
            ans += bound - b - 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def __lower_bound(arr, x, left, right):
    if left >= right:
        return right
    mid = (left+right)//2
    if arr[mid] < x:
        return __lower_bound(arr, x, mid+1, right)
    else:
        return __lower_bound(arr, x, left, mid-1)
def lower_bound(arr, x, left, right):
    result = __lower_bound(arr, x, left, right)
    if arr[result] >= x:
        result -= 1
    return result

n = int(input())
data = list(map(int, input().split()))
data.sort()
ans = 0
for a in range(n):
    for b in range(a+1, n):
        bound = lower_bound(data, data[a]+data[b], b+1, n-1)
        if bound >= 0:
            ans += bound - b

print(ans)

Fixed submission:
from bisect import bisect_left
n = int(input())
sides = list(map(int, input().split()))
sides.sort()
ans = 0
for a in range(len(sides)):
    for b in range(a+1,len(sides)):
        bound = bisect_left(sides, sides[a]+sides[b], b+1)
        if bound >= n:
            ans += bound - b - 1
        elif sides[bound] < sides[b]:
            ans += bound - b
        elif bound > b+1:
            ans += bound - b - 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(key = lambda x: -x)

if n == 1:
    print(a[0]//2**m)
    exit()

# idx = 0
while m > 0:
    a[0] //= 2
    idx = 0
    m -= 1
    if m <= 0: break
    while idx < n-1 and a[idx] < a[idx+1]:
        a[idx], a[idx+1] = a[idx+1],a[idx]
        idx += 1
    # idx = 0

print(sum(a))



Fixed submission:
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: -int(x), input().split()))
heapq.heapify(a)

if n == 1:
    print(-a[0]//2**m)
    exit()

for _ in range(m):
    heapq.heappush(a, -1*(-heapq.heappop(a)//2))

print(-sum(a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
d, m = divmod(n,2)
if m != 0
    print(n*d)

else:
    print(n*(d - 1) + d)

Fixed submission:
n = int(input())
d,m = divmod(n,2)
if m != 0:
    print(n*d)

else:
    print(n*(d - 1) + d)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
print(np.sum(np.arange(n)))

Fixed submission:
n = int(input())
d,m = divmod(n,2)
if m != 0:
    print(n*d)

else:
    print(n*(d - 1) + d)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
print(sum(range(n)))

Fixed submission:
n = int(input())
d,m = divmod(n,2)
if m != 0:
    print(n*d)

else:
    print(n*(d - 1) + d)
Buggy python submission (verdict: Time Limit Exceeded):
def count(data):
    dic = {}
    for d in data:
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
    return dic

n = int(input())
data = []
for _ in range(n):
    s = input()
    data.append(count(s))
ans = 0
for i in range(n):
    for ii in range(i+1, n):
        if data[i] == data[ii]:
            ans += 1
print(ans)



Fixed submission:
def count(data):
    dic = {}
    for d in data:
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
    return dic

n = int(input())
counts = {}
for _ in range(n):
    s = ''.join(sorted(input()))
    if s in counts:
        counts[s] += 1
    else:
        counts[s] = 1

ans = 0
for v in counts.values():
    ans += (v*(v-1))//2
print(ans)

Buggy python submission (verdict: Runtime Error):
def count(data):
    dic = {}
    for d in data:
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
    return dic

n = int(input())
data = []
for _ in range(n):
    s = input()
    data.append(count(s))
ans = 0
for i in range(n):
    for ii in range(i+1, n):
        if data[i] == data[ii]|:
            ans += 1
print(ans)



Fixed submission:
def count(data):
    dic = {}
    for d in data:
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
    return dic

n = int(input())
counts = {}
for _ in range(n):
    s = ''.join(sorted(input()))
    if s in counts:
        counts[s] += 1
    else:
        counts[s] = 1

ans = 0
for v in counts.values():
    ans += (v*(v-1))//2
print(ans)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
    exit()

l = l%2019
r = r%2019

if l >= r:
    print(0)
else:
    ans = float('inf')
    for left in range(l, r+1):
        for right in range(left+1, r+1):
            # ans = min(ans, (left*right)%2019)
            score = (left*right)%2019
            if score < ans:
                print(f'{left}, {right}: {score}')
                ans = score
    print(ans)

Fixed submission:
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
    exit()

l = l%2019
r = r%2019

if l >= r:
    print(0)
else:
    ans = float('inf')
    for left in range(l, r):
        for right in range(left+1, r+1):
            ans = min(ans, (left*right)%2019)
    print(ans)
Buggy python submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())
multi = 1 if 2*x == w and 2**y == h else 0
print(w*b/2, multi)

Fixed submission:
w, h, x, y = map(int, input().split())
multi = 1 if 2*x == w and 2*y == h else 0
print(w*h/2, multi)