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: Accepted

Solution code:
n =int(input())
cc = []
for i in range(n):
    s = input()
    cc.append(s)
cc = list(set(cc))
print(len(cc))

Submission status: Accepted

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

s=set(S)
print(len(s))

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    s = {}
    for _ in range(n):
        a = input().rstrip()
        s[a] = 1
    print(len(s))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    s = {}
    for _ in range(n):
        a = input().rstrip()
        s[a] = 1
    res = 0
    for _ in s.keys():
        res += 1
    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = [input() for raw in range(n)]
b = set(a)
c = len(b)
print(c)

Submission status: Accepted

Solution code:
dic={}
N=int(input())
for i in range(N):
    s=input()
    if "s" in dic:
        continue
    else:
        dic[s]=1

print(len(dic))

Submission status: Accepted

Solution code:
n = int(input())
s = set()
for i in range(n):
  s.add(input())
  
print(len(s))

Submission status: Accepted

Solution code:
n = int(input())

# TLE
#cnt = 0
#kei = [] 
#for _ in range(n):
#    tmp = input()
#    if not tmp in kei:
#        cnt += 1
#        kei.append(tmp)

s = set()
for _ in range(n):
    s.add(input())
cnt = len(s)

print(cnt)

Submission status: Accepted

Solution code:

n = int(input())
st = set()

for i in range(n):
    s = input()
    st.add(s)

print(len(st))

Submission status: Accepted

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

n = int(input())
a = set()

for i in range(n):
    a.add(input())

print(len(a))

Submission status: Accepted

Solution code:
#abc164c
n=int(input())
s=set()
for i in range(n):
 s.add(input())
print(len(s))

Submission status: Accepted

Solution code:
N = int(input())
S = []
for i in range(N):
  a = input()
  S.append(a)
s = set(S)
b = len(s)
print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Spyderエディタ

これは一時的なスクリプトファイルです
"""

n = int(input())

kList = []
for _ in range(n):
    kList.append(input())  
    
print(len(set(kList)))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
n = int(input())

s_set = {input() for i in range(n)}
print(len(s_set))

Submission status: Accepted

Solution code:
import collections

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

ans = collections.Counter(S)
print(len(ans))

Submission status: Accepted

Solution code:
n = int(input())
a = []
for i in range(n):
  x = input()
  a.append(x)
  
print(len(set(a)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(len(set(input()for _ in range(int(input())))))

Submission status: Accepted

Solution code:
n = int(input())
s_set = {input() for i in range(n) }
print(len(s_set))

Submission status: Accepted

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

sorted_list = sorted(s)
i :int=0
k :int=0
kind :str=""
while i<N:
  if kind!=sorted_list[i]:
    kind=sorted_list[i]
    k+=1
  i+=1
  
print(k)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

n = int(input())
s_set = {input() for i in range(n) }
print(len(s_set))

Submission status: Accepted

Solution code:
n = int(input())

d = dict()
ans = 0

for i in range(n):
    s = str(input())
    if s in d:
        continue
    else:
        d[s] = s
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = [input() for _ in range(N)]
# print(sorted(set(S)))
print(len(set(S)))

Submission status: Accepted

Solution code:
n=int(input())
l=[0]*n
for i in range(n):
  l[i]=input()
print(len(list(set(l))))

Submission status: Accepted

Solution code:
N = int(input())
S = set([input() for _ in [0]*N])
print(len(S))

Submission status: Accepted

Solution code:
n = int(input())

dic = {}

for i in range(n):
    s = input()
    dic[s] = dic.get(s, 0) + 1

print(len(dic.keys()))

Submission status: Accepted

Solution code:
N=int(input())
Ss=[input() for i in range(N)]
print(len(list(set(Ss))))

Submission status: Accepted

Solution code:
# input 
N = int(input())
S = []
append = S.append

for n in range(N):
    append(str(input()))
    
S = set(S)

print(len(S))

Submission status: Accepted

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

t = set(s)
print(len(t))

Submission status: Accepted

Solution code:
n = int(input())

s = set()

for _ in range(n):
  s.add(input())

print(len(s))

Submission status: Accepted

Solution code:
n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
dic={}

for i in range(n):
    s=input()
    dic[s]=dic.get(s,0)+1

print(len(dic.keys()))

Submission status: Accepted

Solution code:
from collections import defaultdict

n = int(input())

d = defaultdict(int)
for i in range(n):
    d[input()] += 1

print(len(d))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = set(open(0))
print(len(s)-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    n = int(input())
    s = []
    for _ in range(n):
        a = input()
        s.append(a)
    s.sort()
    cnt = 1
    for i in range(n-1):
        if s[i] != s[i+1]:
            cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
LIN=lambda : list(IN())
mod=1000000007

#+++++

def main():
	a = int(input())
	#b , c = IN()
	al = [input() for _ in range(a)]
	#s = input()
	n=len(list(set(al)))
	print(n)
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
N = int(input())

S = {}
for _ in range(N):
  S.setdefault(input())

print(len(S))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    print(len(set(input().rstrip('\n') for _ in range(n))))

Submission status: Accepted

Solution code:
n = int(input())
a = []
for i in range(n):
  a.append(str(input()))
print(len(set(a)))

Submission status: Accepted

Solution code:
n = int(input())
l = [0]*n
for i in range(n):
  l[i] = input()
print(len(set(l)))

Submission status: Accepted

Solution code:
N=int(input())
a=[]
for i in range(N):
    a.append(str(input()))
b=set(a)
print(len(b))

Submission status: Accepted

Solution code:
n=int(input())
s={input() for i in range(n)}
print(len(s))

Submission status: Accepted

Solution code:
_,*s=open(0).read().split()
print(len(list(set(s))))

Submission status: Accepted

Solution code:
s = set([])
things = int(input())

for i in range(things):
    p = input()
    s.add(p)

print(len(s))

Submission status: Accepted

Solution code:
def main():
    N=int(input())
    s=[input() for i in range(N)]
    S=set(s)
    print(len(S))
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    n=int(input())
    A=[input() for i in range(n)]
    A=list(set(A))
    print(len(A))


solve()

Submission status: Accepted

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

n = int(input())
st = set()
for i in range(n):
	s = input()
	st.add(s)
print(len(st))

Submission status: Accepted

Solution code:
import sys
def main():
    input = sys.stdin.readline
    N=int(input())
    S=set(input() for _ in range(N))
    print(len(S))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
lista = []
for x in range(n):
    item = input()
    lista.append(item)

lista.sort(reverse = False)
contador = 1

if len(lista) == 1:
    print(contador)
else:
    i = 0
    j = 1
    while i != len(lista)-1:
        if lista[i] != lista[j]:
            contador += 1
        i += 1
        j += 1

    print(contador)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    s = set()
    for _ in range(n):
        tmp = input()
        s.add(tmp)
    ans = 0
    for _ in s:
        ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

s=set()
for i in range(n):
  s.add(input())

print(len(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = set()
for _ in range(N):
    S.add(input())
print(len(S))

Submission status: Accepted

Solution code:
N = int(input())
a_list=[]
for i in range(N):
  a_list.append(input())
  
a_set = set(a_list)

a_num = len(a_set)

print(a_num)

Submission status: Accepted

Solution code:
d={}
for i in range(int(input())):
    s=str(input())
    d[s]=1
print(len(d))

Submission status: Accepted

Solution code:
import collections
N= int(input())
S=[input() for i in range(N)]
s=list(S)
ans = collections.Counter(s)
print(len(ans))

Submission status: Accepted

Solution code:
import math as mt
import collections as cc
I=lambda:list(map(int,input().split()))
n,=I()
s=set()
for i in range(n):
    s.add(input())
print(len(s))

Submission status: Accepted

Solution code:
S = set()
n = int(input())
for i in range(n):
  S.add(input().strip())
print (len(S))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    print(len({input() for _ in range(n)}))
resolve()

Submission status: Accepted

Solution code:
N = int(input())
ans = []
for _ in range(N):
  s = input()
  ans.append(s)
print(len(list(set(ans))))

Submission status: Accepted

Solution code:
ss = set()
n = int(input())
for i in range(n):
    ss.add(input())
print(len(ss))

Submission status: Accepted

Solution code:
N=int(input())
listA=[]
for i in range(N):
  A=input()
  listA+=[A]
listA=list(set(listA))
ans=len(listA)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = {input() for _ in range(N)}
print(len(S))

Submission status: Accepted

Solution code:
n = int(input())
S = set()
for k in range(n):
	S.add(input())
print(len(S))

Submission status: Accepted

Solution code:
N = int(input())
print(len(set(input() for _ in range(N))))

Submission status: Accepted

Solution code:
print(len({input() for _ in range(int(input()))}))

Submission status: Accepted

Solution code:
N = int(input())
s = set()
for _ in range(N):
    S = input()
    s.add(S)
print(len(s))

Submission status: Accepted

Solution code:
print(len(set(open(0).read().split()))-1)

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
s = [input() for i in range(n)]
c = Counter(s)
c = list(c.items())
print(len(c))

Submission status: Accepted

Solution code:
n=int(input())
l=set([])
for i in range(n):
    l.add(input())
print(len(l))

Submission status: Accepted

Solution code:
n=int(input())
ans=set()
for i in range(n):
    ans.add(input())
    
print(len(ans))

Submission status: Accepted

Solution code:
count = int(input())
zenbu = set()
 
for x in range(count):
    keihin = input()
    zenbu.add(keihin)
print(len(zenbu))

Submission status: Accepted

Solution code:
n = int(input())
s = [input() for _ in range(n)] # 見た目がスッキリするリスト内包表記で入力を受け取っています。forループを使っても同じです。

ss = set(s) # sのset型を作ります。これは悪い変数名ですが、短いコードなので適当でいいと思います。
ans = len(ss) # これで種類数がわかります。
print(ans)

Submission status: Accepted

Solution code:
import collections
n = int(input())
s_list = [input() for i in range(n)]
print(len(collections.Counter(s_list)))

Submission status: Accepted

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

s = set(s)

print(len(s))

Submission status: Accepted

Solution code:
n = int(input());
s = [0]*n;
for i in range(n):
    s[i] = input().rstrip('\n');
s.sort();
ans = 1;
for i in range(n-1):
    if not(s[i]==s[i+1]) :
        ans += 1;
print(ans);

Submission status: Accepted

Solution code:
print(len(set(open(0)))-1)

Submission status: Accepted

Solution code:
N = int(input())
s = [0]*N
for i in range(N):
    s[i] = input()

print(len(set(s)))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ans = {}
    for _ in range(N):
        ans[input()] = True
    print(len(ans))

    return 0

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np


def solve(n, s_list):
    return np.unique(s_list).shape[0]


def main():
    n = int(input())
    s_list = [input() for _ in range(n)]
    res = solve(n, s_list)
    print(res)


def test():
    assert solve(3, ["apple", "orange", "apple"]) == 2
    assert solve(5, ["grape", "grape", "grape", "grape", "grape"]) == 1
    assert solve(4, ["aaaa", "a", "aaa", "aa"]) == 4


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

Solution code:
#ABC164 C
N = int(input())
keihin = {}
for i in range(N):
    keihin[input()] = 1
print(len(keihin))

Submission status: Accepted

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

Ans=list(set(S))

print(len(Ans))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
S = [input() for _ in range(N)]

print(len(set(S)))

Submission status: Accepted

Solution code:
n=int(input())
s=[]
for i in range(0,n):
  s.append(input())
a=set(s)
print(len(a))

Submission status: Accepted

Solution code:
n = int(input())
A = []
for i in range(n):
    A.append(input())
A = list(set(A))
print(len(A))

Submission status: Accepted

Solution code:
n = int(input())
dic = {}
cnt =0
for i in  range(n):
    get = input()

    if get not in dic:
        dic[get] = 1

print(len(dic))

Submission status: Accepted

Solution code:
N = int(input())
L = []
if not (1 <= N <= 2*(10**5)):
    exit()


for i in range(N):
    d = input()
    # if not (1 <= len(d) <= 10):
    #    exit()
    # if not (d.lower() == d):
    #     exit()
    L.append(d)

print(len(set(L)))

Submission status: Accepted

Solution code:
n = int(input())
items = set()
for i in range(n):
  item = input()
  items.add(item)
print(len(items))

Submission status: Accepted

Solution code:
n = int(input())
l = []
for i in range(n):
    l.append(input())
print(len(set(l)))

Submission status: Accepted

Solution code:
n = int(input())

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

print(len(set(s)))

Submission status: Accepted

Solution code:
def prb2():
    a,b,c,d = map(int,input().split())
    t = (a+b)
    ak = (c+d)
    print('Yes' if t>ak else "No")

def prb3():
    n = int(input())
    d = set()
    for i in range(n):
        s = input()
        d.add(s)
    print(len(d))



#prb1()
#prb2()
prb3()

Submission status: Accepted

Solution code:
N = int(input())
A = []
for i in range(N):
  s = input()
  A.append(s)
A.sort()
ans = N
for i in range(N-1):
  if A[i] == A[i+1]:
    ans -= 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
d = {}
for i in range(n):
    buf = input()
    if buf not in d:
        d[buf] = 1

print(len(d.keys()))

Submission status: Accepted

Solution code:
N = int(input())
S = []
for _ in range(N):
    S.append(input())
S = list(set(S))
print(len(S))

Submission status: Accepted

Solution code:
n=int(input())
s=[]
for i in range(n): s.append(input())
s.sort()
m=n
for i in range(1,n):
  if s[i]==s[i-1]: m-=1
print(m)

Submission status: Accepted

Solution code:
N = int(input())
s = set()
for k in range (N):
    i = input()
    s.add(i)
print(len(s))

Submission status: Accepted

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

gifts_count = {}
for gift in s_gifts:
    if not gift in gifts_count:
        gifts_count[gift] = 0
    gifts_count[gift] += 1

print(len(gifts_count.keys()))

Submission status: Accepted

Solution code:
from collections import Counter
 
N = int(input())
S = [""]*N
for i in range(N):
  S[i] = input()
print(len(Counter(S).keys()))

Submission status: Accepted

Solution code:
from collections import Counter
 
N = int(input())
S = {}
for i in range(N):
  S[i] = input()
print(len(Counter(S.values()).keys()))

Submission status: Accepted

Solution code:
# C - gacha
def main():
    _, *S = open(0)
    print(len(set(S)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N=int(input())
ans=set()
for i in range(N):
    S=input()
    ans.add(S)
print(len(ans))

Submission status: Accepted

Solution code:
n=int(input())
dict={}
sum=0
for i in range(n):
    s=input()
    if s not in dict.keys():
        dict[s]=1
        sum+=1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
s = set()

for i in range(n):
    a = input()
    s.add(a)

print(len(s))

Submission status: Accepted

Solution code:
N=int(input())
dict={}
for i in range(N):
  dict[input()]=1
print(len(dict))

Submission status: Accepted

Solution code:
n = int(input())
p = [input() for i in range(n)]
s = set()
for i in range(n):
    s.add(p[i])
print(len(s))

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
S=[input().strip() for _ in range(n)]
print(len(set(S)))

Submission status: Accepted

Solution code:
from collections import Counter
 
N = int(input())
S = [input() for _ in range(N)]
print(len(Counter(S).keys()))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

##### 割り算の切り上げ #####
# tmp = -(-4 // 3)

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()
	S = {}

	ans = 0
	for i in range(N):
		tmp = input()
		tmp = tmp[:-1]
		tmptmp = tmp[0]

		if tmp in S:
			continue
		else:
			S[tmp] = 1
			ans += 1

	print(ans)


#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
from collections import Counter as c
N = int(input())
s = []
for n in range(N):
    s.append(input())
print(len(c(s)))

Submission status: Accepted

Solution code:
# C - gacha
def main():
    _, *S = open(0).read().split()
    print(len(set(S)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
S = []
ans = N
S = [input() for i in range(N)]
#for i in range(N):
#    S.append(input())
S.sort()
for i in range(N-1):
    if S[i] == S[i+1]:
        ans = ans - 1
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n = II()
    s = SR(n)
    print(len(set(s)))
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
n = int(input())
s = set()
for i in range(n):
    s.add(input())

print(len(s))

Submission status: Accepted

Solution code:
n = int(input())
dic = {}
for i in range (n):
    s = input()
    dic[s] =  dic.get(s, 0) + 1
print(len(dic))

Submission status: Accepted

Solution code:
n = int(input())
s = set(input() for _ in range(n))

print(len(s))

Submission status: Accepted

Solution code:
N = int(input())
 
res = set()
for i in range(N):
    res.add(input())
 
print(len(res))

Submission status: Accepted

Solution code:
n = int(input())
counter = 0
s = "TEMP"
list = []
temp = ''

while n > 0:
  s = input()
  list.append(s)
  n = n - 1

list.sort()
for item in list:
  if item == temp:
    counter = counter - 1
  counter = counter + 1
  temp = item

print(counter)

Submission status: Accepted

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

print(len(set(s)))

Submission status: Accepted

Solution code:
l=set()
n=int(input())
for i in range(n):
    s=input()
    l.add(s)
print(len(l))

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
aint = lambda: int(input())
n = aint(); get = []
for _ in range(n):
  inp = input()
  get.append(inp)
s = set(get)
print(len(s))

Submission status: Accepted

Solution code:
l={}
n=int(input())
for i in range(n):
    s=input()
    if not s in l:
        l[s]=1
print(len(l))

Submission status: Accepted

Solution code:
N = int(input())
ans = set()
for i in range(N):
    Si = input()
    ans.add(Si)
print(len(ans))

Submission status: Accepted

Solution code:
N = int(input())
A = {input() for _ in range(N)}
print(len(A))

Submission status: Accepted

Solution code:
import collections
N=int(input())
a=[]
for i in range(N):
  a.append(input())
print(len(collections.Counter(a)))

Submission status: Accepted

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

A=set(S)
print(len(A))

Submission status: Accepted

Solution code:
import sys
from collections import Counter


def main():
  scan = sys.stdin.readline
  
  n = int(scan().rstrip())
  s = [scan().rstrip() for _ in range(n)]
  
  print(len(Counter(s)))


if __name__ == "__main__":
  main()

Submission status: Accepted

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

print(len(set(S)))

Submission status: Accepted

Solution code:
n = int(input())
s = {input() for _ in range(n)}
print(len(s))

Submission status: Accepted

Solution code:
n=int(input());print(len(set([input()for i in range(n)])))

Submission status: Accepted

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

print(len(set(S)))

Submission status: Accepted

Solution code:
n = int(input())
ans = len(set([input() for _ in range(n)]))
print(ans)

Submission status: Accepted

Solution code:
def main():

    N = int(input())

    S = []
    for i in range(N):
        S.append(input())
    
    S.sort()

    now_name = S[0]
    ans = 1
    for i in range(N):
        if now_name != S[i]:
            ans += 1
            now_name = S[i]
    
    print('{}'.format(ans))



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
s = [readline().rstrip().decode() for _ in range(n)]
print(len(set(s)))

Submission status: Accepted

Solution code:
n = int(input())
str_list = []
count = 1
for _ in range(n):
    s = input()
    str_list.append(s)
str_list.sort()
for i in range(n-1):
    if str_list[i] != str_list[i+1]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
def c_gacha():
    N = int(input())
    return len(set([input() for _ in range(N)]))

print(c_gacha())

Submission status: Accepted

Solution code:
n = int(input())
s = []
'''
t = s
for i in range(n):
    s.append(str(input()))
ans = n
for i in range(n-1):
    for j in range(i+1, n):
        if s[j] == s[i]:
            ans -= 1
            del t[j]
print(ans)
print(len(t))
'''
for i in range(n):
    s.append(str(input()))
sa = set(s)
print(len(sa))

Submission status: Accepted

Solution code:
def c_gacha():
    N = int(input())
    Prizes = [input() for _ in range(N)]
    return len(set(Prizes))

print(c_gacha())

Submission status: Accepted

Solution code:
import collections
N = int(input())
s=[]
for i in range(N):
  s.append(input())
c = collections.Counter(s)
 
print(len(c))

Submission status: Accepted

Solution code:
n = int(input())
a = [input() for _ in range(n)]
a = set(a)
print(len(a))

Submission status: Accepted

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

st=set(S)
print(len(st))

Submission status: Accepted

Solution code:
import sys
import collections

n = int(sys.stdin.readline().strip())
data = []

for x in range(n):
    data.append(input())

print(len(collections.Counter(data)))

Submission status: Accepted

Solution code:
n=int(input())
a=set()
for i in range(n):
    b=input()
    a.add(b)
print(len(a))

Submission status: Accepted

Solution code:
N = int(input())

print(len(set(input() for _ in range(N))))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = [str(input()) for i in range(N)]
    print(len(set(S)))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
li = []
for _ in range(n):
    li.append(input())
li.sort()

ans = n

for i in range(n-1):
    if li[i] == li[i+1]:
        ans -= 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
kind_set = set()

for i in range(N):
    kind_set.add(input())

print(len(kind_set))

Submission status: Accepted

Solution code:

a = int(input())
l = [input() for i in range(a)]
print(len(set(l)))

Submission status: Accepted

Solution code:
N = int(input())
li = []
while len(li) <N:
  li.append(input())
print(len(set(li)))

Submission status: Accepted

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

s_l = len(set(s))
print(s_l)

Submission status: Accepted

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