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

Fixed submission:
nums = input().split()
a = int(nums[0])
b = nums[1]

res = ""
for ch in range(len(b)):
	if b[ch] != '.':
		res += b[ch]
		
b = int(res)

prod = (a * b) // 100

print(prod)

Buggy submission (verdict: Runtime Error):
nums = input().split()
a = int(nums[0])
b = nums[1]

res = ""
for ch in b:
	if ch not in ('0', '.'):
		res += ch
		
b = int(res)

prod = (a * b) // 100

print(prod)
Problem p02682 (python)

Fixed submission:
A, B, C, K = map(int, input().split())

if (A+B) == K:
  print(A)
elif (A+B) > K:
  if A > K:
    print(K)
  else:
    print(A)
elif (A+B) < K:
  print(A - (K - (A+B)))

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

if (A+B) == K:
  print(A)
elif (A+B) > K:
  if a > K:
    print(K)
  else:
    print(A)
elif (A+B) < K:
  print(A - (K - (A+B)))

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

if A+B == K:
  print(A)
elif A+B > K:
  if a > K:
    print(K)
  else:
    print(A)
elif A+B < K:
  print(A - (K - (A+B)))
Problem p02659 (python)

Fixed submission:
A, B = input().split()
ans = 0
A = int(A)
B = B.replace(".", "")
ans = A*int(B)
print(ans//100)

Buggy submission (verdict: Runtime Error):
A, B = map(float, input().split())
print(int((A*(B*100))/100)
Problem p02711 (python)

Fixed submission:
s = input()
flag = 0
    # １文字ずつ数値化し配列にする。
array = list(map(int, s))
    # 合計値を返す
for i in array:
  if i == 7:
    flag = 1
if flag ==1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = str(n)
flag = 0
    # １文字ずつ数値化し配列にする。
array = list(map(int, s))
    # 合計値を返す
for i in array:
  if i == 7:
    flag = 1
if flag ==1:
  print("Yes")
else:
  print("No")
Problem p02835 (python)

Fixed submission:
A1, A2, A3= map(int, input().split())
sum=A1+A2+A3
if sum>=22:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
A1, A2, A3= map(int, input().split())
sum=A1+A2+A3
if sum>=22:
    print(“bust”)
else:
    print(“win”)
Problem p02879 (python)

Fixed submission:
A,B = map(int,input().split())
if (A <= 9) and (B <=9):
    print(A*B)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import math
N = int(input()) 
factor = []
tmp = int(math.sqrt(N)) + 1
list = range(2,tmp)
for num in list[::-1]:
    while N % num == 0:
        N //= num
        factor.append(num)
        factor.append(N)
    if not factor:
        factor.append(N)
        factor.append(0)
    else:
        pass
    break
f=sum(factor)-1
print(f)

Buggy submission (verdict: Runtime Error):
import math
N = int(input()) 
factor = []
tmp = int(math.sqrt(N)) + 1
list = range(2,tmp)
for num in list[::-1]:
    while N % num == 0:
        N //= num
        factor.append(num)
        factor.append(N)
    if not factor:
        factor.append(N)
        factor.append(0)
    else:
        pass
    break
f=sum(factor)-1
print(f)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if (A <= 9)&(B <= 9):
    return(A*B)
else:
    return(-1)
Problem p02881 (python)

Fixed submission:
N = int(input())
import math
sqrtN = math.floor(math.sqrt(N))
list = range(1, sqrtN+1)
a=[]
for i in list[::-1]:
    while N%i == 0:
        a.append(int(i))
        a.append(int(N/i))
        break
    if not a:
        pass
    else:
        break
f = a[0]+a[1]-2
print(f)

Buggy submission (verdict: Runtime Error):
import math
N = int(input()) 
factor = []
tmp = int(math.sqrt(N)) + 1
list = range(2,tmp)
for num in list[::-1]:
    while N % num == 0:
        N //= num
        factor.append(num)
        factor.append(N)
    if not factor:
        factor.append(N)
        factor.append(1)
    else:
        pass
    break
if 
f=sum(factor)-2
print(f)

Buggy submission (verdict: Runtime Error):
import math
N = int(input()) 
factor = []
tmp = int(math.sqrt(N)) + 1
print(tmp)
list = range(2,tmp)
print(list[::-1])
for num in list[::-1]:
    while N % num == 0:
        N //= num
        factor.append(num)
        factor.append(N)
    if not factor:
        factor.append(N)
        factor.append(0)
        print("N="+str(N))
    else:
        pass
    break
f=factor[0]+factor[1]-1
print(f)
18
Problem p02725 (python)

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

ans = K - A[-1] + A[0]
for n in range(N-1):
  dis = A[n+1] - A[n]
  ans = max(ans, dis)
  
print(K-ans)

Buggy submission (verdict: Runtime Error):
import sys
lines = sys.stdin.readlines()    
# 1行ずつ取り出し
KN = input().strip(" ")
A = input().strip(" ")

K=int(KN[0])

X = K - int(A[-1])
temp = 0
for Ai in A:
  Y = int(Ai) - temp
  if Y > X:
    X = Y
  temp = int(Ai)

print(K-X)

Buggy submission (verdict: Runtime Error):
import sys
lines = sys.stdin.readlines()    
# 1行ずつ取り出し
KN = lines[0].strip(" ")
A = lines[1].strip(" ")

K=int(KN[0])

X = K - int(A[-1])
temp = 0
for Ai in A:
  Y = int(Ai) - temp
  if Y > X:
    X = Y
  temp = int(Ai)

print(K-X)

Buggy submission (verdict: Runtime Error):
import sys
lines = sys.stdin.readlines()    
# 1行ずつ取り出し
KN = lines[0].strip(" ")
A = lines[1].strip(" ")

K=KN[0]

X = K - A[-1]
temp = 0
for Ai in A:
  Y = Ai - temp
  if Y > X:
    X = Y
  temp = Ai

print(K-X)
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())
set_bule = N//(A+B) * A
other = N - N//(A+B) * (A+B)
hashi_bule=0
if 0 <= other <= A:
    hashi_bule = other
else :
    hashi_bule = A
print(set_bule + hashi_bule)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
set_bule = N//(A+B) * A
other = N - N//(A+B) * (A+B)
if 0 <= other <= A:
    hashi_ bule = other
else :
    hashi_bule = A
print(set_bule + hashi_bule)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
set_bule = //(A+B) * A
other = N - N//(A+B) * (A+B)
if 0 <= other <= A:
    hashi_ bule = other
else :
    hashi_bule = A
print(set_bule + hashi_bule)
Problem p02759 (python)

Fixed submission:
import math
N = int(input())
print(math.ceil(N/2))

Buggy submission (verdict: Runtime Error):
A = []
for _ in range(3):
    A += list(map(int, input().split()))
N = int(input())
B = [int(input()) for i in range(N)]

for i in range(0,N):
    for j in range(9):
        if B[i] ==  A[j]:
            A[j] = 0

if A[0]==A[1]==A[2]==0 or A[3]==A[4]==A[5]==0 or A[6]==A[7]==A[8]==0 or A[0]==A[3]==A[6]==0 or A[1]==A[4]==A[7]==0 or A[2]==A[5]==A[8]==0 or  A[0]==A[4]==A[8]==0 or A[2]==A[4]==A[6]==0 :
    print('Yes')
else:
    print('No')
Problem p02773 (python)

Fixed submission:
#bA
import collections
N = int(input())
S = [input() for i in range(N)]
s = collections.Counter(S) #出現回数をまとめた辞書型作成

maximum = max(s.values()) #
list = sorted(key for key,value in s.items() if value==maximum)
#sを利用して、出現回数が最大のものを辞書順に並べたリストを作成

for i in list:
    print(i)

Buggy submission (verdict: Runtime Error):
#bA
import collections
N = int(input())
S = [input() for i in range(N)]
s = collections.Counter(S) #出現回数をまとめた辞書型作成

maximum = max(S.values())
list = sorted(key for key,value in s.items() if value==maximum)
#sを利用して、出現回数が最大のものを辞書順に並べたリストを作成

for i in list:
    print(i)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
S = [input() for i in range(N)]
s = collections.Counter(S) #出現回数をまとめた辞書型作成

maximum = max(S.values())
list = sorted(key for key,value in s.items() if value==maximum))
#sを利用して、出現回数が最大のものを辞書順に並べたリストを作成

for i in list:
    print(i)
Problem p02829 (python)

Fixed submission:

A = int(input())
B = int(input())
if A != 1 and B != 1:
    print(1)
elif A != 2 and B != 2:
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
print(*[s+t for s,t in zip(S,T)], sep='')
Problem p02879 (python)

Fixed submission:
A, B = map(int,input().split())
print(A*B if A<=9 and B<=9 else -1)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 1 + N - 2 #求めるのは(x-1) + (y-1)の最小値
for i in range(1, int(N**0.5)+1):
    if N%i==0:
        ans = min(ans, i+N//i-2)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M,A,B=map(int,input().split())
for m in range(M):
    if N<=A:
        N+=B
    c=int(input())
    N-=c
    if N<0:
        print(m+1)
        break
else:
    print("complete")
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
print(s if a >= 3200 else 'red')

Buggy submission (verdict: Runtime Error):
N = int(input())
v = sorted(list(map(int, input().split())))
for i in range(N-1):
    a = (v[i]+v[i+1])/2
    v[i+1] = float(a)
    a = 0
print(v[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
v = sorted(list(map(int, input().split())))
for i in range(N):
    a = (v[i]+v[i+1])/2
    v[i+1] = int(a)
    v[i] = 'A'
    a = 0
print(v[-1])
Problem p02935 (python)

Fixed submission:
N = int(input())
v = sorted(list(map(int, input().split())))
for i in range(N-1):
    a = (v[i]+v[i+1])/2
    v[i+1] = float(a)
    v[i] = 'A'
    a = 0
print(v[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
v = sorted(list(map(int, input().split())))
for i in range(N-1):
    a = (v[i]+v[i+1])/2
    v[i] = 'A'
    v[i+1] = int(a)
    a = 0
print(a[-1])
Problem p02951 (python)

Fixed submission:
A, B, C = map(int, input().split())
print(C-(A-B) if C >= (A-B) else '0')

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
a = H[0]
for i in range(1,N-1):
    a = max(H[i], a)
    b = H[i+1]
    if a - b >= 2:
        print("No")
        break
print("Yes")
Problem p03803 (python)

Fixed submission:
A, B = map(int, input().split()) 
if A==B:
    print('Draw')
elif A==1:
    print('Alice')
elif B==1:
    print('Bob')
elif A>B:
    print('Alice')
else:
    print('Bob')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print('Alice' if A>B or A==1 and B==2 else 'Draw' if A==B 'Bob')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print('Alice' if A>B or A==1 and B==2 'Draw' if A==B 'Bob')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print('Alice' if A>B or A==1 and B==2 else 'Draw' if A==B 'Bob')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print('Alice' if A>B or A==1 and B==2 elif A==B 'Draw' else 'Bob')
Problem p03834 (python)

Fixed submission:
print(*input().split(','))

Buggy submission (verdict: Runtime Error):
print(input().replace(',','')

Buggy submission (verdict: Runtime Error):
print(s.replace(',', '')
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<=K: #X+Y+Z=S Z=S-X-Y,0<=Z<=K
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())
print(len([for X in range(K+1) for Y in range(K+1) if 0<=S-X-Y<=K]))

Buggy submission (verdict: Runtime Error):
#リスト内方表記1,
K, S = map(int, input().split())
print(len([1 for X in range(K+1) for Y in range(K+1) if 0<=S-X=Y<=K]))

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())
print(len[1 for X in range(K+1) for Y in range(K+1) if 0<=S-X=Y<=K])
Problem p02659 (python)

Fixed submission:
X = input().split(" ")
A = int(X[0])
B = int( float(X[1])*1000 )

m = A * B
m = m // 1000

print(m)

Buggy submission (verdict: Runtime Error):
import math
X = input().split(" ")
A = int(X[0])
B100 = float(X[1])*100
ab = math.floor(A*B)//100
print(str(ab))
Problem p02729 (python)

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

def cmb(n,r):
    if r > n:
        return 0
    if r == 0 or r == n:
        return 1
    if r == 1:
        return n
    return cmb(n-1,r) + cmb(n-1,r-1)

ret = cmb(N,2) + cmb(M,2)
print(ret)

Buggy submission (verdict: Runtime Error):
L = int(input())
x = float(L/3)
print(x**3)
Problem p02629 (python)

Fixed submission:
n=int(input())
al=[chr(ord('a') + i) for i in range(26)]
sakai=[]
k=0
for i in range(10):
  k+=26**(i+1)
  sakai.append(k)

if n<=26:
  n-=1
  u=1
elif n>sakai[9]:
  n-=sakai[9]+1
  u=11
for i in range(9):
  if (sakai[i]<n<=sakai[i+1]):
    n-=sakai[i]+1
    u=i+2

def base(n):
  ans=[]
  while(n>=26):
    r=n%26
    n=(n-r)//26
    ans.append(r)
  ans.append(n)
  return ans


p=base(n)

if u-len(p)>0:
  ans_3='a'
  if u-len(p)>1:
    for j in range(u-len(p)-1):
      ans_3+='a'
    
for i in range(len(p)):
  if i==0:
    ans_2=al[p[len(p)-i-1]]
  else:
    ans_2=ans_2+al[p[len(p)-i-1]]
if u-len(p)>0:
  print(ans_3+ans_2)
else:
  print(ans_2)

Buggy submission (verdict: Runtime Error):
n=int(input())
al=[chr(ord('a') + i) for i in range(26)]
sakai=[]
k=0
for i in range(10):
  k+=26**(i+1)
  sakai.append(k)

if n<=26:
  n-=1
  u=1
elif n>sakai[9]:
  n-=sakai[9]+1
  u=11
for i in range(9):
  if (sakai[i]<n<=sakai[i+1]):
    n-=sakai[i]+1
    u=i+2

def base(n):
  ans=[]
  while(n>26):
    r=n%26
    n=(n-r)//26
    ans.append(r)
  ans.append(n)
  return ans


p=base(n)

if u-len(p)>0:
  ans_3='a'
  if u-len(p)>1:
    for j in range(u-len(p)-1):
      ans_3+='a'
    
for i in range(len(p)):
  if i==0:
    ans_2=al[p[len(p)-i-1]]
  else:
    ans_2=ans_2+al[p[len(p)-i-1]]
if u-len(p)>0:
  print(ans_3+ans_2)
else:
  print(ans_2)

Buggy submission (verdict: Runtime Error):
n=int(input())
al=[chr(ord('a') + i) for i in range(26)]
sakai=[]
k=0
for i in range(10):
  k+=26**(i+1)
  sakai.append(k)

if n<=26:
  n-=1
  u=1
elif n>sakai[9]:
  n-=sakai[9]+1
  u=11
for i in range(9):
  if (sakai[i]<n<=sakai[i+1]):
    n-=sakai[i]+1
    u=i+2

def base(n):
  ans=[]
  while(n>26):
    r=n%26
    n=(n-r)//26
    ans.append(r)
  ans.append(n)
  return ans


p=base(n)



if u-len(p)>0:
  ans_3='a'
  if u-len(p)>1:
    for j in range(u-len(p)-1):
      ans_3+='a'
    
for i in range(len(p)):
  if i==0:
    ans_2=al[p[len(p)-i-1]]
  elif i==len(p)-1:
    ans_2=ans_2+al[p[len(p)-i-1]]
  else:
    ans_2=ans_2+al[p[len(p)-i-1]]
if u-len(p)>0:
  print(ans_3+ans_2)
else:
  print(ans_2)

Buggy submission (verdict: Runtime Error):
n=int(input())
al=[chr(ord('a') + i) for i in range(26)]
sakai=[]
k=0
for i in range(10):
  k+=26**(i+1)
  sakai.append(k)


for i in range(10):
  if (sakai[i]<n<=sakai[i+1]):
    n-=sakai[i]
    u=i+2
  elif (n>sakai[9]):
    n-=sakai[9]
    u=12

def base(n):
  ans=[]
  while(n>26):
    r=n%26
    n=(n-r)//26
    ans.append(r)
  ans.append(n)
  return ans

p=base(n-1)
if u-len(p)>0:
  ans_3='a'
  if u-len(p)>1:
    for j in range(u-len(p)-1):
      ans_3+='a'
    
for i in range(len(p)):
  if i==0:
    ans_2=al[p[len(p)-i-1]]
  else:
    ans_2=ans_2+al[p[len(p)-i-1]]
if u-len(p)>0:
  print(ans_3+ans_2)
else:
  print(ans_2)
Problem p02622 (python)

Fixed submission:
S = input()
s = list(S)
T = input()
t = list(T)
s1=s[0]
t1=t[0]
count = 0
j=0
for i in S:
  if(s[j]!=t[j]):
    count=count+1
  j=j+1
print(count)

Buggy submission (verdict: Runtime Error):
ST = input().split()
S = list(S)
T = list(T)
for i in S:
  if(S[i]!=T[i]):
    count++
 
print(count)

Buggy submission (verdict: Runtime Error):
S = input().split()
S = list(S)
T = input.split()
T = list(T)
for i in S:
  if(S[i]!=T[i]):
    count++
 
print(count)

Buggy submission (verdict: Runtime Error):
S = input().split()
S = list(S)
T = input.split()
T = list(T)
for i in S:
  if(S[i]!=T[i]):
    count++;

print(count)
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
if a >= k:
    vis = k
elif a + b >= k:
    vis = a
else:
    vis= a + (-1*(k-a-b))
    
print(vis)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
if a > k:
    vis = [1]*a
elif a+b > k:
    vis=[1]*a+[0]*b
else:
    vis=[1]*a+[0]*b+[-1]*c
    
s = 0

sum(vis[0:k])
    
print(s)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
vis=[1]*a + [0]*b + [-1]*c
s = 0

sum(vis[0:k])
    
print(s)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
vis=[1]*a + [0]*b + [-1]*c
s = 0

for i in vis[0:k]:
    s += i
    
print(s)
Problem p02781 (python)

Fixed submission:
from math import factorial
N = int(input())
K = int(input())
S = list(map(int,str(N))) #桁数
ans = 0
digit = len(S)
k = K

def D(i,j): 
    if i >= j:
        return (9**j) * (factorial(i) // (factorial(i - j) * factorial(j)))
    else:
        return 0

if K > len(S):
    print(0)
    exit()

for i in range(digit):
    digit -= 1
    if int(S[i]) == 0:
        if K == len(S):
            print(0)
            exit()
        continue
    ans += D(digit,k)
    k -= 1
    if k == 0:
        ans += S[i]
        break
    ans += (int(S[i]-1))*D(digit,k)
print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial
N=int(input())
K=int(input())
#N,K = int(314159),int(3)
S = list(map(int,str(N)))

def C(n,r): 
    return factorial(n) // (factorial(n - r) * factorial(r))

def D(i,j): 
    return (9**j)*C(i,j)

ans = 0
l = len(S)
for i in range(l):
    if K >= 1:
        ans = ans + (int(S[i])-1)*D(l-1,K-1) + D(l-1,K)
        K -= 1
        l -= 1
    else:
        ans += 1
        break
print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial
N=int(input())
K=int(input())
#N,K = int(314159),int(3)
S = list(map(int,str(N)))

def C(n,r): 
    return factorial(n) // (factorial(n - r) * factorial(r))

def D(i,j): 
    return (9**j)*C(i,j)

ans = 0
l = len(S)
for i in range(l):
    if K >= 1:
        print('K',K)
        print((int(S[i])-1)*D(l-1,K-1))
        print(D(l-1,K))
        ans = ans + (int(S[i])-1)*D(l-1,K-1) + D(l-1,K)
        K -= 1
        l -= 1
    else:
        ans += 1
        break
print(ans)
Problem p02623 (python)

Fixed submission:
import bisect

def cumsum(a):
   r = [0]
   for v in a:
      r.append(r[-1] + v)
   return r

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

# 累積和をとる
a_cumsum = cumsum(a)
b_cumsum = cumsum(b)

ans = 0

# a_numはindex、vの部分aの値（中味）
for a_num, v in enumerate(a_cumsum):
    tmp = 0
    if k >= v:
        b_num = bisect.bisect_right(b_cumsum, k-v) -1
        # -1は「0」先頭に入れてるからね
        tmp = a_num + b_num
    ans = max(ans,tmp)

print(ans)

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

sum = 0
ans = 0


while sum < k:
    if k < a[0] and k < b[0] :
        break
    if len(a) == 0 and len(b) == 0:
        break
    elif len(a) == 0 :
        sum = sum + b.pop(0)
        ans += 1
    elif len(b) == 0:
        sum = sum + a.pop(0)
        ans += 1
    elif a[0] < b[0]:
        sum = sum + a.pop(0)
        ans += 1
    elif b[0] < a[0] :
        sum = sum + b.pop(0)
        ans += 1
if sum > k:
    ans -= 1

print(ans)
Problem p02729 (python)

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

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
n,m = map(int, input().split())

all = comb(n+m,2,exact=True)

print(all-m*n)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
n,m = map(int, input().split())

even = comb(n,2,exact=True) + comb(m,2,exact=True)

print(even)
Problem p02622 (python)

Fixed submission:
s = input()
t = input()
count = 0

for i in range(len(s)):
  if s[i]!=t[i]:
    count= count+1

print( count)

Buggy submission (verdict: Runtime Error):
s,t = map(str, input().split())
count = 0

for i in range(len(s)):
  if s[i]!=t[i]:
    count= count+1

print( count)
Problem p02777 (python)

Fixed submission:
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

if u == s:
  a = a - 1
if u == t:
  b = b - 1

print(str(a)+" "+str(b))

Buggy submission (verdict: Runtime Error):
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

if u == s:
  a = a - 1
if u == t:
  b = b - 1

print(a+" "+b)
Problem p02634 (python)

Fixed submission:
a,b,c,d = [int(x) for x in input().split()]
MOD = 998244353
dp = [[0 for i in range(d+10)] for j in range(c+10)]

for i in range(a,c+1):
    for j in range(b,d+1):
        # print(str(i) +'  '+str(j))
        if i == a and j == b:
            dp[i][j] = 1
            continue
        dp[i][j] = dp[i-1][j]*j + dp[i][j-1]*i - dp[i-1][j-1]*(i-1)*(j-1)
        dp[i][j] %= MOD
print(dp[c][d])

Buggy submission (verdict: Runtime Error):
	#include<bits/stdc++.h>
	using namespace std;
	using ll = long long;
	#define forn(i,n) for(int i = 0; i< n;++i)
	int INF = 1e9 + 7;
	ll MOD = 998244353;


	int main(){
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
		int a,b,c,d;
		cin >> a >> b >> c >> d;

		vector<vector<ll>> dp(c+10,vector<ll>(d+10,0));
		
		for(int i = a; i <= c; ++i){
			for(int j = b; j <= d; ++j){
				if(i == a && j == b){
					dp[i][j] = 1;
					continue;
				}
				dp[i][j] = dp[i-1][j]*j + dp[i][j-1]*i - dp[i-1][j-1]*(i-1)*(j-1);
				//dp[i][j] %= MOD;
				dp[i][j] = (MOD + dp[i][j] % MOD) % MOD;
			}
		}
		cout << dp[c][d] << endl;
				
	}
Problem p02891 (python)

Fixed submission:
S = input()
K = int(input())

prev_c = S[0]
num_changes = 0
for c in S[1:]:
    if c == prev_c:
        num_changes += 1
        prev_c = 'replaced'
    else:
        prev_c = c

total_changes = 0
if len(S) == 1:
    if len(S) % 2 == 0:
        total_changes = int(K/2)
    else:
        total_changes = int((K-1)/2)
elif S[0] == prev_c and S[1] == S[0] and len(S) % 2 == 1:
    num_changes2 = 0
    for c in S:
        if c == prev_c:
            num_changes2 += 1
            prev_c = 'replaced'
        else:
            prev_c = c
    total_changes = num_changes * int(K/2 + 1) + num_changes2 * int(K/2)
elif S[0] == prev_c:
    num_changes2 = 0
    for c in S:
        if c == prev_c:
            num_changes2 += 1
            prev_c = 'replaced'
        else:
            prev_c = c
    total_changes = num_changes + num_changes2 * (K-1)
else:
    total_changes = num_changes * K

print(total_changes)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

prev_c = S[0]
num_changes = 0
for c in S[1:]:
    if c == prev_c:
        num_changes += 1
        prev_c = 'replaced'
    else:
        prev_c = c

total_changes = 0
if S[0] == prev_c and S[1] == S[0] and len(S) % 2 == 1:
    num_changes2 = 0
    for c in S:
        if c == prev_c:
            num_changes2 += 1
            prev_c = 'replaced'
        else:
            prev_c = c
    total_changes = num_changes * int(K/2 + 1) + num_changes2 * int(K/2)
elif S[0] == prev_c:
    num_changes2 = 0
    for c in S:
        if c == prev_c:
            num_changes2 += 1
            prev_c = 'replaced'
        else:
            prev_c = c
    total_changes = num_changes + num_changes2 * (K-1)
else:
    total_changes = num_changes * K

print(total_changes)
Problem p02912 (python)

Fixed submission:

import heapq


class MaxHeap(object):
    def __init__(self, x):
        self.heap = [-e for e in x]
        heapq.heapify(self.heap)

    def push(self, value):
        heapq.heappush(self.heap, -value)

    def pop(self):
        return -heapq.heappop(self.heap)

N, M = list(map(lambda x:int(x), input().split(' ')))
l = list(map(lambda x:int(x), input().split(' ')))

maxheap = MaxHeap(l)

WARI = 0.5
for _ in range(0, M):
    v = int(maxheap.pop() * WARI)
    maxheap.push(v)

SUM = 0
for _ in range(0, N):
    SUM += maxheap.pop()

print(SUM)

Buggy submission (verdict: Runtime Error):
import heapq
 
 
class MaxHeap(object):
    def __init__(self, x):
        self.heap = [-e for e in x]
        heapq.heapify(self.heap)
 
    def push(self, value):
        heapq.heappush(self.heap, -value)
 
    def pop(self):
        return -heapq.heappop(self.heap)
 
N, M = list(map(lambda x:int(x), input().split(' ')))
l = list(map(lambda x:int(x), input().split(' ')))

maxheap = MaxHeap(l)
 
WARI = 0.5
for _ in range(0, M):

Buggy submission (verdict: Runtime Error):

import heapq


class MaxHeap(object):
    def __init__(self, x):
        self.heap = [-e for e in x]
        heapq.heapify(self.heap)

    def push(self, value):
        heapq.heappush(self.heap, -value)

    def pop(self):
        return -heapq.heappop(self.heap)

N, M = list(map(lambda x:int(x), input().split(' ')))
l = list(map(lambda x:int(x), input().split(' ')))

print(N, M)
print(l)

maxheap = MaxHeap(l)

WARI = 0.5
for _ in range(0, M):
    v = int(maxheap.pop() * WARI)
    maxheap.push(v)

print(SUM)