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

Fixed submission:
C = input()

print(chr(ord(C)+1))

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))

p = []
tmp_p = [0]*N
S = []

wa = 0
ac = 0

for i in range(M):
    P, s = list(map(str, input().split()))

    if s == 'AC' and P not in p:
        ac += 1
        p.append(P)
        wa += tmp_p[int(P)-1]
    if s == 'WA' and P not in p:
        tmp_p[int(P)-1] += 1


print(ac, wa)
Problem p02817 (python)

Fixed submission:
S, T = list(map(str, input().split()))

print(T+S)

Buggy submission (verdict: Runtime Error):
S, T = list(map(int, input().split()))

print(T+S)
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 = input()
 
if S = 'Sunny':
  print('Cloudy')
elif S = 'Cloudy':
  print('Rainy')
else:
  print('Sunny')

Buggy submission (verdict: Runtime Error):
S = input()

if S = 'Sunny':
    print('Cloudy')
elif S = 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
Problem p02934 (python)

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

ans = 0

for i in range(N):
    ans += 1 / A[i]

print(1/ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ans = (A[0] * A[1]) / (A[0] + A[1])

for i in range(2, N):
    ans += (ans * A[i]) / (ans + A[i])

print(ans)
Problem p02946 (python)

Fixed submission:
K, X = list(map(int, input().split()))

T = X - K + 1

ans = []

for i in range(K*2 - 1):
    ans.append(T)
    T += 1

print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
#include<iostream>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i)
#define rep(i,n) REP(i,0,n)
int main(){
    int K, X;
    cin >> K >> X;
    X -= K - 1;
    rep(i,2*K-1) cout<<X+i<<" ";
    cout<<endl;

    return 0;

}
Problem p03000 (python)

Fixed submission:
N, X = list(map(int, input().split()))

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

count = 0
now = 0
for i in L:
    if now > X:
        break
    now += i
    count += 1
if now <= X:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, X = list(map(int, input().split()))

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


now = 0
i = 0
ans = 0
while True:
    if now > X:
        break
    now += L[i]
    i += 1
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, X = list(map(int, input().split()))

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


now = 0
i = 0
while True:
    if now > X:
        break
    now += L[i]
    i += 1

print(i)
Problem p03061 (python)

Fixed submission:
'''
import math

def gcd (a,b):
    if (b == 0):
        return a
    else:
        return gcd(b, a % b)

def gcd_list(arr):

    ans = arr[0]
    for c in arr[1::]:
        ans = gcd(ans , c)
    return ans
'''
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N = int(input())

A = list(map(int, input().split()))
A.sort()

af = A[0]
ag = A[1]

F = make_divisors(af)
G = make_divisors(ag)
F.sort(reverse=True)
G.sort(reverse=True)
del F[-1]
del G[-1]

'''
print(F)
print(G)
'''

ansf = 1
ansg = 1

for i in F:
    count = 0
    for j in A:
        if j % i != 0:
            count += 1
            if count == 2:
                break

    if count == 1:
        ansf = i
        break
    if count == 0:
        ansf = i
        break

for i in G:
    count = 0
    for j in A:
        if j % i != 0:
            count += 1
            if count == 2:
                break

    if count == 1:
        ansg = i
        break

print(max(ansf,ansg))
'''
g = gcd_list(A)
print(g)

for i in range(N):
    tmp = A.pop(0)
    if g < gcd_list(A):
        g = gcd_list(A)
    A.append(tmp)

print(g)
'''

Buggy submission (verdict: Runtime Error):
import math

def gcd_list(arr):

    ans = arr[0]
    for c in arr[1::]:
        ans = math.gcd(ans , c)
    return ans

N = int(input())

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

g = gcd_list(A)

for i in range(N):
    tmp = A.pop(0)
    if g < gcd_list(A):
        g = gcd_list(A)
    A.append(tmp)

print(g)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N = int(input())

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

g = gcd_list(A)

for i in range(N):
    tmp = A.pop(0)
    if g < gcd_list(A):
        g = gcd_list(A)
    A.append(tmp)

print(g)
Problem p03106 (python)

Fixed submission:
A, B, K = list(map(int, input().split()))

S = [1]

for i in range(2,min(A+1,B+1)):
    if A % i == 0 and B % i == 0:
        S.append(i)

S.sort(reverse=True)

print(S[K-1])

Buggy submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))

S = [1]

for i in range(2,min(A,B)):
    if A % i == 0 or B % i == 0:
        S.append(i)

S.sort(reverse=True)

print(S[K-1])

Buggy submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))

S = [1]

for i in range(2,min(A,B)):
    if A % i == 0 and B % i == 0:
        S.append(i)

S.reverse()

print(S[K-1])

Buggy submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))

S = [1]

for i in range(2,min(A,B)):
    if A % i == 0 and B % i == 0:
        S.append(i)

S.append()

print(S[K-1])

Buggy submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))

S = [1]

for i in range(2,min(A,B)):
    if A % i == 0 and B % i == 0:
        S.append(i)

print(S[K-1])

Buggy submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))

S = [1]

for i in range(2,min(A,B)):
    if A % i == 0 or B % i == 0:
        S.append(i)

print(S[K-1])

Buggy submission (verdict: Runtime Error):
A, B, K = list(map(int, input().split()))

S = []

for i in range(1, min(A,B)):
    if (A % i == 0) or (B % i == 0):
        S.append(i)
        

if A == 1 and B == 1 and K == 1:
    print(1)
else:
    print(S[K-1])
Problem p03238 (python)

Fixed submission:
N = int(input())

if N == 1:
    print("Hello World")
if N == 2:
    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")
if N == 2:
    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 p03239 (python)

Fixed submission:
N, T = list(map(int, input().split()))

ans = 10**9

for i in range(N):
    c, t = list(map(int, input().split()))
    if t <= T:
        if c < ans:
            ans = c

if ans == 10**9:
    print('TLE')
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())

c = [0 for i in range(N)]
t = [0 for i in range(N)]

count = 0

for i in range(N):
    c[i], t[i] = map(int, input().split())
    
for i in range(N):
    if t[i] > T:
        del c[i]
        count += 1
        
c.sort()

if count != N:
    print(c[0])
else:
    print("TLE")

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())

c = [0 for i in range(N)]
t = [0 for i in range(N)]

for i in range(N):
    c[i], t[i] = map(int, input().split())
    
for i in range(N):
    if t[i] > T:
        del c[i]
        
c.sort()

print(c[0])
Problem p03280 (python)

Fixed submission:
A, B = map(int, input().split())

print((A - 1) * (B - 1))

Buggy submission (verdict: Runtime Error):
N = int(input())

if N <= 104 and N >= 1:
  print(0)
elif N >= 105:
  print(1)
elif N >= 135:
  print(2)
elif N >= 145:
  print(3)
elif N >= 165:
  print(4)
elif N >= 189:
  print(5)
elif N >= 195:
  print(6)
Problem p03284 (python)

Fixed submission:
N, K = map(int, input().split())
 
if N % K >= 1:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N K = map(int, inpur().split())

if N % K => 1:
  print(1)
else:
  print(0)
Problem p03294 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
print(sum(a) - N)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


N = int(input())

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

ans = 0
    
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

for i in range(len(a)):
    ans += (lcm_list(a) - 1) % a[i]
    
print(ans)
Problem p02683 (python)

Fixed submission:
import itertools

n,m,x = map(int,input().split())
C, A = [], []
for i in range(n):
    ca = list(map(int, input().split()))
    C.append(ca[0])
    A.append(ca[1:])

min_price = 10**9
for k in range(n):
    for comb in itertools.combinations(range(n), k+1):
        sums = [0] * m
        price = 0
        for c in comb:
            price += C[c]
            for i in range(m):
                sums[i] += A[c][i]

#         print(comb)
#         print(sums)
#         print(min_price)
        if sum([y >= x for y in sums]) == m:
            min_price = min(min_price, price)

if min_price == 10**9:
    print('-1')
else:
    print(min_price)

Buggy submission (verdict: Runtime Error):
import itertools
min_price = 10**9
for k in range(n):
    for comb in itertools.combinations(range(m), k+1):
        sums = [0] * m
        price = 0
        for c in comb:
            price += C[c]
            for i in range(m):
                sums[i] += A[c][i]

#         print(comb)
#         print(sums)
        if sum([y >= x for y in sums]) == len(A):
            min_price = min(min_price, price)

if min_price == 10**9:
    print('-1')
else:
    print(min_price)
Problem p02696 (python)

Fixed submission:
a, b, n = map(int, input().split())
def f(x):
  return (a*x)//b - a*(x//b)
 
print(f(min(b-1, n)))

Buggy submission (verdict: Runtime Error):
a. b. x = map(int, input().split())
def f(x):
  return (a*x)//b - a*(x//b)

print(f(min(b-1, n))
Problem p02702 (python)

Fixed submission:
s = input()[::-1]

sum_of_digits = 0

cnts = [0] * 2019

cnts[0] = 1

d = 1

for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019
    cnts[sum_of_digits] += 1

ans = 0
    
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

print(ans)

Buggy submission (verdict: Runtime Error):
# import sys
# s = input()
# n = len(s)

# if n < 4:
#     print(0)
#     sys.exit()

# ans = 0
# for i in range(n-3):
#     for j in range(i+3, n):
#         a = int(s[i:j+1])
#         # print(i, j, a, a%2019)
#         if a % 2019 == 0:
#             ans += 1
#             print(a)
# print(ans)

# count = 0
# s = input()
# a = int(s) // 2019
# print(a)
# for i in range(a):
#     if str(i*2019) in s:
#         print(str(i*2019))
#         count += 1
# print(count)

import sys
s = input()
n = len(s)
import numpy as np
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

res = [int(s[a:])%2019 for a in range(n)]
num, count = np.unique(res, return_counts=True)
ans = 0
for n, a in zip(num, count):
    if n == 0:
        ans += a
    else:
        if a > 1:
            ans += combinations_count(a, 2)
print(ans)
Problem p02720 (python)

Fixed submission:
import sys
k = int(input())
old = [1,2,3,4,5,6,7,8,9]
new = []
count = 9
if k <= count:
    print(old[k-1])
    sys.exit()
else:
    while count < k:
        if len(old) > 0:
            i = old.pop(0)
            last = i%10
            if last != 0:
                new.append(i*10 + (last-1))
                count += 1
                if count == k:
                    break
            new.append(i*10 + last)
            count += 1
            if count == k:
                break
            if last != 9:
                new.append(i*10 + (last+1))
                count += 1
                if count == k:
                    break
        else:
            old = new
            new = []
    print(new[-1])

Buggy submission (verdict: Runtime Error):
k = int(input())
old = [1,2,3,4,5,6,7,8,9]
new = []
count = 9
if k <= count:
    print(ans[k])
while count < k:
    if len(old) > 0:
        i = old.pop(0)
        last = i%10
        if last != 0:
            new.append(i*10 + (last-1))
            count += 1
            if count == k:
                break
        new.append(i*10 + last)
        count += 1
        if count == k:
            break
        if last != 9:
            new.append(i*10 + (last+1))
            count += 1
            if count == k:
                break
    else:
        old = new
        new = []
print(new[-1])
Problem p03061 (python)

Fixed submission:
from fractions import gcd
from functools import reduce

N=int(input())
A=[i for i in map(int,input().split())]

ans=[]
L={}
L[0]=0
R={}
R[N+1]=0
R[N+2]=0

def gcd2(x,a):
    if x==0:
        return a
    else:
        return gcd(x,a)

for i in  range(N):
    L[i+1]=gcd2(L[i],A[i])
    R[N-i]=gcd2(R[N-i+1],A[-(i+1)])

for i in range(N):
    ans.append(gcd2(L[i],R[i+2]))
print(max(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[i for i in map(int,input().split())]

from math import gcd
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

ans=[]
for i in range(N):
    B=A.copy()
    del B[i]
    ans.append(gcd_list(B))
    
print(max(ans))
Problem p03069 (python)

Fixed submission:
N = int(input())
S = input()
 
left_black=0
right_white=S.count(".")
ans=left_black+right_white

for i in S:
    if i==".":
        right_white-=1
        ans=min(ans,left_black+right_white)
    else:
        left_black+=1
        ans=min(ans,left_black+right_white)
print(ans)

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

dic={'.':0,'#':1}
N=int(input())
S=np.array([dic[i] for i in input()])
ans=N
arr=np.ones((N,N))


if S.sum()==0:
    print(0)
elif S.sum()==N:
    print(0)    
else:
    for i in range(N):
        arr[i,:N-i]=0
        ans=min(ans,(arr[i,:]!=S).sum())
        
    print(ans)

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

dic={'.':0,'#':1}
N=int(input())
S=np.array([dic[i] for i in input()])
ans=N
arr=np.ones((N,N))


if S.sum()==0:
    print(0)
elif S.sum()==N:
    print(0)    
else:
    for i in range(N):
        arr[i,:N-i]=0
        ans=min(ans,(arr[i,:]!=S).sum())
        
    print(ans)

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

dic={'.':0,'#':1}
N=int(input())
S=np.array([dic[i] for i in input()])

arr=np.ones((N,N))
for i in range(N):
    arr[i,:N-i]=0

if S.sum()==0:
    print(0)
elif S.sum()==N:
    print(0)    
else:
    print(min((arr!=S).sum(axis=1)))

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

dic={'.':0,'#':1}
N=int(input())
S=np.array([dic[i] for i in input()])
arr=np.flip(np.triu(np.ones((N,N))),axis=1)==0

if S.sum()==0:
    print(0)
elif S.sum()==N:
    print(0)    
else:
    print(min((arr!=S).sum(axis=1)))
Problem p03074 (python)

Fixed submission:
N,K=map(int,input().split())
S=input()+'E'

# Initial values
ans=1
l=0
r=0
edge=[]

# 立っているグループのカウント
# 最初の文字が0なら1
if S[l]=='0':
    count=1
else:
    count=0    

# ｒがNまでループ
while(r < N-1):
    r+=1
    #　もし1=>0の境目だと、countを追加
    if ( S[r-1]=='1') & (S[r]=='0'):
        count+=1

    #　countがKを超すとlのループに入る(Break)
    while(count>K):
        l+=1
        # lを更新したとき0=>1の境目だと、l~r間の0グループが減るので、countを減らす
        if (S[l-1]=='0') & (S[l]=='1'):
            count-=1
        #lがrを追い越さないように
        if l==r:
            r+=1
        #print(r,l,count,ans)

    #何事もなく 進んだ場合は答えの更新
    ans=max(ans,r-l+1)
    #print(r,l,count,ans) 

print(ans)

Buggy submission (verdict: Runtime Error):
ans=-1
l=0

r=0
R=0

q=[0]
for i in range(1,N-1):
    if S[i]!=S[i-1]:
        q.append(i)
q.append(N+1)
        
L=q[l]
R=q[r]

S[L:R]

for l in range(len(q)):
    count=0
    for r in range(l+1,len(q)):        
        L=q[l]
        R=q[r]
        print(S[L:R])
        if S[L:R][-1]=='0':
            count+=1
            if count>K:
                break
        ans=max(ans,len(S[L:R]))
        
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()

q=[0]
for i in range(1,N-1):
    if S[i]!=S[i-1]:
        q.append(i)

answers=[]

for i,p in enumerate(q):
    if S[p]=='1':
        if i+2*K+1>len(q)-1:
                answers.append(N-p)
        else:
            answers.append(q[min(i+2*K+1,len(q)-1)]-p)
#    else:
#        answers.append(q[min(2*K,len(q)-1)]-p+1)
        
print(max(answers))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()

q=[0]
for i in range(1,N):
    if S[i]!=S[i-1]:
        q.append(i)

answers=[]

for p in q[:(2*K+1)]:
    if S[p]==1:
        answers.append(q[min(2*K+1,N)]-p+1)
    else:
        answers.append(q[min(2*K,N)]-p+1)
        
print(max(answers))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()

q=[0]
for i in range(1,N):
    if S[i]!=S[i-1]:
        q.append(i)

answers=[]

for p in q[:(2*K+1)]:
    if S[p]==1:
        answers.append(q[min(2*K+1,N)]-p+1)
    else:
        answers.append(q[min(2*K,N)]-p+1)
        
print(max(answers)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()

q=[0]
for i in range(1,N):
    if S[i]!=S[i-1]:
        q.append(i)

answers=[]

for p in q[:(2*K+1)]:
    if S[p]==1:
        answers.append(q[min(2*K+1,N)]-p+1)
    else:
        answers.append(q[min(2*K,N)]-p+1)
Problem p03078 (python)

Fixed submission:
from heapq import heappop, heappush

#input
x,y,z,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]

#sort
a=sorted(a,reverse=True)
b=sorted(b,reverse=True)
c=sorted(c,reverse=True)

q=[]
heappush(q,(-(a[0]+b[0]+c[0]),0,0,0))
s={(0,0,0)}

for n in range(k):
    p,h,i,j=heappop(q)
    
    if  (h+1<x) and ((h+1,i,j) not in s):
        heappush(q,(-(a[h+1]+b[i]+c[j]),h+1,i,j))
        s.add((h+1,i,j))
        
    if  (i+1<y) and ((h,i+1,j) not in s):
        heappush(q,(-(a[h]+b[i+1]+c[j]),h,i+1,j))
        s.add((h,i+1,j))
        
    if  (j+1<z) and ((h,i,j+1) not in s):
        heappush(q,(-(a[h]+b[i]+c[j+1]),h,i,j+1))        
        s.add((h,i,j+1))
        
    print(-p)

Buggy submission (verdict: Runtime Error):
#input
x,y,z,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]

#sort
a=sorted(a,reverse=True)
b=sorted(b,reverse=True)
c=sorted(c,reverse=True)

q=[]
heappush(q,(-(a[0]+b[0]+c[0]),0,0,0))
s={(0,0,0)}

for n in range(k):
    p,h,i,j=heappop(q)
    
    if  (h+1<x) and ((h+1,i,j) not in s):
        heappush(q,(-(a[h+1]+b[i]+c[j]),h+1,i,j))
        s.add((h+1,i,j))
        
    if  (i+1<y) and ((h,i+1,j) not in s):
        heappush(q,(-(a[h]+b[i+1]+c[j]),h,i+1,j))
        s.add((h,i+1,j))
        
    if  (j+1<z) and ((h,i,j+1) not in s):
        heappush(q,(-(a[h]+b[i]+c[j+1]),h,i,j+1))        
        s.add((h,i,j+1))
        
    print(-p)
         
for j in range(1,k):
  q_value=q[-1][0]
  q_x=q[-1][1]
  q_y=q[-1][2]
  q_z=q[-1][3]
  new=max(
Problem p03085 (python)

Fixed submission:
x=input()
dic={'A':'T',
      'C':'G',
      'G':'C',
      'T':'A',
     }
 
print(dic[x])

Buggy submission (verdict: Runtime Error):
x=input()
dic={'A':'T',
      'C':'G',
      'G':'C',
      'T':,'A',
     }

print(dic[x])
Problem p02994 (python)

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

total = sum(list(range(l, n+l)))
pie = []
min_abs = 9999999
for i in range(n):
    a = list(range(l, n+l))
    a.pop(i)
    if abs(total-sum(a)) < min_abs:
        min_abs = abs(total-sum(a))
        ans = sum(a)
print(ans)

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

total = sum(list(range(l, n+l)))
pie = []
min_abs = math.inf
for i in range(n):
    a = list(range(l, n+l))
    a.pop(i)
    if abs(total-sum(a)) < min_abs:
        min_abs = abs(total-sum(a))
        ans = sum(a)
print(ans)
Problem p03076 (python)

Fixed submission:
t=[int(input()) for _ in range(5)]
ans=0
b=[x%10 for x in t]
c=[x%10 for x in t if x%10>0]
if c==[]:
    print(sum(t))
else:
    for i in range(5):
        if b[i]>0:
            ans+=(t[i]//10+1)*10
        else:
            ans+=t[i]
    print(ans-10+min(c))

Buggy submission (verdict: Runtime Error):
t=[int(input()) for _ in range(5)]
ans=0
b=[x%10 for x in t]
c=[x%10 for x in t if x%10>0]
for i in range(5):
    if b[i]>0:
        ans+=(t[i]//10+1)*10
    else:
        ans+=t[i]
print(ans-10+min(c))
Problem p03212 (python)

Fixed submission:
n=int(input())
import bisect
import itertools
l=len(str(n))
ans=[]
num=[]
x=['3', '5', '7']
for k in range(3,l+1):
    m=list(itertools.product(x, repeat=k))
    num.extend(m)
for i in range(len(num)):
    y=num[i]
    if '3' in y and '5' in y and '7' in y:
        number=''
        for j in range(len(y)):
            number+=y[j]
        ans.append(int(number))
ans.sort()
print(bisect.bisect_right(ans, n))

Buggy submission (verdict: Runtime Error):
n=int(input())
import bisect
import itertools
l=len(str(n))
ans=[]
num=[]
for k in range(3,l+1):
    m=list(itertools.product(x, repeat=k))
    num.extend(m)
for i in range(len(num)):
    y=num[i]
    if '3' in y and '5' in y and '7' in y:
        number=''
        for j in range(len(y)):
            number+=y[j]
        ans.append(int(number))
ans.sort()
print(bisect.bisect_left(ans, n))

Buggy submission (verdict: Runtime Error):
n=int(input())
import bisect
import itertools
ans=[]
num=[]
for i in range(3,l+1):
    m=list(itertools.product(x, repeat=i))
    num.extend(m)
for i in range(len(num)):
    y=num[i]
    if '3' in y and '5' in y and '7' in y:
        number=''
        for j in range(len(y)):
            number+=y[j]
        ans.append(int(number))
ans.sort()
print(bisect.bisect_left(ans, n))
Problem p03244 (python)

Fixed submission:
n=int(input())
v=list(map(int, input().split()))
import collections
v1=v[0::2]
v11=collections.Counter(v1)
v2=v[1::2]
v22=collections.Counter(v2)
o=v11.most_common()+([(0,0)])
e=v22.most_common()+([(0,0)])
if o[0][0]!=e[0][0]:
    print(n-o[0][1]-e[0][1])
else:
    print(min(n-o[0][1]-e[1][1],n-o[1][1]-e[0][1]))

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int, input().split()))
import collections
v1=v[0::2]
v11=collections.Counter(v1)
v2=v[1::2]
v22=collections.Counter(v2)
ans=0
o=v11.most_common()[0][0]
e=v22.most_common()[0][0]
if e!=o:
    for x in v1:
        if x!=o:
            ans+=1
    for y in v2:
        if y!=e:
            ans+=1
else:
    if v1.count(o)>v2.count(e):
        for x in v1:
            if x!=o:
                ans+=1
        for y in v2:
            if y!=v22.most_common()[1][0]:
                ans+=1
    else:
        for x in v1:
            if x!=v11.most_common()[1][0]:
                ans+=1
        for y in v2:
            if y!=v2:
                ans+=1
print(ans)
Problem p02555 (python)

Fixed submission:
from scipy.special import comb

S = int(input())

sho = S // 3
ans = 1
S -= 5
if sho > 0:
    for i in range(1,sho):
        ans += comb(S, i, exact=True)
        S -= 2
    print(int(ans)%(10**9+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

S = int(input())

sho = S // 3
ans = 1
S -= 5
if sho > 0:
    for i in range(1,sho):
        ans += cmb(S, i)
        S -= 2
    print((ans)%(10**9+7))
else:
    print(0)