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

Fixed submission:
import copy
S_dash = input()
T = input()

len_S = len(S_dash)
len_T = len(T)

candidate0 = list(S_dash)


ans = "z"*51

if len_S >= len_T:
  for s in range(len_S):
    cha_S = S_dash[s]
    if cha_S != "?" and cha_S in list(T):
      for t in range(len_T):
        cha_T = T[t]
        if cha_S == cha_T and 0<= s-t < len_S and  0< s-t+len_T <= len_S:
          S_cut = S_dash[s-t:s-t+len_T]
          candidate1 = copy.deepcopy(candidate0)
          for x in range(len_T):
            if S_cut[x] == "?":
              candidate1[s-t+x] = T[x]
            elif  S_cut[x] != T[x]:
              break
          else:
            if "".join(candidate1[s-t:s-t+len_T]) == T:
              if ans > "".join(candidate1).replace('?', 'a'):
                ans = "".join(candidate1).replace('?', 'a')
  
  
  
  for u in range(len_S-len_T+1):
    cut_S = S_dash[u:u+len_T]
    if cut_S.count("?") == len_T:
      candidate1 = copy.deepcopy(candidate0)
      for t in range(len_T):
        candidate1[u+t] = T[t]
      if ans > "".join(candidate1).replace('?', 'a'):
        ans = "".join(candidate1).replace('?', 'a')
                
if ans == "z"*51:
  ans = "UNRESTORABLE"
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
S_dash = input()
T = input()

len_S = len(S_dash)
len_T = len(T)

candidate0 = list(S_dash)


ans = "z"*51

if len_S >= len_T:
  for s in range(len_S):
    cha_S = S_dash[s]
    if cha_S != "?" and cha_S in list(T):
      for t in range(len_T):
        cha_T = T[t]
        if cha_S == cha_T:
          S_cut = S_dash[s-t:s-t+len_T]
          
          candidate1 = copy.deepcopy(candidate0)
          
          for x in range(len_T):
            if S_cut[x] == "?":
              candidate1[s-t+x] = T[x]
            elif  S_cut[x] != T[x]:
              break
          
          else:
            if candidate1[s-t:s-t+len_T].count("?") == 0:
              if ans > "".join(candidate1).replace('?', 'a'):
                ans = "".join(candidate1).replace('?', 'a')
                
if ans == "z"*51:
  ans = "UNRESTORABLE"
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
S_dash = input()
T = input()

len_S = len(S_dash)
len_T = len(T)

candidate0 = list(S_dash)


ans = "z"*51

if len_S >= len_T:
  for s in range(len_S):
    cha_S = S_dash[s]
    if cha_S != "?" and cha_S in list(T):
      for t in range(len_T):
        cha_T = T[t]
        if cha_S == cha_T:
          S_cut = S_dash[s-t:s-t+len_T]
          
          candidate1 = copy.deepcopy(candidate0)
          
          for x in range(len_T):
            if S_cut[x] == "?":
              candidate1[s-t+x] = T[x]
            elif  S_cut[x] != T[x]:
              break
          
          else:
            if candidate1[s-t:s-t+len_T].count("?") == 0:
              if ans > "".join(candidate1).replace('?', 'a'):
                ans = "".join(candidate1).replace('?', 'a')
                
if ans = "z"*51:
  ans = "UNRESTORABLE"
print(ans)
Problem p03567 (python)

Fixed submission:
S = input()


ans =0
for i in range((len(S)-1)):
  if (S[i] == "A") and (S[i+1] =="C"):
    ans = 1
if ans == 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
ans =0
for i in (len(S)-1):
  if (S[i] == "A") and (S[i+1] =="C"):
    ans = 1
if ans == 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
ans =0
for i in (len(S)-1):
  if (S[i] == "A") and (S[i+1] =="C"):
    ans = 1

if ans ==1:
  print("Yes")
else:
  print("No")
Problem p03719 (python)

Fixed submission:
A, B, C = map(int,input().split())
 
flag = False
 
if A <= C:
  if B>= C:
    flag = True

if flag == True:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int,input(),split())
 
flag = False
 
if A <= C:
  if B>= C:
    flag = True

if flag == True:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int,input(),split())

flag = False

if A <= C:
  if B>= C:
    flag = True

if flag == True:
  print("Yes")
else:
  print("No")
Problem p03760 (python)

Fixed submission:
O = list(input())
E = list(input())
ans =[]

if len(O)>len(E):
  for i in range(len(E)):
    ans.append(O[i])
    ans.append(E[i])
  ans.append(O[-1])
  print("".join(ans))
else:
  for i in range(len(E)):
    ans.append(O[i])
    ans.append(E[i])
  print("".join(ans))

Buggy submission (verdict: Runtime Error):
O = list(input())
E = list(input())
ans =[]
for i in range(len(O)):
  ans.append(O[i])
  ans.append(E[i])
print("".join(ans))
Problem p03777 (python)

Fixed submission:
a, b = map(str,input().split())

if a == b:
  print("H")
else:
  print("D")

Buggy submission (verdict: Runtime Error):
W, a, b = map(int,input().split())
 
if a+W<=b:
  print(b-(a+W))
elif (a<= b)and (b<(a+W)):
  print(b-a)
elif (a<=b+W) and(b+W<a+W):
  print(a-b)
elif (b+W)<a:
  print(a-(b+W))
Problem p03778 (python)

Fixed submission:
W, a, b = map(int,input().split())
 
if (a+W)<=b:
  print(b-(a+W))
elif (a<= b)and (b<(a+W)):
  print(0)
elif ((a-W)<=b) and(b<a):
  print(0)
elif b<(a-W):
  print(a-(b+W))

Buggy submission (verdict: Runtime Error):
W, a, b = map(int,input().split())
 
if a+W<=b:
  print(b-(a+W))
elif (a<= b)and (b<(a+W)):
  print(b-a)
elif ((a-W)<=b) and(b<a):
  print(a-b)
elif (b<(a-W):
  print(a-(b+W))
Problem p03813 (python)

Fixed submission:
X = int(input())
if X < 1200:
  print("ABC")
else:
  print("ARC")

Buggy submission (verdict: Runtime Error):
X = int(input())
if x < 1200:
  print("ABC")
else:
  print("ARC")
Problem p03854 (python)

Fixed submission:
S =input()
ls_S = list(S)
ans = "YES"

while len(ls_S) != 0:
  if "".join(ls_S[len(ls_S)-5:]) == "dream":
    ls_S = ls_S[:len(ls_S)-5]
  elif "".join(ls_S[len(ls_S)-5:]) == "erase":
    ls_S = ls_S[:len(ls_S)-5]
  elif "".join(ls_S[len(ls_S)-7:]) == "dreamer":
    ls_S = ls_S[:len(ls_S)-7] 
  elif "".join(ls_S[len(ls_S)-6:]) == "eraser":
    ls_S = ls_S[:len(ls_S)-6]
  else:
    ans = "NO"
    break
print(ans)

Buggy submission (verdict: Runtime Error):
S =input()
ls_S = list(S)
ans = "Yes"

while len(ls_S) != 0:
  print(ls_S)
  if "".join(ls_S[len(ls_S)-5:]) == "dream":
    ls_S = ls_S[:len(ls_S)-5]
  elif "".join(ls_S[len(ls_S)-5:]) == "erase":
    ls_S = ls_S[:len(ls_S)-5]
  elif "".join(ls_S[len(ls_S)-7:]) == "dreamer":
    ls_S = ls_S[:len(ls_S)-7] 
  elif "".join(ls_S[len(ls_S)-6:]) == "eraser":
    ls_S = ls_S[:len(ls_S)-6]
  else:
    ans = "No"
    break
print(ans)
Problem p04043 (python)

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

list_a = list(a)
list_a.sort()
if list_a == [5, 5, 7]:
  print("YES")
else:
  print("NO")

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

if set(a) == set(5,5,7):
  print("YES")
else:
  print("NO")
Problem p02573 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)
n, m = map(int, input().split())

friend = [set() for i in range(n)]

for i in range(m):
  a = list(map(int, input().split()))
  a.sort()
  x, y = a[0]-1,a[1]-1
  friend[x].add(y)
  friend[y].add(x)

def dfs(s):
  if vis[s] == False:
    vis[s] = True
    ary.append(s)
    for j in friend[s]:
      dfs(j)
vis = [False for i in range(n)]
ans = 0
for i in range(n):
  ary = []
  dfs(i)
  ans = max(ans,len(ary))
print (ans)

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

friend = [set() for i in range(n)]

for i in range(m):
  a = list(map(int, input().split()))
  a.sort()
  x, y = a[0]-1,a[1]-1
  friend[x].add(y)
  friend[y].add(x)

def dfs(s):
  if vis[s] == False:
    vis[s] = True
    ary.append(s)
    for j in friend[s]:
      dfs(j)
vis = [False for i in range(n)]
ans = 0
for i in range(n):
  ary = []
  dfs(i)
  ans = max(ans,len(ary))
print (ans)
Problem p02787 (python)

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

inf = 10**9
magic = []
c = 0
for i in range(n):
	a, b = map(int, input().split())
	magic.append([a,b])
	c = max(c,a)

dp = [inf] * (h+c)

for i, j in magic:
	dp[i] = min(dp[i],j)

for i in range(len(dp)):
	for j in range(n):
		if i - magic[j][0] <= 0 or dp[i-magic[j][0]] == inf:
			continue
		else:
			dp[i] = min(dp[i],dp[i-magic[j][0]] + magic[j][1])

print (min(dp[h:]))

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

dp = [10**7 for i in range(h+100)]
dp[0] = 0
magic = []
for i in range(n):
	a, b = map(int, input().split())
	magic.append([a,b])
	dp[a] = b
#print (dp)


for i in range(h+100):
	for j in range(n):
		if i - magic[j][0] <= 0 or dp[i-magic[j][0]] == 10**7:
			continue
		else:
			dp[i] = min(dp[i],dp[i-magic[j][0]] + magic[j][1])

if dp[h] == 10**7:
	for i in dp[h:]:
		if i != 10**7:
			ans = i
			break
	print (ans)
else:
	print (dp[h])
Problem p02658 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
ans = 1
if 0 in a:
	print(0)
	exit()
for i in range(n):
	ans *= a[i]
	if ans > 10 ** 18:
		print(-1)
		exit()
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
ans = 1
if 0 in a:
	print(0)
	exit()
for i in range(n):
	ans += a[i]
	if ans > 10 ** 18:
		print(-1)
		exit()
print(ans)n = int(input())
a = [int(i) for i in input().split()]
ans = 1
if 0 in a:
	print(0)
	exit()
for i in range(n):
	ans += a[i]
	if ans > 10 ** 18:
		print(-1)
		exit()
print(ans)
Problem p02641 (python)

Fixed submission:
targ, length = map(int, input().split(' '))

banned = [False] * 100

bans = input()
if bans != '':
    for ban in bans.split(' '):
        banned[int(ban) - 1] = True

for dist in range(100):
    if targ - dist > 0:
        if not banned[targ - dist - 1]:
            print(targ - dist)
            exit()
    else:
        print(targ - dist)
        exit()
    if targ + dist <= 100:
        if not banned[targ + dist - 1]:
            print(targ + dist)
            exit()
    else:
        print(targ + dist)
        exit()

Buggy submission (verdict: Runtime Error):
targ, length = map(int, input().split(' '))

banned = [False] * 100

bans = input()
if bans != '':
    for ban in bans.split(' '):
        banned[int(ban) - 1] = True

for dist in range(100):
    if banned[targ - dist - 1]:
        print(targ - dist)
        exit()
    elif banned[targ + dist - 1]:
        print(targ + dist)
        exit()
Problem p02741 (python)

Fixed submission:
num_array = [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
]
print(num_array[int(input()) - 1])

Buggy submission (verdict: Runtime Error):
num_array = [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
]
print(num_array[int(input() - 1)])

Buggy submission (verdict: Runtime Error):
num_array = [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
]
print(num_array[int(input() - 1])
Problem p02765 (python)

Fixed submission:
attend, rate = input().split(' ')
 
if int(attend) >= 10:
  print(rate)
else:
  print(int(rate) + 100 * (10 - int(attend)))

Buggy submission (verdict: Runtime Error):
attend, rate = input()

if int(attend) >= 10:
  print(rate)
else:
  print(int(rate) - 100 * (10 - int(attend)))
Problem p02772 (python)

Fixed submission:
input()
nums = [int(n_str) for n_str in input().split(' ')]

for num in nums:
  if num % 2 == 0:
    if num % 3 != 0 and num % 5 != 0:
      print("DENIED")
      exit()

print("APPROVED")

Buggy submission (verdict: Runtime Error):
input()
nums = [int(n_str) for n_str in input().split(' ')]

for num in nums:
  if num % 2 == 0:
    if num % 3 != 0 and num % 5 != 0:
      print("DENIED")
	  exit()

print("APPROVED")
Problem p02909 (python)

Fixed submission:
tomorrow = {
  'Sunny': 'Cloudy',
  'Cloudy': 'Rainy',
  'Rainy': 'Sunny'
}
print(tomorrow[input()])

Buggy submission (verdict: Runtime Error):
tomorrow = {
  'Sunny': 'Cloudy',
  'Cloudy': 'Rainy',
  'Rainy': 'Sunny'
}
print(tomorrow[int(input())])

Buggy submission (verdict: Runtime Error):
tomorrow = {
  'Sunny': 'Cloudy',
  'Cloudy': 'Rainy',
  'Rainy': 'Sunny'
};
print(tomorrow[int(input())])
Problem p03261 (python)

Fixed submission:
def count_word(words, word):
    count = 0

    for w in words:
        if w == word:
            count += 1

    return count

n = int(input())

words = []
for i in range(n):
    words.append(input())

bind_letter = ""
for word in words:
    matches = count_word(words, word)
    if matches >= 2:
        print("No")
        exit()

    if bind_letter != "":
        if word[0] != bind_letter:
            print("No")
            exit()
    bind_letter = word[len(word) - 1]
    
print("Yes")

Buggy submission (verdict: Runtime Error):
def count_word(words, word):
    count = 0

    for w in words:
        if w == word:
            count += 1

    return count

n = int(input())

words = []
for i in range(n):
    words.append(input())

bind_letter = ""
for word in words:
    matches = count_word(words, word)
    if matches >= 2:
        print("No")
        exit()

    if bind_letter != "":
        if word[0] != bind_letter:
            print("No")
            exit()
    bind_letter = word[len(word) - 1]
    
p
Problem p02606 (python)

Fixed submission:
l,r,d = map(int,input().split())
c = 0
for i in range(l,r+1):
  if i%d == 0:
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
l,r,d = map(int,input())
c = 0
for i in range(l,r+1):
  if i%d == 0:
    c += 1
print(c)
Problem p02573 (python)

Fixed submission:
class UnionFind:
  def __init__(self, N):
    self.r = [-1]*N
  
  def root(self, x):
    if self.r[x] < 0:
      return x
    else:
      self.r[x] = self.root(self.r[x])
      return self.r[x]
  
  def unite(self, x, y):
    x = self.root(x)
    y = self.root(y)
    if x == y:
      return False
    else:
      if self.r[x] > self.r[y]:
        x, y = y, x
      self.r[x] += self.r[y]
      self.r[y] = x
      return True
    
  def size(self, x):
    return -1*self.r[self.root(x)]
  
  def print(self):
    print(self.r)


N, M = map(int, input().split())

UF = UnionFind(N)

for _ in range(M):
  a, b = map(int, input().split())
  UF.unite(a-1, b-1)

ans = 0
for i in range(N):
  ans = max(ans, UF.size(i))

print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind:
  def __init__(self, N):
    self.r = [-1]*(N+1)
  
  def root(self, x):
    if self.r[x] < 0:
      return x
    else:
      self.r[x] = self.root(self.r[x])
      return self.r[x]
  
  def unite(self, x, y):
    x = self.root(x)
    y = self.root(y)
    if x == y:
      return False
    else:
      self.r[x] += self.r[y]
      self.r[y] = x
      return True
    
  def size(self, x):
    return -1*self.r[self.root(x)]
  
  def print(self):
    print(self.r)


N, M = map(int, input().split())

UF = UnionFind(N)

for _ in range(M):
  a, b = map(int, input().split())
  UF.unite(a-1, b-1)

ans = 0
for i in range(N):
  ans = max(ans, UF.size(i))

print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind:
  def __init__(self, N):
    self.r = [-1]*N
  
  def root(self, x):
    if self.r[x] < 0:
      return x
    else:
      self.r[x] = self.root(self.r[x])
      return self.r[x]
  
  def unite(self, x, y):
    x = self.root(x)
    y = self.root(y)
    if x == y:
      return False
    else:
      self.r[x] += self.r[y]
      self.r[y] = x
      return True
    
  def size(self, x):
    return -1*self.r[self.root(x)]
  
  def print(self):
    print(self.r)


N, M = map(int, input().split())

UF = UnionFind(N)

for _ in range(M):
  a, b = map(int, input().split())
  UF.unite(a-1, b-1)

ans = 0
for i in range(N):
  ans = max(ans, UF.size(i))

print(ans)
Problem p02601 (python)

Fixed submission:
A, B, C = map(int, input().split())
K = int(input())
 
for i in range(K):
  if A >= B:
    B = B*2
  elif B >= C:
    C = C*2
  else:
    break

if A<B<C:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
K = int(input())

for i in range(K):
  if A >= B:
    B = B*2
  elif B >= C:
    C = C*2
  else:
    break

if A<B<C:
  print(Yes)
else:
  print(No)
Problem p02615 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()

len_A = len(A)
ans = 0
for i in range(1, len_A):
  ans += A[len_A-1-int(i/2)]

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split())).sorted()
 
len_A = len(A)
ans = 0
for i in range(1, len_A-1):
  ans += A[len_A-1-int(i/2)]

print(ans)

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

len_A = len(A)
ans = 0
for i in range(1, len_A-1):
  ans += A[len_A-1-int(i/2)]

print(ans)
Problem p02630 (python)

Fixed submission:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
  D[a] += 1
Q = int(input())
B = []
C = []
for _ in range(Q):
  l = list(map(int, input().split()))
  B.append(l[0])
  C.append(l[1])

ans = sum(A)
for i in range(Q):
  k = D[B[i]]
  D[B[i]] = 0
  D[C[i]] += k
  ans = ans - (B[i]*k) + (C[i]*k)
  print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for _ in range(Q):
  l = map(int, input().split())
  B.append(l[0])
  C.append(l[1])

for i in range(Q):
  for a in A:
    if a == B[i]:
      a = C[i]
  print(sum(A))
Problem p02639 (python)

Fixed submission:
X = list(map(int, input().split()))
for i in range(len(X)):
  if X[i] == 0:
    print(i+1)
    break

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

for i in range(50):
  if X-i not in ps:
    print(X-i)
    break
  elif X+i not in ps:
    print(X+i)
    break

Buggy submission (verdict: Runtime Error):
X = map(int, input().split())
for i in range(len(X)):
  if X[i] == 0:
    print(i+1)
    break
Problem p02657 (python)

Fixed submission:
def main():
  l = input().split()
  A, B = int(l[0]), float(l[1])
  B100 = int(B*1000)
  ans = int((A*B100)/1000)
  print(ans)
  return

main()

Buggy submission (verdict: Runtime Error):
str_n = input()
str_an = input()

n = int(str_n)
an = [int(ai) for ai in str_an.split()]

ans = 1
for ai in an:
  ans *= ai

if ans > 1e8:
  ans = -1
  
print(ans)