Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

ruiseki_w = [0]
ruiseki = 0
for i in s[:-1]:
    if i == 'W':
        ruiseki += 1
        ruiseki_w.append(ruiseki)
    else:
        ruiseki_w.append(ruiseki)

ruiseki_e = [0]
ruiseki = 0
for i in s[::-1][:-1]:
    if i == 'E':
        ruiseki += 1
        ruiseki_e.append(ruiseki)
    else:
        ruiseki_e.append(ruiseki)
        
ninzu = [ruiseki_w[i] + ruiseki_e[::-1][i] for i in range(n)]
print(min(ninzu))

Fixed submission:
n = int(input())
s = input()

ruiseki_w = [0]
ruiseki = 0
for i in s[:-1]:
    if i == 'W':
        ruiseki += 1
        ruiseki_w.append(ruiseki)
    else:
        ruiseki_w.append(ruiseki)

ruiseki_e = [0]
ruiseki = 0
for i in s[::-1][:-1]:
    if i == 'E':
        ruiseki += 1
        ruiseki_e.append(ruiseki)
    else:
        ruiseki_e.append(ruiseki)
ruiseki_e.reverse()
        
ninzu = [ruiseki_w[i] + ruiseki_e[i] for i in range(n)]
print(min(ninzu))

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

count_w =[s[:i].count('W') for i in range(n)]
count_e =[s[::-1][:i].count('E') for i in range(n)]

ninzu = n
for i in range(n):
    ninzu = min(ninzu, count_w[i]+count_e[-(i+1)])
print(ninzu)

Fixed submission:
n = int(input())
s = input()

ruiseki_w = [0]
ruiseki = 0
for i in s[:-1]:
    if i == 'W':
        ruiseki += 1
        ruiseki_w.append(ruiseki)
    else:
        ruiseki_w.append(ruiseki)

ruiseki_e = [0]
ruiseki = 0
for i in s[::-1][:-1]:
    if i == 'E':
        ruiseki += 1
        ruiseki_e.append(ruiseki)
    else:
        ruiseki_e.append(ruiseki)
ruiseki_e.reverse()
        
ninzu = [ruiseki_w[i] + ruiseki_e[i] for i in range(n)]
print(min(ninzu))
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
S = [input() for i in range(h)]


picture = []
diff = [-1, 1]

for i_h in range(h):
    row = '...'
    for i_w in range(w):
        if S[i_h][i_w] == '.':continue
        else:
            for dh in diff:
                if (i_h+dh<0) or (i_h+dh>h-1):continue
                if S[i_h+dh][i_w] == '#':
                    row[i_w] = '#'
            for dw in diff:
                if (i_w+dw<0) or (i_w+dw<w-1):continue
                if S[i_h][i_w+dw] == '#':
                    row[i_w] = '#'
    picture.append(row)
    
if picture == S:
    print('Yes')
else:
    print('No')

Fixed submission:
h, w = map(int, input().split())
S = [input() for i in range(h)]


picture = []
diff = [-1, 1]

for i_h in range(h):
    row = ''
    for i_w in range(w):
        can_draw = False
        if S[i_h][i_w] == '.': row = row + '.';continue
        else:
            for dh in diff:
                if (i_h+dh<0) or (i_h+dh>h-1):continue
                if S[i_h+dh][i_w] == '#':
                    can_draw = True
            for dw in diff:
                if (i_w+dw<0) or (i_w+dw>w-1):continue
                if S[i_h][i_w+dw] == '#':
                    can_draw = True
                    
        if can_draw:
            row = row + '#'
        else:
            row = row + '.'
    picture.append(row)
    
if picture == S:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a b c d = map(int, input().split())


if b<=c:
    print ('0')
    exit()
elif:
    if b>=d:
        print(d-c)
        exit()
    elif b<d:
        print(b-c)
        exit()

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

print(max(0, min(d,b)-max(c,a)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

num_div = 10**9 +7
power = 1
for i in range(1,n+1):
    power = power*i
#     print(power, power%num_div)
print(power%num_div)

Fixed submission:
n = int(input())

num_div = 10**9 +7
remainder_power = 1
for i in range(1,n+1):
    remainder_power = (remainder_power*i)%num_div
print(remainder_power)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
CNT = []
for i in range(N):
    dummy = input()
    S.append(dummy)
    CNT.append(S.count(S[i]))
MAX = max(CNT)
new_S = []
for i in range(N):
    if (CNT[i] == MAX and S[i] not in new_S):
        new_S.append(S[i])
new_S = sorted(new_S)
for x in new_S:
    print(x)

Fixed submission:
N = int(input())
S = []
for i in range(N):
    S.append(input())
S = sorted(S)
CNT = [1]
dummy = 1
for i in range(1, N):
    if(S[i] == S[i - 1]):
        dummy += 1
    else:
        dummy = 1
    CNT.append(dummy)
#print(S)
#print(CNT)        
MAX = max(CNT)
for i in range(N):
    if(CNT[i] == MAX):
        print(S[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for i in range(N):
    dummy = input()
    S.append(dummy)
#print(S)
S = sorted(S)
#print(S)
CNT = []
for i in range(N):
    CNT.append(S.count(S[i]))
#print(CNT)
MAX = max(CNT)
i = 0
while i < N:
    if(CNT[i] == MAX):
        print(S[i])
    i += CNT[i]

Fixed submission:
N = int(input())
S = []
for i in range(N):
    S.append(input())
S = sorted(S)
CNT = [1]
dummy = 1
for i in range(1, N):
    if(S[i] == S[i - 1]):
        dummy += 1
    else:
        dummy = 1
    CNT.append(dummy)
#print(S)
#print(CNT)        
MAX = max(CNT)
for i in range(N):
    if(CNT[i] == MAX):
        print(S[i])
Buggy python submission (verdict: Time Limit Exceeded):
dummy = list(map(int, input().split(" ")))
N = dummy[0]
K = dummy[1]

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

count = 0
while(count < K):
    max = -1
    max_i = -1
    for i in range(N):
        if(H[i] > max):
            max = H[i]
            max_i = i
    H[max_i] = 0
    count += 1
print(sum(H))

Fixed submission:
dummy = list(map(int, input().split(" ")))
N = dummy[0]
K = dummy[1]

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

H.sort(reverse = True)

for i in range(N):
    if(i < K):
        H[i] = 0

print(sum(H))
Buggy python submission (verdict: Time Limit Exceeded):
dummy = list(map(int, input().split(" ")))
N = dummy[0]

P = list(map(int, input().split(" ")))

out = 0
for a in range(N):
    flag = 1
    for b in range(a + 1):
        #print(P[a], P[b])
        if(P[a] > P[b]):
            flag = 0
            break
    if(flag == 1):
        out += 1

#print(P)
print(out)

Fixed submission:
dummy = list(map(int, input().split(" ")))
N = dummy[0]

P = list(map(int, input().split(" ")))

out = 0
min = N + 1
for a in range(N):
    if(P[a] <= min):
        min = P[a]
        out += 1

#print(P)
print(out)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = list(map(int,input().split()))

s = b + c
counter = 1
ans = 0
while True:
  if a < s * counter:
    ans = b*(counter-1)
    if a - (s * (counter-1)) <= b:
      ans += a - (s * (counter-1))
    else:
      ans += b
    break
  else:
    counter += 1

print(ans)


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

s = b + c

counter = a//s
ans = b*counter
if a - (s * counter) <= b:
  ans += a - (s * counter)
else:
  ans += b

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = input().split()
a = int(a)
b = int(b)
c = list(map(int,input().split()))

nx = 0
for i in range(a-b+1):
  x = 0
  for j in range(b):
  	x += (c[i+j]+1) / 2
  nx = max(nx,x) 

print('{:.12f}'.format(nx))

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

x = [(e + 1) / 2 for e in c]

t = sum(x[0:b])
res = t
for i in range(a - b):
  t -= x[i]
  t += x[i+b]
  res = max(res,t)

print('{:.12f}'.format(res))

Buggy python submission (verdict: Time Limit Exceeded):
a,b = input().split()
a = int(a)
b = int(b)
x = [0]*(a+1)

c = list(map(int,input().split()))

for i in range(a-b+1):
  for j in range(b):
  	x[i] += (c[i+j]+1) / 2

print('{:.12f}'.format(max(x)))

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

x = [(e + 1) / 2 for e in c]

t = sum(x[0:b])
res = t
for i in range(a - b):
  t -= x[i]
  t += x[i+b]
  res = max(res,t)

print('{:.12f}'.format(res))

Buggy python submission (verdict: Time Limit Exceeded):
a,b = input().split()
a = int(a)
b = int(b)
x = [0]*(a+1)

c = list(map(int,input().split()))

for i in range(a-b+1):
  for j in range(b):
  	x[i] += (c[i+j]+1) / 2

print('{:.12f}'.format(max(x)))

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

x = [(e + 1) / 2 for e in c]

t = sum(x[0:b])
res = t
for i in range(a - b):
  t -= x[i]
  t += x[i+b]
  res = max(res,t)

print('{:.12f}'.format(res))
Buggy python submission (verdict: Runtime Error):
s = list(map(int,input().split()))
m = list(map(int,input().split()))

a=s[0]
for i in range(s[1]):
  a -= m[i]

if a <= 0:
  print("Yes")
else:
  print("No")

Fixed submission:
s = list(map(int,input().split()))
a = s[0] // s[1]
b = s[0] % s[1]
if b != 0:
  a +=1
print(a)

Buggy python submission (verdict: Runtime Error):
s = [list(map(int,input().split())) for i in range(2)]

a=s[0][0]
for i in range(s[0][1]):
  a -= s[1][i]

if a <= 0:
  print("Yes")
else:
  print("No")

Fixed submission:
s = list(map(int,input().split()))
a = s[0] // s[1]
b = s[0] % s[1]
if b != 0:
  a +=1
print(a)

Buggy python submission (verdict: Runtime Error):
s = [list(map(int,input().split())) for i in range(2)]

a=s[0][0]
for i in range(s[0][1]):
  a -= s[1][i]

if a <= 0:
  print("Yes")
else:
  print("No")

Fixed submission:
s = list(map(int,input().split()))
a = s[0] // s[1]
b = s[0] % s[1]
if b != 0:
  a +=1
print(a)

Buggy python submission (verdict: Runtime Error):
s = [list(map(int,input().split())) for i in range(2)]

a=0
for i in range(s[0][1]):
  a += s[1][i]

r = "Yes"
if a < s[0][0]:
  print("No")
else:
  print("Yes")

Fixed submission:
s = list(map(int,input().split()))
a = s[0] // s[1]
b = s[0] % s[1]
if b != 0:
  a +=1
print(a)

Buggy python submission (verdict: Runtime Error):
s = [list(map(int,input().split())) for i in range(2)]

p = s[0][0]
a = 0
for i in range(s[0][1]):
  a += s[1][i]

r = "Yes"
if p > a:
  r = "No"

print(r)

Fixed submission:
s = list(map(int,input().split()))
a = s[0] // s[1]
b = s[0] % s[1]
if b != 0:
  a +=1
print(a)

Buggy python submission (verdict: Runtime Error):
s = [list(map(int,input().split())) for i in range(2)]

p = s[0][0]
a = 0
for i in range(s[0][1]):
  a += s[1][i]

r = "Yes"
if p > a:
  r = "No"

print(r)

Fixed submission:
s = list(map(int,input().split()))
a = s[0] // s[1]
b = s[0] % s[1]
if b != 0:
  a +=1
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int,input().split()))
b = list(map(int,input().split()))

b.sort(reverse=True)
c = b[a[1]:]
cnt = 0
h = 0
for i in range(len(c)):
  h = c[i]
  while True:
    h -= 1
    cnt += 1
    if h <= 0:
      break
print(cnt)

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

b.sort(reverse=True)
c = b[a[1]:]
cnt = 0

for i in range(len(c)):
  cnt += c[i]

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
h, n = list(map(int,input().split()))
a = [list(map(int,input().split())) for _ in range(n)]

INF = 10**18
dp = [INF]*(h+10001)

dp[0] = 0

for i in range(n):
  for j in range(h):
    if dp[j] == INF:
      continue
    dp[j+a[i][0]] = min(dp[j+a[i][0]],dp[j]+a[i][1])
print(min(dp[h:]))

Fixed submission:
h, n = list(map(int,input().split()))
a = [list(map(int,input().split())) for _ in range(n)]

INF = 10**18
dp = [INF]*(h+10001)

dp[0] = 0

for i in range(n):
  for j in range(h):
    if dp[j] == INF:
      continue
    dp[j+a[i][0]] = min(dp[j+a[i][0]],dp[j]+a[i][1])
print(min(dp[h:]))
Buggy python submission (verdict: Runtime Error):
K = int(input())
W = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = k + 1
print(W[K])

Fixed submission:
K = int(input())
K = K - 1
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[K])

Buggy python submission (verdict: Runtime Error):
K = int(input())
R = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(R[K])

Fixed submission:
K = int(input())
K = K - 1
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[K])
Buggy python submission (verdict: Runtime Error):
S = input()
a = count("A")
if a == 3:
    print("No")
else:
    print("Yes")

Fixed submission:
S = input()
a = S.count("A")

if a == 3 or a == 0:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
vA, B, C = map(int, input().split())

if A == B and B != C:
    print("Yes")
elif B == C and A != B:
    print("Yes")
elif A == C and A != B:
    print("Yes")
else:
    pirnt("No")

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

if A == B and B != C:
    print("Yes")
elif B == C and A != B:
    print("Yes")
elif A == C and A != B:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
S, T ＝ map(str, input().split())
A, B ＝ map(int, input().split())
U ＝ input()

if S ＝＝ U:
    A ＝ A － 1
else：
    B ＝ B － 1
  
print(A)
print(B)

Fixed submission:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if S == U:
    A = A - 1 
else:
    B = B - 1 

print(str(A) + " " + str(B))

Buggy python submission (verdict: Runtime Error):
S, T ＝ map(str, input().split())
A, B ＝ map(int, input().split())
U ＝ input()

if S ＝＝ U：
    A ＝ A － 1
else：
    B ＝ B － 1
print(str(A)＋str(B))

Fixed submission:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if S == U:
    A = A - 1 
else:
    B = B - 1 

print(str(A) + " " + str(B))
Buggy python submission (verdict: Runtime Error):
S ＝ input()
print("x" * len(S))

Fixed submission:
S = input()

print("x" * len(S))
Buggy python submission (verdict: Runtime Error):
import math
H, W, M = map(int, input().split())

if H <= W:
    for i in range(1, H + 1):
        if W * i >= M:
            print(i)

elif:
    for k in range(1, W + 1):
        if H * k >= M:
            print(k)

Fixed submission:
H = int(input())
W = int(input())
M = int(input())

if H <= W:
    for i in range(1, H + 1):
        if W * i >= M:
            print(i)
            break
            
else:
    for k in range(1, W + 1):
        if H * k >= M:
            print(k)
            break

Buggy python submission (verdict: Runtime Error):
import math
H, W, M = map(int, input().split())

if H <= W:
    for i in range(1, H + 1):
    if W * i => M:
        print(i)

elif:
    for k in range(1, W + 1):
    if H * k => M:
        print(k)

Fixed submission:
H = int(input())
W = int(input())
M = int(input())

if H <= W:
    for i in range(1, H + 1):
        if W * i >= M:
            print(i)
            break
            
else:
    for k in range(1, W + 1):
        if H * k >= M:
            print(k)
            break

Buggy python submission (verdict: Runtime Error):
import math
H, W, M = map(int, input().split())

if H <= W:
    for i in range(1, H + 1):
        if W * i => M:
            print(i)

elif:
    for k in range(1, W + 1):
        if H * k => M:
            print(k)

Fixed submission:
H = int(input())
W = int(input())
M = int(input())

if H <= W:
    for i in range(1, H + 1):
        if W * i >= M:
            print(i)
            break
            
else:
    for k in range(1, W + 1):
        if H * k >= M:
            print(k)
            break
Buggy python submission (verdict: Runtime Error):
N = int(input())
aaa = 0
box = []
for i in range(0, 10):
    if N % i == 0:
        box.append(int(N/i))
for k in box:
    if k>=1 and k<=9:
        aaa = 1
        print("Yes")
if aaa ==0:
    print("No")

Fixed submission:
N = int(input())
aaa = 0 
box = []
for i in range(1, 10):
    if N % i == 0:
        box.append(int(N/i))
for k in box:
    if k>=1 and k<=9:
        aaa = 1 
        break
    else:
        aaa = 0 
if aaa == 1:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
aaa = 0
box = []
for i in range(0, 10):
    if N % i == 0:
        box.append(int(N/i))
for k in box:
    if k>=1 and k<=9:
        aaa = 1
        print("yes")
if aaa ==0:
    print("no")

Fixed submission:
N = int(input())
aaa = 0 
box = []
for i in range(1, 10):
    if N % i == 0:
        box.append(int(N/i))
for k in box:
    if k>=1 and k<=9:
        aaa = 1 
        break
    else:
        aaa = 0 
if aaa == 1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

box = []
for i in range(1, N + 1): 
    if N % i == 0:
        box.append(int(N / i)) 

a = box[int(len(box)/2)]
b = int(N / a)

kkk = (a-1) + (b-1)

print(kkk)

Fixed submission:
import math

N = int(input())

box = []
for i in range(1, int(math.sqrt(N) + 1)):
    if N % i == 0:
        box.append(int(N / i)) 

a = box[-1]
b = int(N / a)

kkk = (a-1) + (b-1)

print(kkk)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split)

s = A - 2B

if s <= 0:
    print(0)
else:
    print(s)

Fixed submission:
A, B = map(int, input().split())

s = A - 2 * B 

if s <= 0:
    print(0)
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
Last login: Fri Oct 18 22:40:34 on ttys000

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
  File "a.py", line 3
    s = A - 2B
             ^
SyntaxError: invalid syntax
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
12 4
Traceback (most recent call last):
  File "a.py", line 1, in <module>
    A, B = map(int, input().split)
TypeError: 'builtin_function_or_method' object is not iterable
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
12 4
4
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ vim k.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python k.py
(2, 3, 4)
nakamurashuntaMacBook-Pro:~ n.shunta$ vi k.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python k.py
4
nakamurashuntaMacBook-Pro:~ n.shunta$ rm k.py
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
  File "a.py", line 17
    for r in data
                ^
SyntaxError: invalid syntax
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
3
3 1 2
22
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
3
3 1 2
(3, 1)
(3, 2)
(1, 3)
(1, 2)
(2, 3)
(2, 1)
22
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
  File "a.py", line 9
    for i in itertools.combinations(box, 2)
                                          ^
SyntaxError: invalid syntax
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
3
3 1 2
(3, 1)
(3, 2)
(1, 2)
11
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py

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

import itertools

boxes = []
data = []

for i in itertools.combinations(box, 2): 
    boxes.append(i)

for k in boxes:
    data.append(k[0] * k[1])

i = 0 

for r in data:
    i = r + i 

print(i)

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

import itertools

boxes = []
data = []

for i in itertools.combinations(box, 2): 
    boxes.append(i)

for k in boxes:
    data.append(k[0] * k[1])

i = 0 

for r in data:
    i = r + i 

print(i)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a>=b:
	print(1)
else:
	print(str(b//a+1))

Fixed submission:
s = input()
t = input()
ans = 0
for i in range(3):
	if s[i] == t[i]:
		ans += 1
	else:
		continue
print(str(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
for i in range(n):
	s[i] = ''.join(list(sorted(s[i])))
ns = sorted(s)
t=0
for i in range(n-1):
	for j in range(1,n-i):
		if ns[i]==ns[i+j]:
			t += 1
		else:
			break
	continue
print(t)

Fixed submission:
import collections
import math

n = int(input())
s = [input() for i in range(n)]
for i in range(n):
	s[i] = ''.join(list(sorted(s[i])))
c = collections.Counter(s)
t = 0
for v in c.values():
	if v>1:
		t += math.factorial(v) // (math.factorial(v - 2) * math.factorial(2))
	else:
		continue
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
m1 = max(a)
if len(set(a)) == 1:
	for i in range(n):
		print(m1)
else:
	m2 = sorted(set(a))[-2]
	for i in range(n):
		if a[i] < m1:
			print(m1)
		elif a[i] == m1:
			if a.count(m1) > 1:
				print(m1)
			else:
				print(m2)
		else:
			print(m2)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
m1 = max(a)
c = a.count(m1)
if len(set(a)) == 1:
	for i in range(n):
		print(m1)
else:
	m2 = sorted(set(a))[-2]
	for i in range(n):
		if a[i] < m1:
			print(m1)
		elif a[i] == m1:
			if c > 1:
				print(m1)
			else:
				print(m2)
		else:
			print(m2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
m1 = max(a)
m2 = sorted(set(a))[-2]
for j in range(n):
	if a[j] < m1:
		print(m1)
	elif a[j] == m1:
		if a.count(m1) > 1:
			print(m1)
		else:
			print(m2)
	else:
		print(m2)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
m1 = max(a)
c = a.count(m1)
if len(set(a)) == 1:
	for i in range(n):
		print(m1)
else:
	m2 = sorted(set(a))[-2]
	for i in range(n):
		if a[i] < m1:
			print(m1)
		elif a[i] == m1:
			if c > 1:
				print(m1)
			else:
				print(m2)
		else:
			print(m2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
m = max(a)
for j in range(n):
	if a[j] < m:
		print(m)
	elif a[j] == m:
		if a.count(m) > 1:
			print(m)
		else:
			b = a[:]
			b[j] = 0
			print(max(b))
	else:
		b = a[:]
		b[j] = 0
		print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
m1 = max(a)
c = a.count(m1)
if len(set(a)) == 1:
	for i in range(n):
		print(m1)
else:
	m2 = sorted(set(a))[-2]
	for i in range(n):
		if a[i] < m1:
			print(m1)
		elif a[i] == m1:
			if c > 1:
				print(m1)
			else:
				print(m2)
		else:
			print(m2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
m = max(a)
for j in range(n):
	if a[j] < m:
		print(m)
	else:
		b = a[:]
		b[j] = 0
		print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
m1 = max(a)
c = a.count(m1)
if len(set(a)) == 1:
	for i in range(n):
		print(m1)
else:
	m2 = sorted(set(a))[-2]
	for i in range(n):
		if a[i] < m1:
			print(m1)
		elif a[i] == m1:
			if c > 1:
				print(m1)
			else:
				print(m2)
		else:
			print(m2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
for j in range(n):
	b = a[:]
	b[j] = 0
	print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
m1 = max(a)
c = a.count(m1)
if len(set(a)) == 1:
	for i in range(n):
		print(m1)
else:
	m2 = sorted(set(a))[-2]
	for i in range(n):
		if a[i] < m1:
			print(m1)
		elif a[i] == m1:
			if c > 1:
				print(m1)
			else:
				print(m2)
		else:
			print(m2)