ZhenlongDai/ACPR huggingface dataset:
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n=int(input())
a=list(map(int, input().split()))
c=Counter(a)
print('Yes' if len(a)==len(c) else 'No')

Failing test case input:
5
7 10 -1 -1 3

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
from collections import Counter
n=int(input())
a=list(map(int, input().split()))
c=Counter(a)
print('YES' if len(a)==len(c) else 'NO')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("No")
else:
  	print("Yes")


Failing test case input:
2
10000100 10000000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("NO")
else:
  	print("YES")

Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    N = int(input())
    List = list(map(int,input().split()))
    Set = set()
    for i in List:
        if i in Set:
        	print('No')
        	return
        Set.add(i)
    print('Yes')
    return
main()

Failing test case input:
5
1 4 2 -1 -1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    List = list(map(int,input().split()))
    Set = set()
    for i in List:
        if i in Set:
        	print('NO')
        	return
        Set.add(i)
    print('YES')
    return
main()

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A = list(map(int,input().split()))
print("Yes") if len(A) == len(set(A)) else print("No")

Failing test case input:
6
1 3 4 -2 6 0

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
A = list(map(int,input().split()))
print("YES") if len(A) == len(set(A)) else print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n = int(input())
    print("Yes" if n == len(set(map(int, input().split()))) else "No")
    
if __name__ == '__main__':
    main()

Failing test case input:
2
00000101 01010000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    print("YES" if n == len(set(map(int, input().split()))) else "NO")
    
if __name__ == '__main__':
    main()

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l_set = set(input().split())
if n == len(l_set):
    print("Yes")
else:
    print("No")

Failing test case input:
5
3 9 0 -2 2

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
l_set = set(input().split())
if n == len(l_set):
    print("YES")
else:
    print("NO")
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

if len(A) == len(set(A)):
    print("Yes")
else:
    print("No")

Failing test case input:
2
10000100 00101000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
from collections import Counter


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

if [1] * N == list(Counter(A).values()):
    print("YES")
else:
    print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
List = list(map(int, input().split()))

count = 'Yes'
for i in range(N-1):
    for j in range(N-1-i):
        if List[i] == List[i+1+j]:
            count = 'No'

print(count)

Failing test case input:
2
11000100 10001000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
List = list(map(int, input().split()))

List.sort()
count = 'YES'
for i in range(N-1):
    if List[i] == List[i+1]:
        count = 'NO'
        
print(count)

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

N = int(input())
AList = list(map(int, input().split()))
AList.sort()

for i in range(1, N):
    if AList[i - 1] == AList[i]:
        print('No')
        sys.exit()
        
print('Yes')

Failing test case input:
6
6 2 2 0 2 0

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
import sys

N = int(input())
AList = list(map(int, input().split()))
AList.sort()

for i in range(1, N):
    if AList[i - 1] == AList[i]:
        print('NO')
        sys.exit()
        
print('YES')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A = list(map(int, input().split()))
setA = set(A)
print("Yes" if len(setA)==len(A) else "No")

Failing test case input:
6
6 1 1 0 2 0

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
A = list(map(int, input().split()))
setA = set(A)
print("YES" if len(setA)==len(A) else "NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A_line = list(map(int, input().split()))

A_line.sort()

res = "YES"
for i in range(len(A_line) - 2):
  if A_line[i] == A_line[i + 1]:
    res = "NO"

print(res)

Failing test case input:
2
10000000 10000000

Expected output:
NO

Actual output:
YES


Fixed submission (verdict: Accepted):
N = int(input())
A_line = list(map(int, input().split()))

A_line.sort()

res = "YES"
for i in range(len(A_line) - 1):
  if A_line[i] == A_line[i + 1]:
    res = "NO"

print(res)

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=input()
lst=len(set(input().split()))
if n==lst:
    print("YES")
else:  print("NO")

Failing test case input:
2
11000101 00001000

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
n=input()
lst=input().split()
if len(lst)==len(set(lst)):
    print("YES")
else: print("NO")
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
tmp=set(A)
tmp=list(tmp)


if len(tmp)==len(A):
  print ("Yes")
else:
  print ("No")

Failing test case input:
5
1 4 2 -1 -1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
tmp=set(A)
tmp=list(tmp)


if len(tmp)==len(A):
  print ("YES")
else:
  print ("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(int(x) for x in input().split())
x = 0

a.reverse()
for i in range(n-1):
    if a[0] - a[1] == 0:
        print("NO")
        x = 1
        break
    a.pop(0)

if x == 0:
    print("YES")


Failing test case input:
5
1 4 1 0 2

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
n = int(input())
a = list(int(x) for x in input().split())
x = 0
 
a.sort()
for i in range(n-1):
    if a[-1] - a[-2] == 0:
        print("NO")
        x = 1
        break
    a.pop()
 
if x == 0:
    print("YES")

Problem: p02779
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    print("Yes" if len(A) == len(set(A)) else "No")

if '__main__' == __name__:
    resolve()

Failing test case input:
5
1 4 2 -2 -1

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    print("YES" if len(A) == len(set(A)) else "NO")

if '__main__' == __name__:
    resolve()

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
if len(list(set(a)))==n:
    print("Yes")
else:print("No")



Failing test case input:
5
11 10 0 -1 3

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
if len(list(set(a)))==n:
    print("YES")
else:print("NO")

Problem: p02779
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from collections import Counter
N=int(input())
A=list(map(int, input().split()))

cnt=Counter(A)
print("Yes" if all([i==1 for i in cnt.values()]) else "No")

Failing test case input:
5
2 6 2 -2 1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
from collections import Counter
N=int(input())
A=list(map(int, input().split()))

cnt=Counter(A)
print("YES" if all([i==1 for i in cnt.values()]) else "NO")

Problem: p02779
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
a.sort()

for i in range(n - 1):
    if a[i] == a[i + 1]:
        print('No')
        exit()
print('Yes')

Failing test case input:
6
6 2 2 0 2 0

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
a.sort()

for i in range(n - 1):
    if a[i] == a[i + 1]:
        print('NO')
        exit()
print('YES')
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
data = list(map(int, input().split()))

data.sort()

ans = "Yes"
for i in range(len(data) - 1):
  if data[i] == data[i+1]:
    ans = "No"
    break

print(ans)


Failing test case input:
6
4 1 3 2 2 0

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
data = list(map(int, input().split()))

data.sort()

ans = "YES"
for i in range(len(data) - 1):
  if data[i] == data[i+1]:
    ans = "NO"
    break

print(ans)

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
_ = int(input())
A = list(map(int, input().split()))

import collections
c = collections.Counter(A)

if max(c.values()) > 1:
    print("No") 
else:
    print("Yes")

Failing test case input:
6
6 1 2 2 2 0

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
_ = int(input())
A = list(map(int, input().split()))

import collections
c = collections.Counter(A)

if max(c.values()) > 1:
    print("NO") 
else:
    print("YES")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())  
    A = list(map(int, input().split()))  

    d = {}

    for i in A:
        if not i in d.keys():
            d[i] = None
        else:
            print("No")
            return
    else:
        print("YES")


if __name__ == '__main__':
    main()


Failing test case input:
6
6 2 2 0 1 -1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
def main():
    N = int(input())  
    A = list(map(int, input().split()))  

    d = {}

    for i in A:
        if not i in d.keys():
            d[i] = None
        else:
            print("NO")
            return
    else:
        print("YES")


if __name__ == '__main__':
    main()

Problem: p02779
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N=int(input())
A=list(map(int, input().split()))

if list(set(A))==sorted(A):
	print("YES")
else:
	print("NO")

Failing test case input:
2
00001111 11010100

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int, input().split()))

if len(set(A))==N:
	print("YES")
else:
	print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))

Auni = set(A)

if len(A) == len(Auni):
    print("Yes")
else:
    print("No")

Failing test case input:
5
1 4 2 -1 -1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))

Auni = set(A)

if len(A) == len(Auni):
    print("YES")
else:
    print("NO")
Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
from collections import Counter
if max(Counter([int(x) for x in input().split()]).values())==1:
  print("Yes")
else:
  print("No")

Failing test case input:
6
1 3 4 -2 6 0

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
N=int(input())
from collections import Counter
if max(Counter([int(x) for x in input().split()]).values())==1:
  print("YES")
else:
  print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
b=list(input().split())
c=sorted(b)
count=0
for i in range (a-1):
	if c[i]==c[i+1]:
		count=1
		break
	
if count==1:
	print("No")	
else:print("Yes")

Failing test case input:
6
1 2 5 -1 4 1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
a=int(input())
b=list(input().split())
c=sorted(b)
count=0
for i in range (a-1):
	if c[i]==c[i+1]:
		count=1
		break
	
if count==1:
	print("NO")	
else:print("YES")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
len1 = int(input())
len2 = set(input().split(" "))
if len1 == len2:
  print("YES")
else:
  print("NO")


Failing test case input:
2
11000100 00001000

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
len1 = int(input())
len2 = len(set(input().split(" ")))
if len1 == len2:
  print("YES")
else:
  print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
lis = list(map(int,input().split()))
x = 0
for i in range(N):
        for j in range(i,N):
                if lis[i] == lis[j]:
                        x = 1
if x == 0:
        print("YES")
else:
        print("NO")

Failing test case input:
5
2 9 1 4 5

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
N = int(input())
lis = list(map(int,input().split()))
lis.sort()
judge = 0
for i in range(1,N):
    if lis[i-1] == lis[i]:
        judge = 1
if judge == 0:
    print("YES")
else:
    print("NO")

Problem: p02779
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
re = 0

c = Counter(a)

for i in c.values():
    if i > 1:
        re += 1

if re > 0:
    print("No")
else:
    print("Yes")


Failing test case input:
6
4 1 3 1 2 1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

c = Counter(a)
new = c.values()

for i in new:
    if i != 1:
        re = "NO"
        break
    else:
        re = "YES"

print(re)

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N = int(input())
A = list(map(int, input().split(' ')))
A.sort()
S = list(set(A))
if A == S:
    print('YES')
else:
    print('NO')


Failing test case input:
2
00011100 01010000

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):


N = int(input())
A = list(map(int, input().split(' ')))
A.sort()
S = list(set(A))
if len(A) == len(S):
    print('YES')
else:
    print('NO')
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from itertools import groupby


def input():
    return sys.stdin.readline()[:-1]


def solve():
    N = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) == N:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    solve()


Failing test case input:
6
4 1 3 1 6 2

Expected output:
NO

Actual output:
No


Fixed submission (verdict: Accepted):
import sys
from itertools import groupby


def input():
    return sys.stdin.readline()[:-1]


def solve():
    N = int(input())
    A = list(map(int, input().split()))
    if len(set(A)) == N:
        print('YES')
    else:
        print('NO')


if __name__ == "__main__":
    solve()

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input()) 

An = [int(x) for x in input().split() ]

ii = len(An)

if len( set(An) ) == ii:
    print('Yes')
else:
    print('No')


Failing test case input:
6
6 1 2 2 2 0

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input()) 

An = [int(x) for x in input().split() ]

ii = len(An)

if len( set(An) ) == ii:
    print('YES')
else:
    print('NO')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
s = list(set(a))

if len(a) == len(s):
    print("Yes")
else:
    print("No")

Failing test case input:
5
4 11 0 -1 3

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
s = list(set(a))

if len(a) == len(s):
    print("YES")
else:
    print("NO")

Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())

a = list(map(int, input().split()))


x = len(set(a))


if x == len(a):
    print("Yes")
else:
    print("No")

Failing test case input:
5
7 11 -1 -1 3

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())

a = list(map(int, input().split()))


x = len(set(a))


if x == len(a):
    print("YES")
else:
    print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=input()
An = input()
list_An=[]
a = 0
for i in range(len(An)):
    if An[i]==" ":
        list_An.append(An[a:i])
        a = i
list_An.append(An[a+1:len(An)])
A =0
for i in range(len(list_An)):
    for j in range(len(list_An)):
        if list_An[i]==list_An[j]:
            A+=1
if A == len(list_An)+2:
    print("YES")
else:
    print("NO")

Failing test case input:
6
1 2 5 -1 2 0

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
N=input()
An = input()
list_An=[]
a = 0
for i in range(len(An)):
    if An[i]==" ":
        list_An.append(int(An[a:i]))
        a = i+1
list_An.append(int(An[a:len(An)]))
list_An.sort()
A = 0
for i in range(len(list_An)):
    if list_An[i-1]==list_An[i]:
        print("NO")
        A = 1
        break    
if A == 0:
    print("YES")
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter


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

if [1 ** N] == Counter(A).values():
    print("YES")
else:
    print("NO")

Failing test case input:
5
2 9 0 -2 1

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
from collections import Counter


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

if [1] * N == list(Counter(A).values()):
    print("YES")
else:
    print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):










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

def calculate(n,arr):

    dict = {}
    result = True
    for i in range(n):
        item = arr[i]
        if dict.get(item) == None:
            dict.__setitem__(item,True)
        else:
            result = False
            break
    if result == True:
        print("Yes")
    else:
        print("No")

calculate(N,ARR)


Failing test case input:
5
2 9 1 3 5

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):










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

def calculate(n,arr):

    dict = {}
    result = True
    for i in range(n):
        item = arr[i]
        if dict.get(item) == None:
            dict.__setitem__(item,True)
        else:
            result = False
            break
    if result == True:
        print("YES")
    else:
        print("NO")

calculate(N,ARR)

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
arr = list(map(int, input().split()))

flag = False
for i in arr:
    if arr.count(i) >= 2:
        flag = True
        break

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

Failing test case input:
2
10010100 10101001

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
arr = list(map(int, input().split()))

arr.sort()

ans = "YES"
for i in range(n-1):
    if arr[i] == arr[i+1]:
        ans = "NO"
        break

print(ans)

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

def main():
    StringN = input();
    listA = input();
    newlistA = sorted(listA);

    for i in range(len(newlistA)-1):
        if newlistA[i] == newlistA[i+1]:
            print('No');
            return 0;
        else:
            print('Yes');
            return 0;


main();

Failing test case input:
2
10000000 00101000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):

def main():
    StringN = input();
    listA = input().split();
    listA.sort();



    for i in range(int(StringN)-1):


        if listA[i] == listA[i+1]:
            print('NO');

            return 0;
    print('YES');


main();
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def has_duplicates(seq):
    return len(seq) != len(set(seq))

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

if has_duplicates(A) == True:
  print('YES')
else:
  print('NO')


Failing test case input:
6
6 3 2 2 1 -1

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
def has_duplicates(seq):
    return len(seq) != len(set(seq))

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

if has_duplicates(A) == True:
  print("NO")
else:
  print("YES")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("Yes")
else:
  	print("No")


Failing test case input:
5
3 9 0 0 2

Expected output:
NO


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("NO")
else:
  	print("YES")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A = int(input()), list(map(int, input().split()))
print("Yes" if len(set(A)) == len(A) else "No")

Failing test case input:
2
00001100 01010000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
N, A = int(input()), list(map(int, input().split()))
print("YES" if len(set(A)) == len(A) else "NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = input().split(" ")

flag = False
for i in range(n-1):
    for j in range(i, n):
        if a[i] == a[j]:
            flag = True
            break
    if flag:
        break

print('NO' if flag else 'YES')


Failing test case input:
5
2 9 1 4 5

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
n = int(input())
a = input().split(" ")

a.sort()
flag = False
for i in range(n-1):
    if a[i] == a[i+1]:
        flag = True
        break

print('NO' if flag else 'YES')

Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
a.sort()
tmp = 0
for i in range(n-1):
    if a[i]==a[i+1]:
        tmp = 1
        break
if tmp == 1:
    print('No')
else:
    print('Yes')
    

Failing test case input:
5
2 9 0 -2 2

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
a.sort()
tmp = 0
for i in range(n-1):
    if a[i]==a[i+1]:
        tmp = 1
        break
if tmp == 1:
    print('NO')
else:
    print('YES')
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
import sys

N = int(input())
A = [int(x) for x in input().split()]

C = dict(Counter(A))
for a in C:
    if C[a] > 1:
        print('No')
        sys.exit()
print('Yes')

Failing test case input:
6
6 5 2 2 1 -1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
from collections import Counter
import sys
N = int(input())
A = [int(x) for x in input().split()]

C = dict(Counter(A))
for a in C:
    if C[a] > 1:
        print('NO')
        sys.exit()
print('YES')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))

if len(set(a)) == n:
    print("Yes")
else:
    print("No")

Failing test case input:
6
6 0 1 1 2 0

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))


if len(set(a)) == n:
    print("YES")
else:
    print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
if(sorted(Counter([i for i in input().split()]).most_common())[0][1] > 1):
  print('No')
else:
  print('Yes') 


Failing test case input:
2
11001100 10101000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
if(sorted(Counter([i for i in input().split()]).most_common(), key=lambda x: x[1], reverse = True)[0][1] > 1):
  print('NO')
else:
  print('YES')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a_list = list(map(int, input().split()))

if len(a_list) == len(set(a_list)):
    print('Yes')
else:
    print('No')

Failing test case input:
2
11000100 10101001

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
a_list = list(map(int, input().split()))

if len(set(a_list)) == n:
    print('YES')
else:
    print('NO')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
a.sort()

s=0

for i in range(len(a)-1):
    if a[i]==a[i+1]:
        print("YES")
        s=s+1
        
if s == 0: print("NO")

Failing test case input:
6
1 2 5 -1 2 0

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
a.sort()

s=0

for i in range(len(a)-1):
    
    
    if a[i]==a[i+1]:
        print("NO")
        s=s+1
        break
        
if s == 0: print("YES")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=set(map(int,input().split()))
print("YES") if len(a)==n else print("No")

Failing test case input:
5
7 11 -1 -1 3

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
a=set(map(int,input().split()))
print("YES") if len(a)==n else print("NO")
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
if n==len(set(a)):
    print('Yes')
else:print('No')

Failing test case input:
5
3 9 0 -1 2

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
s=list(map(int,input().split()))
print('YES' if len(set(s))==n else 'NO')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

ans = {}
a = list(map(int, input().split()))
flag = True
for i in range(n):
  if n in ans:
    flag = False
    break
  else:
    ans[a[i]] = 1
    
if flag:
  print("YES")
else:
  print("NO")

Failing test case input:
6
4 1 1 2 2 0

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
n = int(input())

ans = {}
a = list(map(int, input().split()))
flag = True
for i in range(n):
  if a[i] in ans:
    flag = False
    break
  else:
    ans[a[i]] = 1
    
if flag:
  print("YES")
else:
  print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

def main():
    N, *A = read().split()
    for a in A:
        if A.count(a)==1:
            continue
        else:
            result = 'NO'
            return result
    else:
        result = 'Yes'
    return result

if __name__ == '__main__':
    print(main())



Failing test case input:
2
00000001 01000000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

def main():
    N, *A = map(int,read().split())
    d = defaultdict(int)
    for a in A:
        d[a] +=1
    if len(A)==len(d):
        result = 'YES'
    else:
        result = 'NO'

    return result

if __name__ == '__main__':
    print(main())

Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=0
for x in range(N-1):
  if A[x]==A[x+1]:
    ans += 1
    break
if ans==0:
  print("Yes")
else:
  print("No")

Failing test case input:
6
6 1 1 0 2 0

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=0
for x in range(N-1):
  if A[x]==A[x+1]:
    ans += 1
    break
if ans==0:
  print("YES")
else:
  print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
List = list(map(int, input().split()))
for i in range(n - 1):
    for j in range(n - i - 1):
        if List[i] == List[i + j]:
            print('NO')
            exit()

print('YES')

Failing test case input:
2
00001111 01010000

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
n = int(input())
List = list(map(int, input().split()))
Sorted = sorted(List)
ans = 'YES'
for i in range(n - 1):
    if Sorted[i] == Sorted[i + 1]:
        ans = 'NO'
        break

print(ans)
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    c = collections.Counter(A)
    C = max(c)
    ans = c.get(C)
    if ans > 1 :
        print('NO')
    else:
        print('YES')
resolve()

Failing test case input:
5
1 4 2 -1 -1

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
import  collections
def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    c = collections.Counter(A)
    C = max(c.values())
    if C > 1 :
        print('NO')
    else:
        print('YES')
resolve()

Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input()) 
A=list(map(int,input().split()))
a=[]
for i in range(N):   
    if A[i] in a:
        print("NO")
    else:
        a.append(A[i])
        if i==N-1:print('YES')

Failing test case input:
6
1 3 4 -2 4 0

Expected output:
NO


Actual output:
NO
YES


Fixed submission (verdict: Accepted):
N=int(input()) 
A=sorted(list(map(int,input().split())))
a=[]
for i in range(N-1):   
    if A[i]==A[i+1]:
        print("NO") 

        break
    elif i==N-2:print("YES")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter


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

if [1 ** N] == Counter(A).values():
    print("Yes")
else:
    print("No")

Failing test case input:
5
4 11 0 -1 3

Expected output:
YES


Actual output:
No


Fixed submission (verdict: Accepted):
from collections import Counter


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

if [1] * N == list(Counter(A).values()):
    print("YES")
else:
    print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(x) for x in input().split()]
if len(A) != len(set(A)):
    print("NO")
else:
    if A.count(N) > 0:
        print("YES")
    else:
        print("NO")

Failing test case input:
2
11000101 00001000

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(x) for x in input().split()]
if len(A) != len(set(A)):
    print("NO")
else:
    print("YES")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
list=[]
for i in a:
	if a in list:
		print("NO")
		break
	list.append(a)
else:
	print("YES")


Failing test case input:
5
2 4 0 3 5

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
a.sort()
for i in range(n-1):
	if a[i]==a[i+1]:
		print("NO")
		break
else:
	print("YES")
Problem: p02779
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
s=list(map(int,input().split()))




from collections import Counter
S=Counter(s)

if S.most_common(1)[0][1]==1:
    print("Yes")
else:
    print("No")




Failing test case input:
2
00001111 11010100

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
N=int(input())
s=list(map(int,input().split()))




from collections import Counter
S=Counter(s)

if S.most_common(1)[0][1]==1:
    print("YES")
else:
    print("NO")

Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
print(['No','Yes'][int(len(set(A))==len(A))])

Failing test case input:
6
6 3 2 2 2 -1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
print(['NO','YES'][int(len(set(A))==len(A))])

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a = map(int, input().lower().split())
if list(a) == list(set(a)):
  	print("YES")
else:
  	print("NO")


Failing test case input:
5
2 9 1 3 5

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
s = input()
a = map(int, input().lower().split())

if int(s) == len(set(a)):
  print("YES")
else:
  print("NO")

Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
from collections import Counter
input=sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))

c=Counter(a)
if n==c:
  print('YES')
  
else:
  print('NO')

Failing test case input:
2
00001010 11010100

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
import sys
from collections import Counter
input=sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))

c=len(Counter(a))
if n==c:
  print('YES')
  
else:
  print('NO')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
y = map(int, input().split())
k = list(y)
t = len(set(k))
q = len(k)

if q > t:
    print("No")
else:
    print("Yes")

Failing test case input:
2
11010100 10101001

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = input()
y = map(int, input().split())
k = list(y)
t = len(set(k))
q = len(k)

if q > t:
    print("NO")
else:
    print("YES")

Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
c=sorted(list(map(int, input().split())))
ans = 0

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

if ans == 0:
    print('Yes')
if ans != 0:
    print('No')

Failing test case input:
2
10000001 00001000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
c=sorted(list(map(int, input().split())))
ans = 0

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

if ans == 0:
    print('YES')
if ans != 0:
    print('NO')
Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
N = int(input())
A = list(map(int,input().split()))

K = collections.Counter(A)
B = len(K)

if N == len(K):
    print("Yes")
else:
    print("No")

Failing test case input:
2
00010101 01010000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
import collections
N = int(input())
A = list(map(int,input().split()))

K = collections.Counter(A)
B = len(K)

if N == len(K):
    print("YES")
else:
    print("NO")

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

d = {x:0 for x in A}
for x in A:
    d[x] += 1

if max(d.values()) >= 2:
    print('No')
else:
    print('Yes')

Failing test case input:
6
1 3 5 -1 4 1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))

d = {x:0 for x in A}
for x in A:
    d[x] += 1

if max(d.values()) >= 2:
    print('NO')
else:
    print('YES')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = set( map(int,input().split()) )
if len(a)==n :
    print('Yes')
else :
    print('No')   

Failing test case input:
2
00001110 11010100

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
a = set( map(int,input().split()) )
if len(a)==n :
    print('YES')
else :
    print('NO')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=sorted(list(map(int,input().split())))
unt=False
for i in range(0,n-1):
    if a[i]==a[i+1]:
        unt=True
if unt:
    print('No')
else:
    print('Yes')

Failing test case input:
2
00000001 01000000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
a=sorted(list(map(int,input().split())))
unt=False
for i in range(0,n-1):
    if a[i]==a[i+1]:
        unt=True
if unt:
    print('NO')
else:
    print('YES')

Problem: p02779
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n = int(input())
A = list(map(int,input().split()))
A.sort()
for i in range(n-1):
	if A[i]==A[i+1]:
		print("No")
		sys.exit()
print("Yes")

Failing test case input:
2
11000100 10101000

Expected output:
YES


Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
n = int(input())
A = list(map(int,input().split()))
A.sort()
for i in range(n-1):
	if A[i]==A[i+1]:
		print("NO")
		sys.exit()
print("YES")

Problem: p02779
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
A = list(map(int, input().split()))

A = list(set(A))

if len(A) == n:
    print('Yes')
else :
    print('No')

Failing test case input:
6
6 1 1 2 2 0

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
A = list(map(int, input().split()))

A = list(set(A))

if len(A) == n:
    print('YES')
else :
    print('NO')
Problem: p02294
Buggy submission (Python3, verdict: Wrong Answer):
from sys import stdin
readline = stdin.readline


def main():
    q = int(readline())
    for i in range(q):
        xy = map(int, readline().split())
        p0, p1, p2, p3 = [x + y * 1j for x, y in zip(*[xy] * 2)]
        print(1 if is_intersected_ls(p0, p1, p2, p3) else 0)


def is_intersected_ls(a1, a2, b1, b2):
    eps = 0
    return (cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < eps) and (cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < eps)

def cross(a, b):
    return a.real * b.imag - a.imag * b.real
main()

Failing test case input:
3
0 0 3 0 1 1 2 -1
0 0 3 0 3 1 3 -1
0 0 3 0 3 -2 5 0

Expected output:
1
1
0

Actual output:
1
0
0


Fixed submission (verdict: Accepted):
from sys import stdin
readline = stdin.readline


def main():
    q = int(readline())
    for i in range(q):
        xy = map(int, readline().split())
        p0, p1, p2, p3 = [x + y * 1j for x, y in zip(*[xy] * 2)]
        print(1 if is_intersected_ls(p0, p1, p2, p3) else 0)


def is_intersected_ls(a1, a2, b1, b2):
    eps = 0
    if max(a1.real, a2.real) < min(b1.real, b2.real)\
      or max(b1.real, b2.real) < min(a1.real, a2.real)\
      or max(a1.imag, a2.imag) < min(b1.imag, b2.imag)\
      or max(b1.imag, b2.imag) < min(a1.imag, a2.imag):
        return False

    
    
    
    
    return (cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) <= eps)\
        and (cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) <= eps)


def cross(a, b):
    return a.real * b.imag - a.imag * b.real
main()
Problem: p03565
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
from pprint import pprint

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

len_s = len(s)
len_t = len(t)


for i in range(0, len_s - len_t + 1):
    flag = True
    for j in range(len_t):
        if flag == False:
            continue
        
        if s[i+j] == "?" or s[i+j] == t[j]:
            continue
        flag = False
        break
    if flag:
        ans = ""
        for s_i in s[0:i]:
            if s_i == "?":
                ans += "a"
            else:
                ans += s_i
        print(ans + t)
        sys.exit()

print("UNRESTORABLE")

Failing test case input:
d>>>???q
a`a

Expected output:
d>>>a`aq


Actual output:
d>>>a`a


Fixed submission (verdict: Accepted):
import sys
from pprint import pprint

s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()

len_s = len(s)
len_t = len(t)


cand = []
for i in range(0, len_s - len_t + 1):
    a = list(s)
    flag = True
    for j in range(len_t):
        
        if s[i+j] == "?":
            a[i+j] = t[j]
        elif s[i+j] != t[j]:
            flag = False
            break
    if flag:
        cand.append(a)

if cand:
    print("".join(cand[-1]).replace("?", "a"))
    sys.exit()
else:
    print("UNRESTORABLE")

Problem: p03565
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
S = input()
T = input()
ans = 'UNRESTORABLE'

if len(S) < len(T):
    print(ans)
    sys.exit()

if S.count(T) != 0:
    S = S.replace('?', 'a')
    print(S)
    sys.exit()

for i in range(len(S) - len(T) + 1):
    tmp = True
    s = i
    e = i + len(T)
    for j in range(len(T)):
        if S[i + j] != '?' and\
            S[i + j] != T[j]:
            tmp = False
            break

    if tmp:
        break
    else:
        s = -1
        e = -1


else:
    ans = S.replace('?', 'a')
    ans = ans[:s] + T + ans[e:]
    print(ans)


Failing test case input:
@tc??@?
endcr

Expected output:
UNRESTORABLE


Actual output:
@tcaa@endcra


Fixed submission (verdict: Accepted):
import sys
S = input()
T = input()
ans = 'UNRESTORABLE'

if len(S) < len(T):
    print(ans)
    sys.exit()

if len(S) < len(T):
    print(ans)
    sys.exit()

tmp = True
anss = -1
anse = -1
for i in range(len(S) - len(T) + 1):
    tmp = True
    s = i
    e = i + len(T)
    for j in range(len(T)):
        if S[i + j] != '?' and\
            S[i + j] != T[j]:
            tmp = False
            break

    if tmp:
        anss = i
        anse = i + len(T)

if anss == -1:
    print(ans)

else:
    ans = S.replace('?', 'a')
    ans = ans[:anss] + T + ans[anse:]
    print(ans)
Problem: p03565
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
T = input()

found = []
for i in range(len(S) - len(T) + 1):
    for cs,ct in zip(S[i:],T):
        if cs != '?' and cs != ct:
            break
    else:
        found.append(i)

if not found:
    print('UNRESTORABLE')
    exit()

ans = 'z' * 51
for i in found:
    tmp = S[:i] + T + S[i+len(T):]
    
print(tmp)


Failing test case input:
>q???d?>
_ba

Expected output:
>q_bada>


Actual output:
>q_bad?>


Fixed submission (verdict: Accepted):
S = input()
T = input()

found = []
for i in range(len(S) - len(T) + 1):
    for cs,ct in zip(S[i:],T):
        if cs != '?' and cs != ct:
            break
    else:
        found.append(i)

if not found:
    print('UNRESTORABLE')
    exit()

ans = 'z' * 51
for i in found:
    tmp = S[:i] + T + S[i+len(T):]
    ans = min(ans, tmp.replace('?', 'a'))
print(ans)

Problem: p03565
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S_=input()
T=input()
N=len(S_)
M=len(T)
posi=[]

for i in range(N-M+1):
  flag=True
  for j in range(i,i+M):
    if S_[j]!=T[j-i] and S_[j]!="?":
      flag=False
  if flag==True:
    posi.append(S_[:i]+T+S_[i+M+1:])
    
if posi==[]:
  print("UNRESTORABLE")
else:
  ans_list=[]
  for item in posi:
    ans=""
    for str in item:
      if str=="?":
        ans += "a"
      else:
        ans += str
    ans_list.append(ans)
  ans_list.sort()
  print(ans_list[0])

Failing test case input:
d>>>???q
a`a

Expected output:
d>>>a`aq


Actual output:
d>>>a`a


Fixed submission (verdict: Accepted):
S_=input()
T=input()
N=len(S_)
M=len(T)
posi=[]

for i in range(N-M+1):
  flag=True
  for j in range(i,i+M):
    if S_[j]!=T[j-i] and S_[j]!="?":
      flag=False
  if flag==True:
    posi.append(S_[:i]+T+S_[i+M:])

    
if posi==[]:
  print("UNRESTORABLE")
else:
  ans_list=[]
  for item in posi:
    ans=""
    for str in item:
      if str=="?":
        ans += "a"
      else:
        ans += str
    ans_list.append(ans)
  ans_list.sort()
  print(ans_list[0])
Problem: p03565
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
T = input()

ls = len(S)
lt = len(T)

if ls < lt:
    print('UNRESTORABLE')
    exit()

diff = ls - lt

candidates = []
for i in range(diff+1):
    string = S[i:i+lt]

    for j in range(lt):
        if string[j] == T[j] or string[j] == '?':
            continue
        else:
            break

    else:
        candidate = S[:i] + T
        candidate = candidate.replace('?', 'a')
        candidates.append(candidate)

if not candidates:
    print('UNRESTORABLE')
    exit()

ans = min(candidates)
print(ans)


Failing test case input:
d>>>???q
a`a

Expected output:
d>>>a`aq


Actual output:
d>>>a`a


Fixed submission (verdict: Accepted):
S = input()
T = input()

ls = len(S)
lt = len(T)

if ls < lt:
    print('UNRESTORABLE')
    exit()

diff = ls - lt

candidates = []
for i in range(diff+1):
    string = S[i:i+lt]

    for j in range(lt):
        if string[j] == T[j] or string[j] == '?':
            continue
        else:
            break

    else:
        candidate = S[:i] + T + S[i+lt:]
        candidate = candidate.replace('?', 'a')
        candidates.append(candidate)

if not candidates:
    print('UNRESTORABLE')
    exit()

ans = min(candidates)
print(ans)

Problem: p03565
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
T = input()

rs = list(S[::-1])
rt = list(T[::-1])

idx = None
if len(rs) >= len(rt):
  for i in range(len(rs)-len(rt)):
    flg = True
    for j in range(len(rt)):
      si = i + j
      if rs[si] != rt[j] and rs[si] != '?':
        flg = False
    if flg:
      idx = i
    break

if idx is None:
  print('UNRESTORABLE')
else:
  for i in range(idx, idx+len(rt)):
    rs[i] = rt[i-idx]
  for i in range(len(rs)):
    if rs[i] == '?':
      rs[i] = 'a'
  print("".join(rs[::-1]))


Failing test case input:
d>>>???q
a`a

Expected output:
d>>>a`aq


Actual output:
UNRESTORABLE


Fixed submission (verdict: Accepted):
S = input()
T = input()

rs = list(S[::-1])
rt = list(T[::-1])

idx = None
for i in range(len(rs)-len(rt)+1):
  flg = True
  for j in range(len(rt)):
    si = i + j
    if rs[si] != rt[j] and rs[si] != '?':
      flg = False
  if flg:
    idx = i
    break

if idx is None:
  print('UNRESTORABLE')
else:
  for i in range(idx, idx+len(rt)):
    rs[i] = rt[i-idx]
  for i in range(len(rs)):
    if rs[i] == '?':
      rs[i] = 'a'
  print("".join(rs[::-1]))