For those who as I has wa3 or wa5 and don't understand why: 1) similar must be personal number, not passwords 2) personal number is decimal number 3) to get other password (i.e. calculate diffeence of passwords) we can ONLY change digit, we can't insert or erase digits like in personal number May be you don't have theese mistakes, but I spent a day to undestand it Notice that the similar 4556 to the 456 can be obtained by insertion a digit into TWO positions. Don't take it into account twice. dead beef f00d I do not can understand!? How using 1 insert or 1 replace or one delete to make f00d from dead does your misunderstanding come from another problem? :) As for this problem, there's no need to insert or delete symbols from access codes. But personal number 3 can be obtained from personal number 1 with 1 digit replace. Oh! Thanks very much! My misunderstanding was due to problem 1007 where words for replacements were given explicitly No subj Edited by author 07.11.2009 21:24 610 1000 1001 1002 1003 ... 1609 Answer is 6350 1126 460 0 Thank you very much! Very helpful test! Edited by author 07.11.2009 05:29 Why is answer 0 0 2 1 ? Yes, why 0 0 2 1??? Edited by author 03.11.2009 21:14 Because 1) There are 0 pairs of employees whose pincodes are different at 1 position. 2) There are 0 pairs of employees whose pincodes differ at 1 position. 3) There are 2 pairs of employees (1 and 2, 1 and 3) whose pincodes differ at 3 positions 4) There is 1 pair of employees (2 and 3) whose pincodes differ at all 4 positions. Thank you melkiy I have AC now+) Edited by author 04.11.2009 14:15 5 and 105? Edited by author 01.11.2009 15:52 According to the condition "if one of them can be obtained from the other by inserting, deleting, or replacing one digit" i think they are not similar. Although i haven't ACed... All the numbers 1,2,3 are similar. For i=1 .. 4 there IS at least 1 pair of employees whose pincodes differ at ith position. Why there are zeros in the output? Edited by author 01.11.2009 14:09 Sorry, i'm wrong. "i" and "ith" make large difference 
