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

Fixed submission:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

a,b,c=map(int,input().split())
for i in itertools.permutations([a,b,c],3):
    if i[0]==sum(i[1:]) or sum(i[:2])==i[2]:
        print("Yes")
        exit()

print("No")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys, itertools
from math import gcd
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0



a, b, c = map(int, input().split())
for i in itertools.permutations([a, b, c], 3):
    if i[0] == sum(i[1:]) or sum(i[:2]) == i[2]:
        print("Yes")
        exit()

print("No")

Buggy submission (verdict: Runtime Error):
!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

a,b,c=map(int,input().split())
print(0)
for i in itertools.permutations([a,b,c],3):
    if i[0]==sum(i[1:]) or sum(i[:2])==i[2]:
        print("Yes")
        exit()

print("No")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

# a,b,c=map(int,input().split())
# for i in itertools.permutations([a,b,c],3):
#     if i[0]==sum(i[1:]) or sum(i[:2])==i[2]:
#         print("Yes")
#         exit()

# print("No")
Problem p03964 (python)

Fixed submission:
def ceil(x,y):
  return (x-1)//y+1
N = int(input())
TA = [list(map(int, input().split())) for _ in range(N)]
t, a = 1, 1
for T, A in TA:
  rate = max(ceil(t, T), ceil(a, A))
  t = T * rate
  a = A * rate
print(t + a)

Buggy submission (verdict: Runtime Error):
def ceil(x,y):
    return x//y+(not( not x%y))
n=int(input())
a,b=1,1
for i in range(n):
    t,s = map(int,input().split())
    i = max( ceil(a/t), ceil(b/s) )
    a=t*i;b=s*i
print(a+b)

Buggy submission (verdict: Runtime Error):
from math import ceil
# def ceil(x,y):
#   return (x-1)//y+1
N = int(input())
TA = [list(map(int, input().split())) for _ in range(N)]
t, a = 1, 1
for T, A in TA:
  rate = max(ceil(t, T), ceil(a, A))
  t = T * rate
  a = A * rate
print(t + a)

Buggy submission (verdict: Runtime Error):
from math import ceil
N = int(input())
TA = [list(map(int, input().split())) for _ in range(N)]
t, a = 1, 1
for T, A in TA:
  rate = max(ceil(t, T), ceil(a, A))
  t = T * rate
  a = A * rate
print(t + a)
Problem p04043 (python)

Fixed submission:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

A=list(map(int,input().split()))
a=b=0
for ai in A:
    if ai==5:
        a+=1
    elif ai==7:
        b+=1
if a==2 and b==1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n,k=map(int,input().split())
D=set(input().split())
while True:
    ns=str(n)
    for ni in ns:
        if ni in D:
            break
    else:
        print(n)
        exit()
    n+=1
    continue
Problem p02583 (python)

Fixed submission:
import sys

n=int(input())
l=[int(x) for x in input().rstrip().split()]
l.sort()


ans=0
for i in range(n):
  for j in range(i+1,n):
    for s in range(j+1,n):
      if l[i]!=l[j] and l[j]!=l[s] and l[i]!=l[s]:
        if l[i]<l[j]+l[s] and l[j]<l[i]+l[s] and l[s]<l[i]+l[j]:
          ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

n=int(input())
l=[int(x) for x in input().rstrip().split()]
l.sort()
num=[0]*max(l)
for i in l:
  num[i-1]+=1

ans=0
for i in range(n):
  for j in range(i+1,n):
    for s in range(j+1,n):
      if l[i]!=l[j] and l[j]!=l[s] and l[i]!=l[s]:
        if l[i]<l[j]+l[s] and l[j]<l[i]+l[s] and l[s]<l[i]+l[j]:
          ans+=1
print(ans)
Problem p02584 (python)

Fixed submission:
x,k,d=map(int,input().split())
x=abs(x)
syou=x//d
if k<=syou:
  print(x-k*d)
else:
  k=k-syou
  x=x%d
  if k%2==0:
    print(x)
  else:
    print(abs(x-d))

Buggy submission (verdict: Runtime Error):
import sys


x,k,d=map(int,input().split())

x=abs(x)
syou = x//d
if k<=syou:
  print(x-k*d)
else:
  if (k//syou)%2 == 0:
    if syou%2==0:
      print(x%d)
    else:
      print(min(abs(x%d+d), abs(x%d-d)))
  else:
    if syou%2==0:
      print(min(abs(x%d+d), abs(x%d-d)))
    else:
      print(x%d)
Problem p03282 (python)

Fixed submission:
import sys
s=input()
k=int(input())
for i in range(k):
  if s[i]!="1":
    print(s[i])
    sys.exit()
print(1)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
// #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);i++)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}


int main() {
  string s;cin >> s;
  int k;cin >> k;
  rep(i,k+3){
    if (s[i]!='1'){
      cout<<s[i]<<endl;
      return 0;
    }
  }
  cout<<1<<endl;  
}
Problem p03353 (python)

Fixed submission:
s=input()
k=int(input())
ans=[]

for i in range(len(s)):
  for j in range(i+1,min(k+i+1,len(s)+1)):
    ans.append(s[i:j])

ans=list(set(ans))
ans.sort()
print(ans[k-1])

Buggy submission (verdict: Runtime Error):
from numba import njit
@njit("i8(i8)")

def solve(s,k):
  l=[i for i in s]
  ans=l
  mae=[]
  for i in range(len(s)-1):
    nlen=i+1
    for j in range(len(l)-1):
      lj=l[j+1]
      now=l[j]+lj[nlen-1:]
      mae.append(now)

    ans.extend(mae)
    l=mae
    mae=[]

  ans=list(set(ans))
  ans.sort()
  print(ans[k-1])


s=input()
k=int(input())
solve(s,k)
Problem p02583 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            if len(set([l[i], l[j], l[k]])) == 3 and max(l[i], l[j], l[k]) < sum([l[i], l[j], l[k]]) - max(l[i], l[j], l[k]):
                ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
    l = list(map(int, input().split()))
    ans = 0

    for i in range(n - 2):
        for j in range(i + 1, n - 1):
            for k in range(j + 1, n):
                if len(set([l[i], l[j], l[k]])) == 3 and max(l[i], l[j], l[k]) < sum([l[i], l[j], l[k]]) - max(l[i], l[j], l[k]):
                    ans += 1
    print(ans)
Problem p02675 (python)

Fixed submission:
n = int(input())
n = n % 10
if n in [2, 4, 5, 7, 9]:
  print("hon")
elif n in [0,1,6,8]:
  print("pon")
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())
ax = a * math.cos(math.radians((h/12 + 1/12 * m/60) * 360))
ay = a * math.sin(math.radians((h/12 + 1/12 * m/60) * 360))
bx = b * math.cos(math.radians(m/60 * 360))
by = b * math.sin(math.radians(m/60 * 360))
print(math.sqrt((ax-bx)**2 + (ay-by)**2))
Problem p02677 (python)

Fixed submission:
import math
a, b, h, m = map(int, input().split())
ax = a * math.cos(math.radians((h/12 + 1/12 * m/60) * 360))
ay = a * math.sin(math.radians((h/12 + 1/12 * m/60) * 360))
bx = b * math.cos(math.radians(m/60 * 360))
by = b * math.sin(math.radians(m/60 * 360))
print(math.sqrt((ax-bx)**2 + (ay-by)**2))

Buggy submission (verdict: Runtime Error):
a, b, h, m = map(int, input().split())
ax = a * math.cos(math.radians((h/12 + 1/12 * m/60) * 360))
ay = a * math.sin(math.radians((h/12 + 1/12 * m/60) * 360))
bx = b * math.cos(math.radians(m/60 * 360))
by = b * math.sin(math.radians(m/60 * 360))
print(math.sqrt((ax-bx)**2 + (ay-by)**2))
Problem p02713 (python)

Fixed submission:
from math import gcd
n = int(input())
ans = 0
for i in range(1,n + 1):
    for j in range(1, n + 1):
        f = gcd(i, j)
        for k in range(1, n + 1):
            ans += gcd(f, k)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n + 1):
    for j in range(1, n + 1):
        f = fractions.gcd(i, j)
        for k in range(1, n + 1):
            ans += fractions.gcd(f, k)
print(ans)
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = list(map(int,input().split()))
l = sorted(l)[::-1]
check = l[m - 1] > (sum(l) / 4 / m)
print("Yes" if check else "No")
Problem p02732 (python)

Fixed submission:
import collections

def count_defaultdict(it):
    counter = collections.defaultdict(int)
    for x in it:
        counter[x] += 1
    return dict(counter)

_ = int(input())
l = list(map(int, input().split()))
all_sum = 0
count = count_defaultdict(l)
for _, v in count.items():
    all_sum += v * (v - 1) // 2
for i in range(len(l)):
    if count[l[i]] > 1:
        v = count[l[i]]
        print(all_sum - v * (v-1) // 2 + (v-1) * (v-2)//2)
    else:
        print(all_sum)

Buggy submission (verdict: Runtime Error):
import collections

def count_defaultdict(it):
    counter = collections.defaultdict(int)
    for x in it:
        counter[x] += 1
    return dict(counter)
  
n = int(input())
l = list(map(int, input().split()))
all_sum = 0
count = count_defaultdict(l)
for k, v in count:
    all_sum += v * (v - 1) // 2
for i in range(len(l)):
    if count[l[i]] > 1:
        v = count[l[i]]
        print(all_sum - v * (v-1) // 2 + (v-1) * (v-2)//2)
    else:
        print(all_sum)

Buggy submission (verdict: Runtime Error):
import collections
def count_defaultdict(it):
    counter = collections.defaultdict(int)
    for x in it:
        counter[x] += 1
    return dict(counter)
n = int(input())
l = list(map(int, input().split()))
all_sum = 0
count = count_defaultdict(l)
for k, v in count:
    all_sum += v * (v - 1) // 2
for i in range(len(l)):
    if count[l[i]] > 1:
        v = count[l[i]]
        print(all_sum - v * (v-1) // 2 + (v-1) * (v-2)//2)
    else:
        print(all_sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
s = list(set(l))
all_sum = 0
count = {}
for i in range(len(s)):
    v = l.count(s[i])
    if v > 1:
        all_sum += v * (v - 1) // 2
        count[s[i]] = v
    else:
        count[l[i]] = 1
for i in range(len(l)):
    if count[l[i]] > 1:
        v = count[l[i]]
        print(all_sum - v * (v-1) // 2 + (v-1) * (v-2)//2)
    else:
        print(all_sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
d = {}
s_sum = {}
s = list(set(l))
for i in range(len(s)):
    d[s[i]] = l.count(s[i])
for i in range(len(l)):
    if l[i] in s_sum:
        print(s_sum[l[i]])
    else:
        ans = 0
        e = copy.deepcopy(d)
        e[l[i]] -= 1
        for v in e.values():
            if v > 1:
                ans += math.factorial(v) // math.factorial(v -
                                                           2) // math.factorial(2)
        s_sum[l[i]] = ans
        print(ans)
Problem p02741 (python)

Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[int(input())-1])

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

a, b, c = map(int, input().split())
print("Yes" if np.sqrt(a) + np.sqrt(b) < np.sqrt(c) else "No")
Problem p02743 (python)

Fixed submission:
from decimal import *
a, b, c = map(int, input().split())
print("Yes" if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt() else "No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print("Yes" if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) else "No")
Problem p02837 (python)

Fixed submission:
n = int(input())
l = []
ans = 0
check = True
for _ in range(n):
    m = int(input())
    l.append([list(map(int, input().split())) for _ in range(m)])
for i in range(2 ** n):
    bin_i = format(i, 'b').rjust(n, "0")
    check = True
    for k in range(n):
        for x in range(len(l[k])):
            if bin_i[k] == "1":
                if (bin_i[l[k][x][0] - 1] == "1") and (l[k][x][1] == 0):
                    check = False
                elif (bin_i[l[k][x][0]-1] == "0") and (l[k][x][1] == 1):
                    check = False
    if check:
        ans = max(ans, bin_i.count("1"))
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
l = []
for _ in range(n):
    m = int(input())
    l.append([list(map(int, input().split())) for _ in range(m)])
# for i in range(1):
for i in range(2 ** n - 1):
    sj = [True] * n
    bin_i = format(i, 'b').rjust(n, "0")
    for j in range(n):
        sj[j] = (bin_i[j] == "0")
        for k in range(n):
            check = True
            for x in range(len(l[k])):
                # print(j, k, x)
                if sj[k] and sj[l[k][x][0]] and l[k][x][1] == 0:
                    check = False
                    break
                elif sj[k] and not(sj[l[k][x][0]]) and l[k][x][1] == 1:
                    check = False
                    break
                elif (not (sj[k])) and (not(sj[l[k][x][0]])) and l[k][x][1] == 1:
                    check = False
                    break
                elif (not (sj[k])) and (sj[l[k][x][0]]) and l[k][x][1] == 0:
                    check = False
                    break
    if check:
        print(n - i)
        exit()
print(0)
Problem p02841 (python)

Fixed submission:
a, b = map(int, input().split())
c, d = map(int, input().split())
print("0" if a == c else "1")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n // 100
b = n % 100
check = a >= 20 or b / 5 <= a
print("1" if check else "0")
Problem p02900 (python)

Fixed submission:
import fractions
a, b = map(int, input().split())
n = fractions.gcd(a, b)
i = 1
ass = [1]
for i in range(2, int(n**0.5)+1):
    while n % i == 0:
        ass.append(i)
        n = n//i
if n != 1:
    ass.append(n)
print(len(set(ass)))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
l = []
x = fractions.gcd(a, b)
i = 1
# while i * i <= x:
#     if x % i == 0:
#         l.append(i)
#         l.append(x//i)
#     i += 1
# table = list(set(l))
for i in range(1, int(x**0.5)+1):
    if x % i == 0:
        l.append(i)
        if i**2 == x:
            continue
        l.append(x//i)
table = l
ans = []
for i in range(len(table)):
    check = True
    for j in range(2, int(table[i]**0.5)+1):
        if table[i] % j == 0:
            check = False
    if check:
        ans.append(table[i])
print(len(ans))
Problem p02911 (python)

Fixed submission:
n, k, q = map(int, input().split())
points = [0 for _ in range(n + 1)]
for i in range(q):
    answer = int(input())
    points[answer] += 1
for i in range(1, n + 1):
    if (points[i] + k - q) > 0:
        print("Yes")
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
points = []
for i in range(1, n+1):
    points[i] = k
for j in range(q):
    answer = int(input())
    for i in range(1, n + 1):
        if i == answer:
            continue
        else:
            points[i] -= 1
for i in range(1, n+1):
    if points[i] > 0:
        print("Yes")
    else:
        print('No')
Problem p02921 (python)

Fixed submission:
a = input()
b = input()
c = 0
for i in range(len(a)):
    if a[i] == b[i]:
        c += 1
print(c)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
print(int((a+b)*c/2))
Problem p02936 (python)

Fixed submission:
import collections
N, Q = map(int, input().split())
count = [0] * (N + 1)
g = [[] for _ in range(N+1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
for _ in range(Q):
    v, val = map(int, input().split())
    count[v] += val
q = collections.deque()
q.append(1)
check = [0] * (N + 1)
while q:
    v = q.pop()
    check[v] = 1
    for u in g[v]:
        if check[u] == 1:
            continue
        count[u] += count[v]
        q.append(u)
print(*count[1:])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
count = [0] * (N + 1)
g = [[] for _ in range(N+1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
for _ in range(Q):
    v, val = map(int, input().split())
    count[v] += val
q = collections.deque()
q.append(1)
check = [0] * (N + 1)
while q:
    v = q.pop()
    check[v] = 1
    for u in g[v]:
        if check[u] == 1:
            continue
        count[u] += count[v]
        q.append(u)
print(*count[1:])
Problem p02945 (python)

Fixed submission:
a,b = map(int,input().split())

c = a+b
d = a-b
e = a*b
print(max(c,d,e))

Buggy submission (verdict: Runtime Error):
a= int(input())
b= int(input())
c = a+b
d = a-b
e = a*b
print(max(c,d,e))

Buggy submission (verdict: Runtime Error):
a= int(input())
b= int(input())
print(max(a+b,a-b,a*b))
Problem p02995 (python)

Fixed submission:
import fractions
def answer(x, i, j):
    lcm = (i * j) // fractions.gcd(i, j)
    xi = x // i
    xj = x // j
    xlcm = x // lcm
    return x - xi - xj + xlcm
a, b, c, d = map(int, input().split())
ans = answer(b, c, d) - answer(a-1, c, d)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def answer(x, i, j):
    lcm = (i * j) // math.gcd(i, j)
    xi = x // i
    xj = x // j
    xlcm = x // lcm
    return x - xi - xj + xlcm
a, b, c, d = map(int, input().split())
ans = answer(b, c, d) - answer(a-1, c, d)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
def answer(x, i, j):
    lcm = (i * j) // math.gcd(i, j)
    xi = x // i
    xj = x // j
    xlcm = x // lcm
    return x - xi - xj + xlcm
ans = answer(b, c, d) - answer(a-1, c, d)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
def func(x, i, j):
    lcm = (i * j) // math.gcd(i, j)
    xi = x // i
    xj = x // j
    xlcm = x // lcm
    return x - xi - xj + xlcm
print(func(b, c, d) - func(a-1, c, d))
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
l = list(map(int, input().split()))
dis = 0
ans = 0
if sum(l) <= x:
    print(len(l) + 1)
else:
    while (dis <= x):
        dis += l[ans]
        ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))
dis = 0
ans = 0
while (dis <= x):
    dis += l[ans]
    ans += 1
print(ans)
Problem p03059 (python)

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

Buggy submission (verdict: Runtime Error):
import copy
import fractions

n = int(input())
l = list(map(int, input().split()))
sum = 0
if len(l) == 2:
    print(max(l[0], l[1]))
    exit()
else:
    for i in range(n):
        ll = copy.deepcopy(l)
        ll.pop(i)
        ans = ll[0]
        for j in range(1, len(ll)):
            ans = fractions.gcd(ans, ll[j])
            if sum < ans:
                sum = ans
print(sum)
Problem p03086 (python)

Fixed submission:
import re
s = input()
max_re = 0
for i in range(len(s)):
    tar_s = s[i:]
    tar_s = re.search(r'(A|T|C|G)*', tar_s).group()
    max_re = max(max_re, len(tar_s))
print(max_re)

Buggy submission (verdict: Runtime Error):
s = input()
max_re = 0
for i in range(len(s)):
    tar_s = s[i:]
    tar_s = re.search(r'(A|T|C|G)*', tar_s).group()
    max_re = max(max_re, len(tar_s))
print(max_re)
Problem p03210 (python)

Fixed submission:
n = int(input())
if n == 7 or n == 5 or n == 3:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
def sft(n, num, add):
    int_sft = int(num+add)
    if int_sft > n:
        return True
    else:
        l.append(int_sft)
        sft(n, num+add, "3")
        sft(n, num+add, "5")
        sft(n, num+add, "7")

n = int(input())
sft(n, "", "3")
sft(n, "", "5")
sft(n, "", "7")
le = []
for i in range(len(l)):
    c3 = str(l[i]).count("3")
    c5 = str(l[i]).count("5")
    c7 = str(l[i]).count("7")
    if c3 > 0 and c5 > 0 and c7 > 0:
        le.append(l[i])
print(len(list(set(le))))
Problem p03212 (python)

Fixed submission:
def sft(n, num, add):
    int_sft = int(num+add)
    if int_sft > n:
        return True
    else:
        l.append(int_sft)
        sft(n, num+add, "3")
        sft(n, num+add, "5")
        sft(n, num+add, "7")

l=[]
n = int(input())
sft(n, "", "3")
sft(n, "", "5")
sft(n, "", "7")
le = []
for i in range(len(l)):
    c3 = str(l[i]).count("3")
    c5 = str(l[i]).count("5")
    c7 = str(l[i]).count("7")
    if c3 > 0 and c5 > 0 and c7 > 0:
        le.append(l[i])
print(len(list(set(le))))

Buggy submission (verdict: Runtime Error):
n = int(input())
sft(n, "", "3")
sft(n, "", "5")
sft(n, "", "7")
le = []
for i in range(len(l)):
    c3 = str(l[i]).count("3")
    c5 = str(l[i]).count("5")
    c7 = str(l[i]).count("7")
    if c3 > 0 and c5 > 0 and c7 > 0:
        le.append(l[i])
print(len(list(set(le))))
Problem p03352 (python)

Fixed submission:
n = int(input())
l = []
if n == 1:
    print(1)
else:
    for i in range(1, n + 1):
        for j in range(2, n + 1):
            if i ** j > n:
                break
            l.append(i ** j)
    l = list(set(l))
    l = sorted(l)
    ans = 0
    for i in range(len(l)):
        if l[i] > n:
            break
        ans = l[i]
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in reversed(range(n + 1)):
    if math.sqrt(i).is_integer():
        print(i)
        break
Problem p03436 (python)

Fixed submission:
import collections
H, W = map(int, input().split())
l = [input() for _ in range(H)]
check = [([0] * (W)) for _ in range(H)]
white = 0
for i in range(H):
    white += l[i].count(".")
q = collections.deque()
check[0][0] = 1
q.append([0, 0])
g = False
while q:
    h, w = q.popleft()
    for i, j in ([0, 1], [0, -1], [1, 0], [-1, 0]):
        new_h = h + i
        new_w = w + j
        if new_w < 0 or new_h < 0 or new_w > W-1 or new_h > H-1 or l[new_h][new_w] == "#":
            continue
        elif check[new_h][new_w] == 0:
            check[new_h][new_w] = check[h][w] + 1
            q.append([new_h, new_w])
print(white - check[H-1][W-1] if check[H-1][W-1] != 0 else -1)

Buggy submission (verdict: Runtime Error):
import colections
H, W = map(int, input().split())
l = [input() for _ in range(H)]
check = [([0] * (W)) for _ in range(H)]
white = 0
for i in range(H):
    white += l[i].count(".")
q = collections.deque()
check[0][0] = 1
q.append([0, 0])
g = False
while q:
    h, w = q.popleft()
    for i, j in ([0, 1], [0, -1], [1, 0], [-1, 0]):
        new_h = h + i
        new_w = w + j
        if new_w < 0 or new_h < 0 or new_w > W-1 or new_h > H-1 or l[new_h][new_w] == "#":
            continue
        elif check[new_h][new_w] == 0:
            check[new_h][new_w] = check[h][w] + 1
            q.append([new_h, new_w])
print(white - check[H-1][W-1] if check[H-1][W-1] != 0 else -1)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
l = [input() for _ in range(H)]
check = [([0] * (W)) for _ in range(H)]
white = 0
for i in range(H):
    white += l[i].count(".")
q = collections.deque()
check[0][0] = 1
q.append([0, 0])
g = False
while q:
    h, w = q.popleft()
    for i, j in ([0, 1], [0, -1], [1, 0], [-1, 0]):
        new_h = h + i
        new_w = w + j
        if new_w < 0 or new_h < 0 or new_w > W-1 or new_h > H-1 or l[new_h][new_w] == "#":
            continue
        elif check[new_h][new_w] == 0:
            check[new_h][new_w] = check[h][w] + 1
            q.append([new_h, new_w])
print(white - check[H-1][W-1] if check[H-1][W-1] != -1 else -1)