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

Fixed submission:
from collections import Counter

n = int(input())
vs = input().split()
even = []
odd = []

if len(list(set(vs))) == 1:
  res = int(len(vs) / 2)
else:
  for i, v in enumerate(vs):
    if i % 2 == 0:
      even.append(int(v))
    else:
      odd.append(int(v))
  counter_even = Counter(even)
  counter_odd = Counter(odd)
  if counter_even.most_common()[0][0] != counter_odd.most_common()[0][0]:
    res = len(even) - counter_even.most_common()[0][1]  + len(odd) - counter_odd.most_common()[0][1]
  else:
    res1 = len(even) - counter_even.most_common()[1][1]  + len(odd) - counter_odd.most_common()[0][1]
    res2 = len(even) - counter_even.most_common()[0][1]  + len(odd) - counter_odd.most_common()[1][1]
    res = min(res1, res2)
print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
vs = input().split()
even = []
odd = []
if not even == odd:
  for i, v in enumerate(vs):
  	if i % 2 == 0:
    	even.append(int(v))
    else:
    	odd.append(int(v))
  counter_even = Counter(even)
  counter_odd = Counter(odd)

  res = len(even) - counter_even.most_common()[0][1] + len(odd) - counter_odd.most_common()[0][1] 
else:
  res = len(even)
print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
vs = input().split()
even = []
odd = []
if not even == odd:
  for i, v in enumerate(vs):
  	if i % 2 == 0:
    	even.append(int(v))
    else:
    	odd.append(int(v))
  counter_even = Counter(even)
  counter_odd = Counter(odd)

  res = len(even) - counter_even.most_common()[0][1] + len(odd) - counter_odd.most_common()[0][1] 
else:
  res = len(even)
print(res)
Problem p03282 (python)

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

for i in range(min(len(s),k)):
    if s[i] != '1':
        print(s[i])
        quit()
 
print('1')

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

if len(set(s)) == 1 and set(s)[0] == set(['1']):
  print(1)
else:
  for elem in s:
    if int(elem) == 1:
      pass
    else:
      print(elem)
      break
Problem p03417 (python)

Fixed submission:
n, m = map(int, input().split())
if n >= 2:
  if m >= 2:
    print((n-2) * (m-2)) 
  else:
    print((n-2) * m)
else:
  if m >= 2:
    print(n * (m-2)) 
  else:
    print(n * m)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
if n >= 2:
  if m >= 2:
    print((n-2) * (m-2)) 
  else:
    print((n-2) * m)
else:
  if m >= 2:
    print(n * (m-2)) 
  else:
    print(n * m)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
print((n-2) * (m-2))
Problem p03469 (python)

Fixed submission:
s = input()

y, m, d = s.split("/")
print("2018/" + m + "/" + d)

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

y, m, d = s.split("/")
print("2018/" + m + "/" d)

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

y, m, d = s.split("/")
print("2018/" m + "/" d)
Problem p03565 (python)

Fixed submission:
S,T=input(),input()
l,m=len(S),len(T)
 
for i in range(l-m+1):
  if all(c in"?"+d for c,d in zip(S[-i-m:],T)):
    S=S.replace("?","a")
    print(S[:-i-m]+T+S[l-i:])
    quit()
 
print("UNRESTORABLE")

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

flag = 0
if t in s:
  s = s.replace('?', 'a')
  print(s)
  flag = 1
if '?' * len(t) in s:
  s = s[::-1]
  s = s.replace((t[:i] + '?' * (len(t) - i))[::-1], t[::-1], 1)
  s = s.replace('?', 'a')
  print(s[::-1])
  flag = 1          

if flag == 0:
  for i in range(0, len(t)):
    for j in range(i+1, len(t)):
      if ('?' * i + t[i:j] + '?' * (len(t) - j)) in s:
        s = s[::-1]
        s = s.replace((t[:i] + '?' * (len(t) - i))[::-1], t[::-1], 1)
        s = s.replace('?', 'a')
        print(s[::-1])
        flag = 1
        break
    
if flag == 0:
	print('UNRESTORABLE')
Problem p03828 (python)

Fixed submission:
def solve():
    n = int(input())
    keta = [0] * (n+1)
    for i in range(2, n+1):
        for j in range(2, int(pow(i, 0.5))+1):
            if i % j: continue
            ex = 0
            while i % j == 0:
                i = i // j
                ex += 1
            keta[j] += ex
        if i != 1:
            keta[i] += 1

    mod = 1000000007
    ans = 1
    for ex in keta:
        ans = ans * (ex + 1)
        ans %= mod
    print(ans)

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
fac_n = math.factorial(n)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
print(len(make_divisors(fac_n)) % (10**9+7))

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
fac_n = math.factorial(n)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
print(len(make_divisors(fac_n)) % (10**9+7))

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
fac_n = math.factorial(n)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
print(len(make_divisors(fac_n)))
Problem p02576 (python)

Fixed submission:
N, X, T = map(int, input().split())
print((N + X - 1) // X * T)

Buggy submission (verdict: Runtime Error):
N, X, T = map(int, input.split())
print((N + X - 1) / X * T)
Problem p02606 (python)

Fixed submission:
l, r, d = map(int, input().split())
print(r // d - (l - 1) // d)

Buggy submission (verdict: Runtime Error):
l, r, d = map(int, input())
print(r // d - (l - 1) // d)
Problem p02663 (python)

Fixed submission:
H1, M1, H2, M2, K = map(int, input().split())
ans = 60*H2+M2 - (60*H1+M1) - K
print(ans)

Buggy submission (verdict: Runtime Error):
H1, M1, H2, M2, K = map(int, input().split())
ans = 60*H2+M2 - 60*H1+M1
print(ans)H1, M1, H2, M2, K = map(int, input().split())
ans = 60*H2+M2 - 60*H1+M1 - K
print(ans)
Problem p02995 (python)

Fixed submission:
import fractions
def lcm(x, y):
    return (x*y) // fractions.gcd(x,y)
A, B, C, D = map(int,input().split())
L = lcm(C,D)
#A-1以下のCorDで割り切れる個数
a = (A-1)//C + (A-1)//D - (A-1)//lcm(C,D)
#B以下のCorDで割り切れる個数
b = B//C + B//D - B//lcm(C,D)
ans = B-(A-1) - (b-a)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x*y) // math.gcd(x,y)
A, B, C, D = map(int,input().split())
L = lcm(C,D)
#A-1以下のCorDで割り切れる個数
a = (A-1)//C + (A-1)//D - (A-1)//lcm(C,D)
#B以下のCorDで割り切れる個数
b = B//C + B//D - B//lcm(C,D)
ans = B-(A-1) - (b-a)
print(ans)
Problem p03129 (python)

Fixed submission:
N, K = map(int, input().split())
if N >= K * 2 - 1:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N, K = map(int(input().split()))
if N >= k * 2 - 1:
  print("YES")
else:
  print("NO")
Problem p03140 (python)

Fixed submission:
n = int(input())
a, b, c = input(), input(), input()
ans = 0
for i in range(n):
  ans += len(set([a[i], b[i], c[i]])) - 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a, b, c = input(), input(), input()
ans = 0
for i in range(n):
  ans += len(set(a[i], b[i], c[i])) - 1
print(ans)
Problem p03227 (python)

Fixed submission:
s = input()
if len(s) == 3:
  s = s[::-1]
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
if len(s) == 3:
  s.reverse()
print(s)
Problem p03282 (python)

Fixed submission:
S = input()
K = input() 
ans = 1
if not all([i == '1' for i in S[:int(K)]]):
    for i in range(len(S)):
        if S[i] != '1':
            ans = int(S[i])
            break
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = input() 
if S[int(K)-1] == '1':
    ans = 1
else:
    for i in range(len(S)):
        if S[i] != '1':
            ans = int(S[i])
            break
print(ans)
Problem p03711 (python)

Fixed submission:
x, y = map(int, input().split())
list1 = [1,3,5,7,8,10,12,4,6,9,11,2]
list2 = [0,0,0,0,0,0,0,1,1,1,1,2]
d = dict(zip(list1, list2))
if d[x] == d[y]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
list1 = [1,3,5,6,8,10,12,4,6,9,11,2]
list2 = [0,0,0,0,0,0,0,1,1,1,1,2]
d = dict(zip(list1, list2))
if d[x] == d[y]:
  print("Yes")
else:
  print("No")
Problem p03909 (python)

Fixed submission:
H, W = map(int, input().split())
flag = False
for i in range(H):
    S = list(input().split())
    for j, s in enumerate(S):
        if s == "snuke":
            print(chr(ord('A')+j)+str(i+1))
            flag = True
            break

    if flag:
        break

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
flag = False
for i in range(H):
    for j in range(W):
        s = input()
        if s == "snuke":
            print(chr(ord('A')+j)+str(i+1))
            flag = True
            break

    if flag:
        break
Problem p03998 (python)

Fixed submission:
A, B, C = [list(input()) for _ in range(3)]
x = 'a'
while True:
    if x == 'a':
        if len(A) == 0:
            print('A')
            exit()
        x = A[0]
        A.remove(x)
    elif x == 'b':
        if len(B) == 0:
            print('B')
            exit()
        x = B[0]
        B.remove(x)   
    elif x == 'c':
        if len(C) == 0:
            print('C')
            exit()
        x = C[0]
        C.remove(x)

Buggy submission (verdict: Runtime Error):
A, B, C = [input() for _ in range(3)]
ca = 1
cb = 0
cc = 0
current = A[0]
while True:
    if current == 'a':
        ca += 1
        if ca == len(A):
            print('A')
            break    
        else:
            current =  A[ca]
    elif current == 'b':
        cb += 1
        if cb == len(B):
            print('B')
            break    
        else:
            current =  B[cb]
    elif current == 'c':
        cc += 1
        if cc == len(C):
            print('C')
            break    
        else:
            current =  C[cc]
Problem p02621 (python)

Fixed submission:
x=int(input())
print(x+x**2+x**3)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
book_list = list(map(int,input().split()))
book_list.extend(list(map(int,input().split())))
book_list.sort()
count=0
readTime=0
for i in range(n+m):
    if readTime+book_list[i]<=k:
        count+=1
        readTime+=book_list[i]
    else:
        break
print(count)
Problem p02576 (python)

Fixed submission:
n, x, t = map(int, input().split())
if n % x == 0:
  print(int(n/x*t))
else:
  print(int((n//x+1)*t))

Buggy submission (verdict: Runtime Error):
n = input()
total = 0
for i in range(len(n)):
  total += int(n[i])
if total % 9 == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n, x, t = map(int, input())
print((n//x+1)*t)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = int(input())
t = int(input())
print((n//x+1)*t)

Buggy submission (verdict: Runtime Error):
n, x, t = int(input()).split(" ")
print((n//x+1)*t)

Buggy submission (verdict: Runtime Error):
n, x, t = int(input())
print((n//x+1)*t)
Problem p02687 (python)

Fixed submission:
s = input()

if s == 'ABC':
    print('ARC')
elif s == 'ARC':
    print('ABC')

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(2000)

n,k = map(int,input().split())
lisN = list(range(1,n+1))
lis = set([])

for i in range(k):
    a =int(input())
    for j in range(a):
        lis.add(int(input()))
        

    
print(len(set(lisN) ^ set(lis)))
Problem p02694 (python)

Fixed submission:

x = int(input())
counter = 0
goukei = 100

while goukei < x:
    goukei += int( goukei * 0.01)
    counter += 1
    
print(counter)

Buggy submission (verdict: Runtime Error):
##import math

x = int(input())
counter = 0
goukei = 100

while goukei < x:
    counter += 1
    goukei += int(1 + counter * 0.01)
    print(goukei)

    
print(counter)
Problem p03160 (python)

Fixed submission:
import sys
n = int(input())
l = list(map(int, input().split()))
dp = [sys.maxsize] *n
dp[0] = 0
for i in range(n):
    for j in range(i+1,i+3):
        if(j<n):
            dp[j]=min(dp[j],dp[i]+abs(l[i]-l[j]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import sys
n,k = map(int,input().split())
l = list(map(int, input().split()))
dp = [sys.maxsize] *n
dp[0] = 0
for i in range(n):
    for j in range(i+1,i+k+1):
        if(j<n):
            dp[j]=min(dp[j],dp[i]+abs(l[i]-l[j]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import sys
import math
n = int(sys.stdin.readline())
l = list(map(int, input().split()))
dp = [math.inf] *n
dp[0] = 0
for i in range(n):
    for j in range(i+1,i+3):
        if(j<n):
            dp[j]=min(dp[j],dp[i]+abs(l[i]-l[j]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import sys
import math
n = int(sys.stdin.readline())
l = list(map(int, input().split()))
dp = [math.inf] *n
dp[0] = 0
for i in range(n):
    for j in range(i+1,i+3):
        if(j<n):
            dp[j]=min(dp[j],dp[i]+abs(l[i]-l[j]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import sys
import math
dp = [math.inf] * 1000000
dp[0] = 0
def frog(n,l):
    for i in range(n):
        for j in range(i+1,i+3):
            if(j<n):
                dp[j]=min(dp[j],dp[i]+abs(l[i]-l[j]))
    return dp[n-1]
if __name__ == "__main__":
        n = int(sys.stdin.readline())
        l = list(map(int, input().split()))
        sys.stdout.write(str(frog(n,l))+"\n")

Buggy submission (verdict: Runtime Error):
import sys
import math
dp = [math.inf] * 1000000
def frog(n,l):
    dp[0]=0
    for i in range(n):
        for j in range(i+1,i+3):
            if(j<n):
                dp[j]=min(dp[j],dp[i]+abs(l[i]-l[j]))
    return dp[n-1]
if __name__ == "__main__":
    t = int(sys.stdin.readline())
    for _ in range(t):
        n = int(sys.stdin.readline())
        l = list(map(int, input().split()))
        sys.stdout.write(str(frog(n,l))+"\n")

Buggy submission (verdict: Runtime Error):
import sys
import math
def frog(n,l):
    dp=[math.inf]*n
    dp[0]=0
    for i in range(n):
        for j in range(i+1,i+3):
            if(j<n):
                dp[j]=min(dp[j],dp[i]+abs(l[i]-l[j]))
    return dp[n-1]
if __name__ == "__main__":
    t = int(sys.stdin.readline())
    for _ in range(t):
        n = int(sys.stdin.readline())
        l = list(map(int, input().split()))
        sys.stdout.write(str(frog(n,l))+"\n")
Problem p02548 (python)

Fixed submission:
N = int(input())
nd = [0] * (N+1)
for i in range(1, N):
    for j in range(i, N, i):
        nd[j] += 1
print(sum(nd))

Buggy submission (verdict: Runtime Error):
 N = int(input())
nd = [0] * (N+1)
for i in range(1, N):
    for j in range(i, N, i):
        nd[j] += 1
print(sum(nd))
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B, C = [], []
for i in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)
data = {}
SUM = sum(A)
for i in range(N):
    if A[i] in data:
        data[A[i]] += 1
    else:
        data[A[i]] = 1
for i in range(Q):
    if B[i] in data:
        SUM += data[B[i]]*(C[i]-B[i])
        if C[i] in data:
            data[C[i]] += data[B[i]]
        else:
            data[C[i]] = data[B[i]]
        data[B[i]] = 0
    print(SUM)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B, C = [], []
for i in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)
data = {}
SUM = sum(A)
for i in range(N):
    if A[i] in data:
        data[A[i]] += 1
    else:
        data[A[i]] = 1
for i in range(Q):
    if B[i] in data:
        SUM += data[B[i]]*(C[i]-B[i])
        data[C[i]] += data[B[i]]
        data[B[i]] = 0
    print(SUM)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B, C = [], []
for i in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)
data = {}
SUM = sum(A)a
for i in range(N):
    if A[i] in data:
        data[A[i]] += 1
    else:
        data[A[i]] = 1
for i in range(Q):
    if B[i] in data:
        SUM += data[B[i]]*(C[i]-B[i])
        data[C[i]] += data[B[i]]
        data[B[i]] = 0
    print(SUM)
Problem p02660 (python)

Fixed submission:
N = int(input())
n = min(N, 10**6)
is_Prime = [True] * (n + 1)
is_Prime[0] = False
is_Prime[1] = False
for i in range(2, int(n**(1/2)+1)):
    for j in range(2*i, n+1, i):
        if j % i == 0:
            is_Prime[j] = False
P = [i for i in range(n+1) if is_Prime[i]]

count = 0
for p in P:
    count_p = 0
    while N % p == 0:
        count_p += 1
        N /= p
    count += int((-1+(1+8*count_p)**(1/2))/2)
    if p == P[-1] and N != 1:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
is_Prime = [True] * (10**6 + 1)
is_Prime[0] = False
is_Prime[1] = False
for i in range(2, int(10**3)+1):
    for j in range(2*i, 10**6+1, i):
        if j % i == 0:
            is_Prime[j] = False
P = [i for i in range(n+1) if is_Prime[i]]

N = int(input())
count = 0
for p in P:
    count_p = 0
    while N % p == 0:
        count_p += 1
        N /= p
    count += int((-1+(1+8*count_p)**(1/2))/2)
    if p == P[-1] and N != 1:
        count += 1
print(count)
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
s = []
c = []
if M == 0:
    if N != 1:
        print(10**(N-1))
    else:
        print(0)
else:   
    for i in range(M):
        s_i, c_i = map(int, input().split())
        s.append(s_i)
        c.append(c_i)
    if N != 1:
        for i in range(10**(N-1), 10**N):
            for j in range(M):
                if str(i)[s[j]-1] != str(c[j]):
                    break
                if j == M - 1:
                    print(i)
                    c = 1
                    break
            if c == 1:
                break
            if i == 10**N -1:
                print(-1)
    else:
        for i in range(0, 10):
            for j in range(M):
                if str(i)[s[j]-1] != str(c[j]):
                    break
                if j == M - 1:
                    print(i)
                    c = 1
                    break
            if c == 1:
                break
            if i == 10**N -1:
                print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s = []
c = []
for i in range(M):
    s_i, c_i = map(int, input().split())
    s.append(s_i)
    c.append(c_i)
sc.sort(key = lambda x: x[0], reverse = True)
for i in range(10**(N-1), 10**N):
    for j in range(M):
        if str(i)[s[j]-1] != str(c[j]):
            break
        if j == M - 1:
            print(i)
            c = 1
            break
    if c == 1:
        break
    if i == 10**N -1:
        print(-1)
Problem p02717 (python)

Fixed submission:
string = input().split(" ")
print(string[2], string[0], string[1])

Buggy submission (verdict: Runtime Error):
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])

a = input().split(" ")

total = 0
for v in a:
  total += int(a)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")
Problem p02718 (python)

Fixed submission:
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])
 
a = input().split(" ")
 
total = 0
for v in a:
  total += int(v)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
= input().split(" ")
n = int(nm[0])
m = int(nm[1])
 
a = input().split(" ")
 
total = 0
for v in a:
  total += int(v)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])

a = input().split(" ")

total = 0
for v in a:
  total += int(a)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])

a = input().split(" ")

total = 0
for v in a:
  total += int(a)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes", end="")
else:
  print("No", end="")
Problem p02755 (python)

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

found = False
for i in range(1, 10000):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        found = True
        break

if not found:
    print(-1)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split(" "))
for i in range(1, 10000):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        return
print(-1)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split(" "))
for i in range(1, 1009):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        return
print(-1)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split(" "))
for i in range(1, 1009):
    if i * 0.08 == a and i * 0.1 == b:
        print(i)
        return
print(-1)
Problem p02582 (python)

Fixed submission:
weather=list(input())
r= weather. count("R")
if r==2 and weather[1]=="S":
   print(1)
else:
   print(r)

Buggy submission (verdict: Runtime Error):
list(input())
r= weather. count("R")
if r==2 and weather[1]=="S":
   print(1)
else:
   print(r)

Buggy submission (verdict: Runtime Error):
a

Buggy submission (verdict: Runtime Error):
weather=input()
s=count(R)
if s=2 and weather[2]=R:
  s=s-1
print(s)
Problem p02584 (python)

Fixed submission:
X,K,D=map(int, input().split())
X=abs(X)
if X-K*D>0:
  print(X-K*D)
else:
  if K%2==0:
    s=X-2*D*int(X/(2*D))
    t=-(s-2*D)
    print(min(abs(s),t))
    
  else:
    s=X-2*D*int((X-D)/(2*D))-D
    t=-(s-2*D)
    
    print(min(abs(s),t))

Buggy submission (verdict: Runtime Error):
X,K,D=map(int, input().split())
X=abs(X)
if X-K*D>0:
  print(X-K*D)
else:
  if K%2==0:
    s=X-2*D*int(X/(2*D))
    t=-(s-2*D)
    if s<t:
      print(s)
    else:
      print(t)
  else:
    s=X-2*D*int((X-D)/(2*D))+D
    t=-(s-2*D)
    r=s-2D
    print(min(s,t,r))