ZhenlongDai/ACPR huggingface dataset:
Problem: p02839
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
MI=lambda:map(int,input().split())
LI=lambda:list(map(int,input().split()))

H,W=MI()
A=[LI() for _ in [0]*H]
B=[LI() for _ in [0]*H]
    
G=[[set() for i in range(W)] for j in range(H)]
dif=A[0][0]-B[0][0]
G[0][0].add(0)

M=80*(H+W)

for h in range(H):
    for w in range(W):
        d=A[h][w]-B[h][w]
        for a in G[h][w]:
            if h!=H-1:
                G[h+1][w].add(abs(a+d))
                G[h+1][w].add(abs(a-d))
            if w!=W-1:
                G[h][w+1].add(abs(a+d))
                G[h][w+1].add(abs(a-d))
    
res=set()
for a in G[H-1][W-1]:
    res.add(a)
d=A[H-1][W-1]-B[H-1][W-1]
for a in G[H-1][W-1]:
    res.add(abs(a+d))
    res.add(abs(a-d))

res=sorted(list(res))
print(min(res))


Failing test case input:
1 3
-1 10 120
9 14 3
1 1 0
3 0 6

Expected output:
103


Actual output:
6


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
MI=lambda:map(int,input().split())
LI=lambda:list(map(int,input().split()))

H,W=MI()
A=[LI() for _ in [0]*H]
B=[LI() for _ in [0]*H]

G=[[set() for i in range(W)] for j in range(H)]
G[0][0].add(0)

for h in range(H):
    for w in range(W):
        d=A[h][w]-B[h][w]
        for a in G[h][w]:
            if h!=H-1:
                G[h+1][w].add(abs(a+d))
                G[h+1][w].add(abs(a-d))
            if w!=W-1:
                G[h][w+1].add(abs(a+d))
                G[h][w+1].add(abs(a-d))

res=set()
d=A[H-1][W-1]-B[H-1][W-1]
for a in G[H-1][W-1]:
    res.add(abs(a+d))
    res.add(abs(a-d))

res=sorted(list(res))
print(min(res))
Problem: p03147
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def min_other_than_zero(seq):
    seq = set(seq)
    if 0 in seq: seq.remove(0)
    return min(seq)


def water(H, start, stop):
    if max(H) == 0:
        return

    
    valley = min_other_than_zero(H[start:stop])
    for i in range(start, stop):
        H[i] -= valley
    global ans
    ans += valley

    
    valley_indices = [start + i for i, h in enumerate(H[start:stop]) if h == 0]
    if len(valley_indices) == 0:
        return
    if valley_indices[0] != start:
        valley_indices = [start - 1] + valley_indices
    if valley_indices[-1] != stop - 1:
        valley_indices += [stop]
    for i in range(len(valley_indices) - 1):
        if valley_indices[i + 1] - valley_indices[i] > 1:
            water(H, valley_indices[i] + 1, valley_indices[i + 1])


N = int(input())
H = [int(s) for s in input().split()]

ans = 0
water(H, 0, N)
print(ans)


Failing test case input:
5
2 0 8 3 0

Expected output:
10


Actual output:
8


Fixed submission (verdict: Accepted):
def water(H, start, stop):
    if max(H) == 0:
        return

    
    valley = min(H[start:stop])
    for i in range(start, stop):
        H[i] -= valley
    global ans
    ans += valley

    
    valley_indices = [start + i for i, h in enumerate(H[start:stop]) if h == 0]
    if valley_indices[0] != start:
        valley_indices = [start - 1] + valley_indices
    if valley_indices[-1] != stop - 1:
        valley_indices += [stop]
    for i in range(len(valley_indices) - 1):
        if valley_indices[i + 1] - valley_indices[i] > 1:
            water(H, valley_indices[i] + 1, valley_indices[i + 1])


N = int(input())
H = [int(s) for s in input().split()]

ans = 0
water(H, 0, N)
print(ans)

Problem: p03147
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
h = list(map(int,input().split()))
h.insert(0,0)
sum = 0
bottom = 0
for i, hn in enumerate(h):
  if (i == 0) :
    continue
  if (hn < h[i-1]):
    sum += (h[i-1] - bottom)
    bottom = hn
end = bottom if h[n-1] < h[n] else 0
print(sum+end)

Failing test case input:
8
6 23 136 1 23 32 50 100

Expected output:
235


Actual output:
137


Fixed submission (verdict: Accepted):
n = int(input())
h = list(map(int,input().split()))
h.insert(0,0)
sum = 0
bottom = 0
for i, hn in enumerate(h):
  if (i == 0) :
    continue
  if (hn < h[i-1]):
    bottom = hn
  else:
    sum += hn - h[i-1]
print(sum)
Problem: p03147
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
hs = [int(i) for i in input().split()]
flag = -1
count = 0

while max(hs) > 0:
    for i in range(n):
        if hs[i] > 0:
            if flag == 1:
                if i == n - 1:
                    flag *= -1
                hs[i] -= 1
            else:
                count += 1
                flag *= -1
                hs[i] -= 1
        else:
            if flag == 1: 
                flag *= -1
print(count)

Failing test case input:
8
4 65 110 2 5 88 0 101

Expected output:
297


Actual output:
294


Fixed submission (verdict: Accepted):
n = int(input())
hs = [int(i) for i in input().split()]
flag = -1
count = 0

while max(hs) > 0:
    flag = -1
    for i in range(n):
        if hs[i] > 0:
            if flag == 1:
                hs[i] -= 1
            else:
                count += 1
                flag = 1
                hs[i] -= 1
        else:
            if flag == 1: 
                flag = -1
print(count)

Problem: p03147
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
h=list(map(int,input().split()))
ans=0
while any(h)==True:
    flag=0
    for i in range(n):
        if h[i]>0:
            h[i]-=1
            flag=1
        else:
            if flag==1:
                ans+=1
                flag=0
        if i==n-2:
            if h[n-1]>0:
                h[n-1]-=1
                ans+=1
                break
            else:
                if h[i]>0:
                    ans+=1
                break
print(ans)


Failing test case input:
5
3 1 2 3 1

Expected output:
5

Actual output:
4


Fixed submission (verdict: Accepted):
n=int(input())
h=list(map(int,input().split()))
ans=0
if n==1:
    print(h[0])
    exit()
while any(h)==True:
    flag=0
    for i in range(n-1):
        if h[i]>0:
            h[i]-=1
            flag=1
        else:
            if flag==1:
                ans+=1
                flag=0
        if i==n-2:
            if h[n-1]>0:
                h[n-1]-=1
                ans+=1
            else:
                if flag==1:
                    ans+=1
print(ans)

Problem: p03147
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
h = list(map(int,input().split()))
ans = 0
tmp = 0
for i in range(len(h)):
    print(h[i])
    if tmp < h[i]:
        ans += h[i] - tmp
    tmp = h[i]
print(ans)

Failing test case input:
8
6 23 15 0 23 1 50 100

Expected output:
145


Actual output:
6
23
15
0
23
1
50
100
145


Fixed submission (verdict: Accepted):
n = int(input())
h = list(map(int,input().split()))
ans = 0
tmp = 0
for i in range(len(h)):
    if tmp < h[i]:
        ans += h[i] - tmp
    tmp = h[i]
print(ans)
Problem: p03147
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n=int(input())  
global h
h=list(map(int, input().split()))  
global cnt
cnt=0
while sum(h) !=0:
    for L in range(0,len(h)):
        if h[L] != 0:
            for r in range(L+1 ,len(h)):
                if h[r] == 0:
                    
                    for k in range(L,r):
                        h[k]-=1
                    cnt+=1
                    break
            else:
                r = len(h)
                for k in range(L,r):
                    h[k]-=1
                cnt+=1
                break
print(cnt)


Failing test case input:
8
3 65 13 0 0 84 8 011

Expected output:
152


Actual output:
157


Fixed submission (verdict: Accepted):


n=int(input())  
h=list(map(int, input().split()))  
cnt=0
L=0
while L != len(h):
    if h[L] != 0:
        for r in range(L+1 ,len(h)):
            if h[r] == 0:
                
                for k in range(L,r):
                    h[k]-=1
                cnt+=1
                break
        else:
            r = len(h)
            for k in range(L,r):
                h[k]-=1
            cnt+=1
    elif h[L] == 0:
        L+=1
print(cnt)

Problem: p03147
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
h=list(map(int, input().split()))
ans=0

for i in range(n-1):
    ans+=max(h[i+1]-h[i], 0)

print(ans)

Failing test case input:
8
4 2 75 0 21 13 66 101

Expected output:
186


Actual output:
182


Fixed submission (verdict: Accepted):
n=int(input())
h=[0]+list(map(int, input().split()))
ans=0

for i in range(n):
    ans+=max(h[i+1]-h[i],0)

print(ans)

Problem: p03147
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
h = list(map(int, input().split()))
counter = 0
fin = [0 for _ in range(N)]

while not h == fin:
    for i in range(1, N-1):
        if h[i] == 0 and not h[i-1] == 0:
            counter += 1
    counter += 1
    for i in range(N):
        if not h[i] == 0:
            h[i] -= 1


print(counter)


Failing test case input:
5
1 1 6 3 1

Expected output:
6


Actual output:
9


Fixed submission (verdict: Accepted):
N = int(input())
h = [0] + list(map(int, input().split())) + [0]
counter = 0
fin = [0 for _ in range(N+2)]

while not h == fin:
    for i in range(1, N+2):
        if h[i] == 0 and not h[i-1] == 0:
            counter += 1
    for i in range(1, N+1):
        if not h[i] == 0:
            h[i] -= 1


print(counter)
Problem: p03147
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

ct =0
for i in range(n):
    while Tree_List[i] != 0:
        
        if i == n-1:
            Tree_List[i] -= 1
            print(Tree_List)
        
        else:
            
            k = i + 1
            while Tree_List[k] != 0: 
                k+=1
                if k == n:
                    break
            
            
            
            Tree_List[i:k]=map(lambda x:x-1,Tree_List[i:k])
        
        ct += 1
        
    
        
        
        
print(ct)

Failing test case input:
8
8 65 136 0 0 108 31 101

Expected output:
314


Actual output:
[0, 0, 0, 0, 0, 0, 0, 69]
[0, 0, 0, 0, 0, 0, 0, 68]
[0, 0, 0, 0, 0, 0, 0, 67]
[0, 0, 0, 0, 0, 0, 0, 66]
[0, 0, 0, 0, 0, 0, 0, 65]
[0, 0, 0, 0, 0, 0, 0, 64]
[0, 0, 0, 0, 0, 0, 0, 63]
[0, 0, 0, 0, 0, 0, 0, 62]
[0, 0, 0, 0, 0, 0, 0, 61]
[0, 0, 0, 0, 0, 0, 0, 60]
[0, 0, 0, 0, 0, 0, 0, 59]
[0, 0, 0, 0, 0, 0, 0, 58]
[0, 0, 0, 0, 0, 0, 0, 57]
[0, 0, 0, 0, 0, 0, 0, 56]
[0, 0, 0, 0, 0, 0, 0, 55]
[0, 0, 0, 0, 0, 0, 0, 54]
[0, 0, 0, 0, 0, 0, 0, 53]
[0, 0, 0, 0, 0, 0, 0, 52]
[0, 0, 0, 0, 0, 0, 0, 51]
[0, 0, 0, 0, 0, 0, 0, 50]
[0, 0, 0, 0, 0, 0, 0, 49]
[0, 0, 0, 0, 0, 0, 0, 48]
[0, 0, 0, 0, 0, 0, 0, 47]
[0, 0, 0, 0, 0, 0, 0, 46]
[0, 0, 0, 0, 0, 0, 0, 45]
[0, 0, 0, 0, 0, 0, 0, 44]
[0, 0, 0, 0, 0, 0, 0, 43]
[0, 0, 0, 0, 0, 0, 0, 42]
[0, 0, 0, 0, 0, 0, 0, 41]
[0, 0, 0, 0, 0, 0, 0, 40]
[0, 0, 0, 0, 0, 0, 0, 39]
[0, 0, 0, 0, 0, 0, 0, 38]
[0, 0, 0, 0, 0, 0, 0, 37]
[0, 0, 0, 0, 0, 0, 0, 36]
[0, 0, 0, 0, 0, 0, 0, 35]
[0, 0, 0, 0, 0, 0, 0, 34]
[0, 0, 0, 0, 0, 0, 0, 33]
[0, 0, 0, 0, 0, 0, 0, 32]
[0, 0, 0, 0, 0, 0, 0, 31]
[0, 0, 0, 0, 0, 0, 0, 30]
[0, 0, 0, 0, 0, 0, 0, 29]
[0, 0, 0, 0, 0, 0, 0, 28]
[0, 0, 0, 0, 0, 0, 0, 27]
[0, 0, 0, 0, 0, 0, 0, 26]
[0, 0, 0, 0, 0, 0, 0, 25]
[0, 0, 0, 0, 0, 0, 0, 24]
[0, 0, 0, 0, 0, 0, 0, 23]
[0, 0, 0, 0, 0, 0, 0, 22]
[0, 0, 0, 0, 0, 0, 0, 21]
[0, 0, 0, 0, 0, 0, 0, 20]
[0, 0, 0, 0, 0, 0, 0, 19]
[0, 0, 0, 0, 0, 0, 0, 18]
[0, 0, 0, 0, 0, 0, 0, 17]
[0, 0, 0, 0, 0, 0, 0, 16]
[0, 0, 0, 0, 0, 0, 0, 15]
[0, 0, 0, 0, 0, 0, 0, 14]
[0, 0, 0, 0, 0, 0, 0, 13]
[0, 0, 0, 0, 0, 0, 0, 12]
[0, 0, 0, 0, 0, 0, 0, 11]
[0, 0, 0, 0, 0, 0, 0, 10]
[0, 0, 0, 0, 0, 0, 0, 9]
[0, 0, 0, 0, 0, 0, 0, 8]
[0, 0, 0, 0, 0, 0, 0, 7]
[0, 0, 0, 0, 0, 0, 0, 6]
[0, 0, 0, 0, 0, 0, 0, 5]
[0, 0, 0, 0, 0, 0, 0, 4]
[0, 0, 0, 0, 0, 0, 0, 3]
[0, 0, 0, 0, 0, 0, 0, 2]
[0, 0, 0, 0, 0, 0, 0, 1]
[0, 0, 0, 0, 0, 0, 0, 0]
314


Fixed submission (verdict: Accepted):

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

ct =0
for i in range(n):
    while Tree_List[i] != 0:
        
        if i == n-1:
            Tree_List[i] -= 1
        
        else:
            
            k = i + 1
            while Tree_List[k] != 0: 
                k+=1
                if k == n:
                    break
            Tree_List[i:k]=map(lambda x:x-1,Tree_List[i:k])
        
        ct += 1
        
print(ct)
Problem: p00637
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    n = int(input())
    if n == 0:
        break
    line = list(map(int, input().split()))
    t = len(line)-1
    ans = []
    i = 0
    while True:
        ans.append(line[i])
        while i < t:
            if line[i]+1 == line[i+1]:
                i += 1
            else:
                ans.append(line[i])
                i += 1
                break
        if i == t:
            ans.append(line[i])
            break
    print(*ans)

Failing test case input:
5
1 1 5 3 4
3
24 8 9
0

Expected output:
1 1 5 3-4
24 8-9


Actual output:
1 1 1 1 5 5 3 4
24 24 8 9


Fixed submission (verdict: Accepted):
while True:
    n = int(input())
    if n == 0:
        break
    line = list(map(int, input().split()))
    i = 0
    while i < n:
        j = i
        while j+1 < n and line[j+1]-line[j] == 1:
            j += 1
        s = "\n" if n-1 == j else " "
        if i == j:
            print("%d%s" % (line[i], s), end='')
            i += 1
        else:
            print("%d-%d%s" % (line[i], line[j], s), end='')
            i = j+1
Problem: p03698
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input();print("yneos"[len(set(s))>len(s)::2])

Failing test case input:
uprnfxpichsacle

Expected output:
no


Actual output:
yes


Fixed submission (verdict: Accepted):
s=input();print("yneos"[len(set(s))<len(s)::2])

Problem: p03698
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import  collections
dic=collections.Counter(list(input()))
if max((dic.values()))==1:
	print('yes')
else:print('No')	


Failing test case input:
tiffdrgnf

Expected output:
no


Actual output:
No


Fixed submission (verdict: Accepted):
import  collections
dic=collections.Counter(list(input()))
if max((dic.values()))==1:
	print('yes')
else:print('no')

Problem: p03698
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
for i in s:
    if s.count(i) != 1:
        print('No')
        exit()
print('Yes')

Failing test case input:
ql

Expected output:
yes


Actual output:
Yes


Fixed submission (verdict: Accepted):
s = input()
for i in s:
    if s.count(i) != 1:
        print('no')
        exit()
print('yes')

Problem: p03698
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

s = input()
for a in range(len(s)-1):
    for b in range(a+1,len(s)):
        if s[a] == s[b]:
            neko = 1
if neko:
    pn()
else:
    py()

Failing test case input:
elcashfiqxcopnu

Expected output:
no


Actual output:
No


Fixed submission (verdict: Accepted):
import math
def py():
    print("yes")
def pn():
    print("no")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

s = input()
for a in range(len(s)-1):
    for b in range(a+1,len(s)):
        if s[a] == s[b]:
            neko = 1
if neko:
    pn()
else:
    py()

Problem: p03698
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
s.sort()
flag = True
for i in range(len(s) - 1):
    if s[i] == [i + 1]:
        flag = False

if flag:
    print("yes")
else:
    print("no")


Failing test case input:
gmfidfqju

Expected output:
no


Actual output:
yes


Fixed submission (verdict: Accepted):
s = list(input())
s.sort()
flag = True
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        flag = False

if flag:
    print("yes")
else:
    print("no")

Problem: p03698
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=list(str(input()))

print('Yes' if len(list(set(s)))==len(s) else 'No')


Failing test case input:
enereffit

Expected output:
no


Actual output:
No


Fixed submission (verdict: Accepted):
s=list(str(input()))

print('yes' if len(list(set(s)))==len(s) else 'no')

Problem: p03698
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()

ans = "Yes"
for i in range(len(s)):
    if s.count(s[i])>1:
        ans = "No"

print(ans)



Failing test case input:
lo

Expected output:
yes


Actual output:
Yes


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

ans = "yes"
for i in range(len(s)):
    if s.count(s[i])>1:
        ans = "no"

print(ans)
Problem: p03698
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
S = input()
for i in range(len(S)):
  if i == len(S)-1:
    print('yes')
    break
  for p in range(i+1,len(S)):
    if S[i] == S[p]:
      print('no')
      break

Failing test case input:
dnereffit

Expected output:
no


Actual output:
no
no
yes


Fixed submission (verdict: Accepted):
S = input()
n = []
for i in range(len(S)):
  for p in range(i+1,len(S)):
    if S[i] == S[p]:
      n.append(0)
  if i == len(S)-1:
    n.append(1)
for i in range(len(n)):
  if n[i] == 0:
    print('no')
    break
  if i == len(n)-1:
    print('yes')

Problem: p03698
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

s = input().rstrip()
print("yes" if set(s) == s else "no")

Failing test case input:
mq

Expected output:
yes


Actual output:
no


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

s = input().rstrip()
print("yes" if len(set(s)) == len(s) else "no")

Problem: p03698
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
t = set(s)
print(s)
print(t)
if len(s) == len(t):
	print('yes')
else:
	print('no')

Failing test case input:
uxrmg`cjdhpspme

Expected output:
no


Actual output:
['u', 'x', 'r', 'm', 'g', '`', 'c', 'j', 'd', 'h', 'p', 's', 'p', 'm', 'e']
{'m', 'u', 'c', 'p', 's', 'g', 'h', '`', 'd', 'j', 'x', 'e', 'r'}
no


Fixed submission (verdict: Accepted):
s = list(input())
t = set(s)
if len(s) == len(t):
	print('yes')
else:
	print('no')
Problem: p02601
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c =  map(int, input().split())
K = int(input())

while K > 0:
    if a > b:
        b *= 2
    elif b > c:
        c *= 2
    K -= 1

if a < b < c:
    print('Yes')
else:
    print('No')

Failing test case input:
1 2 1
9

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
a, b, c =  map(int, input().split())
K = int(input())

while K > 0:
    if a >= b:
        b *= 2
    elif b >= c:
        c *= 2
    K -= 1

if a < b < c:
    print('Yes')
else:
    print('No')

Problem: p02601
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
numbers = [int(s) for s in input().split()] 
K = int(input())
for i in range(K):
    if(numbers[2] < numbers[0]):
        numbers[2] *= 2
        
    elif(numbers[1] < numbers[0]):
        numbers[1] *= 2
        
    elif(numbers[2] < numbers[1]):
        numbers[2] *= 2
        
    else:
        break
if(numbers[1] > numbers[0] and numbers[2] > numbers[1]):
    print("Yes")
else:
    print("No")

Failing test case input:
4 2 5
3

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
numbers = [int(s) for s in input().split()] 
K = int(input())
for i in range(K):
    if(numbers[2] <= numbers[0]):
        numbers[2] *= 2
    elif(numbers[1] <= numbers[0]):
        numbers[1] *= 2
    elif(numbers[2] <= numbers[1]):
        numbers[2] *= 2
    else:
        break
if(numbers[1] > numbers[0] and numbers[2] > numbers[1]):
    print("Yes")
else:
    print("No")

Problem: p02601
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A,B,C = map(int, input().split())
K = int(input())
count = 0
a = 0
while K > 0:

    if (A < B * 2 ** K) and (B * 2 ** K < C * 2 ** a):
        count +=1
    K -=1
    a +=1

if count == 1:
    print("Yes")
else: print("No")

Failing test case input:
12 4 2
9

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
A,B,C = map(int, input().split())
K = int(input())
count = 0
a = 0
while K >= 0:

    if (A < B * 2 ** K) and (B * 2 ** K < C * 2 ** a):
        count +=1
    K -=1
    a +=1

if count >= 1:
    print("Yes")
else: print("No")

Problem: p02601
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A, B, C = map(int, input().split())
q = int(input())

k = 0

for i in range(q+1):
    for j in range(0, q-i+1):
        print(i, j)
        B_ = B * (2 ** i)
        C_ = C * (2 ** j)
        if A < B_ and B_ < C_ and A < C_:
            k = 1
if k != 0:
    print('Yes')
else:
    print('No')

Failing test case input:
16 2 4
9

Expected output:
Yes


Actual output:
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
1 0
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
2 0
2 1
2 2
2 3
2 4
2 5
2 6
2 7
3 0
3 1
3 2
3 3
3 4
3 5
3 6
4 0
4 1
4 2
4 3
4 4
4 5
5 0
5 1
5 2
5 3
5 4
6 0
6 1
6 2
6 3
7 0
7 1
7 2
8 0
8 1
9 0
Yes


Fixed submission (verdict: Accepted):
A, B, C = map(int, input().split())
q = int(input())

k = 0

for i in range(q+1):
    for j in range(0, q-i+1):
        B_ = B * (2 ** i)
        C_ = C * (2 ** j)
        if A < B_ and B_ < C_ and A < C_:
            k = 1
if k != 0:
    print('Yes')
else:
    print('No')
Problem: p02601
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):


A,B,C = map(int, input().split())
K = int(input())

for i in range(K):

    if A > B:
        B *= 2
    if B > A:
        if B > C:
            C *= 2
        elif B < C:
            pass

if A < B and B < C:
    print("Yes")
else:
    print("No")

Failing test case input:
3 3 6
5

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):


A,B,C = map(int, input().split())
K = int(input())

for i in range(K):

    if A >= B:
        B *= 2
    elif B > A:
        if B >= C:
            C *= 2
        elif B < C:
            pass
    else:
        pass

if A < B and B < C:
    print("Yes")
else:
    print("No")

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



def magic(a, b, c, k):
    i = 0
    while i < k:
        if a > b:
            b = b * 2
        elif b > c:
            c = c * 2
        if a < b and b < c:
            return "Yes"
        i += 1
    return "No"


if __name__ == "__main__":
    param_a, param_b, param_c = input().split(' ')
    param_k = int(input())
    print(magic(int(param_a), int(param_b), int(param_c), int(param_k)))


Failing test case input:
2 1 6
2

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):



def magic(a, b, c, k):
    for i in range(k):
        if a >= b:
            b = b * 2
        elif b >= c:
            c = c * 2
        i += 1
    if a < b and b < c:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":
    param_a, param_b, param_c = map(int, input().split(' '))
    param_k = int(input())
    print(magic(param_a, param_b, param_c, param_k))

Problem: p02601
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A, B, C = map(int, input().split())
K = int(input())


if A < B and B < C :
  print('Yes')
  exit()

for i in range(K):
  if A < C and C < B:
    C = C * 2
    if A < B and B < C:
      print('Yes')
      exit()
  elif B < A and A < C:
    B = B * 2
    if A < B and B < C:
      print('Yes')
      exit()
  elif B < C and C < A:
    B = B * 2
    if A < B and B < C:
      print('Yes')
      exit()
  elif C < A and A < B:
    C = C * 2
    if A < B and B < C:
      print('Yes')
      exit()
  elif C < B and B < A:
    C = C * 2
    if A < B and B < C:
      print('Yes')
      exit()
print('No')

Failing test case input:
12 7 7
7

Expected output:
Yes


Actual output:
No


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

if A < B and B < C :
  print('Yes')
  exit()

for i in range(K):
  if A <= C and C <= B:
    C = C * 2
    if A < B and B < C:
      print('Yes')
      exit()
  elif B <= A and A <= C:
    B = B * 2
    if A < B and B < C:
      print('Yes')
      exit()
  elif B <= C and C <= A:
    C = C * 2
    if A < B and B < C:
      print('Yes')
      exit()
  elif C <= A and A <= B:
    C = C * 2
    if A < B and B < C:
      print('Yes')
      exit()
  elif C <= B and B <= A:
    C = C * 2
    if A < B and B < C:
      print('Yes')
      exit()
print('No')
Problem: p02601
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c=map(int,input().split())
k=int(input())
i=0
while a>=b:
    b*=2
    i+=1
  

while b>=c:
        c*=2
        i+=1

if a<b and b<c and i<=k:
    print("Yse")
else:
    print("No")


Failing test case input:
6 3 9
5

Expected output:
Yes


Actual output:
Yse


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
k=int(input())
i=0
while a>=b:
    b*=2
    i+=1
  

while b>=c:
        c*=2
        i+=1

if a<b and b<c and i<=k:
    print("Yes")
else:
    print("No")

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

def main():
    R, G, B = map(int, input().split())
    K = int(input())

    for i in range(K):
        if R > G:
            G = G * 2
        else:
            if G > B:
                B = B * 2
        if B > G > R:
            print("Yes")
            exit()
    print("No")
if __name__  == '__main__':
    main()

Failing test case input:
6 3 6
5

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):

def main():
    R, G, B = map(int, input().split())
    K = int(input())

    for i in range(K):
        if R >= G:
            G = G * 2
        else:
            if G >= B:
                B = B * 2
        if B > G > R:
            print("Yes")
            exit()
    print("No")
if __name__  == '__main__':
    main()

Problem: p02601
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c = map(int, input().split())
k = int(input())
for x in range(k+1):
    for y in range(x, k+1):
        if a * (2**x) < b * (2**(y-x)) < c* (2**(k-x-y)):
            print("Yes")
            break
    break
else:
    print("No")

Failing test case input:
8 3 4
3

Expected output:
No


Actual output:
no output


Fixed submission (verdict: Accepted):
import sys

a, b, c = map(int, input().split())
k = int(input())
for x in range(k+1):
    for y in range(x, k+1):
        if a * (2**x) < b * (2**(y-x)) < c* (2**(k-x-y)):
            print("Yes")
            sys.exit()
else:
    print("No")
Problem: p02975
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
if A.count(0)==N:
    print("Yes")
elif N%3!=0:
    print("No")
elif len(set(A))==2:
    if 0 in set(A):
        if A.count(0)==N/3:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(set(A))==3:
    print("Yes" if all(A.count(a)==N/3 for a in set(A)) else "No")
else:
    print("No")

Failing test case input:
3
-1 25 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
if A.count(0)==N:
    print("Yes")
elif N%3!=0:
    print("No")
elif len(set(A))==2:
    if 0 in set(A):
        if A.count(0)==N/3:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(set(A))==3:
    xor=0
    for a in set(A):
        if A.count(a)==N/3:
            xor^=a
        else:
            print("No")
            exit()
    if xor==0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Problem: p02975
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from sys import stdin, exit

N = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]

num = []
for k in a:
    if k not in num:
        num.append(k)
    if len(num) > 3:
        print('No')
        exit()
if len(num) == 1 and num[0] == 0:
    print('Yes')
    exit()
if len(num) == 2 and num[0] ^ num[1] == num[0] and N % 2 == 0:
    print('Yes')
    exit()
if len(num) <= 2:
    print('No')
    exit()
if num[0] ^ num[1] != num[2] and num[2] ^ num[1] != num[0] and num[0] ^ num[2] != num[1] and N % 3 == 0:
    print('No')
else:
    print('Yes')


Failing test case input:
4
0 7 1 0

Expected output:
No


Actual output:
Yes


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

N = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]

num = []
count = []
for k in a:
    if k not in num:
        num.append(k)
        count.append(1)
    else:
        count[num.index(k)] += 1
    if len(num) > 3:
        print('No')
        exit()
if len(num) == 1 and num[0] == 0:
    print('Yes')
    exit()
if len(num) == 2 and num[0] ^ num[1] == num[1] and N % 3 == 0 and count[1] == 2 * count[0]:
    print('Yes')
    exit()
if len(num) == 2 and num[0] ^ num[1] == num[0] and N % 3 == 0 and count[0] == 2 * count[1]:
    print('Yes')
    exit()
if len(num) <= 2:
    print('No')
    exit()
if num[0] ^ num[1] ^ num[2] == 0 and N % 3 == 0 and count[0] == count[1] == count[2] == int(N / 3):
    print('Yes')
else:
    print('No')
Problem: p02975
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))

res=0

for i in range(n):
    res = res ^ a[i]

if n % 3 ==0:
    if res==0:
        print("Yes")
        exit()
else:
    for i in range(n):
        if res == a[i]:
            print("Yes")
            exit()
print("No")

Failing test case input:
4
2 -5 0 2

Expected output:
No


Actual output:
Yes


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

res=0
a_set=set(a)

res=0
for i in range(n):
    res = res ^ a[i]

if n % 3 ==0:
    if res==0:
        print("Yes")
        exit()
else:
    if len(a_set) ==1:
        print("Yes")
        exit()
print("No")

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

R = {}
for i in a:
  if i in R:
    R[i] += 1
  else:
    R[i] = 1

ans = ["Yes", "No"]
if 0 in R:
  if len(R) == 1:
    print(ans[0])
  elif len(R) == 2:
    for i in R.keys():
      if i != 0:
        x = R[i]
      else:
        z = R[i]
    if x == z * 2:
      print(ans[0])
    else:
      print(ans[1])
  else:
    print(ans[1])
else:
  if len(R) != 3:
    print(ans[0])
  else:
    t = -1
    for i in R.values():
      if t == -1:
        t = i
      else:
        if i != t:
          print(ans[1])
          break
    else:
      print(ans[0])

Failing test case input:
3
-1 49 -1

Expected output:
No


Actual output:
Yes


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

R = {}
for i in a:
  if i in R:
    R[i] += 1
  else:
    R[i] = 1

ans = ["Yes", "No"]
if 0 in R:
  if len(R) == 1:
    print(ans[0])
  elif len(R) == 2:
    for i in R.keys():
      if i != 0:
        x = R[i]
      else:
        z = R[i]
    if x == z * 2:
      print(ans[0])
    else:
      print(ans[1])
  else:
    print(ans[1])
else:
  if len(R) != 3:
    print(ans[1])
  else:
    t = -1
    for i in R.values():
      if t == -1:
        t = i
      else:
        if i != t:
          print(ans[1])
          break
    else:
      a = b = c = -1
      for i in R.keys():
        if a == -1:
          a = i
        elif b == -1:
          b = i
        else:
          c = i
      if a ^ b == c:
        print(ans[0])
      else:
        print(ans[1])
Problem: p02975
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n=input()
a=list(map(int,input().split()))
b=set(a)
c=list(b)
c.sort()
cnt=collections.Counter(a)
if len(b)==1:
  if c[0]==0:
    print('Yes')
if len(b)==2:
  if c[0]==0 and cnt[1]%2==0:
    print('Yes')
if len(b)==3:
  if cnt[c[0]]==cnt[c[1]]==cnt[c[2]]:
    if c[0]^c[1]==c[2]:
      print('Yes')
else:
  print('No')


Failing test case input:
4
1 4 1 -1

Expected output:
No


Actual output:
no output


Fixed submission (verdict: Accepted):
import collections
n=input()
a=list(map(int,input().split()))
b=set(a)
c=list(b)
c.sort()
cnt=collections.Counter(a)
if len(b)==1:
  if c[0]==0:
    print('Yes')
  else:
    print('No')
if len(b)==2:
  if c[0]==0 and cnt[c[1]]%2==0 and cnt[c[0]]*2>=cnt[c[1]]:
    print('Yes')
  else:
    print('No')
if len(b)==3:
  if c[0]==0:
    print('No')
  elif cnt[c[0]]==cnt[c[1]]==cnt[c[2]] and c[0]^c[1]==c[2]:
        print('Yes')
  else:
      print('No')
if len(b)>3:
  print('No')

Problem: p02975
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)
if len(c) == 3:
    l = list(c.keys())
    v = list(c.values())
    if l[0]^l[1]^l[2] == 0 and v[0]==v[1]==v[2]:
        print("Yes")
elif len(c) == 1:
    if list(c.keys())[0] == 0:
        print("Yes")
elif len(c) == 2:
    if (0 not in a):
        print("No")
    else:
        v = c[0]
        if len(a) == c[0]*3/2 or len(a) == c[0]*3:
            print("Yes")
else:
    print("No")

Failing test case input:
3
-1 25 0

Expected output:
No


Actual output:
no output


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
c = Counter(a)
if len(c) == 3:
    l = list(c.keys())
    v = list(c.values())
    if l[0]^l[1]^l[2] == 0 and v[0]==v[1]==v[2]:
        print("Yes")
    else:
        print("No")
elif len(c) == 1:
    if list(c.keys())[0] == 0:
        print("Yes")
    else:
        print("No")
elif len(c) == 2:
    if (0 not in a):
        print("No")
    else:
        v = c[0]
        if len(a) == c[0]*3:
            print("Yes")
        else:
            print("No")
else:
    print("No")
Problem: p02975
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))

sum = 0
for i in range(N):
    sum ^= a[i]

    print('Yes' if sum == 0 else 'No')


Failing test case input:
3
-1 49 -1

Expected output:
No


Actual output:
No
No
No


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

sum = 0
for i in range(N):
    sum ^= a[i]

print('Yes' if sum == 0 else 'No')

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

n = int(input())
A = list(map(int, input().split()))
ans = "No"
Co = Counter(A)
if n % 3 != 0 : 
    if len(Co.keys()) == 1 and list(Co.keys())[0] == 0:
        ans = "Yes" 
else :
    tr = n 
    Va = Co.values()
    print(Va)
    if len(Va) == 3 :
        if Co.most_common()[0][1] == Co.most_common()[1][1] == Co.most_common()[2][1] == tr:
            ans = "No"
    elif len(Va) == 2 and Co.most_common()[0][1] == 2 * tr :
        ans = "Yes"
    elif len(Va) == 1 and Co.most_common()[0][0] == 1 :
        ans = "Yes"

print(ans)

Failing test case input:
3
0 25 2

Expected output:
No


Actual output:
dict_values([1, 1, 1])
No


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

n = int(input())
A = list(map(int, input().split()))
ans = "No"
Co = Counter(A)
if n % 3 != 0 : 
    if len(Co.keys()) == 1 and list(Co.keys())[0] == 0:
        ans = "Yes" 
else :
    tr = n 
    Va = Co.values()
    if len(Va) == 3 :
        if Co.most_common()[0][1] == Co.most_common()[1][1] == Co.most_common()[2][1] == tr:
            a,b,c = Co.most_common()[0][0],Co.most_common()[1][0],Co.most_common()[2][0]
            if a^b==c and b^c==a and c^a==b:
                ans = "Yes"
    elif len(Va) == 2 and Co.most_common()[0][1] == 2 * tr :
        a, b = Co.most_common()[0][0], Co.most_common()[1][0]
        if a^b==a and a^a==b:
            ans = "Yes"
    elif len(Va) == 1 and Co.most_common()[0][0] == 0 :
        ans = "Yes"
print(ans)
Problem: p02975
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

data = {}
N = int(input())
for i in input().split():
    if i not in data:
        data.update({i: 1})
    else:
        data[str(i)] += 1

ok = 0

if len(data.items()) > 3:
    pass
elif len(data.items()) == 1:
    if list(data.keys())[0] == "0":
        ok = 1
elif len(data.items()) == 2:
    print(data)
    if "0" in data.keys() and data["0"] == N/3:
        ok = 1
else:
    sum = 0
    for i, count in data.items():
        if not count == N/3:
            ok = -1
            break
        sum = sum ^ int(i)
    if ok == 0 and sum == 0:
        ok = 1

if ok == -1:
    ok = 0
print("Yes" if ok else "No")



Failing test case input:
4
1 4 1 1

Expected output:
No


Actual output:
{'1': 3, '4': 1}
No


Fixed submission (verdict: Accepted):

data = {}
N = int(input())
for i in input().split():
    if i not in data:
        data.update({i: 1})
    else:
        data[str(i)] += 1

ok = 0

if len(data.keys()) > 3:
    pass
elif len(data.keys()) == 1:
    if list(data.keys())[0] == "0":
        ok = 1
elif len(data.keys()) == 2:
    if "0" in data.keys() and data["0"] == N/3:
        ok = 1
else:
    sum = 0
    for i, count in data.items():
        if not count == N/3:
            ok = -1
            break
        sum = sum ^ int(i)
    if ok == 0 and sum == 0:
        ok = 1

if ok == -1:
    ok = 0
print("Yes" if ok else "No")
Problem: p02916
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

res = 0
prev = -1
for i in range(N):
	res += B[A[i]-1]
	if prev+1 == A[i]-1:
		res += C[prev]
	prev = A[i]-1 
print(res)

Failing test case input:
2
1 0
18 74
56

Expected output:
92


Actual output:
148


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
 
ans = 0
tmp = -1
for a in A:
    ans += B[a-1]
    if a-tmp == 1:
        ans += C[tmp-1]
    tmp = a
print(ans)

Problem: p02916
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
sum_satisfaction = sum(b)

for i in range(1,n):
    if(i < n-1 and  a[i] == a[i-1] + 1 ):
        sum_satisfaction = sum_satisfaction + c[i]
print(sum_satisfaction)

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

Expected output:
11


Actual output:
8


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

for i in range(0,n-1):
    if(a[i+1] - a[i] == 1 ):
        sum_satisfaction = sum_satisfaction + c[a[i]-1]
   
print(sum_satisfaction)

Problem: p02916
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
i = -1
for j in range(n):
    if a[j]-1 == i+1:
        ans += c[i]
    i = a[j] - 1
    ans += b[i]
print(ans)


Failing test case input:
2
1 2
10 95
31

Expected output:
136


Actual output:
167


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

ans = 0
i = -2
for j in range(n):
    if a[j]-1 == i+1:
        ans += c[i]
    i = a[j] - 1
    ans += b[i]
print(ans)

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

ans = sum(B)

for i in range(N-1):
    if A[i] == A[i+1] - 1:
        print(str(A[i])+ " : " +str(A[i+1]))
        ans += C[A[i]-1]

print(ans)


Failing test case input:
4
2 3 4 1
7 1 1 24
45 9 16

Expected output:
58


Actual output:
2 : 3
3 : 4
58


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

ans = sum(B)

for i in range(N-1):
    if A[i]+1 == A[i+1]:
        
        ans += C[A[i]-1]

print(ans)
Problem: p02916
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
 
ans = sum(B) 
for i in range(N-1):
    if A[i+1] - A[i] ==1:
        ans += C[i-1]
print(ans)


Failing test case input:
4
2 3 4 1
7 5 1 77
45 9 8

Expected output:
107


Actual output:
143


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
 
ans = sum(B) 
for i in range(N-1):
    if A[i+1] - A[i] ==1:
        ans += C[A[i]-1]
print(ans)

Problem: p02916
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a,b,c = [list(map(int,input().split())) for i in range(3)]
x = 0
d = -10
for i in range(n):
    x += b[a[i]-1]
    if i-1 == d:
        x+= c[d]
    if d != 0:
        d=i
print(x)

Failing test case input:
4
2 3 4 1
20 5 1 24
45 9 16

Expected output:
75


Actual output:
95


Fixed submission (verdict: Accepted):
n = int(input())
a,b,c = [list(map(int,input().split())) for i in range(3)]
x = 0
d = -10
for i in range(n):
    y = b[a[i]-1]
    x += y
    if a[i]-1 == d:
        x+= c[d-1]
    d = a[i]
print(x)

Problem: p02916
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
la = list(map(int,input().split()))
lb = list(map(int,input().split()))
lc = list(map(int,input().split()))

con = 0

for i in range(len(la)-1):
    if la[(i+1)%3]==la[i]+1:
        con += lc[la[i]-1]

print(sum(lb)+con)

Failing test case input:
4
2 3 0 1
7 5 4 24
45 9 21

Expected output:
70


Actual output:
49


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

con = 0

for i in range(n-1):
    if la[i+1]==la[i]+1:
        con += lc[la[i]-1]

print(sum(lb)+con)

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

ans = 0
for i in range(n):
  ai = a[i]
  ans += b[ai - 1]
  if ai < len(c) and i != n - 1:
    ans += c[ai - 1]

print(ans)

Failing test case input:
4
2 3 4 1
7 1 2 48
45 9 16

Expected output:
83


Actual output:
67


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

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

print(ans)
Problem: p02916
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = input().split()
b = input().split()
c = input().split()

result = 0
j = 0
for i in a:
  m = int(i) - 1
  result += int(b[m])
  if (not (m == 0)) and (j + 1 == m):
      result += int(c[j])
  j = m
print(result)

Failing test case input:
4
2 3 4 1
14 10 1 70
8 6 16

Expected output:
117


Actual output:
125


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

result = 0
j = 0
isFirst = True
for i in a:
  m = int(i) - 1
  result += int(b[m])
  if (not (isFirst)) and (j + 1 == m):
      result += int(c[j])
  j = m
  isFirst = False
print(result)

Problem: p02916
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
num = int(input())
index = list(map(int, input().split()))
point = list(map(int, input().split()))
add = list(map(int, input().split()))

total = 0
for i in range(num):
  total += point[index[i]-1]

for j in range(num-1):
  if index[j+1] == index[j]+ 1:
    total += add[j]

print(total)

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

Expected output:
5


Actual output:
18


Fixed submission (verdict: Accepted):
num = int(input())
index = list(map(int, input().split()))
point = list(map(int, input().split()))
add = list(map(int, input().split()))


total = 0
for i in range(num):
  total += point[index[i]-1]

for j in range(num-1):
  if index[j+1] == index[j]+ 1:
    total += add[index[j]-1]

print(total)
Problem: p02410
Buggy submission (Python3, verdict: Wrong Answer):
n,m =[int(r) for r in input().split()]

matrix = []
for ni in range(n):
    matrix.append([int(a)for a in input().split()])

vector = []
for mi  in range(m):
    vector.append(int(input()))

for i in range(len(matrix)):

    sum = 0
    for j in range(len(matrix[i])):

        sum += matrix[i][j] * vector[j]

Failing test case input:
3 4
0 7 -13 0
0 0 0 1
4 2 2 0
1
1
3
-1

Expected output:
-32
-1
12


Actual output:
no output


Fixed submission (verdict: Accepted):
n,m =[int(r) for r in input().split()]

matrix = []
for ni in range(n):
    matrix.append([int(a)for a in input().split()])

vector = []
for mi  in range(m):
    vector.append(int(input()))

for ni in range(n):

    sum = 0
    for mi in range(m):
        sum += matrix[ni][mi] * vector[mi]

    print(sum)

Problem: p02410
Buggy submission (Python3, verdict: Wrong Answer):
n, m = list(map(int, input().split()))
A = [[0 for w in range(m)] for h in range(n)]
B = [0 for h in range(m)]
for i in range(n):
    A[i] = list(map(int, input().split()))
for i in range(m):
    B[i] = int(input())

for i in range(n):
    c = 0
    for j in range(m):
        c += A[i][j] * B[j]
print(c)

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

Expected output:
-14
-6
-2


Actual output:
-2


Fixed submission (verdict: Accepted):
n, m = list(map(int, input().split()))
A = [[0 for w in range(m)] for h in range(n)]
B = [0 for h in range(m)]
for i in range(n):
    A[i] = list(map(int, input().split()))
for i in range(m):
    B[i] = int(input())

for i in range(n):
    c = 0
    for j in range(m):
        c += A[i][j] * B[j]
    print(c)

Problem: p02410
Buggy submission (Python3, verdict: Wrong Answer):
a = []; b = []; c = []
n, m = map(int, input().split())

for i in range(n):
	row = map(int, input().split())
	a.append(list(row))

for j in range(m):
	col = int(input())
	b.append(col)

for k in range(n):
	temp = 0
	for l in range(m):
		temp += a[k][l] * b[l] 
	c.append(temp)

print(c)

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

Expected output:
-2
2
9


Actual output:
[-2, 2, 9]


Fixed submission (verdict: Accepted):
a = []; b = []; c = []
n, m = map(int, input().split())

for i in range(n):
	row = map(int, input().split())
	a.append(list(row))

for j in range(m):
	col = int(input())
	b.append(col)

for k in range(n):
	temp = 0
	for l in range(m):
		temp += a[k][l] * b[l] 
	c.append(temp)

for ind in range(n):
	print(c[ind])