Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
while True:
	H, W = list(map(int, input().split()))
	if H == 0 and W == 0:
		break
	else:
		a = list(input() for i in range(H))
		visitedlist = []
		h = 0
		w = 0
		while True:
			if (h, w) not in visitedlist:
				visitedlist.append([h, w])
				if a[h][w] == '>':
					w += 1
				if a[h][w] == '<':
					w -= 1
				if a[h][w] == '^':
					h -= 1
				if a[h][w] == 'v':
					h += 1
				if a[h][w] == '.':
					print(w, h)
					break
			else:
				print('LOOP')
				break
				

Fixed submission:
while True:
	H, W = list(map(int, input().split()))
	if H == 0 and W == 0:
		break
	else:
		a = list(input() for i in range(H))
		visitedlist = []
		h = 0
		w = 0
		while True:
			if [h, w] not in visitedlist:
				visitedlist.append([h, w])
				if a[h][w] == '>':
					w += 1
				if a[h][w] == '<':
					w -= 1
				if a[h][w] == '^':
					h -= 1
				if a[h][w] == 'v':
					h += 1
				if a[h][w] == '.':
					print(w, h)
					break
			else:
				print('LOOP')
				break
Buggy python submission (verdict: Runtime Error):
def FOA(a, count):
	b = a
	for i in range(len(b)):
		b[i] = a.count(a[i])
	if  b == a:
		print(count)
		print(" ".join(map(str, b)))
		break
	else:
		return FOA(b, count + 1)

while True:
	n = int(input())
	if n == 0:
		break
	a = map(int, input().split())
	FOA(a, 0)

Fixed submission:
def FOA(a, count):
	b = [a.count(a[i]) for i in range(len(a))]
	if  b == a:
		print(count)
		print(" ".join(map(str, b)))
	else:
		return FOA(b, count+1)

while True:
	n = int(input())
	if n == 0:
		break
	a = list(map(int, input().split()))
	FOA(a, 0)
Buggy python submission (verdict: Runtime Error):
while x > 0:
    z = x
    x = y % x
    y = z
print(y)

Fixed submission:
x, y = sorted([int(i) for i in input().split()])
while x > 0:
    z = x
    x = y % x
    y = z
    
print(y)
Buggy python submission (verdict: Runtime Error):
for i in range(0, N):
    j = A[i] - 2
    if j == 0 or j == 1:
        counter += 1
    else:
        while j > 1:
            if A[i] % j == 0:
                break
            else:
                j -= 1
        else:
            counter += 1

Fixed submission:
def isprime(x):
    import math
    if  x == 2:
        return True
    elif x < 2 or x % 2 == 0:
        return False
    else:
        i = 3
        while i <= math.sqrt(x):
            if x % i == 0:
                return False
            i += 2
        return True

N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
counter = 0
for i in range(0, N):
    if isprime(A[i]):
        counter += 1
        
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
counter = 0
for i in range(0, N):
    j = A[i] - 2
    if j == 0 or j == 1:
        counter += 1
    else:
        while j > 1:
            if A[i] % j == 0:
                break
            else:
                j -= 1
        else:
            counter += 1
            
print(counter)

Fixed submission:
def isprime(x):
    import math
    if  x == 2:
        return True
    elif x < 2 or x % 2 == 0:
        return False
    else:
        i = 3
        while i <= math.sqrt(x):
            if x % i == 0:
                return False
            i += 2
        return True

N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
counter = 0
for i in range(0, N):
    if isprime(A[i]):
        counter += 1
        
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
counter = 0
for i in range(0, N):
    j = A[i] - 2
    if j == 0 or j == 1:
        counter += 1
    else:
        while j > 1:
            if A[i] % j == 0:
                break
            else:
                j -= 1
        else:
            counter += 1
print(counter)

Fixed submission:
def isprime(x):
    import math
    if  x == 2:
        return True
    elif x < 2 or x % 2 == 0:
        return False
    else:
        i = 3
        while i <= math.sqrt(x):
            if x % i == 0:
                return False
            i += 2
        return True

N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
counter = 0
for i in range(0, N):
    if isprime(A[i]):
        counter += 1
        
print(counter)
Buggy python submission (verdict: Runtime Error):
import math


def insertionsort(A, n, g):
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v
    return cnt


def shellsort(A, n):
    G = []         ##??§????°???¨?????????????????°???(gap??????????????????)???????????????
    gap = 1
    while gap <= math.ceil(n / 3):
        G.append(gap)
        gap = gap * 3 + 1
    G = G[::-1]
    m = len(G)
    print(m)
    print(*G)
    cnt = 0
    for i in range(m):
        insertionsort(A, n, G[i])
    print(cnt)


n = int(input())
A = []
for i in range(n):
    A.append(int(input()))
shellsort(A, n)
print("?\n".join(map(str, A)))  ##a?????¨??????????´????str()????????§??????list??????????????????

Fixed submission:
import math


def insertionsort(A, n, g):
    cnt = 0
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v
    return cnt


def shellsort(A, n):
    G = []         
    gap = 1
    while gap <= math.ceil(n / 3):
        G.append(gap)
        gap = gap * 3 + 1
    G = G[::-1]
    m = len(G)
    print(m)
    print(*G)
    cnt = 0
    for i in range(m):
        cnt += insertionsort(A, n, G[i])
    print(cnt)


n = int(input())
A = []
for i in range(n):
    A.append(int(input()))
shellsort(A, n)
for i in range(n):
    print(A[i])
Buggy python submission (verdict: Runtime Error):
a = x * x * x
print(a)

Fixed submission:
x = int(input())
a = x ** 3
print (a)

Buggy python submission (verdict: Runtime Error):
x = input()
a = x ** 3
print(a)

Fixed submission:
x = int(input())
a = x ** 3
print (a)

Buggy python submission (verdict: Runtime Error):
x = input()
a = x ** 3
print (a)

Fixed submission:
x = int(input())
a = x ** 3
print (a)

Buggy python submission (verdict: Runtime Error):
x = input()
a = x ** 3
print int(a)

Fixed submission:
x = int(input())
a = x ** 3
print (a)

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

Fixed submission:
x = input()
y = int(x)**3
print(y)

Buggy python submission (verdict: Runtime Error):
while True:
    x = input()
    if int(x) > 100 or int(x) < 1:
        continue
    print(int(x)**3)

Fixed submission:
x = input()
y = int(x)**3
print(y)
Buggy python submission (verdict: Runtime Error):
x=input(vertical:)
y=input(horizontal:)
z=int(x)*int(y)
l=int(x)+int(y)
print(z l)

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

m = int(x)*int(y)
l = int(x)*2+int(y)*2
print('{} {}'.format(m,l))

Buggy python submission (verdict: Runtime Error):
x=()
y=()
z=int(x)*int(y)
l=int(x)+int(y)
print(z l)

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

m = int(x)*int(y)
l = int(x)*2+int(y)*2
print('{} {}'.format(m,l))
Buggy python submission (verdict: Runtime Error):
while True:
    x = input().split()
    x_int = [int(i) for i in x]
    if x_int[0] == 0 and x_int[1] == 0:
        break
    else:
        print('{} {}'.format(x_int[1],x_int[0]))

Fixed submission:
while True:
    x = input().split()
    x_int = [int(i) for i in x]
    if x_int[0] == 0 and x_int[1] == 0:
        break
    else:
        x_int.sort()
        print('{} {}'.format(x_int[0],x_int[1]))
Buggy python submission (verdict: Runtime Error):
from math import pow, pi
r = int(input())
z = pow(r,2)*pi
l = 2*r*pi
print('{} {}'.format(z,l))

Fixed submission:
from math import pi
r = float(input())
z = r*r*pi
l = 2*r*pi
print('{} {}'.format(z,l))

Buggy python submission (verdict: Runtime Error):
r = int(input())
z = r*r*pi
l = 2*r*3.141529
print('{} {}'.format(z,l))

Fixed submission:
from math import pi
r = float(input())
z = r*r*pi
l = 2*r*pi
print('{} {}'.format(z,l))

Buggy python submission (verdict: Runtime Error):
r = float(input())
z = r*r*pi
l = 2*r*3.141529
print('{} {}'.format(z,l))

Fixed submission:
from math import pi
r = float(input())
z = r*r*pi
l = 2*r*pi
print('{} {}'.format(z,l))

Buggy python submission (verdict: Runtime Error):
 r = float(input())
z = r*r*3.141592
l = 2*r*3.141592
print('{} {}'.format(z,l))

Fixed submission:
from math import pi
r = float(input())
z = r*r*pi
l = 2*r*pi
print('{} {}'.format(z,l))
Buggy python submission (verdict: Runtime Error):
x = input().split()
if x[1] == '+':
    y = int(x[0])+int(x[2])
    print(y)
elif x[1] == '-':
    y = int(x[0])-int(x[2])
    print(y)
elif x[1] == '*':
    y = int(x[0])*int(x[2])
    print(y)
elif x[1] == '/':
    y = int(x[0])//int(x[2])
    print(y)
elif x[1] == '?':

Fixed submission:
while True:
    x = input().split()
    if x[1] == '+':
        y = int(x[0])+int(x[2])
        print(y)
    elif x[1] == '-':
        y = int(x[0])-int(x[2])
        print(y)
    elif x[1] == '*':
        y = int(x[0])*int(x[2])
        print(y)
    elif x[1] == '/':
        y = int(x[0])//int(x[2])
        print(y)
    elif x[1] == '?':
        break
Buggy python submission (verdict: Runtime Error):
while True:
    x = input().split()
    x_int = [int(i) for i in x]

    for i in range(x_int[0]):
        z = '#' * x_int[1]
        print(z)
    print()

Fixed submission:
while True:
    x = input().split()
    x_int = [int(i) for i in x]

    if x_int[0] == 0 and x_int[1] ==0:
        break
    for i in range(x_int[0]):
        z = '#' * x_int[1]
        print(z)
    print()
Buggy python submission (verdict: Runtime Error):
x = int(input())

for i in range(1,x+1):
     if i % 3 == 0 or i % 10 == 3 :
         print(" {}".format(i),end='')
    print()

Fixed submission:
x = int(input())

for i in range(1,x+1):
     if i % 3 == 0 or i % 10 == 3 or '3' in str(i):
         print(" {}".format(i),end='')
print()
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = input().split()
x_int = [int(i) for i in x]
y = list(range(n))

for i in x_int:
     y[-i] = i
print(y)

Fixed submission:
n = int(input())
x = input().split()
x_int = [int(i) for i in x]
y = list(range(n))

for i in range(n):
     y[-i-1] = x_int[i]
y_str = [str(i) for i in y]
print(' '.join(y_str))

Buggy python submission (verdict: Runtime Error):
n = int(input())
x = input().split()
x_int = [int(i) for i in x]
y = list(range(n))

for i in range(n):
     y[-i-1] = x_int[i]
for i in y:
    print('{} 'format(i),end = '')

Fixed submission:
n = int(input())
x = input().split()
x_int = [int(i) for i in x]
y = list(range(n))

for i in range(n):
     y[-i-1] = x_int[i]
y_str = [str(i) for i in y]
print(' '.join(y_str))

Buggy python submission (verdict: Runtime Error):
n = int(input())
x = input().split()
x_int = [int(i) for i in x]
y = list(range(n))

for i in range(n):
     y[-i-1] = x_int[i]
for i in y:
    print('{} 'format(i),end = '')
print()

Fixed submission:
n = int(input())
x = input().split()
x_int = [int(i) for i in x]
y = list(range(n))

for i in range(n):
     y[-i-1] = x_int[i]
y_str = [str(i) for i in y]
print(' '.join(y_str))
Buggy python submission (verdict: Runtime Error):
N = int(raw_input())

for i in range(N):
    line = raw_input()
    a, b, c = sorted(int(i) for i in line.split())

    if a**2 + b**2 == c**2:
        print('YES')
    else:
        print('NO')

Fixed submission:
N = int(input())

for i in range(N):
    line = input()
    a, b, c = sorted(int(w) for w in line.split())

    if a**2 + b**2 == c**2:
        print('YES')
    else:
        print('NO')

Buggy python submission (verdict: Runtime Error):
N = int(raw_input())

for i in range(N):
    line = raw_input()
    a, b, c = sorted(int(w) for w in line.split())

    if a**2 + b**2 == c**2:
        print('YES')
    else:
        print('NO')

Fixed submission:
N = int(input())

for i in range(N):
    line = input()
    a, b, c = sorted(int(w) for w in line.split())

    if a**2 + b**2 == c**2:
        print('YES')
    else:
        print('NO')
Buggy python submission (verdict: Runtime Error):
def contains3(n):
    while n > 0:
        if n % 10 == 3:
            return True
        else:
            n /= 10
    return Falses

x = int(input())
out = ""
for i in range(x):
    n = i + 1
    if n % 3 == 0 or contains3(n):
        out += (" %d" % n)
print(out)

Fixed submission:
def contains3(n):
    x = n
    while x > 0:
        if x % 10 == 3:
            return True
        else:
            x //= 10
    return False

x = int(input())
out = ""
for i in range(x):
    n = i + 1
    if n % 3 == 0 or contains3(n):
        out += (" %d" % n)
print(out)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

double = 1

for i in range(1, N+1):
  double = double*i
  
print(double%(10**9+7))


Fixed submission:
N = int(input())
 
double = 1
a = 10**9+7
 
for i in range(1, N+1):
  double *= i
  double %= a
  
print(double)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

ans = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ans += 1

print(ans)

Fixed submission:
Max, Sum = map(int, input().split())

counter = 0
for i in range(Max+1):
  for j in range(Max+1):
    k = Sum - i -j
    if k >= 0 and k <= Max:
      counter += 1
 
print(counter)

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

counter = 0
for i in range(Max+1):
  for j in range(Max+1):
    for k in range(Max+1):
      if i + j + k == Sum:
        counter += 1
 
print(counter)

Fixed submission:
Max, Sum = map(int, input().split())

counter = 0
for i in range(Max+1):
  for j in range(Max+1):
    k = Sum - i -j
    if k >= 0 and k <= Max:
      counter += 1
 
print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())

counter = 0
if x % 2 == 0:
  for i in range(a, b+1, 2):
    if i % x == 0:
      counter += 1
else:
  for i in range(a, b+1):
    if i % x == 0:
      counter += 1

print(counter)

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

ans = b//x - (a-1)//x

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())

counter = 0
if x % 2 == 0:
  for i in range(a, b+1, 2):
    if i % x == 0:
      counter += 1
else:
  for i in range(a, b+1):
    if i % x == 0:
      counter += 1

print(counter)

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

ans = b//x - (a-1)//x

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

for i in range(2**(len(S)-1):
	temp = S
	for j in range(len(S)-1):
		if(i >> j) & 1:
               temp = temp[:j - len(S) + 1]+'+'+temp[j-len(S)+1:]
    ans += eval(temp)

print(ans)
               

Fixed submission:
S = input()
ans = 0
 
for i in range(2**(len(S)-1)):
  temp = S
  for j in range(len(S)-1):
    if(i >> j) & 1:
      temp = temp[:j - len(S) + 1]+'+'+temp[j-len(S)+1:]
  ans += eval(temp)
 
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
s=k
m=c
while s<a:
  s=s+b
  m=m+c
print(m)

Fixed submission:
a,b,c=map(int,input().split())
s=b
m=c
while s<a:
  s=s+b
  m=m+c
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=0
while n>0:
  r=n%10
  s=s+r
  n=n//10
if s%9==0:
  print('Yes')
else:
  print('No')

Fixed submission:
n=input()
u=sum(map(int, str(n)))
if u%9==0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n=int(input())l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!=u:
  if l[i]>l[i+1]:
    d=d+abs(l[i+1]-l[i])
    l[i+1]=l[i] 
  i=i+1
r=i
for b in range(r,n):
    d=d+(u-l[b])
print(d)


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!=u:
  if l[i]>l[i+1]:
    d=d+abs(l[i+1]-l[i])
    l[i+1]=l[i] 
  i=i+1
r=i
for b in range(r,n):
    d=d+(u-l[b])
print(d)

Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!=u:
  if l[i]>l[i+1]:
    d=d+abs(l[i+1]-l[i])
  i=i+1
r=i
else:
  for b in range(r,len(l)):
    d=d+(u-l[b])
print(d)


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!=u:
  if l[i]>l[i+1]:
    d=d+abs(l[i+1]-l[i])
    l[i+1]=l[i] 
  i=i+1
r=i
for b in range(r,n):
    d=d+(u-l[b])
print(d)

Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!max:
  if l[i]>l[i+1]:
    d=d+abs(l[i+1]-l[i])
  i=i+1
r=i
else:
  for b in range(r,len(l)):
    d=d+(u-l[b])
print(d)


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!=u:
  if l[i]>l[i+1]:
    d=d+abs(l[i+1]-l[i])
    l[i+1]=l[i] 
  i=i+1
r=i
for b in range(r,n):
    d=d+(u-l[b])
print(d)

Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!max:
  if l[i]<l[i+1]:
    pass
  else:
    d=d+abs(l[i+1]-l[i])
  i=i+1
r=i
else:
  for b in range(r,len(l)):
    d=d+(u-l[b])
print(d)


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!=u:
  if l[i]>l[i+1]:
    d=d+abs(l[i+1]-l[i])
    l[i+1]=l[i] 
  i=i+1
r=i
for b in range(r,n):
    d=d+(u-l[b])
print(d)

Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
u=max(l)
d=0
while l[i]!max:
  if l[i]<l[i+1]:
    pass
  else:
    d=d+abs(l[i+1]-l[i])
  i=i+1
r=i
else:
  for b in range(r,len(l)):
    d=d+(u-l[b])
print(d)


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
u=max(l)
d=0
i=0
while l[i]!=u:
  if l[i]>l[i+1]:
    d=d+abs(l[i+1]-l[i])
    l[i+1]=l[i] 
  i=i+1
r=i
for b in range(r,n):
    d=d+(u-l[b])
print(d)
Buggy python submission (verdict: Runtime Error):
s=input()
i=0
c=0
if s[i]=='R':
  c=1
  if s[i+1]=='R':
    c=2
    if s[i+2]=='R':
      c=3
if s[i]=='S':
  c=0
  if s[i+1]=='R':
    c=1
   	if s[i+2]=='R':
      c=2
print(c)
      

Fixed submission:
s=input()
if 'RRR' in s:
  c=3
elif 'RR' in s:
  c=2
elif 'R' in s:
  c=1
else:
  c=0
print(c)

Buggy python submission (verdict: Runtime Error):
s=input()
l=[]
for i in range(0,len(s)):
  if s[i]=='R':
    c=1
    p=i
    while True:
      if s[p+1]=='R':
        c=c+1
        p=p+1
      else:
        break
    l.append(c)
print(max(l))
        
      
      

Fixed submission:
s=input()
if 'RRR' in s:
  c=3
elif 'RR' in s:
  c=2
elif 'R' in s:
  c=1
else:
  c=0
print(c)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split())
c=0
for i in range(0,n):
      for j in range(i,n):
       		for k in range(j,n):
       				if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
       						if l[i]+l[j]>l[k] and l[k]+l[j]>l[i] and l[i]+l[k]>l[j]:
       										c=c+1
print(c)


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

ans=0

for i in range(N):
	for j in range(i, N):
		for k in range(j, N):
			if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]:
				if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]:
					ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split())
c=0
for i in range(1,n):
      for j in range(i,n):
       		for k in range(j,n):
       				if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
       						if l[i]+l[j]>l[k] and l[k]+l[j]>l[i] and l[i]+l[k]>l[j]:
       										c=c+1
print(c)


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

ans=0

for i in range(N):
	for j in range(i, N):
		for k in range(j, N):
			if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]:
				if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]:
					ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split())
c=0
for i in range(1,n):
      for j in range(i,n):
       		for k in range(j,n):
       				if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
       						if l[i]+l[j]>l[k] and l[k]+l[j]>l[i] and l[i]+l[k]>l[j]:
       										c=c+1
       print(c)

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

ans=0

for i in range(N):
	for j in range(i, N):
		for k in range(j, N):
			if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]:
				if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]:
					ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split())
c=0
for i in range(1,N):
       for j in range(i,N):
       		for k in range(j,N):
       			if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
       				if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[i]+l[k]>l[j]:
       							c=c+1
print(c)

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

ans=0

for i in range(N):
	for j in range(i, N):
		for k in range(j, N):
			if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]:
				if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]:
					ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S = []
for _ in range(K):
    l, r = map(int, input().split())
    S += [i for i in range(l, r+1)]
S.sort()
mod = 998244353

dp = [0] * (N+1)
dp[1] = 1
for i in range(1, N+1):
    for d in S:
        if i+d > N:
            break
        dp[i+d] += dp[i] % mod
print(dp[N]%mod)

Fixed submission:
N, K = map(int, input().split())
S = []
for _ in range(K):
    l, r = map(int, input().split())
    S.append((l, r))

mod = 998244353
 
dp = [0] * (N+1)
cumsum_dp = [0] * (N+1)
dp[1] = 1
cumsum_dp[1] = 1

for i in range(2, N+1):
    for s in S:
        fr = max(0, i-s[1]-1)
        to = max(0, i-s[0])
        dp[i] += (cumsum_dp[to]-cumsum_dp[fr]) % mod
    cumsum_dp[i] = (cumsum_dp[i-1] + dp[i]) % mod
    
print(dp[N]%mod)