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

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

Buggy submission (verdict: Runtime Error):
def all_divisor(n):
  small = [1]
  large = [n]
  for i in range(2, int(n ** 0.5)+1):
    if n % i == 0:
      small.append(i)
      large.append(n//i)
  large.reverse()
  divisor = small + large
  return divisor


n = int(input())
n_divisor = all_divisor(n)
ans = 0
for i in n_divisor:
  mini_ans = (n - i) // i
  if i >= mini_ans:
    break
  ans += mini_ans 
print(ans)
Problem p03062 (python)

Fixed submission:
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
i = bisect.bisect_left(a,0)
if i % 2 == 0:
    ans = abs(sum(a[:i]))+sum(a[i:])
else:
    if i == n:
        ans = abs(sum(a[:i-1]))+a[i-1]
    else:
        ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
i = bisect.bisect_left(a,0)
if i % 2 == 0:
    ans = abs(sum(a[:i]))+sum(a[i:])
else:
    if i == n:
        ans = abs(sum(a[:i])+a[i])
    else:
        ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
a = list(map(int, input().split()))
a.sort()
i = bisect.bisect_left(a,0)
if i % 2 == 0:
    ans = abs(sum(a[:i]))+sum(a[i:])
else:
    ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i,j in enumerate(a):
  if j >= 0:
    if i % 2 == 0:
      ans = abs(sum(a[:i]))+sum(a[i:])
      break
    else:
      ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
      break
print(ans)
Problem p03095 (python)

Fixed submission:
mod = 10 ** 9 + 7
n = int(input())
s = input()
a = [0]*26
ans = 1
for i in s:
  a[ord(i)-ord("a")] += 1
for i in a:
  ans = (ans * (i+1)) % mod
print(ans-1)

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

def main():
  n = int(input())
  a = [[] for row in range(200000)]
  C = [int(input()) for i in range(n)]
  b = 0
  d = [0]
  mod = 10 ** 9 + 7
  mini_ans = 0
  for i,c in enumerate(C):
    if b != c:
      for j in a[c]:
        mini_ans += (d[j] + 1) % mod
      a[c].append(i)
    d.append(mini_ans % mod)
    b = c
  print(d[-1]+1)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [[] for row in range(200000)]
b = 0
e = [int(input()) for i in range(n)]
d = [0]
mini_ans = 0
for i,c in enumerate(e):
  if b != c:
    for j in a[c]:
      mini_ans += d[j] + 1
    a[c].append(i)
  d.append(mini_ans)
  b = c
print(d[-1]+1)
Problem p03110 (python)

Fixed submission:
n = int(input())
btc = 0
jpy = 0
for i in range(n):
  a,b = input().split()
  if b == "BTC":
    btc += float(a)
  else:
    jpy += int(a)
print(jpy+btc*380000)

Buggy submission (verdict: Runtime Error):
n = int(input())
btc = 0
jpy = 0
for i in range(n):
  a,b = input().split()
  if b = "BTC":
    btc += float(a)
  else:
    jpy += int(a)
print(jpy+btc*380000)
Problem p03129 (python)

Fixed submission:
a,b = map(int, input().split())
if b * 2 - 1 <= a:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
k,a,b = map(int, input().split())
if b - a <= 2:
  print(k + 1)
else:
  yen = 0
  if k >= a + 1:
    yen += 1
    k -= a + 1
    c,d = divmod(k,2)
    yen += c
    print(a + (b-a) * yen + d)
  else:
    print(k + 1)
Problem p03200 (python)

Fixed submission:
s = list(input())
ans = 0
w = 0
for i,j in enumerate(s):
  if j == "W":
    ans += (i - w)
    w += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 1
b = 0
c = []
for i in a:
  if i > b:
    for j in range(i-b):
      c.append(0)
  else:
    c[i-1] += 1
    c = c[:i]
    if c[i-1] >= ans:
      ans += 1
  b = i    
print(ans)
Problem p03211 (python)

Fixed submission:
n = input()
a = [int(n[i:i+3]) for i in range(len(n)-2)]
ans = abs(a[0]-753)
for i in a:
  b = abs(i-753)
  if b < ans:
    ans = b
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
a = [int(n[i:i+3]) for i in range(len(n)-3)]
ans = abs(a[0]-753)
for i in a:
  b = abs(a[i]-753)
  if b < ans:
    ans = b
print(ans)
Problem p03213 (python)

Fixed submission:
n = int(input())
prime_list = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
d = []
e = [0,0,0,0,0]
f = [74,24,14,4,2]
for i in prime_list:
  a = n
  b = 0
  c = 1
  while a // (i**c) > 0:
    b += a // (i**c)
    c += 1
  else:
    d.append(b)
count = 0
len_d = len(d)-1
for k in f:
  for i,j in enumerate(d):
    if j < k:
      e[count] = i
      count += 1
      break
    elif i == len_d:
      e[count] = i+1
      count += 1
      break



print(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))

Buggy submission (verdict: Runtime Error):
n = int(input())
d = []
e = [0,0,0,0,0]
f = [74,24,14,4,2]
for i in prime_list:
  a = n
  b = 0
  c = 1
  while a // (i**c) > 0:
    b += a // (i**c)
    c += 1
  else:
    d.append(b)
count = 0
len_d = len(d)-1
for k in f:
  for i,j in enumerate(d):
    if j < k:
      e[count] = i
      count += 1
      break
    elif i == len_d:
      e[count] = i+1
      count += 1
      break


print(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))

Buggy submission (verdict: Runtime Error):
d = []
e = [0,0,0,0,0]
f = [74,24,14,4,2]
for i in prime_list:
  a = n
  b = 0
  c = 1
  while a // (i**c) > 0:
    b += a // (i**c)
    c += 1
  else:
    d.append(b)
count = 0
len_d = len(d)-1
for k in f:
  for i,j in enumerate(d):
    if j < k:
      e[count] = i
      count += 1
      break
    elif i == len_d:
      e[count] = i+1
      count += 1
      break


print(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
	print("Hello World")
elif n == 2:
	a = int(input())
	b = int(input())
	print(a+b)

Buggy submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
	a, b = map(int,input().split())
	mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
k = 0
for j in sortedDict:
	k += 1
	if j[1] <= t:
		print(j[0])
		break
	if k == len(sortedDict):
		print("TLE")
		break

Buggy submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
	a, b = map(int,input().split())
	mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
k = 0
for j in sortedDict:
	k += 1
	if j[1] <= t:
		print(j[0])
		break
	if k == len(sortedDict):
		print("TLE")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
	print("Hello World")
elif n == 2:
	a = int(input())
    b = int(input())
    print(a+b)
Problem p03239 (python)

Fixed submission:
n,t = map(int, input().split())
a = []
b = 0
for i in range(n):
  l = list(map(int, input().split()))
  a.append(l)
a.sort()
for i in range(n):
  if a[i][1] <= t:
    b = a[i][0]
    break
if b > 0:
  print(b)
else:
  print("TLE")

Buggy submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
	a, b = map(int,input().split())
	mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
k = 0
for j in sortedDict:
	k += 1
	if j[1] <= t:
		print(j[0])
        break
	if k == len(sortedDict):
		print("TLE")

Buggy submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
  a, b = map(int,input().split())
  mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
k = 0
for j in sortedDict:
  k += 1
  if j[1] <= t:
    print(j[0])
    break
  if k == len(sortedDict):
  	print("TLE")
	break

Buggy submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
  a, b = map(int,input().split())
  mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
print(sortedDict)
k = 0
for j in sortedDict:
  k += 1
  if j[1] <= t:
    print(j[0])
    break
  if k == len(sortedDict):
  	print("TLE")
    break
Problem p03244 (python)

Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int,input().split()))
even1 = v[0::2]
odd1 = v[1::2]
even2 = Counter(even1)
odd2 = Counter(odd1)
a = even2.most_common()[0][0]
b = odd2.most_common()[0][0]
c = even2.most_common()[0][1]
d = odd2.most_common()[0][1]
if a != b:
 print(len(even1)-c+len(odd1)-d)
else:
 if len(list(set(even1))) == 1 and len(list(set(odd1))) == 1:
  print(len(even1))
 elif len(list(set(even1))) == 1:
  print(len(odd1)-odd2.most_common()[1][1])
 elif len(list(set(odd1))) == 1:
  print(len(even1)-even2.most_common()[1][1])
 else:
  e = even2.most_common()[1][1]
  f = odd2.most_common()[1][1]
  if c-e >= d-f:
   print(len(even1)*2-c-f)
  else:
   print(len(even1)*2-d-e)

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

n = int(input())
v = list(map(int,input().split()))
even1 = v[0::2]
odd1 = v[1::2]
even2 = Counter(v1)
odd2 = Counter(v2)
a = even2.most_common()[0][0]
b = odd2.most_common()[0][0]
c = even2.most_common()[0][1]
d = odd2.most_common()[0][1]
if a != b:
 print(len(even1)-c+len(odd1)-d)
else:
 if len(list(set(even1))) == 1 and len(list(set(odd1))) == 1:
  print(len(even1))

 else:
  if c <= d:
   print(len(even1)*2-d-even2.most_common()[1][1])
  else:
   print(len(even1)*2-c-odd2.most_common()[1][1])
Problem p03251 (python)

Fixed submission:
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split())) 
set1 = set()
set2 = set()
c = 0
maxa = max(a)
minb = min(b)
if maxa < minb:
  for i in range(maxa+1,minb+1):
    set1.add(i)
if x < y:
  for i in range(x+1,y+1):
    set2.add(i)
set3 = set1 & set2
if len(set3) >= 1:
  print("No War")
else:
  print("War")

Buggy submission (verdict: Runtime Error):
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
a.sort()
b.sort()
if a[len(a)-1] < b[0]:
 for i in range(a[len(a),b]):
  if i > x and i <= y:
   c = 1
   break
if c == 1:
 print("No war")
else:
 print("War")
Problem p03260 (python)

Fixed submission:
a, b = map(int, input().split())
print("Yes") if a % 2 != 0 and b % 2 != 0 else print("No")

Buggy submission (verdict: Runtime Error):
a, b = input().split()
print("Yes") if a % 2 != 0 and b % 2 != 0 else print("No")
Problem p03263 (python)

Fixed submission:
def move(moves):
  b = []
  for (y1,x1),(y2,x2) in zip(moves[:-1],moves[1:]):
    b.append((y1,x1,y2,x2))
  return b

h,w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
now = 0
moves = []
ans = []
for y,coins in enumerate(a,1):
  if y % 2:
    for x,coin in enumerate(coins,1):
      if now:
        moves.append((y,x))
        if coin % 2:
          b = move(moves)
          ans += b
          moves = []
          now = 0
      else:
        if coin % 2:
          moves.append((y,x))
          now = 1
  else:
    for x,coin in enumerate(coins[::-1]):
      x = w - x
      if now:
        moves.append((y,x))
        if coin % 2:
          b = move(moves)
          ans += b
          moves = []
          now = 0
      else:
        if coin % 2:
          moves.append((y,x))
          now = 1
print(len(ans))
for i in ans:
  print(*i)

Buggy submission (verdict: Runtime Error):
def move(x1, y1, x2, y2):
  number = abs(x1-x2)+abs(y1-y2)
  result = []
  while x1 > x2:
    result.append([x1, y1, x1-1, y1])
    x1 -= 1
  while x1 < x2:
    result.append([x1, y1, x1+1, y1])
    x1 += 1
  while y1 > y2:
    result.append([x1, y1, x1, y1-1])
    y1 -= 1
  while y1 < y2:
    result.append([x1, y1, x1, y1+1])
    y1 += 1
  return number, result


H,W = map(int, input().split())
a = [[j%2 for j in range(w)] for i in range(h)]
b = 0
x1, y1 = 0,0
n = 0
moved = []
for x,i in enumerate(a):
  x += 1
  for y,j in enumerate(i):
    y += 1
    if j:
      if b:
        d = move(x1,y1,x,y)
        n += d[0]
        moved += d[1]
        b = 0
      else:
        x1, y1 = x,y
        b = 1
print(n)        
for i in moved:
  print(*i)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
for i,j in enumerate(s):
  if j == "1":
    if (i+1) == k:
      print("1")
      break
  else:
    print(j)
    break

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
for i,j in enumerate(s):
  if j == "1"
    if (i+1) == k:
      print(j)
      break
  else:
    print(j)
    break
Problem p03284 (python)

Fixed submission:
import math
n,k = map(int, input().split())
print(math.ceil(n/k)-n//k)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = "No"
for i in range(n // 7 + 1):
  if (n - i*7) % 4 == 0:
    ans = "Yes"
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = "No"
for i in range(n // 7 + 1):
  if (n - i*7) % 4 == 0:
    ans == "Yes"
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = "No"
for i in range(n // 7 + 1):
  if (n - i*7) % 4 == 0:
    ans == "Yes"
print(ans)
Problem p03288 (python)

Fixed submission:
n = int(input())
if n >= 2800:
  print("AGC")
elif n >= 1200:
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
s = input()
mod = 10**9 + 7
abc = 0
bc = 0
c = 0
q = 0
for i in s[::-1]:
  elif i == "A":
    abc = (abc + bc) % mod
  elif i == "B":
    bc = (bc + c) % mod
  elif i == "C":
    c = (3**q+c) % mod
  elif i == "?":
    abc = (abc*3 + bc) % mod
    bc = (bc*3 + c) % mod 
    c = (3**q + c*3) % mod
    q += 1
print(abc)
Problem p03289 (python)

Fixed submission:
s = input()
if s[0] == "A" and s[2:-1].count("C") == 1:
  index_C = s.find("C")
  if s[1:index_C].islower() and s[index_C+1:].islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] == "A" and s[2:-1].count("C") == 1:
  s[s[2:-1].find("C")] = c
  if s[1:].islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")
Problem p03304 (python)

Fixed submission:
def con(n,d):
  if d == 0:
    return 1 / n
  else:
    return (n - d) * 2 / (n ** 2)

n,m,d = map(int, input().split())
beauty = con(n,d) * (m - 1)
print(beauty)

Buggy submission (verdict: Runtime Error):
def con(n,d):
  if d == 0:
    return n
  else:
    return (n - d) * 2

n,m,d = map(int, input().split())
beauty_sum = pow(con(n,d),m-1) * (m - 1)
print(beauty_sum / pow(n,m))
Problem p03316 (python)

Fixed submission:
n = input()
sn = sum([int(i) for i in list(n)])
n = int(n)
if n % sn == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
sn = sum(list(map(int, n.split())))
if n % sn == 0:
  print("Yes")
else:
  print("No")
Problem p03323 (python)

Fixed submission:
a, b = map(int, input().split())
print("Yay!") if a <= 8 and b <= 8 else print(":(")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print("Yay!") if a <= 8 and b <= 8 else print(":(
")

Buggy submission (verdict: Runtime Error):
a, b = int(input())
print("Yay!") if a <= 8 and b <= 8 else print(":(
")
Problem p03338 (python)

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(1,n):
  a = set([j for j in s[:i]])
  b = set([k for k in s[i:]])
  c = a & b
  d = len(c)
  if d > ans:
    ans = d    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
t = 0
for i in range(len(s)-1):
  a = {s[:i]} 
  b = {s[i+1:]}
  c = a & b
  print(c)
  if c > t:
    t = c

print(c)
Problem p03339 (python)

Fixed submission:
n = int(input())
s = input()
ans = s[1:].count("E")
a = ans
for i in range(n-1):
  if s[i] == "W":
    a += 1
  if s[i+1] == "E":
    a -= 1
  if a < ans:
    ans = a
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = s[1:].count("E")
a = ans
for i in range(n-1):
  if s[i] == "W"
    a += 1
  if s[i+1] == "E"
    a -= 1
  if a < ans:
    ans = a
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
str = s[1:]
a = 0
for i in str:
  if i == "E":
    a += 1
b = a

for i in range(len(n)):
  if str[i] == "w":
  	if str[i+1] == "E":
      continue
    else:
      a += 1 
  else:
    if str[i+1] == "E"
      a -= 1
      if b > a:
        a = b
    else:
      continue
      
print(b)
Problem p03353 (python)

Fixed submission:
s = input()
k = int(input())
c = len(s)
d = 0
a = []
if c < 5:
  d = c
else:
  d = 5
for i in range(d):
  b = [s[j:i+j+1] for j in range(c-i)]
  b = list(set(b))
  a = a + b
a.sort()
print(a[k-1])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
c = len(s)
a = []
for i in range(5):
  b = [s[j:i+j+1] for j in range(c-i-1)]
  b = list(set(b))
  a = a + b
a.sort()
print(a[k-1])
Problem p03354 (python)

Fixed submission:
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]
    
    def all_group_members(self):
        return_list = [list() for i in range(n)]
        for i in range(n):
          return_list[self.find(i)].append(i)
        return return_list
      
      
n,m = map(int, input().split())
p = [x-1 for x in list(map(int, input().split()))]
key = dict()
for k,v in enumerate(p):
  key[v] = k
Union = UnionFind(n)
xy = [list(map(int, input().split())) for i in range(m)]
for x,y in xy:
  Union.union(x-1,y-1)
a = Union.all_group_members()
ans = 0
for i in a:
  x = set()
  for j in i:
    x.add(key[j])
  y = set(i)
  ans += len(x & y)
print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

      
n,m = map(int, input().split())
p = [x-1 for x in list(map(int, input().split()))]
key = dict()
for k,v in enumerate(p):
  key[v] = k
Union = UnionFind(n)
xy = [list(map(int, input().split())) for i in range(m)]
for x,y in range(xy):
  Union.union(x-1,y-1)
a = Union.all_group_members()
ans = 0
for i in a.values():
  x = set()
  for j in i:
    x.add(key[j])
  y = set(i)
  ans += len(x & y)
print(ans)
Problem p03371 (python)

Fixed submission:
a,b,c,x,y = map(int, input().split())
mx = a if x >= y else b
if c * 2 <= (a+b):
  if c * 2 <= mx:
    print((min(x,y)+abs(x-y))*c*2)
  else:
    print(min(x,y)*c*2+abs(x-y)*mx)
else:
  print(a*x+b*y)

Buggy submission (verdict: Runtime Error):
a,b,c,x,y = map(int, input().split())
mx = a if x >= y else b
if c * 2 <= (a+b):
  if c * 2 <= mx:
    print((min(x,y)+abs(x-y))*c*2)
  else:
    print(min(x,y)*c*2+ans(x-y)*mx)
else:
  print(a*x+b*y)
Problem p03379 (python)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
for i in x:
  if i > y[n//2-1]:
    print(y[n//2-1])
  else:
    print(y[n//2])

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
for i in x:
  if i > y[n/2-1]:
    print(y[n/2-1])
  else:
    print(y[n/2])
Problem p03385 (python)

Fixed submission:
s = input()
if s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
a = ["abc","acb","bac","bca","cab","cba"]
print["No","Yes"][s in a]

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
A, B, C = sorted([a, b, c])
if (B - A) % 2 == (C - A) % 2 == 0:
    print((C - A) // 2 + (C - B) // 2)
else:
    print((C - A) // 2 + (C - B) // 2 + 2)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
for x in range(a,b):
  if x < a + k  or x > b - k:
    print(x)
  else:
    continue

Buggy submission (verdict: Runtime Error):
s = input
if s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1:
  print("Yes")
else:
  print("No")
Problem p03386 (python)

Fixed submission:
a, b, k= map(int, input().split())
for x in range(a,min(a+k,b+1)):
    print(x)
for x in range(b-k+1,b+1):
    if x < a+k:
        continue
    else:
        print(x)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, raw_input().split())
for x in range(a,b):
  if x < a + k  or x > b - k:
    print(x)
  else:
    continue
Problem p03393 (python)

Fixed submission:
a={chr(i) for i in range(ord("a"),ord("a")+26)}
s=input()
n=len(s)
if n<26:
  print(s+sorted(a-set(s))[0])
else:
  for i in range(2,27):
    if s[-i]<s[-i+1]:
      break
    if i==26:
      print(-1)
      exit()
  for j in sorted(s[-i+1:]):
    if j>s[-i]:break
  print(s[:-i]+j)

Buggy submission (verdict: Runtime Error):
a={chr(i) for i in range(ord(a),ord(a)+25)}
s=input()
n=len(s)
if n<26:
  print(s+sorted(a-set(s))[0])
else:
  for i in range(2,27):
    if s[-i]<s[-i+1]:
      break
    if i==26:
      print(-1)
      exit()
  for j in sorted(s[-i+1:]):
    if j>s[-i]:break
  print(s[:-i]+j)
Problem p03424 (python)

Fixed submission:
n = int(input())
s = list(input().split())
if any(i == "Y" for i in s):
  print("Four")
else:
  print("Three")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input().split())
if any(i === "Y" for i in s):
  print("Four")
else:
  print("Three")
Problem p03437 (python)

Fixed submission:
x,y = map(int, input().split())
if x % y == 0:
  print(-1)
else:
  print(x)

Buggy submission (verdict: Runtime Error):
import sys

n = int(input())
l = 0
r = n-1
mid = r // 2
re = [None] * n
print(0, flush=True)
re[0] = input()
if re[0] == "Vacant":
  sys.exit()
print(mid, flush=True)
re[mid] = input()
while re[mid] != "Vacant":
  if re[l] == re[mid]:
    if (mid - l) % 2:
      r = mid
    else:
      l = mid
  else:
    if (mid - l) % 2:
      l = mid
    else:
      r = mid
  mid = (l + r) // 2
  print(mid, flush=True)
  re[mid] = input()
else:
  sys.exit()