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

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

li.sort()

if li[0] >= 0:
    print(sum(li)-2*li[0])
    for i in range(n-2):
        print(li[0],li[i+1])
        li[0] -= li[i+1]
    print(li[n-1],li[0])
elif li[n-1] <= 0:
    print(abs(sum(li))+2*li[n-1])
    for i in range(n-1):
        print(li[n-1],li[i])
        li[n-1] -= li[i]
else:
    for i in range(n):
        if li[i] > 0:
            a = i-1
            break
    print(abs(sum(li[:a+1])) + sum(li[a+1:]))
    for i in range(n-a-2):
        print(li[0],li[a+1+i])
        li[0] -= li[a+1+i]
    for i in range(a+1):
        print(li[n-1],li[i])
        li[n-1] -= li[i]

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

li.sort()

if li[0] > 0:
    print(sum(li)-2*li[0])
    for i in range(n-2):
        print(li[0],li[i+1])
        li[0] -= li[i+1]
    print(li[n-1],li[0])
elif li[n-1] < 0:
    print(abs(sum(li))+2*li[n-1])
    for i in range(n-1):
        print(li[n-1],li[i])
        li[n-1] -= li[i]
else:
    for i in range(n):
        if li[i] > 0:
            a = i-1
            break
    print(abs(sum(li[:a+1])) + sum(li[a+1:]))
    for i in range(n-a-2):
        print(li[0],li[a+1+i])
        li[0] -= li[a+1+i]
    for i in range(a+1):
        print(li[n-1],li[i])
        li[n-1] -= li[i]
Problem p03061 (python)

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
ans = 0
lgcd = [0]*n
rgcd = [0]*n
lgcd[0] = li[0]
rgcd[-1] = li[-1]

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

for i in range(n-1):
    lgcd[i+1] = gcd(lgcd[i],li[i+1])
    rgcd[-i-2] = gcd(rgcd[-i-1],li[-(i+2)])

gcd_list = [gcd(lgcd[i],rgcd[i+2]) for i in range(n-2)]

gcd_list.append(lgcd[-2])
gcd_list.append(rgcd[1])

print(max(gcd_list))

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
li = list(map(int,input().split()))
ans = 0
lgcd = [li[0]]
rgcd = [li[-1]]

for i in range(n-1):
    lgcd.append(np.gcd(lgcd[-1],li[i+1]))
    rgcd.insert(0,np.gcd(rgcd[0],li[-(i+2)]))

gcd_list = [lgcd[-2],rgcd[1]]

for i in range(n-2):
    gcd_list.append(np.gcd(lgcd[i],rgcd[i+2]))

print(max(gcd_list))

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
ans = 0

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def gcd_list2(li):
    a = gcd(li[0],li[1])
    for i in range(n-1):
        a = gcd(a,li[i])
    return a

for i in range(n):
    li2 = li[:i] + li[i+1:]
    a = gcd_list2(li2)
    if a > ans:
        ans = a

print(ans)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
li = list(map(int,input().split()))
ans = 0

def gcd_list2(li):
    a = math.gcd(li[0],li[1])
    for i in range(n-1):
        a = math.gcd(a,li[i])
    return a

for i in range(n):
    li2 = li[:i] + li[i+1:]
    a = gcd_list2(li2)
    if a > ans:
        ans = a

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
li = list(map(int,input().split()))
ans = 0

def gcd_list(numbers):
    return reduce(math.gcd,numbers)

def gcd_list2(li):
    a = math.gcd(li[0],li[1])
    for i in range(n-1):
        a = math.gcd(a,li[i])
    return a

for i in range(n):
    li2 = li[:i] + li[i+1:]
    a = gcd_list2(li2)
    if a > ans:
        ans = a

print(ans)
Problem p03074 (python)

Fixed submission:
n,k = map(int,input().split())
s = input()
li = [0]
count = 1

for i in range(n-1):
    if s[i] != s[i+1]:
        li.append(count)
    count += 1
li.append(count)

m = len(li)

if s[0] == '1':
    li.append(li[-1])
    li.append(li[-1])
    t = int(m/2-1)
    if k >= t:
        print(n)
    else:
        max1 = 0
        for i in range(t-k+2):
            max1 = max(li[2*(i+k)+1] - li[2*i],max1)
        print(max1)
else:
    li.append(li[-1])
    t = int(m/2)
    if k >= t:
        print(n)
    else:
        max1 = li[2*k]
        for i in range(t-k):
            max1 = max(li[2*(i+k+1)] - li[2*i+1],max1)
        print(max1)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
li = [0]
count = 1

for i in range(n-1):
    if s[i] != s[i+1]:
        li.append(count)
    count += 1
li.append(count)

m = len(li)

if s[0] == '1':
    t = int(m/2-1)
    if k >= t:
        print(n)
    else:
        max1 = 0
        for i in range(t-k+1):
            max1 = max(li[2*(i+k)+1] - li[2*i],max1)
        print(max1)
else:
    t = int(m/2)
    if k >= t:
        print(n)
    else:
        max1 = li[2*k]
        for i in range(t-k):
            max1 = max(li[2*(i+k+1)] - li[2*i+1],max1)
        print(max1)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
li = [0]
count = 1

for i in range(n-1):
    if s[i] != s[i+1]:
        li.append(count)
    count += 1
li.append(count)

print(li)

m = len(li)

if s[0] == '1':
    t = int(m/2-1)
    if k >= t:
        print(n)
    else:
        max1 = 0
        for i in range(t-k+1):
            max1 = max(li[2*(i+k)+1] - li[2*i],max1)
        print(max1)
else:
    t = int(m/2)
    if k >= t:
        print(n)
    else:
        max1 = li[2*k]
        for i in range(t-k):
            max1 = max(li[2*(i+k+1)] - li[2*i+1],max1)
        print(max1)

Buggy submission (verdict: Runtime Error):
import numpy as np

def main():
    n,k = map(int,input().split())
    s = input()
    li = np.array([])
    count = 1


    for i in range(n-1):
        if s[i] == s[i+1]:
            count += 1
        else:
            li = np.append(li,count)
            count = 1
    li = np.append(li,count)

    m = len(li)

    if s[0] == '1':
        t = int(m/2)
        if k >= t:
            print(sum(li))
        else:
            for i in range(t-k+1):
                max1 = max(np.sum(li[2*i:2*(i+k)+1]),max1)
            print(max1)
    else:
        t = int(m/2+1)
        if k >= t:
            print(sum(li))
        else:
            max1 = sum(li[:2*k])
            for i in range(t-k):
                max1 = max(np.sum(li[2*i+1:2*(i+k)+2]),max1)
            print(max1)
main()
Problem p03096 (python)

Fixed submission:
n = int(input())
c = []
for _ in range(n):
    c.append(int(input()))

mod = 10**9+7
dp = [0] * n
dp[0] = 1

pre = [-1] * n
tmp = [-1] * (2*10**5+10)

for i in range(n):
    pre[i] = tmp[c[i]-1]
    tmp[c[i]-1] = i

for i in range(1,n):
    dp[i] = dp[i-1]
    if pre[i] != -1 and c[i] != c[i-1]:
        dp[i] += dp[pre[i]]
        dp[i] %= mod

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
c = []
for _ in range(n):
    c.append(int(input()))

dp = [0] * n
dp[0] = 1

pre = [-1] * n
tmp = [-1] * n

for i in range(n):
    pre[i] = tmp[c[i]-1]
    tmp[c[i]-1] = i

for i in range(1,n):
    dp[i] = dp[i-1]
    if pre[i] != -1 and c[i] != c[i-1]:
        dp[i] += dp[pre[i]]

print(dp[-1])
Problem p03103 (python)

Fixed submission:
n,m = map(int,input().split())
li = [list(map(int,input().split())) for _ in range(n)]
li.sort(key = lambda x:x[0])

money = 0
count = 0

while m > 0:
    if m > li[count][1]:
        money += li[count][0] * li[count][1]
        m -= li[count][1]
        count += 1
    else:
        money += li[count][0] * m
        m = 0
        count += 1

print(money)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
dict1 = {}
for i in range(n):
    a,b = map(int,input().split())
    dict1[a] = b

dict1_sorted = sorted(dict1.items(),key = lambda x:x[0],reverse = False)

money = 0
count = 0

while m > 0:
    if m > dict1_sorted[count][1]:
        money += dict1_sorted[count][0] * dict1_sorted[count][1]
        m -= dict1_sorted[count][1]
        count += 1
    else:
        money += dict1_sorted[count][0] * m
        m = 0
        count += 1

print(money)
Problem p03112 (python)

Fixed submission:
import bisect
import sys
input = sys.stdin.readline

a,b,q = map(int,input().split())
s = []
t = []
s1 = []
t1 = []

for _ in range(a):
    s.append(int(input()))
for _ in range(b):
    t.append(int(input()))

for i in range(a-1):
    s1.append((s[i]+s[i+1])/2)
for i in range(b-1):
    t1.append((t[i]+t[i+1])/2)

for _ in range(q):
    x = int(input())
    s_index = bisect.bisect_left(s1, x)
    t_index = bisect.bisect_left(t1, x)
    xs = []
    xt = []
    for i in range(-2, 3):
        if 0 <= s_index + i < a:
            xs.append(s[s_index+i])
        if 0 <= t_index + i < b:
            xt.append(t[t_index+i])
    ans = 10**20
    for i in xs:
        for j in xt:
            ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

    print(ans)

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

a,b,q = map(int,input().split())
s = []
t = []
s1 = []
t1 = []

for _ in range(a):
    s.append(int(input()))
for _ in range(b):
    t.append(int(input()))

for i in range(a-1):
    s1.append((s[i]+s[i+1])/2)
for i in range(b-1):
    t1.append((t[i]+t[i+1])/2)

for _ in range(q):
    x = int(input())
    s_index = bisect.bisect_left(s1, x)
    t_index = bisect.bisect_left(t1, x)
    xs = []
    xt = []
    for i in range(-2, 3):
        if 0 <= s_index + i < a:
            xs.append(s[s_index+i])
        if 0 <= t_index + i < a:
            xt.append(t[t_index+i])
    ans = 10**20
    for i in xs:
        for j in xt:
            ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

    print(ans)
Problem p03150 (python)

Fixed submission:
s = input()
t = 'keyence'

idx = 0
for i in range(len(s)):
    if i < len(t):
        if s[i] != t[i]:
            idx = i
            break
    elif i == len(t):
        print('YES')
        exit()

for i in range(idx,len(s)):
    if s[:idx] + s[i:] == t:
        print('YES')
        exit()

print('NO')

Buggy submission (verdict: Runtime Error):
s = input()
t = 'keyence'

count = 0
count2 = 0
flag = True

for i in s:
    if i == t[count]:
        count += 1
        flag = True
    else:
        if flag:
            count2 += 1
            flag = False
        else:
            pass

if count2 <= 1 and count == len(t):
    print('YES')
else:
    print('NO')
Problem p03262 (python)

Fixed submission:
n,x = map(int,input().split())
li = list(map(int,input().split()))

li2 = [i-x for i in li]
li3 = [abs(i) for i in li2]
b = li3[0]

def gcd(x,y):
    if x < y:
        x,y = y,x
    if y == 0:
        return x
    z = x % y
    return gcd(y,z)

for i in li3:
    b = gcd(b,i)

print(b)

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

li2 = [i-x for i in li]
li3 = [abs(i) for i in li2]
a = min(li3)
flag = 1
b = li3[0]

import math

for i in li3:
    b = math.gcd(b,i)

print(b)

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

li2 = [i-x for i in li]
li3 = [abs(i) for i in li2]
a = min(li3)
flag = 1

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(li3))
Problem p03438 (python)

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

sub1 = 0
sub2 = 0

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        sub2 += (b[i] - a[i]) // 2

if sub1 <= sub2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import heapq

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

sub1 = 0
li = []

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        heapq.heappush(li, a[i] - b[i])

for i in range(sub1):
    x = -heapq.heappop(li)
    if x >= 2:
        heapq.heappush(li, 2-x)
    else:
        print('No')
        exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
import heapq

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

sub1 = 0
li = []

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        heapq.heappush(li, a[i] - b[i])

for i in range(sub1):
    x = -heapq.heappop(li)
    if x >= 2:
        heapq.heappush(li, x-2)
    else:
        print('No')
        exit()

print('Yes')
Problem p03651 (python)

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

if n == 1:
    gcd1 = a[0]
else:
    gcd1 = gcd(a[0], a[1])

    for i in range(2,n):
        gcd1 = gcd(gcd1,a[i])

if k > max(a):
    print('IMPOSSIBLE')
else:
    if k % gcd1 == 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

gcd1 = gcd(a[0], a[1])

for i in range(2,n):
    gcd1 = gcd(gcd1,a[i])

if k > max(a):
    print('IMPOSSIBLE')
else:
    if k % gcd1 == 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
Problem p02681 (python)

Fixed submission:
S = str(input())
T = str(input())
if T[:-1] == S :
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())
result = 0
if K > 0 :
    result = result + A
    K = K - A
for i in range (K):
    if B > 0 :
        B = B-1
    else:
        result = result-1
print(result)

Buggy submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())
i = 0
result = 0
K = K - A
result = result + A
while K > i :
    if B > 0 :
        K = K- B
        B = B -B
    elif C > 0 :
        result = result - 1
        K = K - 1
print(result)
Problem p02717 (python)

Fixed submission:
a,b,c = input().split()
print(c,a,b)

Buggy submission (verdict: Runtime Error):
X = int(input())
Y = int(input())
Z = int(input())
r = X
X = Y
Y = r
r = X
X = Z
Z = r
print(X,Y,Z)
Problem p03029 (python)

Fixed submission:
a,p=map(int,input().split())
c=(a*3)+p
pi=c//2
print(str(pi)+'\n')

Buggy submission (verdict: Runtime Error):
a,p=map(int,input().split())
c=(a*3)+p
pi=c//2
print(c+pi+"¥n")

Buggy submission (verdict: Runtime Error):
def pi(a,p):
  c=0
  pi=0
  while c>2:
    c=a*3+p
    pi=c//2
    
   return pi
Problem p02922 (python)

Fixed submission:
A, B = list(map(int, input().split()))
for i in range(20):
    if B<=1+i*(A-1):
        print(i)
        break

Buggy submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))
B-=1
print((A+B-1)/B)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
B-=1
print((A+B-1)/B)
Problem p02582 (python)

Fixed submission:
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10**6) 

I=sys.stdin.readline

 #s="abcdefghijklmnopqrstuvwxyz"

#
def ii():
	return int(I().strip())
def li():
	return list(map(int,I().strip().split()))
def mi():
	return map(int,I().strip().split())

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x





	

def main():
	s=I().strip()
	arr=s.split("S")
	ans=0
	for i in arr:
		ans=max(ans,len(i))
	print(ans)

	













	
	
	






		







		
		
	
		

	







		









if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
s=I().strip()
arr=s.split("S")
ans=0
for i in arr:
    ans=max(ans,len(i))
print(ans)

Buggy submission (verdict: Runtime Error):
s=I().strip()
	arr=s.split("S")
	ans=0
	for i in arr:
		ans=max(ans,len(i))
	print(ans)
Problem p02639 (python)

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

print(arr.index(0)+1)

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

sett=list(map(int,input().split()))
arr=[i for i in range(-1,102) if i not in sett]

min_=100000
num=0
for i in arr:
	if abs(x-i)<min_:
		min_=abs(x-i)
		num=i



print(num)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
 
for i in range(x+1):
  if i*4+(x-i)*2==y:
    print("Yes")
    break   
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
 
for i in range(x+1):
  if i*4+(x-i)*2==y:
    print("Yes")
    
else:
  print("No")
Problem p02640 (python)

Fixed submission:
x,y=map(int,input().split())
 
for i in range(x+1):
  if i*4+(x-i)*2==y:
    print("Yes")
    break   
else:
  print("No")

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

for i in range(n+1):
  if i*4+(n-i)*2==y:
    print("Yes")
    
else:
  print("No")
Problem p02675 (python)

Fixed submission:
n=int(input())
n=n%10

if n==3:
  print("bon")
elif n==0 or n==1 or n==6 or n==8:
  print("pon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

hour_angle=0.5*(60*h+m)
minute_angle=6*m

diff_angle=abs(hour_angle-minute_angle)

angle=min(360-diff_angle,diff_angle)
cos_angle=math.cos(angle*(math.pi/180))

lenth=math.sqrt(a**2+b**2-(2*a*b*cos_angle))
print(lenth)
Problem p03738 (python)

Fixed submission:
a=int(input())
b=int(input())
if a>b:print("GREATER")
elif a<b:print("LESS")
else:print("EQUAL")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>b:print("GREATER")
elif a<b:print("LESS")
else print("EQUAL")
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if s == t[:-1]:
  print("Yes")
else:
  print("No")

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

Fixed submission:
from collections import deque
def main():
  s = deque(list(input()))
  q = int(input())
  sr = s.reverse
  sa = s.append
  sal = s.appendleft

  cnt = 0
  for _ in range(q):
    t = input()
    if t[0] == "1":
      cnt += 1
    else:
      _,f,c = t.split(" ")
      if f == "1":
        if cnt%2==1:
          sa(c)
        else:
          sal(c)
      else:
        if cnt%2==1:
          sal(c)
        else:
          sa(c)
  if cnt%2 == 1:
    sr()
  print("".join(list(s)))

if __name__=="__main__":
  main()

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
 
cnt = 0
for _ in range(q):
  t = input()
  if t[0] == "1":
    cnt += 1
  else:
    if cnt%2 == 1:
      s = "".join(list(reversed(s)))
      cnt = 0
    _,f,c = t.split(" ")
    if f == "1":
      s = c + s
    else:
      s = s + c
if cnt%2 == 1:
  s = "".join(list(reversed(s)))
  cnt = 0
 
print(s)
s = input()
q = int(input())

cnt = 0
for _ in range(q):
  t = input()
  if t[0] == "1":
    cnt += 1
  else:
    if cnt%2 == 1:
      s = "".join(list(reversed(s)))
      cnt = 0
    _,f,c = t.split(" ")
    if f == "1":
      s = c + s
    else:
      s = s + c
if cnt%2 == 1:
  s = "".join(list(reversed(s)))
  cnt = 0

print(s)
Problem p02982 (python)

Fixed submission:
import numpy as np
 
n, d = map(int, input().split())
 
p = np.zeros((n,d))
 
for i in range(n):
  p[i] = np.array(list(map(int, input().split())))
cnt = 0
d = 0
for i in range(n):
  for j in range(i+1,n):
    d = np.sqrt(np.sum((p[i] - p[j]) ** 2))
    if d % 1 == 0:
      cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np

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

p = np.zeros(n,d)

for i in range(n):
  p[i] = np.array(list(map(int, input().split())))

cnt = 0
d = 0
for i in range(n):
  for j in range(i+1,n):
    d = np.sqrt((p[i] - p[j]) ** 2)
    if d % 1 == 0:
      cnt += 1

print(cnt)
Problem p02993 (python)

Fixed submission:
p = input()

for i in range(3):
  if p[i] == p[i + 1]:
    print("Bad")
    quit()
print("Good")

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

for i in range(3):
  if p[i] == p[i + 1]:
    print("Bad")
    quit()
print("Good")
Problem p02995 (python)

Fixed submission:
from fractions import gcd
a, b, c, d = map(int, input().split())
s = b - a + 1

def dev(x):
    if a % x == 0:
        return b // x - a // x + 1
    return b // x - a // x

g = gcd(c, d)
print(s - (dev(c) + dev(d) - dev(c * d // g)))

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())
s = b - a + 1

def dev(x):
    if a % x == 0:
        return b // x - a // x + 1
    return b // x - a // x

print(s - (dev(c) + dev(d) - dev(c * d // math.gcd(c, d))))
Problem p02645 (python)

Fixed submission:
str = input()
 
str_length = len(str)
 
import random
 
start_num = random.randint(0,str_length-3)
 
print(str[start_num:start_num+3])

Buggy submission (verdict: Runtime Error):
str = input()

str_length = len(str)

import randum

start_num = randum.randint(0,str_length-3)

print(str[start_num:start_num+2])

Buggy submission (verdict: Runtime Error):
print(S[0:2])
Problem p03456 (python)

Fixed submission:
import math 

list=input().split()

num=int(list[0]+list[1])

num_squrt=math.sqrt(num)

if num_squrt.is_integer()==True:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):

list=input().split()

num=int(list[0]+list[1])

num_squrt=math.sqrt(num)

if num_squrt.is_integer()==True:
    print("Yes")
else:
    print("No")
Problem p02922 (python)

Fixed submission:
a, b = map(int, input().split())
print((b-2) // (a - 1) + 1)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
ans = sum(a[i] == b[i] for i in range(3))
print(ans)
Problem p02641 (python)

Fixed submission:
def actual(X, N, P):
    for i in range(X, -1 - 1, -1):
        if i not in P:
            left = i
            break

    for i in range(X, 101 + 1):
        if i not in P:
            right = i
            break

    if abs(left - X) <= abs(right - X):
        answer = left
    else:
        answer = right

    return answer


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

if N == 0:
    P = []
    print(actual(X, N, P))
else:
    P = list(map(int, input().split()))
    print(actual(X, N, P))

Buggy submission (verdict: Runtime Error):
def actual(X, N, P):
    for i in range(X, -1, -1):
        if i not in P:
            left = i
            break

    for i in range(X, 101):
        if i not in P:
            right = i
            break

    if abs(left - X) <= abs(right - X):
        return left
    else:
        return right


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

if N == 0:
    print(X)
else:
    P = list(map(int, input().split()))
    print(actual(X, N, P))

Buggy submission (verdict: Runtime Error):
def actual(X, N, P):
    for i in range(X, -1, -1):
        if i not in P:
            left = i
            break

    for i in range(X, 101):
        if i not in P:
            right = i
            break

    if abs(left - X) <= abs(right - X):
        return left
    else:
        return right


X, N = map(int, input().split())
P = input()

if P == '':
    print(X)
else:
    P = list(map(int, P.split()))
    print(actual(X, N, P))
Problem p02657 (python)

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

print(a * b)

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

part1 = s[:k - 1]
part2 = s[k - 1].lower()
part3 = s[k:]

print(f'{part1}{part2}{part3}')
Problem p02681 (python)

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

if s == t[:-1]:
	print('Yes')
else:
  	print('No')

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


def actual(a, b, c, k):
    if a >= k:
        return k
    else:
        k -= a

    if b >= k:
        return a
    else:
        k -= b

    return a - k


print(actual(a, b, c, k))

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


def actual(a, b, c, k):
    if a >= k:
        return k
    else:
        k -= a

    if b >= k:
        return a
    else:
        k -= b

    return a - k

  
print(actual(a, b, c, k))

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

def actual(a, b, c, k):
    if a >= k:
        return k
    else:
        k -= a

    if b >= k:
        return a
    else:
        k -= b

    return a - k

  
print(actual(a, b, c, k))