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

Fixed submission:
n , y = map(int,input().split())
y = y//1000
for i in range(y//10+1):
    y1 = y-10*i - n +i
    if y1 >=0 and y1%4 == 0 and n-i-y1//4>=0:
        print(i,y1//4,n-i-y1//4)
        exit()
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
n , y = map(int,input().split())
y = y//1000
m = 0
for i in range(y//10+1):
    y1 = y-10*i - n +i
    if y1%4 == 0:
    if n-i-y1//4>=0:
        print(i,y1//4,n-i-y1//4)
        exit()
print('-1 -1 -1')
Problem p03476 (python)

Fixed submission:
import math
num = 100000
s = set([i for i in range(2,num+1)])
p = set()
mi = 0
while mi<=math.sqrt(num):
    mi = min(s)
    t = set([i*mi for i in range(1,num//mi+1)])
    p.add(mi)
    s-=t
p = p|s
p2 = set([i for i in p if (i+1)//2 in p])
c = 0
x = [0]*100001
for i in range(1,num+1):
    if i in p2:
        c+=1
    x[i]=c

q = int(input())
for i in range(q):
    l , r = map(int, input().split())
    ans = x[r]-x[l-1]
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
num = 100000
s = set([i for i in range(2,num+1)])
p = set()
mi = 0
while mi<=math.sqrt(num):
    mi = min(s)
    t = set([i*mi for i in range(1,num//mi+1)])
    p.add(mi)
    s-=t
p = p|s
p2 = set([i for i in p if (i+1)//2 in p])

q = int(input())
for i in range(q):
    l , r = map(int, input().split())
    s2 = set([i for i in range(l,r+1)if in p2])
    print(len(s2))
Problem p03503 (python)

Fixed submission:
n = int(input())
f = [list(map(int,input().split())) for i in range(n)]
p = [list(map(int,input().split())) for i in range(n)]

s = [list(map(int,bin(x)[2:].zfill(10))) for x in range(1,2**10)]
c = 0
ans = 0
max = -1000000000
for k in range(2**10-1):
    for i in range(n):
        for j in range(10):
            c += f[i][j]*s[k][j]
        ans += p[i][c]
        c=0
    if ans > max:
        max = ans
    ans = 0
print(max)

Buggy submission (verdict: Runtime Error):
n = int(input())
f = [list(map(int,input().split())) for i in range(n)]
p = [list(map(int,input().split())) for i in range(n)]

s = [list(map(int,bin(x)[2:].zfill(10))) for x in range(2**10)]
s.pop(0)
c = 0
ans = 0
max = -10000000
for k in range(2**10-1):
    for i in range(n):
        for j in range(10):
            c += f[i][j]*s[k][j]
        ans += p[i][c+1]
        c=0
    if ans > max:
        max = ans
    ans = 0
print(max)
Problem p03599 (python)

Fixed submission:
a,b,c,d,e,f = map(int, input().split())
s_max = f*e//(e+100)
w_max = f//100

s=[]
w=[]

max = 0
ans = [100*a,0]
for i in range(s_max//c+1):
    for j in range(s_max//d+1):
        if c*i + d*j <= s_max:
            s.append(c*i + d*j)

for i in range(w_max//a+1):
    for j in range(w_max//b+1):
        if 0<a*i + b*j <= w_max:
            w.append(a*i + b*j)

for i in range(len(s)):
    for j in range(len(w)):
        if s[i]/(w[j]*100+s[i])<=e/(e+100) and s[i]/(w[j]*100+s[i])>=max and w[j]*100+s[i]<=f:
            max = s[i]/(w[j]*100+s[i])
            ans = [w[j]*100+s[i],s[i]]

print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int, input().split())
s_max = f*e//(e+100)
w_max = f//(e+100)

s=[]
w=[]

max = 0
for i in range(s_max//c+1):
    for j in range(s_max//d+1):
        if c*i + d*j <= s_max:
            s.append(c*i + d*j)

for i in range(w_max//a+1):
    for j in range(w_max//b+1):
        if 0<a*i + b*j <= w_max:
            w.append(a*i + b*j)

for i in range(len(s)):
    for j in range(len(w)):
        if s[i]/(w[j]*100+s[i])<=e/(e+100) and s[i]/(w[j]*100+s[i])>=max:
            max = s[i]/(w[j]*100+s[i])
            ans = [w[j]*100+s[i],s[i]]

print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int, input().split())
s_max = f*e//(e+100)
w_max = f//(e+100)

s=[]
w=[]

max = 0
ans = []
for i in range(s_max//c+1):
    for j in range(s_max//d+1):
        if c*i + d*j <= s_max:
            s.append(c*i + d*j)

for i in range(w_max//a+1):
    for j in range(w_max//b+1):
        if 0<a*i + b*j <= w_max:
            w.append(a*i + b*j)

for i in range(len(s)):
    for j in range(len(w)):
        if s[i]/(w[j]*100+s[i])<=e/(e+100) and s[i]/(w[j]*100+s[i])>max:
            max = s[i]/(w[j]*100+s[i])
            ans = [w[j]*100+s[i],s[i]]

print(ans[0],ans[1])
Problem p03636 (python)

Fixed submission:
s = input()
l=len(s)-2
t=s[0]+str(l)+s[l+1]
print(t)

Buggy submission (verdict: Runtime Error):
s = input()
l=len(s)-2
t=f'{s[0]}{l}{s[l+1]}'
print(t)
Problem p03695 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
rate=[0]*13
for i in a:
    rate[i//400]+=1
min = 0
for i in range(8):
    if rate[i]>0:
        min+=1

max = min + rate[8] + rate[9] + rate[10] + rate[11] + rate[12]
if min ==0:
    min=1
print(min,max)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
rate=[0]*9
for i in a:
    rate[i//400]+=1
min = 0
for i in range(8):
    if rate[i]>0:
        min+=1
max = min + rate[8]
if max>8:
    max=8
print(min,max)
Problem p03861 (python)

Fixed submission:
a,b,x = map(int, input().split())
ans = 0
if a==0:
    a=1
    ans += 1
ans += b//x - (a-1)//x
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int, input().split())
if a==0:
    a=1
    ans += 1
ans = b//x - (a-1)//x
print(ans)
Problem p02584 (python)

Fixed submission:
line = input()

strL = line.split()
X = abs(int(strL[0]))
K = int(strL[1])
D = int(strL[2])

mod = X % D
div = int(X / D)

if div > K:
    ans = X - K * D
elif (K - div) % 2 != 0:
    ans = mod - D
else:
    ans = mod

print(abs(int(ans)))

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

strL = line.split()
X = int(strL[0])
K = int(strL[1])
D = int(strL[2])

mod = X % D
div = int(X / D)

if div > K:
    ans = abs(X - K * D)
elif (K - div) % 2 != 0:
    if mod > 0:
        ans = mod - D
    else:
        ans = mod + D

print(int(abs(ans)))
Problem p02983 (python)

Fixed submission:
DEVISOR = 2019

L, R = (int(word) for word in input().split())

if (R // DEVISOR) > (L // DEVISOR):
    print(0)
    exit()

L %= DEVISOR
R %= DEVISOR

print(min(i * j % DEVISOR for i in range(L, R) for j in range(i+1, R+1)))

Buggy submission (verdict: Runtime Error):
DEVISOR = 2019

L, R = (int(word) for word in input().split())

if R // DEVISOR > L // DEVISOR:
    print(0)

L %= DEVISOR
R %= DEVISOR

print(min(i * j % DEVISOR for i in range(L, R) for j in range(i+1, R+1)))

Buggy submission (verdict: Runtime Error):
DEVISOR = 2019

L, R = (int(word) for word in input().split())

if R // DEVISOR > L // DEVISOR:
    print(0)

L %= DEVISOR
R %= DEVISOR

print(min(i * j for i in range(L, R) for j in range(i+1, R+1)))
Problem p02660 (python)

Fixed submission:
import math


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = int(input())
a = factorization(n)
if a[0][0] == 1:
    print(0)
else:
    b = []
    c = [0,1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190]
    for i in range(len(a)):
        b.append(a[i][1])
    ans = 0
    for i in range(len(b)):
        for j in range(len(c)):
            if b[i] == c[j]:
                ans +=j
                break
            elif b[i] < c[j]:
                ans += j-1
                break
                
    print(ans)

Buggy submission (verdict: Runtime Error):
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

n = int(input())
a = is_prime(n)
if a:
    print(1)
else:
    ans = 0
    con = 2
    while True:
        if n % con == 0:
            ans +=1
            n = n // con
            b = is_prime(n)
        if n == 1 or b:
            break
        con +=1
    print(ans)
Problem p02664 (python)

Fixed submission:
t = input()
a = []
for i in range(len(t)):
    if t[i] == '?':
        a.append('D')
    else:
        a.append(t[i])
print(''.join(a))

Buggy submission (verdict: Runtime Error):
t = input()
for i in range(len(t)):
  if t[i] == '?':
    t[i] = 'D'
print(t)
Problem p02696 (python)

Fixed submission:
import math
a,b,n = map(int, input().split())
if b > n:
    c = n
else:
    c = b-1
ans = math.floor(a * c /b) - a * math.floor(c/b)

print(ans)

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

c = b-1

ans = math.floor(a * c /b) - a * floor(c/b)

print(ans)
Problem p02727 (python)

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

s_a = [int(i) for i in list(input().split())]
s_b = [int(i) for i in list(input().split())]
s_c = [int(i) for i in list(input().split())]

s_a.sort(reverse = True)
s_b.sort(reverse = True)
s_c.sort(reverse = True)

x_a = s_a[0:x]
x_b = s_b[0:y]


sum_a = x_a + x_b + s_c
sum_a.sort(reverse = True)
sum_a = sum_a[0:x+y]
print(sum(sum_a))

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

s_a = [int(i) for i in list(input().split())]
s_b = [int(i) for i in list(input().split())]
s_c = [int(i) for i in list(input().split())]

s_a.sort(reverse = True)
s_b.sort(reverse = True)
s_c.sort(reverse = True)

x_a = s_a[0:x]
x_b = s_b[0:y]


x_a.append(x_b)
x_a.append(s_c)
x_a.sort(reverse = True)
ans = x_a[0:x+y]
print(sum(ans))

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

s_a = [int(i) for i in list(input().split())]
s_b = [int(i) for i in list(input().split())]
s_c = [int(i) for i in list(input().split())]

s_a.sort(reverse = True)
s_b.sort(reverse = True)
s_c.sort(reverse = True)

ans = 0
x_a = s_a[0:x]
x_b = s_b[0:y]

x_a.reverse()
x_b.reverse()

s = 0
v = 0
t = 0
while s <= x and v <= y and t <= c:
    if x_a[s] <= x_b[v]:
        #print('B')
        if x_a[s] < s_c[t]:
            x_a[s] = s_c[t]
            s += 1
            t += 1
        else:
            break
    else:
        #print('A')
        if x_b[v] < s_c[t]:
            x_b[v] = s_c[t]
            v += 1
            t += 1
        else:
            break

ans = sum(x_a) + sum(x_b)
print(ans)
Problem p02756 (python)

Fixed submission:
Sr = list(input())
Sl = []
Q = int(input())


for i in range(Q):
    s = list(input().split())
    if len(s) == 1:
        Sr,Sl = Sl,Sr
    elif s[1] == '1':
        Sl.append(s[2])
    else:
        Sr.append(s[2])
Sl.reverse()
print('%s' % (''.join(Sl) + ''.join(Sr)))

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

Q = int(input())

A = np.array([S])

for i in range(Q):
    s = input().split()
    if len(s) == 1:
        A = np.flip(A)
    else:
        if s[1] == '1':
            A = np.insert(A,0,np.array([s[2]]))
        else:
            A = np.append(A,np.array([s[2]]))

print('%s' % ''.join(A))

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

Q = int(input())

A = np.array([S])

for i in range(Q):
    s = input().split()
    if len(s) == 1:
        A = np.flip(A)
    else:
        if s[1] == '1':
            A = np.insert(A,0,np.array([s[2]]))
        else:
            A = np.append(A,np.array([s[2]]))

print('%s' % ''.join(A))

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

Q = int(input())

A = np.array([])
A = np.append(A,S)

for i in range(Q):
    s = input().split()
    if len(s) == 1:
        A = np.flip(A)
    else:
        if s[1] == '1':
            A = np.insert(A,0,np.array([s[2]]))
        else:
            A = np.append(A,np.array([s[2]]))

print('%s' % ''.join(A))
Problem p02844 (python)

Fixed submission:

n = int(input())
s = input()
ans = 0
for i in range(10):
    if str(i) in s:
        t = s[s.index(str(i))+1:]
        for j in range(10):
            if str(j) in t:
                u = t[t.index(str(j))+1:]
                for k in range(10):
                    if str(k) in u:
                        ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = 0
for i in range(10):
    if str(i) in s:
        t = s[s.index(str(i))+1:]
    for j in range(10):
        if str(j) in t:
            u = t[t.index(str(j))+1:]
        for k in range(10):
            if str(k) in u:
                ans +=1
print(ans)
Problem p03086 (python)

Fixed submission:
a = list(input())
ans = 0
count = 0
for i in a:

    if i == 'A':
        count +=1
    elif i == 'C':
        count+=1
    elif i == 'G':
        count+=1
    elif i == 'T':
        count+=1
    else:
        ans = max(ans ,count)
        count = 0

print(max(ans,count))

Buggy submission (verdict: Runtime Error):
a = input()
ans = []
count = 0
for i in range(len(a)):
    b = a[i]
    if b == 'A':
        count +=1
    elif b == 'C':
        count+=1
    elif b == 'G':
        count+=1
    elif b == 'T':
        count+=1
    else:
        ans.append(count)
        count = 0
print(max(ans))
Problem p03161 (python)

Fixed submission:
def main():
    n,k= map(int,input().split())
    h = [int(i) for i in input().split()]
    inf = 10**7
    dp = [inf]*100005
    dp[0] = 0
    for i in range(1,n):
        dp[i] = min(dp[i-j] + abs(h[i-j] - h[i]) for j in range(1,min(k,i)+1))
    print(dp[n-1])
main()

Buggy submission (verdict: Runtime Error):
def main():
    n,k= map(int,input().split())
    h = [int(i) for i in input().split()]
    inf = 10**7
    dp = [inf]*100005
    dp[0] = 0
    for i in range(1,n):
        for j in range(1,min(k,i)+1):
            dp[i] = min(dp[i-j] + abs(h[i-j] - h[i]))
    print(dp[n-1])
main()

Buggy submission (verdict: Runtime Error):
def main():
    n,k= map(int,input().split())
    h = [int(i) for i in input().split()]
    inf = 10**7
    dp = [inf]*100005
    dp[0] = 0
    for i in range(1,n):
      for j in range(1,min(k,i)+1)
        dp[i] = min(dp[i-j] + abs(h[i-j] - h[i]) )
    print(dp[n-1])
main()

Buggy submission (verdict: Runtime Error):
n,k= map(int,input().split())
h = [int(i) for i in input().split()]
inf = 10**7
dp = [inf]*100005
dp[0] = 0
for i in range(1,n):
    for j in range(1,k):
        if j > len(h):
            break
        dp[i+j] = min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
print(dp[n-1])
Problem p03281 (python)

Fixed submission:
n = int(input())
a = n//2
ans = 0
for j in range(1,n+1):
    count = 0
    for i in range(1,j+1):
        if j % i == 0:
            count += 1
        if count >= 8 and j % 2 == 1:
            ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n//2
ans = 0
for j in range(1,n+1):
    count = 1
    for i in range(a):
        if n % i == 0:
            count += 1
        if count >= 8:
            ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n//2
ans = 0
for j in range(1,n+1):
  	count = 1
	for i in range(a):
    	if n % i == 0:
      		count += 1
        if count >= 8:
          ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n//2
ans = 0
for j in range(1,n+1):
  	count = 1
	for i in range(a):
    	if n % i == 0:
      		count += 1
        if count >= 8:
          ans +=1
print(ans)

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

ans = 0
for j in range(1,n+1):
  	count = 1
	for i in range(n//2):
    	if n % i == 0:
      		count += 1
        if count >= 8:
          ans +=1
print(ans)
Problem p03380 (python)

Fixed submission:
import math
import numpy as np

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def getNearestValue(list, num):
    """
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]

n = int(input())
a = [int(i) for i in input().split()]
check = 0
a.sort()
b = a[-1]
c = getNearestValue(a,b/2)
ans = str(b) + ' ' + str(c)
print(ans)

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def getNearestValue(list, num):
    """
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]

n = int(input())
a = [int(i) for i in input().split()]
check = 0
a.sort()
b = a[-i]
c = getNearestValue(a,b/2)
ans = str(b) + ' ' + str(c)
print(ans)
Problem p03476 (python)

Fixed submission:
q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
    l[i], r[i] = map(int, input().split())
 
mini = min(min(l), min(r))
maxi = max(max(l), max(r))
ans = [0] * (maxi + 1)
prime = [0] * (maxi + 1)
def judge_prime(n):
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    
    return True if n != 1 else False
 
for i in range((mini + 1) // 2, maxi + 1):
    prime[i] = judge_prime(i)
 
for i in range(mini, maxi + 1, 2):
    ans[i] = ans[i - 2] + 1 if prime[i] and prime[(i + 1) // 2] else ans[i - 2]
for i in range(q):
    print(ans[r[i]] - ans[max(0, l[i] - 2)])

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
def get_prime(n):
    if n<= 1:
        return[]
    prime = [2]
    limit = int(math.sqrt(n))
    
    data = [i + 1 for i in range(2,n,2)]
    while limit > data[0]:
        prime.append(data[0])
        data = [j for j in data if j % data[0] != 0]
    return prime + data
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
n = int(input())
a = get_prime(10**5+1)
b = np.array([0]*(10**5+2))
c =0
d = 0
add = 0
for i in range(1,len(a)):
    if is_prime((a[i]+1)/2):
        d = a[i] 
        b[c:d] = add 
        c = d
        add +=1
b[c:] = add 
b[0::2] = 0

for i in range(n):
    l, r =map(int,input().split())
    print(b[max(0, l[i] - 2)] - b[r[i]])
Problem p03625 (python)

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

a.sort(reverse = True)
ans = 0
b = a.copy()
b = list(set(b))
b.sort(reverse = True)
c = [0]*len(b)
j = 0
c[j] = 1
for i in range(1,n):
    if a[i-1] == a[i]:
        c[j] +=1
    else:
        j+=1
        c[j] +=1
for i in range(len(b)):
    if c[i] >= 4:    
        
        ans = b[i]*b[i]
        break
    elif c[i] >= 2:
        for j in range(i+1,len(b)):
            if c[j] >= 2:
                ans = b[i]*b[j]
                break
        break
print(ans)

Buggy submission (verdict: Runtime Error):
from numba import jit
@jit
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    a.sort(reverse = True)
    ans = 0
    for i in range(n):
        if a.count(a[i]) >= 4:
            ans = a[i]*a[i]
            break
        elif a.count(a[i]) >=2:
            for j in range(i+a.count(a[i]),n):
                if a.count(a[j]) >=2:
                    ans = a[i]*a[j]
                    break
            break
    print(ans)
main()

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

a.sort(reverse = True)
c = []
for i in range(n):
    if a.count(a[i]) ==2 or a.count(a[i]) ==3:
        c.append(i+1)
    elif a.count(a[i]) >= 4:
        c.append(i+1)
        c.append(i+1)
    if len(c) >= 2:
        break

if len(c) >= 2:
    e = max(c)
    c.pop(e)
    f = max(c)
    print(e*f)
else:
    print(0)

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

b = [0]*10**5

for i in range(n):
    b[a[i]] += 1

c = []
for i in range(n):
    if b[i] == 2 or b[i] == 3:
        c.append(i+1)
    elif b[i] >= 4:
        c.append(i+1)
        c.append(i+1)

if len(c) >= 3:
    
    e = max(c)
    c.pop(e)
    f = max(c)
    print(e*f)
else:
    print(0)

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

b = [0]*10**9

for i in range(n):
    b[a[i]] += 1

c = []
for i in range(n):
    if b[i] == 2 or b[i] == 3:
        c.append(i+1)
    elif b[i] >= 4:
        c.append(i+1)
        c.append(i+1)

if len(c) >= 3:
    
    e = max(c)
    c.pop(e)
    f = max(c)
    print(e*f)
else:
    print(0)
Problem p03645 (python)

Fixed submission:
n,m = map(int,input().split())
a = [0 for _ in range(m)]
b = [0 for _ in range(m)]

for i in range(m):
    a[i],b[i] = map(int,input().split())

go = []
goal = []

for i in range(len(a)):
    if a[i] == 1:
        go.append(b[i])
    if b[i] == n:
        goal.append(a[i])

count = [0 for i in range(n)]
for i in range(len(go)):
    count[go[i]-1] = 1
for i in range(len(goal)):
    count[goal[i]-1] += 1
for i in range(len(count)):
    if count[i] > 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
a,b = [0]*m
for i in range(m):
    a[i],b[i] = map(int,input().split())
c = []
d = []
for i in range(m):
    
    if a[i] == 1:
        c.append(b[i])
    if b[i][1] == n:
        d.append(a[i])
ans = False
c = list(set(c))
for i in c:
    if d.count(i) >=1:
        ans = True
        break
if ans:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Problem p03862 (python)

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

if int(a[0]) > x:
    ans += int(a[0])-x
    a[0] = x
for i in range(n-1):
    c = int(a[i+1]) + int(a[i])
    if c > x:
        ans += c-x
        a[i+1] = int(a[i+1])-(c-x)
print(ans)

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

if int(a[0]) > x:
    ans += a[0]-x
    a[0] = x
for i in range(n-1):
    c = int(a[i+1]) + int(a[i])
    if c > x:
        ans += c-x
        a[i+1] = int(a[i+1])-(c-x)
print(ans)
Problem p03944 (python)

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

x = [int(i) for i in range(w+1)]
y = [int(i) for i in range(h+1)]

for i in range(n):
    x_i, y_i, a = map(int,input().split())
    if a == 1:
        x = [int(j) for j in x if j >= int(x_i)]
    elif a == 2:
        x = [int(j) for j in x if j <= int(x_i)]
    elif a == 3:
        y = [int(j) for j in y if j >= int(y_i)]
    elif a == 4:
        y = [int(j) for j in y if j <= int(y_i)]
if len(x) == 0 or len(y) == 0:
    print('0')
else:
    print((max(x)-min(x)) * (max(y)-min(y)))

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

x = [int(i) for i in range(w+1)]
y = [int(i) for i in range(h+1)]

for i in range(n):
    x_i, y_i, a = map(int,input().split())
    if a == 1:
        x = [int(j) for j in x if j >= int(x_i)]
    elif a == 2:
        x = [int(j) for j in x if j <= int(x_i)]
    elif a == 3:
        y = [int(j) for j in y if j >= int(y_i)]
    elif a == 4:
        y = [int(j) for j in y if j <= int(y_i)]

print((max(x)-min(x)) * (max(y)-min(y)))
Problem p04012 (python)

Fixed submission:
w = input()
alp = 'abcdefghijklmnopqrstuvwxyz'
c = []
for i in range(26):
    a = w.count(alp[i])
    c.append(a)
d = 0
for i in range(26):
    if c[i] % 2 == 0:
        d = 1
    else:
        d = 0
        break
if d == 0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
w = input()
alp = 'abcdefghijklmnopqrstuvwxyz'
c = []
for i in range(26):
    a = w.count(alp[i])
    c.append(a)
d = 0
for i in range(len(w)):
    if int(c[i]) % 2 == 0:
        d = 1
    else:
        break
if d == 0:
    print('No')
else:
    print('Yes')
Problem p04030 (python)

Fixed submission:
s = input()
b = ''
for i in s:
    if i == 'B':
        b = b[:-1]
    else:
        b += i
print(b)

Buggy submission (verdict: Runtime Error):
s = list(input())
a = s.count('B')
b = []
for i in range(len(s)):
    if s[i] == 'B':
        b.append(i)
b.sort(reverse=True)
for i in b:
    s.pop(i)
    s.pop(i-1)
print(''.join(s))
Problem p02548 (python)

Fixed submission:
n = int(input())

ans = 0

for i in range(1,n):
    s = (n-1)//i
    if  0< s < n:
        ans += s
print(ans)

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

ans = 0

for i in range(1,n):
    s = (n-1)//i
    if  0< s < n:
        ans += s
print(ans)