Problem:


Score : 300 points

Problem Statement

You drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.

How many kinds of items did you get?

Constraints

1 \leq N \leq 2\times 10^5

S_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N
S_1
:
S_N

Output

Print the number of kinds of items you got.

Sample Input 1

3
apple
orange
apple

Sample Output 1

2

You got two kinds of items: apple and orange.

Sample Input 2

5
grape
grape
grape
grape
grape

Sample Output 2

1

Sample Input 3

4
aaaa
a
aaa
aa

Sample Output 3

4



Sample input:
3
apple
orange
apple


Sample output:
2

Submission status: Time Limit Exceeded

Solution code:
def gacha():
    N = int(input())
    flag = 0
    num_list1 = []
    num_list2 = []

    for i in range(0,N):
        num_list1.append(input())

    num_list2.append(num_list1[0]) 

    for j in range(0,N):
        for item in num_list2:
            if num_list1[j] == item:
                flag = 1
            else:
                pass
        if flag == 0:
            num_list2.append(num_list1[j])
        else:
            flag = 0

    print(len(num_list2))
gacha()

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
S = [input() for i in range(N)]
count = 0
while len(S) >0:
  [S for S in S if S != S[0]]
  count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
List = []
for i in range(N):
    S = input()
    List.append(S)
New_List = []
for j in List:
    if j not in New_List:
        New_List.append(j)
print(len(New_List))

Submission status: Time Limit Exceeded

Solution code:
N =int(input())
P = [input() for i in range(N)]
#print(P)
S = [1 for i in range(N)]
#S[0] = int(1)

for i in range(N) :
    for j in range(i+1,N) :
        M = [0 for i in range(N)]
        #print (P[i]) 
        #print (P[j])
        li = len(P[i])
        lj = len(P[j])
        #print (li)
        #print (lj)
        if M[j] == 0 : 
            if li == lj :
                if P[i] == P[j] :
                    S[j] = 0 
                    M[j] = 1
                #else :
                #    S[j] = 1
        del M
        

#print (M)
#print (S)
ans = int(sum(S))

print (ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = []
for i in range(N):
    S.append(input())
count = 1
for i in range(1,N):
    if S[i] not in S[:i]:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [input() for i in range(n)] 

ans = 1
s = [a[0]]
 
for i in a[1:]:
    if i in s:
        continue
    else:
        ans += 1
        s.append(i)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
if __name__ == '__main__':
    n = int(input())
    lis = []
    for i in range(n):
        k = input().rstrip('\n')
        if k in lis :
            pass
        else:
            lis.append(k)
    print(len(lis))

Submission status: Time Limit Exceeded

Solution code:
count = int(input())
zenbu = []

for x in range(count):
    keihin = input()

    if not keihin in zenbu:
        zenbu.append(keihin)
print(len(zenbu))

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    ori = [input() for i in range(n)]
    data = ['']
    low = 0
    high = 1
    count = 0
    key = 0
    for per in ori:
        while(high - low > 1):
            center = (high + low) // 2
            if(data[center] == per):
                key = 1
                break
            elif(data[center] > per):
                high = center
            else:
                low = center
        if(key == 0):
            data.insert((high + low) // 2 + 1,per)
            count += 1
        else:
            key = 0
        high = len(data)
        low = 0
        
    print(count)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = []
ans = N


for i in range(N):
    s = input()
    if i == 0:
        S.append(s)
    else:
        flg = 0
        j  = 0
        while(flg == 0 and j < len(S)):
            if i != j:
                if S[j] == s:
                    flg = 1
                    ans = ans - 1
            j = j+1
        if flg == 0:
            S.append(s)
        
print(ans)

Submission status: Time Limit Exceeded

Solution code:
i = 0
S = []
T = []
N = int(input())
while i < N:
  S.append(input())
  i = i +1

i = 0
p = 0
while i < N:
  if not S[i] in T:
    T.append(S[i])
    p = p +1
  i+= 1
print(p)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = ""
List = []
for i in range(N):
    S = input()
    List.append(S)
New_List = []
for j in List:
    if j not in New_List:
        New_List.append(j)
print(len(New_List))

Submission status: Time Limit Exceeded

Solution code:
class TrieNode: 
    def __init__(self): 
    	self.children = [None]*26
    	self.isEndOfWord = False

class Trie: 
    def __init__(self): 
	    self.root = self.getNode() 

    def getNode(self):
        return TrieNode()

    def _charToIndex(self,ch): 
        return ord(ch)-ord('a') 

    def insert(self,key): 
	    pCrawl = self.root 
	    length = len(key) 
	    for level in range(length): 
		    index = self._charToIndex(key[level]) 
		    if not pCrawl.children[index]: 
			    pCrawl.children[index] = self.getNode() 
		    pCrawl = pCrawl.children[index] 
	    pCrawl.isEndOfWord = True
    
    def search(self, key):
        pCrawl = self.root
        length = len(key)
        for level in range(length):
            index = self._charToIndex(key[level])
            if not pCrawl.children[index]:
                return False
            pCrawl = pCrawl.children[index]
        return pCrawl != None and pCrawl.isEndOfWord

t = Trie()
count = 0
n = int(input())
for i in range(n):
    s = input()
    if not t.search(s):
        count += 1
        t.insert(s)
print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input().rstrip())
list=[]
for i in range (n):
    line=input().rstrip()
    list.append(line)

check=[]
count=1
check.append(list[0])
for i in range(1,n):
    for l in range(count):
        if list[i]==check[l]:
            break
        if l==count-1:
            check.append(list[i])
            count+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import copy

n = int(input())
s = []
for _ in range(n):
    s.append(input())

s2 = copy.copy(s)
i = n
j = 0#何個かぶったか
sum2 = 0
sum1 = 0

for k in range(i):
    for l in range(k,i):
        if s[k] == s[l]:
            
            j += 1
            s2.remove(s[k])
        
    if j == 1:
      j = 0
      s2 = [s[k]] + s2
      sum2 += 1
      sum1 += 1
    else:
      temp = s[k]
      s = [temp]  + copy.copy(s2)
      s2 = copy.copy(s)
      i -= (j-1)
      sum2 += j
      sum1 += 1
      j = 0

    if sum2 == n:
      break
          
#sum1 = len(s)
print(sum1)

Submission status: Time Limit Exceeded

Solution code:
count = int(input())
zenbu = []

for x in range(count):
    keihin = str(input())

    if not keihin in zenbu:
        zenbu.append(keihin)
print(len(zenbu))

Submission status: Time Limit Exceeded

Solution code:

n = int(input())
count = 0
flag = 1
l = [[[0] * 1 for i in range(10)] for j in range(26)]
s = [0] * n

alpha2num = lambda c: ord(c) - ord('a') + 1


for i in range(n):
    s[i] = input()
    leng = len(s[i]) - 1
    
    index = list(s[i])[0]
    ind = alpha2num(index) - 1
    
    flag = 1
    #count1 = 0
    for j in range(len(l[ind][leng])):
        #print(count1)
        #count1 += 1
        if s[i] == l[ind][leng][j]:
            flag = 0
            break
    if flag:
        l[ind][leng].append(s[i])
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
gift = []
cnt =0
for i in  range(n):
    get = input()
    if get not in gift:
        gift.append(get)
        cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
count = int(input())
zenbu = []

for x in range(count):
    keihin = str(input())
    flg = False

    if not keihin in zenbu:
        zenbu.append(keihin)
print(len(zenbu))

Submission status: Time Limit Exceeded

Solution code:
N =int(input())
P = [input() for i in range(N)]
#print(P)
S = [1 for i in range(N)]
#S[0] = int(1)
M = [0 for i in range(N)]
for i in range(N) :
    for j in range(i+1,N) :
        #print (P[i]) 
        #print (P[j])
        li = len(P[i])
        lj = len(P[j])
        #print (li)
        #print (lj)
        if M[j] == 0 : 
            if li == lj :
                if P[i] == P[j] :
                    S[j] = 0 
                    M[j] = 1
                #else :
                #    S[j] = 1
        

#print (M)
#print (S)
ans = int(sum(S))

print (ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
def main():
    n = int(input())
    s = deque()
    ans = 0
    for i in range(n):
        si = input()
        if si not in s:
            ans += 1
            s.append(si)
    print(ans)
main()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[]
for i in range(n):
    a.append(input())
num=0
for i in range(0,n//2):
    for l in range(n//2+1,n):
        if a[i]==a[l]:
            num+=1
print(len(a)-num)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = []
for i in range(1, N+1):
        S_i = input()
        S.append(S_i)
cnt = 0
for i in range(0, N):
        flg = 0
        for j in range(i+1, N):
                if( S[i] == S[j]):
                        flg = 1
        if(flg ==0):
                cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
gift = []
for i in  range(n):
    get = input()
    if get not in gift:
        gift.append(get)

print(len(gift))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
b = []
p = 0
for i in range(n):
    x = input()
    if x not in b:
        b.append(x)
        p += 1
print(p)

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
lst = []
count = 0
for i in range(num):
  keihin = str(input())
  if keihin not in lst:
    lst.append(keihin)
    count += 1
  else:
    continue;
print(count)

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    #ori = [str(i) for i in range(200000)]
    ori = [input() for i in range(n)]
    data = ['']
    low = 0
    high = 1
    count = 0
    key = 0
    for per in ori:
        while(high - low > 1):
            center = (high + low) // 2
            if(data[center] == per):
                key = 1
                break
            elif(data[center] > per):
                high = center
            else:
                low = center
        if(key == 0):
            data.insert((high + low) // 2 + 1,per)
            count += 1
        else:
            key = 0
        high = len(data)
        low = 0
        
    print(count)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s =[input() for i in range(n)]

list = []
ans = 0
for j in s:
  if j not in list:
    list.append(j)
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
count = int(input())
zenbu = []

for x in range(count):
    keihin = str(input())
    flg = False
    
    for y in range(len(zenbu)):
        
        if zenbu[y] == keihin:
            flg = True
            break
        
    if flg == False:
        zenbu.append(keihin)

print(len(zenbu))

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
lst = []
for i in range(num):
  keihin = str(input())
  if keihin not in lst:
    lst.append(keihin)
print(len(lst))

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
count = num
lists = []
for i in range(num):
    x = input()
    if x in lists:
        count -= 1
    lists.append(x)

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


i = 0
sum = 0
item_list = []

while i < N:
  item = input()
  if not(item in item_list) :
    item_list.append(item)
    sum += 1
  i += 1
#while_end

print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s =[input() for i in range(n)]

list = []
ans = 0
for j in s:
  if j in list:
    continue
  else:
    list.append(j)
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[]
for i in range(n):
  b=input()
  if b in a:
    continue
  else:
    a.append(b)
print(len(a))

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
list = (input() for i in range(N))

count = ()

for x in list:
    if x in count:None
    else:count = count + (x,)

print(len(count))

Submission status: Time Limit Exceeded

Solution code:
n=input()
n=int(n)
i=0
count = 0
lst=list()
while i<n:
	S=input()
	if S not in lst:
		# print(S)
		count += 1
		lst.append(S)
	# print(S)
	i+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    ori = [str(i) for i in range(200000)]
    #ori = [input() for i in range(n)]
    data = ['']
    low = 0
    high = 1
    count = 0
    key = 0
    for per in ori:
        while(high - low > 1):
            center = (high + low) // 2
            if(data[center] == per):
                key = 1
                break
            elif(data[center] > per):
                high = center
            else:
                low = center
        if(key == 0):
            data.insert((high + low) // 2 + 1,per)
            count += 1
        else:
            key = 0
        high = len(data)
        low = 0
        
    print(count)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
newlst = []
lst =[]
m = int(input())
while m > 0:
    a = str(input())
    lst.append(a)
    m = m -1
for j in lst:
    if j not in newlst:
        newlst.append(j)
print(len(newlst))

Submission status: Time Limit Exceeded

Solution code:
count = int(input())
zenbu = []

for x in range(count):
    keihin = str(input())
    flg = False
    
    for y in range(len(zenbu)):
        
        if zenbu[y] == keihin:
            flg = True
        
    if flg == False:
        zenbu.append(keihin)

print(len(zenbu))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
goods1 = []
goods2 = []
goods3 = []
goods4 = []
goods5 = []
goods6 = []
goods7 = []
goods8 = []
goods9 = []
goods10 = []
count = 0
for _ in range(n):
  check = input()
  finder = len(check)
  if finder == 1:
    if check not in goods1:
      goods1.append(check)
      count += 1

  if finder == 2:
    if check not in goods2:
      goods2.append(check)
      count += 1

  if finder == 3:
    if check not in goods3:
      goods3.append(check)
      count += 1

  if finder == 4:
    if check not in goods4:
      goods4.append(check)
      count += 1
    
  if finder == 5:
    if check not in goods5:
      goods5.append(check)
      count += 1
    
  if finder == 6:
    if check not in goods6:
      goods6.append(check)
      count += 1
    
  if finder == 7:
    if check not in goods7:
      goods7.append(check)
      count += 1
    
  if finder == 8:
    if check not in goods8:
      goods8.append(check)
      count += 1
    
  if finder == 9:
    if check not in goods9:
      goods9.append(check)
      count += 1
    
  if finder == 10:
    if check not in goods10:
      goods10.append(check)
      count += 1
 
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = []
ans = N
#for i in range(N):
#    S.append(input())
S = [input() for i in range(N)]
for i in range(N):
    flg = 0
    j  = 0
    while(flg == 0 and j < i):
        if i != j:
#            if len(S[j]) == len(S[i]):
#                if S[j][0] == S[i][0]:
            if S[j] == S[i]:
                S[j] = ''
                ans = ans - 1
                flg = 1
        j = j+1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
gacha_list = []
output = 0

for i in range(N):
  input_line = input()
  gacha_list.append(input_line)

while len(gacha_list) > 0:
  result = gacha_list[0]
  indexes = [i for i, x in enumerate(gacha_list) if x == result]
  for i in sorted(indexes, reverse=True):
    gacha_list.pop(i)
  output += 1
  
print(output)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = [input() for i in range(N)]
count = N
for i in range(N-1):
  for j in range(i+1, N):
    if S[i] == S[j]:
      count -= 1
      break
print(count)

Submission status: Time Limit Exceeded

Solution code:
import copy

n = int(input())
s = []
for _ in range(n):
    s.append(input())

s2 = copy.copy(s)
i = n
j = 0#何個かぶったか
sum2 = 0

for k in range(i):
    #temp = s[k]
    for l in range(i):
        if s[k] == s[l]:
            
            j += 1
            s2.remove(s[k])
           
    if j == 1:
      j = 0
      s2 = [s[k]] + s2
      sum2 += 1
    else:
      #print(j)
      temp = s[k]
        #for m in range(j):
            #s.remove(temp)

      s = [temp]  + copy.copy(s2)
      s2 = copy.copy(s)
      i -= (j-1)
      sum2 += j
      j = 0

    if sum2 == n:
      break
          
sum1 = len(s)
print(sum1)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
k = []
x = []
for i in range(0, N):
    a = input()
    k.append(a)
for i in k:
    if i not in x:
        x.append(i)
print (len(x))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
S = [input() for i in range(n)]

count = 0
i=0
while S != []:
    temp = len(S)
    S = [s for s in S if s != S[i]]
    if temp > len(S):
        count += 1
        i = 0
    i +=1
    if i == len(S):
        i = 0
print(count)

Submission status: Time Limit Exceeded

Solution code:
from bisect import bisect_left
N = int(input())
ans = [input()]

for i in range(N-1):
    Si = input()
    lef = bisect_left(ans, Si)
    if lef == len(ans):
        ans.append(Si)
    elif ans[lef] != Si:
            ans.insert(lef,Si)

print(len(ans))

Submission status: Time Limit Exceeded

Solution code:
count = int(input())
zenbu = []

for x in range(count):
    kosuu = 0
    keihin = str(input())
    flg = False
    
    for y in range(len(zenbu)):
        
        if zenbu[y] == keihin:
            flg = True
        
    if flg == False:
        zenbu.append(keihin)

print(len(zenbu))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
lst = []
for _ in range(n):
    Si = str(input())
    tf = Si in lst
    if tf is False:
        lst.append(Si)
print(len(lst))

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
list = [input() for i in range(N)]

count = ()

for x in list:
    if x in count:None
    else:count = count + (x,)

print(len(count))

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
lst = []
for i in range(a):
    b = input()
    if not(b in lst):
    	lst.append(b)
        
print(len(lst))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = []
ans = N
#for i in range(N):
#    S.append(input())
S = [input() for i in range(N)]
for i in range(N):
    flg = 0
    j  = 0
    while(flg == 0 and j < i):
        if i != j:
            if len(S[j]) == len(S[i]):
                if S[j][0] == S[i][0]:
                    if S[j] == S[i]:
                        S[j] = ''
                        ans = ans - 1
                        flg = 1
        j = j+1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = [[] for i in range(10)]
count = 0
flag = 0
for i in range(N):
  string = input()
  for s in S[len(string)-1]:
    if string == s:
      flag = 1
      break
  if flag == 0:
    S[len(string)-1].append(string)
    count += 1
  flag = 0
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = input()
N = int(N)
k = []
x = []
for i in range(0, N):
    a = input()
    k.append(a)
for i in k:
    if i not in x:
        x.append(i)
print (len(x))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = [input() for _ in range(N)]

S.sort()
items = 0
i = 0

while i < N:
    items += 1
    for j in range(i+1, N):
        if S[i] == S[j]:
            i += 1
    i += 1

print(items)

Submission status: Time Limit Exceeded

Solution code:
newlst = []
lst =[]
m = int(input())
for i in range(m):
    a = str(input())
    lst.append(a)
for j in lst:
    if j not in newlst:
        newlst.append(j)
print(len(newlst))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = []
ans = 0
for n in range(N):
    s = input()
    if s not in S:
        ans += 1
        S.append(s)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
List = []
answer = 0
for i in range(n):
  g = input()
  if (g in List) == False:
    List.append(g)
    answer += 1
print(answer)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
s = [0]*n
dic = []
count = 1
for i in range(n):
    s[i] = input()

s = sorted(s)
i = 0
while (len(s)-i>1):
    if str(s[i]) == str(s[i+1]):
        #s.pop(i)
        s.remove(s[i])
    else:
        i += 1
print(len(s))

Submission status: Time Limit Exceeded

Solution code:
l = [[],[],[],[],[],[],[],[],[],[],[]]

N = int(input())

for i in range(N):
  x = input()
  if x not in l[len(x)]:
    l[len(x)].append(x)

l2 = 0
for i in range(11):
  l2 += len(l[i])

print(l2)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [input() for i in range(n)] 
ans = 1
s = [a[0]]
 
for i in a[1:]:
    if not i in s:
        ans += 1
        s.append(i)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
S = []
S_append = S.append
for i in range(N):
  data=input()
  if data not in S:
    S_append(data)
print(len(S))

Submission status: Time Limit Exceeded

Solution code:
n = input()

n = int(n)
s = [0]*n
sm = []

for i in range(0,n):
  s[i] = input()

for i in range(0,n):
  sm.append(s[i])
  if(sm.count(s[i]) > 1):
    del sm[-1]
    
print(len(sm))

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-04-26 22:14:32 +0900
# LastModified: 2020-04-26 22:16:54 +0900
#


import os
import sys


def main():
    n=int(input())
    s = []
    count=0
    for i in range(n):
        chara = input()
        if not chara in s:
            s.append(chara)
            count+=1
    
    print(count)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = []
ans = 0
for n in range(N):
    s = input()
    if s not in S:
        ans += 1
    S.append(s)
print(ans)

Submission status: Time Limit Exceeded

Solution code:


def cal():
    number = int(input())
    str1 = input()
    strList1 = [str1]
    strList2 = [[strList1[0]]]
    for i in range(number-1):
        flag = 1
        strList1.append(list(map(str, input().rstrip().split())))
        for each in strList2:
            if each == strList1[i + 1]:
                flag = 0
                break
        if flag == 1:
            strList2.append(strList1[i+1])


    print(len(strList2))


cal()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
S = [input() for i in range(n)]

count = 0

for i in S:

    temp = len(S)
    S = [s for s in S if s != i]
    if temp > len(S):
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
List = []
answer = 0
for i in range(n):
  g = input()
  if (g in List) == False:
    answer += 1
  List.append(g)
print(answer)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = {}
count = 0
for _ in range(n):
    res = 5381
    s = input()
    for i in s:
        res = ((res << 5) + res)
    if res not in a:
        a[res] = []
        a[res].append(s)
        count += 1
    else:
        if s not in a[res]:
            a[res].append(s)
            count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
lists = []
count = 0
for i in range(N):
    S = input()
    if S not in lists:
        lists.append(S)
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:

def onajitoki(i,j):
    global li
    del li[j]
    return 0
#同じときliのj要素を消去

n=int(input())
li=[input() for i in range(n)]
li.extend([0])
k=0
i=0
while li[i]!=0:
    j=i
    while li[j+1]!=0:
        
        if li[i]==li[j+1]:
            op=onajitoki(i,j+1)

        else:j=j+1
    i=i+1

print(len(li)-1)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S = []
S_append = S.append
for i in range(N):
  data=input()
  if data not in S:
    S_append(data)
print(len(S))

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
c= [input() for i in range(a)]
lst = []

for i in range(len(c)):
    if not(c[i] in lst):
        lst.append(c[i])
print(len(lst))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = []
b = []
p = 0
for i in range(n):
    a.append(input())
for i in a:
    if i not in b:
        b.append(a[a.index(i)])
        p += 1
print(p)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 22:06:14 2020

@author: Masataka Amau
"""

N = int(input())
aaa = []
for i in range(N):
    buf = input()
    if(buf not in aaa):
        aaa.append(buf)
        
print(len(aaa))

Submission status: Time Limit Exceeded

Solution code:
n = input()

n = int(n)
s = [0]*n
sm = []

for i in range(0,n):
  s[i] = input()

for i in range(0,n):
  c = 1
  sm.insert(0,s[i])
  if(sm.count(s[i]) > 1):
    del sm[0]

print(len(sm))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = {}
count = 0
for _ in range(n):
    res = 0
    s = input()
    for i in s:
        res += (ord(i)-ord('a'))
    if res not in a:
        a[res] = []
        a[res].append(s)
        count += 1
    else:
        if s not in a[res]:
            a[res].append(s)
            count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
s = [0]*n
dic = []
count = 1
for i in range(n):
    s[i] = input()

s = sorted(s)
i = 0
while (len(s)-i>1):
    if str(s[i]) == str(s[i+1]):
        s.pop(i)
    else:
        i += 1
print(len(s))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = []
for i in range(N):
    x = input()
    if x not in S:
        S.append(x)
print(len(S))

Submission status: Time Limit Exceeded

Solution code:
def solve():
    lists = []
    n = int(input())
    i = 0
    ans = 0;
    temp = input()
    while len(temp) != 0:
        i = i + 1;
        if temp not in lists:
            ans = ans + 1
        if i == n:
            break
        lists.append(temp)
        temp = input()
    print(ans)
if __name__=="__main__":
    solve()

Submission status: Time Limit Exceeded

Solution code:
num = int(input()) - 1
j = 0
target = [input()]
hit = 1
x = 0
for j in range(num):
    check = input()
    if check not in target:
        target.append(check)
        hit += 1
print(hit)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = [input() for i in range(n)]
new_l = []

for i in l:
  if not i in new_l:
    new_l.append(i)
    
a = len(new_l)
print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = [input() for i in range(N)]
count = N

for i in range(N-1):
  for j in range(i+1, N):
    if S[i] == S[j]:
      count -= 1
      break
      
print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
list = [input() for i in range(N)]

count = []

for x in list:
    if x in count:None
    else:count.append(x)

print(len(count))

Submission status: Time Limit Exceeded

Solution code:
l = []

N = int(input())

for i in range(N):
  x = input()
  if x not in l:
    l.append(x)


print(len(l))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
gacha_list = []
output = 0

for i in range(N):
  input_line = input()
  gacha_list.append(input_line)

while len(gacha_list) > 0:
  result = gacha_list[0]
  result_count = gacha_list.count(result)
  for i in range(result_count):
    gacha_list.remove(result)
  output += 1
  
print(output)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
list = [input()]
count=1
for i in range(N-1):
    s = input()
    ind = 0
    for j in range(len(list)):
        if s == list[j]:
            break
        if s != list[j]:
            ind +=1
    if ind == len(list):
        list.append(s)
        count+=1
    if count == 10:
        pass
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
sg = []
for _ in range(n):
    s = input()
    if sg.count(s) == 0:
        sg.append(s)
print(len(sg))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = [[] for i in range(10)]
count = 0
for i in range(N):
  string = input()
  if len(S[len(string)-1]) == 0:
    S[len(string)-1].append(string)
    count += 1
  elif not string in S[len(string)-1]:
    S[len(string)-1].append(string)
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = input()
N = int(N)
k =[]
x = []
for i in range(0,N):
    a = input()
    k.append(a)
for j in k:
    if j not in x:
        x.append(j)
m = len(x)
print (m)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = []



for i in range(0,n):
    l.append(input())

p = []
p.append(1)
for i in range(1,n):
    count = 0
    for j in range(0,i):
        if l[i] == l[j]:
            count = count+1
    if count == 0:
        p.append(p[i-1] + 1)
    else:
        p.append(p[i-1])        

print(p[n-1])

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
lis=[]
for _ in range(n):
  s=input()
  lis.append(s)
  a=set()
  a.update(lis)
print(len(a))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[0]
for i in range(n):
    s=input()
    num=0
    for l in range(len(a)):
        if a[l] == s:
            num+=1
    if num==0:
        a.append(s)
print(len(a)-1)

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    n = int(input())
    lis = []
    for i in range(n):
        k = input()
        if k in lis :
            pass
        else:
            lis.append(k)
    print(len(lis))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
lists = []
count = 0
for i in range(N):
    S = input()
    if S in lists:
        pass
    else:
        lists.append(S)
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [input() for i in range(n)] 
ans =1
s = [a[0]]
 
for i in a[1:]:
    if not i in s:
        ans += 1
        s.append(i)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S = [input() for _ in range(N)]
item=[]
for s in S:
    if s not in item:
        item.append(s)
print(len(item))