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

Fixed submission:
import re

def main():
    s = list(input())
    sr = ''.join(list(reversed(s)))
    t = ['dream', 'dreamer', 'erase', 'eraser']
    tr = list()
    for i in t:
        tr.append(''.join(list(reversed(i))))
    while sr:
        flag = False
        for i in tr:
            if sr.startswith(i):
                sr = sr.replace(i ,'', 1)
                flag = True
        if not flag:
            print('NO')
            break
        if sr == '':
            print('YES')
            break
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import re

def main():
    s = list(input())
    sr = ''.join(list(reversed(s)))
    t = ['dream', 'dreamer', 'erase', 'eraser']
    tr = list()
    for i in t:
        tr.append(''.join(list(reversed(i))))
    while sr:
        flag = False
        for i in tr:
            if sr.startswith(i):
                sr = sr.replace(i ,'', 1)
                flag = True
        if not flag:
            print('NO')
            break
        if st == '':
            print('YES')
            break
if __name__ == '__main__':
    main()
Problem p03206 (python)

Fixed submission:
n = int(input())
if n == 25:
    print("Christmas")
elif n == 24:
    print("Christmas Eve")
elif n == 23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
n = int(import())
if n == 25:
  print("Christmas")
elif n == 24:
  print("Christmas Eve")
elif n == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
n = int(input())
2.2.if n == 25:
3.3.  print("Christmas")
4.4.elif n == 24:
5.5.  print("Christmas Eve")
6.6.elif n == 23:
7.7.  print("Christmas Eve Eve")
8.8.else:
9.9.  print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
n = int(imput())
2.if n == 25:
3.  print("Christmas")
4.elif n == 24:
5.  print("Christmas Eve")
6.elif n == 23:
7.  print("Christmas Eve Eve")
8.else:
9.  print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
n = int(import())
if n == 25:
  print("Christmas")
elif n == 24:
  print("Christmas Eve")
elif n == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")
Problem p03285 (python)

Fixed submission:
n = int(input())
m = [7 * i for i in range(15)]
for i in range(15):
    for j in range(26):
        m.append(m[i] + 4 * j)
if n in set(m):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
m = (n // 7) * 7
if m == n:
    print("Yes")
elif m - n <= n // 7:
    print("Yes")
else:
     print("No")
Problem p03316 (python)

Fixed submission:
n = str(input())
sn = 0
for i in range(len(n)):
    sn += int(n[i])
if int(n) % sn == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = str(input())
sn = 0
for i in range(len(n)):
    sn += int(n[i])
if n % sn == 0:
    print("Yes")
else:
    print("No")
Problem p03399 (python)

Fixed submission:
a = [int(input()) for i in range(4)]
print(min(a[0], a[1]) + min(a[2], a[3]))

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(4)]
print(min(a[0] + a[1]) + min(a[2] + a[3]))
Problem p03407 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a + b >= c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().solit())
if a + b >= c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
if int(input()) + int(input()) >= int(input()):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
if input() + input() >= input():
    print("Yes")
else:
    print("No")
Problem p03408 (python)

Fixed submission:
ans = 0
n = int(input())
blue = [input() for i in range(n)]
m = int(input())
red = [input() for i in range(m)]
for i in range(m):
    if red[i] in blue:
        blue.remove(red[i])
for j in list(set(blue)):
    if blue.count(j) > ans:
        ans = blue.count(j)
print(ans)

Buggy submission (verdict: Runtime Error):
ans = 0
n = int(input())
blue = [input() for i in range(n)]
m = int(input())
red = [input() for i in range(m)]
for i in range(m):
    if red[m] in blue:
        blue.remove(red[m])
for j in list(set(blue)):
    if blue.count(j) > ans:
        ans = blue.count(j)
print(ans)

Buggy submission (verdict: Runtime Error):
ans = 0
n = int(input())
blue = [input() for i in range(n)]
m = int(input())
red = [input() for i in range(m)]
print(blue)
for i in range(m):
    if red[m] in blue:
        blue.remove(red[m])
for j in list(set(blue)):
    if blue.count(j) > ans:
        ans = blue.count(j)
print(ans)
Problem p03409 (python)

Fixed submission:
n = int(input())
red = [list(map(int, input().split())) for i in range(n)]
blue = [list(map(int, input().split())) for i in range(n)]
red = sorted(red, key = lambda x: x[1])
blue.sort()
ans = 0
for i in range(n):
    a = 0
    for j in range(len(red)):
        if blue[i][0] > red[j][0] and blue[i][1] > red[j][1]:
            a = j
    if blue[i][0] > red[a][0] and blue[i][1] > red[a][1]:
        ans += 1
        del red[a]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
red = [list(map(int, input().split())) for i in range(n)]
blue = [list(map(int, input().split())) for i in range(n)]
red.sort()
blue.sort()
ans = 0
for i in range(n):
    for j in range(len(red)):
        if blue[i][0] > red[j][0] and blue[i][1] > red[j][1]:
            a = j
    if blue[i][0] > red[a][0] and blue[i][1] > red[a][1]:
        ans += 1
        del red[a]
print(ans)
Problem p03415 (python)

Fixed submission:
list = [input() for i in range(3)]
print(list[0][0] + list[1][1] + list[2][2])

Buggy submission (verdict: Runtime Error):
list = [input() for i in range(3)]
print(list[0][0] + list[1][1] + list[2][2]
Problem p03416 (python)

Fixed submission:
a, b = map(int, input().split())
ans = 0
for n in range(a, b+1):
    if str(n)[0] == str(n)[4] and str(n)[1] == str(n)[3]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = 0
for n in range(a, b+1):
    if n[0] == n[4] and n[1] == n[3]:
        ans += 1
print(ans)
Problem p02687 (python)

Fixed submission:
import sys
input = sys.stdin.readline

print("ABC" if input().strip() == "ARC" else "ARC")

Buggy submission (verdict: Runtime Error):
x = int(input())
eps = 1e-9
a = 1
while a**5 <= x:
    diff = a**5-x
    if diff < 0:
        diff = abs(diff)
        sign = True
    else:
        sign = False
    if abs(diff**0.2 - round(diff**0.2)) < eps:
        b = round(round(diff**0.2))
        if sign:
            b = -b
        break
    a += 1
print(a,int(b))
Problem p02690 (python)

Fixed submission:
import sys
input = sys.stdin.readline

x = int(input())
eps = 1e-9
a = 1
while True:
    diff = a**5-x
    if diff < 0:
        diff = abs(diff)
        sign = True
    else:
        sign = False
    if abs(diff**0.2 - round(diff**0.2)) < eps:
        b = round(diff**0.2)
        if sign:
            b = -b
        break
    a += 1
print a,int(b)

Buggy submission (verdict: Runtime Error):
x = int(input())
eps = 1e-9
a = 1
while a**5 <= x:
    diff = a**5-x
    if diff < 0:
        diff = abs(diff)
        sign = True
    else:
        sign = False
    if abs(diff**0.2 - round(diff**0.2)) < eps:
        b = round(round(diff**0.2))
        if sign:
            b = -b
        break
    a += 1
print(a,int(b))

Buggy submission (verdict: Runtime Error):
x = int(input())
eps = 1e-9
a = 1
while a**5 <= x:
    diff = a**5-x
    if diff < 0:
        diff = abs(diff)
        sign = True
    else:
        sign = False
    if abs(diff**0.2 - round(diff**0.2)) < eps:
        b = round(round(diff**0.2))
        if sign:
            b = -b
        break
    a += 1
print a,int(b)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from  math import log

x = int(input())
eps = 1e-9
a = 1
while a**5 <= x:
    diff = a**5-x
    if diff < 0:
        diff = abs(diff)
        sign = True
    else:
        sign = False
    if abs(diff**0.2 - round(diff**0.2)) < eps:
        b = round(round(diff**0.2))
        if sign:
            b = -b
        break
    a += 1
print a,int(b)
Problem p02743 (python)

Fixed submission:
from decimal import *
a,b,c = (int(x) for x in input().split())
a = Decimal(a)
b = Decimal(b)
c = Decimal(c) 
if a+b+2*(a.sqrt()*b.sqrt()) < c:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from mpmath import *

mp.dps=50
mp.pretty = True

a,b,c = (int(x) for x in input().split())
if a+b+2*(mp.sqrt(a*b)) < c:
    print('Yes')
else:
    print('No')
Problem p02767 (python)

Fixed submission:
n = int(input())
seq = [int(x) for x in input().split()]
d = round(sum(seq) / len(seq))
print(sum([(x-d)**2 for x in seq]))

Buggy submission (verdict: Runtime Error):
n = int(n)
seq = [int(x) for x in input().split()]
d = round(sum(seq) / len(seq))
print(sum([(x-d)**2 for x in seq]))
Problem p02802 (python)

Fixed submission:
n, m = [int(x) for x in input().split()]
lst = [0]*(n+1)
a = 0
b = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if s == 'AC' and lst[p] is not None:
    a += 1
    b += lst[p]
    lst[p] = None
  elif s == 'WA' and lst[p] is not None:
    lst[p] += 1
print(a,b)

Buggy submission (verdict: Runtime Error):
n, m = [int(x) for x in input().split()]
lst = [None]*(n+1)
a = 0
b = 0
for i in range(m):
  p, s = input().split()
  if s == 'AC' and lst[p] is None:
    a += 1
    lst[p] = True
  elif s == 'WA' and lst[p] is None:
    b += 1
print(a,b)
Problem p02823 (python)

Fixed submission:
n, a, b = (int(x) for x in input().split())
if (b - a) % 2 == 0:
	ans = (b-a) // 2
else:
	ans = min(a-1, n-b) + 1 + (b-a-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = (int(x) for x in input().split())
if (b-a) % 2 == 0:
  ans = (b-a) // 2
else:
  ans = min(a-1,n-b)+1+(b−a−1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = (int(x) for x in input().split())
if (b - a) % 2 == 0:
	ans = (b-a) // 2
else:
	ans = min(a-1, n-b) + 1 + (b−a−1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = (int(x) for x in input().split())
if (b - a) % 2 == 0:
  ans = (b-a) // 2
else:
  ans = min(a-1, n-b) + 1 + (b−a−1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = (int(x) for x in input().split())
if (b - a) % 2 == 0:
  ans = (b-a) // 2
else:
  ans = min(a-1, n-b) + 1 + (B−A−1)//2
print(ans)
Problem p02843 (python)

Fixed submission:
def solve(X):
    for a in range(1 + X // 100):
        for b in range(1 + X // 101):
            for c in range(1+ X // 102):
                for d in range(1 + X // 103):
                    for e in range(1 + X // 104):
                        for f in range( 1 + X // 105):
                            if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 == X:
                                return 1
                            elif a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
                                break
                #        if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
                 #           break
              #      if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
               #         break
            #    if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
             #       break
          #  if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
           #     break
        #if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
         #   break
    return 0

X = int(input())
print(solve(X))

Buggy submission (verdict: Runtime Error):
def solve(X):
    for a in range(1 + X // 100):
        for b in range(1 + X // 101):
            for c in range(1+ X // 102):
                for d in range(1 + X // 103):
                    for e in range(1 + X // 104):
                        for f in range( 1 + X // 105):
                            if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 == X:
                                return 1
                            elif a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
                                break
                #        if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
                 #           break
              #      if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
               #         break
            #    if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
             #       break
          #  if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
           #     break
        #if a*100 + b*101+ c*102 + d * 103 + e * 104 + f * 105 > X:
         #   break
    return 0

X = int(input())
print(solve(X))
~
Problem p02844 (python)

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(1000):
    seq = "{:03d}".format(i)
    cnt = 0
    for j in s:
        if seq[cnt] == j:
            cnt += 1
            if cnt == 3:
                break
    if cnt == 3:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = 0
for i in range(1000):
    seq = f"{i:03d}"
    cnt = 0
    for j in s:
        if seq[cnt] == j:
            cnt += 1
            if cnt == 3:
                break
    if cnt == 3:
        ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = 0
for i in range(1000):
    seq = f"{i:03d}"
    cnt = 0
    for j in s:
        if seq[cnt] == j:
            cnt += 1
            if cnt == 3:
                break
    if cnt == 3:
        ans +=1
print(ans)
Problem p02909 (python)

Fixed submission:
s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")

Buggy submission (verdict: Runtime Error):
s = raw_input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
Problem p02922 (python)

Fixed submission:
a, b = (int(x) for x in input().split())
print(int((b-1) / (a-1)) + (1 if (b-1) % (a-1) != 0 else 0))

Buggy submission (verdict: Runtime Error):
a, b = (int(x) for x in input().split())
print(int((b-1) / (a-1))
Problem p02924 (python)

Fixed submission:
n = int(input())-1
print(((2+n-1)*n ) >> 1)

Buggy submission (verdict: Runtime Error):
print(sum(range(int(input())))
Problem p03435 (python)

Fixed submission:
c = [[],[],[]]
c[0] = [int(x) for x in input().split()]
c[1] = [int(x) for x in input().split()]
c[2] = [int(x) for x in input().split()]

ans = "Yes"
for i in range(3):
    for j in range(3):
        if c[(i+1)%3][(j+1)%3] + c[(i+2)%3][(j+2)%3] != c[(i+2)%3][(j+1)%3] + c[(i+1)%3][(j+2)%3]:
            ans = "No"
            break
    if ans == "No":
        break
print(ans)

Buggy submission (verdict: Runtime Error):
c = [[],[],[]]
c[0] = [int(x) for x in input().split()]
c[1] = [int(x) for x in input().split()]
c[2] = [int(x) for x in input().split()]

ans = "Yes"
for i in range(3):
  for j in range(3):
  	if c[(i+1)%3][(j+1)%3] + c[(i+2)%3][(j+2)%3] != c[(i+2)%3][(j+1)%3] + c[(i+1)%3][(j+2)%3]
      ans = "No"	
      break
  if ans == "No":
    break
print(ans)
Problem p03633 (python)

Fixed submission:
from fractions import gcd

def lcm(x, y):
   lcm = (x*y)//gcd(x,y)
   return lcm

n = int(input())
ans1 = 1
for _ in range(n):
    t=int(input())
    ans1 = lcm(ans1, t)
print(ans1)

Buggy submission (verdict: Runtime Error):
from math import gcd

def lcm(x, y):
   lcm = (x*y)//gcd(x,y)
   return lcm

n = int(input())
ans1 = 1
for _ in range(n):
    t=int(input())
    ans1 = lcm(ans1, t)
print(ans1)

Buggy submission (verdict: Runtime Error):
from math import gcd

def lcm(x, y):
   lcm = (x*y)//gcd(x,y)
   return lcm

n = int(input())
ans1 = 1
for _ in range(n):
    t=int(input())
    ans1 = lcm(ans1, t)
print(ans1)
Problem p02573 (python)

Fixed submission:
def main():
    n,m = [int(v) for v in input().split()]
    if m==0:
        print(1)
        return
    
    g = [set() for _ in range(n+1)]
    seen = [False] * (n+1)
    for _ in range(m):
        a,b = [int(v) for v in input().split()]
        g[a].add(b)
        g[b].add(a)

    ans = 0
    for i in range(1,n+1):
        if seen[i]: continue
        stack = set([i])
        l = 0
        while len(stack)>0:
            no = stack.pop()
            seen[no] = True
            l += 1
            for nn in g[no]:
                if not seen[nn]:
                    stack.add(nn)
        ans = max(ans, l)

    # print(groups, g)
    print(ans)

main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m = [int(v) for v in input().split()]
    groups = []
    g = [-1]*(n+1)
    for _ in range(m):
        a,b = [int(v) for v in input().split()]
        if g[a]!=-1 and g[b]!=-1:
            if g[a]==g[b]: continue
            gb = g[b]
            for no in groups[gb]:
                g[no] = g[a]
            groups[gb] = {}
        elif g[a]!=-1:
            g[b] = g[a]
            groups[g[a]].append(b)
        elif g[b]!=-1:
            g[a] = g[b]
            groups[g[b]].append(a)
        else:
            g[a] = g[b] = len(groups)
            groups.append([a,b])
    # print(groups, g)
    ans = max([len(v) for v in groups])
    print(ans)

main()
Problem p02630 (python)

Fixed submission:
def main():
    nmax = 100000
    n = int(input())
    values = [0] * nmax
    a = [int(v) for v in input().split()]
    for v in a:
        values[v-1] += 1
    asum = sum(a)

    q = int(input())
    for _ in range(q):
        b, c = [int(v) for v in input().split()]
        asum += values[b-1] * (c - b)
        values[c-1] += values[b-1]
        values[b-1] = 0
        print(asum)

main()

Buggy submission (verdict: Runtime Error):
def main():
    nmax = 10000
    n = int(input())
    values = [0] * nmax
    a = [int(v) for v in input().split()]
    for v in a:
        values[v-1] += 1
    asum = sum(a)

    q = int(input())
    for _ in range(q):
        b, c = [int(v) for v in input().split()]
        asum += values[b-1] * (c - b)
        values[c-1] += values[b-1]
        values[b-1] = 0
        print(asum)

main()
Problem p02999 (python)

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

if x >= y:
    print(10)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
x = input()
y = input()
x = int(x)
y = int(y)

if x >= y:
    print(10)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
x = input()
y = input()

if x >= y:
    print(10)
else:
    print(0)
Problem p02732 (python)

Fixed submission:

from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)

Buggy submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_sum = np.sum([np.count_nonzero(A==i)*(np.count_nonzero(A==i)-1)/2 for i in A_set])
    
for i in A:
    print(int(count_sum-(np.count_nonzero(A==i)-1)))
Problem p02574 (python)

Fixed submission:
import math
n = int(input())
a = list(map(int,input().split()))

def generate_D(maxA):
  seq = [i for i in range(maxA+1)]
  p = 2
  while p*p <= maxA:
    if seq[p]==p:
      for q in range(p*2,maxA+1,p):
        if seq[q]==q:
          seq[q] = p
    p += 1
  return seq

cur = a[0]
for v in a[1:]:
  cur = math.gcd(cur,v)
if cur > 1:
  print('not coprime')
else:  
  d = generate_D(max(a))
  primes = set([])
  tf = 1
  for v in a:
    tmp = set([])
    while v > 1:
      tmp.add(d[v])
      v //= d[v]
    for k in tmp:
      if k in primes:
        tf = 0
      else:
        primes.add(k)
  if tf:
    print('pairwise coprime')
  else:
    print('setwise coprime')

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))

def generate_D(maxA):
  seq = [i for i in range(maxA+1)]
  p = 2
  while p*p <= maxA:
    if seq[p]==p:
      for q in range(p*2,maxA+1,p):
        if seq[q]==q:
          seq[q] = p
    p += 1
    return seq

cur = a[0]
for v in a[1:]:
  cur = math.gcd(cur,v)
if cur > 1:
  print('not coprime')
else:  
  d = generate_D(max(a))
  primes = set([])
  tf = 1
  for v in a:
    tmp = set([])
    while v > 1:
      tmp.add(d[v])
      v //= d[v]
    for k in tmp:
      if k in primes:
        tf = 0
      else:
        primes.add(k)
  if tf:
    print('pairwise coprime')
  else:
    print('setwise coprime')

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))

def generate_D(maxA):
  seq = [i for i in range(maxA+1)]
  p = 2
  while p*p <= maxA:
    if seq[p]==p:
      for q in range(p*2,maxA+1,p):
        if seq[q]==q:
          seq[q] = p
    p += 1
    return seq

cur = a[0]
for v in a[1:]:
  cur = math.gcd(cur,v)
if cur > 1:
  print('not coprime')
else:  
  d = generate_D(max(a))
  primes = set([])
  for v in a:
    tmp = set([])
    while v > 1:
      tmp.add(d[v])
      v //= d[v]
    for k in tmp:
      if k in primes:
        tf = 0
        print('setwise coprime')
        exit()
      else:
        primes.add(k)
  else:
    print('pairwise coprime')
Problem p02576 (python)

Fixed submission:
n,x,t = map(int,input().split())
print(-(-n//x)*t)

Buggy submission (verdict: Runtime Error):
h,w,m = map(int,input().split())
row = [0]*(h+1)
col = [0]*(w+1)
bombs = set([])
for i in range(m):
  a,b = map(int,input().split())
  row[a] += 1
  col[b] += 1
  bombs.add((a,b))
r,c = max(row),max(col)
rcnt,ccnt = 0,0
for v in row:
  if v==r:
    rcnt += 1
for v in col:
  if v==c:
    ccnt += 1
doubled = 0
for i,j in bombs:
  if row[i]==r and col[j]==c:
    doubled += 1
if doubled==rcnt*ccnt:
  print(r+c-1)
else:
  print(r+c)
Problem p02614 (python)

Fixed submission:
import numpy as np
h,w,k = map(int,input().split())
c = []
for _ in range(h):
  row = [1 if a=='#' else 0 for a in input()]
  c.append(row)
c = np.array(c).reshape(h,w)
ans = 0
for bith in range(1<<h+w):
  d = np.copy(c)
  for i in range(h+w):
    if (bith>>i)&1:
      if i<h:
        d[i]=0
      else:
        d[:,i-h]=0
  if np.sum(d)==k:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
h,w,k = map(int,input().split())
c = np.zeros((h,w))
for _ in range(h):
  row = [1 if a=='#' else 0 for a in input()]
  c[_]=row
ans = 0
for bit in range(1<<h+w):
  d = np.copy(c)
  for i in range(h+w):
    if (bit>>i)&1:
      if i<h:
        d[i]=0
      else:
        d[:,i-h]=0
  if np.sum(d)==k:
    ans += 1
print(ans)
Problem p02615 (python)

Fixed submission:
n = int(input())
a = sorted(list(map(int,input().split())))[::-1]
ans = 0
for i in range(1,n):
  ans += a[i//2]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int,input().split())))[::-1]
ans = 0
temp = a[0]
lim = 1
cnt = 1
nb = iter(set(a))
poy = next(nb)
nxt = next(nb)
for v in a[1:]:
  if lim==0:
    cnt = 2
    temp = nxt
    lim = cnt
    nxt = next(nb)
  ans += temp
  if temp==v:
    cnt += 1
    lim = cnt
  else:
    lim -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int,input().split())))[::-1]
ans = 0
temp = a[0]
lim = 1
cnt = 1
nb = iter(set(a))
poy = next(nb)
nxt = next(nb)
for v in a[1:]:
  if lim==0:
    cnt = 2
    temp = nxt
    lim = cnt
    nxt = next(nb)
  ans += temp
  if temp==v:
    cnt += 1
    lim = cnt
  else:
    lim -= 1
  print(ans)