TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(input())
Ws=[]
for n in range(N):
    W=input()
    Ws.append(W)

for w in range(len(Ws)):
    if Ws.count(w)>1:
        print('No')
        exit()

for x in range (1,N):
    if Ws[x][0] != Ws[x-1][-1]:
        print("No")
        exit()
print("Yes")


N=int(input())
Ws=[]
for n in range(N):
    W=input()
    Ws.append(W)

for w in range(len(Ws)):
    if Ws.count(w)>=2:
        print('No')
        exit()

for x in range (1,N+1):
    if Ws[x][0] != Ws[x-1][-1]:
        print("No")
        exit()
print("Yes")


N=int(input())
Ws=[]
for n in range(N):
    W=input()
    Ws.append(W)

for w in range(len(Ws)):
    if Ws.count(w)>=2:
        print('No')
        exit()

for x in range (1,N):
    if Ws[x][0] != Ws[x-1][-1]:
        print("No")
        exit()
print("Yes")


N=int(input())
Ws=[]
for n in range(N):
    W=input()
    Ws.append(W)

for w in range(len(Ws)):
    if Ws.count(w)>=2:
        print('No')
        exit()

for x in range (1,len(Ws)):
    if Ws[x][0] != Ws[x-1][-1]:
        print("No")
        exit()
print("Yes")

N=int(input())
Ws=[]
for n in range(N):
    W=input()
    Ws.append(W)

for w in range(len(Ws)):
    if Ws.count(Ws[w])>=2:
        print("No")
        exit()
        
for x in range (1,len(Ws)):
    if Ws[x][0] != Ws[x-1][-1]:
        print("No")
        exit()

print("Yes")

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())

W = [input() for n in range(N)]

ap = []
flag = "No"
a = 0
for n in range(N - 1):
    
    if W[n + 1][0] == W[n][-1] and W[n] not in ap:
        a = 0
    else:
        flag = "Yes" 
    ap.append(W[n])

print(flag)

N = int(input())

W = [input() for n in range(N)]

flag = "Yes"

for n in range(1, N):
    if W[n][0] != W[n - 1][-1] or (W[n] in W[:n]):
        flag = "No"

print(flag)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
l = [input() for _ in [0]*n]
print(l)
if len(set(l)) != n:
    print('No')
else:
    for i in range(n-1):
        print(i)
        print(list(l[i])[-1])
        print(list(l[i+1])[0])
        if list(l[i])[-1] != list(l[i+1][0]):
            print('No')
        #else:
            #print('Noo')
            #break
    #else:
    print('Yes')


n = int(input())
l = [input() for _ in [0]*n]
print(l)
if len(set(l)) != n:
    print('No')
else:
    for i in range(n-1):
        #print(i)
        #print(list(l[i])[-1])
        #print(list(l[i+1])[0])
        if list(l[i])[-1] != list(l[i+1][0]):
            print('No')
        #else:
            #print('Noo')
            #break
    #else:
    print('Yes')




n = int(input())
l = [input() for _ in [0]*n]
if len(set(l)) != n:
    print('No')
else:
    for i in range(n-1):
        if l[i][-1] != l[i+1][0]: 
            print('No')
            break
        else:
            continue
    else:
        print('Yes')


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
s=input()
last=s[-1]

for i in range(n-1):
  s=input()
  if s[0]!=last:
    print(s[0])
    print(last)
    print('No')
    break
  last=s[-1]
  if i==n-2:
    print('Yes')

n=int(input())
s=input()
a=[]
last=s[-1]
a.append(s)

for i in range(n-1):
  s=input()
  a.append(s)
  if s[0]!=last:
    print('No')
    break
  last=s[-1]
  if i==n-2 and len(a)==len(set(a)):
    print('Yes')
  elif i==n-2:
    print('No')
    

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
s=set()
wp=input()
s.add(wp)

f=True
for i in range(n-1):
  wn=input()
  if wp[-1]!=wn[0]:
    f=False
  elif s.issubset(set(wp))==True:
    f=False
  wp=wn
  s.add(wn)

print('Yes' if f==True else 'No')


n=int(input())
s=set()
wp=input()
s.add(wp)

f=True
for i in range(n-1):
  wn=input()
  if wp[-1]!=wn[0]:
    f=False
  elif wn in s:
    f=False
  wp=wn
  s.add(wn)

print('Yes' if f==True else 'No')


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
def main():
    n = int(input())
    word_lst = [""] * n
    previous_word = input()
    ok = True
    for i in range(1,n):
        now_word = input()
        if not (now_word[0] == previous_word[-1]):
            ok = False
            break
        previous_word = now_word

    print("Yes" if ok else "No")






if __name__ == '__main__':
    main()


def main():
    n = int(input())
    word_lst = []
    previous_word = input()
    word_lst.append(previous_word)
    ok = True
    for i in range(1,n):
        now_word = input()
        if not (now_word[0] == previous_word[-1]):
            ok = False
            break
        if now_word in word_lst:
            ok = False
            break
        word_lst.append(now_word)
        previous_word = now_word
    if len(word_lst) != len(set(word_lst)):
        ok = False

    print("Yes" if ok else "No")






if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(input())

W=[input() for i in range(N)]

check=1

for i in range(2,N):
    if W[i-1][-1] != W[i][0]:
        check=0

    




W.sort()



for i in range(2,N):
    if W[i]==W[i-1]:
        check=0
        print(i)






if check==1:
    print("Yes")

else:
    print("No")


import sys

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

from collections import Counter
counter=Counter(W)

if max(counter.values())>1:
    print("No")
    sys.exit()

for i in range(1,N):
    if W[i][0]!=W[i-1][-1]:
        print("No")
        sys.exit()

print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
import sys
N = int(input())
k = input()
a = []
for i in range(N-1):
    a.append(input())
lis = []
for words in a:
  if words in lis:
    print('No')
    sys.exit()
  elif k[-1] != words[0]:
    print('No')
    sys.exit()
  else:
    lis.append(words)
    k = words
print('Yes')

import sys
N = int(input())
k = input()
a = []
for i in range(N-1):
    a.append(input())
lis = [k]
for words in a:
  if words in lis:
    print('No')
    sys.exit()
  elif k[-1] != words[0]:
    print('No')
    sys.exit()
  else:
    lis.append(words)
    k = words
print('Yes')

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
z = list(input() for _ in range(n))
if len(set(z)) == len(z):
  if all([z[i][-1] == z[i+1][0] for i in range(len(z)-1)]):
    print('Yes')
  else:
    print('No')


n=int(input())
w=[input() for i in range(n)]
flag=False
if n==len(set(w)):
    if all([w[i-1][-1]==w[i][0] for i in range(1,n)]):
        flag=True
print("Yes" if flag else "No")

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())

lastch = ''
answer = 'Yes'
words = []
for i in range(n):
    word = list(input())
    words.append(word)
    if lastch != word[0] and i != 0:
        answer = 'No'
    lastch = word[-1]

if len(set(words)) != len(words):
    answer = 'No'

print(answer)


n = int(input())

lastch = ''
answer = 'Yes'
for i in range(n):
    word = list(input())
    if lastch != word[0] and i != 0:
        answer = 'No'
    lastch = word[-1]

print(answer)


n = int(input())

lastch = ''
answer = 'No'
words = []

for i in range(n):
    word = raw_input()
    words.append(word)
    if lastch == word[0] and i != 0:
        answer = 'Yes'
    else:
        answer = 'No'
    lastch = word[-1]

print('Yes' if len(words) == len(set(words)) and answer == 'Yes' else 'No')


n = int(input())

lastch = ''
answer = 'Yes'
words = []

for i in range(n):
    word = input()
    words.append(word)
    if lastch != word[0] and i != 0:
        answer = 'No'
    lastch = word[-1]

if len(words) != len(set(words)):
    answer = 'No'

print(answer)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
index = 0
list1 = []
listForWord=[]
lists = []
flag =0
while index <n:
    word = input()
    list1.append(list(word))
    if index!= 0:
        length = len(lists[index-1])
        if lists[index-1][length-1] == list1[index][0]:
            if word in listForWord == False:
                pass
            else:
                frag =1
        else:
            frag =1
    lists.append(list1[index])
    listForWord.append(word)
    index+=1
    if index==n and flag ==0:
        print("Yes")
    elif index ==n and flag ==1:
        print("No")


n = int(input())
index=0
lists =[]
listForWords=[]
flag =0
while index<n:
    word = input()
    list1 = list(word)
    if index!=0:
        length = len(lists[index-1])
        if list1[0] == lists[index-1][length-1]:
            for li in listForWords:
                if word == li:
                    flag =1
        else:
            flag =1
    lists.append(list1)
    listForWords.append(word)
    index+=1

if flag==0:
    print("Yes")
else:
    print("No")


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
p = ''
d = []
for _ in range(n):
  w = input()
  if p and p[-1] == w[0]
    print('No')
    exit()
  if w in d:
    print('No')
    exit()
  p = w[-1]
  d[w] = 1
print('Yes')
  

n = int(input())
p = ''
d = {}
for _ in range(n):
  w = input()
  if p and p[-1] != w[0]:
    print('No')
    exit()
  if w in d:
    print('No')
    exit()
  p = w[-1]
  d[w] = 1
print('Yes')
  


Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(input())
W=[]
for _ in range(N):
    W.append(input())
c=1
for i in range(N-1):
     if W[i][-1]!=W[i+1][0]:
            c=0
            break
if c:
    print('Yes')
else:
    print('No')

N=int(input())
W=[]
for _ in range(N):
    W.append(input())
c=1
for i in W:
    d=W.count(i)
    if d>1:
        c=0
        break
for i in range(N-1):
     if W[i][-1]!=W[i+1][0]:
            c=0
            break
if c:
    print('Yes')
else:
    print('No')

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):

n = int(input())
w = []

for i in range(n):
    s = input()
    if s in w:
        flag = 0
        break
    else:
        w.append(s)

for i in range(1, n-1):
    if w[i][-1] != w[i+1][0]:
        flag = 0
        break

if flag == 0:
    print('No')
else:
    print('Yes')

N = int(input())
w = input()
word = [w]
before = w[-1]
flag = True

for i in range(N-1):
    w = input()
    if w not in word and before == w[0]:
        word.append(w)
        before = w[-1]
    else:
        flag = False
        break

if flag == True:
    print('Yes')
else:
    print('No')


Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
num_word = int(input())
word_list=[]
word_list = [str(input()) for i in range(num_word)]
 
word_list_temp=[]
for j in range(len(word_list)):
  if j == len(word_list)-1:
    print ("Yes")
    break
  else:
    old_word=word_list[j]
    old_word_sep=list(old_word)
    word_list_temp.append(old_word)
    new_word=word_list[j+1]
    new_word_sep=list(word_list[j+1])

num_word = int(input())
word_list=[]
word_list = [[int(i) for i in input().split()] for i in range(n)] 

word_list_temp=[]
for j in range(len(word_list)):
  if j == len(word_list)-1:
    print ("Yes")
    break
  else:
    old_word=word_list[j]
    old_word_sep=list(old_word)
    word_list_temp.append(old_word)
    new_word=word_list[j+1]
    new_word_sep=list(word_list[j+1])
    if old_word_sep[len(old_word)-1]!=new_word_sep[0]:
      print ("No")
      break
    elif new_word in list(word_list_temp):
      print ("No")
      break
    else:
      continue

num_word = int(input())
word_list=[]
word_list = [str(input()) for i in range(num_word)] 
 
word_list_temp=[]
for j in range(len(word_list)):
  if j == len(word_list)-1:
    print ("Yes")
    break
  else:
    old_word=word_list[j]
    old_word_sep=list(old_word)
    word_list_temp.append(old_word)
    new_word=word_list[j+1]
    new_word_sep=list(word_list[j+1])
    if old_word_sep[len(old_word)-1]!=new_word_sep[0]:
      print ("No")
      break
    elif new_word in list(word_list_temp):
      print ("No")
      break
    else:
      continue

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
import fractions
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=abs(x-a[0])
cnt=abs(a[1]-a[0])
for j in range(n-1):
    cnt=min(abs(a[j+1]-a[j]),cnt)
for i in range(n):
    ans=min(abs(x-a[i]),ans)
print(min(ans,cnt))
    

n=int(input())
w=[]
ans='Yes'
for i in range(n):
    w.append(list(input()))
    if i==0:
        continue
    if w[i][0]!=w[i-1][len(w[i-1])-1]:
            ans='No'
            break
    for j in range(i):
        if w[i]==w[j]:
            ans='No'
            break
print(ans)
    

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A)):
    if all(A[i][-1]==A[i+1][0]) for i in range(N-1):
        print('Yes')
    else:print('No')
else:print('No')

N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A)):
    if all(A[i][-1]==A[i+1][0]) for i in range(N-2):
        print('Yes')
    else:print('No')
else:print('No')

N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A):
    if all(A[i][-1]==A[i+1][0]) for i in range(N-1):
        print('Yes')
    else:print('No')
else:print('No')

N=int(input())
A=list(input()for i in range(N))
if len(A)==len(set(A)):
    if all(A[i][-1]==A[i+1][0] for i in range(N-1)):
        print('Yes')
    else:print('No')
else:print('No')

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
words = [input().strip() for _ in range(N)]

def solve(words):
  s = set(words[0])
  for p, w in zip(words, words[1:]):
    if p[-1] != w[0]:
      return "No"
    if w in s:
      return "No"
    s.add(w)
  return "Yes"

print(solve(words))

N = int(input())                                                                                                                                                                                                  
for i in range(N):
    W.append(input())

prev = W[0]

answer = "Yes"

for w in W[1:]:
    if prev[-1] != w[0]:
        answer = "No"

print(answer)                                                           

N = int(input())
words = [input().strip() for _ in range(N)]

def solve(words):
  s = {words[0]}
  for p, w in zip(words, words[1:]):
    if p[-1] != w[0]:
      return "No"
    if w in s:
      return "No"
    s.add(w)
  return "Yes"

print(solve(words))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(i)
W=[int(input()) for i in range(N)]
for i in range(N-1):
  if W[i:].find(W[i])==True:
    print("No")
  elif W[i][-1]!=W[i+1][0]:
    print("No")
else:
  print("Yes")

N=int(input())
W=[input() for i in range(N)]
for i in range(N-1):
    if W[i] in W[i+1:]:
        print("No")
        break
    elif W[i][-1]!=W[i+1][0]:
        print("No")
        break
else:
    print("Yes")

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(input())
answer=[]

for i in range(N):
    answer.append(input())

for j in range(N-1):
    if(answer[j][-1]==answer[j+1][0]):
        if(j==N-2):
            print("Yes")
        else:
            continue
    else:
        print("No")
        break

N=int(input())
answer=[]

for i in range(N):
    answer.append(input())
    
if(len(set(answer))!=len(answer)):
    print("No")
else:
    for j in range(N-1):
        if(answer[j][-1]==answer[j+1][0]):
            if(j==N-2):
                print("Yes")
            else:
                continue
        else:
            print("No")
            break

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
W = list(input() for i in range(N))
f = True

for i in range(N-1):
  if W[i][-1]!=W[i+1][0]:
    f = False
    
if N!=len(set(W)) and f:
  print("Yes")
else:
  print("No")

N = int(input())
W = [input() for n in range(N)]
a = "Yes"

for n in range(N-1):
  if W[n][-1]!=W[n+1][0] or W.count(W[n])!=1:
    a = "No"

print(a)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input()) 
t = [input() for i in range(N)] 

def is_unique(seq):
    return len(seq) == len(set(seq))

if is_unique(t) == False:
  print('No')

count = 0       

while count < N-1:
  if t[count][-1] != t[count+1][0]:
      print('No')
      break
  else:
    count += 1
print('Yes')


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

def is_unique(seq):
    return len(seq) == len(set(seq))
flag = 'B'
if is_unique(t) == False:
  flag = 'A'

count = 0       
while count < N-1:
  if t[count][-1] != t[count+1][0]:
      flag = 'A'
      count += 1
  else:
    count += 1

if flag =='A':
  print('No')
else:
  print('Yes')

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
def solve(words):
    word = words[0]
    uniq_words = {word: True}
    print(words)

    ans = "Yes"
    for key in range(1, len(words)):
        next_word = words[key]
        if next_word in uniq_words:
            ans = "No"
            break
        uniq_words[next_word] = True
        if word[-1] != next_word[0]:
            ans = "No"
            break
        word = next_word

    return ans

def main():
    n = int(input())
    words = []
    for i in range(n):
        words.append(input())

    ans = solve(words)
    print(ans)

main()



def solve(words):
    word = words[0]
    uniq_words = {word: True}

    ans = "Yes"
    for key in range(1, len(words)):
        next_word = words[key]
        if next_word in uniq_words:
            ans = "No"
            break
        uniq_words[next_word] = True
        if word[-1] != next_word[0]:
            ans = "No"
            break
        word = next_word

    return ans

def main():
    n = int(input())
    words = []
    for i in range(n):
        words.append(input())

    ans = solve(words)
    print(ans)

main()


Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
words = [input() for _ in range(N)]

ans = 'Yes'
if len(words) != len(set(words)):
    ans = 'No1'
else:
    next_words = words[1:]+['']
    for s1,s2 in zip(words,next_words):
        if s2 and s1[-1] != s2[0]:
            ans = 'No2'
            break

print(ans)

N = int(input())
words = [input() for _ in range(N)]

ans = 'Yes'
if len(words) != len(set(words)):
    ans = 'No'
else:
    next_words = words[1:]+['']
    for s1,s2 in zip(words,next_words):
        if s2 and s1[-1] != s2[0]:
            ans = 'No'
            break

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N = int(input())
l = list()
al = list()
bl = list()

for n in N:
    a = input()
　 l.append(a)
    al.append(a[:1])
    bl.append(a[-1:])

l_unq = list(set(l))
if len(l) == len(l_unq):
    for i in N-1:
        if al[i+1] != bl[i]:
          print("No")
          break
     print("Yes")
else:
    print("No")

N = int(input())
l = list()
al = list()
bl = list()
 
for n in range(0,N):
    a = input()
　 l.append(a)
    al.append(a[:1])
    bl.append(a[-1:])
 
l_unq = list(set(l))
if len(l) == len(l_unq):
    for i in range(0,N-1):
        if al[i+1] != bl[i]:
          print("No")
          break
     print("Yes")
else:
    print("No")

N = int(input())
l = list()
al = list()
bl = list()
 
for n in range(0,N):
    a = input()
　 l.append(a)
    al.append(a[1])
    bl.append(a[-1])
 
l_unq = list(set(l))
if len(l) == len(l_unq):
    for i in range(0,N-1):
        if al[i+1] != bl[i]:
          print("No")
          break
     print("Yes")
else:
    print("No")


N = int(input())
l = list()

for n in range(N):
    a = input()
    l.append(a)

l_uniq = list(set(l))

if len(l) == len(l_uniq):
    for i in range(0, N-1):
        if l[i+1][0] != l[i][-1]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("No")
    


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n = int(input())
list = [input() for _ in range(n)]
a = 'Yes'
if len(set(list))!=n:
    ans = 'No'
for i in range(n-1):
    if list[i][-1]!=list[i+1][0]:
        a = 'No'
print(a)

n = int(input())
list = [input() for _ in range(n)]
a = 'Yes'
if len(set(list))!=n:
    a = 'No'
for i in range(n-1):
    if list[i][-1]!=list[i+1][0]:
        a = 'No'
print(a)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(input())
L=[]
a=True
for i in range(n):
  L.append(input())
if len(L)!=len(set(L)):
  print('No')
else:
  for i in range(1,len(L)):
    if L[i][0]==L[i-1][-1]:
      continue
    else:
      a=False
  if a is True:
    print('Yes')
  else:
    print('No')



n=int(input())
L=[]
a=True
for i in range(n):
  L.append(input())
if len(L)!=len(set(L)):
  print('No')
else:
  for i in range(1,len(L)):
    if L[i][0]==L[i-1][-1]:
      continue
    else:
      a=False
  if a is True:
    print('Yes')
  else:
    print('No')

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):

import collections
N = int(input())
Word_List = []
SP = ""
for i in range(N):
    CW = str(input())
    if i == 0:
        Word_List.append(CW)
        SP = CW[-1]
    elif SP != CW[0]:
        break
    else:
        Word_List.append(CW)
        SP = CW[-1]
else:
    Word_List = collections.Counter(Word_List))
    if len(Word_List) != N:
        print("No")
    else:
        print("Yes")


import collections
N = int(input())
Word_List = []
SP = ""
for i in range(N):
    CW = str(input())
    if i == 0:
        Word_List.append(CW)
        SP = CW[-1]
    elif SP != CW[0]:
        print("No")
        break
    else:
        Word_List.append(CW)
        SP = CW[-1]
else:
    Word_List = collections.Counter(Word_List)
    if len(Word_List) != N:
        print("No")
    else:
        print("Yes")

Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
import sys
n=int(input())
now=input()
for i in range(n-1):
    w=input()
    if now[-1]!=w[0]:
        print("No")
        sys.exit()
    now=w
print("Yes")

import sys
n=int(input())
now=input()
D=[now]
for i in range(n-1):
    w=input()
    if now[-1]!=w[0] or w in D:
        print("No")
        sys.exit()
    D.append(w) 
    now=w
print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
    n = int(input())
     
    last = None
    seen = set()
    for _ in range(n):
      w = input()
      if w in seen or (last and last[-1] != w[0]):
        print("No")
        break
      seen.add(w)
    else:
      print("Yes")

n = int(input())

last = None
seen = set()
for _ in range(n):
  w = input()
  if w in seen or (last and last[-1] != w[0]):
    print("No")
    break
  seen.add(w)
  last = w
else:
  print("Yes")


Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n=int(input())
hoge=[]
no=0

a=input()
hoge.append(a)
saigo=a[-1]

for i in range(n-1):
  a=input()
  hoge.append(a)
  if(hoge.count(a)>1):
    no=1
    break
  if(saigo==a[-1]):
    no=1
    break
  saigo=a[-1]
  
if(no==0):
  print("YES")
else:
  print("NO")

n=int(input())
hoge=[]
no=0

a=input()
hoge.append(a)
saigo=a[-1]

for i in range(n-1):
  a=input()
  hoge.append(a)
  if(hoge.count(a)>1):
    no=1
    break
  if(saigo==a[0]):
    saigo=a[-1]
  else:
    no=1
    break
  
if(no==0):
  print("YES")
else:
  print("NO")

n=int(input())
hoge=[]
no=0

a=input()
hoge.append(a)
saigo=a[-1]

for i in range(n-1):
  a=input()
  hoge.append(a)
  if(hoge.count(a)>1):
    no=1
    break
  if(saigo==a[0]):
    saigo=a[-1]
  else:
    no=1
    break
  
if(no==0):
  print("Yes")
else:
  print("No")

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
n  = int(input())
w = []

w.append(input())

ans = 'Yes'
for i in range(1,n,1):
  w.append(input())
  l = len(w[j])
  if w[i][0:1] != w[j][l-1:l]: ans = 'No'
  for j in range(i):
    if w[i] == w[j]: ans = 'No'

print(ans)

n  = int(input())
w = []

w.append(input())

ans = 'Yes'
for i in range(1,n,1):
  w.append(input())
  l = len(w[i-1])
  if w[i][0:1] != w[i-1][l-1:l]:
    ans = 'No'
    break
  for j in range(i):
    if w[i] == w[j]:
      ans = 'No'
      break

print(ans)


Verdicts: Runtime Error

Accepted
Problem: Takahashi is practicing _shiritori_ alone again today.  Shiritori is a game as follows:    * In the first turn, a player announces any one word.   * In the subsequent turns, a player announces a word that satisfies the following conditions:     * That word is not announced before.     * The first character of that word is the same as the last character of the last word announced.  In this game, he is practicing to announce as many words as possible in ten seconds.  You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

Submission attempts (in order):
N=int(input())
b=input()
d={b}
f=1
for _ in [0]*~-N:s=input();f=b[-1]==s[0]and s not in d;b=s;d|={s}
print('Yes'if f else'No', d)

N=int(input())
b=input()
d={b}
f=1
for _ in [0]*~-N:s=input();f=b[-1]==s[0]and s not in d;b=s;d|={s}
print('Yes'if f else'No')

N=int(input())
b=input()
d={b}
f=1
for _ in [0]*~-N:
  s=input()
  if b[-1]!=s[0]or s in d:f=0;break
  b=s;d|={s}
print('Yes'if f else'No')

Verdicts: Wrong Answer

Wrong Answer

Accepted