ZhenlongDai/ACPR huggingface dataset:
Problem: p03456
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):

a,b = map(int,input().split())
x = a*len(str(b))+b
ans = 'No'
for y in range(1000):
    if x==y*y:
        ans = 'Yes'
        break
print(ans)

Failing test case input:
001 000

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):

a,b = map(int,input().split())
x = a*(10**len(str(b)))+b
ans = 'No'
for y in range(1000):
    if x==y*y:
        ans = 'Yes'
        break
print(ans)

Problem: p03456
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
a,b=input().split()
c=a+b
d=math.sqrt(float(c))

if d*d==int(c):
    print('Yes')
else:
    print('No')

Failing test case input:
101 010

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import math
a,b=input().split()
c=a+b
d=math.floor(math.sqrt(float(c)))

if int(d*d)==int(c):
    print('Yes')
else:
    print('No')

Problem: p03456
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b = input().split()
c = int(a+b)

for i in range(1, 101):
    if i ** 2 == c:
        print("Yes")
        exit()

print("No")


Failing test case input:
000 000

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
num = str(a) + str(b)
num = int(num)

for i in range(200000):
    if i ** 2 == num:
        print("Yes")
        exit()

print("No")

Problem: p03456
Buggy submission (Python (3.8.2), verdict: Wrong Answer):



import math
a, b = map(int, input().split())

connected_num = int(str(a) + str(b))
c = int(math.sqrt(connected_num))

print(connected_num)
if connected_num == c*c:
  print("Yes")
else:
  print("No")

Failing test case input:
11 84

Expected output:
No


Actual output:
1184
No


Fixed submission (verdict: Accepted):



import math
a, b = map(int, input().split())

connected_num = int(str(a) + str(b))
c = int(math.sqrt(connected_num))

if connected_num == c*c:
  print("Yes")
else:
  print("No")

Problem: p03456
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
print("NYoe s"[int(input().replace(" ",""))**0.5%1<1::2])

Failing test case input:
001 101

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
print("NYoe s"[int(input().replace(" ",""))**0.5%1==0::2])

Problem: p03456
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b = input().split()
x = int(a+b)
no = 0
for i in range(1, 101):
    if x == i**2:
        print("Yes")
    else:
        no += 1
        if no == 100:
            print("No")

Failing test case input:
000 000

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
a, b = input().split()
x = int(a+b)
no = 0
for i in range(1000):
    if x == i**2:
        print("Yes")
    else:
        no += 1
        if no == 1000:
            print("No")
Problem: p03456
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b = input().split()
n = int(a + b)
if n == n**0.5 * n**0.5:
    print("Yes")
else:
    print("No")

Failing test case input:
13 87

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
a, b = input().split()
n = int(a + b)
if (n**0.5).is_integer():
    print("Yes")
else:
    print("No")

Problem: p03456
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

a, b = map(str, input().split())
c = a + b
d = math.sqrt(int(c))
if isinstance(d, int):
  print("Yes")
else:
  print("No")



Failing test case input:
000 100

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import math

a, b = map(str, input().split())
c = a + b
d = math.sqrt(int(c))
if d % 1 == 0:
  print("Yes")
else:
  print("No")

Problem: p03456
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
L = []
a,b = map(str,input().split())
L.append(a)
L.append(b)
c = int(L[0]+L[1])
K = []
for i in range(1,101) :
    k = i**2
    K.append(k)
if c in K :
    print("Yes")
else :
    print("No")
 


Failing test case input:
000 000

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
L = []
a,b = map(str,input().split())
L.append(a)
L.append(b)
c = int(L[0]+L[1])
K = []
if int(c**(1/2))**2 == c :
    print("Yes")
else :
    print("No")

Problem: p03456
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b = input().split()
c = a+b
c = int(c)
for i in range (1,101):
  if i**2 == c:
    print("Yes")
    exit()
print("No")

Failing test case input:
000 000

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
a,b = input().split()
c = a+b
c = int(c)
for i in range (1000):
  if i**2 == c:
    print("Yes")
    exit()
print("No")
Problem: p03892
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = map(int, input().split())

def gcd(u,v):
  while v:
    u,v = v,u%v
  return u

s = c-a
t = d-b
u = gcd(s,t)
s 
t 
print(u*(s+t-1))

Failing test case input:
32 16 -1 6

Expected output:
42


Actual output:
44


Fixed submission (verdict: Accepted):
a,b,c,d = map(int, input().split())
def gcd(u,v):
  while v: u,v = v,u%v
  return u
s = abs(c-a)
t = abs(d-b)
u = gcd(s,t)
print(u*((s+t)

Problem: p03892
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def gcd(a,b):
	if b==0:return a
	return gcd(b,a%b)
a,b,c,d=map(int,input().split())
c-=a
d-=b
g=gcd(max(c,d),min(c,d))
j=int(c/g)
k=int(d/g)
print((j+k-1)*g)

Failing test case input:
47 16 -1 5

Expected output:
58


Actual output:
-58


Fixed submission (verdict: Accepted):
def gcd(a,b):
	if b==0:return a
	return gcd(b,a%b)
a,b,c,d=map(int,input().split())
c=abs(c-a)
d=abs(d-b)
g=gcd(max(c,d),min(c,d))
j=int(c/g)
k=int(d/g)
print((j+k-1)*g)
Problem: p03712
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
H,W = map(int,input().split())
List = []
for _ in range(H):
  S = input()
  List.append(S)
print('*'*(W+2))
for i in range(H):
  print('*'.strip(),end='')
  print(List[i].strip(),end='')
  print('*')
print('*'*(W+2))

Failing test case input:
2 6
bc`
cqa

Expected output:
########
#bc`#
#cqa#
########


Actual output:
********
*bc`*
*cqa*
********


Fixed submission (verdict: Accepted):
H,W = map(int,input().split())
List = []
for _ in range(H):
  S = input()
  List.append(S)
print('
for i in range(H):
  print('
  print(List[i].strip(),end='')
  print('
print('

Problem: p03712
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
h,w = map(int,input().split())
l=[str(input()) for i in range(h)]
p="*"
print(p*(w+2))
for j in l:
    print(p+j+p)
print(p*(w+2))

Failing test case input:
2 0
fba
brc

Expected output:
##
#fba#
#brc#
##


Actual output:
**
*fba*
*brc*
**


Fixed submission (verdict: Accepted):
h,w = map(int,input().split())
l=[str(input()) for i in range(h)]
p="
print(p*(w+2))
for j in l:
    print(p+j+p)
print(p*(w+2))

Problem: p03712
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
h, m = map(int, input().split())
C = [input() for i in range(h)]

hana = '*' * (m + 2)
print(hana)
for i in range(h):
    print('*' + C[i] + '*')
print(hana)


Failing test case input:
2 0
fba
brc

Expected output:
##
#fba#
#brc#
##


Actual output:
**
*fba*
*brc*
**


Fixed submission (verdict: Accepted):
h, m = map(int, input().split())
C = [input() for i in range(h)]

hana = '
print(hana)
for i in range(h):
    print('
print(hana)

Problem: p03712
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
L = []
L.append("*"*(m+2))
for i in range(n):
    L.append("*"+input()+"*")
L.append("*"*(m+2))
for i in range(len(L)):
    print(L[i])


Failing test case input:
1 3
y

Expected output:
#####
#y#
#####


Actual output:
*****
*y*
*****


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
L = []
L.append("
for i in range(n):
    L.append("
L.append("
for i in range(len(L)):
    print(L[i])

Problem: p03712
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b=map(int,input().split())
s=[]
for i in range(a):
    s.append(input())
print("*"*(b+2))
for i in range(a):
    print("*",end="")
    print(s[i],end="")
    print("*")
print("*"*(b+2))

Failing test case input:
1 3
w

Expected output:
#####
#w#
#####


Actual output:
*****
*w*
*****


Fixed submission (verdict: Accepted):
a,b=map(int,input().split())
s=[]
for i in range(a):
    s.append(input())
print("
for i in range(a):
    print("
    print(s[i],end="")
    print("
print("

Problem: p03712
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
h,w=map(int, input().split())
ar=[input() for _ in range(0,h)]
print("*"*w+"**")
for _ in ar:
    print("*"+_+"*")
print("*"*w+"**")
    

Failing test case input:
1 3
{

Expected output:
#####
#{#
#####


Actual output:
*****
*{*
*****


Fixed submission (verdict: Accepted):
h,w=map(int, input().split())
ar=[input() for _ in range(0,h)]
print("
for _ in ar:
    print("
print("
Problem: p03712
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
h,w=map(int, input().split())
print("*"*w+"**")
for i in range(0, h):
    print("*"+input()+"*")
print("*"*w+"**")
    

Failing test case input:
1 -1
{

Expected output:
#
#{#
#


Actual output:
**
*{*
**


Fixed submission (verdict: Accepted):
h,w=map(int, input().split())
ar=[input() for _ in range(0,h)]
print("
for _ in ar:
    print("
print("

Problem: p03712
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
H, W = list(map(int, input().split()))

for i in range(H + 2):
    if i == 0 or i == (H + 1):
        print("*" * (W + 2))
    else:
        print("*{}*".format("".join(list(map(str, input())))))


Failing test case input:
-5 10
w

Expected output:
############
############


Actual output:
no output


Fixed submission (verdict: Accepted):
H, W = list(map(int, input().split()))

for i in range(H + 2):
    if i == 0 or i == (H + 1):
        print("
    else:
        print("

Problem: p03712
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
H, W = map(int, input().split())
a = [input() for i in range(H)]

print('*' * (W + 2))
for ai in a:
    print('*{}*'.format(ai))
print('*' * (W + 2))


Failing test case input:
1 4
|

Expected output:
######
#|#
######


Actual output:
******
*|*
******


Fixed submission (verdict: Accepted):
H, W = map(int, input().split())
a = [input() for i in range(H)]

print('
for ai in a:
    print('
print('

Problem: p03712
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
H, W = map(int,input().split())
A = [input() for _ in range(H)]

result = []
for a in A:
  result.append('*' + a +'*')
waku = '*' * (W+2)
result.insert(0,waku)
result.insert(len(A)+1,waku)
for r in result:
  print(r)

Failing test case input:
1 2
x

Expected output:
####
#x#
####


Actual output:
****
*x*
****


Fixed submission (verdict: Accepted):
H, W = map(int,input().split())
A = [input() for _ in range(H)]

result = []
for a in A:
  result.append('
waku = '
result.insert(0,waku)
result.insert(len(A)+1,waku)
for r in result:
  print(r)
Problem: p03643
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
print("ABC", input())

Failing test case input:
-75

Expected output:
ABC-75


Actual output:
ABC -75


Fixed submission (verdict: Accepted):
print("ABC"+ input())

Problem: p03643
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input()
print("ABC"+"a")

Failing test case input:
403

Expected output:
ABC403


Actual output:
ABCa


Fixed submission (verdict: Accepted):
a = input()
print("ABC"+a)

Problem: p03643
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
print("ABC",input())

Failing test case input:
-84

Expected output:
ABC-84


Actual output:
ABC -84


Fixed submission (verdict: Accepted):
print("ABC"+input())

Problem: p03643
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=str(input())
print("ABC",n)

Failing test case input:
-41

Expected output:
ABC-41


Actual output:
ABC -41


Fixed submission (verdict: Accepted):
n=input()
print("ABC"+n)

Problem: p03643
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=input()
print ('ABC',n)

Failing test case input:
542

Expected output:
ABC542


Actual output:
ABC 542


Fixed submission (verdict: Accepted):
n=str(input())
print ('ABC'+n)

Problem: p03643
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
print('ABC'.format(int(input())))

Failing test case input:
-111

Expected output:
ABC-111


Actual output:
ABC


Fixed submission (verdict: Accepted):
print('ABC{}'.format(input()))

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

print("ABC"+"n")

Failing test case input:
186

Expected output:
ABC186


Actual output:
ABCn


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

print("ABC"+n)

Problem: p03643
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
"ABC"+input()

Failing test case input:
186

Expected output:
ABC186


Actual output:
no output


Fixed submission (verdict: Accepted):
print("ABC"+input())

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

print("ABC"+"n")

Failing test case input:
542

Expected output:
ABC542


Actual output:
ABCn


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

print("ABC"+n)

Problem: p03643
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
n = stdin.readline().rstrip()
print('A'+n)

Failing test case input:
789

Expected output:
ABC789


Actual output:
A789


Fixed submission (verdict: Accepted):
from sys import stdin
n = stdin.readline().rstrip()
print('ABC'+n)
Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):
word = input().lower()
count = 0
while True:
    line = input()
    if line == "END_OF_TEXT":
        break
    print(line.lower())
    words = line.lower().split()
    for w in words:
        if w == word:
            count += 1
print(count)

Failing test case input:
comquter
Nurttres computer scienuists and highlx-skilled computer engineers
whp will create and tiolpxe "knowledge" for the enw dr.a
Provider an sutotanding ctmpuoer environment.
END_OF_TEXT

Expected output:
0


Actual output:
nurttres computer scienuists and highlx-skilled computer engineers
whp will create and tiolpxe "knowledge" for the enw dr.a
provider an sutotanding ctmpuoer environment.
0


Fixed submission (verdict: Accepted):
word = input().lower()
count = 0
while True:
    line = input()
    if line == "END_OF_TEXT":
        break
    words = line.lower().split()
    for w in words:
        if w == word:
            count += 1
print(count)

Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):
n = 0
T=""
s= input()
while True:
    t=input()
    T += t + " "
    if T.count("END_OF_TEXT")>0:
        break

TL = T.split(" ")
print (TL)
for i in TL:
    if i == str(s):
        n +=1
    else:
        pass
print (n)
        

Failing test case input:
comquter
Nurtures computer scientists and highly-skilked computer engineers
who wilk create and tiolpxe "knowledge" for the enw era.
Provides an sutotanding computer environment.
END_OF_TEXT

Expected output:
0


Actual output:
['Nurtures', 'computer', 'scientists', 'and', 'highly-skilked', 'computer', 'engineers', 'who', 'wilk', 'create', 'and', 'tiolpxe', '"knowledge"', 'for', 'the', 'enw', 'era.', 'Provides', 'an', 'sutotanding', 'computer', 'environment.', 'END_OF_TEXT', '']
0


Fixed submission (verdict: Accepted):
n = 0
T=""
s= input().lower()
while True:
    t=input()
    T += t + " "
    if T.count("END_OF_TEXT")>0:
        break

TL = T.split(" ")

for i in TL:
    i = i.replace('"','')
    i= i.replace(".","")
    if i.lower() == str(s):
        n += 1
    else:
        pass
print (n)

Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):
y = input().lower()
cnt = 0
s=""
while True:
    x = input().lower()
    if x == "end_of_text":
        break
    s += x
    for i in x:
        if i == y:
            cnt += 1
print(cnt)

Failing test case input:
computer
Nurtures computer scientists dna highly-skilled comqutes engineers
who will create and exqloit "knowledge" for the enw era.
Provides an outstanding computer environment.
END_OF_TEXT

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
W = input()
num = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break
    for word in line.split():
        if word.lower() == W.lower():
            num += 1
print(num)
Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):
W = input()
count = 0
T = input().upper()

while T != 'END_OF_TEXT':
    for i in T.split():
        if i == W:
            count += 1
    T = input().upper()
    

print(count)

Failing test case input:
computer
serutruN computer rcientists and highly-skilled computer engineers
who will create and exploit "knowledge" for the new era-
Provides n` outstanding computer environment.
END_OF_TEXT

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
W = input()
count = 0



while True:
    T = input()
    if T == 'END_OF_TEXT':
        break

    for i in T.lower().split():
        if W == i:
            count += 1
    
    

print(count)

Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):
from collections import Counter
W=input().lower()
count=0
while True:
    line=input().split()
    if line==["END_OF_TEXT"]:
        break
    print(line)
    count+=Counter(map(lambda x:x.lower(),line))[W]
print(count)

Failing test case input:
comquter
serutruN computer scitntisfs apd highlx-skilled computer engineers
who lliw create and siolpxe "knowledge" for the enw era.
Provides an sutotanding ctmpuoer envjronment.
END_OF_TEXT

Expected output:
0


Actual output:
['serutruN', 'computer', 'scitntisfs', 'apd', 'highlx-skilled', 'computer', 'engineers']
['who', 'lliw', 'create', 'and', 'siolpxe', '"knowledge"', 'for', 'the', 'enw', 'era.']
['Provides', 'an', 'sutotanding', 'ctmpuoer', 'envjronment.']
0


Fixed submission (verdict: Accepted):
from collections import Counter
W=input().lower()
count=0
while True:
    line=input().split()
    if line==["END_OF_TEXT"]:
        break
    count+=Counter(map(lambda x:x.lower(),line))[W]
print(count)

Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):
import fileinput
W = input()
cnt = 0
for line in fileinput.input():
    if line.rstrip() == 'END_OF_TEXT':
        break
    line = ''.join(line.split())
    print(line)
    cnt += line.count(W)
print(cnt)



Failing test case input:
comquter
Nurtures computer scientists and highlx-skilled computer engineers
who will create and tiolpxe "knowledge" for the enw era.
Provides an sutotanding computer environment.
END_OF_TEXT

Expected output:
0


Actual output:
Nurturescomputerscientistsandhighlx-skilledcomputerengineers
whowillcreateandtiolpxe"knowledge"fortheenwera.
Providesansutotandingcomputerenvironment.
0


Fixed submission (verdict: Accepted):
import fileinput
W = input()
cnt = 0
for T in fileinput.input():
    if T.rstrip() =='END_OF_TEXT':
        break

    T = T.lower().split()
    cnt += T.count(W)
    
print(cnt)
Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):
W = input()
count = 0
while True:
    T = input()
    if T == "END_OF_TEXT":
        break
    if W in T:
        count += 1
    print(count)

    
    

Failing test case input:
comquter
serutruN computer scientists aod highlx-skilled computer engineesr
who lliw create and tiolpxe "knowledge" for the enw era.
Provides an sutptandiog ctmpuoer environment.
END_OF_TEXT

Expected output:
0


Actual output:
0
0
0


Fixed submission (verdict: Accepted):
W = input().lower()
count = 0
while True:
    T = input()
    if T == "END_OF_TEXT":
        break
    count += T.lower().split(" ").count(W)
print(count)

Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):
import fileinput
W = input()
cnt = 0
for line in fileinput.input():
    if line.rstrip() == 'END_OF_TEXT':
        break
    line = ''.join(line.lower().split())
    print(line)
    cnt += line.count(W)
print(cnt)


Failing test case input:
comquter
serutruN computer scitntisfs aod highlx-skilled computer engineers
who lliw create and tiolpxe "knowledge" for the enw era.
Provides an sutotanding ctmpuoer environment.
END_OF_TEXT

Expected output:
0


Actual output:
serutruncomputerscitntisfsaodhighlx-skilledcomputerengineers
wholliwcreateandtiolpxe"knowledge"fortheenwera.
providesansutotandingctmpuoerenvironment.
0


Fixed submission (verdict: Accepted):
import fileinput
W = input()
cnt = 0
for T in fileinput.input():
    if T.rstrip() =='END_OF_TEXT':
        break

    T = T.lower().split()
    cnt += T.count(W)
    
print(cnt)

Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):


contents = []
counter = 0

word = input()

while True:
    text = input()
    if text == "END_OF_TEXT":
        break
    textWords = text.split()
    contents.append(textWords)

for x in contents:
    for y in textWords:
        if y == word:
            counter += 1

print(counter)

Failing test case input:
computer
Nvrtures retupmoc scientists and highly-skilled computer engineers
who will create and tiolpxe "knowledge" for the enw .are
Provides an outstanding computer environment.
END_OF_TEXT

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):


contents = []
counter = 0

word = input()

while True:
    text = input()
    if text == "END_OF_TEXT":
        break
    textWords = text.split()
    contents.append(textWords)

for x in contents:
    for y in x:
        if y.lower() == word:
            counter += 1

print(counter)
Problem: p02419
Buggy submission (Python3, verdict: Wrong Answer):


import sys
import re


def main():
    w = sys.stdin.readline().lower()
    t = str()

    for line in sys.stdin:
        if line == 'END_OF_TEXT':
            break
        t += line.lower()

    print(len(re.findall((w), t)))


if __name__ == '__main__':
    main()

Failing test case input:
computer
serutruN computer rcientists and highly-skilled computer engineers
who wiml create and exploit "knowledge" for the new era-
Provides n` outstanding computer environment.
END_OF_TEXT

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):


import sys


def main():
    w = sys.stdin.readline().lower().strip('\n')
    s = 0

    for line in sys.stdin:
        if line == 'END_OF_TEXT':
            break
        s += line.lower().split().count(w)

    print(s)


if __name__ == '__main__':
    main()
Problem: p03957
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a = s.find('C')

if a == -1:
    print("No")
else:
    if s[a:].find('F') == -1:
        print("Yes")

Failing test case input:
FCD

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
s = input()
a = s.find('C')

if a == -1:
    print("No")
else:
    if s[a:].find('F') == -1:
        print("No")
    else: print("Yes")

Problem: p03957
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
a = s.find("C")
b = s.rfind("F")

if 0 < a < b:
    print("Yes")
else:
    print("No")

Failing test case input:
CODDFESTIVAL

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
s = input()
a = s.find("C")
b = s.rfind("F")

if -1 < a < b:
    print("Yes")
else:
    print("No")

Problem: p03957
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
t=0
for i in range(len(s)):
    if s[i]=='C':
        t=i
    if s[i]=='F' and i>t:
        print('Yes')
        exit()
print('No')

Failing test case input:
DF

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
s=input()
t=100
for i in range(len(s)):
    if s[i]=='C':
        t=i
    if s[i]=='F' and i>t:
        print('Yes')
        exit()
print('No')

Problem: p03957
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s= input()
a=0
b=0
for i in range(len(s)):
  if s[i]=='C':
    a += i
  elif s[i]=='F':
    b += i
if a<b:
  print("Yes")
else:
  print("No")

Failing test case input:
HEFSLEADSOAV

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
s= input()
a=-1
b=-1
for i in range(len(s)):
  if s[i]=='C':
    a = i
  elif s[i]=='F':
    b = i
if a>=0and a<b:
  print("Yes")
else:
  print("No")

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

s = input()
if s.find('C') < s.rfind('F'):
    print('Yes')
else:
    print('No')


Failing test case input:
VAOSSAEDLFEH

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
s = input()
if -1 < s.find('C') < s.rfind('F'):
    print('Yes')
else:
    print('No')

Problem: p03957
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=list(map(str,input()))
if 'C' in s and 'F' in s:
  if s.index('C')<s.index('F'):
    print('Yes')
  else:
    print('No')
else:
  print('No')
  exit()

Failing test case input:
DOFCQDKAIVSF

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
s=str(input())
if 'C' in s and 'F' in s:
  if s.find('C')<s.rfind('F'):
    print('Yes')
  else:
    print('No')
else:
  print('No')
  exit()
Problem: p03957
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
n = 0
m = 0
for i in range(0, len(s)):
    if s[i] == 'C':
        n = 1
        break
for j in range (0, len(s)):
    if s[j] == 'F':
        m = 1
        break
if n == 1 and m == 1 and i < j:
    print('Yes')
else:
    print('No')

Failing test case input:
KIFCQDDAPVSF

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
s = input()
n = 0
m = 0
for i in range(0, len(s)):
    if s[i] == 'C':
        n = 1
        break
for j in range (i, len(s)):
    if s[j] == 'F':
        m = 1
        break
if n == 1 and m == 1:
    print('Yes')
else:
    print('No')

Problem: p03957
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
c = s.find('C')
f = s.find('F')
if c < f and c >= 0 and f >= 0:
  print('Yes')
else:
  print('No')
  

Failing test case input:
DOFCQDKAIVSF

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
s = input()
ans = 'No'
c = s.find('C')
if c != -1:
  f = s[c:].find('F')
  if f != -1:
    ans = 'Yes'
print(ans)

Problem: p03957
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
c=0
f=0
for i in range(len(s)):
    if s[i]=="C":
        if c==0:
            c=i+1
    if s[i]=="F":
        f=i+1
if c<f:
    print("Yes")
else:
    print("No")


Failing test case input:
VBOFLAEDTSEH

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
s=input()
c=0
f=0
for i in range(len(s)):
    if s[i]=="C":
        if c==0:
            c=i+1
    if s[i]=="F":
        f=i+1
if c!=0 and c<f:
    print("Yes")
else:
    print("No")

Problem: p03957
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
for i in range(len(s)):
    for j in range(i,len(s)):
        if s[i]=="C":
            if s[j]=="F":
                print("Yes")
                break
else:
    print("No")

Failing test case input:
FSVP@DDQCFIK

Expected output:
Yes


Actual output:
Yes
No


Fixed submission (verdict: Accepted):
s=input()
a="No"
for i in range(len(s)):
    for j in range(i,len(s)):
        if s[i]=="C":
            if s[j]=="F":
                a="Yes"
                break
print(a)
Problem: p02369
Buggy submission (Python3, verdict: Wrong Answer):
from collections import deque, defaultdict

def topological_sort(V, E):
    
    indeg = {v: 0 for v in V}
    for ends in E.values():
        for v in ends:
            indeg[v] += 1
    
    q = deque([v for v in V if indeg[v] == 0])
    top_sorted = []
    while q:
        v = q.popleft()
        top_sorted.append(v)
        
        for u in E[v]:
            indeg[u] -= 1
            if indeg[u] == 0:
                q.append(u)
    if len(top_sorted) == len(V): 
        return top_sorted
    else: 
        return None

N, M = map(int, input().split())
V = range(N)
E = defaultdict(list)
for _ in range(M):
    s, t = map(int, input().split())
    E[s].append(t)
print(0 if topological_sort(V, E) is None else 1)


Failing test case input:
8 2
0 2
0 2
0 4

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import deque, defaultdict

def topological_sort(V, E):
    
    indeg = {v: 0 for v in V}
    for ends in E.values():
        for v in ends:
            indeg[v] += 1
    
    q = deque([v for v in V if indeg[v] == 0])
    top_sorted = []
    while q:
        v = q.popleft()
        top_sorted.append(v)
        
        for u in E[v]:
            indeg[u] -= 1
            if indeg[u] == 0:
                q.append(u)
    if len(top_sorted) == len(V): 
        return top_sorted
    else: 
        return None

N, M = map(int, input().split())
V = range(N)
E = defaultdict(list)
for _ in range(M):
    s, t = map(int, input().split())
    E[s].append(t)
print(1 if topological_sort(V, E) is None else 0)

Problem: p02369
Buggy submission (Python3, verdict: Wrong Answer):

nv,ne = [int(i) for i in input().split()]

g = [[] for i in range(nv)]

for i in range(ne):
    s,t = [int(j) for j in input().split()]
    g[s].append(t)

visited = [False for i in range(nv)]
f = 0

def pursue_from(index, origin):
    global f

    if f == 1 or visited[index]:
        return

    visited[index] = True

    for next_index in g[index]:

        if next_index == 0:
            f = 1
            return
        pursue_from(next_index, origin)

for i in range(nv):
    pursue_from(i, i)

print(f)


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

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):

nv,ne = [int(i) for i in input().split()]

g = [[] for i in range(nv)]

for i in range(ne):
    s,t = [int(j) for j in input().split()]
    g[s].append(t)

visited = []
f = 0

def pursue_from(index, origin):

    if visited[index]:
        return

    visited[index] = True

    for next_index in g[index]:

        if next_index == origin:
            global f
            f = 1
            return
        pursue_from(next_index, origin)

for i in range(nv):
    visited = [False for i in range(nv)]

    pursue_from(i, i)

    if f == 1:
         break

print(f)
Problem: p03172
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N,K = LI()
a = [0]+LI()
if K == 0:
    print(1)
    exit(0)
dp = [[1] * (K+1) for _ in range(N+1)]
ac = 0
for i in range(1,N+1):
    ac += a[i]
    s = 0
    for j in range(K+1):
        s += dp[i-1][j]
        if j-a[i]-1 >= 0: s -= dp[i-1][j-a[i]-1]
        dp[i][j] = s % MOD
print(dp[-1][K]-dp[-1][K-1])


Failing test case input:
4 101001
101000 100000 100100 101000

Expected output:
844088733


Actual output:
-155911274


Fixed submission (verdict: Accepted):
import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N,K = LI()
a = [0]+LI()
if K == 0:
    print(1)
    exit(0)
dp = [[1] * (K+1) for _ in range(N+1)]
ac = 0
for i in range(1,N+1):
    ac += a[i]
    s = 0
    for j in range(K+1):
        s += dp[i-1][j]
        if j-a[i]-1 >= 0: s -= dp[i-1][j-a[i]-1]
        dp[i][j] = s % MOD
print((dp[-1][K]-dp[-1][K-1])%MOD)

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

from itertools import groupby, accumulate, product, permutations, combinations

def solve(N,K,A):
    mod = 10**9+7
    dp = [[0]*(K+1) for _ in range(N+1)] 
    dp[0][0] = 1
    for i in range(1,N+1):
        cum = list(map(lambda x:x%mod,accumulate(dp[i-1])))
        for j in range(K+1):
            dp[i][j] = cum[j]
            k = j-A[i-1]-1
            if k>=0:
                dp[i][j] -= cum[k]
    ans = dp[N][K]
    return ans
print(solve(N,K,A))

Failing test case input:
4 101100
101010 101100 101001 001101

Expected output:
942914131


Actual output:
-57085876


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

from itertools import groupby, accumulate, product, permutations, combinations

def solve(N,K,A):
    mod = 10**9+7
    dp = [[0]*(K+1) for _ in range(N+1)] 
    dp[0][0] = 1
    for i in range(1,N+1):
        cum = list(map(lambda x:x%mod,accumulate(dp[i-1])))
        for j in range(K+1):
            dp[i][j] = cum[j]
            k = j-A[i-1]
            if k>0:
                dp[i][j] -= cum[k-1]
    ans = dp[N][K]%mod
    return ans
print(solve(N,K,A))
Problem: p03172
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    N, K = map(int, input().split())
    if K == 0:
        return 1
    A = list(map(int, input().split()))
    MOD = 10**9+7
    dp = [[0]*(K+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        a = A[i]
        for j in range(K):
            dp[i+1][j] += dp[i][j]
            if j+a+1 <= K:
                dp[i+1][j+a+1] -= dp[i][j]
        for j in range(K):
            dp[i+1][j+1] += dp[i+1][j]
            dp[i+1][j+1] %= MOD

    return dp[N][K]


print(main())


Failing test case input:
4 101010
001000 000001 100100 001010

Expected output:
1195922


Actual output:
1195739


Fixed submission (verdict: Accepted):
def main():
    N, K = map(int, input().split())
    if K == 0:
        return 1
    A = list(map(int, input().split()))
    MOD = 10**9+7
    dp = [[0]*(K+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        a = A[i]
        for j in range(K+1):
            dp[i+1][j] += dp[i][j]
            if j+a+1 <= K:
                dp[i+1][j+a+1] -= dp[i][j]
        for j in range(K):
            dp[i+1][j+1] += dp[i+1][j]
        for j in range(K+1):
            dp[i+1][j] = dp[i+1][j] % MOD

    return dp[N][K]


print(main())

Problem: p03172
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,K=map(int,input().split())
A=list(map(int,input().split()))
d=[[0]*(K+2) for i in range(N+1)]
d[0]=[0]+[1]*(K+1)
m=10**9+7
for i in range(N):
    for j in range(K+1):
        d[i+1][j+1]=(d[i][j+1]-d[i][max(0,j-A[i])]+d[i+1][j])%m
print(d[-1][-1]-d[-1][-2])

Failing test case input:
4 101000
101000 100110 101001 100000

Expected output:
748258239


Actual output:
-251741768


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
A=list(map(int,input().split()))
d=[[0]*(K+2) for i in range(N+1)]
d[0]=[0]+[1]*(K+1)
m=10**9+7
for i in range(N):
    for j in range(K+1):
        d[i+1][j+1]=(d[i][j+1]-d[i][max(0,j-A[i])]+d[i+1][j])%m
print((d[-1][-1]-d[-1][-2])%m)
Problem: p03172
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

MOD = int(1e9)+7


def main():
    n, K = map(int, input().split())
    a = list(map(int, input().split()))

    
    dp = [[0]*(K+1) for i in range(n+1)]
    prefix = [[0]*(K+1) for i in range(n+1)]
    prefix[0] = [1]*(K+1)
    for i in range(1, n+1):
        for j in range(K+1):
            start = j - min(a[i-1], j)-1
            end = j
            dp[i][j] = prefix[i-1][end] - \
                (prefix[i-1][start] if start >= 0 else 0)
            prefix[i][j] = (prefix[i][j-1] + dp[i][j]) % MOD

    print(dp[n][K])


if __name__ == "__main__":
    main()


Failing test case input:
4 101000
101000 101100 101001 100000

Expected output:
866149419


Actual output:
-133850588


Fixed submission (verdict: Accepted):

MOD = int(1e9)+7


def main():
    n, K = map(int, input().split())
    a = list(map(int, input().split()))

    
    dp = [[0]*(K+1) for i in range(n+1)]
    prefix = [[0]*(K+1) for i in range(n+1)]
    prefix[0] = [1]*(K+1)
    for i in range(1, n+1):
        for j in range(K+1):
            start = j - min(a[i-1], j)-1
            end = j
            dp[i][j] = (prefix[i-1][end] - \
                (prefix[i-1][start] if start >= 0 else 0))%MOD
            prefix[i][j] = (prefix[i][j-1] + dp[i][j]) % MOD

    print(dp[n][K]%MOD)


if __name__ == "__main__":
    main()

Problem: p03172
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    dp=[0]*(k+1)
    dp[k]=1
    for i in range(n):
        ndp=[0]*(k+1)
        
        S=[0]*(k+2)
        for j in range(k+1): S[j+1]=S[j]+dp[j]
        
        for j in range(k+1):
            ndp[j]=S[min(j+A[i]+1,k+1)]-S[j]
        dp=ndp
    print(dp[0])
resolve()

Failing test case input:
4 110000
101100 100000 100000 100000

Expected output:
747535112


Actual output:
221227749083701


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    dp=[0]*(k+1)
    dp[k]=1
    for i in range(n):
        ndp=[0]*(k+1)
        
        S=[0]*(k+2)
        for j in range(k+1):
            S[j+1]=S[j]+dp[j]
            S[j+1]%=MOD
        
        for j in range(k+1):
            ndp[j]=S[min(j+A[i]+1,k+1)]-S[j]
            ndp[j]%=MOD
        dp=ndp
    print(dp[0])
resolve()
Problem: p03172
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from itertools import accumulate

def f(k, A):
    n = len(A)

    mod = int(1e9 + 7)
    dp = [0] * (k + 1)

    
    for j in range(min(A[n - 1], k) + 1):
        dp[j] = 1

    for i in range(n - 2, -1, -1):
        dp = list(accumulate(dp))
        a = A[i]
        dp[a+1:] = [x - y for x, y in zip(dp[a + 1:], dp)]

    return dp[-1]

assert f(4, [2, 3]) == 2
assert f(4, [1, 2, 3]) == 5
assert f(10, [9]) == 0
assert f(0, [0, 0]) == 1


n, k = map(int, input().split())
A = list(map(int, input().split()))
ans = f(k, A)
print(ans)


Failing test case input:
4 101000
101010 101100 101001 000101

Expected output:
746365018


Actual output:
519746368651


Fixed submission (verdict: Accepted):
from itertools import accumulate

def f(k, A):
    n = len(A)

    mod = int(1e9 + 7)
    dp = [0] * (k + 1)

    
    for j in range(min(A[n - 1], k) + 1):
        dp[j] = 1

    for i in range(n - 2, -1, -1):
        dp = list(accumulate(dp))
        a = A[i]
        dp[a+1:] = [x - y for x, y in zip(dp[a + 1:], dp)]
        dp = [x % mod for x in dp]

    return dp[-1] % mod

assert f(4, [2, 3]) == 2
assert f(4, [1, 2, 3]) == 5
assert f(10, [9]) == 0
assert f(0, [0, 0]) == 1
assert f(100000, [100000, 100000, 100000, 100000]) == 665683269

n, k = map(int, input().split())
A = list(map(int, input().split()))
ans = f(k, A)
print(ans)

Problem: p03172
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    N, K = map(int, input().split())
    if K == 0:
        return 1
    A = list(map(int, input().split()))
    MOD = 10**9+7
    dp = [[0]*(K+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        a = A[i]
        for j in range(K):
            dp[i+1][j] += dp[i][j]
            if j+a+1 <= K:
                dp[i+1][j+a+1] -= dp[i][j]
        for j in range(K):
            dp[i+1][j+1] += dp[i+1][j]
        
        

    return dp[N][K] % MOD


print(main())


Failing test case input:
4 101000
101000 001100 101001 100000

Expected output:
710774323


Actual output:
600177772


Fixed submission (verdict: Accepted):
def main():
    N, K = map(int, input().split())
    if K == 0:
        return 1
    A = list(map(int, input().split()))
    MOD = 10**9+7
    dp = [[0]*(K+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        a = A[i]
        for j in range(K+1):
            dp[i+1][j] += dp[i][j]
            if j+a+1 <= K:
                dp[i+1][j+a+1] -= dp[i][j]
        for j in range(K):
            dp[i+1][j+1] += dp[i+1][j]
        for j in range(K+1):
            dp[i+1][j] = dp[i+1][j] % MOD

    return dp[N][K]


print(main())
Problem: p03172
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    N, K = map(int, input().split())
    if K == 0:
        return 1
    A = list(map(int, input().split()))
    MOD = 10**9+7
    dp = [[0]*(K+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        a = A[i]
        for j in range(K):
            dp[i+1][j] += dp[i][j]
            if j+a+1 <= K:
                dp[i+1][j+a+1] -= dp[i][j]
        for j in range(K):
            dp[i+1][j+1] += dp[i+1][j]
        for j in range(K+1):
            dp[i+1][j] %= MOD

    return dp[N][K]


print(main())


Failing test case input:
4 000001
101100 100110 101000 100000

Expected output:
4


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    N, K = map(int, input().split())
    if K == 0:
        return 1
    A = list(map(int, input().split()))
    MOD = 10**9+7
    dp = [[0]*(K+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        a = A[i]
        for j in range(K+1):
            dp[i+1][j] += dp[i][j]
            if j+a+1 <= K:
                dp[i+1][j+a+1] -= dp[i][j]
        for j in range(K):
            dp[i+1][j+1] += dp[i+1][j]
        for j in range(K+1):
            dp[i+1][j] = dp[i+1][j] % MOD

    return dp[N][K]


print(main())

Problem: p03172
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():

    from bisect import bisect_left as bl, bisect_right as br, insort
    import sys
    import heapq
    
    from collections import defaultdict as dd, deque
    def data(): return sys.stdin.readline().strip()
    def mdata(): return list(map(int, data().split()))
    out = sys.stdout.write
    
    INF = int(1e9)
    mod = int(1e9)+7

    n,k=mdata()
    A=mdata()
    dp=[1 if A[0]>=i else 0 for i in range(k+1)]
    for i in range(1,n):
        for j in range(1,k+1):
            dp[j]=(dp[j]+dp[j-1])%mod
        for j in range(k+1):
            if A[i]<j:
                dp[j]=(dp[j]-dp[j-A[i]-1]+mod)%mod
    print(dp[-1]%mod)



if __name__ == '__main__':
    main()

Failing test case input:
4 101100
101010 101100 101001 000100

Expected output:
675732516


Actual output:
851890642


Fixed submission (verdict: Accepted):
def main():

    from bisect import bisect_left as bl, bisect_right as br, insort
    import sys
    import heapq
    
    from collections import defaultdict as dd, deque
    def data(): return sys.stdin.readline().strip()
    def mdata(): return list(map(int, data().split()))
    out = sys.stdout.write
    
    INF = int(1e9)
    mod = int(1e9)+7

    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    dp = [[0] * (k + 1) for _ in range(n + 1)]
    dp[0][0] = 1

    for i in range(n):
        dpsum = [0] * (k + 2)
        for l in range(k + 1):
            dpsum[l + 1] = dpsum[l] + dp[i][l]
            dpsum[l + 1] %= mod
        for j in range(k + 1):
            dp[i + 1][j] = (dpsum[j + 1] - dpsum[max(0, j - a[i])]) % mod
    print(dp[n][k])
    
if __name__ == '__main__':
    main()
Problem: p02958
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
n=int(input())
p=list(map(int,input().split()))
q=sorted(p)
for i in range(n-1):
  for j in range(i,n):
    s=p[i]
    p[i]=p[j]
    p[j]=s
    if p==q:
      print("YES")
      sys.exit()
    s=p[i]
    p[i]=p[j]
    p[j]=s
      
print("N0")

      
      
    
    

Failing test case input:
5
8 0 3 4 2

Expected output:
NO


Actual output:
N0


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

Problem: p02958
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
num = int(input())
ls = list(map(str, input().split(" ")))

sls = sorted(ls)

diff = 0
for i in range(num):
    if (sls[i] != ls[i]):
        diff += 1

if diff == 2 or diff == 0:
    print("YES")
else:
    print("NO")

Failing test case input:
5
1 20 1 1 4

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
num = int(input())
ls = list(map(int, input().split(" ")))

diff = 0
for i in range(num):
    if (ls[i] != i+1):
        diff += 1

if diff == 2 or diff == 0:
    print("YES")
else:
    print("NO")

Problem: p02958
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
p=list(map(int,input().split()))
count=0
num=0
for i in p:
    if i!=num+1:
        count+=1
    num+=1
if count>2:
    print('No')
else:
    print('Yes')

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

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
p=list(map(int,input().split()))
count=0
num=0
for i in p:
    if i!=num+1:
        count+=1
    num+=1
if count>2:
    print('NO')
else:
    print('YES')

Problem: p02958
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(map(int, input().split()))
count = sum([index + 1 == num for index, num in enumerate(P)])
if count <= 2:
  print("YES")
else:
  print("NO")

Failing test case input:
5
0 8 0 1 4

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
N = int(input())
P = list(map(int, input().split()))
count = sum([index + 1 != num for index, num in enumerate(P)])
if count <= 2:
    print("YES")
else:
    print("NO")

Problem: p02958
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(input(). split())
Q = sorted(P)
cnt = 0
i = 0

while cnt <= 2 and i < len(P):
  if Q[i] != P[i]:
    cnt += 1
  i += 1

if cnt <= 2:
  print("YES")
else:
  print("NO")

Failing test case input:
5
1 20 1 1 4

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
N = int(input())
P = list(map(int, input(). split()))
Q = sorted(P)
cnt = 0
i = 0

while cnt <= 2 and i < len(P):
  if Q[i] != P[i]:
    cnt += 1
  i += 1

if cnt <= 2:
  print("YES")
else:
  print("NO")
Problem: p02958
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
l=list(map(int,input().split()))
ll=sorted(l)
cnt=0
for l1,l2 in zip(l,ll):
  if l1 != l2:
    cnt+=1
    
print("Yes" if cnt <= 2 else "No")

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

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
l=list(map(int,input().split()))
ll=sorted(l)
cnt=0
for l1,l2 in zip(l,ll):
  if l1 != l2:
    cnt+=1
    
print("YES" if cnt <= 2 else "NO")

Problem: p02958
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
array=[int(i) for i in input().split()]

mistake=[]
for i in range(n):
  if array[i]!=i+1:
    mistake.append([i+1,array[i]])

ans='Yes'
k=len(mistake)
if k>2:
  ans='No'
elif k==2:
  if mistake[0][0]!=mistake[1][1]:
    ans='No'

print(ans)
    

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

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
array=[int(i) for i in input().split()]

mistake=[]
for i in range(n):
  if array[i]!=i+1:
    mistake.append([i+1,array[i]])

ans='YES'
k=len(mistake)
if k>2:
  ans='NO'
elif k==2:
  if mistake[0][0]!=mistake[1][1]:
    ans='NO'

print(ans)

Problem: p02958
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li_re = sorted(li)

point = 0

while point < 2:
    for i in range(len(li)):
        if li_re[i] != li[i]:
            point += 1
    print("YES")
    exit()
print("NO")

Failing test case input:
5
3 8 2 1 1

Expected output:
NO


Actual output:
YES


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

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li_re = sorted(li)

point = 0

for i in range(len(li)):
    if li_re[i] != li[i]:
        point += 1

if point > 2:
    print("NO")
else:
    print("YES")

Problem: p02958
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy

N = int(input())
P = list(map(int, input().split()))
X = copy.copy(P)
Y = copy.copy(P)
X.sort()

def f(P):
    for i in range(N):
        for j in range(N):
            P = copy.copy(Y)
            P[i],P[j] = P[j],P[i]

            if X == P:
                return "Yes"
    return "NO"

ans = f(P)
print(ans)

Failing test case input:
5
5 2 3 4 1

Expected output:
YES

Actual output:
Yes


Fixed submission (verdict: Accepted):
import copy

N = int(input())
P = list(map(int, input().split()))
X = copy.copy(P)

X.sort()
ans = "NO"


for i in range(N):
    for j in range(N):
        Y = copy.copy(P)
        a = copy.copy(P[i])
        b = copy.copy(P[j])
        Y[i] = b
        Y[j] = a
        
        if Y == X:
            ans =  "YES"


print(ans)