ZhenlongDai/ACPR huggingface dataset:
Problem: p03031
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, m = map(int, input().split())

k = []

for i in range(m):
    k.append(list(map(int, input().split())))

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

ans = 0

for i in range(2**n):
    switch = [0] * n
    for j in range(n):
        if i >> j & 1 == 1:
            switch[j] += 1
    cntt = 0
    for j in range(m):
        cnt = 0
        for s in range(1, k[j][0]+1):
            if switch[s-1] == 1:
                cnt += 1
        if cnt%2 != p[j]:
            cntt += 1
            break
    if cntt == 0:
        ans += 1

print(ans)

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

Expected output:
1


Actual output:
2


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

k = []

for i in range(m):
    k.append(list(map(int, input().split())))

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

ans = 0

for i in range(2**n):
    switch = [0] * n
    for j in range(n):
        if i >> j & 1 == 1:
            switch[j] += 1
    cntt = 0
    for j in range(m):
        cnt = 0
        for s in range(1, k[j][0]+1):
            if switch[k[j][s]-1] == 1:
                cnt += 1
        if cnt%2 == p[j]:
            cntt += 1
    if cntt == m:
        ans += 1

print(ans)

Problem: p03031
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
ks = [[int(i) for i in input().split()][1:] for _ in range(m)]
p = list(map(int, input().split()))

ans = 0
for i in range(2 ** n):
    for j in range(m):
        cnt = 0
        for k in range(n):
            if i >> j & 1 and k + 1 in ks[j]:
                cnt += 1
        if cnt % 2 != p[j]:
            break
    else:
        ans += 1
print(ans)

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

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
ks = [[int(i) for i in input().split()][1:] for _ in range(m)]
p = list(map(int, input().split()))

ans = 0
for i in range(2 ** n):
    for j in range(m):
        cnt = 0
        for k in range(n):
            if i >> k & 1 and k + 1 in ks[j]:
                cnt += 1
        if cnt % 2 != p[j]:
            break
    else:
        ans += 1
print(ans)
Problem: p03031
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



N, M = map(int, input().split())
light_s_dict = dict()
light_n_dict = dict()


for i in range(1, M+1):
    l = [int(j) for j in input().split()]
    connected_s = [0]*N
    for s in l[1:]:
        connected_s[s-1] = 1
    light_s_dict[i] = connected_s
    light_n_dict[i] = l[0]


s_patterns = []
for i in range(2**N):
    p_str = bin(i)[2:].zfill(N)
    s_patterns.append([int(i) for i in list(p_str)])
    

light_conditions = [int(p) for p in input().split()]


ans = 0
for pattern in s_patterns:
    cond = 0
    for light in range(1, M+1): 
        for i, p in enumerate(pattern):
            if p == 1:
                cond += light_s_dict[light][i]
        if cond % 2 != light_conditions[light-1]:
            break
    else: 
        ans += 1
print(ans)

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

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):



N, M = map(int, input().split())

light_s_dict = dict()

for i in range(M):
    l = [int(j) for j in input().split()]
    connected_s = [0]*N
    for s in l[1:]:
        connected_s[s-1] = 1
    light_s_dict[i] = connected_s


s_patterns = []
for i in range(2**N):
    p_str = bin(i)[2:].zfill(N)
    s_patterns.append([int(i) for i in list(p_str)])
    

light_conditions = [int(p) for p in input().split()]


ans = 0
for pattern in s_patterns:
    for light in range(M): 
        cond = 0 
        for i, p in enumerate(pattern): 
            if p == 1:
                cond += light_s_dict[light][i] 
        if cond % 2 != light_conditions[light]:
            break
    else: 
        ans += 1
print(ans)

Problem: p03031
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
l = []
for _ in range(M):
  l.append(list(map(int, input().split())))
p = list(map(int, input().split()))

m = [0] * M 
cnt1 = 0 
cnt2 = 0 

for i in range(2 ** N):
  for j in range(M):
    for k in range(l[j][0]):
      if (i >> (l[j][k+1] - 1) & 1):
        cnt1 += 1
    if cnt1 % 2 == p[j-1]:
      m[j-1] = 1
    cnt1 = 0
  if m == [1] * M:
    cnt2 += 1
  m = [0] * M
print(cnt2)

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

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
l = []
for _ in range(M):
  l.append(list(map(int, input().split())))
p = list(map(int, input().split()))

m = [0] * M 
cnt1 = 0 
cnt2 = 0 

for i in range(2 ** N):
  for j in range(M):
    for k in range(l[j][0]):
      if (i >> (l[j][k+1] - 1) & 1):
        cnt1 += 1
    if cnt1 % 2 == p[j]:
      m[j] = 1
    cnt1 = 0
  if m == [1] * M:
    cnt2 += 1
  m = [0] * M
print(cnt2)
Problem: p03031
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
k_list = [list(map(int, input().split()))[1:] for _ in range(m)]
p_list = list(map(int, input().split()))

ans = 0
for bit in range(2**n):
    check = True
    for k, p in zip(k_list, p_list):
        count = 0
        for i in range(n):
            if bit & (1 << i):
                if i in k:
                    count += 1
        if (count%2) != p:
            check = False
            break
    if check:
        ans += 1
        
print(ans)

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

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
ks = []
for _ in range(M):
    ks.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans = 0
for bit in range(2**N):
    on_list = []
    for i in range(N):
        if bit & (1 << i):
            on_list.append(i+1)
    flag = True
    for s, p_ in zip(ks, p):
        on_sum = len(list(set(on_list) & set(s[1:])))
        if on_sum % 2 != p_:
            flag = False
            break
    
    if flag:
        ans += 1
        
print(ans)

Problem: p03031
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
swis = [list(map(int,input().split()))[1:] for _ in range(M)]
need = list(map(int,input().split()))

ans = 0
for i in range(1<<N):
  for j in range(M):
    rel=0
    for k in swis[j]:
      if i & 1<<(k-1) != 0:
        rel+=1
        
      if rel%2 != need[j]:
        break
  else:
     ans+=1
      
print(ans)
        

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

Expected output:
0


Actual output:
4


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
swis = [list(map(int,input().split()))[1:] for _ in range(M)]
need = list(map(int,input().split()))

ans = 0
for i in range(1<<N):
  for j in range(M):
    rel=0
    for k in swis[j]:
      if i & (1<<(k-1)) != 0:
        rel+=1
        
    if rel%2 != need[j]:
        break
  else:
     ans+=1
      
print(ans)
Problem: p03031
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import sys

n,m = [ int(x) for x in sys.stdin.readline().split() ]
s = list()
for _ in range(m):
    t= [ int(x) for x in sys.stdin.readline().split() ][1:]
    flag = 0
    for x in t: flag|= x
    s.append( flag )
p = [ int(x) for x in sys.stdin.readline().split() ]

ans= 0
for test in range(2**n):
    fail= False
    for i in range(m):
        if bin(s[i]&test).count("1")%2 != p[i]:
            fail= True
            break
    
    if not fail: ans+= 1

print( ans )


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

Expected output:
8


Actual output:
0


Fixed submission (verdict: Accepted):


import sys

n,m = [ int(x) for x in sys.stdin.readline().split() ]
s = list()
for _ in range(m):
    t= [ int(x) for x in sys.stdin.readline().split() ][1:]
    flag = 0
    for x in t: flag|= 2**(x-1)
    s.append( flag )
p = [ int(x) for x in sys.stdin.readline().split() ]

ans= 0
for test in range(2**n):
    fail= False
    for i in range(m):
        if bin(s[i]&test).count("1")%2 != p[i]:
            fail= True
            break
    
    if not fail: ans+= 1

print( ans )

Problem: p03031
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from itertools import product 
n,m = map(int,input().split())
lamp = [list(map(int,input().split())) for _ in range(m)]
p = list(map(int,input().split()))

ans = 0
for i in product('01',repeat=n):
    tmp = 0
    ac = True
    for k,b in enumerate(lamp):
        for a in b[1:]:
            tmp += int(i[a-1])
        tmp %= 2
        if p[k] != tmp:
            ac = False
    if ac == True:
        ans += 1
print(ans)

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

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
from itertools import product
n,m = map(int,input().split())
lamp = [list(map(int,input().split())) for _ in range(m)]
p = list(map(int,input().split()))

ans = 0
for i in product([0,1],repeat=n):
    ac = True
    for k,b in enumerate(lamp):
        tmp = 0
        for a in b[1:]:
            tmp += i[a-1]
        if p[k] != tmp%2:
            ac = False
            break
    if ac:
        ans += 1
print(ans)
Problem: p02368
Buggy submission (Python3, verdict: Wrong Answer):
def solve():
    N, M = map(int, input().split())
    edges = [[] for _ in [0]*N]
    r_edges = [[] for _ in [0]*N]

    for _ in [0]*M:
        a, b = map(int, input().split())
        edges[a].append(b)
        r_edges[b].append(a)
    c = get_strongly_connected_components(edges, r_edges)
    group = [0]*N
    for i in range(len(c)):
        for v in c[i]:
            group[v] = i

    result = []
    append = result.append
    for _ in [0]*int(input()):
        a, b = map(int, input().split())
        append("1" if group[a] == group[b] else "0")

    print("\n".join(result))


def get_strongly_connected_components(edges, r_edges):
    import sys
    sys.setrecursionlimit(10**7)
    v_count = len(edges)
    order = [0]*v_count
    k = 1

    def get_order(v):
        order[v] = 1
        nonlocal k
        for dest in edges[v]:
            if order[dest] == 0:
                get_order(dest)
        order[v] = k
        k += 1

    def get_components(v):
        order[v] = 0
        return [v] + [_v for dest in r_edges[v] if order[dest] > 0 for _v in get_components(dest)]

    get_order(0)
    return [get_components(v) for v, _ in sorted(enumerate(order), key=lambda x: x[1], reverse=True) if order[v] > 0]

if __name__ == "__main__":
    solve()

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

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
def solve():
    N, M = map(int, input().split())
    edges = [[] for _ in [0]*N]
    r_edges = [[] for _ in [0]*N]

    for _ in [0]*M:
        a, b = map(int, input().split())
        edges[a].append(b)
        r_edges[b].append(a)
        
    c = get_strongly_connected_components(edges, r_edges)
    group = [0]*N
    for i in range(len(c)):
        for v in c[i]:
            group[v] = i

    result = []
    append = result.append
    for _ in [0]*int(input()):
        a, b = map(int, input().split())
        append("1" if group[a] == group[b] else "0")

    print("\n".join(result))


def get_strongly_connected_components(edges, r_edges):
    import sys
    sys.setrecursionlimit(10**7)
    v_count = len(edges)
    order = [0]*v_count
    k = 1

    def get_order(v):
        order[v] = 1
        nonlocal k
        for dest in edges[v]:
            if order[dest] == 0:
                get_order(dest)
        order[v] = k
        k += 1

    def get_components(v):
        order[v] = 0
        return [v] + [_v for dest in r_edges[v] if order[dest] > 0 for _v in get_components(dest)]

    [None for v in range(v_count) if order[v] == 0 and get_order(v)]
    return [get_components(v) for v, _ in sorted(enumerate(order), key=lambda x: x[1], reverse=True) if order[v] > 0]

if __name__ == "__main__":
    solve()
Problem: p02368
Buggy submission (Python3, verdict: Wrong Answer):


import sys

sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')

N,M=MAP()
nodes1=[[] for i in range(N)]
nodes2=[[] for i in range(N)]
for i in range(M):
    u,v=MAP()
    nodes1[u].append(v)
    nodes2[v].append(u)

T=[]
visited=[False]*N
def rec1(cur):
    visited[cur]=True
    for nxt in nodes1[cur]:
        if not visited[nxt]:
            rec1(nxt)
    
    T.append(cur)

rec1(0)

visited=[False]*N
group=[0]*N
grpnum=1
def rec2(cur):
    global grpnum
    group[cur]=grpnum
    visited[cur]=True
    for nxt in nodes2[cur]:
        if not visited[nxt]:
            rec2(nxt)
            return
    grpnum+=1
    return


for u in reversed(T):
    if not visited[u]:
        rec2(u)

Q=INT()
for _ in range(Q):
    u,v=MAP()
    if group[u]==group[v]:
        print(1)
    else:
        print(0)



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

Expected output:
0
0
1
0


Actual output:
1
0
0
0


Fixed submission (verdict: Accepted):


import sys

sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')

N,M=MAP()
nodes1=[[] for i in range(N)]
nodes2=[[] for i in range(N)]
for i in range(M):
    u,v=MAP()
    nodes1[u].append(v)
    nodes2[v].append(u)

T=[]
visited=[False]*N
def rec1(cur):
    visited[cur]=True
    for nxt in nodes1[cur]:
        if not visited[nxt]:
            rec1(nxt)
    
    T.append(cur)


for u in range(N):
    if not visited[u]:
        rec1(u)

visited=[False]*N
group=[0]*N
grpnum=1
def rec2(cur):
    global grpnum
    group[cur]=grpnum
    visited[cur]=True
    for nxt in nodes2[cur]:
        if not visited[nxt]:
            rec2(nxt)


for u in reversed(T):
    if not visited[u]:
        rec2(u)
        grpnum+=1

Q=INT()
for _ in range(Q):
    u,v=MAP()
    if group[u]==group[v]:
        print(1)
    else:
        print(0)
Problem: p02368
Buggy submission (Python3, verdict: Wrong Answer):
def solve():
    N, M = map(int, input().split())
    edges = [[] for _ in [0]*N]
    r_edges = [[] for _ in [0]*N]

    for _ in [0]*M:
        a, b = map(int, input().split())
        edges[a].append(b)
        r_edges[b].append(a)
    c = get_strongly_connected_components(edges, r_edges)
    print(c)
    group = [0]*N
    for i in range(len(c)):
        for v in c[i]:
            group[v] = i

    result = []
    append = result.append
    for _ in [0]*int(input()):
        a, b = map(int, input().split())
        append("1" if group[a] == group[b] else "0")

    print("\n".join(result))


def get_strongly_connected_components(edges, r_edges):
    import sys
    sys.setrecursionlimit(10**7)
    v_count = len(edges)
    order = [0]*v_count
    k = 1

    def get_order(v):
        order[v] = 1
        nonlocal k
        for dest in edges[v]:
            if order[dest] == 0:
                get_order(dest)
        order[v] = k
        k += 1

    def get_components(v):
        order[v] = 0
        return [v] + [_v for dest in r_edges[v] if order[dest] > 0 for _v in get_components(dest)]

    [None for v in range(v_count) if order[v] == 0 and get_order(v)]
    return [get_components(v) for v, _ in sorted(enumerate(order), key=lambda x: x[1], reverse=True) if order[v] > 0]

if __name__ == "__main__":
    solve()

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

Expected output:
1
0
0
0


Actual output:
[[7], [6], [5], [3], [4], [0, 2, 1]]
1
0
0
0


Fixed submission (verdict: Accepted):
def solve():
    N, M = map(int, input().split())
    edges = [[] for _ in [0]*N]
    r_edges = [[] for _ in [0]*N]

    for _ in [0]*M:
        a, b = map(int, input().split())
        edges[a].append(b)
        r_edges[b].append(a)
        
    c = get_strongly_connected_components(edges, r_edges)
    group = [0]*N
    for i in range(len(c)):
        for v in c[i]:
            group[v] = i

    result = []
    append = result.append
    for _ in [0]*int(input()):
        a, b = map(int, input().split())
        append("1" if group[a] == group[b] else "0")

    print("\n".join(result))


def get_strongly_connected_components(edges, r_edges):
    import sys
    sys.setrecursionlimit(10**7)
    v_count = len(edges)
    order = [0]*v_count
    k = 1

    def get_order(v):
        order[v] = 1
        nonlocal k
        for dest in edges[v]:
            if order[dest] == 0:
                get_order(dest)
        order[v] = k
        k += 1

    def get_components(v):
        order[v] = 0
        return [v] + [_v for dest in r_edges[v] if order[dest] > 0 for _v in get_components(dest)]

    [None for v in range(v_count) if order[v] == 0 and get_order(v)]
    return [get_components(v) for v, _ in sorted(enumerate(order), key=lambda x: x[1], reverse=True) if order[v] > 0]

if __name__ == "__main__":
    solve()
Problem: p02368
Buggy submission (Python3, verdict: Wrong Answer):


import sys

sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')

N,M=MAP()
nodes1=[[] for i in range(N)]
nodes2=[[] for i in range(N)]
for i in range(M):
    u,v=MAP()
    nodes1[u].append(v)
    nodes2[v].append(u)

T=[]
visited=[False]*N
def rec1(cur):
    visited[cur]=True
    for nxt in nodes1[cur]:
        if not visited[nxt]:
            rec1(nxt)
    
    T.append(cur)


for u in range(N):
    if not visited[u]:
        rec1(u)

visited=[False]*N
group=[0]*N
grpnum=1
def rec2(cur):
    global grpnum
    group[cur]=grpnum
    visited[cur]=True
    for nxt in nodes2[cur]:
        if not visited[nxt]:
            rec2(nxt)
            return
    grpnum+=1
    return


for u in reversed(T):
    if not visited[u]:
        rec2(u)

Q=INT()
for _ in range(Q):
    u,v=MAP()
    if group[u]==group[v]:
        print(1)
    else:
        print(0)



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

Expected output:
1
1
1
1


Actual output:
1
1
1
0


Fixed submission (verdict: Accepted):


import sys

sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')

N,M=MAP()
nodes1=[[] for i in range(N)]
nodes2=[[] for i in range(N)]
for i in range(M):
    u,v=MAP()
    nodes1[u].append(v)
    nodes2[v].append(u)

T=[]
visited=[False]*N
def rec1(cur):
    visited[cur]=True
    for nxt in nodes1[cur]:
        if not visited[nxt]:
            rec1(nxt)
    
    T.append(cur)


for u in range(N):
    if not visited[u]:
        rec1(u)

visited=[False]*N
group=[0]*N
grpnum=1
def rec2(cur):
    global grpnum
    group[cur]=grpnum
    visited[cur]=True
    for nxt in nodes2[cur]:
        if not visited[nxt]:
            rec2(nxt)


for u in reversed(T):
    if not visited[u]:
        rec2(u)
        grpnum+=1

Q=INT()
for _ in range(Q):
    u,v=MAP()
    if group[u]==group[v]:
        print(1)
    else:
        print(0)
Problem: p02368
Buggy submission (Python3, verdict: Wrong Answer):
import sys
sys.setrecursionlimit(100000)

V,E = map(int, input().split())

D1 = [[] for _ in range(V)]
D2 = [[] for _ in range(V)]
for _ in range(E):
    s,t = map(int, input().split())
    D1[s].append(t)
    D2[t].append(s)

stuck = []
color = [0 for _ in range(V)]
def dfs1(s):
    color[s] = 1
    for next in D1[s]:
        if color[next] == 0:
            dfs1(next)
    stuck.append(s)
    return

dfs1(0)

color = [0 for _ in range(V)]
def dfs2(s, cnt):
    color[s] = cnt
    for next in D2[s]:
        if color[next] == 0:
            dfs2(next, cnt)
    return

stuck = stuck[::-1]
cnt = 0
for i in stuck:
    if color[i] == 0:
        cnt += 1
        dfs2(i, cnt)

Q = int(input())
for _ in range(Q):
    u,v = map(int, input().split())
    if color[u] == color[v]:
        print(1)
    else: print(0)

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

Expected output:
1
0
0
0


Actual output:
1
1
1
1


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(100000)

V,E = map(int, input().split())

D1 = [[] for _ in range(V)]
D2 = [[] for _ in range(V)]
for _ in range(E):
    s,t = map(int, input().split())
    D1[s].append(t)
    D2[t].append(s)

stuck = []
color = [0 for _ in range(V)]
def dfs1(s):
    color[s] = 1
    for next in D1[s]:
        if color[next] == 0:
            dfs1(next)
    stuck.append(s)
    return

for i in range(V):
    if color[i] == 0:
        dfs1(i)

color = [0 for _ in range(V)]
def dfs2(s, cnt):
    color[s] = cnt
    for next in D2[s]:
        if color[next] == 0:
            dfs2(next, cnt)
    return

stuck = stuck[::-1]
cnt = 0
for i in stuck:
    if color[i] == 0:
        cnt += 1
        dfs2(i, cnt)

Q = int(input())
for _ in range(Q):
    u,v = map(int, input().split())
    if color[u] == color[v]:
        print(1)
    else: print(0)
Problem: p02368
Buggy submission (Python3, verdict: Wrong Answer):



def dfs(v, visited, edges, order):
  visited[v] = True
  for to in edges[v]:
    if not visited[to]:
      dfs(to, visited, edges, order)
  order.append(v)

def search_strongly_connection(v, visited, reverse_edges, parent):
  visited[v] = True
  for to in reverse_edges[v]:
    if not visited[to]:
      parent[to] = v
      search_strongly_connection(to, visited, reverse_edges, parent)

def find(parent, x):
  if parent[x] == x:
    return x
  tmp = find(parent, parent[x])
  parent[x] = tmp
  return tmp

v_num , e_num = map(int, input().split())
edges = [[] for _ in range(v_num)]
reverse_edges = [[] for _ in range(v_num)]
for _ in range(e_num):
  s, t = map(int, input().split())
  edges[s].append(t)
  reverse_edges[t].append(s)


order = []
visited = [False] * v_num
dfs(0, visited, edges, order)
order.reverse()


visited = [False] * v_num
parent = [i for i in range(v_num)]
for v in order:
  if not visited[v]:
    search_strongly_connection(v, visited, reverse_edges, parent)


q_num = int(input())
for _ in range(q_num):
  u, v = map(int, input().split())
  if find(parent, u) == find(parent, v):
    print(1)
  else:
    print(0)


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

Expected output:
0
1
0


Actual output:
0
1
1


Fixed submission (verdict: Accepted):


import sys

sys.setrecursionlimit(1000000)

def dfs(v, visited, edges, order):
  visited[v] = True
  for to in edges[v]:
    if not visited[to]:
      dfs(to, visited, edges, order)
  order.append(v)

def search_strongly_connection(v, visited, reverse_edges, parent):
  visited[v] = True
  for to in reverse_edges[v]:
    if not visited[to]:
      parent[to] = v
      search_strongly_connection(to, visited, reverse_edges, parent)

def find(parent, x):
  if parent[x] == x:
    return x
  tmp = find(parent, parent[x])
  parent[x] = tmp
  return tmp

v_num , e_num = map(int, input().split())
edges = [[] for _ in range(v_num)]
reverse_edges = [[] for _ in range(v_num)]
for _ in range(e_num):
  s, t = map(int, input().split())
  edges[s].append(t)
  reverse_edges[t].append(s)


order = []
visited = [False] * v_num
for v in range(v_num):
  if not visited[v]:
    dfs(v, visited, edges, order)
order.reverse()


visited = [False] * v_num
parent = [i for i in range(v_num)]
for v in order:
  if not visited[v]:
    search_strongly_connection(v, visited, reverse_edges, parent)

q_num = int(input())
for _ in range(q_num):
  u, v = map(int, input().split())
  if find(parent, u) == find(parent, v):
    print(1)
  else:
    print(0)
Problem: p03545
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    (A,B,C,D) = map(int, input())
    operation = ['+','-']
    for op1 in operation:
        sum = A
        if op1=='+':
            sum+=B
        else:
            sum-=B
        for op2 in operation:
            if op2=='+':
                sum+=C
            else:
                sum-=C
            if 7-sum==D:
                op3 = '+'
                print(str(A)+op1+str(B)+op2+str(C)+op3+str(D)+'=7')
                return
            elif sum-7==D:
                op3 = '-'
                print(str(A)+op1+str(B)+op2+str(C)+op3+str(D)+'=7')
                return

main()


Failing test case input:
2368

Expected output:
2+3-6+8=7


Actual output:
2-3-6+8=7


Fixed submission (verdict: Accepted):
def main():
    (A,B,C,D) = map(int, input())
    operation = ['+','-']
    sumA = A
    for op1 in operation:
        sum = sumA
        if op1=='+':
            sum+=B
        else:
            sum-=B
        sumAB = sum
        for op2 in operation:
            sum = sumAB
            if op2=='+':
                sum+=C
            else:
                sum-=C
            if 7-sum==D:
                op3 = '+'
                print(str(A)+op1+str(B)+op2+str(C)+op3+str(D)+'=7')
                return
            elif sum-7==D:
                op3 = '-'
                print(str(A)+op1+str(B)+op2+str(C)+op3+str(D)+'=7')
                return

main()

Problem: p03545
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input_str = input()
A = int(input_str[0])
B = int(input_str[1])
C = int(input_str[2])
D = int(input_str[3])

list = []
list.append(A + B + C + D)
list.append(A + B + C - D)
list.append(A + B - C + D)
list.append(A + B - C - D)
list.append(A - B + C + D)
list.append(A - B + C - D)
list.append(A - B - C + D)
list.append(A - B - C - D)

num = list.index(7)
print(num)

if num <= 3:
    op1 = '+'
else:
    op1 = '-'

if num == 0 or num == 1 or num == 4 or num == 5:
    op2 = '+'
else:
    op2 = '-'

if num % 2 == 0:
    op3 = '+'
else:
    op3 = '-'

print('{}{}{}{}{}{}{}=7'.format(A,op1,B,op2,C,op3,D))


Failing test case input:
1222

Expected output:
1+2+2+2=7

Actual output:
0
1+2+2+2=7


Fixed submission (verdict: Accepted):
input_str = input()
A = int(input_str[0])
B = int(input_str[1])
C = int(input_str[2])
D = int(input_str[3])

list = []
list.append(A + B + C + D)
list.append(A + B + C - D)
list.append(A + B - C + D)
list.append(A + B - C - D)
list.append(A - B + C + D)
list.append(A - B + C - D)
list.append(A - B - C + D)
list.append(A - B - C - D)

num = list.index(7)

if num <= 3:
    op1 = '+'
else:
    op1 = '-'

if num == 0 or num == 1 or num == 4 or num == 5:
    op2 = '+'
else:
    op2 = '-'

if num % 2 == 0:
    op3 = '+'
else:
    op3 = '-'

print('{}{}{}{}{}{}{}=7'.format(A,op1,B,op2,C,op3,D))
Problem: p03545
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

import sys
s = input()
a = []

for i in range(len(s)):
    num = int(s[i])
    a.append(num)

print(a)
op = ['+', '-']

for i in range(2):
    for j in range(2):
        for k in range(2):
            temp = 0
            if op[i] == '+':
                temp = a[0] + a[1]
            else:
                temp = a[0] - a[1]
            if op[j] == '+':
                temp += a[2]
            else:
                temp -= a[2]
            if op[k] == '+':
                temp += a[3]
            else:
                temp -= a[3]

            if temp == 7:
                n1, n2, n3, n4 = map(str, [a[0], a[1], a[2], a[3]])
                
                print(n1 + op[i] + n2 + op[j] + n3 + op[k] + n4 + '=7')
                sys.exit()


Failing test case input:
1170

Expected output:
1-1+7+0=7


Actual output:
[1, 1, 7, 0]
1-1+7+0=7


Fixed submission (verdict: Accepted):

import sys
s = input()
a = []

for i in range(len(s)):
    num = int(s[i])
    a.append(num)


op = ['+', '-']

for i in range(2):
    for j in range(2):
        for k in range(2):
            temp = 0
            if op[i] == '+':
                temp = a[0] + a[1]
            else:
                temp = a[0] - a[1]
            if op[j] == '+':
                temp += a[2]
            else:
                temp -= a[2]
            if op[k] == '+':
                temp += a[3]
            else:
                temp -= a[3]

            if temp == 7:
                n1, n2, n3, n4 = map(str, [a[0], a[1], a[2], a[3]])
                
                print(n1 + op[i] + n2 + op[j] + n3 + op[k] + n4 + '=7')
                sys.exit()

Problem: p03545
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
listA=[0,0,0,0]
i=0
for x in s:
    listA[i]=int(x)
    i+=1
a=listA[0]
b=listA[1]
c=listA[2]
d=listA[3]
if(a+b+c+d==7):
    print("%d+%d+%d+%d==7"% (a,b,c,d))
elif(a+b+c-d==7):
    print("%d+%d+%d-%d==7"% (a,b,c,d))
elif(a+b-c+d==7):
    print("%d+%d-%d+%d==7" % (a, b, c, d))
elif(a+b-c-d==7):
    print("%d+%d-%d-%d==7" % (a, b, c, d))
elif(a-b+c+d==7):
    print("%d-%d+%d+%d==7" % (a, b, c, d))
elif(a-b-c+d==7):
    print("%d-%d-%d+%d==7" % (a, b, c, d))
elif(a-b-c-d==7):
    print("%d-%d-%d-%d==7" % (a, b, c, d))
elif(a-b+c-d==7):
    print("%d-%d+%d-%d==7" % (a, b, c, d))

Failing test case input:
1583

Expected output:
1-5+8+3=7


Actual output:
1-5+8+3==7


Fixed submission (verdict: Accepted):
s=input()
listA=[0,0,0,0]
i=0
for x in s:
    listA[i]=int(x)
    i+=1
a=listA[0]
b=listA[1]
c=listA[2]
d=listA[3]
if(a+b+c+d==7):
    print("%d+%d+%d+%d=7"% (a,b,c,d))
elif(a+b+c-d==7):
    print("%d+%d+%d-%d=7"% (a,b,c,d))
elif(a+b-c+d==7):
    print("%d+%d-%d+%d=7" % (a, b, c, d))
elif(a+b-c-d==7):
    print("%d+%d-%d-%d=7" % (a, b, c, d))
elif(a-b+c+d==7):
    print("%d-%d+%d+%d=7" % (a, b, c, d))
elif(a-b-c+d==7):
    print("%d-%d-%d+%d=7" % (a, b, c, d))
elif(a-b-c-d==7):
    print("%d-%d-%d-%d=7" % (a, b, c, d))
elif(a-b+c-d==7):
    print("%d-%d+%d-%d=7" % (a, b, c, d))
Problem: p03545
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A,B,C,D = map(int,input())
rt = str(A)
for bt in (True, False):
  tmp=7-A
  for ct in (True, False):
    for dt in (True, False):
      tmp = tmp-B if bt else tmp+B
      tmp = tmp-C if ct else tmp+C
      tmp = tmp-D if dt else tmp+D
      if tmp == 0:
        rt+="+" if bt else "-"
        rt+=str(B)
        rt+="+" if ct else "-"
        rt+=str(C)
        rt+="+" if dt else "-"
        rt+=str(D)
        rt+="=7"

print(rt)

Failing test case input:
1802

Expected output:
1+8+0-2=7


Actual output:
1


Fixed submission (verdict: Accepted):
A,B,C,D = map(int,input())
tfs = []
rt = str(A)
for bt in (True, False):
  for ct in (True, False):
    for dt in (True, False):
      tfs.append([bt,ct,dt])
for bt,ct,dt in tfs:
  tmp=7-A
  tmp = tmp-B if bt else tmp+B
  tmp = tmp-C if ct else tmp+C
  tmp = tmp-D if dt else tmp+D
  if tmp == 0:
    rt+="+" if bt else "-"
    rt+=str(B)
    rt+="+" if ct else "-"
    rt+=str(C)
    rt+="+" if dt else "-"
    rt+=str(D)
    rt+="=7"
    break

print(rt)

Problem: p03545
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import itertools
A=input()
for i in list(itertools.product(range(2),repeat=3)):
  c=''
  c+=A[0]
  bns=int(A[0])
  for j in range(3):
    if i[j]==0:
      bns+=int(A[j+1])
      c+='+'+A[j+1]
    else:
      bns-=int(A[j+1])
      c+='-'+A[j+1]
  if bns==7:
    print(c)
    exit()

Failing test case input:
1152

Expected output:
1-1+5+2=7


Actual output:
1-1+5+2


Fixed submission (verdict: Accepted):
import itertools
A=input()
for i in list(itertools.product(range(2),repeat=3)):
  c=''
  c+=A[0]
  bns=int(A[0])
  for j in range(3):
    if i[j]==0:
      bns+=int(A[j+1])
      c+='+'+A[j+1]
    else:
      bns-=int(A[j+1])
      c+='-'+A[j+1]
  if bns==7:
    print(c+'=7')
    exit()

Problem: p03545
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input().rstrip()
op = ['+', '-', '*', '/']
for op1 in op:
    for op2 in op:
        for op3 in op:
            func = S[0] + op1 + S[1] + op2 + S[2] + op3 + S[3]
            res = 0
            try:
                res = eval(func)
            except:
                pass
            if res == 7:
                print(func + '=7')
                exit()


Failing test case input:
6120

Expected output:
6-1+2+0=7


Actual output:
6+1+2*0=7


Fixed submission (verdict: Accepted):
S = input().rstrip()
op = ['+', '-']
for op1 in op:
    for op2 in op:
        for op3 in op:
            res = 0
            try:
                func = S[0] + op1 + S[1] + op2 + S[2] + op3 + S[3]
                res = eval(func)
            except:
                pass
            if res == 7:
                print(func + '=7')
                exit()
Problem: p03545
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

a,b,c,d=list(input())
s="+-"

for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(a+s[i]+b+s[j]+c+s[k]+d)==7:
                print(eval(a+s[i]+b+s[j]+c+s[k]+d))

Failing test case input:
3242

Expected output:
3+2+4-2=7

Actual output:
7
7


Fixed submission (verdict: Accepted):

a,b,c,d=list(input())
s="+-"

for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(a+s[i]+b+s[j]+c+s[k]+d)==7:
                print(str(a+s[i]+b+s[j]+c+s[k]+d)+"=7")
                exit()

Problem: p03545
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,d = list(input())
sign = '+-'
for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(a+sign[i]+b+sign[j]+c+sign[k]+d) == 7:
                print(a+sign[i]+b+sign[j]+c+sign[k]+d + '==7')

Failing test case input:
3611

Expected output:
3+6-1-1=7


Actual output:
3+6-1-1==7


Fixed submission (verdict: Accepted):
a,b,c,d = list(input())
sign = '+-'
for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(a+sign[i]+b+sign[j]+c+sign[k]+d) == 7:
                print(str(a+sign[i]+b+sign[j]+c+sign[k]+d) + '=7')
                exit()

Problem: p03545
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
l = list(stdin.readline().rstrip())
s = [int(i) for i in l]
def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            print(f)
            exit()
    else:
        dfs(i+1, f + '+' + str(s[i]), sum + s[i])
        dfs(i+1, f + '-' + str(s[i]), sum - s[i])
dfs(0, str(s[0]), s[0])


Failing test case input:
2533

Expected output:
2+5+3-3=7


Actual output:
no output


Fixed submission (verdict: Accepted):
from sys import stdin
l = list(stdin.readline().rstrip())
s = [int(i) for i in l]
def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            print(f + '=7')
            exit()
    else:
        dfs(i+1, f + '+' + str(s[i+1]), sum + s[i+1])
        dfs(i+1, f + '-' + str(s[i+1]), sum - s[i+1])
dfs(0, str(s[0]), s[0])
Problem: p02595
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, D = map(int, input().split())
ans = 0
for i in range(N):
  X, Y = map(int, input().split())
  if X*X+Y*Y<=D:
    ans += 1
print(ans)

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

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
N, D = map(int, input().split())
ans = 0
for i in range(N):
  X, Y = map(int, input().split())
  if X*X+Y*Y<=D*D:
    ans += 1
print(ans)

Problem: p02595
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
n, d = map(int, input().split())
t = 0
for i in range(0,n-1):
  alis = list(map(int, input().split()))
  sss = math.sqrt(alis[0] ** 2 + alis[1] ** 2)
  if d >= sss:
    t += 1
    
print(t)


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

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
import math
n, d = map(int, input().split())
t = 0
for i in range(0,n):
  alis = list(map(int, input().split()))
  sss = math.sqrt(alis[0] ** 2 + alis[1] ** 2)
  if d >= sss:
    t += 1
    
print(t)

Problem: p02595
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

n, d = map(int, input().split())

count = 0

for i in range(n):
  x, y = map(int, input().split())
  if math.sqrt((x)**2 + (y)**2) <= d:
    count += 1
  else:
    break

print(count)

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

Expected output:
7


Actual output:
5


Fixed submission (verdict: Accepted):
import math

n, d = map(int, input().split())

count = 0

for i in range(n):
  x, y = map(int, input().split())
  if math.sqrt((x)**2 + (y)**2) <= d:
    count += 1

print(count)

Problem: p02595
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,d = [int(x) for x in input().split()]
x = []
y = []
for i in range(n):
  x1,y1 = [int(x) for x in input().split()]
  x.append(x1)
  y.append(y1)
c = 0
for i in range(n):
  s = x[i] ** 2 + y[i] ** 2
  if s < d ** 2:
    c += 1
print(c)

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

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n,d = [int(x) for x in input().split()]
x = []
y = []
for i in range(n):
  x1,y1 = [int(x) for x in input().split()]
  x.append(x1)
  y.append(y1)
c = 0
for i in range(n):
  s = x[i] ** 2 + y[i] ** 2
  if s <= d ** 2:
    c += 1
print(c)

Problem: p02595
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,d = map(int,input().split())
count = 0
for _ in range(n):
    x, y = map(int,input().split())
    if (x**2 + y**2)**(0.5) >= d:
        count += 1

print(count)

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

Expected output:
5


Actual output:
10


Fixed submission (verdict: Accepted):
n,d = map(int,input().split())
count = 0
for _ in range(n):
    x, y = map(int,input().split())
    if (x**2 + y**2)**(0.5) <= d:
        count += 1

print(count)
Problem: p02595
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

N,D = map(int,input().split())
cnt = 0
for n in range(N):
    a,b = map(int,input().split())
    if math.sqrt(a**2 + b**2)-D>=0:
        cnt+=1
print(cnt)

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

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import math

N,D = map(int,input().split())
cnt = 0
for n in range(N):
    a,b = map(int,input().split())
    if math.sqrt(a**2 + b**2)-D<=0:
        cnt+=1
print(cnt)

Problem: p02595
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,y=map(int,input().split())

res=0

for n in range(x):
    a,b=map(int,input().split())
    d=(a*a +b*b)**.5
    if d>=y:res+=1

print(res)

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

Expected output:
7

Actual output:
5


Fixed submission (verdict: Accepted):
x,y=map(int,input().split())

res=0

for n in range(x):
    a,b=map(int,input().split())
    d=(a*a +b*b)**.5
    if d<=y:res+=1

print(res)

Problem: p02595
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n, d = map(int, input().split())
ans = 0
for i in range(n):
    x, y = map(int, input().split())
    if x * x + y * y < d * d:
        ans += 1
print(ans)

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

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
n, d = map(int, input().split())
ans = 0
for i in range(n):
    x, y = map(int, input().split())
    if x * x + y * y <= d * d:
        ans += 1
print(ans)

Problem: p02595
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

n,d = map(int,input().split(' '))
x,y = [0]*n,[0]*n
for i in range(n):
  x[i],y[i] = map(int,input().split(' '))
  
ans = 0  
  
for i in range(n):
  distane = math.sqrt(x[i]*x[i] + y[i]*y[i])
  if distane >= d:
      ans += 1
print(ans)

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

Expected output:
3


Actual output:
10


Fixed submission (verdict: Accepted):
import math

n,d = map(int,input().split(' '))
x,y = [0]*n,[0]*n
for i in range(n):
  x[i],y[i] = map(int,input().split(' '))
  
ans = 0  
  
for i in range(n):
  distane = math.sqrt(x[i]*x[i] + y[i]*y[i])
  if distane <= d:
      ans += 1
print(ans)

Problem: p02595
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import sqrt
n,d = map(int,input().strip().split())
cnt = 0
for i in range(n):
	x,y = map(int,input().strip().split())
	if sqrt(x*x+y*y) >= d:
		cnt+=1
print(cnt)

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

Expected output:
8


Actual output:
4


Fixed submission (verdict: Accepted):
from math import sqrt
n,d = map(int,input().strip().split())
cnt = 0
for i in range(n):
	x,y = map(int,input().strip().split())
	
	if x*x+y*y <= d*d:
		
		cnt+=1
print(cnt)
Problem: p02909
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
weatherlist = ["Sunny", "Cloudy", "Rainy"]

weather = input().rstrip()
weathernum = weatherlist.index(weather)

tomorrownum = weathernum % 3

print(weatherlist[tomorrownum])

Failing test case input:
Rainy

Expected output:
Sunny

Actual output:
Rainy


Fixed submission (verdict: Accepted):
weatherlist = ["Sunny", "Cloudy", "Rainy"]
 
weather = input().rstrip()
weathernum = weatherlist.index(weather)
 
tomorrownum = (weathernum +1) % 3

print(weatherlist[tomorrownum])

Problem: p02909
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import random

w = input()

f = random.randint(0, 2)

if f == 0:
    print("Sunny")
elif f == 1:
    print("Cloudy")
elif f == 2:
    print("Rainy")

Failing test case input:
Sunny

Expected output:
Cloudy

Actual output:
Rainy


Fixed submission (verdict: Accepted):
import random

w = input()

if w == "Sunny":
    print("Cloudy")
elif w == "Cloudy":
    print("Rainy")
elif w == "Rainy":
    print("Sunny")

Problem: p02909
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()

if S == 'Sunny':
    print('cloudy')

elif S == 'cloudy':
    print('Rainy')

elif S == 'Rainy':
    print('Sunny')
    

Failing test case input:
Sunny

Expected output:
Cloudy

Actual output:
cloudy


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

if S == 'Sunny':
    print('Cloudy')

elif S == 'Cloudy':
    print('Rainy')

elif S =='Rainy':
    print('Sunny')

Problem: p02909
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

if s == "Suuny":
   print("Cloudy")
elif s == "Cloudy":
    print("Sunny")
elif s==("Rainy"):
    print("Suuny")

Failing test case input:
Sunny

Expected output:
Cloudy

Actual output:
no output


Fixed submission (verdict: Accepted):
s = input()
 
if s == 'Sunny':
    print('Cloudy')
if s == 'Cloudy':
    print('Rainy')
if s == 'Rainy':
    print('Sunny')

Problem: p02909
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
if(s == "Sunny"):
    print("Cloudy")

elif(s == "Cloudy"):
    print("Rainy")

else:
    print("Suuny")

Failing test case input:
Rainy

Expected output:
Sunny

Actual output:
Suuny


Fixed submission (verdict: Accepted):
s = input()
if(s == "Sunny"):
    print("Cloudy")

elif(s == "Cloudy"):
    print("Rainy")

else:
    print("Sunny")

Problem: p02909
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

if s == "Sunny":
	print("Cloudy")
elif s == "Cloudy":
	print("Rainy")
elif s == "Rainy":
	print("Rainy")

Failing test case input:
Rainy

Expected output:
Sunny

Actual output:
Rainy


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

if s == "Sunny":
	print("Cloudy")
elif s == "Cloudy":
	print("Rainy")
elif s == "Rainy":
	print("Sunny")

Problem: p02909
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
if S == "Sunny":
	print("Cloudy")
elif S == "Cloudy":
	print("Rainy")
else:
	print("Rainy")

Failing test case input:
Rainy

Expected output:
Sunny

Actual output:
Rainy


Fixed submission (verdict: Accepted):
S = input()
if S == "Sunny":
	print("Cloudy")
elif S == "Cloudy":
	print("Rainy")
else:
	print("Sunny")
Problem: p02909
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

W = [ "Sunny", "Cloudy", "Rainy" ]

S = input()

if S==W[0]:
  print(S[1])
elif S==W[1]:
  print(S[2])
else:
  print(S[0])



Failing test case input:
Sunny

Expected output:
Cloudy

Actual output:
u


Fixed submission (verdict: Accepted):
W = [ "Sunny", "Cloudy", "Rainy" ]
 
S = input()
 
if S==W[0]:
  print(W[1])
elif S==W[1]:
  print(W[2])
else:
  print(W[0])

Problem: p02909
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
t = input()
pred ={'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Cloudy'}
print(pred[t])

Failing test case input:
Rainy

Expected output:
Sunny

Actual output:
Cloudy


Fixed submission (verdict: Accepted):
t = input()
pred ={'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Sunny'}
print(pred[t])

Problem: p02909
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()[:1]
if s=='S':
    print('cloudy')
elif s=='C':
    print('Rainy')
else:
    print('Sunny')

Failing test case input:
Sunny

Expected output:
Cloudy

Actual output:
cloudy


Fixed submission (verdict: Accepted):
s=input()[:1]
if s=='S':
    print('Cloudy')
elif s=='C':
    print('Rainy')
else:
    print('Sunny')
Problem: p03944
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
w,h,n = map(int,input().split())
area = h*w
a1=0
a2=w
a3=0
a4=h
for i in range(n):
  x,y,a = map(int,input().split())
  if a ==1:
    a1 = max(a1,x)
  elif a ==2:
    a2 = min(a2,x)
  elif a ==3:
    a3 = max(a3,y)
  elif a==4:
    a4 = min(a4,y)

area -= a1*h + (w-a2)*h + a3*w + (h-a4)*w 
if area<=0:
  print(0)
else:
  print(area-(a1*(a3+(h-a4))+(10-a2)*(a3+(h-a4))))

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

Expected output:
16


Actual output:
12


Fixed submission (verdict: Accepted):
w,h,n = map(int,input().split())
area = h*w
a1=0
a2=w
a3=0
a4=h
for i in range(n):
  x,y,a = map(int,input().split())
  if a ==1:
    a1 = max(a1,x)
  elif a ==2:
    a2 = min(a2,x)
  elif a ==3:
    a3 = max(a3,y)
  elif a==4:
    a4 = min(a4,y)

if a1>=a2 or a3>=a4:
  print(0)
else:
  area -= a1*h + (w-a2)*h + a3*w + (h-a4)*w 
 
  print(area+(a1*(a3+(h-a4))+(w-a2)*(a3+(h-a4))))

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



def main()->None:
    W, H, N = map(int, input().split())
    range_N = range(N)
    xl, xr, yd, yu = 0, W, 0, H
    for i in range_N:
        x, y, a = map(int, input().split())
        if a == 1:
            xl = max(x, xl)
        if a == 2:
            xr = min(x, xr)
        if a == 3:
            yd = max(y, yd)
        else:
            yu = min(y, yu)
    if xl >= xr or yd >= yu:
        print(0)
    else:
        print((xr - xl) * (yu - yd))

if __name__ == "__main__":
    main()

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

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):



def main()->None:
    W, H, N = map(int, input().split())
    range_N = range(N)
    xl, xr, yd, yu = 0, W, 0, H
    for i in range_N:
        x, y, a = map(int, input().split())
        if a == 1:
            xl = max(x, xl)
        elif a == 2:
            xr = min(x, xr)
        elif a == 3:
            yd = max(y, yd)
        else:
            yu = min(y, yu)
    if xl >= xr or yd >= yu:
        print(0)
    else:
        print((xr - xl) * (yu - yd))

if __name__ == "__main__":
    main()