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

Fixed submission:
S = input()
T = input()

ans = "Yes"
 
for i in range(0,len(S)):
  for j in range(0,i):
    if S[j] == S[i]:
      if T[i] != T[j]:
        ans = "No"
        break
      break
    if T[j] == T[i]:
      if S[j] != S[i]:
        ans = "No"
        break
      break
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

con = 0

ans = "Yes"

for i in range(0,len(S)):
  cutS = S[i+1:]
  cutT = T[i+1:]
  if S[i] in cutS:
    print(S[i],cutS)
    j = cutS.index(S[i]) + (i + 1)
    print(T[i],T[j])
    if T[i] != T[j]:
      ans = "No"
      break
  if T[i] in cutT:
    k = cutT.index(T[i]) + (i + 1)
    if S[i] != S[k]:
      ans = "No"
      break

print(ans)
Problem p03286 (python)

Fixed submission:
Z = int(input())

if Z == 0:
  print(0)

else:
  n = (-2)

  ans = ""

  while abs(Z) >= 1:
    r = Z % n
    if r < 0:
      r = r + 2
    Z = int((Z - r) / n)
    ans += str(r)

  ans = "".join(list(reversed(ans)))


  print(int(ans))

Buggy submission (verdict: Runtime Error):
Z = int(input())
n = (-2)

ans = ""

while abs(Z) >= 1:
  r = Z % n
  if r < 0:
    r = r + 2
  Z = int((Z - r) / n)
  ans += str(r)

ans = "".join(list(reversed(ans)))

print(int(ans))

Buggy submission (verdict: Runtime Error):
Z = int(input())
n = (-2)

ans = ""

while abs(Z) >= 1:
  r = Z % n
  if r < 0:
    r = r + 2
  Z = int((Z - r) / n)
  ans += str(r)
  
print(int(ans))
Problem p03326 (python)

Fixed submission:
import itertools

N,M = map(int,input().split())
value = [0] * N

for i in range(N):
  v = list(map(int,input().split()))
  abv = [i if i > 0 else i * - 1 for i in v]
  value[i] = v

ans = 0
totals = []

for i in range(0,2 ** 3):
  totals = []
  #print(bin(i))
  for v in range(N):
    tmp = 0
    for j in range(0,3):
      if (i >> j) & 1:
        tmp += value[v][j]
      else:
        tmp -= value[v][j]
    totals.append(tmp)
  #print(totals)
  totals = sorted(totals,reverse = True)

  t = 0
  for k in range(M):
    t += totals[k]
  ans = max(ans,t)
  
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

N,M = map(int,input().split())
value = [0] * N

for i in range(N):
  v = list(map(int,input().split()))
  abv = [i if i > 0 else i * - 1 for i in v]
  value[i] = v

ans = 0

for i in list(itertools.combinations(range(0,N),M)):
  a,b,c = value[i[0]],value[i[1]],value[i[2]]
  tmp = 0
  for j in range(3):
    t = a[j] + b[j] + c[j]
    if t < 0:
      t *= -1
    tmp += t
  ans = max(ans,tmp)
  
print(ans)
Problem p03329 (python)

Fixed submission:
N = int(input())
List9 = [9 ** i for i in range(1,7) if 9 ** i <= N]
List6 = [6 ** i for i in range(1,7) if 6 ** i <= N]

def recur(n,con):
  if n == 0:
    return con

  elif n < 6:
    return con + n
    
  elif n < 9:
    return con + (n - 5)

  else:
    max9 = [i for i in List9 if i <= n][-1]
    max6 = [i for i in List6 if i <= n][-1]
    
    return min(recur(n - max9,con + 1),recur(n - max6,con + 1))
    
print(recur(N,0))

Buggy submission (verdict: Runtime Error):
N = int(input())
List9 = [9 ** i for i in range(6) if 9 ** i <= N]
List6 = [6 ** i for i in range(6) if 6 ** i <= N]

def recur(n,con):
  if n == 0:
    return con
    
"""
  elif n < 6:
    return con + n
    
  elif n < 9:
    return con + (n - 5)
"""    

  else:
    max9 = max([i for i in List9 if i <= n])
    max6 = max([i for i in List6 if i <= n])
    
    return min(recur(n - max9,con + 1),recur(n - max6,con + 1))
    
print(recur(N,0))
Problem p02659 (python)

Fixed submission:
a, b = input().split()
a = int(a)
b = round(float(b) * 100)
print(a * b // 100)

Buggy submission (verdict: Runtime Error):
a,b = input().split()
a = round(float(a)*100)
b = int(b)
print(a*b//100)
Problem p02779 (python)

Fixed submission:
already = {}
n = int(input())
a = list(map(int, input().split()))
for x in a:
    if already.get(x):
        print("NO")
        break
    already[x] = True
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
already = [False] * 200000
n = int(input())
a = list(map(int, input().split()))
for x in a:
    if already[x]:
        print("NO")
        break
    already[x] = True
else:
    print("YES")
Problem p03326 (python)

Fixed submission:
import numpy as np
N, M = [int(str) for str in input().strip().split()]
cakes = np.array([[int(str) for str in input().strip().split()] for i in range(N)])

def calc_score(choised_cakes):
    return sum([abs(sum(para)) for para in choised_cakes.T])

signs_list = [[i, j, k] for i in (-1, 1) for j in (-1, 1) for k in (-1, 1)]

score_list = []
for signs in signs_list:
    sscores = np.dot(cakes, np.array(signs).T)
    sort_index = np.argsort(sscores)[::-1]
    sorted_cakes = cakes[sort_index]
    score_list.append(sum(np.dot(sorted_cakes[:M], np.array(signs).T)))

print(max(score_list))

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = [int(str) for str in input().strip().split()]
cakes = np.array([[int(str) for str in input().strip().split()] for i in range(N)])

def calc_score(choised_cakes):
    return sum([abs(sum(para)) for para in choised_cakes.T])

score_list = []
for i in range(3):
    sorted_cakes = cakes[np.argsort(cakes[:, i])]
    for j in range(min(100, N - M)):
        score_list.append(calc_score(sorted_cakes[j : M + j, :]))
        score_list.append(calc_score(sorted_cakes[::-1][j : M + j, :]))

print(max(score_list))
Problem p02659 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b.replace(".",""))
print(a*b//100)

Buggy submission (verdict: Runtime Error):
a,b=map(float,input().split())
b=b.replace(".","")
print(int(a*b/100))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(int(a*b))
Problem p02891 (python)

Fixed submission:
t=input()
s=list(t)
k=int(input())
if s==[s[0]]*len(s):
  print((len(s)*k)//2)
  exit()
b=[1]
for i in range(1,len(s)):
  if s[i-1]==s[i]:b[-1]+=1
  else:b.append(1)
ans=0
for i in b:ans+=i//2*k
if t[0]==t[-1] and (b[0]+b[-1])%2==0:ans+=k-1
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
K=int(input())
flag=False
if S[0]==S[-1]:
    flag=True
cnt=1
A=[]
for i in range(1,len(S)):
    if S[i-1]==S[i]:
        cnt+=1
    else:
        A.append(cnt)
        cnt=1
if cnt>=2:
    A.append(cnt)
ans=0
for a in A:
    ans+=a//2
if flag:
    ans=(ans*K)+((A[0]+A[-1])//2-(A[0]//2+A[-1]//2))*(K-1)
    print(ans)
else:
    ans*=K
    print(ans)
Problem p03137 (python)

Fixed submission:
N,M=map(int,input().split())
X=sorted(list(map(int,input().split())))
Y=[]
for i in range(M-1):
    y=X[i+1]-X[i]
    Y.append(y)
y=sorted(Y)[::-1]
print(sum(y[N-1:]))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
X=sorted(list(map(int,input().split())))
Y=[]
for i in range(M-1):
    y=X[i+1]-X[i]
    Y.append(y)
y=sorted(Y)[::-1]
print(sum(y[N-1]))
Problem p03804 (python)

Fixed submission:
N,M=map(int,input().split())
A=[input() for i in range(N)]
B=[input() for j in range(M)]
for i in range(N-M+1):
    for j in range(N-M+1):
        if A[i][j:j+M]==B[0]:
            if all(A[i+k][j:j+M]==B[k] for k in range(1,M)):
                print("Yes")
                exit()
print("No")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[input() for i in range(N)]
B=[input() for j in range(M)]
for i in range(N):
    for j in range(N-M+1):
        if A[i][j:j+M]==B[0]:
            if all(A[i+k][j:j+M]==B[k] for k in range(1,M)):
                print("Yes")
                exit()
print("No")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[input() for i in range(N)]
B=[input() for j in range(M)]
for i in range(N):
    for j in range(N-M):
        if A[i][j:j+M]==B[0]:
            if all(A[i+k][j:j+M]==B[k] for k in range(1,M)):
                print("Yes")
                exit()
print("No")
Problem p02793 (python)

Fixed submission:
from fractions import gcd

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

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

div = 10**9 + 7
lcm_num = lcm(a)
ans = [lcm_num//ai for ai in a]

print(sum(ans)%div)

Buggy submission (verdict: Runtime Error):
from math import gcd

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

if N == 1:
    print(1)
    exit()

def saisho_ko_baisu(A,B):
    return A*B // gcd(A,B)
#     # A < B
#     x = A*B
#     r = B%A
#     while r!=0:
#         B = A
#         A = r
#         r = B%A
#     return x//A

A.sort(reverse = True)
tmp = saisho_ko_baisu(A[0], A[1])
res = tmp//A[0] + tmp//A[1]
for i in range(2,N):
    if tmp % A[i] != 0:
        new = saisho_ko_baisu(A[i], tmp)
        res *= new//tmp
        tmp = new
    res += tmp // A[i]

print(res % (10**9 + 7))

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

def saisho_ko_baisu(A,B):
    # A < B
    x = A*B
    r = B%A
    while r!=0:
        B = A
        A = r
        r = B%A
    return x//A

A.sort()
tmp = saisho_ko_baisu(A[0], A[1])
for i in range(2,N):
    if tmp % A[i] != 0:
        tmp = saisho_ko_baisu(min([tmp, A[i]]), max([tmp, A[i]]))
res = 0
for a in A:
    res += tmp//a

print(res % (10**9 + 7))
Problem p02679 (python)

Fixed submission:
from math import gcd
from collections import defaultdict

n = int(input())
a, b = [], []
for i in range(n):
    data = list(map(int, input().split()))
    a.append(data[0])
    b.append(data[1])

d = defaultdict(lambda: [0, 0])
zeros = 0

for i in range(n):
    if a[i] * b[i] != 0:
        g = gcd(a[i], b[i])
        a[i] //= g
        b[i] //= g
    if a[i]*b[i] > 0:
        d[(abs(a[i]), abs(b[i]))][0] += 1
    elif a[i]*b[i] < 0:
        d[(abs(b[i]), abs(a[i]))][1] += 1
    elif a[i] == 0 and b[i] != 0:
        d[(0, 1)][0] += 1
    elif b[i] == 0 and a[i] != 0:
        d[(0, 1)][1] += 1
    elif a[i] == b[i] == 0:
        zeros += 1

mod = 1000000007
cnt = 1
for pair in d.values():
    cnt *= pow(2, pair[0], mod) + pow(2, pair[1], mod) - 1
    cnt %= mod
cnt += zeros - 1
cnt %= mod
print(cnt)

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

def sign(a):
    if a == 0:
        return 0
    else:
        return a//abs(a)

n = int(input())
a, b = [], []
for i in range(n):
    data = list(map(int, input().split()))
    a.append(data[0])
    b.append(data[1])

d = defaultdict(lambda: [0, 0])
zeros = 0

for i in range(n):
    g = gcd(a[i], b[i])
    a[i] //= g
    b[i] //= g
    if a[i]*b[i] > 0:
        d[(abs(a[i]), abs(b[i]))][0] += 1
    elif a[i]*b[i] < 0:
        d[(abs(b[i]), abs(a[i]))][1] += 1
    elif a[i] == 0 and b[i] != 0:
        d[(0, 1)][0] += 1
    elif b[i] == 0 and a[i] != 0:
        d[(0, 1)][1] += 1
    elif a[i] == b[i] == 0:
        zeros += 1

mod = 1000000007
cnt = 1
for pair in d.values():
    cnt *= pow(2, pair[0], mod) + pow(2, pair[1], mod) - 1
    cnt %= mod
cnt += zeros - 1
print(cnt)
Problem p02990 (python)

Fixed submission:
import math

def comb(n,r):
    return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))

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

for i in range(1, k+1):
    if n-k < i-1:
        print(0)
    else:
        print(comb(k-1, i-1)*comb(n-k+1, i)%(10**9+7))

Buggy submission (verdict: Runtime Error):
def comb(n,r):
    return math.factorial(n)/(math.factorial(r)*math.factorial(n-r))

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

for i in range(1, k+1):
    if n-k < i-1:
        print(0)
    else:
        print(comb(k-1, i-1)*comb(n-k+1, i)%(10**9+7))

Buggy submission (verdict: Runtime Error):
def comb(n,r):
    return math.factorial(n)/(math.factorial(r)*math.factorial(n-r))

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

for i in range(1, k+1):
    if n-k < i-1:
        print(0)
    else:
        print(comb(k-1, i-1, exact=True)*comb(n-k+1, i, exact=True)%(10**9+7))

Buggy submission (verdict: Runtime Error):
from scipy.special import perm, comb

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


for i in range(1, k+1):
    if n-k < i-1:
        print(0)
    else:
        print(comb(k-1, i-1, exact=True)*comb(n-k+1, i, exact=True)%(10**9+7))
Problem p02753 (python)

Fixed submission:
s = input()
if s == "AAA" or s == "BBB":
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
add_head = ""
add_tail = ""

for _ in range(q):
    query = input().split()
    if query[0] == "1":
        add_head, add_tail = add_tail,add_head
    else:
        if query[1] == "1":
            add_head = query[2] + add_head
        else:
            add_tail = add_tail + query[2]
                
print(add_head[::-1] + s + add_tail)
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a > k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = (int(num) for num in input().split())
a = [int(num) for num in input().split()]
b = [int(num) for num in input().split()]
c = [int(num) for num in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

l = []
for i in range(X):
    if i+1 > K:
        break
    
    for j in range(Y):
        if (i+1) + (j+1) > K:
            break
        
        for k in range(Z):
            if (i+1) + (j+1) + (k+1) > K:
                break
            
            l.append(a[i]+b[j]+c[k])
            
            
l.sort(reverse=True)
for i in range(K):
    print(l[i])

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if max(e-a) > k:
    print(":(")
else:
    print("Yay!")
Problem p02729 (python)

Fixed submission:
n, m = input().split()

n = int(n)
m = int(m)
j = 0
for i in range(1, n):
  j += i
  
for i in range(1, m):
  j += i
  
print(j)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input().split()
 
for i in range(n):
  b = a[:]
  del b[i]
  k = 0
  c = set(b)
  for t in c:
    num = b.count(t)
    for i in range(num):
      k += i
  print(k)
Problem p02753 (python)

Fixed submission:
s = input()

if 'A' in s and 'B' in s:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a8, a10 = input().split(' ')
a8 = int(a8)
a10 = int(a10)
 
value1 = int(a8 / 0.08)
value2 = int(a10 / 0.1)
if int(value1 * 0.1) == a10:
  if value1 > value2:
    print(value1)
  else:
    print(value1)
elif int(value2 * 0.08) == a8:
  if value1 > value2:
    print(value1)
  else:
    print(value1)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a8, a10 = input().split(' ')
a8 = int(a8)
a10 = int(a10)
 
value1 = int(a8 / 0.08)
value2 = int(a10 / 0.1)
if int(value1 * 0.1) == a10:
  print(value1)
elif int(value2 * 0.08 == a8):
  print(value2)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a8, a10 = input().split(' ')
a8 = int(a8)
a10 = int(a10)
 
value1 = int(a8 / 0.08)
value2 = int(a10 / 0.1)
if int(value1 * 0.1) == a10:
  print(value1)
elif int(value2 * 0.08 == a8):
  print(value2)
else:
  print(-1)
Problem p02754 (python)

Fixed submission:
s = input()
n, a, b = s.split(' ')
n = int(n)
a = int(a)
b = int(b)

na = n // (a+b) * a
if n % (a+b) >= a:
  na += a
else:
  na += (n % (a + b))
  
print(na)

Buggy submission (verdict: Runtime Error):
a8, a10 = input().split(' ')
a8 = int(a8)
a10 = int(a10)
 
value1 = int(a8 / 0.08)
value2 = int(a10 / 0.1)

if int(value1 * 0.1) == a10:
  if value1 > value2:
    print(value1)
  else:
    print(value2)
elif int(value2 * 0.08 == a8):
  if value1 > value2:
    print(value1)
  else:
    print(value2)
else:
  print(-1)
Problem p02835 (python)

Fixed submission:
l_s = input().split(' ')
i_s = [int(i) for i in l_s]
a = sum(i_s)
 
if a <= 21:
  print('win')
else:
  print('bust')

Buggy submission (verdict: Runtime Error):
s = input()
l_s = s.split(' ')

a = sum(l_s)

if a <= 21:
  print("win")
else:
  print("bust")
Problem p02699 (python)

Fixed submission:
input_line = input().split(" ")
S = int(input_line[0])
W = int(input_line[1])
if S > W:
  print("safe")
else:
  print("unsafe")

Buggy submission (verdict: Runtime Error):
input_line = input()
S = int(input_line[0])
W = int(input_line[1])
if S > W:
  print("safe")
else:
  print("unsafe")

Buggy submission (verdict: Runtime Error):
input_line = int(input())
S = input_line[0]
W = input_line[1]
if S > W:
  print("safe")
else:
  print("unsafe")
Problem p02725 (python)

Fixed submission:
import numpy as np
K, N = map(int, input().split())
A = np.array(list(map(int, input().split())))
diff = np.append(A[1:] - A[:-1], K + A[0] - A[-1])
print(np.delete(diff, np.argmax(diff)).sum())

Buggy submission (verdict: Runtime Error):
import numpy as np
K, N = map(int, input().split())
A = input().split()
diff = np.append(np.array(A[1:]) - np.array(A[:-1]), K - A[-1])
diff = np.delete(diff, np.argmax(diff))
print(diff.sum())
Problem p02987 (python)

Fixed submission:
import collections

s = input()
c = collections.Counter(s)

flag = 0
for i in range(4):
	word = s[i]
	if c[word] != 2:
		flag = 1
		break
	
if flag == 1:
	print("No")
else :
	print("Yes")

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
if n > k:
	if n+1 >= 2*k:
		for i in range(k):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
			
	else :
		for i in range(n-k+1):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
		for _ in range(2*k -n -1):
			print(0)
else:
	print(1)
	for i in range(n-1):
		print(0)
Problem p02990 (python)

Fixed submission:
import math

n, k = map(int, input().split())
if n > k:
	if n+1 >= 2*k:
		for i in range(k):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
			
	else :
		for i in range(n-k+1):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
		for _ in range(2*k -n -1):
			print(0)
else:
	print(1)
	for i in range(n-1):
		print(0)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
if n > k:
	if n+1 >= 2*k
		for i in range(k):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
			
	else :
		for i in range(n-k+1):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
		for _ in range(2*k -n -1):
			print(0)
else:
	print(1)
	for i in range(n-1):
		print(0)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
if n > k:
	for i in range(k):
		j = i+1
	
		c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
		c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
		comb = c_blue * c_div
	
		print(comb % 1000000007)
		
else:
	print(1)
	for i in range(n-1):
		print(0)

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())

for i in range(k):
	j = i+1

	c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
	c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
	comb = c_blue * c_div
	print(comb % 1000000007)
Problem p03017 (python)

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

if "##" in s[a:c+1] or "##" in s[b:d+1] :
  print("No")
elif c<d:
  print("Yes")
elif "..." in s[b-2:d+1] :#以下 d<c の場合
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
n, a, b, c, d = map(int, input().split())
s = input()

if "##" in s[a:c+1] or "##" in s[b:d+1] :
  print("No")
elif c<d:
  print("Yes")
elif "..." in s[b-2:d] :#以下 d<c の場合
  print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, a, b, c, d = map(int, input().split())
s = input()

if "##" in s[a-1:c] or "##" in s[b-1:d] :
  print("No")
elif c<d:
  print("Yes")
elif "..." in s[b-2:b+3] :#以下 d<c の場合
  print("Yes")
  else:
    print("No")
Problem p03835 (python)

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

for X in range(K+1):
    for Y in range(K+1):
        if (0 <= S-(X+Y)) and (S-(X+Y) <= K) :
            count += 1

print(count)

Buggy submission (verdict: Runtime Error):
K, S = map(int input().split())
count = 0

for X in range(K+1):
    for Y in range(K+1):
        for Z in range(K+1):
            if X+Y+Z == S:
                count += 1

print(count)
Problem p02835 (python)

Fixed submission:
A,B,C=map(int, input().split())
print('bust' if A+B+C >= 22 else 'win')

Buggy submission (verdict: Runtime Error):
A,B,C=map(int, input().split())
print('bust' if A+B+C => 22 else 'win')

Buggy submission (verdict: Runtime Error):
A,B,C=map(int, input().split())
print('bust' if A+B+C => 22 else 'win')
Problem p02682 (python)

Fixed submission:
input = input().split(" ")
a, b, c = int(input[0]), int(input[1]), int(input[2])
k = int(input[3])
totalnum = 0
for nuum in range(4):
    if a>=k: #もしaの枚数がkを上回っていたら
        totalnum+=k
        k=0
        break
    elif a<k and a!=0: #もしaの枚数がkを下回っていたら
        totalnum+=a #totalnumをa分足して
        k-=a #kからaの枚数分引く
        a=0
    elif b>=k: #もしbの枚数がkを上回っていたら
        k=0
        break
    elif b<k and b!=0: #もしbの枚数がkを下回っていたら
        k-=b #bの枚数分だけkから引く。
        b=0
    elif c>=k: #もしcのところまで来たら
        totalnum-=k
        break
print(totalnum)

Buggy submission (verdict: Runtime Error):
input = input()
a, b, c = int(input[0]), int(input[1]), int(input[2])
k = int(input[3])
totalnum = 0
#a→b→cの順番で取ればいい。
for aa in range(k):
  if a != 0:
    a-=1
    totalnum+=1
  elif b != 0:
    b-=1
  elif c != 0:
    c-=1
    totalnum-=1
  else:
    break
print(totalnum)
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
D=[1] * (n + 1)
for _ in range(m):
    D[int(input())] = 0
for i in range(n+1):
    if i > 1:
        D[i] = (D[i-1] + D[i-2]) % 1000000007 * D[i]
print(D[i])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
d=[1]*(n+1)
for i in range(m):
    d[int(input())]=0
for i in range(n+1):
    if i >1:
        d[i]=(d[i-1]+d[i-2])%(10**9+7)*d[i]
print(d[n+1])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
d=[1]*(n+1)
for i in range(m):
    d[int(input())]=0
for i in range(n+1):
    if i >1:
        d[i]=(d[i-1]+d[i-2]%(10**9+7))*d[i]
print(d[n+1])
Problem p03033 (python)

Fixed submission:
import sys
from heapq import heappush, heappop
n,q=map(int,input().split())
a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True)
heap=[]
ans=[]
for i in range(q):
  d=int(input())
  while a and a[-1][0]<=d:
    e=a.pop()
    heappush(heap,(e[2],e[1]))
  while heap and heap[0][1]<=d:
    heappop(heap)
  if heap:
    ans.append(heap[0][0])
  else:
    ans.append(-1)

print(*ans, sep='\n')

Buggy submission (verdict: Runtime Error):
import sys
from heapq import heappush, heappop
n,q=map(int,input().split())
a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True)
heap=[]
ans=[]
z=list(map(int,sys.stdin))
for d in z:
  d=int(input())
  while a and a[-1][0]<=d:
    e=a.pop()
    heappush(heap,(e[2],e[1]))
  while heap and heap[0][1]<=d:
    heappop(heap)
  if heap:
    ans.append(heap[0][0])
  else:
    ans.append(-1)

print(*ans, sep='\n')