Problem:

Unique

 

  For a sequence of integers $A = \{a_0, a_1, ..., a_{n-1}\}$ which is sorted by ascending order, eliminate all equivalent elements.

Input

  A sequence is given in the following format.

$n$
$a_0 \; a_1 \; ,..., \; a_{n-1}$

Output

  Print the sequence after eliminating equivalent elements in a line. Separate adjacency elements by a space character.

Constraints

  
$1 \leq n \leq 100,000$

  
$-1000,000,000 \leq a_i \leq 1,000,000,000$

  
$a_0 \leq a_1 \leq ... \leq a_{n-1}$

Sample Input 1

4
1 2 2 4

Sample Output 1

1 2 4



Sample input:
4
1 2 2 4


Sample output:
1 2 4

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split(' ')))

a = list(set(a))
print(' '.join(list(map(str, a))))

Submission status: Wrong Answer

Solution code:
# coding=utf-8

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

print(' '.join(map(str, set(A))))

Submission status: Accepted

Solution code:
from collections import Counter

n=input()
A=map( int , raw_input().split() )

D={}

for x in A:
	if x not in D:
		D[x]=1
		print x,
	else:
		pass

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split(' ')))

a = sorted(set(a))
print(' '.join(list(map(str, a))))

Submission status: Accepted

Solution code:
# coding=utf-8

N = int(input())
A = list(map(int, input().split()))
A = list(set(A))
A.sort()
print(' '.join(map(str, A)))

Submission status: Accepted

Solution code:

def unique(li):
    """Returns a list of unique elements in ordered list li

    >>> unique([1, 1])
    [1]
    >>> unique([1, 2])
    [1, 2]
    """
    return [li[i] for i in range(len(li)) if i == 0 or li[i] > li[i-1]]


def run():
    n = int(input())
    li = [int(x) for x in input().split()]
    assert(n == len(li))

    print(" ".join([str(x) for x in unique(li)]))


if __name__ == '__main__':
    run()

Submission status: Accepted

Solution code:
# AOJ ITP2_4_D: Unique
# Python3 2018.6.24 bal4u

n = int(input())
a = list(map(int, input().split()))
ans = []
ans.append(a[0])
for i in range(1, n):
	if a[i] != a[i-1]: ans.append(a[i])
print(*ans)

Submission status: Accepted

Solution code:
# AOJ ITP2_4_D: Unique
# Python3 2018.6.24 bal4u

n = int(input())
a = list(map(int, input().split()))
print(*sorted(list(set(a))))

Submission status: Accepted

Solution code:

n = int(input())
a = list(map(int, input().split()))
print(*sorted(list(set(a))))

Submission status: Accepted

Solution code:
n = int(input())
A = sorted(map(int, set(input().split())))
print(" ".join(map(str, A)))

Submission status: Accepted

Solution code:
def solve():
    from sys import stdin
    f_i = stdin
    n = f_i.readline()
    A = f_i.readline().split()

    ans = (a1 for a1, a2 in zip(A, A[1:] + [None]) if a1 != a2)
    print(' '.join(ans))


solve()

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    A = [int(i) for i in input().split()]
    a = set([A[0]])
    print(A[0], end="")
    for i in range(1, N):
        if A[i] not in a:
            print("", A[i], end="")
            a.add(A[i])
    print()


resolve()

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))

B = [A[0]]
for i in A:
    if B[-1] < i:
        B.append(i)

print(*B)

Submission status: Accepted

Solution code:
n = int(input())
b = list(map(int,input().split()))
a = list()
pre = 100100100
for bb in b:
  if bb != pre:
    a.append(bb)
    pre = bb
  
print(a[0],end="")
for aa in a[1:]:
  print(" {}".format(aa),end="")
print()

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(list(set(list(map(int,input().split())))))
print (' '.join(map(str,a)))

Submission status: Accepted

Solution code:

from sys import stdin

n = int(stdin.readline())
l = list(stdin.readline().split())
l = list(dict.fromkeys(l))
print(' '.join(l))

Submission status: Accepted

Solution code:
input()
print(*sorted(set(list(map(int,input().split())))))

Submission status: Accepted

Solution code:
n = int(input())
*a, = map(int, input().split())
b = []
i = 0
while i < n:
    if i > 0 and a[i] == a[i-1]:
        i += 1
        continue
    b.append(a[i])
    i += 1
print(*b)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
a = list(set(a))
print(*sorted(a))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
print(*sorted(list(set(a))))

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=list(set(l))
s.sort()
print(' '.join(map(str,s)))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

B = []
B.append(A[0])
for i in range(1, N):
    if A[i] != A[i-1]:
        B.append(A[i])
print(*B)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
print(*sorted(set(A)))

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
A = list(dict.fromkeys(A))

print(*A)

Submission status: Accepted

Solution code:
n = int(input())
s = set()
a = []
for i in list(map(int, input().split())):
	if not i in s:
		a.append(i)
		s.add(i)
print(" ".join(map(str,a)))

Submission status: Accepted

Solution code:
def main():
    n = input()
    s = sorted(set(map(int, input().split(" "))))
    print(*s)
main()

Submission status: Accepted

Solution code:
m = input()
print(" ".join(list(dict.fromkeys(input().split()))))

Submission status: Accepted

Solution code:
n=int(input())
S=set(map(int, input().split()))
print(*sorted(list(S)))

Submission status: Accepted

Solution code:
n = input()
a = list(map(int,input().split()))
print(*list(dict.fromkeys(a)))

Submission status: Accepted

Solution code:
def solve():
    from sys import stdin
    f_i = stdin
    
    n = f_i.readline()
    A = f_i.readline().split()
    
    ans = (a1 for a1, a2 in zip(A, A[1:] + [None]) if a1 != a2)
    print(' '.join(ans))

solve()

Submission status: Accepted

Solution code:
n = int(input())

s = { int(x) for x in input().split()}

l = list(s)
l.sort()
print(*l)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split( )))
a.append(20000000000)
ans = []
for i in range(0, n)[::-1]:
    if a[i] != a[i-1]:
        ans.append(a[i])
print(*reversed(ans))

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    num_a = int(input())
    a = list(map(lambda x: int(x), input().split()))

    print(" ".join([str(elem) for elem in sorted(set(a))]))

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(list(set((map(int, input().split())))))

print(*a)

Submission status: Accepted

Solution code:
N = int(input())
print(*sorted(set(map(int, input().split()))))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Basic Modifications - Unique
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_4_D&lang=jp

"""
_ = input()
prev = float('-inf')
res = []
for a in input().split():
    a = int(a)
    if a > prev:
        res.append(a)
        prev = a
print(*res)

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	n = int(input())
	A = set(map(int,input().split()))
	print(*sorted(list(A)))

Submission status: Accepted

Solution code:
n = int(input())

A = set(map(int, input().split()))

print(*sorted(list(A)))

Submission status: Accepted

Solution code:
n = int(input())
box = set(map(int, input().split()))
box = list(box)
box.sort()
print(*box)

Submission status: Accepted

Solution code:
input()
nums = list(map(int, input().split(' ')))

print(' '.join(map(str, sorted(set(nums)))))

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
A=sorted(list(set(A)))

print(' '.join(map(str,A)))

Submission status: Accepted

Solution code:
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_4_D&lang=jp
# Unique

from collections import deque
import sys
input = sys.stdin.readline

def main():
    n1 = int(input())
    l1 = list(map(int,input().split()))
    print(*sorted(list(set(l1))))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
input()
arr = sorted(list(set(map(int, input().split()))))
print(*arr)

Submission status: Accepted

Solution code:
n = int(input())
num = list(map(int, input().split()))

ans = list(set(num))
ans.sort()
print(' '.join(str(a) for a in ans))

Submission status: Accepted

Solution code:
N = int(input())
print(*sorted(set(map(int, input().split()))))

Submission status: Accepted

Solution code:
n = input()
li = set([int(i) for i in input().split()])
li = sorted(li)
print(" ".join(map(str, li)))

Submission status: Accepted

Solution code:
input(); print(*sorted(set(map(int, input().split()))))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a = sorted(set(a))
print(" ".join(map(str, a)))