Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
A = 0
B = 0
C = 0

if a == 1:
  	A = 1

if b == 1:
  	B = 1

if c == 1:
  	C = 1

print(A+B+C)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
if a == 1:
  	A = 1
else:
  	A = 0
if b == 1:
  	B = 1
else:
  	B = 0
if c == 1:
  	C = 1
else:
  	C = 0
print(A+B+C)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
if a == 1:
  A = 1
else:
  A = 0
if b == 1:
  B = 1
else:
  B = 0
if c == 1:
  C = 1
else:
  C = 0
print(A+B+C)
Problem p03494 (python)

Fixed submission:
N = input()
A = list(map(int, input().split()))
cnt = 0
while all(a%2==0 for a in A):
    A = [a/2 for a in A]
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
cnt = 0
while all(a%2==0 for a in A):
  	A = [a/2 for a in A]
    cnt += 1
print(cnt)
Problem p03545 (python)

Fixed submission:
n = input()
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
  op = ['-'] * op_cnt#['-', '-', '-']
  for j in range(op_cnt):
    if ((i >> j) & 1):
      op[-1-j] = '+'
  formula = ''
  for p_n, p_o in zip(n, op + ['']):#(1,+),(2,+),(3,+),(4,'')
    formula += (p_n + p_o)
  if eval(formula) == 7:#'1+2+3+4'
    print(formula + '=7')
    break

Buggy submission (verdict: Runtime Error):
n = input()
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
  op = ['-'] * op_cnt#['-', '-', '-']
  for j in range(op_cnt):
    if ((i >> j) & 1):
      op[-1-j] = '+'
      formula = ''
  for p_n, p_o in zip(n, op + ['']):#(1,+),(2,+),(3,+),(4,'')
    formula += (p_n + p_o)
  if eval(formula) == 7:#'1+2+3+4'
    print(formula + '=7')
    break

Buggy submission (verdict: Runtime Error):
n = [int(x) for x in input()]
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
	op = ['-'] * op_cnt#['-', '-', '-']
    for j in range(op_cnt):
      if ((i >> j) & 1):
        op[-1-j] = '+'
    formula = ''
    for p_n, p_o in zip(n, op + ['']):#(1,+),(2,+),(3,+),(4,'')
      formula += (p_n + p_o)
    if eval(formula) == 7:#'1+2+3+4'
      print(formula + '=7')
      break
Problem p03844 (python)

Fixed submission:
s = raw_input()
print eval(s)

Buggy submission (verdict: Runtime Error):
_ = raw_input()
tests = [int(test) for test in raw_input().split(" ")]
total_time = sum(tests)
drinks = raw_input()
for _ in range(drinks):
    i = raw_input().split(" ")
    no, time = i[0], i[1]
    print total_time - (tests[no] - time)
Problem p03845 (python)

Fixed submission:
_ = raw_input()
tests = [int(test) for test in raw_input().split(" ")]
total_time = sum(tests)
drinks = int(raw_input())
for _ in range(drinks):
    i = [int(x) for x in raw_input().split(" ")]
    no, time = i[0], i[1]
    print total_time - (tests[no - 1] - time)

Buggy submission (verdict: Runtime Error):
_ = raw_input()
tests = [int(test) for test in raw_input().split(" ")]
total_time = sum(tests)
drinks = raw_input()
for _ in range(drinks):
    i = raw_input().split(" ")
    no, time = i[0], i[1]
    print total_time - (tests[no - 1] - time)
Problem p02730 (python)

Fixed submission:
s=input()
n=len(s)
x=n//2
a=s[0:x]
b=s[x+1:]
if a==b:print('Yes')
else:print('No')

Buggy submission (verdict: Runtime Error):
n=len(s)
x=n//2
a=s[0:x]
b=s[x+1:]
if a==b:print('Yes')
else:print('No')
Problem p02898 (python)

Fixed submission:
n, k = map(int, input().split())
lst = [int(i) for i in input().split()]
print(len([j for j in lst if j >= k]))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
lst=[k<h int(h) for h in input().split()]
x=len(lst)
print(x)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
print=(len.list[x for x in int(input()) if k<x])
Problem p02988 (python)

Fixed submission:
n=int(input())
p = list(map(int, input().split()))
ans=0

for i in range(1,n-1):
  if p[i-1]<p[i]<p[i+1] or p[i+1]<p[i]<p[i-1]:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
p = list(map(int, input().split()))
ans=0
x=0
for i in range(n+1):
	if p[x] < p[x+1]:
		ans+=1
		x+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input)
p = list(map(int, input().split()))
ans=0
x=0
for i in range(n+1):
	if p[x] < p[x+1]:
		ans+=1
		x+=1
print(ans)
Problem p02993 (python)

Fixed submission:
s = list(input())
if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
    print('Good')
else:
    print('Bad')

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
    print('Good')
else:
    print('Bad')

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
if s[0] != s[1] != s[2] != s[3]:
    print('Good')
else:
    print('Bad')
Problem p03145 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(a*b//2)

Buggy submission (verdict: Runtime Error):
ab,c=map(int,input().split())
print(a*b//2)
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
    print('Hello World')
else:
    a = int(input())
    b = int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
if n == 1:
    print('Hello World')
else:
    print(a+b)
Problem p03433 (python)

Fixed submission:
n=int(input())
a=int(input())
if n%500 <= a:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
if n%500=<a:
	print('Yes')
else:
	print('No')
Problem p03632 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if min(b,d)-max(a,c)>0:
    print(min(b,d)-max(a,c))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if b>c:
    print(b-c-a)
elif:
    print(0)
Problem p03860 (python)

Fixed submission:
s = input()
print('A'+s[8]+'C')

Buggy submission (verdict: Runtime Error):
import re
s = input()
x = s[8:-8]
print('{}''{}''{}'.format('A', *re.findall('[A-Z]', x), 'C'))
Problem p04043 (python)

Fixed submission:
s = input().split(" ")
if s.count('5') == 2 and s.count('7') == 1:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if s.count('5') == 2 and s.count('7') == 1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

s = a + b + c

if s.count('5') == 2 and s.count('7') == 1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = sorted(map(int, input().split()))

if a + b + c == 5, 5, 7:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

if a + b + c == 17:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = int(input("ここに数値を入力してください:"))
b = int(input("ここに数値を入力してください:"))
c = int(input("ここに数値を入力してください:"))

if a + b + c == 17:
    print("Yes")
else:
    print("No")
Problem p02995 (python)

Fixed submission:
import sys
input = sys.stdin.readline
#-------------------------------------
def gcd( x, y ):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

a,b,c,d = map(int,input().split())
cd = c*d
bcnt = b-(b//c+b//d-b//(cd//gcd(c,d)))
acnt = 0
if a>1:
        a -= 1
        acnt = a-(a//c+a//d-a//(cd//gcd(c,d)))

print(bcnt-acnt)

Buggy submission (verdict: Runtime Error):

import sys
input = sys.stdin.readline
#-------------------------------------
import math

a,b,c,d = map(int,input().split())
cd = c*d
bcnt = b-(b//c+b//d-b//(cd//math.gcd(c,d)))
acnt = 0
if a>1:
        a -= 1
        acnt = a-(a//c+a//d-a//(cd//math.gcd(c,d)))

print(bcnt-acnt)
Problem p03000 (python)

Fixed submission:

n,x = map(int,input().split())
l = list(map(int,input().split()))

cnt = 1
d = 0

for _ in range(n):

    if d+l[cnt-1] <= x:
        d = d+l[cnt-1]
        cnt += 1
        # print(d)
    else:
        break

print(cnt)

Buggy submission (verdict: Runtime Error):

import sys
input = sys.stdin.readline
#-------------------------------------

n,x = map(int,input().split())
l = list(map(int,input().split()))

cnt = 1
d = 0

for _ in range(n+1):
    if n is 1:
        d = d+l[0]
        break

    if d+l[cnt-1] <= x:
        d = d+l[cnt-1]
        cnt += 1
        # print(d)
    else:
        break

print(cnt)

Buggy submission (verdict: Runtime Error):

import sys
input = sys.stdin.readline
#-------------------------------------

n,x = map(int,input().split())
l = list(map(int,input().split()))

cnt = 1
d = 0

for _ in range(n+1):
    if d+l[cnt-1] <= x:
        d = d+l[cnt-1]
        cnt += 1
        # print(d)
    else:
        break

print(cnt)
Problem p03031 (python)

Fixed submission:
#https://atcoder.jp/contests/abc128
# -*- coding: utf-8 -*-

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

k = []
s = []
for i in range(m):
    x = list(map(int,input().split()))
    k.append(x[0])
    y = []
    for j in range(x[0]):
        y.append(x[j+1])
    s.append(y)

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

cnt = 0
for i in range(1024):
    x = format(i,"010b")[::-1]
    if n < 10 and x[n] == "1":
        break
    
    for j in range(m):
        tmpSum = 0
        for k in s[j]:
            tmpSum += int(x[k-1])
        if tmpSum%2 is not p[j]:
            break
    else:
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc128
# -*- coding: utf-8 -*-

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

k = []
s = []
for i in range(m):
    x = list(map(int,input().split()))
    k.append(x[0])
    y = []
    for j in range(x[0]):
        y.append(x[j+1])
    s.append(y)

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

cnt = 0
for i in range(1024):
    x = format(i,"08b")[::-1]
    if x[n] == "1":
        break

    for j in range(m):
        tmpSum = 0
        for k in s[j]:
            tmpSum += int(x[k-1])
        if tmpSum%2 is not p[j]:
            break
    else:
        cnt += 1
        
print(cnt)

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc128
# -*- coding: utf-8 -*-

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

k = []
s = []
for i in range(m):
    x = list(map(int,input().split()))
    k.append(x[0])
    y = []
    for j in range(x[0]):
        y.append(x[j+1])
    s.append(y)

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

cnt = 0
for i in range(1024):
    x = format(i,"08b")[::-1]
    if x[n] == "1":
        break

    for j in range(m):
        tmpSum = 0
        for k in s[j]:
            tmpSum += int(x[k-1])
        if tmpSum%2 is not p[j]:
            break
    else:
        cnt += 1

print(cnt)
Problem p03071 (python)

Fixed submission:
#https://atcoder.jp/contests/abc124
# -*- coding: utf-8 -*-

a,b = map(int,input().split())
c = max(a,b)
if a>b:
    a-=1
else:
    b-=1
c += max(a,b)
print(c)

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc124
# -*- coding: utf-8 -*-

a,b = map(int,input().split())
c = max(a,b)
if a<b:
    a--
    else:
        b--
c += max(a,b)
print(c)

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc124
# -*- coding: utf-8 -*-

a,b = map(int,input().split())
c = max(a,b)
if a<b:
    a--
    else:
        b--
c += max(a,b)
print(c)

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc124
# -*- coding: utf-8 -*-

a,b = map(int,input().split())
c += max(a,b)
c += max(a,b)-1
print(c)
Problem p03324 (python)

Fixed submission:
d,n = map(int,input().split())

if d is 0:
    print(n + n//100)
if d is 1:
    if n is 100:
        print(100*100+100)
    else:
        print(n*100)
if d is 2:
    if n is 100:
        print(100*10000+10000)
    else:
        print(n*10000)

Buggy submission (verdict: Runtime Error):
if d is 0:
    print(n + n//100)
if d is 1:
    if n is 100:
        print(100*100+100)
    else:
        print(n*100)
if d is 2:
    if n is 100:
        print(100*10000+10000)
    else:
        print(n*10000)
Problem p03325 (python)

Fixed submission:
#!/usr/bin/env python
N = int(input())
A = [int(i) for i in input().split()]
ans = 0
for a in A:
    while a % 2 != 1:
        ans += 1
        a /= 2
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for v in a:
    while a%2 is 0:
        ans += 1
        a /= 2
print(ans)
Problem p03493 (python)

Fixed submission:
#http://abc081.contest.atcoder.jp/
# -*- coding: utf-8 -*-

a,b,c = map(int,list(input()))
print(a+b+c)

Buggy submission (verdict: Runtime Error):
#http://abc081.contest.atcoder.jp/
# -*- coding: utf-8 -*-

a,b,c = map(int,input().split())
print(a+b+c)
Problem p03543 (python)

Fixed submission:
#http://abc079.contest.atcoder.jp/
# -*- coding: utf-8 -*-

n = list(input())

if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(5):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])
print(sum([sum(map(lambda a: 0 if a == -1 else C[a][1], row)) for row in A])
Problem p03546 (python)

Fixed submission:
#http://abc079.contest.atcoder.jp/
# -*- coding: utf-8 -*-

h,w = map(int,input().split())

mp = []
for _ in range(10):
    mp.append(list(map(int,input().split())))

wall = []
for _ in range(h):
    wall.append(list(map(int,input().split())))

def min_cost(i,j,current,min_cost_current):
    if i == j: return current
    for index in range(10):
        if i == index: continue
        if current + mp[i][index] < min_cost_current:
            min_cost_current = min_cost(index,j,current+mp[i][index],min_cost_current)
    return min_cost_current


mp_min_cost =[]
for i in range(10):
    tmp = []
    for j in range(10):
        if i == j :
            tmp.append(0)
            continue

        min_cost_current = mp[i][j]
        if min_cost_current == sorted(mp[i])[1]:
            tmp.append(mp[i][j])
            continue

        # from i to j
        for index in range(10):
            if i == index: continue
            if mp[i][index] < min_cost_current:
                min_cost_current = min_cost(index,j,mp[i][index],min_cost_current)
        tmp.append(min_cost_current)
    mp_min_cost.append(tmp)

amount = 0
for i in wall:
    for j in i:
        if j == -1 or j == 1: continue
        amount += mp_min_cost[j][1]
print(amount)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])
print(sum([sum(map(lambda a: 0 if a == -1 else C[a][1], row)) for row in A])

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(4):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])
print(sum([sum(map(lambda a: 0 if a == -1 else C[a][1], row)) for row in A])
Problem p03550 (python)

Fixed submission:
#http://abc078.contest.atcoder.jp/
# -*- coding: utf-8 -*-
n, z, w = map(int,input().split())
a = list(map(int,input().split()))

ans = []
ans.append( abs( a[-1] - w ) )
if len(a) > 1: ans.append( abs( a[-1] - a[-2] ) )

print(max(ans))

Buggy submission (verdict: Runtime Error):
#http://abc078.contest.atcoder.jp/
# -*- coding: utf-8 -*-
n, z, w = map(int,input().split())
a = list(map(int,input().split()))

ans = []
ans.append( abs( a[-1] - w ) )
ans.append( abs( a[-1] - a[-2] ) )
print(max(ans))
Problem p03573 (python)

Fixed submission:
#https://beta.atcoder.jp/contests/abc075
# -*- coding: utf-8 -*-
a,b,c = map(int,input().split())

if a == b : print(c)
if b == c : print(a)
if c == a : print(b)

Buggy submission (verdict: Runtime Error):
#https://beta.atcoder.jp/contests/abc075
# -*- coding: utf-8 -*-
from collections import Counter
import sys

n,m = map(int,input().split())
line = []
for _ in range(m):
    line.append(list(map(int,input().split())))

line_count = []
for i in line:
    line_count.append(i[0])
    line_count.append(i[1])
line_count = Counter(line_count)

start_point = []
for k,v in line_count.items():
    if v == 1: start_point.append(k)
if len(start_point) == 0:
    print(0)
    sys.exit()

counter = 0
while(True):
    start_point_bu = start_point
    start_point = []
    for i in start_point_bu:
        for index,j in enumerate(line):
            if i in j:
                if j[0] == i : start_point.append(j[1])
                if j[1] == i : start_point.append(j[0])
                line.pop(index)
                counter+=1
            break
    if len(start_point)==0: break
print(counter)

Buggy submission (verdict: Runtime Error):
#https://beta.atcoder.jp/contests/abc075
# -*- coding: utf-8 -*-
from collections import Counter
import sys

n,m = map(int,input().split())
line = []
for _ in range(m):
    line.append(list(map(int,input().split())))

line_count = []
for i in line:
    line_count.append(i[0])
    line_count.append(i[1])
line_count = Counter(line_count)

start_point = []
for k,v in line_count.items():
    if v == 1: start_point.append(k)
if len(start_point) == 0:
    print(0)
    sys.exit()

counter = 0
while(True):
    start_point_bu = start_point
    start_point = []
    for i in start_point_bu:
        for index,j in enumerate(line):
            if i in j:
                if j[0] == i : start_point.append(j[1])
                if j[1] == i : start_point.append(j[0])
                line.pop(index)
                counter+=1
            break
    if len(start_point)==0: break
print(counter)
Problem p02658 (python)

Fixed submission:
def demon():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  if A[0] == 0:
    print(0)
    return

  X = 1
  for i in A:
    X *= i
    if X > 10 ** 18:
      print("-1")
      return

  print(X)

demon()

Buggy submission (verdict: Runtime Error):
def demon():
  N = int(input())
  A = list(map(int,input().split()))
  A = sort(A)
  if A[0] == 0:
    print(0)
    return

  X = 1
  for i in A:
    X *= A
    if X > 10 ** 18:
      print("-1")
      return

  print(X)

demon()
Problem p02675 (python)

Fixed submission:
N = input()
X = int(N[-1])
if X == 2 or X == 4 or X == 5 or X == 7 or X == 9:
  print("hon")
elif X == 3:
  print("bon")
else:
  print("pon")

Buggy submission (verdict: Runtime Error):
N = int(input())
X = N[-1]
if X == 2 or X == 4 or X == 5 or X == 7 or X == 9:
  print("hon")
if X == 3:
  print("bon")
else:
  print("pon")
Problem p02719 (python)

Fixed submission:
X = list(map(int, input().split()))
N = X[0]
K = X[1]
t = N % K
s = K - t
if t <= s:
  print(t)
else:
  print(s)

Buggy submission (verdict: Runtime Error):
import math
X = list(map(int, input().split()))
N = X[0]
K = X[1]
A = math.inf
if K == 1:
  print(0)
else:  
  while True:
    A = abs(N - K)
    if N > A:
      N = A
    else:
      break
  print(N)
Problem p02730 (python)

Fixed submission:
S = input()
N = len(S)
A = int((N - 1) / 2)
if A % 2 == 0:
  B = int(A / 2)
else:
  B = int((A - 1) / 2)
X = 0
 
for i in range(A):
  if S[i] != S[-i-1]:
    X += 1
 
if N >= 5:
  for i in range(B):
  	if S[i] != S[A-1-i]:
  	    X += 1
      
if X == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
A = int((N - 1) / 2)
B = int((A - 1) / 2)
X = 0

for i in range(A):
  if S[i] != S[-i-1]:
    X += 1

if N == 5:
  if S[0] != S[1]:
    X += 1

if N >= 7:
  for i in range(B):
  	if S[i] != S[A-1]:
    	X += 1
      
if X == 0:
  print("Yes")
else:
  print("No")
Problem p02812 (python)

Fixed submission:
n = int(input())
S = input()
A = 0
for i in range(n-2):
  clipped_S = S[i:i+3]
  if clipped_S == "ABC":
    A += 1
print(A)

Buggy submission (verdict: Runtime Error):
n = int(input())
S = input()
A = 0
for i in range(n-3):
  clipped_S = S[i:i+2]
  if clipped_S == "ABC"
    A += 1
print(A)
Problem p03086 (python)

Fixed submission:
s = input()
n = len(s)
l = list("ACGT")
A = 0
for i in range(n):
  for j in range(i+1,n+1):
    x = s[i:j]
    if all(k in l for k in x):
      A = max(A,len(x))
print(A)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
l = list("ACGT")
A = 0
for i in range(n):
  for j in range(i+1,n+1):
    x = s[i,j]
    if all(k in l for k in x):
      A = max(A,len(x))
print(A)
Problem p03369 (python)

Fixed submission:
a,b,c = input()
A = 0
if a == "o":
  A += 1
if b == "o":
  A += 1
if c == "o":
  A += 1
 
if A == 3:
  print(1000)
if A == 2:
  print(900)
if A == 1:
  print(800)
if A == 0:
  print(700)

Buggy submission (verdict: Runtime Error):
a,b,c = input()
A = 0
if a == o:
  A += 1
if b == o:
  A += 1
if c == o:
  A += 1

if A == 3:
  print(1000)
if A == 2:
  print(900)
if A == 1:
  print(800)
if A == 0:
  print(700)
Problem p02614 (python)

Fixed submission:
h, w, k = map(int, input().split())
grid = []
for i in range(h):
    grid.append(input())

count = 0
for i in range(2**h):
    row = []
    r = 0
    while i:
        if i & 1:
            row.append(r)
        i >>= 1
        r += 1

    for j in range(2**w):
        col = []
        c = 0
        while j:
            if j & 1:
                col.append(c)
            j >>= 1
            c += 1

        black = 0
        for r in row:
            for c in col:
                if grid[r][c] == "#":
                    black += 1

        if black == k:
            count += 1

print(count)

Buggy submission (verdict: Runtime Error):
h, w, k = map(int, input().split())
grid = []
for i in range(h):
    grid.append(input())

count = 0
for i in range(2**h):
    row = []
    while i:
        if i & 1:
            row.append(i & 1)
        i >>= 1
        
        for j in range(2**w):
            col = []
            while j:
                if j & 1:
                    row.append(j & 1)
                j >>= 1
            
            black = 0
            for r, c in row, col:
                if grid[r][c] == "#":
                    black += 1
            
            if black == k:
                count += 1
            
print(count)
Problem p02615 (python)

Fixed submission:
n = int(input())
friendliness = [int(s) for s in input().split()]

friendliness.sort(reverse=True)
print(friendliness[0] + 2 * sum(friendliness[1:n//2]) + (n%2) * friendliness[n//2])

Buggy submission (verdict: Runtime Error):
n = int(input())
friendliness = [int(s) for s in input().split()]

res = friendliness[0] + 2 * sum(friendliness[1:n//2+1]) + (n%2) * friendliness[n//2+1]
Problem p02608 (python)

Fixed submission:

import math
def func(x,y,z):
    ans = x**2 + y**2 + z**2+ x*y + y*z + z*x
    return ans

N = int(input())
array_N = [0]*N
root_n = round(math.sqrt(N+1))

for x in range(1,root_n):
    for y in range(1,root_n):
        for z in range(1,root_n):
            if func(x,y,z) <= N:
                array_N[func(x,y,z)-1] = array_N[func(x,y,z)-1] +1
                
for i in range(N):
    print(array_N[i])

Buggy submission (verdict: Runtime Error):

import math
def func(x,y,z):
    ans = x**2 + y**2 + z**2+ x*y + y*z + z*x
    return ans

N = int(input())
array_N = [0]*N
root_n = round(math.sqrt(n+1))

for x in range(1,root_n):
    for y in range(1,root_n):
        for z in range(1,root_n):
            if func(x,y,z) <= N:
                array_N[func(x,y,z)-1] =array_N[func(x,y,z)-1] +1
                
for i in range(N):
    print(array_N[i])

Buggy submission (verdict: Runtime Error):

import math
def func(x,y,z):
    ans = x**2 + y**2 + z**2+ x*y + y*z + z*x
    return ans

N = int(input())
array_N = [0]*N
root_n = round(math.sqrt(n+1))

for x in range(1,root_n):
    for y in range(1,root_n):
        for z in range(1,root_n):
            if func(x,y,z) <= N:
                array_N[func(x,y,z)-1] =array_N[func(x,y,z)-1] +1
                
for i in range(N):
    print(array_N[i])