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

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
MX = 100005
cnt = [0]*MX
for i in a:
    cnt[i] += 1
tot = 0
for i in range(1, MX):
    tot += cnt[i] * i
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    tot += (c - b) * cnt[b]
    cnt[c] += cnt[b]
    cnt[b] = 0
    print(tot)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
Q = int(input())
ans = []
for q in range(Q):
    b, c = map(int, input().split())
    a = np.where(a==b, c, a)
    ans.append(sum(a))
for q in range(Q):
    print(ans[q])
Problem p02642 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
M = max(A)+1
cnt = [0]*M
ans = 0
for a in A:
    if cnt[a] != 0:
        cnt[a] = 2
    else:
        for i in range(a, M, a):
            cnt[i] += 1
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
M = 100000
cnt = [0]*M
ans = 0
for a in A:
    if cnt[a] != 0:
        cnt[a] = 2
    else:
        for i in range(a, M, a):
            cnt[i] += 1
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
M = 100005
cnt = [0]*M
ans = 0
for a in A:
    if cnt[a] != 0:
        cnt[a] = 2
    else:
        for i in range(a, M, a):
            cnt[i] += 1
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
M = 100005
cnt = [0]*M
ans = 0
for a in A:
    if cnt[a] == 1:
        cnt[a] = 2
    else:
        for i in range(a, M, a):
            cnt[i] += 1
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
import sympy
from collections import Counter
ans = 0
for i in range(n):
    if len(set(a) & set(sympy.divisors(a[i])))-1 == 0:
        ans += 1
cnt = Counter(a)
for i in cnt.values():
    if i > 1:
        ans -= i

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
import sympy
from collections import Counter
ans = 0
for i in range(n):
    if len(set(a) & set(sympy.divisors(a[i])))-1 == 0:
        ans += 1
for i in Counter(a).values():
    if i > 1:
        ans -= i

print(ans)
Problem p02702 (python)

Fixed submission:
s = input()[::-1]
m = 2019
ans = 0
x = 1
tot = 0
cnt = [0] * m
cnt[0] = 1
for s in s:
    tot += int(s) * x
    tot %= m
    #ans += cnt[tot]
    x *= 10
    x %= m
    cnt[tot] += 1

print(sum(i*(i-1)//2 for i in cnt))

Buggy submission (verdict: Runtime Error):
s = input()
num = ['2019', '4038', '6057', '8076', '10095', '12114', '14133', '16152', '18171']
ans = 0
for n in num:
    a += s.count(n)
print(ans)
Problem p02720 (python)

Fixed submission:
k = int(input())
a = [i for i in range(1, 10)]
while True:
    if k <= len(a):
        print(a[k-1])
        exit()
    k -= len(a)
    old = []
    old, a = a, old
    for i in range(len(old)):
        for j in range(-1, 2):
            d = old[i]%10+j
            if d >= 0 and d <= 9:
                a.append(old[i]*10+d)

Buggy submission (verdict: Runtime Error):
k = int(input())
a = [i for i in range(1, 10)]
while True:z
    if k <= len(a):
        print(a[k-1])
        exit()
    k -= len(a)
    old = []
    old, a = a, old
    for i in range(len(old)):
        for j in range(-1, 2):
            d = old[i]%10+j
            if d >= 0 and d <= 9:
                a.append(old[i]*10+d)
Problem p02730 (python)

Fixed submission:
s = input()
n = len(s)
a = s[:n//2]
b = s[n//2+1:]
def circular(string):
    return string == "".join(reversed(list(string)))

if circular(s) and circular(a) and circular(b):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
 = input()
def isPalindrome(string):
    return s == s[::-1]
if isPalindrome(s) and isPalindrome(s[:len(s)//2]) and isPalindrome(s[len(s)//2+1:]):
    print('Yes')
else:
    print('No')
Problem p02732 (python)

Fixed submission:
n = int(input())
a = [int(a)-1 for a in input().split()]
cnt = [0]*n
for i in a:
    cnt[i] += 1
total = 0
for i in cnt:
    total += i * (i-1) // 2
for i in a:
    print(total - (cnt[i] - 1))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
cnt = [0]*n
for i in a:
    cnt[i] += 1
total = 0
for i in cnt:
    total += i * (i-1) // 2
for i in a:
    print(total - (cnt[i] - 1))
Problem p02756 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#h,w,k = [int(i) for i in read().split()]


s = input()
u = ""
t = ""
q = int(input())
num = 0

for _ in range(q):
    a = readline().split()
    if len(a)==1:
        u,t = t,u
        num ^= 1
    else:
        f = int(a[1])
        c = a[2]
        if f==1:
            t += c
        else:
            u += c

if num:
    print(t[::-1]+s[::-1]+u)
else:
    print(t[::-1]+s+u)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read
s = input()
u = ""
t = ""
q = int(input())
num = 0

for _ in range(q):
    a = readline.split()
    if len(a)==1:
        u,t = t,u
        num ^= 1
    else:
        f = int(a[1])
        c = a[2]
        if f==1:
            t += c
        else:
            u += c

if num:
    print(t[::-1]+s[::-1]+u)
else:
    print(t[::-1]+s+u)

Buggy submission (verdict: Runtime Error):
s = input()
u = ""
t = ""
q = int(input())
num = 0

for _ in range(q):
    a = q.split()
    if len(a)==1:
        u,t = t,u
        num ^= 1
    else:
        f = int(a[1])
        c = a[2]
        if f==1:
            t += c
        else:
            u += c

if num:
    print(t[::-1]+s[::-1]+u)
else:
    print(t[::-1]+s+u)
Problem p02995 (python)

Fixed submission:
import fractions
a, b, c, d = map(int, input().split())
ans = b - (b//c)
ans -= b//d
ans += b//((c*d)//fractions.gcd(c, d))
x = (a-1)-((a-1)//c)
x -= (a-1)//d
x += (a-1)//((c*d)//fractions.gcd(c,d))
ans -= x
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())
ans = b - (b//c)
ans -= b//d
ans += b//((c*d)//math.gcd(c, d))
x = (a-1)-((a-1)//c)
x -= (a-1)//d
x += (a-1)//((c*d)//math.gcd(c,d))
ans -= x
print(ans)
Problem p03680 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500*500)
n = int(input())
a = [int(input()) for _ in range(n)]
def search(i, p):
    if p > n:
        print(-1)
        exit()
    elif i == 2:
        print(p)
        exit()
    else:
        search(a[i-1], p+1)

search(1, 0)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]
def search(i, p):
    if p > n:
        print(-1)
        exit()
    elif i == 2:
        print(p)
        exit()
    else:
        search(a[i-1], p+1)

search(1, 0)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]
def search(i, p):
    if p > n:
        print(-1)
        exit()
    if i == 2:
        print(p)
        exit()
    else:
        search(a[i-1], p+1)

search(1, 0)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]
def search(i, p):
    if i == 2:
        print(p)
        exit()
    elif p > n:
        print(-1)
        exit()
    else:
        search(a[i-1], p+1)

search(1, 0)
Problem p02796 (python)

Fixed submission:
n = int(input())
robots = []
for i in range(n):
    x_tmp, l_tmp = (int(i) for i in input().split())
    robots.append([x_tmp - l_tmp, x_tmp + l_tmp])

robots.sort()
ans = n
right = robots[0][1]
for i in range(n-1):
    if(robots[i+1][0] < right):
        ans -= 1
        right = min(right, robots[i+1][1])
    else:
        right = robots[i+1][1]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
robots = []
for i in range(n):
    x_tmp, l_tmp = (int(i) for i in input().split())
    robots.append({'x': x_tmp, 'l': l_tmp})

robots_sorted = sorted(robots, key=lambda x: x['x'])
ans = n
i = 0
while((robots_sorted[0]['x'] + robots_sorted[0]['l']) > (robots_sorted[1]['x'] - robots_sorted[1]['l'])):
    if(robots_sorted[0]['l'] > robots_sorted[1]['l'] * 2):
        robots_sorted.pop(0)
    else:
        robots_sorted.pop(1)

while(i < n-1):
    if((robots_sorted[i]['x'] + robots_sorted[i]['l']) > (robots_sorted[i+1]['x'] - robots_sorted[i+1]['l'])):
        if(i == n-2):
            if(robots_sorted[n-2]['l'] * 2 >= robots_sorted[n-1]['l']):
                robots_sorted.pop(i)
            else:
                robots_sorted.pop(i+1)
        elif(robots_sorted[i]['l'] > robots_sorted[i+1]['l']):
            robots_sorted.pop(i)
        else:
            robots_sorted.pop(i+1)
        i += -1
        n += -1
    i += 1

print(n)
Problem p02801 (python)

Fixed submission:
C = input()
print(chr(ord(C)+1))

Buggy submission (verdict: Runtime Error):
C = input()
print(chr(ord(C)+1)
Problem p03139 (python)

Fixed submission:
import numpy as np

N,A,B=[int(i) for i in input().split()]
x=min(A,B)
if((A+B)>N):
    z=N
    y=abs(A+B-z)
else:
    y=0
print("{} {}".format(x,y))

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

N,A,B=[int(i) for i in input().split()]
x=min(A,B)
if((A+B)>N):
    z=N
    y=abs(A+B-z)
else:
    y=0
print("{} {}".format(x,y))
Problem p03145 (python)

Fixed submission:
x,y,z=[int(i) for i in input().split()]
print(int(x*y/2))

Buggy submission (verdict: Runtime Error):
x,y,z=[int(i) for i in range(input)]
print(x*y/2)
Problem p03262 (python)

Fixed submission:
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

N,X=[int(i) for i in input().split()]
a=input().split()
x=[]
for i in range(N):
    x.append(int(a[i]))
if(N==1):
    print(abs(x[0]-X))
    exit()
x=list(map(lambda y:abs(y-X) , x))
ans=gcd(x[0],x[1])
for i in range(2,N):
    ans=gcd(x[i],ans)
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

N,X=[int(i) for i in input().split()]
a=input().split()
x=[]
for i in range(N):
    x.append(int(a[i]))
if(N==1):
    print(abs(x[0]-X))
    exit()
x=list(map(lambda y:abs(y-X) , x))
ans=gcd(x[0],x[1])
for i in range(2:N):
    ans=gcd(x[i],ans)
    
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

N,X=[int(i) for i in input().split()]
a=input().split()
x=[]
for i in range(N):
    x.append(int(a[i]))
if(N==1):
    print(abs(x[0]-X))
    exit()
x=list(map(lambda y:abs(y-X) , x))
x.sort()
print(math.gcd(x[0],x[1]))

Buggy submission (verdict: Runtime Error):
import math
N,X=[int(i) for i in input().split()]
a=input().split()
x=[]
for i in range(N):
    x.append(int(a[i]))
if(len(x)==1):
    print(abs(x[0]-X))
    exit()
xx=list(map(lambda y:abs(y-X) , x))
xx.sort()
print(math.gcd(xx[0],xx[1]))

Buggy submission (verdict: Runtime Error):
import math
N,X=[int(i) for i in input().split()]
a=input().split()
x=[]
for i in range(N):
    x.append(int(a[i]))
if(len(x)==1):
    print(abs(x[0]-X))
    exit()
x=list(map(lambda y:abs(y-X) , x))
x.sort()
print(math.gcd(x[0],x[1]))
Problem p02646 (python)

Fixed submission:
import sys

n = list(map(int,input().split()))
r = list(map(int,input().split()))
t = int(input())

A = n[0]
V = n[1]

B = r[0]
W = r[1]

T = t

after_a = A + V * T
after_b = B + W * T

after_a_min = A - V * T
after_b_min = B - W * T

if (after_a == after_b) or (after_a_min == after_b_min):
    print('YES')
    sys.exit()

if A < B and after_a > after_b:
    print('YES')
    sys.exit()

if A < B and after_a < after_b:
    print('NO')
    sys.exit()


if A > B and after_a_min < after_b_min:
    print('YES')
    sys.exit()

if A > B and after_a_min > after_b_min:
    print('NO')
    sys.exit()

Buggy submission (verdict: Runtime Error):
import sys

n = list(map(int,input().split()))
r = list(map(int,input().split()))
t = int(input())

A = n[0]
V = n[1]

B = r[0]
W = r[1]

T = t

after_a = A + V * T
after_b = B + W * T

after_a_min = A - V * T
after_a_min = B - V * T
print(after_a)
print(after_b)

if after_a == after_b:
    print('YES')
    sys.exit()

if A < B and after_a > after_b:
    print('YES')
    sys.exit()

if A < B and after_a <= after_b:
    print('NO')
    sys.exit()


if A > B and after_a_min < after_b_min:
    print('YES')
    sys.exit()

if A > B and after_a_min >= after_b_min:
    print('NO')
    sys.exit()

Buggy submission (verdict: Runtime Error):
import sys

n = list(map(int,input().split()))
r = list(map(int,input().split()))
t = int(input())

A = n[0]
V = n[1]

B = r[0]
W = r[1]

T = t

after_a = A + V * T
after_b = B + W * T

if after_a == after_b:
    print('YES')
    sys.exit()

elif A < B and after_a > after_b:
    target = ['YES' if (A + V * i) - (B + W * i) == 0  else 'NO' for i in range(T)]
    pritn(target)

elif A > B and after_a < after_b:
    target = ['YES' if (A + V * i) - (B + W * i) == 0  else 'NO' for i in range(T)]

else:
    print('NO')
    sys.exit()
Problem p02657 (python)

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

y = int(a[0]) * int(a[1])
print(y)

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

for i in range(n):
    if i == 0:
        x = r[i]
    else:
        x = x * r[i]
    
    if x >= 10**19:
        x = -1
        break

if x > 10**18:
        x = -1
print(int(x))
Problem p03493 (python)

Fixed submission:
s = input()
a = [int(c) for c in s]
print(sum(a))

Buggy submission (verdict: Runtime Error):
N = int(input())
As = [int(c) for c in input().split()]
counter = 0
w = 0


while w == 0:
    for i in range(N):
        if As[i] % 2 != 0:
            w = 1
        As[i] = int(As[i] / 2)
    counter += 1

print(counter)
Problem p03854 (python)

Fixed submission:
S = input()
T = ''
U = ['dreamer', 'dream', 'eraser', 'erase']
answer = 'NO'
list = [T]
done = 0

while done == 0:
    for l in list:
        list.remove(l)
        for u in U:
            if S.startswith(l + u):
                if S == l + u:
                    answer = 'YES'
                    done = 1
                list.append(l + u)
    if list == []:
        done = 1
print(answer)

Buggy submission (verdict: Runtime Error):
S = input()
U = ['dreamer', 'dream', 'eraser', 'erase']

answer = 'NO'


def possible(current):
    possible = []
    for string in U:
        if S.startswith(current + string):
            possible.append(string)
    return possible


def judge(current):
    if current == S:
        global answer
        answer = 'YES'
        return
    if answer == 'YES':
        return
    else:
        if possible(current) == []:
            return
        else:
            for candidate in possible(current):
                new = current + candidate
                if len(S) >= len(new):
                    judge(current + candidate)


judge('')

print(answer)

Buggy submission (verdict: Runtime Error):
S = input()
T = ''
U = ['dreamer', 'dream', 'eraser', 'erase']

answer = 'NO'


def possible(current):
    possible = []
    for string in U:
        if S.startswith(current + string):
            possible.append(string)
    return possible


def judge(current):
    if current == S:
        global answer
        answer = 'YES'
        return
    if answer == 'YES' or len(S) < len(current):
        return
    else:
        if possible(current) == []:
            return
        else:
            for candidate in possible(current):
                new = current + candidate
                if len(S) >= len(new):
                    judge(current + candidate)


for string in U:
    judge(string)

print(answer)
Problem p02717 (python)

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

l_1 = []
l_1.append(l_0[1])
l_1.append(l_0[0])
l_1.append(l_0[2])

l_2 = []
l_2.append(l_1[2])
l_2.append(l_1[1])
l_2.append(l_1[0])

print('{} {} {}'.format(l_2[0],l_2[1],l_2[2]))

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

p = sum(L)/(4*M)

cnt = 0
for i in range(N):
    if L[i] >= p:
        cnt += 1
if cnt >= M:
    print('Yes')
else:
    print('No')
Problem p02621 (python)

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

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

Fixed submission:
n, k = map(int, input().split())
a_lst = list(map(int, input().split()))
a_lst.sort()

ans = 0

for i in range(k):
    ans += a_lst[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a_lst = list(map(int, input().split()))
a_lst.sort()
if n > k or k == 3:
    print(a_lst[0]+a_lst[1]+a_lst[2])
elif k == 2:
    print(a_lst[0]+a_lst[1])
else:
    print(a_lst[0])
Problem p02642 (python)

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

a_max = max(a_lst)
index_lst = [0]*(a_max + 1)

for ai in a_lst:
    for multi in range(ai, a_max+1, ai):
        index_lst[multi] += 1

ans = 0
for ai in a_lst:
    if index_lst[ai] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_lst = list(map(int, input().split()))
index_lst = [0]*(a_max + 1)

for ai in a_lst:
    for multi in range(ai, a_max+1, ai):
        index_lst[multi] += 1

ans = 0
for ai in a_lst:
    if index_lst[ai] == 1:
        ans += 1
print(ans)
Problem p02741 (python)

Fixed submission:
a_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a = int(input())
print(a_list[a-1])

Buggy submission (verdict: Runtime Error):
a_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a = int(input())
print(a_list[a+1])
Problem p02887 (python)

Fixed submission:
n = int(input())
s_word = list(input())
start_w = s_word[0]
goal_num = 0
for i in range(n-1):
    if s_word[i+1] != start_w:
        start_w = s_word[i+1]
        goal_num += 1
goal_num +=1
print(goal_num)

Buggy submission (verdict: Runtime Error):
n = int(input())
s_word = list(input())
start_w = s_word[0]
goal_num = 0
for i in range(n-1):
    if s_word[i+1] != start_w:
        start_w = s_word[i+1]
        goal_num += 1
goal_num +=1
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
s_word = list(input())
start_w = s_word[0]
goal_num = 0
for i in range(n-1):
    if s_word[i+1] != start_w:
        start_w = s_word[i+1]
        res += 1
res +=1
print(res)
Problem p02909 (python)

Fixed submission:
s = input()
if s == 'Sunny':
    print('Cloudy')
if s == 'Cloudy':
    print('Rainy')
if s == 'Rainy':
    print('Sunny')

Buggy submission (verdict: Runtime Error):
N,K,Q = map(int, input().split()) #N人、K点、Q問
A = [int(input()) - 1 for i in range(Q)] #受験番号とリスト番号のズレを補正
# print(A)
P = [0] * N #持ち点
for j in range(Q):
    P[A[j]] +=1
for k in range(N):
    if P[k] > Q - K:
        print("Yes")
    else:
        print("No")
Problem p02911 (python)

Fixed submission:
N,K,Q = map(int, input().split()) #N人、K点、Q問
A = [int(input()) - 1 for i in range(Q)] #受験番号とリスト番号のズレを補正
# print(A)
P = [0] * N #持ち点
for j in range(Q):
    P[A[j]] +=1
for k in range(N):
    if P[k] > Q - K:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
a_list = [k] * n
# for _ in range(n):
#     a_list.append(k)
#print(a_list)
for _ in range(q):
    a = int(input())
    a_list = list(map(calc_minus, a_list))
    #print(a_list)
    a_list[a-1] = a_list[a-1] + 1
    #print(a_list)

#print(a_list)
for j in a_list:
    if int(j) > 0:
        print("Yes")
    else:
        print("No")
Problem p02675 (python)

Fixed submission:
n = list(input())
l = n[-1]
if l == "3":
  print("bon")
elif l == "0" or l == "6" or l == "1" or l == "8":
  print("pon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()
if len(s) <= k:
  print(s)
else:
  ns = s[:k]
  print(ns + "...")
Problem p02677 (python)

Fixed submission:
import math
a,b,h,m = map(int,input().split())
N = 360*m/60
M = 30*h + 30*m/60
siita = abs(N - M)
if siita >= 180:
  siita = 360 - siita
ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians((siita))))
print(ans)

Buggy submission (verdict: Runtime Error):
3 4 10 40
Problem p02796 (python)

Fixed submission:
n = int(input())
 
lines = []
for i in range(n):
  x,l = map(int,input().split())
  lines.append([x-l,x+l])
lines = sorted(lines,key=lambda x:x[1])
count = 0
kari = -9999999999999
for i in range(n):
  if lines[i][0] >= kari:
    count += 1
    kari = lines[i][1]
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
 
lines = []
for i in range(n):
  x,l = map(int,input().split())
  lines.append([x-l,x+l])
lines = sorted(lines)
count = 0
kari = -9999999999999
for i in range(n):
  if lines[i][0] >= kari:
    count += 1
    kari = lines[i][1]
print(count)
n = int(input())

lines = []
for i in range(n):
  x,l = map(int,input().split())
  lines.append([x-l,x+l])
lines = sorted(lines,key = lambda x:x[1])
count = 0
kari = -9999999999999
for i in range(n):
  if lines[i][0] >= kari:
    count += 1
    kari = lines[i][1]
print(count)
Problem p03449 (python)

Fixed submission:
n = int(input())
line1 = list(map(int,input().split()))
line2 = list(map(int,input().split()))
sum1 = sum(line1)
sum2 = sum(line2)
count1 = 0
count2 = 0
box = []
for i in range(0,n):
  count1 += line1[i]
  count2 += line2[i]
  totalgap = count2 - line2[i] +sum1 - count1
  box.append(totalgap)
print(sum1 + sum2 - min(box))

Buggy submission (verdict: Runtime Error):
n = int(input())
line1 = list(map(int,input().split()))
line2 = list(map(int,input().split()))
sum1 = sum(line1)
sum2 = sum(line2)
count1 = line1[0]
count2 = 0
box = []
for i in range(1,n-1):
  count1 += line1[i]
  count2 += line2[i-1]
  totalgap = count2 +sum1 - count1
  box.append(totalgap)
print(sum1 + sum2 - min(box))
Problem p03455 (python)

Fixed submission:
line = input().split(" ")
answer = int(line[0]) * int(line[1])
if answer % 2 == 1:
  print("Odd")
else:
  print("Even")

Buggy submission (verdict: Runtime Error):
(a,b) = input().split()
c = a*b
if c % 2 = 0:
  print("Even")
else:
  print("Odd")
Problem p03471 (python)

Fixed submission:
n,y = map(int,input().split())
kekkas = []
for a in range(2001):
  for b in range(2001):
    kekka = 9000*a + 4000*b - (y - 1000*n)
    if kekka == 0:
      c = n - a - b
      if c >= 0:
        kekkas.append((a,b,c))
if len(kekkas) > 0 :
  print(str(kekkas[0][0]) + " " + str(kekkas[0][1]) + " " + str(kekkas[0][2]))
else:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
n,y = map(int,input().split())
count = 0
for a in range(2001):
  for b in range(2001):
    c = n - a - b
    if 10000*a + 5000*b + 1000*c == y and 0 <= c <= 2000:
      print(str(a) + " " + str(b) + " " + str(c))
      count += 1
      break
  if count == 1:
    break
if count == 1:
  break

Buggy submission (verdict: Runtime Error):
n,y = map(int,input().split())
box = []
for a in range(2001):
  for b in range(2001):
    c = n - a - b
    if 10000*a + 5000*b + 1000*c == y and 0 <= c <= 2000:
      box.append([a,b,c])
print(str(box[0][0]) + " " + str(box[0][1]) + " " + str(box[0][2]))
Problem p03493 (python)

Fixed submission:
line = input()
count = 0
for i in range(3):
  if line[i] == "1":
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
def how_many(n):
  ans = 0
  while n % 2 == 0:
    n /= 2
    ans += 1
  return ans

n = int(input())
line = map(int , input().split())
answer = min(map(how_many , line))
             
print(answer)

Buggy submission (verdict: Runtime Error):
def how_many(n):
  ans = 0
  while n % 2 == 0:
    n /= 2
    ans += 1
  return ans

n = int(input())
line = map(int , input().split())
answer = min(map(how_many , line))
             
print(answer)