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

Fixed submission:
def main():
    print(input().count('1'))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <string>
using namespace std;


int main()
{
  string s;
  int c=0;
  
  cin >> s;
  for ( int i=0; i<s.length(); i++ ) {
    if ( s[i] == '1' ) c++;
  }
  cout << c << endl;
  
  return 0;
}
Problem p03563 (python)

Fixed submission:
def main():
    r = int(input())
    g = int(input())
    print(g*2 - r)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    t = input()

    for i in range(len(s)-len(t)+1):
        flag = True
        for j in range(len(t)):
            if s[i+j] != t[j] and s[i+j] != '?':
                flag = False
                break
        if flag:
            s = s[:i] + t + s[i+len(t):]
            #break

    if flag:
        print(s.replace('?', 'a'))
    else:
        print("UNRESTORABLE")
        

if __name__ == "__main__":
    main()
Problem p03591 (python)

Fixed submission:
def main():
    s = input()
    if len(s) < 4 or "YAKI" != s[:4]:
        print("No")
    else:
        print("Yes")


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <string>


using namespace std;


bool yaki_check(string s)
{
  if (s.length() < 4){
    return false;
  }
  string t("YAKI");
  for (int i=0; i<4; i++){
    if (s[i] != t[i]){
      return false;
    }
  }
  return true;
}

int main()
{
  string s;

  cin >> s;

  if (yaki_check(s)){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}
Problem p03657 (python)

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

    if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0: print("Possible")
    else: print("Impossible")


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    l_list = sorted([int(i) for i in input().split()], reverse=True)
    print(sum(l_list[:k]))
    

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    l_list = sorted([int(i) for i in input().split()], reverse=True)
    print(sum(l_list[:k]))
    

if __name__ == "__main__":
    main()
Problem p03737 (python)

Fixed submission:
def main():
    print(''.join([s[0].upper() for s in input().split()]))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict


def solve(pre_is_positive, a_list):
    total = 0
    ans = 0
    for a in a_list:
        total += a
        if pre_is_positive and total >= 0:
            ans += abs(total) + 1
            total = -1
        elif not pre_is_positive and total <= 0:
            ans += abs(total) + 1
            total = 1
        pre_is_positive = total > 0
    return ans


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    print(min(solve(True, a_list), solve(False, a_list)))


if __name__ == "__main__":
    main()
Problem p03826 (python)

Fixed submission:
def main():
    a, b, c, d = map(int, input().split())
    ans = a*b if a*b >= c*d else c*d
    print(ans)
    

if __name__ == "__main__":
    main()

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

    x, maxv = 0, 0
    for c in s:
        if c == 'I':
            x += 1
        elif c == 'D':
            x -= 1
        if x > maxv:
            maxv = x
    print(maxv)


if __name__ == "__main__":
    main()
Problem p03576 (python)

Fixed submission:
def solve():
    from itertools import combinations
    N, K = map(int, input().split())
    vertices = [tuple(map(int, input().split())) for _ in [0]*N]
    sorted_v = sorted(vertices)
    result = float("inf")
 
    for l in combinations(sorted_v, min(4, K)):
        xs = sorted(x for x, y in l)
        ys = sorted(y for x, y in l)
        min_x, max_x = xs[0], xs[-1]
        min_y, max_y = ys[0], ys[-1]
        if sum(1 for x, y in vertices if min_x <= x <= max_x and min_y <= y <= max_y) >= K:
            s = (max_x-min_x)*(max_y-min_y)
            if result > s:
                result = s
 
    print(result)
 
 
if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    from itertools import combinations
    N, K = map(int, input().split())
    v = [tuple(map(int, input().split())) for _ in [0]*N]
    sorted_v = sorted(v)
    ans = float('inf')
    #print(v)
    
    for l in combinations(sorted_v, min(4, K)):
        xs = sorted(x for x, y in l)
        ys = sorted(y for x, y in l)
        min_x, max_x = xs[0], xs[-1]
        min_y, max_y = ys[0], ys[-1]
        if sum(1 for x, y in v if min_x <= x <= max_x and min_y <= y <= max_y) >= K:
            s = (max_x - min_x) * (max_y - min_y)
        if ans > s:
            ans = s
    
    print(ans)
    
if __name__ == '__main__':
    solve()
Problem p03599 (python)

Fixed submission:
def solve():
    
    A, B, C, D, E, F = map(int, input().split())
    memo = {}
    
    for a in range(31):
        for b in range(31):
            for c in range(101):
                for d in range(101):
                    if a == 0 and b == 0:
                        break
                    if (100*A)*a + (100*B)*b + C*c + D*d > F:
                        break
                    if  ((100*A)*a + (100*B)*b)/100 *E < C*c + D*d:
                        break
                    density = 100 * (C*c+D*d) / ( (100*A)*a + (100*B)*b + C*c + D*d )
                    memo[a,b,c,d] = density
    
    max_v = max(memo.values())
    
    for k, v in memo.items():
        if v == max_v:
            print((100*A)*k[0] + (100*B)*k[1] + C*k[2] + D*k[3], C*k[2] + D*k[3] )
            break
 
if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    
A, B, C, D, E, F = map(int, input().split())
memo = []

for a in range(31):
    for b in range(31):
        for c in range(101):
            for d in range(101):
                w = (100*A)*a + (100*B)*b
                s = C*c + D*d
                if w+s > F:
                    break
                else:
                    if w/100 * E >= s:
                        memo.append([w+s,s])

print(*sorted(memo, key=lambda x: (100*x[1] / x[0] if x[0] else 0))[-1])

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    
    A, B, C, D, E, F = map(int, input().split())
    memo = {}
    
    for a in range(31):
        for b in range(31):
            for c in range(101):
                for d in range(101):
                    w = (100*A)*a + (100*B)*b
                    s = C*c + D*d
                    if w+s > F:
                        break
                    else:
                        if w/100 * E >= s:
                            density = 100* s/(w+s)
                            memo[a,b,c,d] = density
    
    max_v = max(memo.values())
    
    for k, v in memo.items():
        if v == max_v:
            print((100*A)*k[0] + (100*B)*k[1] + C*k[2] + D*k[3], C*k[2] + D*k[3] )
            break
 
if __name__ == '__main__':
    solve()
Problem p03611 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
 
set_a = set(a)
cnt = [0] * (max(a)+1)
ans = 0
 
for i in a:
    cnt[i] += 1
 
if len(cnt) == 1:
    print(cnt[0])
elif len(cnt) == 2:
    print(sum(cnt))
else:
    for i in range(1, max(a)):
        ans = max(ans, cnt[i-1]+cnt[i]+cnt[i+1])
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt = [0] * 100001
a = list(map(int, input().split()))
for v in a:
    cnt[v] += 1
    cnt[v+1] += 1
    cnt[v+2] += 1
print(max(cnt))
Problem p03625 (python)

Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
h = w = 0

for i, cnt in Counter(A).items():
    if cnt >= 2 and i > w:
        if i > h:
            if cnt >= 4:
                h = i
                w = i
            else:
                w = h
                h = i
        else:
            w = i
            
print(w * h)

Buggy submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A_counter = Counter(A).most_common()
A_counter.sort(reverse = True)

ans = []

for i, cnt in A_counter.items():
    if cnt >= 2:
        ans.append(i)
        if len(ans) == 2:
            print(ans[0] * ans[1])
            break
    
    if cnt >= 4:
        print(i**2)
        break
    
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
two = []
four = []

for i, cnt in Counter(A).items():
    if cnt >= 4:
        four.append(i)
    if 4 > cnt >= 2:
        two.append(i)
    if len(two) >= 2:
        break

if two:
    if four:
        print(max(two[0]*two[1], four[0]*four[0]))
    else:
        print(two[0]*two[1])
else:
    if four:
        print(four[0]* four[0])
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
two = []
four = []

for i, cnt in Counter(A).items():
    if cnt >= 4:
        four.append(i)
    if 4 > cnt >= 2:
        two.append(i)
    if len(two) >= 2:
        break

if two:
    if four:
        print(max(two[0]*two[1], four[0]*four[0]))
    else:
        print(two[0]*two[1])
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
two = []
four = []

for i, cnt in Counter(A).items():
    if cnt >= 4:
        four.append(i)
    if cnt >= 2:
        two.append(i)
    if len(two) >= 2:
        break

print(max(two[0] * two[1], four[0] * four[0]))
Problem p03635 (python)

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

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
 
i = 0

for x in range(H):
    c = []
    for y in range(W):
        c.append(i + 1)
        a[i] -= 1
        if a[i] == 0:
            i += 1
            
    if x % 2 == 0:
        print(*c)
    else:
        print(*c[::-1])
Problem p03645 (python)

Fixed submission:
N, M = map(int, input().split())
set_a, set_b = set(), set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        set_a.add(b)
    if b == N:
        set_b.add(a)

if set_a & set_b:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
N, M = int(input())
set_a, set_b = set(), set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        set_a.add(b)
    if b == N:
        set_b.add(a)

if set_a & set_b:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Problem p03673 (python)

Fixed submission:
from collections import deque

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

b = deque()

for i in range(n):
    if (i+1) %2 == n % 2:
        b.appendleft(a[i])
    else:
        b.append(a[i])
ans = list(b)
print(*ans)

Buggy submission (verdict: Runtime Error):
from collections import deque

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

b = deque()

for i in range(n):
    if (i+1) %2 == n % 2:
        b.insert(0, a[i])
    else:
        b.append(a[i])
print(*b)

Buggy submission (verdict: Runtime Error):
from collections import deque

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

b = deque()

for i in range(n):
    if (i+1) %2 == n % 2:
        b.insert(0, a[i])
    else:
        b.append(a[i])
print(*b)
Problem p03721 (python)

Fixed submission:
import bisect

N, K = map(int, input().split())
d = []


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

d.sort()

l = [0] * N
l[0] = d[0][1]

for i in range(1, N):
    l[i] = d[i][1]+ l[i-1]

pos = bisect.bisect_left(l, K)
print(d[pos][0])

Buggy submission (verdict: Runtime Error):
10 500000
1 100000
1 100000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000
Problem p03722 (python)

Fixed submission:
import sys

INF = float('inf')

def Bellmanford(n, edges, r): #r: 始点
    d = [INF] * n
    d[r] = 0
    
    for i in range(n):
        #flag = False
        
        for (u, v, c) in edges:
            if d[u] != INF and d[u] + c < d[v]:
                d[v] = d[u] + c
                #flag = True
                if i == n-1 and v == n-1:
                    return 'inf'
    
    return -d[n-1]
    

N, M = map(int, sys.stdin.readline().split())
Edges = [None] * M

for i in range(M):
    ai, bi, ci = map(int, sys.stdin.readline().split())
    Edges[i] = (ai-1, bi-1, -ci)
    
ans = Bellmanford(N, Edges, 0)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

INF = float('inf')

def Bellmanford(n, edges, r): #r: 始点
    d = [INF] * n
    d[r] = 0
    
    for i in range(n):
        flag = False
        
        for (u, v, c) in edges:
            if d[u] != INF and d[u] + c < d[v]:
                d[v] = d[u] + c
                flag = True
        
        if flag and i == n-1 and t == n-1:
            return 'inf'
    
    return -d[n-1]
    

N, M = map(int, sys.stdin.readline().split())
Edges = [None] * M

for i in range(M):
    ai, bi, ci = map(int, sys.stdin.readline().split())
    Edges[i] = (ai-1, bi-1, -ci)
    
ans = Bellmanford(N, Edges, 0)

print(ans)
Problem p03828 (python)

Fixed submission:
def isPrime(n):
	i = 2
	while i*i <= n:
		if n % i == 0:
			return False
		i += 1
	return True

N = 1000
Prime = []

for i in range(2,N):
	if isPrime(i):
		Prime.append(i)
		
dic = {}
for i in Prime:
	dic[i] = 0

p = int(input())
for k in range(2, p+1):
	for i in Prime:
		while k % i == 0:
			k /= i
			dic[i] += 1

ans = 1
for i in Prime:
	ans *= (1+dic[i])

print(ans % 1000000007)

Buggy submission (verdict: Runtime Error):
import sympy as sp
import math as ma
N = int(input())
dic = sp.factorint(ma.factorial(N))
key = list(dic.keys())
ans = 1
for i in range(len(dic)):
    ans *= (1 + dic[key[i]])
print(ans % 1000000007)
Problem p03854 (python)

Fixed submission:
import re

S = input()
x = r"^(dream|dreamer|erase|eraser)*$"

if re.match(x,S):
	print('YES')
else:
	print('NO')

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

while len(S) > 0:
	flag = False
	for d in l:
		if S.endswith(d):
			S = S[:-len(d)]
			flag = True
			break
	if flag = False:
		print('NO')
		exit()
		
print('YES')
Problem p03408 (python)

Fixed submission:
from collections import Counter

arr_b = []
N = int(input())
for i in range(N):
    arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
    arr_r.append(str(input()))

c_b = Counter(arr_b)
c_r = Counter(arr_r)

res = 0
for k_b in c_b.keys():
    if k_b in c_r :
        if res < c_b[k_b] - c_r[k_b]:
            res = c_b[k_b] - c_r[k_b]
    else:
        if res < c_b[k_b]:
            res = c_b[k_b]

print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter

arr_b = []
N = int(input())
for i in range(N):
    arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
    arr_r.append(str(input()))

c_b = Counter(arr_b)
c_r = Counter(arr_r)

res = 0
print(c_b)
print(c_r)

for k_b in c_b.keys():
    if c_r.has_key(k_b):
        if res < c_b[k_b] - c_r[k_b]:
            res = c_b[k_b] - c_r[k_b]
        else:
            if res < c_b[k_b]:
                res = c_b[k_b]

print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter

arr_b = []
N = int(input())
for i in range(N):
    arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
    arr_r.append(str(input()))

c_b = Counter(arr_b)
c_r = Counter(arr_r)

res = 0
for k_b in c_b.keys():
    if k_b in c_r:
        if res < c_b[k_b] - c_r[k_r]:
            res = c_b[k_b] - c_r[k_r]

print(res)
Problem p03501 (python)

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

if int(A) * int(N) > int(B):
  print(B)
else:
  print(int(A) * int(N))

Buggy submission (verdict: Runtime Error):
N, A, B = input().split

if int(A) * int(N) > int(B):
  print(B)
else:
  print(int(A) * int(N))
Problem p03283 (python)

Fixed submission:
N, M, Q = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]
pq = [list(map(int, input().split())) for _ in range(Q)]

table = [[0 for _i in range(N+1)] for _j in range(N+1)]
accum = [[0 for _i in range(N+1)] for _j in range(N+1)]
accum2 = [[0 for _i in range(N+1)] for _j in range(N+1)]

for line in LR:
    table[line[0]][line[1]] += 1
# よこ
for i in range(1, N+1):
    for j in range(1, N+1):
        accum[i][j] = accum[i][j-1] + table[i][j]
# 縦
for i in range(1, N+1):
    for j in range(1, N+1):
        accum2[i][j] = accum2[i-1][j] + accum[i][j]

# for i in range(1, N+1):
#     for j in range(i, N+1):
#         ans[i][j] = sum([accum[k][j] - accum[k][i-1] for k in range(i, j+1)])

for question in pq:
    p = question[0]
    q = question[1]
    print(accum2[q][q] - accum2[p-1][q] - accum2[q][p-1] + accum2[p-1][p-1])

Buggy submission (verdict: Runtime Error):
N, M, Q = map(int, raw_input().split())
for _ in range(M):
LR = [map(int, raw_input().split()) for _ in range(M)]
pq = [map(int, raw_input().split()) for _ in range(Q)]

table = [[0 for _i in range(N+1)] for _j in range(N+1)]
for line in LR:
    table[LR[0]][LR[1]] += 1
for question in pq:
    p = question[0]
    q = question[1]
    ans = 0
    for j in range(p, q+1):
        ans += table[p][j]
    print(ans)
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
print((A-1)*(B-1))
Problem p03288 (python)

Fixed submission:
r = int(input())

if r < 1200:
    print("ABC");
elif r < 2800:
    print("ARC")
else:
    print("AGC")

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

rate = int(input("Enter your rate: "))

if rate < 1200:
    print("ABC")
elif rate >= 1200 and rate < 2800:
    print("ARC")
elif:
    print("AGC")
Problem p03284 (python)

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

print(0 if n%k == 0 else 1)

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

print(0 if n%k == 0 else 1)
Problem p03292 (python)

Fixed submission:
a = list(int(i) for i in input().split())
a.sort()
print(abs(a[0]-a[1]) + abs(a[1]-a[2]))

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv
l = []

for i in range(0,3):
    l.append(int(args[i+1]))
l.sort()
print(abs(l[0]-l[1]) + abs(l[1]-l[2]))
Problem p03294 (python)

Fixed submission:
n = int(input())
a = list(int(i) for i in input().split())

print(sum(a)-n)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = input()
a = list(int(i) for i in input().split())

lcm = lcm_list(a) - 1

out = 0
for i in a:
    out += lcm%i
print(out)
Problem p03339 (python)

Fixed submission:
n = int(input())
s = input()
t = []
x = 0
y = s.count('E')
for ch in s:
    if ch == 'E':
        y -= 1
    t.append(x+y)
    if ch == 'W':
        x += 1
print(min(t))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
t = []
x = 0
y = s.count('E')
for ch in s:
    if ch == 'E':
        y -= 1
    t.append(x+y)
    if ch == 'W:
        x += 1
print(min(t))
Problem p03353 (python)

Fixed submission:
s = input()
k = int(input())
st = set()
for i in range(len(s)):
    j = 1
    while j <= k and i+j <= len(s):
        st.add(s[i:i+j])
        j += 1
for _ in range(k-1):
    m = min(st)
    st = [x for x in st if x != m]
print(min(st))

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
st = set()
for i in range(len(s)):
    for j in range(min(k, len(s)-i)):
        st.add(s[i:i+j])
for _ in range(k-1):
    m = min(st)
    st = [x for x in st if x != m]
print(min(st))

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
st = set()
for i in range(len(s)):
    for j in range(min(k, len(s)-i))
        st.add(s[i:i+j])
for _ in range(k-1):
    m = min(st)
    st = [x for x in st if x != m]
print(min(st))

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
st = set()
for i in range(len(s)):
    for j in range(min(k, len(s)-i+1))
        st.add(s[i:i+j])
for _ in range(k-1):
    m = min(st)
    st = [x for x in st if x != m]
print(min(st))
Problem p03361 (python)

Fixed submission:
h, w = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())
ans = ((i < h-1 and s[i+1][j] == '#') or (i > 0 and s[i-1][j] == '#') or (j > 0 and s[i][j-1] == '#') or (j < w-1 and s[i][j+1] == '#') for i in range(h) for j in range(w) if s[i][j] == '#')
if False in ans:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = []
for _ in range(w):
    s.append(input())
ans = ((i < h-1 and s[i+1][j] == '#') or (i > 0 and s[i-1][j] == '#') or (j > 0 and s[i][j-1] == '#') or (j < w-1 and s[i][j+1] == '#') for i in range(h) for j in range(w) if s[i][j] == '#')
if False in ans:
    print("No")
else:
    print("Yes")
Problem p03362 (python)

Fixed submission:
from math import *
n = int(input())
ps = set(range(2, 55556))
for i in range(2, floor(sqrt(55555) + 1)):
    if i in ps:
        k = 2
        while(i*k <= 55555):
            if i*k in ps:
                ps.remove(i*k)
            k += 1
ans = []
i = 2
while len(ans) < n and i <= 55555:
    if i in ps:
        ans.append(i)
    i += 5
print(*ans)

Buggy submission (verdict: Runtime Error):
from math import *
n = int(input())
ps = set(range(2, 55556))
for i in range(2, frool(sqrt(55555))):
    if i in ps:
        k = 2
        while(i*k <= 55555):
            ps.remove(i*k)
            k += 1
ans = []
i = 2
while len(ans) < n and i <= 55555:
    if i in ps:
        ans.append(i)
    i += 5
print(*ans)
Problem p03377 (python)

Fixed submission:
# coding=utf-8
a, b, x = map(int, input().split())
if a <= x and x<= a+b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ai = max(a)
aj = min(filiter(lambad x: x!=ai, a), key=lambda x: abs(x-ai//2))
print("{} {}".format(ai, aj))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = map(int, input().split())
temp = sorted(zip(x, range(n)))
ans = [None] * n
for i in range(n):
    idx = n//2
    if i >= idx:
        idx -= 1
    ans[temp[i][1]] = temp[idx][0]
for item in ans:
    print(item)

Buggy submission (verdict: Runtime Error):
# coding=utf-8
a, b, x = map(int, input().split())
if a <= x and x<= a+b:
    print(“Yes”)
else:
    print(“No”)
Problem p03380 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ai = max(a)
aj = min((item for item in a if item != ai), key=lambda x: abs(x-ai//2))
print("{} {}".format(ai, aj))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ai = max(a)
aj = min(filiter(lambad x: x!=ai, a), key=lambda x: abs(x-ai//2))
print("{} {}".format(ai, aj))
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
st = list(range(a, min(b+1, a+k))) + list(range(b, max(a-1, b-k), -1))
for i in sorted(set(st)):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input())
st = set(range(a, min(b, a+k)+1)) + set(range(b, max(a, b-k)-1, -1))
for i in sorted(st):
    print(i)
Problem p03353 (python)

Fixed submission:
s = input()
K = int(input())
subs = []
for i in range(0, len(s)):
    for j in range(i+1, K+i+1 if i + K <= len(s) else len(s)+1):
        subs.append(s[i:j])
subs = list(set(subs))
subs.sort()
print(subs[K-1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
subs = []
for i in range(0, len(s)):
    for j in range(i+1, len(s)+1):
        subs.append(s[i:j])
subs = list(set(subs))
subs.sort()
print(subs[K-1])