Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
Ss = S
q = []
for _ in range(Q):
    q.append(list(map(str,input().rsplit())))

for i in range(Q) :
    if int(q[i][0]) == 1 :
        Ss = Ss[::-1]
    elif int(q[i][0]) == 2 :
        if int(q[i][1]) == 1 :
            Ss = str(q[i][2]) + Ss
        else:
            Ss = Ss + str(q[i][2])
print(Ss)

Fixed submission:
str = input()
Q = int(input())
left = []
right = []
flag = 1
for _ in range(Q):
    line = input().split()
    op1 = int(line[0])
    if op1 == 1:
        flag = -flag
    else:
        op2 = int(line[1])
        char = line[2]
        if (op2 == 1 and flag == 1) or (op2 == 2 and flag == -1) :
            left.append(char)
        else:
            right.append(char)

if flag == -1:
    right.reverse()
    str = str[::-1]
    str = "".join(right) + str
    str += "".join(left)
else:
    left.reverse()
    str = "".join(left) + str
    str += "".join(right)

print(str)

Buggy python submission (verdict: Time Limit Exceeded):
"""
    Author: _YL_
"""
s = input()
n = int(input())

i = 0
while i < n:
    lst = input().split()

    if lst[0] == "1":
        s = s[::-1]
    elif lst[1] == "1":
        s = lst[2] + s
    else:
        s += lst[2]

    i += 1

print(s)

Fixed submission:
str = input()
Q = int(input())
left = []
right = []
flag = 1
for _ in range(Q):
    line = input().split()
    op1 = int(line[0])
    if op1 == 1:
        flag = -flag
    else:
        op2 = int(line[1])
        char = line[2]
        if (op2 == 1 and flag == 1) or (op2 == 2 and flag == -1) :
            left.append(char)
        else:
            right.append(char)

if flag == -1:
    right.reverse()
    str = str[::-1]
    str = "".join(right) + str
    str += "".join(left)
else:
    left.reverse()
    str = "".join(left) + str
    str += "".join(right)

print(str)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = int(input())
for i in range(n):
    q = input().split()
    if len(q) == 1:
        s = s[::-1]
    else:
        if q[1] == "1":
            s = q[2] + s
        else:
            s = s + q[2]

print(s)

Fixed submission:
str = input()
Q = int(input())
left = []
right = []
flag = 1
for _ in range(Q):
    line = input().split()
    op1 = int(line[0])
    if op1 == 1:
        flag = -flag
    else:
        op2 = int(line[1])
        char = line[2]
        if (op2 == 1 and flag == 1) or (op2 == 2 and flag == -1) :
            left.append(char)
        else:
            right.append(char)

if flag == -1:
    right.reverse()
    str = str[::-1]
    str = "".join(right) + str
    str += "".join(left)
else:
    left.reverse()
    str = "".join(left) + str
    str += "".join(right)

print(str)
Buggy python submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
ans = ['0' for i in range (n)]
fl = True

for i in range (m):
    s,c = input().split()
    s = int(s) - 1
    if (s == 0 and c == '0' and N != 1):
        fl = False
    if (ans[s] != '0'):
        if (ans[s] != c):
            fl = False
    else:
        ans[s] = c

res = ''

if (ans[0] == '0' and N != 1):
    ans[0] = '1'

for i in ans:
    res += i

print (res if fl else -1)

Fixed submission:
#graph implementation
import math
n,m=map(int,input().split())
ans=['bal']*n
for i in range(m):
    s,c=map(int,input().split())
    if ans[s-1]=='bal':
      ans[s-1]=c
    else:
        if ans[s-1]!=c:
            print(-1)
            exit(0)
if ans[0]=='bal' and n>1:
    ans[0]=1
for i in range(n):
    if ans[i]=='bal':
        ans[i]=0
if ans[0]==0 and n>1:
    print(-1)
else:
    for i in ans:
        print(i,end="")
print()

Buggy python submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
nlist = []
clist = []
for i in range (m):
    s,c = list(map(int,input().split()))
    nlist.append(s)
    clist.append(c)

if n == 1:
    if len(clist) > 1:
        for i in range (len(clist)-1):
            for j in range (1, len(clist)):
                if clist[i] != clist[j]:
                    print (-1)
                    exit()
    else:
        print(clist[0])

else:
    for i in range (len(nlist)-1):
        for j in range (1, len(nlist)):
            if nlist[i] == nlist[j]:
                if clist[i] != clist[j]:
                    print(-1)
                    exit()

    a = 1
    b = 0
    c = 0

    for i in range (len(nlist)):
        if nlist[i] == 1:
            a = (clist[i])
        if nlist[i] == 2:
            b = (clist[i])
        if nlist[i] == 3:
            c = (clist[i])

    if n == 2:
        if a == 0:
            print(-1)
        else:
            print(a,end = "")
            print(b)
    elif n == 3:
        if a == 0:
            print(-1)
        else:
            print(a,end = "")
            print(b,end = "")
            print(c)

Fixed submission:
#graph implementation
import math
n,m=map(int,input().split())
ans=['bal']*n
for i in range(m):
    s,c=map(int,input().split())
    if ans[s-1]=='bal':
      ans[s-1]=c
    else:
        if ans[s-1]!=c:
            print(-1)
            exit(0)
if ans[0]=='bal' and n>1:
    ans[0]=1
for i in range(n):
    if ans[i]=='bal':
        ans[i]=0
if ans[0]==0 and n>1:
    print(-1)
else:
    for i in ans:
        print(i,end="")
print()
Buggy python submission (verdict: Runtime Error):
N = int(input())
R = int(input())
if 10 < N <= 100 and 0 <= R <= 4111:
    print(R)
if 1<= N < 10 and 0 <= R <= 4111:
    K = 100 * (10 - N)
    M = R + K
    print(M)

Fixed submission:
N,R=input().split()
n,r=int(N),int(R)

if n>=10:
    print(r)
else:
    print(r+100*(10-n))

Buggy python submission (verdict: Runtime Error):
if 1 <= N <= 100 and 0 <= R <= 4111:
    if N > 10:
        print(R)
    else:
        K = 100 * (10 - N)
        M = R + K
        print(M)
else:
    False

Fixed submission:
N,R=input().split()
n,r=int(N),int(R)

if n>=10:
    print(r)
else:
    print(r+100*(10-n))

Buggy python submission (verdict: Runtime Error):
N , K = input().split()
if (N <= 10) :
    print (100 * (10 - int(N)) + int(K))
else :
    print (K)

Fixed submission:
N,R=input().split()
n,r=int(N),int(R)

if n>=10:
    print(r)
else:
    print(r+100*(10-n))
Buggy python submission (verdict: Runtime Error):
import math


def get_stamina(x, p):
    return (x - p) ** 2


n = int(input())
persons_coordinates = list(map(int, input().split()))
max_coordinate = max(persons_coordinates)
min_stamina = math.inf


for p in range(max_coordinate + 1):
    stamina = 0
    for x in persons_coordinates:
        stamina += get_stamina(x, p)
    
    if min_stamina >= stamina:
        min_stamina = stamina
print(min_stamina)

Fixed submission:
N = int(input())
x = input().split()
avg = 0

for i in range (N) :
    x[i] = int(x[i])
    avg += x[i]

avg1 = avg // N
avg2 = avg // N + 1

ans1 = 0
ans2 = 0

for i in range (N) :
    ans1 += (x[i] - avg1) ** 2
    ans2 += (x[i] - avg2) ** 2

print (int(min(ans1 , ans2)))
Buggy python submission (verdict: Runtime Error):
for case in range (int(input())):
    triple = input().split()
    for i in range (3):
        triple[i] = int(triple[i])
    triple.sort()
    if (triple [0] == triple [2]) :
        print('No')
    elif (triple[0] == triple [1] or triple[1] == triple [2]) :
        print('Yes')
    else:
        print('No')

Fixed submission:
from sys import stdin
import math

if __name__ == '__main__':
	n = stdin.readline()
	n = n.rstrip('\n')
	n = n.split(' ')
	n = [int(i) for i in n]
	n.sort()
	if (n[0] == n[1] and n[1] != n[2]) or (n[0] != n[1] and n[1] == n[2]):
		print('Yes')
	else:
		print('No')

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
if a==b:
    if b==c: 
        print('NO')
    else:
        print('YES')
elif b==c:
    if a==c: 
        print('NO')
    else:
        print('YES')
elif a==c:
    if b==c:
        print('NO')
    else:
        print('YES')
else:
    print('NO')



Fixed submission:
from sys import stdin
import math

if __name__ == '__main__':
	n = stdin.readline()
	n = n.rstrip('\n')
	n = n.split(' ')
	n = [int(i) for i in n]
	n.sort()
	if (n[0] == n[1] and n[1] != n[2]) or (n[0] != n[1] and n[1] == n[2]):
		print('Yes')
	else:
		print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N,K=input().split()
n,k=int(N),int(K)
p=list(input().split())

for i in range (len(p)):
    p[i]=int(p[i])
    
def f(m,p):
    q=0
    for i in range (m):
        q=q+p[i]
    return q

r=[]
for i in range (n-k+1):
    a=f(i+k,p)-f(i,p)
    r.append(a)

maxs=max(r)

print((maxs+k)/2)


Fixed submission:
n, k = list (map (int, input ().split ()))
p = [0] + list (map (int, input ().split ()))
s = [0 for i in range (n + 1)]
mx = 0
tag = 0
f = [0.0 for i in range (n + 1)]
for i in range (1, n + 1) :
    s[i] = s[i - 1] + (p[i] + 1) * p[i] / 2 / p[i]
    if (i >= k and s[i] - s[i - k] > mx) :
        mx = s[i] - s[i - k]
print (mx)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=input().split()
n,k=int(N),int(K)
p=list(input().split())

for i in range (len(p)):
    p[i]=int(p[i])


sums=0
maxi=0

for i in range(0,n-k+1):
    sums=0
    for t in range(i,i+k):
        sums=sums+p[t]
    if sums>=maxi:
        maxi=sums
    
print((maxi+k)/2)


Fixed submission:
n, k = list (map (int, input ().split ()))
p = [0] + list (map (int, input ().split ()))
s = [0 for i in range (n + 1)]
mx = 0
tag = 0
f = [0.0 for i in range (n + 1)]
for i in range (1, n + 1) :
    s[i] = s[i - 1] + (p[i] + 1) * p[i] / 2 / p[i]
    if (i >= k and s[i] - s[i - k] > mx) :
        mx = s[i] - s[i - k]
print (mx)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=input().split()
n,k=int(N),int(K)
p=list(input().split())

for i in range (len(p)):
    p[i]=int(p[i])


sums=0
maxi=0

for i in range(0,n-k+1):
    sums=0
    for j in range(i,i+k):
        sums=sums+p[j]
        if sums>=maxi:
            maxi=sums
    
print((maxi+k)/2)


Fixed submission:
n, k = list (map (int, input ().split ()))
p = [0] + list (map (int, input ().split ()))
s = [0 for i in range (n + 1)]
mx = 0
tag = 0
f = [0.0 for i in range (n + 1)]
for i in range (1, n + 1) :
    s[i] = s[i - 1] + (p[i] + 1) * p[i] / 2 / p[i]
    if (i >= k and s[i] - s[i - k] > mx) :
        mx = s[i] - s[i - k]
print (mx)
Buggy python submission (verdict: Runtime Error):
x,y,z=input().split()
x=int(x)
y=int(y)



if x==y:
    print("Yes")

else:
    print("No")
    

Fixed submission:
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
if n==m:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = input().split()
cnt = 0 

for i in range (N) :
    l[i] = int(l[i])

for i in range (N) :
    flag = True
    for j in range (i) :
        if (l[j] < l[i]) :
            flag = False
    if (flag) :
        cnt += 1

print (cnt)

Fixed submission:
from sys import stdin
n = int(stdin.readline())
l = list(map(int,stdin.readline().split()))
ans = 0
m = float('inf')
for u in l:
	if u<=m: m = u; ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = str(input())
a = string.ascii_lowercase.index(n) 
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
print (n,'is followed by',letters[a+1])

Fixed submission:
x = input().lower()
print(chr(ord(x) + 1))
#..........
Buggy python submission (verdict: Runtime Error):
#ddfdfdf
#djfkdnfjdnfjfn
#sjhdjhfjdf
def stringconcant(S,T):
    a = S
    b = T
    r = a+b
    return r

S,T= input().split()
a = stringconcant(T,S)
print(a)

Fixed submission:
A,B=input().split()
print(B+A)
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Buggy python submission (verdict: Runtime Error):
for mn in range(n):
    a=input()# String1 in the pair
    b=input()#String2 in the pair
    la=[]
    lb=[]

    for i in range(max(len(a),len(b))):#creating lists with all possible elements by slicing off the characters
        la.append(a[i:])
        lb.append(b[i:])

    if len(a)>len(b):#removes empty elements
        lb=[x for x in lb if x!='']
    else:
        la=[x for x in la if x!='']

    while True:#Create empty list for sorting the 0th elements of 'la' nd 'lb'
        temp=[]
        temp.append(la[0])
        temp.append(lb[0])
        temp=sorted(temp)
        print(temp[0][0],end='')#print the 1st character

        if(temp[0] in la):#removing the element after printing the first character
            la.pop(0)
        else:
            lb.pop(0)

        if len(la)==0:#breaks the while loop if a list gets empty
            print(temp[1],end='')
            break
        elif len(lb)==0:
            print(temp[1],end='')
            break

Fixed submission:
A,B=input().split()
print(B+A)
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Buggy python submission (verdict: Runtime Error):
String : ")
str2 = input("Please Enter the Second String : ")

concat1 = str1 + str2
print("The Final String After Python String Concatenation = ", concat1)

concat2 = str1 + ' ' + str2
print("The Final After String Concatenation with Space = ", concat2)

Fixed submission:
A,B=input().split()
print(B+A)
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Buggy python submission (verdict: Runtime Error):
def stringconcant(S,T):
    a = S
    b = T
    c = a+b
    return c

S= input()
T= input()
a = stringconcant(T,S)
print(a)

Fixed submission:
A,B=input().split()
print(B+A)
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Buggy python submission (verdict: Runtime Error):
inp = input().split()

input().split() == "2 5 7" == ["2", "5","7"]

A = int(inp[0])
B = int(inp[1])
C = int(inp[2])

if A + B + C >= 22:
	print("bust")
else:
	print("win")

Fixed submission:
a1, a2, a3 = map(int, input().split())
if 1 <= a1 <= 13 and 1 <= a2 <= 13 and 1 <= a3 <= 13:
    if a1 + a2 + a3 >= 22:
        print('bust')
    else:
        print('win')

Buggy python submission (verdict: Runtime Error):
inp = input().split()

input().split() == "2 5" == ["2", "5",]

A = int(inp[0])
B = int(inp[1])
C = int(inp[3])

if A + B + C >= 22:
	print("bust")
else:
	print("win")

Fixed submission:
a1, a2, a3 = map(int, input().split())
if 1 <= a1 <= 13 and 1 <= a2 <= 13 and 1 <= a3 <= 13:
    if a1 + a2 + a3 >= 22:
        print('bust')
    else:
        print('win')
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin


def ii(): return int(stdin.readline())


def fi(): return float(stdin.readline())


def mi(): return map(int, stdin.readline().split())


def fmi(): return map(float, stdin.readline().split())


def li(): return list(mi())


def lsi():
    x=list(stdin.readline())
    x.pop()
    return x


def si(): return stdin.readline()


def sieve(x):
    a=[True]*(x+1)
    sq=floor(sqrt(x))
    for i in range(3, sq+1, 2):
        if a[i]:
            for j in range(i*i, x+1, i):
                a[j]=False
    if x>1:
        p=[2]
    else:
        p=[]
    for i in range(3, x+1, 2):
        if a[i]:
            p.append(i)
    return p
#vowel={'a', 'e', 'i', 'o', 'u', 'y', 'A', 'E', 'I', 'O', 'U', 'Y'}
#pow=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904, 9223372036854775808]
############# CODE STARTS HERE #############
a=lsi()
s, e=0, len(a)-1
c=0
while s<e:
    if a[s]!=a[e]:
        c+=1
    s+=1
    e-=1
print(c)

Fixed submission:
s = input()
res = 0
for i in range(len(s)//2):
    res += int(s[i] != s[len(s)-i-1])
print(res)

Buggy python submission (verdict: Runtime Error):
s = input().rstrip()
l = len(s)
half_len = int(l/2)

if l%2 != 0:
	s = s.replace(s[half_len], "")
	fst_half = s[:half_len]
	snd_half = s[half_len:]
else:
	fst_half = s[:half_len]
	snd_half = s[half_len:]

snd_half = snd_half[::-1]

count = 0
for i in range(half_len):
	if(snd_half[i] != fst_half[i]):
		count += 1

print(count)

Fixed submission:
s = input()
res = 0
for i in range(len(s)//2):
    res += int(s[i] != s[len(s)-i-1])
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
from math import  *
import copy

input = int(input())

def getMoney(money):
    prices = [100, 101, 102, 103, 104, 105]
    rem = []
    for element in prices:
        rem.append(money - money * floor(money/element))
    bounds = [floor(money/element) + 1 for element in prices]
    for index1 in range(bounds[0]):
        for index2 in range(bounds[1]):
            for index3 in range(bounds[2]):
                for index4 in range(bounds[3]):
                    for index5 in range(bounds[4]):
                        for index6 in range(bounds[5]):
                            if (index1 * prices[0] + index2 * prices[1] +index3 * prices[2] + index4 * prices[3] + index5 * prices[4] + index6 * prices[5] == money):
                                return 1
    return 0

print(getMoney(input))


Fixed submission:
x = int(input())
 
for i in range(2000):
    if i * 100 <= x <= i * 105:
        print(1)
        exit()
 
print(0)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
if (N%2!=0):
    print('No')
else:
    a1=S[:N/2]
    a2=S[N/2:]
    if (a1==a2):
        print('Yes')

Fixed submission:
n = int(input())
s = input()

if(n%2 == 1):
    print("No")
else:
    flag = False
    for i in range(n//2):
        if(s[i] != s[i+n//2]):
            flag = True
            print("No")
    
    if(flag == False):
        print("Yes")
Buggy python submission (verdict: Runtime Error):
s = raw_input()
    n = int(raw_input())

    a,b = s.split(' ')
    a,b = int(a),int(b)

    if a <= 9 and a >=1 and (1 <= b <= 9):
        return a * b
    else:
        return -1

Fixed submission:
entrada = input().split();
numeros =[int(entrada[0]),int(entrada[1])] 
if(numeros[0]>=1 and numeros[0]<=9 and numeros[1]>=1 and numeros[1]<=9):
	print(numeros[0]*numeros[1])
else:
	print(-1)

Buggy python submission (verdict: Runtime Error):
A=variable
B=variable_2
A=1
B=1
C=A*B
while A and B <= 9;
	print(A*B)
	A=A+1
	B=B+1
print(C)

Fixed submission:
entrada = input().split();
numeros =[int(entrada[0]),int(entrada[1])] 
if(numeros[0]>=1 and numeros[0]<=9 and numeros[1]>=1 and numeros[1]<=9):
	print(numeros[0]*numeros[1])
else:
	print(-1)

Buggy python submission (verdict: Runtime Error):
A=variable
B=variable_2
A=1
B=1
while A and B <= 9;
	print(A*B)
	A=A+1
	B=B+1

Fixed submission:
entrada = input().split();
numeros =[int(entrada[0]),int(entrada[1])] 
if(numeros[0]>=1 and numeros[0]<=9 and numeros[1]>=1 and numeros[1]<=9):
	print(numeros[0]*numeros[1])
else:
	print(-1)

Buggy python submission (verdict: Runtime Error):
a=variable
b=variable_2
a=9
b=9
if a*b=81;
	print("81")
else;
	print("-1")

Fixed submission:
entrada = input().split();
numeros =[int(entrada[0]),int(entrada[1])] 
if(numeros[0]>=1 and numeros[0]<=9 and numeros[1]>=1 and numeros[1]<=9):
	print(numeros[0]*numeros[1])
else:
	print(-1)
Buggy python submission (verdict: Runtime Error):
def primes(n):
    i = 2
    prime = []
    while i**2<= n:
        if n % i:
            i += 1
        else:
            n =n//i
            prime.append(i)
    if n > 1:
        prime.append(n)
    return prime
a = int(input())
b = int(input())
pa=set(primes(a))
pb=set(primes(b))
inte=pa.intersection(pb)
print(len(inte)+1)

Fixed submission:
import math
def primes(n):
    l= []
    for i in range(2,math.floor(math.sqrt(n))):
        while n % i == 0:
            n = n//i
            l.append(i)
        if n == 1: 
            break
    
    if n > 1:
        l.append(n)
    return l

a,b=map(int,input().split())
sa=set(primes(a))
sb=set(primes(b))
sans=sa.intersection(sb)
print(len(sans)+1)
Buggy python submission (verdict: Runtime Error):
n = int(input()) #waiting_for_pudging
a = list(map(int, input().split())) #waiting_for_pudging
b = list(map(int, input().split())) #waiting_for_pudging
c = list(map(int, input().split())) #waiting_for_pudging
summ = 0 #waiting_for_pudging
for i in range(n-1): #pudging
    if a[i] + 1 == a[i + 1]: #pudging
        summ += c[a[i]] #pudging
        summ += b[a[i]] #pudging
    else: #pudging
        summ += b[a[i-1]] #pudging
print(summ) #pudging
#accepted
    

Fixed submission:
n = int(input()) #waiting_for_pudging
a = list(map(int, input().split())) #waiting_for_pudging
b = list(map(int, input().split())) #waiting_for_pudging
c = list(map(int, input().split())) #waiting_for_pudging
summ = 0 #waiting_for_pudging
for i in range(n-1): #pudging
    if a[i] + 1 == a[i + 1]: #pudging
        summ += c[a[i]-1] #pudging
        summ += b[a[i]-1] #pudging
    else: #pudging
        summ += b[a[i]-1] #pudging
print(summ + b[a[n-1]-1]) #pudging
#accepted
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
cnt = 0
for i in range(s):
    if s[i] == t[i]:
        cnt = cnt+1

print(cnt)

Fixed submission:
S = input()
T = input()
c = 0
for i in range(3):
  if (S[i] == T[i]):
    c = c + 1
print(c)
Buggy python submission (verdict: Runtime Error):
m=int(input())
n=int(input())
r=m
i=1
while r<n :
	r=r+m-1
	i+=1
print(i)


Fixed submission:
s = input().split(" ")
a = int(s[0])
b = int(s[1])
c = 1
ans = 0

while c < b:
	c += a - 1
	ans += 1

print(ans)

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

print(round((n/m)+0.4))

Fixed submission:
s = input().split(" ")
a = int(s[0])
b = int(s[1])
c = 1
ans = 0

while c < b:
	c += a - 1
	ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
input1 = input()
x = []
y=[]
check=0

for i in input1:
    if i!=" " and check==0:
        x.append(i)
    elif i==" ":
        check=1
    elif i!=" " and check==1:
        check==1
        y.append(i)
xstring=''.join(x)
ystring=''.join(y)

xint=int(xstring)
yint=int(ystring)

if yint==1:
    print(0)
else:
    cnt=0
    while ((xint-1)*(cnt))+xint<yint:
        cnt=cnt+1
    cnt=cnt+1
    5print(cnt)
    

    


Fixed submission:
s = input().split(" ")
a = int(s[0])
b = int(s[1])
c = 1
ans = 0

while c < b:
	c += a - 1
	ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
x = int(input())
y = int(input())
temp=x


cnt=1
while x<y:
    cnt=cnt+1
    x=x+temp-1

print(cnt)
    


Fixed submission:
s = input().split(" ")
a = int(s[0])
b = int(s[1])
c = 1
ans = 0

while c < b:
	c += a - 1
	ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
su=0
for i in range(n):
    su+=i
print(su)

Fixed submission:
##################
n = int(input())
print((n*(n-1))//2)

Buggy python submission (verdict: Time Limit Exceeded):
def sum1(n):
    ans=0
    for i in range(1,n):
        ans=ans+i

    return ans
n=int(input())
print(sum1(n))

Fixed submission:
##################
n = int(input())
print((n*(n-1))//2)
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
#define ld long double

int main() {
    ll n;
    cin >> n;
    vector<ll> numbers(n);
    for(auto &i: numbers) cin >> i ;
    sort(numbers.begin(), numbers.end());
    ld ans = numbers[0];
    for(auto i: numbers) {
        ans = (ans + i)/2;
    }
    cout << ans << endl;
    return 0;
}

Fixed submission:

# Solution: sort and then combine result of mixing first and second with the third, etc. so that most valuable are weighted heighest

input() # N
ingredients = [int(x) for x in input().split()]

ingredients.sort()
value = ingredients[0]
for ingredient in ingredients:
    value = (value+ingredient) / 2
print(value)