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

Fixed submission:
a,b=map(int, input().split())
if a<=9 and b<=9:
    print(a*b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
s = raw_input()
a,b = s.split('/')
a,b = int(a),int(b)

def mul(a,b):
    if a <= 9 and a >=1 and (1 <= b <= 9):
        return a * b
    else:
        return -1

print(mul(a,b))

Buggy submission (verdict: Runtime Error):
s = raw_input()
a,b = s.split('/')
a,b = int(a),int(b)

def mul(a,b):
    if a <= 9 and a >=1 and (1 <= b <= 9):
        return a * b
    else:
        return -1

return mul(a,b)

Buggy submission (verdict: Runtime Error):
s = raw_input()
a,b = s.split('/')
a,b = int(a),int(b)

def mul(a,b):
    if a <= 9 and a >=1 and (1 <= b <= 9):
        return a * b
    else:
        return -1

mul(a,b)

Buggy submission (verdict: Runtime Error):
while True:
    try:
        a = int(input())
        b = int(input())
    except EOFError:
        break
    if a <= 9 and a>=1 and b <= 9 and b>=1:
        print(a * b)
    else:
        print(-1)

Buggy submission (verdict: Runtime Error):
while True:
    try:
        a = int(input())
        b = int(input())
    except EOFError:
        break
    if a <= 9 and b <= 9:
        print(a * b)
    else:
        print(-1)
Problem p02897 (python)

Fixed submission:
n=int(input())
c=0
for i in range(1,n+1):
    if(i%2!=0):
        c+=1
print('%.10f'%(c/n))

Buggy submission (verdict: Runtime Error):
num=int(input())
if(num%2==0): 
     print(0.5)
else
     print((num/2+1)/num)
Problem p02915 (python)

Fixed submission:
n = int(input())#waiting_for_pudging
print(n**3)#pudging
#accepted

Buggy submission (verdict: Runtime Error):
import sys
import math

def input():
    return sys.stdin.readline().strip()

def iinput():
    return int(input())

def finput():
    return float(input())

def tinput():
    return input().split()

def rinput():
    return map(int, tinput())

def rlinput():
    return list(rinput())

def pro(k, l, n):
    if l < n:
        if k == 0:
            return(n - l)
        return (n - l + 2)
    if l == n:
        if k == 0:
            return 0
        elif k == 1:
            return 1
        return 3
    else:
        l -= n - 1
        if l == k:
            return 1
        elif l > k:
            return 0
        if l < k - 1:
            return 2
        else:
            return 3
            

def rt(k, l , n):
    if k < n:
        if l == 0:
            return (k * 2 + n)
        return (n + k * 2 - 1)
    elif k == n:
        if l == 1:
            return (k * 3 - 2)
        elif l == 0:
            return (k * 3)
        return (k * 3 - 3)
    else:
        k -= n - 1
        if k == l:
            return (n * 3 - 2)
        elif k > l:
            return (n * 3)
        if k < l - 1:
            return ((n - 1) * 3 - 1)
        else:
            return ((n - 1) * 3)



def main():
    a = iinput()
    print(q ** 3)
    
    
    


main()
Problem p03011 (python)

Fixed submission:
x = input().split()
P = int(x[0])
Q = int(x[1])
R = int(x[2])
l = [P+Q,Q+R,R+P]
print(min(l))

Buggy submission (verdict: Runtime Error):
valores = [int(input()), int(input()), int(input())]
valores[valores.index(max(valores))]=0
print(valores[0]+valores[1]+valores[2])

Buggy submission (verdict: Runtime Error):
lista=[]
soma=[]
for x in input().split():
    lista.append(int(x))
for var1 in lista:
    for var2 in lista:
        if var1!=var2:
            soma.append(var1+var2)

min=min(soma)
print(min)
Problem p03013 (python)

Fixed submission:
def fibonacci(n):
	if n==0:
		return 0
	a,b=1,1
	for i in range(0,int((n-1)/2)):
		a+=b
		b+=a
	if n%2!=0:
		return a
	return b

n=[int(i) for i in input().split()]
f=1
a=-1
for i in range(0,n[1]):
	b=int(input())
	f*=fibonacci(b-a-1)
	a=b
f*=fibonacci(n[0]-a)
print(f%1000000007)

Buggy submission (verdict: Runtime Error):
// Fibonacci 
#include <bits/stdc++.h> 
using namespace std; 
long long dp[1000];
long long MOD {1000000007}; 
int main () {
    ios::sync_with_stdio(false);

    int n; cin >> n; 
    int m; cin >> m; 
    vector<int> broken(100010, 0);
    int x;
    for (int i = 0; i < m; i++) {
        cin >> x; 
        broken[x] = 1; 
    }

    dp[0] = 1;
    for (int num = 0; num < n; num++) {
        for (int next = num+1; next <= min(num+2, n); next++) {
            if (not broken[next]) { 
                dp[next] += dp[num]; 
                dp[next] = dp[next] % 1000000007; 
            }
            else 
                dp[next] = 0;
        }
    }

    // for (int i = 0; i <= n; i++) {
    //     cout << dp[i] << " "; 
    // }
    cout << dp[n]; 
}
Problem p03038 (python)

Fixed submission:
I=lambda:list(map(int,input().split()))
n,m=I()
a=I()
a.sort(reverse=True)
qq=[I() for i in range(m)]
qq.sort(key=lambda x:x[1],reverse=True)
ans=0
for x,y in qq:
    for j in range(x):
        if not a:
            break
        aa=a.pop()
        ans+=max(aa,y)
ans+=sum(a)
print(ans)

Buggy submission (verdict: Runtime Error):
def mi():
    return map(int, input().split())
'''
3 2
5 1 4
2 3
1 5
'''
n,m = mi()
a = list(mi())
a.sort()
q = [0]*m
for i in range(m):
    q[i] = list(mi())[::-1]
q.sort(reverse=True)
mi = 0
for i in range(m):
    for j in range(q[i][1]):
        if a[mi]<q[i][0]:
            a[mi] = q[i][0]
            mi+=1
            if mi==n:
                break
        else:
            break
print(sum(a))
Problem p03075 (python)

Fixed submission:
xs = []
for _ in range(5):
    x = int(input())
    xs.append(x)
k = int(input())

ok = False
for i in xs:
    for j in xs:
        if max(i, j) - min(i, j) > k:
            ok = True

print(':(') if ok else print('Yay!')

Buggy submission (verdict: Runtime Error):
line = input()
numbers = [int(n) for n in line.split()]
predicted_value = "Yay!"
k_distance = numbers[-1]
antenas = numbers[:-1]
antenas.sort()
if antenas[-1] - antenas[0] > k_distance:
    predicted_value = ":("
print(predicted_value)
Problem p03186 (python)

Fixed submission:
x=input().split()
a=int(x[0])
b=int(x[1])
c=int(x[-1])
n=0
if b>=c:
    n+=b+c
    print(n)
else:
    n+=2*b
    c-=b
    if a>=c:
        n+=c
        print(n)
    else:
        n+=a+1  
        print(n)

Buggy submission (verdict: Runtime Error):
a = input("enter : ")
b = list(a)
c = [];
for i in b:
    if(i != " "):
        c.append(i)
d = 0;
if int(c[2])-1>=int(c[0])+int(c[1]):
    d = int(c[0])+int(c[1])+int(c[1])+1
else:
    d = int(c[1])+int(c[2])

print(d)
Problem p03252 (python)

Fixed submission:
str1= list(raw_input())
str2 = list(raw_input())
from collections import Counter
# import operator
resstr2 = Counter(str2)
resstr1 = Counter(str1)

# a = sorted(res.values())
res1 = Counter(resstr1.values())
res2 =  Counter(resstr2.values())
result = "Yes"
for k , i in res1.iteritems():
    if res2[k] != i:
        result = "No"
        break
print result

Buggy submission (verdict: Runtime Error):
def ctonum(c):
	alp = "qwertyuiopasdfghjklzxcvbnm"
	for i in range(len(alp)):
		if c == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=[0 for i in range(100)]

S=input()
T=input()

for i in range(len(S)):
	countS[ctonum[S(i)]]+=1
	countT[ctonum[T(i)]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
def ctonum(c):
	alp="qwertyuiopasdfghjklzxcvbnm"
	for i in range(len(alp)):
		if yay == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=countS

S,T=input(),input()

for i in range(len(S)):
	countS[ctonum[S[i]]]+=1
	countT[ctonum[T[i]]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
def ctonum(c):
	alp="qwertyuiopasdfghjklzxcvbnm"
	for i in len(alp):
		if yay == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=countS

S,T=input(),input()

for i in range(len(S)):
	countS[ctonum[S[i]]]+=1
	countT[ctonum[T[i]]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")
Problem p03272 (python)

Fixed submission:
N,i=map(int,input().split( ))
count=0

while N>=i:
    count+=1
    N-=1


print(count)

Buggy submission (verdict: Runtime Error):
value = input()
N,i = value.split()
N = int(N)
i = int(i)

print (N - i + 1)

Buggy submission (verdict: Runtime Error):
N,i=int(input ("enter the number of cars and car ))
X=N-i+1
Print(x)

Buggy submission (verdict: Runtime Error):
N,i=map(int,input().split())
if 1<=n<=100:
if 1<=i<=n:
print(N-i+1)

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

j=N-i+1

print (j)

Buggy submission (verdict: Runtime Error):
N , i = map( int input( ) )
x = (N - i) + 1
print ( x )

Buggy submission (verdict: Runtime Error):
N , i = map( int input( ) )
x = N - i + 1
print ( x )
Problem p03617 (python)

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

twoval=min(8*a,4*a+2*b,4*b,2*b+c,2*c,d)
oneval=min(4*a,2*b,2*a+b,c)

if n%2==0:
    print(twoval*(n//2))
else:
    print(oneval+twoval*((n-1)//2))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split)
n=int(input)
oneltr=min(4*a, 2*b, c, 2*a+b)
twoltr=min(8*a, 4*b, 2*c, d, c+2*b, c+b+2*a,c+4*a,4*a+2*b,b+6*a,3*b+2*a)

if(n%2==0) :
                   print(n//2*twoltr)
else :
                    print(oneltr+(n-1)//2*twoltr)
Problem p03705 (python)

Fixed submission:
n,a,b = map(int, input().split())
mi = a*(n-1)+b
ma = b*(n-1)+a
if ma -mi+1 < 0:
    print(0)
    quit()
print(ma-mi+1)

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

def add(n,a,b):
    print((n * b + (a - b)) - (n * a + (b - a)) + 1)
    return (n * b + (a - b)) - (n * a + (b - a)) + 1

add(n,a,b)

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


return (n * b + (a - b)) - (n * a + (b - a)) + 1
Problem p03745 (python)

Fixed submission:
from sys import stdin

def main():
	N = int(stdin.readline().strip())
	array = [int(x) for x in stdin.readline().strip().split()]
	ans,i= 0,0
	while i+1 < N:
		if array[i] < array[i+1]:
			ans+=1
			while i+1 < N and array[i] <= array[i+1]:
				i+=1
			i+=1
		elif array[i] > array[i+1]:
			ans+=1
			while i+1 < N and array[i] >= array[i+1]:
				i+=1
			i+=1
		else:
			i+=1
	if i+1 == N or ans == 0:
		ans+=1
	print(ans)
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    global lista
    n = int(stdin.readline())
    lista = [int(x) for x in stdin.readline().strip().split()]

    inx = 0
    inx  = cuenta(inx)
    flag = lista[inx] >= lista[inx+1];
    cont = 0
    tempc = 0
    while(inx < len(lista)-1):
        if flag:
            if(lista[inx] >= lista[inx+1]):
                flag = True
                tempc+=1
            else:
                tempc=0
                cont+=1
                flag = inx < len(lista)-2 and lista[inx+1] >= lista[inx+2];
        else:
            if(lista[inx] <= lista[inx+1]):
                flag = False
                tempc+=1
            else:
                tempc=0
                cont+=1
                flag = inx < len(lista)-2 and lista[inx+1] >= lista[inx+2];
        inx+=1
    print(cont+1)

def cuenta(i):
    while(i < len(lista)-1 and lista[i] == lista[i+1]):
        i+=1
    return i

main()
Problem p03986 (python)

Fixed submission:
ipt = raw_input()
l = ""
for s in ipt:
    if not l:
        l += s
    elif l[-1]+s == "ST":
        l = l[:-1]
    else:
        l += s
print len(l)

Buggy submission (verdict: Runtime Error):
s = raw_input()
n = int(raw_input())

head = []
sub = 0

for i, v in enumerate(s):
    if v == 'S':
        head.append(i)

    if v == 'T' and head:
        head.pop(0)
        sub += 2

print(len(s) - sub)

Buggy submission (verdict: Runtime Error):
s = raw_input()
def cal(s):
	a= 0
	for idx in range(len(s)/2):
		if s[2*idx]==s[2*idx +1]:
			continue
		else:
			a = 1
			s = s[2*(idx+1):]
			break

	if a:
		return cal(s)
	else:
		return s

print(len(cal(s)))
Problem p02570 (python)

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

d,t,s = map(int,input().split())

if t*s >= d:
    print("Yes")
else:
    print("No")

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

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


def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

p = primes(1003)

g = a[0]
for e in a:
    g = gcd(g,e)

if g != 1:
    print("not coprime")
else:
    a.sort()
    if a[0] == a[-1] and a[0] == 1:
        print("pairwise coprime")
    else:
        s = set()
        for e in a:
            for d in p:
                if e%d == 0:
                    if d in s:
                        print("setwise coprime")
                        exit()
                    s.add(d)
            s.add(e)
        print("pairwise coprime")
Problem p02835 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a+b+c >= 22:
    print('bust')
else:
    print('win')

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

n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7

cnt = [0]*65

for e in a:
    for i in range(65):
        if (e>>i)&1 == 1:
            cnt[i] += 1

res = 0
p = 1

for e in cnt:
    res = (res+p*e*(n-e)%mod)%mod
    p = p*2%mod

print(res)
Problem p02984 (python)

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

s = sum(a)
p = 0
for i in range(n):
    if i%2 == 1:
        p += a[i]*2

q = s-p
for i in range(n):
    print(q)
    q = a[i]*2-q

Buggy submission (verdict: Runtime Error):
mod = 2019
l,r = map(int,input().split())

cnt = 0
tank = []
for i in range(l,r+1):
    tank.append(i%mod)
    cnt += 1
    if cnt >= 2020:
        break

res = 2019

n = len(tank)
for i in range(n):
    for j in range(i+1,n):
        res = min(res,tank[i]*tank[j]%mod)
print(res)
Problem p02990 (python)

Fixed submission:
n,k = map(int,input().split())
mod = 10**9+7

dp = [[0]*(k+1) for i in range(k+1)]
dp[0][0] = 1

for i in range(1,k+1):
    for j in range(1,i+1):
        dp[i][j] = (dp[i-1][j]*(i+j-1)+dp[i-1][j-1]*(n-k-j+2))//i

for i in range(1,k+1):
    print(dp[-1][i]%mod)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
mod = 10**9+7

dp = [[0]*n for i in range(k+1)]
dp[0][0] = 1

for i in range(1,k+1):
    for j in range(1,i+1):
        dp[i][j] = ((dp[i-1][j]*(i+j-1)+dp[i-1][j-1]*(n-k-j+2))//i)%mod

for i in range(1,k+1):
    print(dp[-1][i])
Problem p03033 (python)

Fixed submission:
def main():
    import sys,heapq
    from collections import defaultdict
    input = sys.stdin.readline

    n,q = map(int,input().split())
    #used[i]:0より大きいならi
    used = defaultdict(int)
    tank = []

    p = []
    for i in range(n):
        s,t,x = map(int,input().split())
        p.append((s-x,x))
        p.append((t-x,-x))
    p.sort()

    cnt = 0
    for i in range(q):
        d = int(input())
        while cnt<=len(p)-1 and p[cnt][0] <= d:
            w = p[cnt][1]
            if w>=0:
                used[w] += 1
                heapq.heappush(tank,w)
            else:
                used[-w] -= 1
            cnt += 1
        while True:
            if len(tank) == 0:
                print(-1)
                break
            kouho = tank[0]
            if used[kouho] > 0:
                print(kouho)
                break
            else:
                heapq.heappop(tank)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys,heapq
    from collections import defaultdict
    input = sys.stdin.readline

    n,q = map(int,input().split())
    #used[i]:0より大きいならi
    used = defaultdict(int)
    tank = []

    p = []
    for i in range(n):
        s,t,x = map(int,input().split())
        p.append((s-x,x))
        p.append((t-x-0.5,x))
    p.sort()

    cnt = 0
    for i in range(q):
        d = int(input())
        while cnt<=len(p)-1 and p[cnt][0] <= d:
            w = p[cnt][1]
            if int(p[cnt][0]) == p[cnt][0]:
                used[w] += 1
                heapq.heappush(tank,w)
            else:
                used[w] -= 1
            cnt += 1
        while True:
            if len(tank) == 0:
                print(-1)
                break
            kouho = tank[0]
            if used[kouho] > 0:
                print(kouho)
                break
            else:
                heapq.heappop(kouho)
if __name__ == '__main__':
    main()
Problem p03053 (python)

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    h,w = map(int,input().split())
    a = []
    for i in range(h):
        inp = list(input())
        a.append(inp)
    
    dp = [[10**9]*w for i in range(h)]
    
    for i in range(h):
        for j in range(w):
            if a[i][j] == '.' and [i,j] != [0,0]:
                if i >= 1:
                    dp[i][j] = dp[i-1][j]+1
                    if j >= 1:
                        dp[i][j] = min(dp[i][j],dp[i][j-1]+1)
                else:
                    dp[i][j] = dp[i][j-1]+1
            elif a[i][j] == '#':
                dp[i][j] = 0
    for i in range(h):
        for j in range(w-1,-1,-1):
            if a[i][j] == '.' and [i,j] != [0,w-1]:
                if i >= 1:
                    dp[i][j] = min(dp[i-1][j]+1,dp[i][j])
                    if j+1 <= w-1:
                        dp[i][j] = min(dp[i][j],dp[i][j+1]+1)
                else:
                    dp[i][j] = min(dp[i][j+1]+1,dp[i][j])
    for i in range(h-1,-1,-1):
        for j in range(w):
            if a[i][j] == '.' and [i,j] != [h-1,0]:
                if i+1 <= h-1:
                    dp[i][j] = min(dp[i+1][j]+1,dp[i][j])
                    if j >= 1:
                        dp[i][j] = min(dp[i][j],dp[i][j-1]+1)
                else:
                    dp[i][j] = min(dp[i][j-1]+1,dp[i][j])
    for i in range(h-1,-1,-1):
        for j in range(w-1,-1,-1):
            if a[i][j] == '.' and [i,j] != [h-1,w-1]:
                if i+1 <= h-1:
                    dp[i][j] = min(dp[i+1][j]+1,dp[i][j])
                    if j+1 <= w-1:
                        dp[i][j] = min(dp[i][j],dp[i][j+1]+1)
                else:
                    dp[i][j] = min(dp[i][j+1]+1 ,dp[i][j])
        
    res = -1
    for i in range(h):
        for j in range(w):
            res = max(res,dp[i][j])

    print(res)



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
## coding: UTF-8
#from math import gcd 旧環境でこれを有効化するとREを吐きます
 
H,W = map(int,input().split())

c = []
#c.append(['w']*(W+2))
for i in range(H):
    c.append(list(input()))
#c.append(['w']*(W+2))
 
 
 
 
#queue = [start]
next_list = [] #次の歩数で探すものを格納しておく
step = 1
#mode = 0
#answer_mode = 0
status = True #ゴール判定でゴールについていたらFalseにする
#answer = -1
 
queue = []
for i in range(H+2):
    for j in range(W+2):
        if(c[i][j] == '#'):
            queue.append([i, j])

print(-1)
Problem p03108 (python)

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

#木の根を求める
def find(x):
    if par[x] == x:
        return x
    else:
        return find(par[x])

#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x != y:
        #xとyの属している集合が異なる時
        if rank[x] < rank[y]:
            par[x] = y
            size[y] += size[x]
        else:
            par[y] = x
            size[x] += size[y]
            if rank[x]==rank[y]:
                rank[x] += 1

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

########################################
#初期化
n,m = map(int,input().split())

par = [0]*n #親
for i in range(n):
    par[i] = i
rank = [1]*n #深さ
size = [1]*n #size[i]:iを根とするグループのサイズ
edge2 = [[0] for i in range(m)]
for i in range(m):
    edge2[i] = list(map(int,input().split()))

edge = [[0] for i in range(m)]
for i in range(m):
    edge[i] = [edge2[m-1-i][0]-1,edge2[m-1-i][1]-1]
res = []
for i in range(m):
    fi = find(edge[i][0])
    se = find(edge[i][1])
    if fi == se:
        res.append(0)
    else:
        res.append(size[fi]*size[se])
        unite(fi,se)
ass = 0
for i in range(m):
    ass += res[m-1-i]
    print(ass)

Buggy submission (verdict: Runtime Error):
#Union Find
import sys
input = sys.stdin.readline
 
n,m = map(int,input().split())

#根なら-size,子なら親の頂点
par = [-1]*n

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x != y:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

def size(x):
    return -par[find(x)]


edge = [tuple(map(int,input().split())) for i in range(m)]
edge = edge[::-1]
for i in range(m):
    edge[i] = (edge[i][0]-1,edge[i][1]-1)

res = []
for i in range(m):
    fi = find(edge[i][0])
    se = find(edge[i][1])
    if fi == se:
        res.append(0)
    else:
        res.append(size(fi)*size)
        unite(fi,se)
ass = 0
for i in range(m):
    ass += res[m-1-i]
    print(ass)
Problem p03201 (python)

Fixed submission:
import bisect
 
N = int(input())
A = [int(a) for a in input().split()]
A = sorted(A)
 
c = 0
for i in range(N - 1 , -1, -1):
    if A[i] == int(A[i]):
        b = 1
        while b <= A[i]:
            b <<= 1
 
        j = bisect.bisect_left(A, b - A[i])
        if i > j:
            if b - A[i] == A[j]:
                c += 1
                A[j] = A[j] - 0.5
                A[i] = A[i] + 0.5
print(c)

Buggy submission (verdict: Runtime Error):
import bisect
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
 
res = 0
for i in range(n - 1 , -1, -1):
    if a[i] == int(a[i]):#判定
        b = 1
        while b <= a[i]:
            b =b*2
 
        j = bisect.bisect_left(a, b - a[i])
        if i > j:
            if b - a[i] == a[j]:
                c += 1
                a[j] = a[j] - 0.5
                a[i] = a[i] + 0.5
print(res)

Buggy submission (verdict: Runtime Error):
import bisect
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
 
res = 0
for i in range(n - 1 , -1, -1):
    if a[i] == int(a[i]):#判定
        b = 1
        while b <= A[i]:
            b =b*2
 
        j = bisect.bisect_left(A, b - A[i])
        if i > j:
            if b - a[i] == a[j]:
                c += 1
                a[j] = a[j] - 0.5
                a[i] = a[i] + 0.5
print(res)
Problem p03327 (python)

Fixed submission:
# your code goes here
a=int(input())

if a <= 999:
	print('ABC')
else:
	print('ABD')

Buggy submission (verdict: Runtime Error):
a=int(input())
if a < = 999:
  print('ABC')
 else:
  print('ABD')