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

Fixed submission:
import sys
input = sys.stdin.readline
def print_ans(N, K, Q, arr):
    """Test Case
    >>> print_ans(6, 3, 4, [3, 1, 3, 2])
    No
    No
    Yes
    No
    No
    No
    >>> print_ans(6, 5, 4, [3, 1, 3, 2])
    Yes
    Yes
    Yes
    Yes
    Yes
    Yes
    >>> print_ans(10, 13, 15,[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9])
    No
    No
    No
    No
    Yes
    No
    No
    No
    Yes
    No
    """
    point = [K - Q] * N
    for a in arr:
        point[a - 1] += 1
    ans_arr = ["Yes" if p > 0 else "No" for p in point]
    for ans in ans_arr:
        print(ans)

if __name__ == '__main__':
    N, K, Q = map(int,input().rstrip().split())
    arr = [ int(input()) for i in range(Q)]
    print_ans(N, K, Q, arr)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def print_ans(N, K, Q, arr):
    """Test Case
    >>> print_ans(6, 3, 4, [3, 1, 3, 2])
    No
    No
    Yes
    No
    No
    No
    >>> print_ans(6, 5, 4, [3, 1, 3, 2])
    Yes
    Yes
    Yes
    Yes
    Yes
    Yes
    >>> print_ans(10, 13, 15,[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9])
    No
    No
    No
    No
    Yes
    No
    No
    No
    Yes
    No
    """
    point = [K - Q] * N
    for a in arr:
        point[a - 1] += 1
    ans_arr = ["Yes" if p > 0 else "No" for p in point]
    for ans in ans_arr:
        print(ans)

if __name__ == '__main__':
    N, K, Q = map(int,input().rstrip().split())
    arr = [ int(line) for line in input()]
    print_ans(N, K, Q, arr)
Problem p02945 (python)

Fixed submission:
import sys
input = sys.stdin.readline
def print_ans(A, B):
    """Test Case
    >>> print_ans(-13, 3)
    -10
    >>> print_ans(1, -33)
    34
    >>> print_ans(13, 3)
    39
    """
    print(max(max(A + B, A - B), A * B))

if __name__ == '__main__':
    A, B = map(int,input().rstrip().split())
    print_ans(A, B)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def print_ans(A, B):
    """Test Case
    >>> print_ans(-13, 3)
    -10
    >>> print_ans(1, -33)
    34
    >>> print_ans(13, 3)
    39
    """
    print(max(max(A + B, A - B), A * B))

if __name__ == '__main__':
    A = int(input().rstrip())
    B = int(input().rstrip())
    print_ans(A, B)
Problem p02952 (python)

Fixed submission:
import sys
input = sys.stdin.readline
def print_ans(N):
    """Test Case
    >>> print_ans(11)
    9
    >>> print_ans(136)
    46
    >>> print_ans(100000)
    90909
    """
    counter = 0
    for i in range(1, N + 1):
        if len(str(i)) % 2 != 0:
            counter +=1
    print(counter)

if __name__ == '__main__':
    N = int(input().rstrip())
    print_ans(N)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def print_ans(N):
    """Test Case
    >>> print_ans(11)
    9
    >>> print_ans(136)
    46
    >>> print_ans(100000)
    90909
    """
    # counter = 0
    # for i in range(1, N + 1):
    #     if len(str(i)) % 2 != 0:
    #         counter +=1
    # print(counter)
    length = len(str(N))
    ans = []

    for i in reversed(range(length - 1)):
        if i % 2 == 0:
            ans.append("9")
        else:
            ans.append("0")
    answer = int("".join(ans))
    if length % 2 != 0:
        answer += N % (10 ** (length -1)) + 1
    print(answer)


if __name__ == '__main__':
    N = int(input().rstrip())
    print_ans(N)
Problem p02982 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, D, dr):
    """Test Case
    >>> print_ans(3, 2, [[1, 2], [5, 5], [-2, 8]])
    1
    >>> print_ans(3, 4, [[-3, 7, 8, 2], [-12, 1, 10, 2], [-2, 8, 9, 3]])
    2
    >>> print_ans(5, 1, [[1],[2],[3],[4],[5]])
    10
    """
    dr = [np.array(d) for d in dr]
    ans = 0
    for i in range(N-1):
        for k in range(i + 1, N):
            multi_ar = dr[i] - dr[k] 
            abs_tmp = float(np.sum(multi_ar ** 2) ** (1/2))
            if(abs_tmp.is_integer()):
                ans += 1
    print(ans)



if __name__ == '__main__':
    N, D = map(int, input().rstrip().split())
    dr = [list(map(int, input().rstrip().split())) for _ in range(N)]
    print_ans(N, D, dr)

Buggy submission (verdict: Runtime Error):
# B problem
import numpy as np
def check_abs(arr, lists):
    ret = 0
    for i, k in lists:
        tmp = ( arr - k ) ** 2
        if (np.sum(tmp) ** 0.5).is_integer():
            ret += 1
    return ret
T = input()
N, D = map(int,T.split())
lists = []
for i in range(N):
    data = input().split()
    tmp = list(map(int, data))
    lists.append(tmp)
tmp2 = np.array(lists)
for i in range(N):
    ress = 0
    arr = tmp2[i]
    np.delete(tmp2, i, 0)
    res = check_abs(arr, tmp2)
    ress += res
print(ress)
Problem p02995 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x
def calc(x, C, D, l):
    x1 = x // C
    x2 = x // D
    x3 = x // l
    return x - x1 -x2 + x3

def print_ans(A, B, C, D):
    """Test Case
    >>> print_ans(4, 9, 2, 3)
    2
    >>> print_ans(10, 40, 6, 8)
    23
    >>> print_ans(314159265358979323, 846264338327950288, 419716939, 937510582)
    532105071133627368
    """
    # Greatest common divisor
    g = gcd(max(C,D),min(C,D))
    # Least common multiple
    l = C * D // g
    print(calc(B, C, D, l) - calc(A - 1, C, D, l))



if __name__ == '__main__':
    A, B, C, D = map(int, input().rstrip().split())
    print_ans(A, B, C, D)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(A, B, C, D):
    """Test Case
    >>> print_ans(4, 9, 2, 3)
    2
    >>> print_ans(10, 40, 6, 8)
    23
    >>> print_ans(314159265358979323, 846264338327950288, 419716939, 937510582)
    532105071133627368
    """
    ar = np.arange(A, B + 1)
    cr = ar[ar % C != 0]
    dr = cr[cr % D != 0]
    print(len(dr))

if __name__ == '__main__':
    A, B, C, D = map(int, input().rstrip().split())
    print_ans(A, B, C, D)
Problem p03030 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(6,[["khabarovsk",-20, 1], ["moscow",-10, 2], ["kazan",-50, 3], ["kazan",-35, 4], ["moscow",-60, 5], ["khabarovsk",-40, 6]])
    3
    4
    6
    1
    5
    2
    >>> print_ans(10, [["yakutsk", -10, 1 ], ["yakutsk", -20, 2 ], ["yakutsk", -30, 3 ], ["yakutsk", -40, 4 ], ["yakutsk", -50, 5 ], ["yakutsk", -60, 6 ], ["yakutsk", -70, 7 ], ["yakutsk", -80, 8 ], ["yakutsk", -90, 9 ], ["yakutsk", -100,10]])
    10
    9
    8
    7
    6
    5
    4
    3
    2
    1
    """
    ans = sorted(ar)
    for a in ans:
        print(a[2])

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = []
    for i in range(N):
        s, p = input().rstrip().split()
        p = int(p)
        ar.append([s, -p, i + 1])
    print_ans(N, ar)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(6,[["khabarovsk",-20, 1], ["moscow",-10, 2], ["kazan",-50, 3], ["kazan",-35, 4], ["moscow",-60, 5], ["khabarovsk",-40, 6]])
    3
    4
    6
    1
    5
    2
    >>> print_ans(10, [["yakutsk", -10, 1 ], ["yakutsk", -20, 2 ], ["yakutsk", -30, 3 ], ["yakutsk", -40, 4 ], ["yakutsk", -50, 5 ], ["yakutsk", -60, 6 ], ["yakutsk", -70, 7 ], ["yakutsk", -80, 8 ], ["yakutsk", -90, 9 ], ["yakutsk", -100,10]])
    10
    9
    8
    7
    6
    5
    4
    3
    2
    1
    """
    ans = sorted(ar)
    for a in ans:
        print(a[2])

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = []
    for i in range(N):
        s, p = input().rstrip().split()
        n = int(n)
        ar.append([s, -n, i + 1])
    print_ans(N, ar)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(6,[["khabarovsk",-20, 1], ["moscow",-10, 2], ["kazan",-50, 3], ["kazan",-35, 4], ["moscow",-60, 5], ["khabarovsk",-40, 6]])
    3
    4
    6
    1
    5
    2
    >>> print_ans(10, [["yakutsk", -10, 1 ], ["yakutsk", -20, 2 ], ["yakutsk", -30, 3 ], ["yakutsk", -40, 4 ], ["yakutsk", -50, 5 ], ["yakutsk", -60, 6 ], ["yakutsk", -70, 7 ], ["yakutsk", -80, 8 ], ["yakutsk", -90, 9 ], ["yakutsk", -100,10]])
    10
    9
    8
    7
    6
    5
    4
    3
    2
    1
    """
    ans = sorted(ar)
    for a in ans:
        print(a[2])

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = []
    for i in range(N):
        s, p = input().rstrip().split()
        n = int(n)
        ar.append((s, -n, i + 1))
    print_ans(N, ar)
Problem p03101 (python)

Fixed submission:
import sys
input = sys.stdin.readline
def print_ans(H, W, h, w):
    """Test Case
    >>> print_ans(3, 2, 2, 1)
    1
    >>> print_ans(5, 5, 2, 3)
    6
    >>> print_ans(2, 4, 2, 4)
    0
    """
    print((H - h) * (W  -w))


if __name__ == '__main__':
    H, W = map(int, input().rstrip().split())
    h, w = map(int, input().rstrip().split())
    print_ans(H, W, h, w)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def print_ans(H, W, h, w):
    """Test Case
    >>> print_ans(3, 2, 2, 1)
    1
    >>> print_ans(5, 5, 2, 3)
    6
    >>> print_ans(2, 4, 2, 4)
    0
    """
    print((H - h) * (W  -w))


if __name__ == '__main__':
    H, W = map(int, input().rstrip().split())
    h, w = map(int, input().rstrip().split())
    print_ans(b)
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
l = list(map(int,input().split()))
#print(len(l))
a = len(l)
d = 0
i = 0
while(i<=a):
    if d <= x:
        if i == a:
            i += 1
            break
        d += l[i]
        i += 1
    else:
        break
print(i)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
i = 0
while(True):
    if d <= x:
        d += l[i]
        i += 1
    else:
        break
print(i)
Problem p03080 (python)

Fixed submission:
n=int(input())
s = input()
#print(s)
r = 0
b = 0
for i in s:
    if i == "R":
        r += 1
    if i == "B":
        b += 1

if r <= b:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
#s = input().split()
print(s)
r = 0
b = 0
for i in s:
    if i == "R":
        r += 1
    if i == "B":
        b += 1

if r <= b:
    print("No")
else:
    print("Yes")
Problem p03145 (python)

Fixed submission:
l=list(map(int,input().split()))
l.remove(max(l))
print(l[0]*l[1]//2)

Buggy submission (verdict: Runtime Error):
l=map(int,input().split())
l.remove(max(l))
print(l[0]*l[1])
Problem p03239 (python)

Fixed submission:
n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m == 10000:
    print('TLE')
else:
    print(m)

Buggy submission (verdict: Runtime Error):
n,t = int(input().split())
m = 10000
for i in range(n):
    c,d = int(input().split())
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

Buggy submission (verdict: Runtime Error):
n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

Buggy submission (verdict: Runtime Error):
n,t = [x for x in int(input())]
m = 10000
for i in range(n):
    c,d = [x for x in int(input())]
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)
Problem p02607 (python)

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

result = 0

for i in range(n):
    if (i+1) % 2 != 0 and a[i] % 2 != 0:
        result +=1
print(result)

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


def cal(n):
    result = 0
    totyu = 1
    for _ in range(n-1):
        if a[totyu] % 2 !=0:
            result += 1
            totyu += 2
        else :
            totyu += 2
    return result

if n % 2 == 0:
    n /= 2
else:
    n = n//2 +1 

print(cal(n))
Problem p02621 (python)

Fixed submission:
n = int(input())
n = n + n**2 + n**3
print(int(n))

Buggy submission (verdict: Runtime Error):
n = int(input())n = int(input())
n = n + n**2 + n**3
print(n)
Problem p02641 (python)

Fixed submission:
x, n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
p_change = []
m = 0
if n == 0:
  print(x)
else:
    for i in p:
        p_change.append(abs(i-x))
 
    if x in p:
        for i in range(n+1):
            if i != 0 and p_change.count(i) != 2:
                m = i
                break
        if x-m in p:
            print(x+m)
        else:
            print(x-m)
    else:
        print(x)

Buggy submission (verdict: Runtime Error):
x, n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
  p = []
else:
  print(x)

p_change = []
m = 0
for i in p:
    p_change.append(abs(i-x))

if x in p:
    for i in range(n):
        if i != 0 and p_change.count(i) != 2:
            m = i
            break
    if x-m in p:
        print(x+m)
    else:
        print(x-m)
else:
    print(x)

Buggy submission (verdict: Runtime Error):
x, n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
p_change = []
m = 0
if n == 0:
  print(x)

for i in p:
    p_change.append(abs(i-x))

if x in p:
	pass
else:
  print(x)
    
for i in range(n):
    if i != 0 and p_change.count(i) != 2:
        m = i
        break
if x-m in p_change:
    print(x+m)
else:
    print(x-m)

Buggy submission (verdict: Runtime Error):
x, n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
p_change = []
m = 0
if n == 0:
  print(x) 

for i in p:
    p_change.append(abs(i-x))

if x in p_change:
	pass
else:
  print(x)
    
for i in range(n):
    if i != 0 and p_change.count(i) != 2:
        m = i
        break
if x-m in p_change:
    print(x+m)
else:
    print(x-m)

Buggy submission (verdict: Runtime Error):
x, n = map(int,input().split())
if n != 0:
  p = list(map(int,input().split()))
p_change = []
m = 0
if n == 0:
  print(x)

for i in p:
    p_change.append(abs(i-x))

for i in range(n):
    if i != 0 and p_change.count(i) != 2:
        m = i
        break
if x-m in p_change:
    print(x+m)
else:
    print(x-m)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()
c = 0
fi = list(S)
for i in range(N-2):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                c += 1
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
c = 0
fi = list(S)
for i in range(N):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                c += 1
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
c = 0
fi = list(S)
for i in range(N):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                c += 1
print(c)
Problem p02817 (python)

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

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))
for i in range(A[2]):
    if A[0] > 0:
        A[0] -= 1
    elif A[1] > 1:
        A[1] -=1
print(A[0],A[1])
Problem p03612 (python)

Fixed submission:
n = int(input())
p = [int(x) for x in input().split()]

ans = 0
cnt = 0
'''
index = 0
while index <= n-1:
    if p[index] == index+1:
        if p[index+1] != index+2:
            index += 1
        else:
            index += 2
        ans += 1
    else:
        index += 1
'''

for i in range(n-1):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        cnt += 1

if p[-1] == n:
    cnt += 1

print(cnt)

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

ans = 0
index = 0

while index <= n-1:
    if p[index] == index+1:
        if p[index+1] != index+2:
            index += 1
        else:
            index += 2
        ans += 1
    else:
        index += 1

print(ans)
Problem p04032 (python)

Fixed submission:
s = str(input())


a, b = 0, 0

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
    elif i < len(s)-2:
        if s[i] == s[i+2]:
            a, b = i+1, i+3
            break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)

Buggy submission (verdict: Runtime Error):
s = str(input())


a, b = 0, 0

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
    elif i != len(s)-1:
        if s[i] == s[i+2]:
            a, b = i+1, i+3
            break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)

Buggy submission (verdict: Runtime Error):
s = str(input())


a, b = 0, 0

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
    if i != len(s)-1:
        elif s[i] == s[i+2]:
            a, b = i+1, i+3
            break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)

Buggy submission (verdict: Runtime Error):
s = str(input())


a, b = 0, 0

for i in range(len(s)):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)
Problem p03240 (python)

Fixed submission:
N = int(input())

xyh = []
for i in range(N):
    xyh.append(list(map(int,input().split())))

xyh_sorted = sorted(xyh, key=lambda x: x[2], reverse=True)

answer = [0, 0, 0]
for cy in range(0, 101):
    for cx in range(0, 101):
        H = xyh_sorted[0][2] + abs(xyh_sorted[0][0] - cx) + abs(xyh_sorted[0][1] - cy)
        flag = True
        for i in range(1,N):
            h2 = max(H - abs(xyh_sorted[i][0] - cx) - abs(xyh_sorted[i][1] - cy), 0)
            if h2 != xyh_sorted[i][2]:
                flag = False
                break
        if flag:
            answer = [cx, cy, H]
            break
    if flag:
        break

answerString = str(answer[0]) + " " + str(answer[1]) + " " + str(answer[2])
print(answerString)

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

for cx in range(101):
    for cy in range(101):
        flag = True
        tmpH = 0
        for i in range(N):
            X = xyh[i][0]
            Y = xyh[i][1]
            h = xyh[i][2]
            if i == 0:
                tmpH = abs(X-cx) + abs(Y-cy) + h
            else:
                if tmpH != abs(X-cx) + abs(Y-cy) + h:
                    flag = False
        if flag:
            answer_cx = cx
            answer_cy = cy
            answer_h = tmpH
            answer_string = str(cx) + " " + str(cy) + " " + str(tmpH)
            break
print(answer_string)
Problem p02621 (python)

Fixed submission:
import re
import sys
try:
  a = int(input())
  if not 1 <= a <= 10:
    sys.exit()
  print(a+(a**2)+(a**3))
except:
  sys.exit()

Buggy submission (verdict: Runtime Error):
import re
import sys
S = input()
T = input()
w = 0
if not re.match(r'^[a-z]+$', S) or not re.match(r'^[a-z]+$', T) or len(S) != len(T) or (10 ** 5 * 2) < len(S):
  sys.exit()
if S != T:
  i = 0
  for l in S:
    if l != T[i]:
      w = w + 1
    i = i + 1
print(w)
Problem p02582 (python)

Fixed submission:
s = input()
res = 1
 
if s[0] == "R" and s[1] == "R":
  res += 1
if s[1] == "R" and s[2] == "R":
  res += 1
  
if "R" in s:
  print(res)
else:
  print(0)

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

if s[0] == s[1]:
  res += 1
if s[1] == s[2]:
  res += 1

print(res)
Problem p02797 (python)

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

if S != 10**9:
  res = [S]*K + [10**9]*(N-K)
else:
  res = [10**9]*K + [1]*(N-K)
  
print(*res)

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

s.sort(key=lambda x: x[1])

t = list(map(lambda j:(j[0]-j[1]+1, j[0]+j[1]-1), s))
NN = len(t)
dobon = []

for k, k_l in enumerate(t):
  if k in dobon:
    break
  for l in range(k+1, NN):
    if l in dobon:
      pass
    else:
      if int(k_l[1]) <= int(t[l][1]):
        if (t[l][0] <= k_l[1]) and (k_l[1] <= t[l][1]):
          N -= 1
          dobon.append(l)
          break
      else:
        if (t[l][0] <= k_l[0]) and (k_l[0] <= t[l][1]):
          N -= 1
          dobon.append(l)
          break

print(N)
Problem p03352 (python)

Fixed submission:
x = int(input())
s = set([1])
for b in range(32):
    for p in range(2,10):
        if b**p <= x:
            s.add(b**p)
print(sorted(list(s))[-1])

Buggy submission (verdict: Runtime Error):
x = int(input())
s = set([])
primes = [2,3,5,7,11,13,17,19,23,29,31]
for b in primes:
    for p in range(2,10):
        if b**p <= x:
            s.add(b**p)
        else:
            break
print(sorted(list(s))[-1])
Problem p03679 (python)

Fixed submission:
x, a, b = map(int, input().split())
if b - a <= 0:
    print("delicious")
elif 0 < b - a <= x:
    print("safe")
else:
    print("dangerous")

Buggy submission (verdict: Runtime Error):
x, a, b = map(int, input().split())
if b - a < 0:
    print("delicious")
elif 0 <= b - a =< x:
    print("safe")
else:
    print("dangerous")
Problem p03998 (python)

Fixed submission:
# coding: utf-8
# Here your code !

sa, sb, sc = [list(input()) for i in range(3)]
now = sa.pop(0)
while 1:
    #print(now, sa, sb, sc)
    if now == "a":
        if sa == []:
            pass
        else:
            now = sa.pop(0)
    elif now == "b":
        now = sb.pop(0)
    else:
        now = sc.pop(0)
    
    if sa == [] and now == "a" :
        print("A")
        break
    elif sb == [] and now == "b":
        print("B")
        break
    elif sc == [] and now == "c":
        print("C")
        break

Buggy submission (verdict: Runtime Error):

sa, sb, sc = [list(input()) for i in range(3)]
now = sa.pop(0)
while 1:
    #print(now, sa, sb, sc)
    if now == "a":
        now = sa.pop(0)
    elif now == "b":
        now = sb.pop(0)
    else:
        now = sc.pop(0)
    
    if sa == [] and now == "a" :
        print("A")
        break
    elif sb == [] and now == "b":
        print("B")
        break
    elif sc == [] and now == "c":
        print("C")
        break
Problem p03999 (python)

Fixed submission:
# coding: utf-8

S = input()
cnt = 0
ls = []
for i in range(2**(len(S)-1)):
    #print(str(bin(i))[2:].zfill(len(S)-1))
    bi = list(str(bin(i))[2:].zfill(len(S)-1))
    ls.append(bi)

for item in ls:
    s = S[0]
    for inx, bi in enumerate(item):
        if bi == "0":
            pass
        else:
            s = s+"+"
        if len(S) != 1:
            s = s + S[inx+1]
        else:
            s = S
    cnt += sum(map(int, s.split("+")))
print(cnt)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

S = input()
cnt = 0
ls = []
for i in range(2**(len(S)-1)):
    #print(str(bin(i))[2:].zfill(len(S)-1))
    bi = list(str(bin(i))[2:].zfill(len(S)-1))
    ls.append(bi)

for item in ls:
    s = S[0]
    for inx, bi in enumerate(item):
        if bi == "0":
            pass
        else:
            s = s+"+"
        s = s + S[inx+1]
    cnt += sum(map(int, s.split("+")))
print(cnt)
Problem p04039 (python)

Fixed submission:
# coding: utf-8
import itertools
n, k = map(int, raw_input().split())
ls = map(int, raw_input().split())
kls = []
for i in range(10):
    if i not in ls:
        kls.append(i)
#print ls,kls
ans_list = []
repeat_len = len(str(n))
while not ans_list:
    for element in itertools.product(kls, repeat=repeat_len):
        a = int("".join(map(str,element)))
        if a >= n:
            ans_list.append(a)
    repeat_len += 1
print ans_list[0]

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import itertools
n, k = map(int, raw_input().split())
ls = map(int, raw_input().split())
kls = []
for i in range(10):
    if i not in ls:
        kls.append(i)
#print ls,kls
ans_list = []
for element in itertools.product(kls, repeat=len(str(n))):
    a = int("".join(map(str,element)))
    if a >= n:
        ans_list.append(a)
print ans_list[0]