Problem p03041 (python)

Fixed submission:
import sys

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

abcs = input()
 
def change_upper_to_lower(str, num):
  
  before = str[:int(num) - 1]
  after = str[int(num):]

  if(str[int(num) - 1] == "A"):
    newstr = before + "a" + after
  elif(str[int(num) - 1] == "B"):
    newstr = before + "b" + after
  else:
    newstr = before + "c" + after
    
  return newstr
 
 
changed_abcs = change_upper_to_lower(abcs, b)
 
print(changed_abcs)

Buggy submission (verdict: Runtime Error):
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)

Buggy submission (verdict: Runtime Error):
import sys
 
args = sys.argv
 
length = args[1]
focus = args[2]
abcs = args[3]
 
 
def change_upper_to_lower(str, num):
  
  before = str[:int(num) - 1]
  after = str[int(num):]

  if(str[int(num) - 1] == "A"):
    newstr = before + "a" + after
  elif(str[int(num) - 1] == "B"):
    newstr = before + "b" + after
  else:
    newstr = before + "c" + after
    
  return newstr
 
 
changed_abcs = change_upper_to_lower(abcs, focus)
 
print(changed_abcs)

Buggy submission (verdict: Runtime Error):
import sys
 
args = sys.argv
 
length = args[1]
focus = args[2]
abcs = args[3]
 
 
def change_upper_to_lower(str, num):
  
  before = str[:int(num) - 1]
  print(before)
  after = str[int(num):]
  print(after)

  if(str[int(num) - 1] == "A"):
    newstr = before + "a" + after
  elif(str[int(num) - 1] == "B"):
    newstr = before + "b" + after
  else:
    newstr = before + "c" + after
    
  return newstr
 
 
changed_abcs = change_upper_to_lower(abcs, focus)
 
print(changed_abcs)

Buggy submission (verdict: Runtime Error):
import sys
 
args = sys.argv
 
length = args[1]
focus = args[2]
abcs = args[3]
 
 
def change_upper_to_lower(str, num):
  if(str[int(num)] == "A"):
    str[int(num)] = "a"
  elif(str[int(num)] == "B"):
    str[int(num)] = "b"
  else:
    str[int(num)] = "c"
    
  return str
 
 
changed_abcs = change_upper_to_lower(abcs, focus)
 
print(changed_abcs)

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv

length = args[1]
focus = args[2]
abcs = args[3]


def change_upper_to_lower(str, num):
  if(str[int(num)] == "A"):
    str[int(num)] == "a"
  elif(str[int(num)] == "B"):
    str[int(num)] == "b"
  else:
    str[int(num)] == "c"
    
  return str


changed_abcs = change_upper_to_lower(abcs, focus)

print(changed_abcs)

Buggy submission (verdict: Runtime Error):
import sys
 
args = sys.argv
 
length = args[1]
focus = args[2]
abcs = args[3]
 
def change_upper_to_lower(str, num):
  if(str[num] == "A"):
    str[num] == "a"
  elif(str[num] == "B"):
    str[num] == "b"
  else:
    str[num] == "c"
    
change_upper_to_lower(abcs, focus)
 
print(abcs)

Buggy submission (verdict: Runtime Error):
import sys
 
args = sys.argv
 
length = arg[1]
focus = int(arg[2])
abcs = arg[3]
 
def change_upper_to_lower(str, num):
  if(str[num] == "A"):
    str[num] == "a"
  elif(str[num] == "B"):
    str[num] == "b"
  else:
    str[num] == "c"
    
change_upper_to_lower(abcs, focus)
 
print(abcs)

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv

length = arg[1]
focus = arg[2]
abcs = arg[3]

def change_upper_to_lower(str, num):
  if(str[num] == "A"):
    str[num] == "a"
  elif(str[num] == "B"):
    str[num] == "b"
  else:
    str[num] == "c"
    
change_upper_to_lower(abcs, focus)

print(abcs)