Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys

default_x = 0
default_y = 0

n = int(input())

a = []

#標準入力をN分読み込み
for i in range(n):
        a.append(list(map(int,input().split())))

times = 0
for i in range(n):
    for j in range(a[i][0]+times):
        if default_x < a[i][1]:
            default_x += 1
        elif default_x > a[i][1]:
            default_x -= 1

        elif default_y < a[i][2]:
            default_y += 1
        elif default_y > a[i][2]:
            default_y -= 1
        else:
            default_y -= 1

    if default_x != a[i][1] or default_y != a[i][2]:
        print('No')
        sys.exit()

    times  = a[i][0]

print('Yes')

Fixed submission:
n = int(input())

travel = list()
#start point
travel.append((0,0,0))

for i in range(n):
  travel.append(tuple(map(int,input().split())))


for j in range(n):
  dist = abs(travel[j][0]-travel[j+1][0])

  dd = abs(travel[j][1]-travel[j+1][1])+abs(travel[j][2]-travel[j+1][2])
  
#fail
  if dist < dd or (dd%2 != dist%2):
    print("No")
    exit(0) 

print("Yes")

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

default_x = 0
default_y = 0

n = int(input())

a = []

#標準入力をN分読み込み
for i in range(n):
        a.append(list(map(int,input().split())))

times = 0
for i in range(n):
    for j in range(a[i][0]+times):
        if default_x < a[i][1]:
            default_x += 1
        elif default_x > a[i][1]:
            default_x -= 1

        elif default_y < a[i][2]:
            default_y += 1
        elif default_y > a[i][2]:
            default_y -= 1
        else:
            default_y -= 1

    if default_x != a[i][1] or default_y != a[i][2]:
        print('No')
        sys.exit()

    times  = a[i][0]

print('Yes')

Fixed submission:
n = int(input())

travel = list()
#start point
travel.append((0,0,0))

for i in range(n):
  travel.append(tuple(map(int,input().split())))


for j in range(n):
  dist = abs(travel[j][0]-travel[j+1][0])

  dd = abs(travel[j][1]-travel[j+1][1])+abs(travel[j][2]-travel[j+1][2])
  
#fail
  if dist < dd or (dd%2 != dist%2):
    print("No")
    exit(0) 

print("Yes")
Buggy python submission (verdict: Runtime Error):
))

print("{:.0f}".format((a+b)/2))


Fixed submission:
import math

a, b = map(float, input().split())

print(math.ceil((a+b)/2))
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

s_sort = sorted(s,reverse=True)
t_sort = sorted(t,reverse= True)

if s_sort < t_sort:
    print('Yes')
else:
    print('No

Fixed submission:
s = input()
t = input()

s_sort = sorted(s)
t_sort = sorted(t,reverse= True)

if s_sort < t_sort:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())

hx = hex(x)
hy = hex(y)

if hx < hy:
  print("<")
elif hx > hy:
  print(">")
else:
  print("=")


Fixed submission:
x,y = input().split()

if x < y:
  print("<")
elif x > y:
  print(">")
else:
  print("=")

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

hx = hex(x)
hy = hex(y)

if hx < hy:
  print("<")
elif hy > hx:
  print(">")
else:
  print("=")


Fixed submission:
x,y = input().split()

if x < y:
  print("<")
elif x > y:
  print(">")
else:
  print("=")

Buggy python submission (verdict: Runtime Error):
x,y = map(hex,input().split())


if x < y:
  print("<")
elif y > x:
  print(">")
else:
  print("=")


Fixed submission:
x,y = input().split()

if x < y:
  print("<")
elif x > y:
  print(">")
else:
  print("=")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())

print(abs(n**2-a)


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

print(abs(n**2-a))
Buggy python submission (verdict: Runtime Error):
x, t = map(int,input().split())

if x <= t:
  print(0)
else;
  print(x-t)


Fixed submission:
x, t = map(int,input().split())

if x <= t:
  print(0)
else:
  print(x-t)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

dList = sorted(list(map(int,input().split())))
  
count = 0
for i in range(n):
  tmpC = 0
  for j in range(n):
      if dList[i]-1 > dList[j]:
        pass
      elif dList[i]+1 < dList[j]:
        break 
      else:
        tmpC +=1
  if tmpC > count:
    count = tmpC

print(count)
  

Fixed submission:
n = int(input())

dList = sorted(list(map(int,input().split())))
dic = {}

for i in dList:
  
  if str(i) in dic.keys():
    dic[str(i)] += 1
  else:
    dic[str(i)] = 1
  if str(i+1) in dic.keys():
    dic[str(i+1)] += 1
  else:
    dic[str(i+1)] = 1
  
  if i-1 >= 0:
    if str(i-1) in dic.keys():
      dic[str(i-1)] += 1
    else:
      dic[str(i-1)] = 1
 
print(max(dic.values()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

sList = list(map(int,input().split()))
sEdit = sorted(list(set(sList)),reverse=True)
res = 0
for i in sEdit:
  dcount = sList.count(i)//2
  if dcount >= 2 and res == 0:
    print(i*i)
    exit(0)
  elif dcount >= 1 and res == 0:
    res = i
  elif dcount >= 1 and res != 0:
    print(res*i)
    exit(0)

print(0)



Fixed submission:
n = int(input())

sList = sorted(list(map(int,input().split())),reverse=True)
res = []
acc = False
for i in range(n-1):
  if acc:
    acc = False
  else:
      if sList[i] == sList[i+1]:
        res.append(sList[i])
        acc = True
      if len(res) == 2:
        print(res[0]*res[1])
        exit(0)

print(0)

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

sList = list(map(int,input().split()))
sEdit = sorted(list(set(sList)),reverse=True)
res = 0
for i in sEdit:
  dcount = sList.count(i)//2
  if dcount >= 2 and res == 0:
    print(i*i)
    exit(0)
  elif dcount >= 1 and res == 0:
    res = i
  elif dcount >= 1 and res != 0:
    print(res*i)
    exit(0)

print(0)



Fixed submission:
n = int(input())

sList = sorted(list(map(int,input().split())),reverse=True)
res = []
acc = False
for i in range(n-1):
  if acc:
    acc = False
  else:
      if sList[i] == sList[i+1]:
        res.append(sList[i])
        acc = True
      if len(res) == 2:
        print(res[0]*res[1])
        exit(0)

print(0)
Buggy python submission (verdict: Runtime Error):
n = input()

if n[0] == n[3]:
  print("Yes")
else:
  print("No")


Fixed submission:
n = input()

if n[0] == n[2]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, m = map(int,input())

print((n-1)*(m-1))


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

print((n-1)*(m-1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dList = list(map(int,input().split()))
result = []

for i in range(n):
  if (i % 2 == 0 and n % 2 == 0) or (i % 2 != 0 and n % 2 != 0):
   result.append(dList[i])
  else:
   result.insert(0,dList[i])

for i in result:
  print(i,end=" ")

print()


Fixed submission:
from collections import deque
n = int(input())
dList = list(map(int,input().split()))
result = deque()

for i in range(n):
  if (i % 2 == 0 and n % 2 == 0) or (i % 2 != 0 and n % 2 != 0):
   result.append(dList[i])
  else:
   result.appendleft(dList[i])

for i in result:
  print(i,end=" ")

print()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dList = list(map(int,input().split()))
result = []

for i in range(n):
  if i % 2 == 0:
   result.insert(0,dList[i])
  else:
   result.append(dList[i])

if n % 2 == 0:
  for i in range(len(result)-1,-1,-1):
    print(result[i],end=" ")
else:
  for i in result:
    print(i)



Fixed submission:
from collections import deque
n = int(input())
dList = list(map(int,input().split()))
result = deque()

for i in range(n):
  if (i % 2 == 0 and n % 2 == 0) or (i % 2 != 0 and n % 2 != 0):
   result.append(dList[i])
  else:
   result.appendleft(dList[i])

for i in result:
  print(i,end=" ")

print()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dList = list(map(int,input().split()))
result = []

for i in range(n):
  if i % 2 == 0:
   result.insert(0,dList[i])
  else:
   result.append(dList[i])

if n % 2 == 0:
  print(' '.join([str(result[i]) for i in range(len(result)-1,-1,-1)]))
else:
  print(' '.join([str(i) for i in result]))



Fixed submission:
from collections import deque
n = int(input())
dList = list(map(int,input().split()))
result = deque()

for i in range(n):
  if (i % 2 == 0 and n % 2 == 0) or (i % 2 != 0 and n % 2 != 0):
   result.append(dList[i])
  else:
   result.appendleft(dList[i])

for i in result:
  print(i,end=" ")

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

if c => a and c =< b:
  print("Yes")
else:
  print("No")


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

if c >= a and c <= b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int,input().split())

for i in range(a,ba+1,a):
  if i % b == c:
    print("YES")
    exit(0)
print("NO")


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

for i in range(a,b*a+1,a):
  if i % b == c:
    print("YES")
    exit(0)
print("NO")

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

aj = a%2
bj = b%2
cj = c%2

if aj == bj == cj == 1 or aj == bj == cj ==0 or (aj == bj ==1 and cj ==0 ) or (aj == cj == 1 and bj == 0) or (aj == 0 and bj==cj==1):
  print("YES")
else:
  p

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

for i in range(a,b*a+1,a):
  if i % b == c:
    print("YES")
    exit(0)
print("NO")
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

if 2*n <= m:
  print(n+(m-2*n)//4)
elif 2*n > m:
  print(c//2)


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

if 2*n <= m:
  print(n+(m-2*n)//4)
elif 2*n > m:
  print(m//2)
Buggy python submission (verdict: Runtime Error):
cardArray = list(map(int,input().split()))

if cardArray[0]== carArray[1]:
  print("Draw")
elif cardArray[0] < cardArray[1]:
  if cardArray[0] == 1:
    print("Alice")
  else:
    print("Bob")
else:
  if cardArray[1] == 1:
    print("Bob")
  else:
    print("Alice")


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

if cardArray[0]== cardArray[1]:
  print("Draw")
elif cardArray[0] < cardArray[1]:
  if cardArray[0] == 1:
    print("Alice")
  else:
    print("Bob")
else:
  if cardArray[1] == 1:
    print("Bob")
  else:
    print("Alice")

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

if cardArray[0]== carArray[1]:
  print("Draw")
elif cardArray[0] < cardArray[1]:
  if cardArray[0] == 1:
    print("Alice")
  else:
    print("Bob")
else:
  if cardArray[1] == 1:
    print("Bob")
  print("Alice")


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

if cardArray[0]== cardArray[1]:
  print("Draw")
elif cardArray[0] < cardArray[1]:
  if cardArray[0] == 1:
    print("Alice")
  else:
    print("Bob")
else:
  if cardArray[1] == 1:
    print("Bob")
  else:
    print("Alice")

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

if cardArray[0]== carArray[1]:
  print("Draw")
elif cardArray[0] < cardArray[1]:
  if cardArray[0] == 1:
    print("Alice")
  else:
    print("Bob")
else:
  print("Bob")


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

if cardArray[0]== cardArray[1]:
  print("Draw")
elif cardArray[0] < cardArray[1]:
  if cardArray[0] == 1:
    print("Alice")
  else:
    print("Bob")
else:
  if cardArray[1] == 1:
    print("Bob")
  else:
    print("Alice")

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

if cardArray[0]= carArray[1]:
  print("Draw")
elif cardArray[0] < cardArray[1]:
  if cardArray[0] == 1:
    print("Alice")
  else:
    print("Bob")
else:
  print("Bob")


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

if cardArray[0]== cardArray[1]:
  print("Draw")
elif cardArray[0] < cardArray[1]:
  if cardArray[0] == 1:
    print("Alice")
  else:
    print("Bob")
else:
  if cardArray[1] == 1:
    print("Bob")
  else:
    print("Alice")
Buggy python submission (verdict: Runtime Error):
x = int(input())

if x< 1200
  print("ABC")
else:
  print("ARC")


Fixed submission:
x = int(input())

if x< 1200:
  print("ABC")
else:
  print("ARC")

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

if x< 1200;
  print("ABC")
else:
  print("ARC")


Fixed submission:
x = int(input())

if x< 1200:
  print("ABC")
else:
  print("ARC")
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int,input().split())

counter = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                counter += 1
                break
            elif x + y + z > s:
                break

print(counter)

Fixed submission:
k, s = map(int,input().split())

counter = 0
for x in range(k+1):
    for y in range(k+1):
            if (s- (x + y) <= k) and (s - (x+ y) >= 0):
                counter += 1


print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int,input().split())

counter = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                counter += 1
            elif x + y + z > s:
                break

print(counter)

Fixed submission:
k, s = map(int,input().split())

counter = 0
for x in range(k+1):
    for y in range(k+1):
            if (s- (x + y) <= k) and (s - (x+ y) >= 0):
                counter += 1


print(counter)
Buggy python submission (verdict: Runtime Error):
s = input()

if a == s or i == s or u == s or e == s or o == s:
  print("vowel")
else:
  print("consonant")


Fixed submission:
s = input()

if 'a' == s or 'i' == s or 'u' == s or 'e' == s or 'o' == s:
  print("vowel")
else:
  print("consonant")
Buggy python submission (verdict: Runtime Error):
n = int(input())
ais = list(map(int, input().split()))
evens = []
for a in ais:
  if a % 2 == 0:
    evens.append(a)
if len(evens) == 0:
  print("DENIED")
  puit()
m = 0
for e in evens:
  if e % 3 == 0 or e % 5 == 0:
    pass
  else:
    m += 1
if m == 0:
  print("APPROVED")
else:
  print("DENIED")
  


Fixed submission:
n = int(input())
ais = list(map(int, input().split()))
evens = []
for a in ais:
  if a % 2 == 0:
    evens.append(a)
if len(evens) == 0:
  print("APPROVED")
  quit()
m = 0
for e in evens:
  if e % 3 == 0 or e % 5 == 0:
    pass
  else:
    m += 1
if m == 0:
  print("APPROVED")
else:
  print("DENIED")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
s = []
s_num = []
for i in range(n):
  si = input()
  if not si in s:
    s.append(si)
    s_num.append(1)
  else:
    s_num[s.index(si)] += 1
maxs = []
m = max(s_num)
for j in range(len(s_num)):
  if s_num[j] == m:
    maxs.append(s[j])
maxs = sorted(maxs)
for ma in maxs:
  print(ma)

Fixed submission:
from collections import Counter
n = int(input())
s = []
for i in range(n):
  si = input()
  s.append(si)
  
C = Counter(s)
s_num = C.values()
m = max(s_num)
s_max = []
for k, v in C.items():
  if v == m:
    s_max.append(k)
s_max = sorted(s_max)
for sj in s_max:
  print(sj)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sis = []
for i in range(n):
  si = input()
  sis.append(si)
s_one = list(set(sis))
if len(s_one) == 1:
  print(s_one[0])
  quit()
s_max = []
m = 0
for so in s_one:
  c = sis.count(so)
  if c > m:
    m = c
    s_max = []
    s_max.append(so)
  elif c == m:
    s_max.append(so)
s_max2 = sorted(s_max)
for sm in s_max2:
  print(sm)


Fixed submission:
from collections import Counter
n = int(input())
s = []
for i in range(n):
  si = input()
  s.append(si)
  
C = Counter(s)
s_num = C.values()
m = max(s_num)
s_max = []
for k, v in C.items():
  if v == m:
    s_max.append(k)
s_max = sorted(s_max)
for sj in s_max:
  print(sj)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
pis = list(map(int, input().split()))
sum_max = 0
pikmax = []
for i in range(n-k+1):
  pik = pis[i:i+k]
  sumk = sum(pik)
  if sumk > sum_max:
    sum_max = sumk
    pikmax.append(pik)
expect = 0
expect += sum_max/2 + k / 2
print(expect)

Fixed submission:
n, k = map(int, input().split())
pis = list(map(int, input().split()))
sum_max = 0
sum_cd = 0
for i in range(k):
  sum_max += pis[i]
  sum_cd += pis[i]
for j in range(1,n-k+1):
  sum_cd -= pis[j-1]
  sum_cd += pis[j+k-1] 
  if sum_cd > sum_max:
    sum_max = sum_cd
expect = sum_max/2 + k / 2
print(expect)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ps = list(map(int, input().split()))
m = 1
fps = []
for i in range(1, n):
  fps.append(ps[i-1])
  if min(fps) > ps[i]:
    m += 1
print(m)

Fixed submission:
n = int(input())
ps = list(map(int, input().split()))
fps = [ps[0]]
for i in range(1,n):
  if fps[len(fps)-1] > ps[i]:
    fps.append(ps[i])
print(len(fps))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ps = input().split()
m = 1
fps = []
for i in range(1, n):
  fps.append(int(ps[i-1]))
  if min(fps) > int(ps[i]):
    m += 1
print(m)

Fixed submission:
n = int(input())
ps = list(map(int, input().split()))
fps = [ps[0]]
for i in range(1,n):
  if fps[len(fps)-1] > ps[i]:
    fps.append(ps[i])
print(len(fps))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
submits = []
for i in range(m):
  submit = input().split()
  submits.append(submit)
wa = 0
ac = 0
l = [submits[0]]
for i in range(1, m):
  if submits[i] == submits[i-1]:
    l.append(submits[i])
  else:
    l = []
    l.append(submits[i])
  if i != m-1 and submits[i] != submits[i+1]:
    for j in range(len(l)):
      if l[j][1] == "WA":
        wa += 1
      else:
        ac += 1
        break
  elif i == m-1:
    for j in range(len(l)):
      if l[j][1] == "WA":
        wa += 1
      else:
        ac += 1
        break
print(ac, wa)


Fixed submission:
n, m = map(int, input().split())
acs = [0]*n
was = [0]*n
ac = 0
wa = 0
for i in range(m):
  p, s = input().split()
  p = int(p) - 1
  if s == "AC" and acs[p]==0:
    acs[p] += 1
    ac += 1
    wa += was[p]
  elif s == "WA":
    was[p] += 1
print(ac, wa)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
if a <= K:
  a = 0
  k = k - a
  b -= k
  if b < 0:
    b = 0
  else:
    pass
else:
  a -= k
print(a, b)

Fixed submission:
a,b,k = map(int, input().split())
if a <= k:
  k = k - a
  a = 0
  b = b - k
  if b < 0:
    b = 0
  else:
    pass
else:
  a -= k
print(a, b)

Buggy python submission (verdict: Time Limit Exceeded):
a, b , k  = map(int, input().split())
for i in range(k):
  if a > 0:
    a -= 1
  else:
    if b > 0:
      b -= 1
    else:
      break
print(a, b)
      
    

Fixed submission:
a,b,k = map(int, input().split())
if a <= k:
  k = k - a
  a = 0
  b = b - k
  if b < 0:
    b = 0
  else:
    pass
else:
  a -= k
print(a, b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
k = 1
x = []
y = []
for i in range(1, n+1):
  if n % (k*i) == 0:
    x.append(k*i)
    y.append(n//(k*i))
    if n // (k*i) < k*i:
      break

print(x[len(x)-2] + y[len(x)-2] -2)

Fixed submission:
import math
n = int(input())
x = []
m = int(math.sqrt(n))
for i in range(1, m+1):
  if n % i == 0:
    x.append(n//i + i -2)
print(min(x))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
hs = input().split()
num = 0
for i in range(len(n)):
  if int(hs[i]) >= k:
    num += 1
print(num)

Fixed submission:
n, k = map(int, input().split())
hs = input().split()
num = 0
for i in range(n):
  if int(hs[i]) >= k:
    num += 1
print(num)
Buggy python submission (verdict: Runtime Error):
s = list(input())
odd = []
even = []
for i in range(len(s)):
  if i % 2 == 0:
    odd.aapend(s[i])
  else:
    even.append(s[i])
o = 0
e = 0
if "L" in odd:
  o = -1
if "R" in even:
  e = -1
if o * e == 0:
  print("Yes")
else:
  print("No")


Fixed submission:
s = list(input())
odd = []
even = []
for i in range(len(s)):
  if i % 2 == 0:
    odd.append(s[i])
  else:
    even.append(s[i])
if "L" in odd or "R" in even:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
n = 1
e = a
if b = 1:
  print(0)
  quit()
while n > 0:
  if e >= b:
    print(n)
    n = 0
  else:
    e += a-1
    n += 1

Fixed submission:
a, b = map(int, input().split())
n = 1
e = a
if b == 1:
  print(0)
  quit()
while n > 0:
  if e >= b:
    print(n)
    n = 0
  else:
    e += a-1
    n += 1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(n):
  ans += i
print(ans)

Fixed submission:
n = int(input())
ans = n*(n-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
nums = input().split(" ")
rev = float(0)
for i in range(int(n)):
  rev += 1/nums[i]
print(1/rev)

Fixed submission:
n = int(input())
a_n = input().split(" ")
rev = float(0)
for i in range(n):
  rev += 1/int(a_n[i])
print(1/rev)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sis = []
sin = []
for i in range(n):
  si = sorted(input())
  if not si in sis:
    sis.append(si)
    sin.append(1)
  else:
    sin[sis.index(si)] += 1
ans = 0
for j in sin:
  for k in range(1, j):
    ans += k
print(ans)



Fixed submission:
from collections import Counter
n = int(input())
sis = []
for i in range(n):
  si = sorted(input())
  si = ''.join(si)
  sis.append(si)
C = Counter(sis)
ans = 0
for v in C.values():
  ans += sum(range(1, v))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
m = max(a)
for j in a:
  if j < m:
    print(m)
  elif j == m:
    b = sorted(a.copy())
    print(b[n-2])
    
  

Fixed submission:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
b = a.copy()
m = max(a)
b2 = b.remove(m)
mb = max(b)
for j in a:
  if j < m:
    print(m)
  elif j == m:
    print(mb)

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

for j in range(n):
  b = a.copy()
  aj = a[j]
  b.remove(a[j])
  print(max(b))
  


Fixed submission:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
b = a.copy()
m = max(a)
b2 = b.remove(m)
mb = max(b)
for j in a:
  if j < m:
    print(m)
  elif j == m:
    print(mb)
Buggy python submission (verdict: Runtime Error):
ns = input().split(" ")
if int(ns[0])*int(ns[1]) <= int(ns[2]):
  print(int(ns[0])*int(ns[1]))
else:
  print(int(ns[2])

Fixed submission:
ns = input().split(" ")
if int(ns[0])*int(ns[1]) <= int(ns[2]):
  print(int(ns[0])*int(ns[1]))
else:
  print(int(ns[2]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
pis = list(map(int, input().split()))
m = 0
for i in range(n-2):
  if p[i] < p[i+1] < p[i+2] or p[i+2] < p[i+1] < p[i]:
    m += 1
print(m)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
m = 0
for i in range(n-2):
  if p[i] < p[i+1] < p[i+2] or p[i+2] < p[i+1] < p[i]:
    m += 1
print(m)
Buggy python submission (verdict: Runtime Error):
import fractions
a, b, c, d = map(int, input().split())
ans = 0
nc = 1
nc2 = 0
nd = 1
nd2 = 0 
ndc = 1
ndc2 = 0
while b >= c*nc:
  nc2 += 1
  nc += 1
while b >= d*nd:
  nd += 1
  nd2 += 1
cd = c*d//fractions.gcd(c,d)
while b >= cd*ndc:
  ndc += 1
  ndc2 += 1
nc2 -= a//c
nd2 -= a//d
ndc2 -= a//(cd)
ans = b-a+1-nc2-nd2+ndc2
print(ans)

Fixed submission:
s = list(str(input()))
for i in range(3):
  if s[i] == s[i+1]:
    print("Bad")
    quit()
print("Good")
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
a, b, c, d = map(int, input().split())
ans = 0
nc = 1
nc2 = 0
nd = 1
nd2 = 0 
ndc = 1
ndc2 = 0
while b >= c*nc:
  nc2 += 1
  nc += 1
while b >= d*nd:
  nd += 1
  nd2 += 1
cd = c*d//fractions.gcd(c,d)
while b >= cd*ndc:
  ndc += 1
  ndc2 += 1
nc2 -= (a-1)//c
nd2 -= (a-1)//d
ndc2 -= (a-1)//(cd)
ans = b-a+1-nc2-nd2+ndc2
print(ans)

Fixed submission:
import fractions
a, b, c, d = map(int, input().split())
ans = 0
nc = b//c - (a-1)//c
nd = b//d - (a-1)//d
cd = c*d // fractions.gcd(c,d)
ncd = b//cd - (a-1)//cd
ans = b-a+1-nc-nd+ncd
print(ans)