ZhenlongDai/ACPR huggingface dataset:
Problem: p03568
Buggy submission (Python (3.4.3), verdict: Wrong Answer):





from functools import reduce
from itertools import repeat


def multipler(x, y):
    return x*y

def hundred_or_one(l: list):
    return [True if x == 100 else False for x in l]
    

def check_odds(l :list):
    return [True if x % 2 == 0 else False for x in l]

def check_hun(l: list):
    return [True if x == 100 else False for x in l]

def main(num, data:list):
    
    hun_one = hundred_or_one(data)
    odds = check_odds(data)  
    huns = check_hun(data)

    basis = [2 if t else 3 for t in hun_one]
    remover = [2 if o else 1 for o in odds]

    remover_num = int(reduce(multipler, remover))
    
    

    basic_answer = reduce(multipler, basis)
    
    
    return basic_answer - remover_num

if __name__ == '__main__':
    
    
    num = int(input())
    data = input().split(" ")
    data = [int(i) for i in data]

    print(main(num, data))


Failing test case input:
10
105 100 11 98 114 7 6 43 114 120

Expected output:
58985


Actual output:
39302


Fixed submission (verdict: Accepted):





from functools import reduce
from itertools import repeat


def multipler(x, y):
    return x*y

def hundred_or_one(l: list):
    return [True if x == 100 else False for x in l]
    

def check_odds(l :list):
    return [True if x % 2 == 0 else False for x in l]

def check_hun(l: list):
    return [True if x == 100 else False for x in l]

def main(num, data:list):
    
    hun_one = hundred_or_one(data)
    odds = check_odds(data)  
    huns = check_hun(data)

    basis = [3 for t in hun_one]

    
    remover = [2 if o else 1 for o in odds]

    remover_num = int(reduce(multipler, remover))
    
    

    basic_answer = reduce(multipler, basis)
    
    
    return basic_answer - remover_num

if __name__ == '__main__':
    
    
    num = int(input())
    data = input().split(" ")
    data = [int(i) for i in data]

    print(main(num, data))

Problem: p03568
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
A=list(map(int,input().rstrip().split(' ')))
ans=1
for a in A:
  if(a%2==1):
    ans*=3
    
print(ans)

Failing test case input:
10
60 101 56 71 73 7 6 25 114 84

Expected output:
59017


Actual output:
243


Fixed submission (verdict: Accepted):
n=int(input())
A=list(map(int,input().rstrip().split(' ')))
Xans=1
for a in A:
  if(a%2==1):
    Xans*=1
  else:
    Xans*=2
    
print(3**n-Xans)
Problem: p03568
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

def resolve():
    N=int(input())
    t=3**N
    s=1
    f=0
    for a in pin():
        if a>1 and a%2:
            f=1
            s*=1
        else:
            s*=2

    print(t-s)

resolve()


Failing test case input:
3
0 8 -3

Expected output:
23


Actual output:
19


Fixed submission (verdict: Accepted):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

def resolve():
    N=int(input())
    t=3**N
    s=1
    f=0
    for a in pin():
        if  a%2:
            f=1
            s*=1
        else:
            s*=2

    print(t-s)

resolve()

Problem: p03568
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input().split()
x=1
for i in s:
 if(int(i)%2==0):
  x*=2
print(2**n-x)

Failing test case input:
10
0 010 2 0 0 0 0 -2 2 10

Expected output:
58025


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
s=input().split()
x=1
for i in s:
 if(int(i)%2==0):
  x*=2
print(3**n-x)

Problem: p03568
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def get_result(A):
    res = 1
    total = 1
    for i, ai in enumerate(A):
        res *= 2 if ai % 2 == 0 else 1
        total *= 3 if ai > 1 else 2
    return total - res
n = input()
A = [int(ai) for ai in input().split()]
print(get_result(A))

Failing test case input:
10
16 010 3 2 7 7 6 43 0 135

Expected output:
59017


Actual output:
39334


Fixed submission (verdict: Accepted):
def get_result(A):
    res = 1
    total = 3 ** len(A)
    for i, ai in enumerate(A):
        res *= 2 if ai % 2 == 0 else 1
    return total - res
n = input()
A = [int(ai) for ai in input().split()]
print(get_result(A))

Problem: p03568
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
An = list(map(int, input().split()))
odd = sum([1 for a in An if a % 2 != 0])
print(3**N - 2**odd)


Failing test case input:
3
3 3 3

Expected output:
26

Actual output:
19


Fixed submission (verdict: Accepted):
N = int(input())
An = list(map(int, input().split()))
even = sum([1 for a in An if a % 2 == 0])
print(3**N - 2**even)

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

cnt = 0
for i in range(n):
    if a[i] % 2 == 0:
        cnt += 1

x = 3 ** n - 2 ** cnt

print(x)

Failing test case input:
10
90 52 56 71 44 8 13 30 57 84

Expected output:
58921

Actual output:
[90, 52, 56, 71, 44, 8, 13, 30, 57, 84]
58921


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

cnt = 0
for i in range(n):
    if a[i] % 2 == 0:
        cnt += 1

x = 3 ** n - 2 ** cnt

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

even_num = 0

for i in range(N):
    if A[i]%2:
        even_num += 1

print(1*3**(N-1)*even_num+2*3**(N-1)*(N-even_num)-2**(N-even_num))

Failing test case input:
10
16 010 3 2 7 7 6 43 0 135

Expected output:
59017


Actual output:
295213


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

even_num = 0

for i in range(N):
    if A[i]%2==0:
        even_num += 1
print(3**N-2**even_num)

Problem: p03568
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = II()
    a = LI()
    ans = 3 ** n
    a = sum(map(lambda x: x & 1, a))
    na = n - a
    print(ans - 2 ** na * a)
    return



if __name__ == '__main__':
    solve()


Failing test case input:
10
60 101 94 98 114 7 6 27 114 120

Expected output:
58921


Actual output:
58665


Fixed submission (verdict: Accepted):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = II()
    a = LI()
    ans = 3 ** n
    a = sum(map(lambda x: x & 1, a))
    na = n - a
    print(ans - 2 ** na)
    return



if __name__ == '__main__':
    solve()
Problem: p03568
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
def readLine_int_list():return list(map(int, stdin.readline().split()))

n = int(input())
a = readLine_int_list()
even = [i for i in a if i%2 == 0]
e = len(even)
one = a.count(1)


if e == 0:
    if n == 1:
        print(2-one)
    else:
        print(n**3 - 1 - one)
else:
    print(3**n - (2**e) - one)

Failing test case input:
3
1 1 -4

Expected output:
25


Actual output:
23


Fixed submission (verdict: Accepted):
from sys import stdin
def readLine_int_list():return list(map(int, stdin.readline().split()))

n = int(input())
a = readLine_int_list()
even = [i for i in a if i%2 == 0]
e = len(even)

if e == 0:
    if n == 1:
        print(2)
    else:
        print(3**n - 1)
else:
    print(3**n - (2**e))

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



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

all_pair = 1
odd_pair = 1

for i in range(n):
    if a_inputs[i]==1:
        all_pair*=2
        odd_pair*=1
    else:
        if a_inputs[i]%2==0:
            odd_pair*=2
        else:
            odd_pair*=1
        all_pair*=3

print(all_pair-odd_pair)




Failing test case input:
3
1 0 -4

Expected output:
23


Actual output:
14


Fixed submission (verdict: Accepted):



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

all_pair = 1
odd_pair = 1

for i in range(n):
    if a_inputs[i]%2==0:
        odd_pair*=2
    else:
        odd_pair*=1
    all_pair*=3

print(all_pair-odd_pair)

Problem: p03568
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
kisuu = 0
for i in range(N):
  if A[i] % 2 == 0:
    kisuu += 2
print(2**N-kisuu)

Failing test case input:
10
16 010 3 98 7 7 6 43 0 135

Expected output:
59017


Actual output:
1014


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
kisuu = 1
for i in range(N):
  if A[i] % 2 == 0:
    kisuu *= 2
print(3**N-kisuu)

Problem: p03568
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def solve(n,a):
  even = 0
  
  for i in range(n):
    if a[i] % 2 == 1:
      even += 1
  
  return 3**n - 2**even
  
def main():
  N = int(input())
  a = list(map(int,input().split()))
  print(solve(N,a))

Failing test case input:
10
60 101 56 71 73 7 6 25 114 84

Expected output:
59017


Actual output:

Fixed submission (verdict: Accepted):
def solve(n,a):
  even = 0
  
  for i in range(n):
    if a[i] % 2 == 0:
      even += 1
  
  return 3**n - 2**even
  
def main():
  N = int(input())
  a = list(map(int,input().split()))
  print(solve(N,a))
  
main()
Problem: p03568
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split(" ")))
kisuu = 1
kake = 1
for i in a:
  if i != 1:
    kake *= 3
  else:
    kake *= 2
  if i % 2 == 0:
    kisuu *= 2
print(kake - kisuu)

Failing test case input:
10
-1 001 91 -1 0 -1 1 0 1 245

Expected output:
59045


Actual output:
17492


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split(" ")))
kisuu = 1
kake = 1
for i in a:
  kake *= 3
  if i % 2 == 0:
    kisuu *= 2
print(kake - kisuu)

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

ans = 1
for a in A:
    if a == 1:
        ans *= 2
    else:
        ans *= 3

odd = 1
for a in A:
    if a%2 == 0:
        odd *= 2

print(ans-odd)


Failing test case input:
3
1 1 -4

Expected output:
25


Actual output:
10


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

ans = 1
for a in A:
    
    
    
        ans *= 3

odd = 1
for a in A:
    if a%2 == 0:
        odd *= 2

print(ans-odd)
Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = list(map(int, input().split()))
s = input()
print(s.replace(s[K - 1], s[K - 1].lower()))

Failing test case input:
3 3
BBBA

Expected output:
BBbA


Actual output:
bbbA


Fixed submission (verdict: Accepted):
N, K = list(map(int, input().split()))
S = list(input())
S[K - 1] = S[K - 1].lower()
print("".join(S))

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



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


s = list(input())

a = s[k:k+1]

a = ','.join(a)

a = a.lower()

s[k:k+1] = a

print(s)

Failing test case input:
2 4
ABBC

Expected output:
ABBc


Actual output:
A, B, B, C

Fixed submission (verdict: Accepted):



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

s = list(input())


a = s[k-1:k]

a = ','.join(a)

a = a.lower()

s[k-1:k] = a

s = ''.join(s)

print("{}".format(s))

Problem: p03041
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = list(map(int, input().split()))
S = input()
print(S.replace(S[K - 1], S[K - 1].lower()))


Failing test case input:
6 3
CAC

Expected output:
CAc


Actual output:
cAc


Fixed submission (verdict: Accepted):
N, K = list(map(int, input().split()))
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K:])

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
s=str(input())


print(s.replace(s[k-1],s[k-1].lower()))

Failing test case input:
1 4
FABA

Expected output:
FABa


Actual output:
FaBa


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

y=s[:k-1]+s[k-1].lower()+s[k:]

print(y)

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
s = str(input())
ans = ''
for i in range(len(s)):
  if i == k:
    ans = ans + s[i].lower()
  else:
    ans = ans + s[i]
print (ans)

Failing test case input:
9 1
BAB

Expected output:
bAB


Actual output:
BaB


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
s = str(input())
ans = ''
for i in range(len(s)):
  if i == k-1:
    ans = ans + s[i].lower()
  else:
    ans = ans + s[i]
print (ans)

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
s=input()
print(s.replace(s[k-1],s[k-1].lower()))

Failing test case input:
1 4
EABA

Expected output:
EABa


Actual output:
EaBa


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
s=input()
print(s[:k-1]+s[k-1].lower()+s[k:])

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def character(n,k,s):
    res = str(s).replace(s[k-1],s[k-1].lower())
    return res
n,k = map(int, input().split())
s = input()
print(character(n,k,s))

Failing test case input:
9 1
BAB

Expected output:
bAB


Actual output:
bAb


Fixed submission (verdict: Accepted):
def character(n,k,s):
    res = s[:k-1] + s[k-1].lower() + s[k:]
    return res
n,k = map(int, input().split())
s = input()
print(character(n,k,s))
Problem: p03041
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import copy
n,k=map(int,input().split())

s=list(input())

print(s[0:k-1],end='')
print(s[k-1].lower(),end='')
print(s[k:],end='')

Failing test case input:
4 1
BAAC

Expected output:
bAAC


Actual output:
[]b['A', 'A', 'C']

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

s=str(input())

print(s[0:k-1],end='')
print(s[k-1].lower(),end='')
print(s[k:],end='')

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
p,q = input().split()
q_ = int(q) -1 
n = input()
x = n.replace(n[q_], n[q_].lower(), 1)
print(x)

Failing test case input:
2 4
ABBB

Expected output:
ABBb


Actual output:
AbBB


Fixed submission (verdict: Accepted):
p,q = input().split()
q_ = int(q) 
n = input()

print(n[:q_-1] + n[q_-1].lower() + n[q_:])

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=map(int, input().split())
S=input()
S=S.replace(S[K-1], chr(ord(S[K-1])+32))
print(S)

Failing test case input:
1 4
EABB

Expected output:
EABb


Actual output:
EAbb


Fixed submission (verdict: Accepted):
N,K=map(int, input().split())
S=list(input())
S[K-1]=S[K-1].lower()
print("".join(S))

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
s = str(input())
print(s.replace(s[k-1],s[k-1].lower()))

Failing test case input:
3 2
ACC

Expected output:
AcC


Actual output:
Acc


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
s = str(input())
b = s[k-1].lower()
print(s[:k-1]+b+s[k:])

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


def main():

    N, K = [int(x) for x in sys.stdin.readline().rstrip().split()]
    S = list(sys.stdin.readline().rstrip())

    S_new = []
    for i, s in enumerate(S):
        if i + 1 == K:
            s = s.lower()
        S_new.append(s)

    print(S_new)


if __name__ == "__main__":
    main()

Failing test case input:
1 4
EABA

Expected output:
EABa


Actual output:
E, A, B, a

Fixed submission (verdict: Accepted):
import sys


def main():

    N, K = [int(x) for x in sys.stdin.readline().rstrip().split()]
    S = list(sys.stdin.readline().rstrip())

    S_new = []
    for i, s in enumerate(S):
        if i + 1 == K:
            s = s.lower()
        S_new.append(s)

    print("".join(S_new))


if __name__ == "__main__":
    main()

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



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


s = list(input())

a = s[k:k+1]

a = ','.join(a)

a = a.lower()

s[k:k+1] = a

s = ','.join(s)
print(s)



Failing test case input:
9 4
BBAC

Expected output:
BBAc


Actual output:
B,B,A,C


Fixed submission (verdict: Accepted):



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

s = list(input())


a = s[k-1:k]

a = ','.join(a)

a = a.lower()

s[k-1:k] = a

s = ''.join(s)

print("{}".format(s))
Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
s = input()
t = s[k-1]
ans = s[:k-1] + t.lower() + s[k:]


Failing test case input:
0 1
D@BA

Expected output:
d@BA


Actual output:

Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
s = input()
t = s[k-1]
ans = s[:k-1] + t.lower() + s[k:]
print(ans)

Problem: p03041
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a,b=map(int,input().split())
s=input()
print(s.replace(s[b-1],s[b-1].lower()))

Failing test case input:
5 1
BBE@

Expected output:
bBE@


Actual output:
bbE@


Fixed submission (verdict: Accepted):
a,b=map(int,input().split())
s=list(input())
s[b-1]=s[b-1].lower()
print("".join(s))

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inputstr1 = input().split()
n = inputstr1[0]
k = inputstr1[1]
s = input()
s_list = list(s)
s_list[int(k) - 1] = s_list[int(k)-1].lower()
s = "".join(s_list)
print("S:"+s)


Failing test case input:
9 1
BBAE

Expected output:
bBAE


Actual output:
S:bBAE


Fixed submission (verdict: Accepted):
inputstr1 = input().split()
n = inputstr1[0]
k = inputstr1[1]
s = input()
s_list = list(s)
s_list[int(k) - 1] = s_list[int(k)-1].lower()
s = "".join(s_list)
print(s)

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split());s=input();print(s[k-1].lower())

Failing test case input:
4 1
ABAB

Expected output:
aBAB


Actual output:
a


Fixed submission (verdict: Accepted):
n,k=map(int,input().split());s=input();print(s[:k-1]+s[k-1].lower()+s[k:])

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input().split()
b = input()
 
list = list(b)
 
for i in list:
  if i == int(a[1]) - 1:
    list[i] = list[i].lower()
    
print(''.join(list))

Failing test case input:
9 2
ABB

Expected output:
AbB


Actual output:
ABB


Fixed submission (verdict: Accepted):
a = input().split()
b = input()
 
c = list(b)
 
for i in range(len(c)):
  if i == int(a[1]) - 1:
    c[i] = c[i].lower()
    
print(''.join(c))

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

S[K-1]=S[K-1].lower()

print(S)

Failing test case input:
9 2
ABB

Expected output:
AbB


Actual output:
A, b, B

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

S[K-1]=S[K-1].lower()

for i in S:
    ANS+=i

print(ANS)

Problem: p03041
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N , K = map(int,input().split())
str_t = list(input())
ans =''
for i in range(len(str_t)):
    if i == K:
        ans += str_t[i].lower()
    else:
        ans += str_t[i].upper()
print(ans)

Failing test case input:
-1 2
BB@E

Expected output:
Bb@E


Actual output:
BB@E


Fixed submission (verdict: Accepted):
N , K = map(int,input().split())
str_t = list(input())
ans =''
K = K-1
for i in range(len(str_t)):
    if i == K:
        ans += str_t[i].lower()
    else:
        ans += str_t[i].upper()
print(ans)
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1



for line in lines:
    x,y,z = map(int, line)
    drop(1,1,1)

n = 0
m = 0
for f in field:
    for e in f:
        if e > m:
            m = e
        if e==0:
            n+=1

print(n)
print(m)



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

Expected output:
62
4


Actual output:
95
6


Fixed submission (verdict: Accepted):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1



for line in lines:
    x,y,z = map(int, line)
    drop(x,y,z)

n = 0
m = 0
for f in field:
    for e in f:
        if e > m:
            m = e
        if e==0:
            n+=1

print(n)
print(m)
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
import sys

paper = [[0] * 10 for i in range(10)]

for line in sys.stdin:
    x,y,s = map(int,line.split(','))
    for i in range(10):
        for j in range(10):
            if s == 1:
                if abs(i - y) + abs(j - x) <= 1:
                    paper [i] [j] += 1
            if s == 2:
                if abs(i - y) <= 1 and abs(j - x) <= 1:
                    paper [i] [j] += 1
            if s == 3:
                if abs(i - y) + abs(j - x) <= 2:
                    paper [i] [j] += 1

ans = [0,0]
for i in range(10):
    for j in range(10):
        if paper [i] [j] == 0:
            ans [0] += 1
        if paper [i] [j] > ans [1]:
            ans [1] = paper [i] [j]

print(ans [0],ans [1])

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

Expected output:
69
4


Actual output:
69 4


Fixed submission (verdict: Accepted):
paper = [[0] * 10 for i in range(10)]

while True:
    try:
        x,y,s = map(int,input().split(','))
    except:
        break
    if s == 1:
        for i in range(10):
            for j in range(10):
                if abs(x - i) + abs(y - j) <= 1:
                    paper [i] [j] += 1
    elif s == 2:
        for i in range(10):
            for j in range(10):
                if abs(x - i) <= 1 and abs(y - j) <= 1:
                    paper [i] [j] += 1
    else:
        for i in range(10):
            for j in range(10):
                if abs(x - i) + abs(y - j) <= 2:
                    paper [i] [j] += 1

ls = sum(paper,[])
print(ls.count(0))
print(max(ls))
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
a = [[0] * 14 for _ in range(14)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    x += 2
    y += 2
    for d in [(0, 0), (0, -1), (0, 1), (-1, 0), (1, 0)]:
        a[x + d[0]][y + d[1]] += 1
    if s >= 2:
        for d in [(1, 1), (1, -1), (-1, 1), (-1, -1)]:
            a[x + d[0]][y + d[1]] += 1
    if s == 3:
        for d in [(0, 2), (0, -2), (2, 0), (-2, 0)]:
            a[x + d[0]][y + d[1]] += 1
print(sum(a[i][2:12].count(0) for i in range(2, 12)))
print(max(max(a[i][2:12]) for i in range(2, 12)))
print(a)

Failing test case input:
2,5,3
3,6,1
2,4,2
4,6,2
3,7,3
1,4,1

Expected output:
73
5


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


Fixed submission (verdict: Accepted):
a = [[0] * 14 for _ in range(14)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    x += 2
    y += 2
    for d in [(0, 0), (0, -1), (0, 1), (-1, 0), (1, 0)]:
        a[x + d[0]][y + d[1]] += 1
    if s >= 2:
        for d in [(1, 1), (1, -1), (-1, 1), (-1, -1)]:
            a[x + d[0]][y + d[1]] += 1
    if s == 3:
        for d in [(0, 2), (0, -2), (2, 0), (-2, 0)]:
            a[x + d[0]][y + d[1]] += 1
print(sum(a[i][2:12].count(0) for i in range(2, 12)))
print(max(max(a[i][2:12]) for i in range(2, 12)))
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
import sys
n1 = [[0, 1], [1, 0], [-1, 0], [0, -1]]
n2 = n1 + [[a, b] for a in [-1, 1] for b in [-1, 1]]
n3 = n2 + [[a*2, b*2] for a, b in n1]
mas = [[0]*10 for i in range(10)]
for i in sys.stdin:
    try:
        x, y, a = list(map(int, i.split(",")))
        mas[y][x] += 1
        for j in eval("n"+str(a)):
            try:
                mas[y+j[1]][x+j[0]] += 1
            except IndexError:
                continue
    except:
        break
print(len([i for x in mas for i in x if not i]))
print(max([max(v) for v in mas]))

Failing test case input:
1,5,2
1,6,3
3,4,1
4,5,3
3,7,3
2,3,2

Expected output:
63
3


Actual output:
62
3


Fixed submission (verdict: Accepted):
import sys
n1 = [[0, 1], [1, 0], [-1, 0], [0, -1]]
n2 = n1 + [[a, b] for a in [-1, 1] for b in [-1, 1]]
n3 = n2 + [[a*2, b*2] for a, b in n1]
mas = [[0]*10 for i in range(10)]
for i in sys.stdin:
    try:
        x, y, a = list(map(int, i.split(",")))
        mas[y][x] += 1
        for k,l in eval("n"+str(a)):
            try:
                if y+l >= 0 and x+k >= 0:
                    mas[y+l][x+k] += 1
            except IndexError:
                continue
    except ValueError:
        break
print(len([i for x in mas for i in x if not i]))
print(max([max(v) for v in mas]))
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
A=[[int(0) for i in range(10)]for j in range(10)]
count=0
while 1:
    try:
        x,y,s = map(int, input().split(','))
        if s==1:
            for i in range(x-1,x+1):
                if i>=0 and i<=9:
                    A[i][y]=A[i][y]+1
            for i in range(y-1,y+1):
                if i>=0 and i<=9:
                    A[x][i]=A[x][i]+1
            A[x][y]=A[x][y]-1                    
        elif s==2:
            for i in range(x-1,x+1):
                for j in range(y-1,y+1):
                    if i>=0 and i<=9 and j>=0 and j<=9:
                        A[i][j]=A[i][j]+1
        else:
            for i in range(x-2,x+2):
                if i>=0 and i<=9:
                    A[i][y]=A[i][y]+1
            for i in range(y-2,y+2):
                if i>=0 and i<=9:
                    A[x][i]=A[x][i]+1
            for i in range(x-1,x+1):
                if i>=0 and i<=9:
                    A[i][y]=A[i][y]-1
            for i in range(y-1,y+1):
                if i>=0 and i<=9:
                    A[x][i]=A[x][i]-1
            for i in range(x-1,x+1):
                for j in range(y-1,y+1):
                    if i>=0 and i<=9 and j>=0 and j<=9:
                        A[i][j]=A[i][j]+1
    except EOFError:
        break
        
for i in range(10):
    for j in range(10):
        if A[i][j]==0:
            count=count+1
print(count)
print(max(A))

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

Expected output:
71
3


Actual output:
80
[0, 1, 1, 0, 1, 1, 1, 0, 0, 0]


Fixed submission (verdict: Accepted):
A=[[int(0) for i in range(10)]for j in range(10)]
count=0
while 1:
    try:
        x,y,s = map(int, input().split(','))
        if s==1:
            for i in range(x-1,x+2):
                if i>=0 and i<=9:
                    A[i][y]=A[i][y]+1
            for i in range(y-1,y+2):
                if i>=0 and i<=9:
                    A[x][i]=A[x][i]+1
            A[x][y]=A[x][y]-1 
        elif s==2:
            for i in range(x-1,x+2):
                for j in range(y-1,y+2):
                    if i>=0 and i<=9 and j>=0 and j<=9:
                        A[i][j]=A[i][j]+1
        else:
            for i in range(x-2,x+3):
                if i>=0 and i<=9:
                    A[i][y]=A[i][y]+1
            for i in range(y-2,y+3):
                if i>=0 and i<=9:
                    A[x][i]=A[x][i]+1
            for i in range(x-1,x+2):
                if i>=0 and i<=9:
                    A[i][y]=A[i][y]-1
            for i in range(y-1,y+2):
                if i>=0 and i<=9:
                    A[x][i]=A[x][i]-1
            for i in range(x-1,x+2):
                for j in range(y-1,y+2):
                    if i>=0 and i<=9 and j>=0 and j<=9:
                        A[i][j]=A[i][j]+1
    except:
        break
num=0
for i in range(10):
    for j in range(10):
        if A[i][j]==0:
            count=count+1
        if A[i][j]!=0:
            if num<A[i][j]:
                num=A[i][j]
print(count)
print(num)
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1





Failing test case input:
1,5,2
3,6,1
1,3,3
3,5,3
3,7,3
2,5,1

Expected output:
67
5


Actual output:

Fixed submission (verdict: Accepted):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1



for line in lines:
    x,y,z = map(int, line)
    drop(x,y,z)

n = 0
m = 0
for f in field:
    for e in f:
        if e > m:
            m = e
        if e==0:
            n+=1

print(n)
print(m)
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1



for line in lines:
    x,y,z = map(int, line)
    

n = 0
m = 0
for f in field:
    for e in f:
        if e > m:
            m = e
        if e==0:
            n+=1

print(n)
print(m)



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

Expected output:
75
4


Actual output:
100
0


Fixed submission (verdict: Accepted):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1



for line in lines:
    x,y,z = map(int, line)
    drop(x,y,z)

n = 0
m = 0
for f in field:
    for e in f:
        if e > m:
            m = e
        if e==0:
            n+=1

print(n)
print(m)
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
t = [[0 for i in range(10)] for j in range(10)]
case1 = [(0, 0), (0, -1), (1, 0), (0, 1), (-1, 0)]
case2 = [(1, -1), (1, 1), (-1, 1), (-1, -1)]
case3 = [(0, -2), (2, 0), (0, 2), (-2, 0)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    for c in [case1, case2, case3][:s]:
        for _x, _y in c:
            try:
                t[y+_y][x+_x] += 1
            except IndexError:
                continue
print(sum(1 for l in t for v in l if not v))
print(max(v for l in t for v in l))

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

Expected output:
70
4


Actual output:
69
4


Fixed submission (verdict: Accepted):
t = [[0 for i in range(10)] for j in range(10)]
case1 = [(0, 0), (0, -1), (1, 0), (0, 1), (-1, 0)]
case2 = [(1, -1), (1, 1), (-1, 1), (-1, -1)]
case3 = [(0, -2), (2, 0), (0, 2), (-2, 0)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    for c in [case1, case2, case3][:s]:
        for _x, _y in c:
            if y+_y < 0 or x+_x < 0:
                continue
            try:
                t[y+_y][x+_x] += 1
            except IndexError:
                continue

print(sum(1 for l in t for v in l if not v))
print(max(v for l in t for v in l))

Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1



for line in lines:
    x,y,z = map(int, line)
    drop(1,1,1)



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

Expected output:
76
5


Actual output:

Fixed submission (verdict: Accepted):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1



for line in lines:
    x,y,z = map(int, line)
    drop(x,y,z)

n = 0
m = 0
for f in field:
    for e in f:
        if e > m:
            m = e
        if e==0:
            n+=1

print(n)
print(m)
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
import sys
n1 = [[0, 1], [1, 0], [-1, 0], [0, -1]]
n2 = n1 + [[a, b] for a in [-1, 1] for b in [-1, 1]]
n3 = n2 + [[a*2, b*2] for a, b in n1]
mas = [[0]*10 for i in range(10)]
for i in sys.stdin:
    try:
        x, y, a = list(map(int, i.split(",")))
        mas[y][x] += 1
        for k,l in eval("n"+str(a)):
            try:
                if y+l>= 0 and x+k >= 0:
                    mas[y+l][x+k] += 1
            except IndexError:
                continue
    except ValueError:
        break
print(mas)
print(len([i for x in mas for i in x if not i]))
print(max([max(v) for v in mas]))

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

Expected output:
73
4


Actual output:
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 1, 1, 0, 1, 1, 1, 0, 0], [1, 2, 3, 2, 1, 1, 1, 1, 0, 0], [0, 2, 3, 4, 2, 1, 1, 1, 0, 0], [0, 0, 3, 3, 3, 0, 0, 0, 0, 0], [0, 0, 1, 2, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
73
4


Fixed submission (verdict: Accepted):
import sys
n1 = [[0, 1], [1, 0], [-1, 0], [0, -1]]
n2 = n1 + [[a, b] for a in [-1, 1] for b in [-1, 1]]
n3 = n2 + [[a*2, b*2] for a, b in n1]
mas = [[0]*10 for i in range(10)]
for i in sys.stdin:
    try:
        x, y, a = list(map(int, i.split(",")))
        mas[y][x] += 1
        for k,l in eval("n"+str(a)):
            try:
                if y+l >= 0 and x+k >= 0:
                    mas[y+l][x+k] += 1
            except IndexError:
                continue
    except ValueError:
        break
print(len([i for x in mas for i in x if not i]))
print(max([max(v) for v in mas]))
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
paper = [0 for i in range(100)]
white_points = None
deep_points = None

def small(x, y):
    p = [[x, y]]
    for i, j in zip([-1, 0, 1, 0], [0, -1, 0, 1]):
        p.append([x + i, y + j])
    return p

def middle(x, y):
    p = small(x, y)
    for i, j in zip([1, -1, 1, -1], [1, 1, -1, -1]):
        p.append([x + i, y + j])
    return p

def big(x, y):
    p = middle(x, y)
    for i, j in zip([-2, 0, 2, 0], [0, -2, 0, 2]):
        p.append([x + i, y + j])
    return p

while True:
    try:
        x, y, size = map(int, input().split(','))
    except:
        print(paper.count(0))
        print(max(paper))
        break

    if size == 1:
        bp = small(x, y)
    elif size == 2:
        bp = middle(x, y)
    elif size == 3:
        bp = big(x, y)
    for p in bp:
        if not 0 <= p[1] * 10 + p[0] <= 99: continue
        paper[p[1] * 10 + p[0]] += 1

Failing test case input:
1,5,2
3,6,1
1,4,3
4,5,3
3,7,3
2,4,1

Expected output:
67
4


Actual output:
66
4


Fixed submission (verdict: Accepted):


paper = [[0] * 10 for i in range(10)]

def small(x, y):
    p = [[x, y]]
    for i, j in zip([-1, 0, 1, 0], [0, -1, 0, 1]):
        p.append([x + i, y + j])
    return p

def middle(x, y):
    p = small(x, y)
    for i, j in zip([1, -1, 1, -1], [1, 1, -1, -1]):
        p.append([x + i, y + j])
    return p

def big(x, y):
    p = middle(x, y)
    for i, j in zip([-2, 0, 2, 0], [0, -2, 0, 2]):
        p.append([x + i, y + j])
    return p

while True:
    try:
        x, y, size = map(int, input().split(','))
    except:
        break

    if size == 1:
        bp = small(x, y)
    elif size == 2:
        bp = middle(x, y)
    elif size == 3:
        bp = big(x, y)
    for p in bp:
        if 0 <= p[0] < 10 and 0 <= p[1] < 10:
            paper[p[1]][p[0]] += 1

print(sum(paper[y][x] == 0 for y in range(10) for x in range(10)))
print(max(paper[y][x] for y in range(10) for x in range(10)))
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
t = [[0 for i in range(10)] for j in range(10)]
case1 = [(0, 0), (0, -1), (1, 0), (0, 1), (-1, 0)]
case2 = [(1, -1), (1, 1), (-1, 1), (-1, -1)]
case3 = [(0, -2), (2, 0), (0, 2), (-2, 0)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    for c in [case1, case2, case3][:s]:
        for _x, _y in c:
            try:
                t[x+_x][y+_y] += 1
            except IndexError:
                continue
print(sum(1 for l in t for v in l if not v))
print(max(v for l in t for v in l))

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

Expected output:
73
4


Actual output:
72
4


Fixed submission (verdict: Accepted):
t = [[0 for i in range(10)] for j in range(10)]
case1 = [(0, 0), (0, -1), (1, 0), (0, 1), (-1, 0)]
case2 = [(1, -1), (1, 1), (-1, 1), (-1, -1)]
case3 = [(0, -2), (2, 0), (0, 2), (-2, 0)]
while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break
    for c in [case1, case2, case3][:s]:
        for _x, _y in c:
            if y+_y < 0 or x+_x < 0:
                continue
            try:
                t[y+_y][x+_x] += 1
            except IndexError:
                continue

print(sum(1 for l in t for v in l if not v))
print(max(v for l in t for v in l))
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
d = [[0] * 10 for i in range(10)]

def b(x, y):
    for i in range(x - 2, x + 3):
        a = 3 - abs(x - i)
        for a in range(y - a + 1, y + a):
            if 0 <= i < 10 and 0 <= a < 10:
                d[a][i] += 1


def m(x, y):
    for i in range(x - 1, x + 2):
        for j in range(y - 1, y + 2):
            if 0 <= i < 10 and 0 <= j < 10:
                d[j][i] += 1


def s(x, y):
    r = (1, 0)
    for i in range(x - 1, x + 2):
        a = abs(x - i)
        for j in range(y - r[a], y + r[a] + 1):
            if 0 <= i < 10 and 0 <= j < 10:
                d[j][i] += 1

while 1:
    try:
        f = (None, s, m, b)
        x, y, size = list(map(int, input().split(',')))
        f[size](x, y)

    except:
        break


r1 = r2 = 0
for i in range(10):
    for j in range(10):
        r1 += 1 if d[i][j] == 0 else 0
        r2 = max(r2, d[i][j])

print(r1, r2)

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

Expected output:
69
5


Actual output:
69 5


Fixed submission (verdict: Accepted):
d = [[0] * 10 for i in range(10)]

def b(x, y):
    for i in range(x - 2, x + 3):
        a = 3 - abs(x - i)
        for a in range(y - a + 1, y + a):
            if 0 <= i < 10 and 0 <= a < 10:
                d[a][i] += 1


def m(x, y):
    for i in range(x - 1, x + 2):
        for j in range(y - 1, y + 2):
            if 0 <= i < 10 and 0 <= j < 10:
                d[j][i] += 1


def s(x, y):
    r = (1, 0)
    for i in range(x - 1, x + 2):
        a = abs(x - i)
        for j in range(y - r[a], y + r[a] + 1):
            if 0 <= i < 10 and 0 <= j < 10:
                d[j][i] += 1

while 1:
    try:
        f = (None, s, m, b)
        x, y, size = list(map(int, input().split(',')))
        f[size](x, y)
    except:
        break


r1 = r2 = 0
for i in range(10):
    for j in range(10):
        r1 += 1 if d[i][j] == 0 else 0
        r2 = max(r2, d[i][j])

print(r1)
print(r2)
Problem: p00026
Buggy submission (Python3, verdict: Wrong Answer):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=10 and 0<=x+i<=10:
                    field[y+j][x+i] += 1

drop(1,1,1)



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

Expected output:
74
4


Actual output:

Fixed submission (verdict: Accepted):
import sys

lines = []
for line in sys.stdin:
    lines.append(line.strip().split(','))

field = [[0 for i in range(10)] for j in range(10)]

def drop(x, y, z):
    if z==1:
        for i in range(-1,2):
            for j in range(-1,2):
                if abs(i)+abs(j)<2 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    elif z==2:
        for i in range(-1,2):
            for j in range(-1,2):
                if 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1
    else:
        for i in range(-2,3):
            for j in range(-2,3):
                if abs(i)+abs(j)<3 and 0<=y+j<=9 and 0<=x+i<=9:
                    field[y+j][x+i] += 1



for line in lines:
    x,y,z = map(int, line)
    drop(x,y,z)

n = 0
m = 0
for f in field:
    for e in f:
        if e > m:
            m = e
        if e==0:
            n+=1

print(n)
print(m)

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

board=[[0]*10 for i in range(10)]
ink=[[[0,0,0,0,0],[0,0,1,0,0],[0,1,1,1,0],[0,0,1,0,0],[0,0,0,0,0]],
[[0,0,0,0,0],[0,1,1,1,0],[0,1,1,1,0],[0,1,1,1,0],[0,0,0,0,0]],
[[0,0,1,0,0],[0,1,1,1,0],[1,1,1,1,1],[0,1,1,1,0],[0,0,1,0,0]]]

while True:
    try:
        x,y,s=map(int,input().split(","))
    except:
        break
    for i in range(5):
        for j in range(5):
            if 0<=i+y-2<=9 and 0<=j+x-2<=9:
                board[i+y-2][j+x-2]+=ink[s-1][i][j]

flat=sum(board,[])
print(flat.count(0))
print(flat.count(max(flat)))

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

Expected output:
77
5

Actual output:
77
2


Fixed submission (verdict: Accepted):

board=[[0]*10 for i in range(10)]
ink=[[[0,0,0,0,0],[0,0,1,0,0],[0,1,1,1,0],[0,0,1,0,0],[0,0,0,0,0]],
[[0,0,0,0,0],[0,1,1,1,0],[0,1,1,1,0],[0,1,1,1,0],[0,0,0,0,0]],
[[0,0,1,0,0],[0,1,1,1,0],[1,1,1,1,1],[0,1,1,1,0],[0,0,1,0,0]]]

while True:
    try:
        x,y,s=map(int,input().split(","))
    except:
        break
    for i in range(5):
        for j in range(5):
            if 0<=i+y-2<=9 and 0<=j+x-2<=9:
                board[i+y-2][j+x-2]+=ink[s-1][i][j]
    
flat=sum(board,[])
print(flat.count(0))
print(max(flat))