Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(a[i]-i-1 for i in range(n))
b.sort()

def sadness(x,y):
  s = 0
  for i in range(len(y)):
    s += abs(y[i]-x)
  return s

if n%2 == 0:
  print(sadness(a[n/2],b))
else:
  print(sadness(a[(n-1)/2],b))


  
  
  

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(a[i]-i-1 for i in range(n))
b.sort()

def sadness(x,y):
  s = 0
  for i in range(len(y)):
    s += abs(y[i]-x)
  return s

if n%2 == 0:
  print(sadness(b[int(n/2)],b))
else:
  print(sadness(b[int((n-1)/2)],b))
Buggy python submission (verdict: Runtime Error):
s = str(input())
k = int(input())
sub = []
c = 5
if len(s)  < 5:
  c = len(s)
for i in range(c):
  for j in range(len(s)-i-1):
    sub.append(s[j:j+i+1])

sub = list(set(sub))
sub.sort()
print(sub[k-1])


Fixed submission:
s = str(input())
k = int(input())
sub = []
c = 5
if len(s)  < 5:
  c = len(s)
for i in range(c):
  for j in range(len(s)-i):
    sub.append(s[j:j+i+1])

sub = list(set(sub))
sub.sort()
print(sub[k-1])
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
t = "."*(w+2)
b = [t]
for i in range(h):
  s = str(input())
  s = "."+ s + "."
  b.append(s)
b.append(t)
for i in range(1,h+1):
  for j in range(1,w+1):
    if s[i][j] == "#":
      if all([s[i-1][j]==".",s[i+1][j]==".",s[i][j-1]==".",s[i][j+1]=="."]):
        print("No")
        exit()
print("Yes")

  

Fixed submission:
h,w = map(int,input().split())
t = "."*(w+2)
b = [t]
for i in range(h):
  s = str(input())
  s = "."+ s + "."
  b.append(s)
b.append(t)
for i in range(1,h+1):
  for j in range(1,w+1):
    if b[i][j] == "#":
      if all([b[i-1][j]==".",b[i+1][j]==".",b[i][j-1]==".",b[i][j+1]=="."]):
        print("No")
        exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b,c,x,y = map(int,input().split())
if 2*c-a-b >= 0:
  print(a*x+b*y)
else:
  s = 0
  if x => y:
    s += 2*c*x
    x -= y
    s += min(2*c,a)*x
    print(s)
  else:
    s += 2*c*y
    y -= x
    s += min(2*c,b)*y
    print(s)

Fixed submission:
a,b,c,x,y = map(int,input().split())
if 2*c-a-b >= 0:
  print(a*x+b*y)
else:
  s = 0
  if x >= y:
    s += 2*c*y
    x -= y
    s += min(2*c,a)*x
    print(s)
  else:
    s += 2*c*x
    y -= x
    s += min(2*c,b)*y
    print(s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
y = x.sorted()
a = y[n//2-1]
b = y[n//2]
for i in range(n):
  if x[i] <= a:
    print(b)
  else:
    print(a)

Fixed submission:
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
a = y[n//2-1]
b = y[n//2]
for i in range(n):
  if x[i] <= a:
    print(b)
  else:
    print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
bx = 0
by = 0
bt = 0
def p(t,x,y):
  if abs(x)+abs(y) > t:
    return True
  elif (t-abs(x)-abs(y))%2 == 1:
    return True
  else:
    return False
for _ in range(n):
  at,ax,ay = map(int,input().split())
  if p(at-bt,bx-ax,by-ay):
    print(p(t,bx-ax,by-ay))
    print("No")
    exit()
  bx = ax
  by = ay
  bt = at
print("Yes")  

Fixed submission:
n = int(input())
bx = 0
by = 0
bt = 0
def p(t,x,y):
  if abs(x)+abs(y) > t:
    return True
  elif (t-abs(x)-abs(y))%2 == 1:
    return True
  else:
    return False
for _ in range(n):
  at,ax,ay = map(int,input().split())
  if p(at-bt,bx-ax,by-ay):
    print("No")
    exit()
  bx = ax
  by = ay
  bt = at
print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
mx = 1
for i in range(2,n**(1/2)+1):
  if n%i == 0:
    mx = i
print(len(str(n//mx)))
    
    

Fixed submission:
n = int(input())
mx = 1
for i in range(2,int(n**(1/2))+1):
  if n%i == 0:
    mx = i
print(len(str(n//mx)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0
for i in range(1,N):
    for j in range(1,i+1):
        if i % j == 0:
            ans += 1
            #print(i,j)
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(1,N):
    #print((N-0.5)//i)
    ans += (N-1) // i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for i in range(len(A)-1):
    #print(A[i+1:])
    ans += (A[i] * sum(A[i+1:]))
print(ans % mod)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
X = sum(A)
for i in range(len(A)-1):
    Y = A[i]
    X -= Y
    ans += (Y * X)
print(ans % mod)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
K=int(input())
L=9*K
if L%7==0:
  L = L//7
for i in range(1,K+1):
  if 10 ** i % L == 1:
    print(i)
    sys.exit()
print(-1)


Fixed submission:
import sys
K=int(input())
L=9*K
if L%7==0:
  L = L//7
n = 1
for i in range(1,K+1):
  n = n * 10 % L
  if n == 1:
    print(i)
    sys.exit()
print(-1)

Buggy python submission (verdict: Runtime Error):
K = int(input())
ans = -1

if K % 7 == 0:
  for i in range(1,K+1):
    if 10 ** i % (9 * K / 7) == 1:
      ans = i
      break
else:
  for i in range(1,K+1):
    if 10 ** i % (9 * K) == 1:
      ans = i
      break
  
print(ans)


Fixed submission:
import sys
K=int(input())
L=9*K
if L%7==0:
  L = L//7
n = 1
for i in range(1,K+1):
  n = n * 10 % L
  if n == 1:
    print(i)
    sys.exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
L.R,d = map(int,input().split())
ans = 0
for i in range(L,R+1):
  if i % d == 0:
    ans += 1
print(ans)

Fixed submission:
L,R,d = map(int,input().split())
ans = 0
for i in range(L,R+1):
  if i % d == 0:
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
for l in range(1,N+1):
  ans = 0
  for i in range(1,101):
    for j in range(1,101):
      for k in range(1,101):
        f = i*i+j*j+k*k+i*j+j*k+k*i
        if f == l:
          ans += 1
  print(ans)


Fixed submission:
N = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for l in range(N):
  print(ans[l+1])
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
ans = 0
for i in range(len(S)):
  if S[i] != T[i]::
      ans += 1
print(ans)

Fixed submission:
S = input()
T = input()
ans = 0
for i in range(len(S)):
  if S[i] != T[i]:
      ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if B-A+ > (W-V)*T:
  print("YES")
else:
  print("NO")


Fixed submission:
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if abs(B-A)+(W-V)*T > 0:
  print("NO")
else:
  print("YES")

Buggy python submission (verdict: Runtime Error):
A,V = map(int,input().split())
B,W = map(int,input().split())
T
if B-A+(W-V)*T > 0:
  print("NO")
else:
  print("YES")

Fixed submission:
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if abs(B-A)+(W-V)*T > 0:
  print("NO")
else:
  print("YES")
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
print((A*(B*100))//100)

Fixed submission:
from decimal import Decimal
A,B = input().split()
print(int(Decimal(A)*Decimal(B)))
Buggy python submission (verdict: Runtime Error):
T = input()
print(T.replase("?","D"))

Fixed submission:
print(input().replace("?","D"))
Buggy python submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())
x = 30 * h + (m * 0.5) % 360
y = m * 6
sa = abs(x - y)
print(x,y,sa)
if a > b:
    c = b
    b = a
    a = c
t = (math.sin(math.radians(sa))) * b
f = math.sqrt(b ** 2 - t ** 2)
if sa >= 180:
    a = -a
print(math.sqrt((f - a) ** 2 + t ** 2))

Fixed submission:
A = input()
if A[-1] == "3":
    print("bon")
elif A[-1] == "0" or A[-1] == "1" or A[-1] == "6" or A[-1] == "8":
    print("pon")
else:
    print("hon")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
B = [i+1+A[i] for i in range(N)]
C = [i+1-A[i] for i in range(N)]
ans = 0
for j in range(N):
    ans += C[j:].count(B[j])
print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = Counter(list(i+1+A[i] for i in range(N)))
#print(B,B[3])
C = Counter((i+1-A[i] for i in range(N)))
ans = 0
#print(C)
for j in range(N):
    ans += B[j]*C[j]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
B = [[i+1+A[i], i+1-A[i]] for i in range(N)]
ans = 0
for j in range(N):
    for k in range(j+1,N):
        if B[j][0] == B[k][1]:
            ans += 1
print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = Counter(list(i+1+A[i] for i in range(N)))
#print(B,B[3])
C = Counter((i+1-A[i] for i in range(N)))
ans = 0
#print(C)
for j in range(N):
    ans += B[j]*C[j]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N):
    Ai = A[i]
    if Ai >= 2*10**5:
        pass
    else:
        for j in range(i+A[i],N):
            if j-i == Ai+A[j]:
                ans += 1
print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = Counter(list(i+1+A[i] for i in range(N)))
#print(B,B[3])
C = Counter((i+1-A[i] for i in range(N)))
ans = 0
#print(C)
for j in range(N):
    ans += B[j]*C[j]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(i+A[i],N):
        if j-i == A[i]+A[j]:
            ans += 1
print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = Counter(list(i+1+A[i] for i in range(N)))
#print(B,B[3])
C = Counter((i+1-A[i] for i in range(N)))
ans = 0
#print(C)
for j in range(N):
    ans += B[j]*C[j]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += math.gcd(math.gcd(i+1,j+1),k+1)
print(ans)


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

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input())
ans = 0

for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += gcd(i+1,j+1,k+1)
print(ans)

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

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


K = int(input())
ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += math.gcd(math.gcd(i+1,j+1),k+1)
print(ans)

Fixed submission:
from math import gcd
K = int(input())
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd(gcd(i,j),k)
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = Counter(A)
C = {key:(B[key]*(B[key]-1)//2) for key in B}
ans = sum(B.values())
for i in A:
    if C[i] < 2:
        print(ans)
    else:
        ans = ans - C[i] +(B[key-1]*(B[key]-2)//2)
        print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = Counter(A)
C = {key:(B[key]*(B[key]-1)//2) for key in B}
ans = sum(C.values())
#print(C,ans)
#print(C[3])
for i in A:
    if C[i] < 1:
        print(ans)
    else:
        print(ans - C[i] + (B[i]-1)*(B[i]-2)//2)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
A = list(map(int,input().split()))
S = Counter(A)
B = [[0,0,0]]*N
all_sum = 0
#print(S)
for i in S.keys():
    n = A.count(i)
    a = n*(n-1)//2
    if a >= 0 and (n-1)*(n-2)//2 >= 0:
        B[i-1]=(i-1,a,(n-1)*(n-2)//2)#キー、Nの組合せ、N-1の組合せ
    else:
        B[i-1]=(i,a,0)
    all_sum += a
    #print(all_sum,"all")
#print(B)
for j in range(N):
    print(all_sum-B[A[j]-1][1]+B[A[j]-1][2])

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = Counter(A)
C = {key:(B[key]*(B[key]-1)//2) for key in B}
ans = sum(C.values())
#print(C,ans)
#print(C[3])
for i in A:
    if C[i] < 1:
        print(ans)
    else:
        print(ans - C[i] + (B[i]-1)*(B[i]-2)//2)
Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(float,input().split())
print("Yes" if a**0.5+b**0.5 < c**0.5 and math.isclose(a**0.5+b**0.5 , c**0.5)==False else "No")


Fixed submission:
from decimal import Decimal
a,b,c = map(float,input().split())
print("Yes" if Decimal(a)**Decimal(0.5)+Decimal(b)**Decimal(0.5) < Decimal(c)**Decimal(0.5) else "No")
Buggy python submission (verdict: Runtime Error):
S = input()
if S[:2]=="hi" and S[2] != "i":
    print("Yes")
else:
    print("No")

Fixed submission:
S = input()
print("Yes" if S.count("hi")*2==len(S) else "No")
Buggy python submission (verdict: Runtime Error):
S = list(map(int,input().split())
print("Yes" if len(set(S))==2 else "No")

Fixed submission:
S = list(map(int,input().split()))
print("Yes" if len(set(S))==2 else "No")
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
A = [sum(p[i:i+K]) for i in range(N-K+1)]
print((max(A) + K) / 2)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
result = 0
p_t = [0]
for i in range(N):
    p_t.append(p[i]+p_t[i])
ans = p_t[K] - p_t[0]

for i in range(N-K):
    tmp = p_t[i+1+K] - p_t[i+1]
    if ans < tmp:
        ans = tmp
print((ans+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
result = 0
for i in range(N-K+1):
    if result <= sum(p[i:i+K]):
        result = sum(p[i:i+K])
    else:
        None
print((result+K)/2)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
result = 0
p_t = [0]
for i in range(N):
    p_t.append(p[i]+p_t[i])
ans = p_t[K] - p_t[0]

for i in range(N-K):
    tmp = p_t[i+1+K] - p_t[i+1]
    if ans < tmp:
        ans = tmp
print((ans+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
result = 0
for i in range(N-K+1):
    result = max(result,(sum(p[i:i+K])))
print((result+K)/2)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
result = 0
p_t = [0]
for i in range(N):
    p_t.append(p[i]+p_t[i])
ans = p_t[K] - p_t[0]

for i in range(N-K):
    tmp = p_t[i+1+K] - p_t[i+1]
    if ans < tmp:
        ans = tmp
print((ans+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
result = 0
for i in range(N-K+1):
    result = max(result,(sum(p[i:i+K])+K)/2)
print(result)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
result = 0
p_t = [0]
for i in range(N):
    p_t.append(p[i]+p_t[i])
ans = p_t[K] - p_t[0]

for i in range(N-K):
    tmp = p_t[i+1+K] - p_t[i+1]
    if ans < tmp:
        ans = tmp
print((ans+K)/2)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
WA = [0] * N
AC = [0] * N
for i in range(M):
    p,s = input().split()
    p = int(p)
    if AC[p-1] == 0:
        if s == "AC":
            AC[p-1] = 1
        else:
            WA[p-1] += 1
wa = 0
for j in range(M):
    if AC[j] == 1:
        wa += WA[j]
print(sum(AC),wa)

Fixed submission:
N, M = map(int, input().split())
WA = [0] * N
AC = [0] * N
for i in range(M):
    p,s = input().split()
    p = int(p)
    if AC[p-1] == 0:
        if s == "AC":
            AC[p-1] = 1
        else:
            WA[p-1] += 1
wa = 0
for j in range(N):
    if AC[j] == 1:
        wa += WA[j]
print(sum(AC),wa)
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
if A+B <= K:
print(0,0)
elif A >= K:
  print(A-K,B)
else:
  print(0,B-K+A)


Fixed submission:
A,B,K = map(int,input().split())
if A+B <= K:
  print(0,0)
elif A >= K:
  print(A-K,B)
else:
  print(0,B-K+A)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
S = sum(A)
a = 0
b = 0
for i in range(len(A)):
    if S/2 >= sum(A[:i]):
        a = sum(A[:i])
    else:
        b = sum(A[:i])
        break
print(min(abs(S-a*2),abs(S-b*2)))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
S = sum(A)
b = 0
a = 0
c = 0
if N == 2:
    print(abs(A[0]-A[1]))
else:
    for i in range(len(A)):
        if S/2-0.5 > a:
            a += A[i]
        else:
            b = a + A[i]
            c = a - A[i-1]
            break
        if i == len(A)-1:
            b = a
            a = a-A[i]
        else:
            None
    print(min(abs(S - a*2), abs(S - b*2),abs(S-c*2)))
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A-2*B < 0:
  print(0)
else:
  print(A-2*b)
  

Fixed submission:
A,B = map(int,input().split())
if A-2*B < 0:
  print(0)
else:
  print(A-2*B)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = tuple(map(int,input().split()))
for i in range(1,N+1):
  print(A.index(i)+1,end=" ")

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = [[i+1,A[i]] for i in range(N)]
B.sort(key=lambda x: x[1])
for j in range(N):
  if j == N-1:
    print(B[j][0])
  else:
    print(B[j][0] ,end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = tuple(map(int,input().split()))
B = [A.index(i)+1 for i in range(1,N+1)]
print(*B)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = [[i+1,A[i]] for i in range(N)]
B.sort(key=lambda x: x[1])
for j in range(N):
  if j == N-1:
    print(B[j][0])
  else:
    print(B[j][0] ,end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
B = [A.index(i)+1 for i in range(1,N+1)]
print(*B)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = [[i+1,A[i]] for i in range(N)]
B.sort(key=lambda x: x[1])
for j in range(N):
  if j == N-1:
    print(B[j][0])
  else:
    print(B[j][0] ,end=" ")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = []
C = 0
try:
    for i in range(N):
        if A[i] >= A[i + 1]:
            None
        else:
            B.append(A[C:i+1])
            C = i+1
except:
    if A[-2] >= A[-1]:
        B.append(A[C:])
    else:
        B.append(A[C:-1])
X = [len(B[j]) for j in range(len(B))]
print(max(X)-1)

Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))
B = []
C = 0
try:
    for i in range(N):
        if A[i] >= A[i + 1]:
            None
        else:
            B.append(A[C:i+1])
            C = i+1
except:
    try:
        if A[-2] >= A[-1]:
            B.append(A[C:])
        else:
            B.append(A[C:-1])
    except:
        print(0)
        sys.exit()
X = [len(B[j]) for j in range(len(B))]
print(max(X)-1)
Buggy python submission (verdict: Runtime Error):
import collections
from scipy.special import comb

N = int(input())
b =[]
for i in range(N):
    a = input()
    b.append([j for j in a])
    b[i].sort()
a = [''.join(j) for j in b]
b = [k for k in collections.Counter(a).values()]
c = 0
for x in range(len(b)):
    if b[x] > 1:
        c += comb(b[x], 2, exact=True)
    else:
        None
print(c)

Fixed submission:
import collections
import math

N = int(input())
b =[]
for i in range(N):
    a = input()
    b.append([j for j in a])
    b[i].sort()
a = [''.join(j) for j in b]
b = [k for k in collections.Counter(a).values()]
c = 0
for x in range(len(b)):
    if b[x] > 1:
        c += math.factorial(b[x]) // (math.factorial(b[x] - 2) * math.factorial(2))
    else:
        None
print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A,reverse=True)
max1 = B[0]
max2 = B[1]
print(max1,max2)
for i in N:
    if A[i] == max1:
        print(max2)
    else:
        print(max1)

Fixed submission:
import numpy as np
N = int(input())
num_list = [int(input()) for i in range(N)]
a = max(num_list)
if num_list.count(a) > 1:
  for j in range(N):
    print(a)
else:
  b = np.sort(num_list)
  c = b[-2]
  for k in range(int(num_list.index(a))):
    print(a)
  print(c)
  for l in range(N-int(num_list.index(a))-1):
    print(a)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A,reverse=True)
max1 = B[0]
max2 = B[1]
print(max1,max2)
for i in A:
    if A[i] == max1:
        print(max2)
    else:
        print(max1)

Fixed submission:
import numpy as np
N = int(input())
num_list = [int(input()) for i in range(N)]
a = max(num_list)
if num_list.count(a) > 1:
  for j in range(N):
    print(a)
else:
  b = np.sort(num_list)
  c = b[-2]
  for k in range(int(num_list.index(a))):
    print(a)
  print(c)
  for l in range(N-int(num_list.index(a))-1):
    print(a)
Buggy python submission (verdict: Runtime Error):
l,r = map(int,input().split())
b = sorted([i%2019 for i in range(l,min(r+1,l+2019))])
print(b[0]*b[1])

Fixed submission:
N,A,B = map(int,input().split())
if N*A > B:
  print(B)
else:
  print(A*N)
Buggy python submission (verdict: Runtime Error):
A = input().split()
print(count(A[0]))

Fixed submission:
A = input()
B = [i for i in A]
B.sort()
if B.count(B[0]) == 2:
  if B.count(B[-1]) == 2:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
from math import gcd
A,B,C,D = map(int,input().split())
ans = 0
N = 1
E = C*D//gcd(C,D)
ans += B-B//C-B//D+B//E
ans -= A-A//C-A//D+A//E
print(ans)

Fixed submission:
from fractions import gcd
A,B,C,D = map(int,input().split())
E = C*D//gcd(C,D)
ans = 0
ans += B-B//C-B//D+B//E
ans -= A-1-(A-1)//C-(A-1)//D+(A-1)//E
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(N):
    S, P = map(str, input().split())
    P = int(p)
    A.append([S, -P])
A.sort()
for i in A:
    print(A.index(i)+1)


Fixed submission:
N = int(input())
A = []
for i in range(N):
    S, P = map(str, input().split())
    P = int(P)
    A.append([S, -P])
S = sorted(A)
for j in S:
    print(A.index(j) + 1)
Buggy python submission (verdict: Runtime Error):
A,B =map(int,input().split())
if A >= 13:
  print(B)
elif A >= 6:
  print(B//2)
else:
print(0)


Fixed submission:
A,B = map(int,input().split())
if A >= 13:
  print(B)
elif 6 <= A <= 12:
  print(B//2)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
X = []
for i in range(M):
  L,R = map(int,input().split())
  for j in range (R-L+1):
    X.append(L + j)
X_duplicate = [x for x in set(X) if X.count(x) > M-1]
print(len(X_duplicate))

Fixed submission:
N,M = map(int,input().split())
L= 0
R = 10 ** 5
for i in range(M):
  Lm,Rm = map(int,input().split())
  L = max(L,Lm)
  R = min(R,Rm)
if R - L < 0:
  print(0)
else:
  print(R - L + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
X = []
for i in range(M):
  L,R = map(int,input().split())
  for j in range (R-L+1):
    A = L + j
    X.append(A)
X_duplicate = [x for x in set(X) if X.count(x) > M-1]
print(len(X_duplicate))

Fixed submission:
N,M = map(int,input().split())
L= 0
R = 10 ** 5
for i in range(M):
  Lm,Rm = map(int,input().split())
  L = max(L,Lm)
  R = min(R,Rm)
if R - L < 0:
  print(0)
else:
  print(R - L + 1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
print(N - K + 1)

Fixed submission:
a,b = map(int,input().split())
print(a - b + 1)