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

Fixed submission:
import collections

def main():
    n = int(input())
    a = list(map(int, input().split()))
    
    cnt = collections.defaultdict(int)
    for var in a:
        cnt[var] += 1
    
    sum_a = sum(a)
    
    q = int(input())
    for _ in range(q):
        b, c = list(map(int, input().split()))
        diff = (c-b) * cnt[b]
        sum_a += diff
        print(sum_a)
        cnt[c] += cnt[b]
        cnt[b] = 0
        
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

import collections

def main():
    n = int(input())
    a = list(map(int, input().split()))
    
    cnt = collections.defaultdict(int)
    for var in a:
        cnt[var] += 1
    
    sum_a = sum[a]
    
    q = int(input())
    for _ in range(q):
        b, c = list(map(int, input().split()))
        diff = (c-b) * cnt[b]
        sum_a += diff
        print(sum_a)
        cnt[c] += cnt[b]
        cnt[b] = 0
        
if __name__ == '__main__':
    main()
Problem p02657 (python)

Fixed submission:
str_num = input()
num_list = str_num.split()

answer = int(num_list[0]) * int(num_list[1])
print(answer)

Buggy submission (verdict: Runtime Error):
def main():
    N = input()
    str_num = input()
    num_list = str_num.split()
    
    if '0' in num_list:
        print(0)
        return
    
    answer = 1
    for num in num_list:
        answer *=int(num)
        if answer > 10**18:
            answer = -1
            break

    print(answer)

main()
Problem p02658 (python)

Fixed submission:
def main():
    N = input()
    str_num = input()
    num_list = str_num.split()
    
    if '0' in num_list:
        print(0)
        return
    
    answer = 1
    for num in num_list:
        answer *=int(num)
        if answer > 10**18:
            answer = -1
            break

    print(answer)

main()

Buggy submission (verdict: Runtime Error):
str_num = input()
num_list = str_num.split()

answer = 1
for i in range(1, int(num_list[0])+1):
    answer *=int(num_list[i])
    if answer >= 10**18:
        answer = -1
        break

print(answer)
Problem p02681 (python)

Fixed submission:
def Registration():
    S = input()
    T = input()
    
    flag = False
    if len(S) + 1 == len(T):
        if S == T[:-1]:
            flag = True
    
    if flag:
        print('Yes')
    else:
        print('No')

Registration()

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    n, m, x = list(map(int, input().split()))
    
    c = []
    a = []
    
    def calc_price(bit):
        price_total = 0
        learn_total = [0] * m #理解度
        
        for i in range(n):
            if (bit >> i) & 1:
                price_total += c[i]
                learn = a[i]
                for j, la in enumerate(learn):
                    learn_total[j] += la
        
        if check(learn_total):
            return price_total
        else:
            return INF
        
    def check(learn_total):
        for i in range(m):
            if learn_total[i] < x:
                return False
        return True
    
    for i in range(n):
        c_temp, *a_temp = list(map(int, input().split()))
        c.append(c_temp)
        a.append(a_temp)
        
    INF = float("inf")
    ans = INF
    
    for bit in range(1 << n):
        price = calc_price(bit)
        ans = min(ans, price)
    
    if ans == INF:
        print(-1)
    else:
        print(ans)
Problem p02708 (python)

Fixed submission:
n,k=map(int,input().split())
print(((n*(n+1)*(n+2)-(3*n-2*k+4)*(k-1)*k)//6-k+n+2)%(10**9+7))

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;
int main() {
    long long N, K;
    cin >> N >> K;
    long long M = N+1, L = K-1;
    long long res = M*(M*M+5)/6 + L*(L*L*2+L*3-5-M*(L+1)*3)/6;
    cout << res%MOD << endl;
}
Problem p02713 (python)

Fixed submission:
import math
def gcd(a,b,c):
    a = math.gcd(a, b)
    a = math.gcd(a, c)
    return a
ans=0
K=int(input())
for i in range(1,K+1): 
    for j in range(1,K+1):
        for k in range(1, K+1):
            ans+=gcd(i,j,k)
print(ans)

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

import numpy as np

snp=np.array(S)
R=list(np.where(snp=='R')[0])
G=list(np.where(snp=='G')[0])
B=np.where(snp=='B')[0]
ans=0
for r in R:
    for g in G:
        d=abs(r-g)
        front=min(r,g)
        back=max(r,g)
        ans+=sum((B!=front-d)*(B!=back+d)*(B!=(front+back)/2))
print(ans)
Problem p02727 (python)

Fixed submission:
X, Y, A, B, C = map(int,input().split())
P = sorted(list(map(int,input().split())), reverse=True)
Q = sorted(list(map(int,input().split())), reverse=True)
R = sorted(list(map(int,input().split())), reverse=True)
P = P[:X]
Q = Q[:Y]
A = P + Q + R
A.sort(reverse=True)
ans = sum(A[:X+Y])
print(ans)

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = map(int,input().split())
P = sorted(list(map(int,input().split())), reverse=True)
Q = sorted(list(map(int,input().split())), reverse=True)
R = sorted(list(map(int,input().split())), reverse=True)
P = P[:X]
Q = Q[:Y]
A = P + Q + R
A.sorted(reverse=True)
ans = sum(A[:X+Y])
print(ans)
Problem p02780 (python)

Fixed submission:
import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=np.concatenate([np.array([0]),(p+1).cumsum()],0)

print((pcm[K:]-pcm[0:-K]).max() /2)

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

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=(p+1).cumsum()

print((pcm[K:]-pcm[0:-K]).max() /2)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

ans=0
for i in range(N-K+1):
    ans=max(ans, sum(p[i:i+K]))

print((ans+K)/2)
Problem p02854 (python)

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

import numpy as np

A=np.array(A)

from bisect import bisect_left
s = bisect_left(A.cumsum(), A.sum()/2)

if A.sum()/2 in A.cumsum():
    print(0)
else:
    print(int(min(abs(A.sum()/2 - A[0:s].sum()) * 2, abs(A.sum()/2 - A[0:s+1].sum()) * 2)))

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

import numpy as np

A=np.array(A)

from bisect import bisect
s = bisect(A.cumsum(), A.sum()/2)

if A.sum()/2 in A.cumsum():
    print(0)
else:
    print(min(A.sum() - A[0:s+1].sum(), A.sum() - A[s+1:N].cumsum()))
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int,input().split())
ans = math.degrees(math.atan(2*(b-x/a**2)/a))
if ans <= math.degrees(math.atan(b/a)):
    print(max(ans,0))
else:
    ans = math.degrees(math.atan(b/(2*x/a/b)))
    print(max(ans,0))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())), reverse=True))

l=-1
r=10**12+2
mid=(l+r)//2
while r-l>1:
    m=0
    for i in range(N):
        a=mid//F[i]
        m+=max(0,A[i]-a)
    if m>K:
        l=mid
    else:
        r=mid
    mid=(l+r)//2
print(l+1)
Problem p02888 (python)

Fixed submission:
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        ab=L[i]+L[j]
        r=bisect.bisect_left(L,ab)
        l=j+1
        ans+=r-l
print(ans)

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

def aaa(l):
    x=0
    a=l[0]
    b=l[1]
    c=l[2]
    if a+b>c:
        if b+c>a:
            if c+a>b:
                x=1
    return x
ans=0
for l in list(itertools.combinations(L, 3)):
    ans+=aaa(list(l))
print(ans)
Problem p02924 (python)

Fixed submission:
N=int(input())
print(N*(N-1)//2)

Buggy submission (verdict: Runtime Error):
N=int(input())
P=list(range(1,N+1))
print(sum(P[0:N-1])+P[-1]%P[0])
Problem p02945 (python)

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

print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
s=["".join(sorted(input())) for _ in range(N)]
print(int(sum(list(map(lambda x: x*(x-1)/2*1, collections.Counter(s).values())))))
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
ans=(a+b)/2
if ans%1==0:
    print(int(ans//1))
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input.split())
ans=(a+b)/2
if ans%2==0:
  print(ans//1)
else:
  print("IMPOSSIBLE")
Problem p02963 (python)

Fixed submission:
import math
S=int(input())
X1,Y1=0,0
X2=math.ceil(math.sqrt(S))
Y3=X2
Y2=1
X3=X2*Y3-S
print(X1,Y1,X2,Y2,X3,Y3)

Buggy submission (verdict: Runtime Error):
import functools
import operator
S=int(input())
prod = functools.partial(functools.reduce, operator.mul)
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
SS=factorize(S)
if len(SS)>1:
    print(0,0,prod(SS[1::2]),0,0,prod(SS[0::2]))
else:
    print(0,0,SS[0],0,0,1)

Buggy submission (verdict: Runtime Error):
import functools
import operator
S=int(input())
prod = functools.partial(functools.reduce, operator.mul)
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
print(0,0,prod(factorize(S)[1::2]),0,0,prod(factorize(S)[0::2]))
Problem p02975 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
a=1
for i in A:
    a^=i
print(["No","Yes"][a==1])

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
if all(map(lambda x:x==0,A)) or (sum(map(lambda x:x==0,A))==(N/3) and (len(set(A))==2) or (len(set(A))==3) and list(set(A))[0]^list(set(A))[1]^list(set(A))[2]==0 and A.count(list(set(A))[0])==A.count(list(set(A))[1]) and A.count(list(set(A))[1])==A.count(list(set(A))[2]) and A.count(list(set(A))[3])==A.count(list(set(A))[0])):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
a=1;for i in A:a^=i 
print(["No","Yes"][a==1])

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
def binbin(a):
    return int(bin(a).split("b")[1])
arr=[A[-1]]
arr.extend(A)
arr.append(A[0])
ans=[]
for i in range(1,N+1):
    ans.append(int(binbin(arr[i])) == int("".join(list(map(lambda x:str(int(x)%2),str(binbin(arr[i-1])+binbin(arr[i+1])))))))

if all(ans):
    if any(ans)==False:
        print("Yes")
else:
    if any(ans)==False:
    print("No")

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

arr=[A[-1]]
arr.extend(A)
arr.append(A[0])
ans=[]
for i in range(1,N+1):
    ans.append(int(binbin(arr[i])) == int("".join(list(map(lambda x:str(int(x)%2),str(binbin(arr[i-1])+binbin(arr[i+1])))))))

print("Yes" if all(ans) else "No")
Problem p02995 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
CC = B // C - A // C + (A % C == 0)
DD = B // D - A // D + (A % D == 0)
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd (a, b)
E = lcm(C, D)
EE = B // E - A // E + (A % E == 0)
print(B - A + 1 - CC - DD + EE)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
CC = B // C - A // C + (A % C == 0)
DD = B // D - A // D + (A % D == 0)
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
E = lcm(C, D)
EE = B // E - A // E + (A % E == 0)
print(B - A + 1 - CC - DD + EE)
Problem p03031 (python)

Fixed submission:
n,m=map(int,input().split())
s=[]
for _ in range(m):
    s.append(list(map(int,input().split()))[1:])
p=list(map(int,input().split()))

import itertools

cnt=0
for i in itertools.product([0,1],repeat=n):
    tn_arr=[]
    for j in range(m):
        on_cnt=0
        for k in range(len(s[j])):
            on_cnt+=i[s[j][k]-1]
        if on_cnt%2==p[j]:
            tn_arr.append(True)
        else:
            tn_arr.append(False)
    if all(tn_arr):
        cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
ans = 0
n,m = map(int, input().split())
s_list = []
s_count_list = []
for _ in range(m):
    s = list(map(int,input().split()))
    s_count_list.append(s[0])
    s_list.append(s[1:])
oe = list(map(int,input().split()))   
seq = list(range(1, n+1))
for i in range(1, n+1):
    cmb = list(itertools.combinations(seq,i))
    for j in range(len(cmb)):
        ansv = []
        for k in range(m):
            ss = []
            for l in range(len(s_list[k])):
                if s_list[k][l] in list(cmb[j]):
                    ss.append(s_list[k][l])
            if len(ss)%2 == oe[k]:
                ansv.append(True)
            else:
                ansv.append(False)
        if all(ansv):
            ans += 1
print(ans)
Problem p03087 (python)

Fixed submission:
N,Q=map(int,input().split())
S=input()
t = [0]*(N+1)
for i in range(len(S)-1):
    if S[i] == 'A' and S[i+1] == 'C':
        t[i+1] = 1

import numpy
res = numpy.cumsum(t)

for _ in range(Q):
    l=list(map(int,input().split()))
    print(res[l[1]-1]-res[l[0]-1])

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

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

t = [0]*(N+1)
for i in range(len(S)-1):
    if S[i] == 'A' and S[i+1] == 'C':
        t[i+1] = 1

for j in range(len(t)):
    print(sum(t[l[j][0]:l[j][1]]))
Problem p03160 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
dp = [0,abs(a[0]-a[1])]
for i in range(2,N):
    dp.append(min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2])))
print(dp[N-1])

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

def chmin(a,b):
    if a > b:
        return b
    else:
        return a

dp[0] = 0

for i in range(1,N):
    dp[i] = chmin(dp[i], dp[i-i] + abs(h[i] - h[i-1]))
    if i > 1:
        dp[i] = chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[N-1])
Problem p03192 (python)

Fixed submission:
N = str(input())

ans = 0
for i in range(0, 4):
    if N[i] == '2':
        ans = ans + 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
cnt = 0
for i in range(0, N):
    if int(input()) != 1:
        cnt = cnt + 1

if N % 2 == 0:
    if cnt % 2 == 0:
        print('second')
    else:
        print('first')
else:
    if cnt % 2 == 0:
        print('first')
    else:
        print('second')
Problem p03195 (python)

Fixed submission:
N = int(input())
cnt = 0
for i in range(0, N):
    if int(input()) % 2 == 1:
        cnt = cnt + 1

if cnt > 0:
    print('first')
else:
    print('second')

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

for i in range(0, N):
    if int(input())% 2 == 0:
        cnt = cnt + 1
if cnt % 2 == 0:
    print('first')
else:
    print('second')

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

Alist = []
for i in range(0, N):
    Alist.append(int(input()))

for j in range(0, len(Alist)):
    if Alist[j] % 2 == 0:
        cnt = cnt + 1
if cnt % 2 == 0:
    print('second')
else:
    print('first')
Problem p03239 (python)

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

clist = []
for i in range(N):
    c, t = map(int,input().split())
    if t <= T:
        clist.append(c)
if len(clist) > 0:
    print(min(clist))
else:
    print("TLE")

Buggy submission (verdict: Runtime Error):
4 3
1 1000
2 4
3 1000
4 500

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

clist = []
for i in range(N):
    c, t = map(int,input().split())
    if t <= T:
        clist.append(c)
print(min(clist))
Problem p03251 (python)

Fixed submission:
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))

print('No War' if min(min(y),Y)>max(max(x),X) else 'War')

Buggy submission (verdict: Runtime Error):
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
print('No War' if max(*x,X)<=min(*y,Y) else 'War')
Problem p03260 (python)

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

if A % 2 != 0 and B % 2 !=0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
mx=min(x)
x=list(map(lambda t:t-mx,x))
def gcd(a,b):
    while b:
        a,b=b,a%b
    return(a)
a=10**10
for i,j in zip(x,x[1:]):
    a=min(a,gcd(i,j))
print(a)
Problem p03262 (python)

Fixed submission:
N,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
mx=min(x)
x=list(map(lambda t:t-mx,x))
def gcd(a,b):
    while b:
        a,b=b,a%b
    return(a)
a=10**10
for i,j in zip(x,x[1:]):
    a=min(a,gcd(i,j))
print(a)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
x_list = list(map(int, input().split()))
x_list.append(X)
def gcd_1(l):
    x = max(l)
    y = min(l)
    if x % y == 0:
        return y
    else:
        while x%y!=0:
            z = x%y
            x = y
            y = z
        else:
            return z
        
if N == 1:
    print(x_list[0] - X)
    exit()

values = np.sort(np.array(x_list))[1:] - min(x_list)

if N == 2:
    print(values[0])
    exit()

print(gcd_1(values))

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

def gcd(l):
    x = max(l)
    y = min(l)
    if x % y == 0:
        return y
    else:
        while x%y!=0:
            z = x%y
            x = y
            y = z
        else:
            return z
        
if N == 1:
    print(x_list[0] - X)
    exit()

values = np.sort(np.array(x_list))[1:] - min(x_list)
print(gcd(values))

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

N, X = map(int, input().split())
x_list = list(map(int, input().split()))

if N == 1:
    print(x_list[0] - X)
    exit()

values = np.sort(np.array(x_list))[1:] - min(x_list)
gcd = functools.reduce(math.gcd, values)
print(gcd)
Problem p03281 (python)

Fixed submission:
import math

N = int(input())

def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def search_divisor_num(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num


print(int(list(map(search_divisor_num,list(range(1,N + 1))[:: 2])).count(8)))

Buggy submission (verdict: Runtime Error):
# sympyをインポート
import sympy
N = int(input())
print(int(list(map(sympy.divisor_count,list(range(1,N + 1))[:: 2])).count(8)))

Buggy submission (verdict: Runtime Error):
import sympy
N = int(input())
print(list(map(sympy.divisor_count,list(range(1,N + 1))[:: 2])).count(8))

Buggy submission (verdict: Runtime Error):
import sympy
N = int(input())
list(map(sympy.divisor_count,list(range(1,N + 1))[:: 2])).count(8)

Buggy submission (verdict: Runtime Error):
import sympy
N = int(input.())
list(map(sympy.divisor_count,list(range(1,N + 1))[:: 2])).count(8)
Problem p03288 (python)

Fixed submission:
R = int(input())

if R < 1200:
    print("ABC")
elif R < 2800:
    print("ARC")
elif R <= 4208:
    print("AGC")
else:
    print("")

Buggy submission (verdict: Runtime Error):
if int(input()) < 1200:
    print("ABC")
elif int(input()) < 2800:
    print("ARC")
else:
    print("AGC")
Problem p03337 (python)

Fixed submission:
a,b=map(int,input().split());print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a,b=input().split();print(max(a+b,a-b,a*b))
Problem p03361 (python)

Fixed submission:
H,W=map(int,input().split())
S=[input() for _ in range(H)]

arr=[]
for h in range(0,H):
    for w in range(0,W):
        if S[h][w]=='#':
            cnt=0
            if w!=0:
                cnt+=S[h][w-1]=='#'
            if w!=W-1:
                cnt+=S[h][w+1]=='#'
            if h!=0:
                cnt+=S[h-1][w]=='#'
            if h!=H-1:
                cnt+=S[h+1][w]=='#'
            arr.append(cnt>0)
print('Yes' if all(arr) else 'No')

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
S=[input() for _ in range(H)]

arr=[]
for h in range(0,H):
    for w in range(0,W):
        if S[w][h]=='#':
            cnt=0
            if w!=0:
                cnt+=S[w-1][h]=='#'
            if w!=W-1:
                cnt+=S[w+1][h]=='#'
            if h!=0:
                cnt+=S[w][h-1]=='#'
            if h!=H-1:
                cnt+=S[w][h+1]=='#'
            arr.append(cnt>0)
print('Yes' if all(arr) else 'No')

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
S=[input() for _ in range(H)]

arr=[]
for h in range(0,H):
    for w in range(0,W):
        if S[w][h]=='#':
            cnt=0
            if w!=0:
                cnt+=S[w-1][h]=='#'
            if w!=W-1:
                cnt+=S[w+1][h]=='#'
            if h!=0:
                cnt+=S[w][h-1]=='#'
            if h!=H-1:
                cnt+=S[w][h+1]=='#'
            arr.append(cnt>0)
print(all(arr))
Problem p03407 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(['No','Yes'][a+b>=c])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input())
print(['No','Yes'][a+b>=c])
Problem p03472 (python)

Fixed submission:
N,H=map(int,input().split())
S=[[int(x) for x in input().split()] for _ in range(N)]
A,B=zip(*S)
A=max(A)
B=[b for b in B if b>A]
B.sort(reverse=True)
ans=0
cnt=0
for b in B:
    if H<=0:
        break
    cnt+=1
    H-=b
if H>0:
    cnt+=(H-1)//A+1
print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import deque
N,H=map(int,input().split())
a=deque([]);b=deque([])
for _ in range(N):
    ai,bi=map(int,input().split())
    a.append(ai)
    b.append(bi)
ma=max(a)
bs=sorted(b,reverse=True)
bc=0
for i in range(len(bs)):
    bi=b[i]
    if bi>ma:
        bc+=b[i]
        if H<=bc:
            print(i+1)
            exit()
ans=(H-bc)//ma+len(bc)
if (H-bc)%ma==0:
    print(ans)
else:
    print(ans+1)

Buggy submission (verdict: Runtime Error):
from collections import deque
N,H=map(int,input().split())
a=deque([]);b=deque([])
for _ in range(N):
    ai,bi=map(int,input().split())
    a.append(ai)
    b.append(bi)
bb=deque([])
ma=max(a)
for _ in range(N):
    bi=b.pop[b.index(max(b))]
    if bi>ma:
        bb.append(bi)
    if sum(bb)>=H:
        print(len(bb))
        exit()
ans=(H-sum(bb))//ma+len(bb)
if (H-sum(bb))%ma==0:
    print(ans)
else:
    print(ans+1)
Problem p03543 (python)

Fixed submission:
x=input()
print(['No','Yes'][len(set(x[1:]))==1 or len(set(x[:3]))==1])

Buggy submission (verdict: Runtime Error):
print(['Yes','No'][len(set(input())<3])
Problem p03573 (python)

Fixed submission:
x=input().split()
y=list(set(x))
print(y[x.count(y[0])-1])

Buggy submission (verdict: Runtime Error):
x=input().split()
y=set(x)
print(y[x.count(y[0])-1])
Problem p03611 (python)

Fixed submission:
import collections
N=int(input())
a=list(map(int,input().split()))

arr=[]
for i in a:
    arr.extend([i-1,i,i+1])

arr_c=collections.Counter(arr)

print(max(arr_c.values()))

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
ans=0
for i in a:
    ans=max(ans,sa.count(i-1)+sa.count(i)+sa.count(i+1))
print(ans)
Problem p03635 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
print((a-1)*(b-1))