Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.unit64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
      d[a::a] += 1
    else:
      d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
print(main())


Fixed submission:
import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.uint64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
      d[a::a] += 1
    else:
      d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
main()

Buggy python submission (verdict: Runtime Error):
import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.unit64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
        d[a::a] += 1
      else:
        d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
main()


Fixed submission:
import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.uint64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
      d[a::a] += 1
    else:
      d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
main()

Buggy python submission (verdict: Runtime Error):
import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.unit64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
      if a != a1:
        d[a::a] += 1
      else:
        d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
main()


Fixed submission:
import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.uint64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
      d[a::a] += 1
    else:
      d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
main()

Buggy python submission (verdict: Runtime Error):
import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.unit64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
      if a != a1:
        d[a::a] += 1
      else:
        d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
print(main())

Fixed submission:
import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.uint64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
      d[a::a] += 1
    else:
      d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
main()
Buggy python submission (verdict: Runtime Error):
k = int(input())
s = input()

if k < len(s):
  s = s[0,k]+"..."
print(s)



Fixed submission:
K = int(input())
S = input()

if len(S) > K:
  S = S[:K] + "..."

print(S)

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

if k < len(s):
  s = s[0,k]+"..."
print(s)

Fixed submission:
K = int(input())
S = input()

if len(S) > K:
  S = S[:K] + "..."

print(S)
Buggy python submission (verdict: Runtime Error):
a, b, c, k = int(input())

if k <= a:
  print(k)
elif k <= a + b:
  print(a)
else:
  print(a-(k - (a + b)))

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

if k <= a:
  print(k)
elif k <= a + b:
  print(a)
else:
  print(a-(k - (a + b)))

Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  if(k <= a) cout << k << endl;
  else if(k <= a + b) cout << a << endl;
  else cout << a - (k - a - b) << endl;
  return 0;
}


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

if k <= a:
  print(k)
elif k <= a + b:
  print(a)
else:
  print(a-(k - (a + b)))
Buggy python submission (verdict: Runtime Error):
n,m,q = map(int,input().split())
arr = [list(map(int,input().split())) for x in range(q)]
ans = 0

for i1 in range(1,m+1):
  for i2 in range(i1,m+1):
    for i3 in range(i2,m+1):
      for i4 in range(i4,m+1):
        for i5 in range(i4,m+1):
          for i6 in range(i5,m+1):
            for i7 in range(6,m+1):
              for i8 in range(i7,m+1):
                for i9 in range(i8,m+1):
                  for i10 in range(i9,m+1):
                    tmp = 0
                    arrs = [0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
                    for a,b,c,d in arr:
                      if arrs[b] - arrs[a] == c:
                        tmp += d
                    ans = max(ans,tmp)
print(ans)

Fixed submission:
n,m,q = map(int,input().split())
arr = [list(map(int,input().split())) for x in range(q)]
ans = 0

for i1 in range(1,m+1):
  for i2 in range(i1,m+1):
    for i3 in range(i2,m+1):
      for i4 in range(i3,m+1):
        for i5 in range(i4,m+1):
          for i6 in range(i5,m+1):
            for i7 in range(i6,m+1):
              for i8 in range(i7,m+1):
                for i9 in range(i8,m+1):
                  for i10 in range(i9,m+1):
                    tmp = 0
                    arrs = [0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
                    for a,b,c,d in arr:
                      if arrs[b] - arrs[a] == c:
                        tmp += d
                    ans = max(ans,tmp)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
ans = 0

for i in range(k, n+2):
  a = 0.5* i* (i-1)
  b = 0.5* n* (n+1) - 0.5* (n-i)* (n-i+1)
  ans += int(b-a+1)
  
print(ans%(10**9+7)

Fixed submission:
n,k = map(int,input().split())
ans = 0

for i in range(k, n+2):
  a = 0.5* i* (i-1)
  b = 0.5* n* (n+1) - 0.5* (n-i)* (n-i+1)
  ans += int(b-a+1)
  
print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
ans = s.count('R')*s.count('G')*s.count('B')

for i in range(n):
  if s[i] == 'R':
    s[i] = 1
  elif s[i] == 'G':
    s[i]
  elif s[i] == 'B':
    s[i] = 4
  
for i in range(n):
  for j in range(i+1, n):
    k = 2*j - i
    if k >= n:
      continue
    if s[i]+s[j]+s[k]==7:
      ans-=1

print(ans)


Fixed submission:
n = int(input())
s = list(input())
ans = s.count('R')*s.count('G')*s.count('B')

for i in range(n):
  if s[i] == 'R':
    s[i] = 1
  elif s[i] == 'G':
    s[i] = 2
  elif s[i] == 'B':
    s[i] = 4
  
for i in range(n):
  for j in range(i+1, n):
    k = 2*j - i
    if k >= n:
      continue
    if s[i]+s[j]+s[k]==7:
      ans-=1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
ans = s.count('R')*s.count('G')*s.count('B')

for i in range(n):
  if s[i] == 'R':
    s[i] = 1
  elif s[i] == 'G':
    s[i]
  elif s[i] = 4
  
for i in range(n):
  for j in range(i+1, n):
    k = 2*j - i
    if k >= n:
      continue
    if s[i]+s[j]+s[k]==7:
      ans-=1

print(ans)

Fixed submission:
n = int(input())
s = list(input())
ans = s.count('R')*s.count('G')*s.count('B')

for i in range(n):
  if s[i] == 'R':
    s[i] = 1
  elif s[i] == 'G':
    s[i] = 2
  elif s[i] == 'B':
    s[i] = 4
  
for i in range(n):
  for j in range(i+1, n):
    k = 2*j - i
    if k >= n:
      continue
    if s[i]+s[j]+s[k]==7:
      ans-=1

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = "No"

if s[2]==s[3]&&s[4]==s[5]:
  ans = "Yes"
  
print(ans)


Fixed submission:
s = input()
ans = "No"

if s[2]==s[3] and s[4]==s[5]:
  ans = "Yes"
  
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
ans = No

if s[2]==s[3]&&s[4]==s[5]:
  ans = Yes
  
print(ans)

Fixed submission:
s = input()
ans = "No"

if s[2]==s[3] and s[4]==s[5]:
  ans = "Yes"
  
print(ans)
Buggy python submission (verdict: Runtime Error):
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in (1,n):
  b.append(a[i] - a[i-1])
b.append(k - a[n-1] + a[0])
b = sorted(b)

print(sum(b[:-1]))

Fixed submission:
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i] - a[i - 1])
b.append(k - a[n-1] + a[0])

b = sorted(b)
print(sum(b[:n-1]))

Buggy python submission (verdict: Runtime Error):
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i]-a[i-1])
b.append(k-a[n-1]+a[0])

b.sorted(b)

print(sum(b[:-1]))


Fixed submission:
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i] - a[i - 1])
b.append(k - a[n-1] + a[0])

b = sorted(b)
print(sum(b[:n-1]))

Buggy python submission (verdict: Runtime Error):
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i]-a[i-1])
b.append(k-a[n-1]-a[0])

b.sorted(b)

print(sum(b[:-1]))

Fixed submission:
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i] - a[i - 1])
b.append(k - a[n-1] + a[0])

b = sorted(b)
print(sum(b[:n-1]))

Buggy python submission (verdict: Runtime Error):
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n+1):
  b.append(a[i] - a[i-1])
b.append(k - a[n] + a[0])
b = sorted(b)

print(sum(b[:n-1])


Fixed submission:
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i] - a[i - 1])
b.append(k - a[n-1] + a[0])

b = sorted(b)
print(sum(b[:n-1]))

Buggy python submission (verdict: Runtime Error):
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n+1):
  b.append(a[i] - a[i-1])
b.append(k - a[n] + a[0])
b = sorted(b)

print(sum(b[:n])

Fixed submission:
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i] - a[i - 1])
b.append(k - a[n-1] + a[0])

b = sorted(b)
print(sum(b[:n-1]))

Buggy python submission (verdict: Runtime Error):
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n+1):
  b.append(a[i] - a[i-1])
b.append(k - a[n] + a[0])
b = sorted(b)

print(sum(b:[:n])

Fixed submission:
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i] - a[i - 1])
b.append(k - a[n-1] + a[0])

b = sorted(b)
print(sum(b[:n-1]))
Buggy python submission (verdict: Runtime Error):
import collections

n = int(input())
arr = list(map(int,input().split()))
cnt = collectioms.Counter(arr)
total = 0

for key in cnt.keys():
  total += cnt[key] * (cnt[key] - 1)//2
  
for i in range(n):
  tmp = total
  tmp -= cnt[arr[i]]*(cnt[arr[i]] - 1)//2
  tmp += (cnt[arr[i]] - 1)*(cnt[arr[i]] - 2)//2
  print(tmp)

Fixed submission:
import collections

n = int(input())
arr = list(map(int,input().split()))
cnt = collections.Counter(arr)
total = 0

for key in cnt.keys():
  total += cnt[key] * (cnt[key] - 1)//2
  
for i in range(n):
  tmp = total
  tmp -= cnt[arr[i]]*(cnt[arr[i]] - 1)//2
  tmp += (cnt[arr[i]] - 1)*(cnt[arr[i]] - 2)//2
  print(tmp)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
ans = int(input())
for i in range(1001,-1,-1):
  money0 = int(i*0.08)
  money1= int(i*0.1)
  if money0==a and money1==b:
    ans = i
print(ans)


Fixed submission:
a,b = map(int,input().split())
ans =-1
for i in range(10000,-1,-1):
  money0 = int(i*0.08)
  money1= int(i*0.1)
  if money0==a and money1==b:
    ans = i
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
ans =-1
for i in range(10000,-1,-1):
  money0 = int(i*0.08)
  money1= int(i*0.1)
  if money0==a and money1==b:
    
print(ans)

Fixed submission:
a,b = map(int,input().split())
ans =-1
for i in range(10000,-1,-1):
  money0 = int(i*0.08)
  money1= int(i*0.1)
  if money0==a and money1==b:
    ans = i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
nums = list(map(int, input().split()))

sum_num = 0
for i in range(len(nums)):
    for j in range(i+1, len(nums)):
        sum_num += nums[i]*nums[j]
        if sum_num > 10**9 + 7:
            sum_num = sum_num%(10**9+7)
print(sum_num)

Fixed submission:
N = input()
nums = list(map(int, input().split()))
rests = []
rest_sum = 0
for i in reversed(nums):
    rest_sum += i
    rests.append(rest_sum)

sum_num = 0
for i in range(len(nums)-1):
    sum_num += nums[i]*rests[-(i+2)]
    if sum_num > 10**9 + 7:
        sum_num = sum_num % (10**9 + 7)
    

print(sum_num)
Buggy python submission (verdict: Time Limit Exceeded):
def test(N, A):
  B = 0
  mx = A[0]
  if N != 1: 
    for i in range(1,N):
      if A[i] - mx < 0:
        B = B + mx - A[i]
      mx = max(A[1:i+1])  
  return B

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

B = test(N, A)

print(B)

Fixed submission:
def test(N, A):
  B = 0
  mx = A[0]
  if N != 1: 
    for i in range(1,N):
      if A[i] - mx < 0:
        B = B + mx - A[i]
      else:
        mx = A[i];
  return B

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

B = test(N, A)

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

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
c=0
dp=[]
l.sort()
for i in range(n-2):
  k=i+2
  for j in range(i+1,n-1):
    while k<n and (l[i]+l[j])>l[k]:
      k+=1
    c+=k-j-1
print(c)

'''

1 2 3 4

1 < 2+3
2 < 1+3
3 < 1+2

6 - 1 = 5
6 - 2 = 4
6 - 3 = 3

'''
Buggy python submission (verdict: Time Limit Exceeded):
# n,k=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
for i in range(1,n+1):
  print(l.index(i)+1,end=" ")

Fixed submission:
# n,k=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
fi=[]
for i in range(n):
  ll=[]
  ll.append(l[i])
  ll.append(i+1)
  fi.append(ll)
fi.sort()
for i in fi:
  print(i[1],end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x=0
c=n
for i in range(1,n+1):
  x+=i%(c)
print(x)

Fixed submission:
n = int(input())
x=0
c=n
x=((n*(n-1))//2)
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
l = []
for _ in range(int(input())):
  s=input()
  s=list(s)
  s.sort()
  t=''.join(s)
  l.append(t)
c=0
for i in range(len(l)-1):
  for j in range(i+1,len(l)):
    if l[i]==l[j]:
      c+=1
print(c)

Fixed submission:
d={}
for _ in range(int(input())):
  s=input()
  s=list(s)
  s.sort()
  t=''.join(s)
  if t in d:
    d[t]+=1
  else:
    d[t]=1
c=0
# print(d)
for i in d:
  c+=(d[i]*(d[i]-1))//2
print(c)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
x=list(range(a,b+1))
y=list(range(c,d+1))
for i in range(b-a+1):
    for j in range(d-c+1):
        e=[x[i]*y[j]]
print(max(e))

Fixed submission:
a,b,c,d=map(int,input().split())
lists = []
lists.append(a*c)
lists.append(a*d)
lists.append(b*c)
lists.append(b*d)
print(max(lists))
Buggy python submission (verdict: Runtime Error):
x = int(input())

if x = 0:
  print(1)
elif x = 1:
  print(0)

Fixed submission:
x = int(input())
 
if x == 0:
  print(1)
elif x == 1:
  print(0)
Buggy python submission (verdict: Runtime Error):
n, d = map(int, input().split())
lst = [[int(j) for j in input().split()] for i in range(n)]
count = 0
for d in lst:
  distance = (d[0]**2 + d[1]**2)**0.5
  if distance <= d:
    count += 1
print(count)

Fixed submission:
n, d = map(int, input().split())
lst = [[int(j) for j in input().split()] for i in range(n)]
count = 0
for x in lst:
  distance = (x[0]**2 + x[1]**2)**0.5
  if distance <= d:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s = input()
t - input()
def hamming_dist(str1,str2):
    ans = 0
    a,b = len(str1),len(str2)
    if a > b:
        ans = a - b
        length = b
    elif a < b:
        ans = b - a
        length = a
    else:
        length = a
    for i in range(length):
        if str1[i] != str2[i]:
            ans += 1
    return ans
print(hamming_dist(s,t))

Fixed submission:
s = input()
t = input()
def hamming_dist(str1,str2):
    ans = 0
    a,b = len(str1),len(str2)
    if a > b:
        ans = a - b
        length = b
    elif a < b:
        ans = b - a
        length = a
    else:
        length = a
    for i in range(length):
        if str1[i] != str2[i]:
            ans += 1
    return ans
print(hamming_dist(s,t))
Buggy python submission (verdict: Runtime Error):
lst = [int(i) for i in input().split()]
for i in range(lst):
    if lst[i] == 0:
        ans = i+1
print(ans)

Fixed submission:
lst = [int(i) for i in input().split()]
for i in range(len(lst)):
    if lst[i] == 0:
        ans = i+1
print(ans)

Buggy python submission (verdict: Runtime Error):
lst = [int(i) for i in input().split()]
for i in range(lst):
  if lst[i] == 0:
    ans = i+1
print(ans)

Fixed submission:
lst = [int(i) for i in input().split()]
for i in range(len(lst)):
    if lst[i] == 0:
        ans = i+1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

total = 1
for i in range(n):
  x = int(input())
  total = total*x

if total <= 1000000000000000000:
  print(total)
else:
  print(-1)

Fixed submission:
n = int(input())
 
List = [int(i) for i in input().split()]
lst = sorted(List, reverse=True)
if lst[-1] == 0:
  print(0)
  exit()
total = 1
for i in lst:
  total = total*i
  if total > 1000000000000000000:
    print(-1)
    exit()
print(total)

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

List = [int(i) for i in input().split()]

total = 1
for i in List:
  total = total*i

if total <= 1000000000000000000:
  print(total)
else:
  print(-1)

Fixed submission:
n = int(input())
 
List = [int(i) for i in input().split()]
lst = sorted(List, reverse=True)
if lst[-1] == 0:
  print(0)
  exit()
total = 1
for i in lst:
  total = total*i
  if total > 1000000000000000000:
    print(-1)
    exit()
print(total)
Buggy python submission (verdict: Runtime Error):
a,b = map(float,input().split())

A = int(A)
B = int(round(float(B) * 100))

print(a*b//100)



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

a = int(a)
b = int(round(float(b) * 100))

print(a*b//100)

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

print(int(a*b))

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

a = int(a)
b = int(round(float(b) * 100))

print(a*b//100)
Buggy python submission (verdict: Runtime Error):
s,w = map(int,input.split())
if s > w:
  print("saffe")
else:
  print("unsafe")

Fixed submission:
s,w = map(int,input().split())
if s > w:
  print("safe")
else:
  print("unsafe")
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
lst = [ int(i) for i in input().split() ]

if n - lst.sum() >= 0:
  print(n-lst.sum())
else:
  print(-1)

Fixed submission:
n, m = map(int, input().split())
lst = [ int(i) for i in input().split() ]

if n - sum(lst) >= 0:
  print(n-sum(lst))
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = [ int(i) for i in input().split() ]

visited = {}

for d in lst:
  if d in visited.keys():
    visited[d] += 1
  else:
    visited[d] = 1
    
searched = {}
for i in range(n):
  if i in searched.keys():
    print(searched[i])
    continue
  visited[lst[i]] -= 1
  ans = 0
  for d in visited.keys():
    v = visited[d]
    ans += v*(v-1)/2
  print(int(ans))
  searched[i] = ans
  visited[lst[i]] += 1

Fixed submission:
n = int(input())
lst = [ int(i) for i in input().split() ]

visited = {}

for d in lst:
  if d in visited.keys():
    visited[d] += 1
  else:
    visited[d] = 1
count = 0
for d in visited.keys():
  count += int(visited[d]*(visited[d]-1)/2)
for d in lst:
  v = visited[d] - 1
  ans = count - v
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = [ int(i) for i in input().split() ]

visited = {}

for d in lst:
  if d in visited.keys():
    visited[d] += 1
  else:
    visited[d] = 1
for i in range(n):
  visited[lst[i]] -= 1
  ans = 0
  for d in visited.keys():
    v = visited[d]
    ans += v*(v-1)/2
  print(int(ans))
  visited[lst[i]] += 1

Fixed submission:
n = int(input())
lst = [ int(i) for i in input().split() ]

visited = {}

for d in lst:
  if d in visited.keys():
    visited[d] += 1
  else:
    visited[d] = 1
count = 0
for d in visited.keys():
  count += int(visited[d]*(visited[d]-1)/2)
for d in lst:
  v = visited[d] - 1
  ans = count - v
  print(ans)
Buggy python submission (verdict: Runtime Error):
s = intput()
if s == 'AAA' or s == 'BBB':
  print('No')
else:
  print('Yes')

Fixed submission:
s = input()
if s == 'AAA' or s == 'BBB':
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
n, r = map(int, input().split())
if n >= 10:
  print(r)
else:
  print(100(10-r))


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

if n >= 10:
  print(r)
else:
  print(r+100*(10-n))
Buggy python submission (verdict: Time Limit Exceeded):

def main():
  n, k = map(int, input().split())
  A = tuple(map(int, input().split()))

  prev = None
  s = 1
  for i in range(n):
    s *= A[i]
    if i >= k - 1:
      if i >= k:
        s //= A[i - k]
        if s > prev:
          print('Yes')
        else:
          print('No')

      prev = s



main()


Fixed submission:

def main():
  n, k = map(int, input().split())
  A = tuple(map(int, input().split()))

  for i in range(k, n):
    if A[i] > A[i - k]:
      print('Yes')
    else:
      print('No')



main()
Buggy python submission (verdict: Time Limit Exceeded):

def main():
  n = int(input())

  dp = [1] * (n + 1)

  ans = 1
  for num in range(2, n + 1):
    dp[num] += 1
    for i in range(num, n // num + 1):
      dp[num * i] += 1 if i == num else 2

    ans += num * dp[num]

  print(ans)


main()


Fixed submission:

def main():
  n = int(input())

  ans = 0
  for i in range(1, n + 1):
    y = n // i
    ans += y * (y + 1) * i // 2

  print(ans)


main()