Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
s = [list(input()) for i in range(h)]
dir = [[-1, 0], [1, 0], [0, -1], [0, 1]]
for y in range(h):
    for x in range(w):
        can_put = True
        if s[y][x] == "#":
            for dx, dy in dir:
                cx = x + dx
                cy = y + dy
                if x >= 0 and x < w and y >= 0 and y < h and s[cy][cx] == "#":
                    can_put = True
                    break
            else:
                can_put = False
        if can_put == False:
            break
if can_put == True:
    print("Yes")
else:
    print("No")


Fixed submission:
h, w = list(map(int, input().split()))
s = [list(input()) for i in range(h)]
dir = [[-1, 0], [1, 0], [0, -1], [0, 1]]
for y in range(h):
    for x in range(w):
        can_put = True
        if s[y][x] == "#":
            for dx, dy in dir:
                cx = x + dx
                cy = y + dy
                if cx >= 0 and cx < w and cy >= 0 and cy < h:
                    if s[cy][cx] == "#":
                        can_put = True
                        break
            else:
                can_put = False
        if can_put == False:
            break
    else:
        continue
    break
if can_put == True:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
s = [list(input()) for i in range(h)]
dir = [[-1, 0], [1, 0], [0, -1], [0, 1]]
for y in range(h):
    for x in range(w):
        if s[y][x] == "#":
            for dx, dy in dir:
                cx = x + dx
                cy = y + dy
                if x >= 0 and x < w and y >= 0 and y < h and s[cy][cx] == "#":
                    break
            else:
                break
    else:
        continue
    print("No")
    break
else:
    print("Yes")

Fixed submission:
h, w = list(map(int, input().split()))
s = [list(input()) for i in range(h)]
dir = [[-1, 0], [1, 0], [0, -1], [0, 1]]
for y in range(h):
    for x in range(w):
        can_put = True
        if s[y][x] == "#":
            for dx, dy in dir:
                cx = x + dx
                cy = y + dy
                if cx >= 0 and cx < w and cy >= 0 and cy < h:
                    if s[cy][cx] == "#":
                        can_put = True
                        break
            else:
                can_put = False
        if can_put == False:
            break
    else:
        continue
    break
if can_put == True:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a*b%2==0:
  print("Even")
else:
  print("Odd")


Fixed submission:
a,b=list(map(int,input().split()))
if a*b%2==0:
  print("Even")
else:
  print("Odd")

Buggy python submission (verdict: Runtime Error):
num = int(input())
a = list(map(int, input().split()))
count = 0
while(True):
    for i in range(num):
        if a[i] % 2 != 0:
            break
        else:
            a[i] /= 2
    else:
        count += 1
        continue
    break
print(count)

Fixed submission:
a,b=list(map(int,input().split()))
if a*b%2==0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = list(map(int, input().split()))
ans = 0
for i in range(a, b+1):
    if i % x == 0:
        ans += 1
print(ans)

Fixed submission:
a, b, x = list(map(int, input().split()))
b_ans = b//x
amin_ans = (a-1)//x
ans = b_ans-amin_ans
print(ans)
Buggy python submission (verdict: Runtime Error):
l,r = map(int,input().split())

if r-l >= 2019:
  ans = 0
else:
  mod_l = l % 2019  
  mod_r = r % 2019
  if mod_r < mod_l:
    ans = 0
  elif mod_l * mod_r == 0:
    ans = 0
    
  else:
    l_list=[]
    a = list(range(mod_l, mod_r+1))
    for i in range(mod_l, mod_r+1):
      ai = a[i]
      for j in range(i+1,mod_r+1):
        aj = a[j]
    l = (ai*aj) % 2019
    l_list.append(l)
    ans = min(l_list)
    
print(ans)

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

ans = min([b,n*a])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
a = []
for i in range(m):
  a.append(list(map(int, input().split())))
 
b = []
for i in range(m):
  c = a[i][0]
  d = a[i][1]
  for e in range(c,d+1):
    b.append(e)

c = [t for t in set(b) if b.count(t) == m]

print(len(c))

Fixed submission:
n,m = map(int, input().split())
a = []
b = []
c = []
for i in range(m):
  a.append(list(map(int, input().split())))
for i in range(m):
  b.append(a[i][0])
  c.append(a[i][1])
  
b_max = max(b)
c_min = min(c)

ans = max(0, min(c) - max(b) + 1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
a = []
for i in range(m):
  a.append(list(map(int, input().split())))

b = []
for i in range(m):
  c = a[i][0]
  d = a[i][1]
  for e in range(c,d+1):
    b.append(e)
  if i >= 1:
    c = [t for t in set(b) if b.count(t) == 2]
    b = c
  
print(len(b))

Fixed submission:
n,m = map(int, input().split())
a = []
b = []
c = []
for i in range(m):
  a.append(list(map(int, input().split())))
for i in range(m):
  b.append(a[i][0])
  c.append(a[i][1])
  
b_max = max(b)
c_min = min(c)

ans = max(0, min(c) - max(b) + 1)

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

N = int(input())
H = list(map(int, input().split()))
ans = ("Yes")

for i in range(N-1):
  if H[i] - H[i+1] == 1:
    H[i+1] -= 1
  elif H[i] - H[i+1] >= 2:
    ans = ("No")
    print(ans)
    sys.exit()

print(ans)

Fixed submission:
A, B, C = list(map(int, input().split()))
ans = max(C-A+B, 0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N = int(input())
H = list(map(int, input().split()))
ans = ("Yes")

for i in range(N-1):
  for j in range(N-i-1):
    if H[i]-H[i+j+1] >= 2:
      ans = ("No")
      print(ans)
      sys.exit()
      
print(ans)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = ("Yes")

for i in range(N-1):
    if H[N-1-i] - H[N-2-i] == -1:
        H[N-2-i] -= 1
    elif H[N-1-i] - H[N-2-i] <= -2:
        ans = ("No")

print(ans)
Buggy python submission (verdict: Runtime Error):
b = input()
if b == A:
  print("T")
elif b == C:
  print("G")
elif b == G:
  print("C")
else:
  print("A")

Fixed submission:
b = input()

if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "G":
  print("C")
else:
  print("A")
Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = input().split()
print('{:.0f}'.np.ceil((int(a)+int(b))/2))

Fixed submission:
import numpy as np
a,b = input().split()
print(int(np.ceil((int(a)+int(b))/2)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = int(input().split())
np.trunc((a+b)/2)

Fixed submission:
import numpy as np
a,b = input().split()
print(int(np.ceil((int(a)+int(b))/2)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = input().split()
np.trunc((a+b)/2)

Fixed submission:
import numpy as np
a,b = input().split()
print(int(np.ceil((int(a)+int(b))/2)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = input().split()
np.trunc((a+b)2)

Fixed submission:
import numpy as np
a,b = input().split()
print(int(np.ceil((int(a)+int(b))/2)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = input().split()
np.trunc(a+b/2)

Fixed submission:
import numpy as np
a,b = input().split()
print(int(np.ceil((int(a)+int(b))/2)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = input().split()
numpy.trunc(a+b/2)

Fixed submission:
import numpy as np
a,b = input().split()
print(int(np.ceil((int(a)+int(b))/2)))
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
count=0
a=[]
for i in range(1,n):
  if h[i]<=h[i-1]:
    count+=1
    a.append(count)
  else: 
    
    count=0

print(max(a))

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
count=0
a=[0]
for i in range(1,n):
  if h[i]<=h[i-1]:
    count+=1
    a.append(count)
  else: 
    
    count=0

print(max(a))

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
count=1
a=[]
for i in range(1,n):
  if h[i]<h[i-1]:
    count+=1
  else: 
    a.append(count)
    count=0
print(max(a))

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
count=0
a=[0]
for i in range(1,n):
  if h[i]<=h[i-1]:
    count+=1
    a.append(count)
  else: 
    
    count=0

print(max(a))
Buggy python submission (verdict: Time Limit Exceeded):
print(sum(range(int(input()))))

Fixed submission:
n=int(input())
print(n*(n-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
d = {}
for i in range(N):
  s = "".join(sorted(input()))
  if s in d.keys():
    d[s] += 1
  else:
    d.setdefault(s, 1)
count = 0
for v in d.values():
  count += (v-1)*v//2
print(count)

Fixed submission:
N = int(input())
d = {}
for i in range(N):
  s = "".join(sorted(input()))
  if s in d.keys():
    d[s] += 1
  else:
    d.setdefault(s, 1)
count = 0
for v in d.values():
  count += (v-1)*v//2
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
count = -N
List = [[c for c in input()] for i in range(N)]
for j in List:
  for k in List:
    if sorted(j) == sorted(k):
      count += 1
print(int(count/2))

Fixed submission:
N = int(input())
d = {}
for i in range(N):
  s = "".join(sorted(input()))
  if s in d.keys():
    d[s] += 1
  else:
    d.setdefault(s, 1)
count = 0
for v in d.values():
  count += (v-1)*v//2
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
count = -N
List = [[c for c in input()] for i in range(N)]
for j in List:
  for k in List:
    if sorted(j) == sorted(k):
      count += 1
print(int(count/2))

Fixed submission:
N = int(input())
d = {}
for i in range(N):
  s = "".join(sorted(input()))
  if s in d.keys():
    d[s] += 1
  else:
    d.setdefault(s, 1)
count = 0
for v in d.values():
  count += (v-1)*v//2
print(count)
Buggy python submission (verdict: Runtime Error):
n=[int(input()) for i in range(int(input()))]
print(sum(i for i in n)-int(max(l)/2))

Fixed submission:
n=[int(input()) for i in range(int(input()))]
#print(n)
print(sum(i for i in n)-int(max(n)/2))
Buggy python submission (verdict: Runtime Error):
n=int(input())
nlist=[input() for i in range(n)]
m=int(input())
mlist=[input() for i in range(m)]
set1=set(nlist)
print(mlist)
print(max(0,max(nlist.count(set1[i])-mlist.count(set1[i]) for i in len(set1))))

Fixed submission:
#n=[input() for _ in range(int(input()))]
#m=[input() for _ in range(int(input()))]
n1=int(input())
n=[input() for i in range(n1)]
m1=int(input())
m=[input() for i in range(m1)]
#print(n)
#print(m)
l=list(set(n))
#print(l)
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))
#print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))
Buggy python submission (verdict: Runtime Error):
input()
a=sorted(map(int, input().split()))[::-1]
print(sum(a[::2]-sum(a[1::2]))

Fixed submission:
input()
a=sorted(map(int, input().split()))[::-1]
print(sum(a[::2])-sum(a[1::2]))
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int, unput().split())
print(sum(i for i in range(n+1) if a<=sum(map(int,str(i)))<=b))

Fixed submission:
n,a,b = map(int, input().split())
print(sum(i for i in range(n+1) if a<=sum(map(int,str(i)))<=b))
Buggy python submission (verdict: Runtime Error):
print(input().count(1))

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
print("Yes" if input()[0]==input()[1] else "No")

Fixed submission:
a,b,c = input()
print("Yes" if a==c else "No")

Buggy python submission (verdict: Runtime Error):
a,b,c = input()
print("Yes" if a=c else "No")

Fixed submission:
a,b,c = input()
print("Yes" if a==c else "No")
Buggy python submission (verdict: Runtime Error):
O=list(input())
E=(input())+[""]
for o,e in zip(O,E): print(o+e,end="")


Fixed submission:
O=list(input())
E=list(input())+[""]
for o,e in zip(O,E): print(o+e,end="")
Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
  
min = 2019

for i in range(L, R):
  for j in range(i+1, R+1):
    if (j - i >= 2019):
      break
    
    result = (i * j) % 2019

    if (result < min):
      min = result
      if (min == 0):
        break
            
print(min)

Fixed submission:
L, R = map(int, input().split())
  
min = 2018

for i in range(L, R):
  for j in range(L + 1, R + 1):
    result = (i * j) % 2019
    if (result < min):
      min = result
      if min == 0:
        break
  if min == 0:
    break
    
print(min)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
  
min = 2019
for i in range(L, R):  
  for j in range(i+1, R+1):
    if (j - i >= 2019):
      break
    
    result = (i * j) % 2019

    if (result < min):
        min = result

print(min)

Fixed submission:
L, R = map(int, input().split())
  
min = 2018

for i in range(L, R):
  for j in range(L + 1, R + 1):
    result = (i * j) % 2019
    if (result < min):
      min = result
      if min == 0:
        break
  if min == 0:
    break
    
print(min)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
  
min = 2019
for i in range(L, R):
  for j in range(i+1, R+1):
    result = (i * j) % 2019

    if (result < min):
        min = result

print(min)

Fixed submission:
L, R = map(int, input().split())
  
min = 2018

for i in range(L, R):
  for j in range(L + 1, R + 1):
    result = (i * j) % 2019
    if (result < min):
      min = result
      if min == 0:
        break
  if min == 0:
    break
    
print(min)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
 
t = 0
for i in B:
  t = t + i
  
y = []
for x in range(len(A)):
  if A[x] + 1 == A[x+1]:
    y.append(x)
 
 
for k in range(len(y)):
  t = t + C[k]
print(t)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
 
t = 0
for i in B:
  t = t + i
  
y = []
for x in range(len(A)-1):
  if A[x] + 1 == A[x+1]:
    y.append(A[x]-1)
  else:
    pass
for k in y:
  t = t + C[k]
print(t)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
 
t = 0
for i in B:
  t = t + i
  
y = []
for x in ramnge(len(A)):
  if A[x] + 1 == A[x+1]:
    y.append(x)
 
 
for k in range(len(y)):
  t = t + C[k]
print(t)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
 
t = 0
for i in B:
  t = t + i
  
y = []
for x in range(len(A)-1):
  if A[x] + 1 == A[x+1]:
    y.append(A[x]-1)
  else:
    pass
for k in y:
  t = t + C[k]
print(t)

Buggy python submission (verdict: Runtime Error):
ソースコード 拡げる

Copy
Copy
N = int(input())
A = list(int,input().split())
B = list(int,input().split())
C = list(int,input().split())
 
t = 0
for i in B:
  t = t + i
  
y = []
for x in ramnge(len(A)):
  if A[x] + 1 == A[x+1]:
    y.append(x)
 

for k in range(len(y)):
  t = t + C[k]
print(t)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
 
t = 0
for i in B:
  t = t + i
  
y = []
for x in range(len(A)-1):
  if A[x] + 1 == A[x+1]:
    y.append(A[x]-1)
  else:
    pass
for k in y:
  t = t + C[k]
print(t)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

t = 0
for i in B:
  t = t + i
y = []
for x in ramnge(len(A)):
  if A[x] + 1 == A[x+1]:
    y.append(x)

z = 0
for k in range(len(y)):
  t = t + y[k]
print(t)
    
  

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
 
t = 0
for i in B:
  t = t + i
  
y = []
for x in range(len(A)-1):
  if A[x] + 1 == A[x+1]:
    y.append(A[x]-1)
  else:
    pass
for k in y:
  t = t + C[k]
print(t)
Buggy python submission (verdict: Runtime Error):
N = int(input())
B = [int(i) for i in input().split()]

if N == 2:
  print(N*B)
else:
  for i in B:
    if B[i] > B[i+1]:
      A[i] = B[i]
      A[i+1] = B[i]
    else:
      A[i] = B[i]
      A[i+1] = B[i+1]

x = 0
for x in A:
  x = x + A
print(x)

Fixed submission:
import sys
N = int(input())
B = [int(i) for i in input().split()]

A =[]
if N == 2:
    print(N*B[0])
    sys.exit()
else:
    if B[1] >= B[0]:
      A.append(B[0])
      A.append(B[0])
    else:
      A.append(B[0])
      A.append(B[1])
    for i in range(1,len(B)-1):
        if B[i+1] >= B[i]:
          A.append(B[i])
        else:
          A.append(B[i+1])
 
x = 0
for y in A:
  x = x + y
print(x+B[-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))

b = 0
 for i in range(0,N):
    b = b + 1/a[i]
print(1/b)

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

x = 2*D+1
y = N/x
z = N//x
if z==0:
    print(y)
else:
    print(z+1)


Fixed submission:
r = int(input())

print(3*r**2)
Buggy python submission (verdict: Runtime Error):
age, price = map(int, input().split())
if age >= 13:
	print(price)
elif: 6 <= age <= 12:
	print(price // 2)	
else:
	print(0)

Fixed submission:
age, price = map(int, input().split())
if age >= 13:
	print(price)
elif 6 <= age <= 12:
	print(price // 2)	
else:
	print(0)
Buggy python submission (verdict: Runtime Error):
b = list(map(int, input().split()))
codes = [list(map(int, input().split())) for _ in range(N)]

res = 0
for code in codes:
    s = C    
    for i in range(M):
        s += (code[i] * b[i])
    if s > 0:
        res += 1

print(res)


Fixed submission:
N, M, C = map(int, input().split())
b = list(map(int, input().split()))
codes = [list(map(int, input().split())) for _ in range(N)]

res = 0
for code in codes:
    s = C
    
    for i in range(M):
        s += (code[i] * b[i])

    if s > 0:
        res += 1

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))

INF = 10 ** 16

dp = [INF] * N
dp[0] = 0

for i in range(1, N):
    for j in range(i - 1, max(i - 1 - K, -1), -1):
        dp[i] = min(dp[i], dp[j] + abs(H[i] - H[j]))

print(dp[N - 1])


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

INF = 10 ** 16

dp = [INF] * N
dp[0] = 0

for i in range(1, N):
    for j in range(i - 1, max(i - 1 - K, -1), -1):
        dp[i] = min(dp[i], dp[j] + abs(H[i] - H[j]))

print(dp[N - 1])
Buggy python submission (verdict: Runtime Error):
N = int(input())

ans = int(N(N-1)/2)
print(ans)

Fixed submission:
N = int(input())

ans = (N * (N-1) // 2)
print(ans)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
N = int(input())
 
ans = int(N(N-1)/2)

Fixed submission:
N = int(input())

ans = (N * (N-1) // 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N = int(input())

ans = int(((1 + N)*N/2) - N)


for i in range(1, N):
    if i < N%i:
        ans -= i
        ans += N%i

print(ans)


Fixed submission:
N = int(input())

ans = (N * (N-1) // 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N = int(input())

ans = 0
for i in range(1, N):
    ans += i

print(ans)

Fixed submission:
N = int(input())

ans = (N * (N-1) // 2)
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import combinations
import math

N = int(input())
c = ["".join(sorted(str(input()))) for x in range(N)]
cs = Counter(c)

ans=0
for i in cs.values():
    ans += math.factorial(i)/2

print(int(ans))

Fixed submission:
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import combinations

N = int(input())
c = ["".join(sorted(str(input()))) for x in range(N)]
cs = Counter(c)

ans=0
for i in cs.values():
    if i!=1:
        ans += (i * (i-1))/2

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import combinations
import string

N = int(input())
cs = [Counter(x) for x in [str(input()) for x in range(N)]]

ans=0
for i in range(N):
    for j in range(i+1, N):
        if cs[i] == cs[j]:
            ans+=1
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import combinations

N = int(input())
c = ["".join(sorted(str(input()))) for x in range(N)]
cs = Counter(c)

ans=0
for i in cs.values():
    if i!=1:
        ans += (i * (i-1))/2

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import combinations
import string

N = int(input())
s = [str(input()) for x in range(N)]


cs = [Counter(x) for x in s]

ans=0
for i in range(N):
    for j in range(i+1, N):
        if cs[i]==cs[j]:
            ans+=1
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import combinations

N = int(input())
c = ["".join(sorted(str(input()))) for x in range(N)]
cs = Counter(c)

ans=0
for i in cs.values():
    if i!=1:
        ans += (i * (i-1))/2

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import combinations

N = int(input())
s = [str(input()) for x in range(N)]

cs = [Counter(x) for x in s]
ccs = combinations(cs, 2)

ans = 0
for i in ccs:
    if i[0]==i[1]:
        ans +=1

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import combinations

N = int(input())
c = ["".join(sorted(str(input()))) for x in range(N)]
cs = Counter(c)

ans=0
for i in cs.values():
    if i!=1:
        ans += (i * (i-1))/2

print(int(ans))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

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

max = 0
ans = "Yes"
for i in range(N):
    if max - H[i] > 1:
        ans = "No"
        break
    max = max(max, H[i])

print(ans)



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

A, B, C = map(int, input().split())

print(max(C-(A-B), 0))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

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

max = 0
ans = "Yes"
for i in range(N-1):
    if max - H[i] > 1:
        ans = "No"
        break
    max = max(max, H[i])
    
print(ans)



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

A, B, C = map(int, input().split())

print(max(C-(A-B), 0))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import copy

N = int(input())
H = list(map(int, input().split()))
H_bak = copy.copy(H)

while H != sorted(H):
    for i in range(N-1):
        while H[i] > H[i+1]:
            H[i] -= 1

if all([abs(H[i]-H_bak[i]) < 2 for i in range(N)]):
    print("Yes")
else:
    print("No")


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

A, B, C = map(int, input().split())

print(max(C-(A-B), 0))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import copy

N = int(input())
H = list(map(int, input().split()))
H_bak = copy.copy(H)

while H != sorted(H):
    for i in range(N-1):
        while H[i] > H[i+1]:
            H[i] -= 1

if all([abs(H[i]-H_bak[i]) < 2 for i in range(N)]):
    print("Yes")
else:
    print("No")


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

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

m = 0
ans = "Yes"
for i in range(N):
    if m - H[i] > 1:
        ans = "No"
        break
    m = max(m, H[i])

print(ans)