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

Fixed submission:
N,A,B = [int(i) for i in input().split()]
N_str = str(N)

sum = 0
S = 0
for i in range(N+1):
    i_str=str(i)
    for k in range(len(i_str)):
        sum += int(i_str[k])
    if(sum >= A and sum <=B):
        S += i
    sum = 0
print(S)

Buggy submission (verdict: Runtime Error):
N,A,B = [int(i) for i in input().split()]
N_str = str(N)

sum = 0
for i in range(N+1):
    i_str=str(i)
    for k in range(len(i_str)):
        sum += int(i_str[k])
    if(sum >= A and sum <=B):
        S += i
    sum = 0
print(S)
Problem p03485 (python)

Fixed submission:
a,b = [int(i) for i in input().split()]
x= (a+b)/2
if((a+b)%2 == 0):
    print(int(x))
else:
    print(int(x)+1)

Buggy submission (verdict: Runtime Error):
a,b = [int(i)for i in input().spilt()]
x= (a+b)/2
if((a+b)%2 == 0):
    print(int(x))
else:
    print(int(x)+1)
Problem p03486 (python)

Fixed submission:
s = ''.join(sorted(input()))
t = ''.join(sorted(input(),reverse=True))
if(s<t):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = sorted(list(input()))
t = sorted(list(input()))
ns = len(s)
nt = len(t)
can = True
if(ns<nt):
    for i in range(ns):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
else:
    can = False
    for i in range(nt):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
if(can):
    print('Yes')
else:
    print('No')
    A

Buggy submission (verdict: Runtime Error):
s = list(input()).sort()
t = list(input()).sort()
ns = len(s)
nt = len(t)
can = True
if(ns<nt):
    for i in range(ns):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
else:
    can = False
    for i in range(nt):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
if(can):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input().split().sort()
t = input().split().sort()
ns= len(s)
nt= len(t)
can = True
for i in range(min(ns,nt)):
    if(s[i] > t[i]):
       can = False
       break
if(can and ns < nt):
    print('Yes')
else:
    print('No')
Problem p03493 (python)

Fixed submission:
str = input()
counter = 0
for i in range(len(str)):
    if(str[i]=="1"):
        counter += 1
print(counter)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
count= 0
while(True):
    exist_odd = False
    for i in range(N):
        if(A[i]%2 != 0):
            exist_odd = True
    if(exist_odd == True):
        break
    for i in range(N):
        A[i] /= 2
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int,input().split()))
count= 0
while(true):
    exist_odd = False
    for i in range(N):
        if(A[i]%2 != 0):
            exist_odd = True
    if(exist_odd == True):
        break
    for i in range(N):
        A[i] /= 2
    count += 1
print(count)
Problem p03494 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count= 0
while(True):
    exist_odd = False
    for i in range(N):
        if(A[i]%2 != 0):
            exist_odd = True
    if(exist_odd == True):
        break
    for i in range(N):
        A[i] /= 2
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = input()
A = list[map(int,input().split())]
count= 0
while(true):
    exist_odd = False
    for i in range(N):
        if(A[i]%2 != 0):
            exist_odd = True
    if(exist_odd == True):
        break
    for i in range(N):
        A[i] /= 2
    count += 1
print(count)
Problem p03644 (python)

Fixed submission:
N = int(input())
counter =-1 
number = 0
for i in range(N):
    k = i+1
    now_counter = 0
    while(k % 2 == 0):
        now_counter += 1
        k /= 2
    if(now_counter > counter):
        number = i+1
        counter = now_counter
print(number)

Buggy submission (verdict: Runtime Error):
N = int(input())
counter =-1 
number = 0
for i+1 in range(N):
    k = i
    now_counter = 0
    while(k % 2 == 0):
        now_counter += 1
        k /= 2
    if(now_counter > counter):
        number = i
print(number)
Problem p02953 (python)

Fixed submission:
# coding: utf8

def read_int():
    return int(input())
 
 
def read_int_n():
    return list(map(int, input().split()))
 
 
def read_str():
    return input()
 
 
def read_str_n():
    return list(map(int, input().split()))


def main():
    n = read_int()
    h = read_int_n()
    h[0] -= 1
    for i in range(1, n - 1):
        if h[i-1] < h[i]:
            h[i] -= 1
        if h[i] > h[i + 1]:
            print('No')
            return
    print('Yes')

main()

Buggy submission (verdict: Runtime Error):
# coding: utf8

def read_int():
    return int(input())
 
 
def read_int_n():
    return list(map(int, input().split()))
 
 
def read_str():
    return input()
 
 
def read_str_n():
    return list(map(int, input().split()))

def main():
    n = read_int()
    h = read_int_n()
    h[0] -= 1
    for i in range(1, n):
        if h[i-1] < h[i]:
            h[i] -= 1
        elif h[i] >  h[i + 1]:
            print('No')
            return
    print('Yes')

main()
Problem p03261 (python)

Fixed submission:
# coding: utf8

if __name__ == "__main__":
    n = int(input())
    w = []
    flag = True
    for _ in range(n):
        a = input()
        if len(w) == 0:
            w.append(a)
            continue
        last = w[len(w)-1]
        if a[0] != last[len(last)-1] or a in w:
            flag = False
            break
        w.append(a)
    if flag == True:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf8

if __name__ == "__main__":
    n = int(input())
    w = []
    flag = True
    for _ in range(n):
        a = input()
        last = w[len(w)-1]
        if a[0] != last[len(last)-1] and a in w:
            flag = False
            print("No")
            break
        w.append(a)
    if flag == True:
        print("Yes")

Buggy submission (verdict: Runtime Error):
# coding: utf8

n = int(input())
w = []
flag = True
for _ in range(n):
    a = input()
    last = w[len(w)-1]
    if a[0] != last[len(last)-1] and a in w:
        flag = False
        print("No")
        break
    w.append(a)
if flag == True:
    print("Yes")
Problem p03262 (python)

Fixed submission:
# coding: utf8

from functools import reduce

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

def gcd(*numbers):
    return reduce(gcda, numbers)


def read_int_n():
    return list(map(int, input().split()))


if __name__ == "__main__":
    n, x = read_int_n()
    y = read_int_n()
    y.append(x)

    y.sort()
    w = [y[i] - y[i-1] for i in range(1, len(y))]
    print(gcd(*w))

Buggy submission (verdict: Runtime Error):
# coding: utf8

import math
from functools import reduce

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


def read_int_n():
    return list(map(int, input().split()))


n, x = read_int_n()
y = read_int_n()
y.append(x)

y.sort()
w = [y[i] - y[i-1] for i in range(1, len(y))]
print(gcd(*w))
Problem p02993 (python)

Fixed submission:
import sys

fin = sys.stdin.readline
num = str(fin()).split()[0]

readable = True
prev_num = num[0]
for i in range(1, 4):
    cur_num = num[i]
    if prev_num == cur_num:
        readable = False
    prev_num = cur_num

if readable:
    print('Good')
else:
    print('Bad')

Buggy submission (verdict: Runtime Error):
import sys

fin = sys.stdin.readline
num = str(int(fin()))

readable = True
prev_num = num[0]
for i in range(1, 4):
    cur_num = num[i]
    if prev_num == cur_num:
        readable = False
    prev_num = cur_num

if readable:
    print('Good')
else:
    print('Bad')
Problem p03067 (python)

Fixed submission:
import sys
a = []
for l in sys.stdin:
    a.append(l)

zahyou = [int(x) for x in a[0].split()]
a, b, c = zahyou
if max(zahyou) == c or min(zahyou) == c:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
import sys


def count(split_haichi):
    black_count = sum([x == '#' for x in split_haichi])
    white_count = len(split_haichi) - black_count
    return min(black_count, white_count)


a = []
for l in sys.stdin:
    a.append(l)

num = int(a[0])
haichi = a[1]
count_list = []

black_all_count = sum([x == '#' for x in haichi])
white_all_count = num - black_all_count
for i in range(num-1):
    if haichi[i] == '#':
        split_haichi_1 = haichi[:i+1]
        split_haichi_2 = haichi[i+1:]

        black_count_1 = sum([x == '#' for x in split_haichi_1])
        white_count_1 = len(split_haichi_1) - black_count_1

        black_count_2 = black_all_count - black_count_1
        white_count_2 = white_all_count - white_count_1

        count_list.append(min(black_count_1, white_count_1) + min(black_count_2, white_count_2))

print(min(count_list))

Buggy submission (verdict: Runtime Error):
import sys

def count(split_haichi):
    black_count = sum([x == '#' for x in split_haichi])
    white_count = sum([x == '.' for x in split_haichi])
    return min(black_count, white_count)

a = []
for l in sys.stdin:
    a.append(l)

num = int(a[0])
haichi = a[1]
count_list = []
for i in range(num-1):
    split_haichi_1 = haichi[:i+1]
    split_haichi_2 = haichi[i+1:]
    count_1 = count(split_haichi_1)
    count_2 = count(split_haichi_2)
    count_list.append(count_1 + count_2)

print(min(count_list))

Buggy submission (verdict: Runtime Error):
import sys
a = []
for l in sys.stdin:
    a.append(l)

zahyou = [int(x) for x in a.split()]

if ((zahyou[0] >= zahyou[1]) and (zahyou[1] >= zahyou[2])) or ((zahyou[0] <= zahyou[1]) and (zahyou[1] <= zahyou[2])):
    print("No")
else:
    print("Yes")
Problem p02963 (python)

Fixed submission:
a = int(input())
ax = 0
ay = 0
bx = 10 ** 9
by = 1
cy = (a + bx - 1) // bx
cx = cy * bx - a
print(ax, ay, bx, by, cx, cy)

Buggy submission (verdict: Runtime Error):
S = int(input())
r = 10**9

a = (S-1) % r
b = (S-1) // r
print("0 0 1 " + str(10 ** 9) + " " + str(a) + " " + str(b))
a = int(input())
xa = 0
ya = 0
xb = 10**9
yb = 1
xc = xb - a
yc = 1
print("{} {} {} {} {} {}".format(xa, ya, xb, yb, xc, yc))
Problem p02983 (python)

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

if b - a >= 2019:
    print(0)
else:
    for i in range(a, b):
        for j in range(a + 1 , b + 1):
            c = min(c, i * j % 2019)
    print(c)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = 10 ** 9
for i in range(a, b + 1):
    for j in range(a, b + 1):
        if i != j
            c = min(c, i * j % 2019)
            if c == 0:
                print()
                exit()
print(c)

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

for i in range(a, b):
  for j in range(a + 1 , b + 1):
    c = min(c, i * j % 2019)
    if c == 0:
    	print(c)
        exit()
print(c)
Problem p02995 (python)

Fixed submission:
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


def lcm(x, y):
    return x * y // gcd(x, y)


a, b, c, d = map(int, input().split())
a = a - 1
e = b - b // c - b // d + b // lcm(c, d)
f = a - a // c - a // d + a // lcm(c, d)
print(e - f)

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())
e = b - int(b / c) - int(b / d) + int(b / lcm(c, d))
f = (a - 1) - int((a - 1) / c) - int((a - 1) / d) + int((a - 1) / lcm(c, d))
print(e - f)
Problem p03000 (python)

Fixed submission:
a, b = map(int, input().split())
d = 0
e = 1
for i in list(map(int, input().split())):
    d += i
    if d > b:
        break
    e += 1
print(e)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = 1
e = 0
for i in range(a):
    e += c[i]
    if e <= b:
        d += 1
print(d)
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = 1
e = 0
for i in range(a):
    e += c[i]
    if e <= b:
        d += 1
    else:
        break
print(d)
Problem p03001 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
if a / 2 == c and b / 2 == d:
    print(str(a * b / 2) + " " + "1")
else:
    print(str(a * b / 2) + " " + "0")

Buggy submission (verdict: Runtime Error):
a
Problem p03061 (python)

Fixed submission:
def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


a = int(input())
b = list(map(int, input().split()))
b.append(0)
b.insert(0, 0)
c = [0]*(len(b))
d = [0]*(len(b))
for i in range(1, len(b)):
    c[i] = (g_c_d(b[i], c[i-1]))
    d[-i-1] = (g_c_d(b[-i-1], d[-i]))
e = 0
for i in range(0, len(c)-2):
    e = max(g_c_d(c[i], d[i+2]), e)
print(e)

Buggy submission (verdict: Runtime Error):
a
Problem p03138 (python)

Fixed submission:
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = [0] * 45
for i in c:
    e = bin(i)[2:]
    for j in range(len(e)):
        d[j] += 1 if e[-j-1] == "1" else 0
e = 0
for i in range(len(d)-1, -1, -1):
    if 2 ** i + e <= b:
        if d[i] <= len(c) // 2:
            e += 2 ** i
f = 0
for i in range(len(c)):
    f += e ^ c[i]
print(f)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = [0] * 45
for i in c:
    e = bin(i)[2:]
    for j in range(len(e)):
        d[j] += 1 if e[-j-1] == "1" else 0
ans = 0
s = 0
for i in range(44, -1, -1):
    if 2 ** i + s <= b
        if a > d[i] * 2:
            s += 2 ** i
for i in c:
    ans += i ^ s
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = [0] * 45
for i in c:
    e = bin(i)[2:]
    for j in range(len(e)):
        d[j] += 1 if e[-j-1] == "1" else 0
ans = 0
s = 0
for i in range(44, -1, -1):
    if 2 ** i + s <= b
        if a > d[i] * 2:
            s += 2 ** i
for i in c:
    ans += i ^ s
print(ans)
Problem p03146 (python)

Fixed submission:
a = int(input())
b = [a]
c = 1
while True:
  c += 1
  if a % 2 == 0:
    a /= 2
    if a in b:
      print(c)
      exit()
    else:
      b.append(a)
  else:
    a = a * 3 + 1
    if a in b:
      print(c)
      exit()
    else:
      b.append(a)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = [a]
c = 0
while:
  c += 1
  if a % 2 == 0:
    a /= 2
    if b.contain(a):
      print(c)
      exit()
    else:
      b.append(a)
  else:
    a = a * 3 + 1
    if b.contain(a):
      print(c)
      exit()
    else:
      b.append(a)
Problem p03231 (python)

Fixed submission:
def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


def l_c_m(x, y):
    return x * y // g_c_d(x, y)


a, b = map(int, input().split())
c = input()
d = input()
lcm = l_c_m(a, b)
gcd = g_c_d(a, b)
for i in range(0, gcd):
    if c[i * a // gcd] != d[i * b // gcd]:
        print(-1)
        exit()
print(lcm)

Buggy submission (verdict: Runtime Error):
def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


def l_c_m(x, y):
    return x * y // g_c_d(x, y)


a, b = map(int, input().split())
c = input()
d = input()
f = l_c_m(a, b)
e = [""] * f
for i in range(0, f):
    if i * f // a > f - 1:
        break
    if e[i * f // a] == "":
        e[i * f // a] = c[i]
    elif e[i * f // a] != c[i]:
        print(-1)
        exit()
    if i * f // b > f - 1:
        break
    if e[i * f // b] == "":
        e[i * f // b] = d[i]
    elif e[i * f // b] != d[i]:
        print(-1)
        exit()
print(f)

Buggy submission (verdict: Runtime Error):
def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


def l_c_m(x, y):
    return x * y // g_c_d(x, y)


a, b = map(int, input().split())
c = input()
d = input()
f = l_c_m(a, b)
e = [""] * f
for i in range(0, 6):
    if i * f // a >= f - 1:
        break
    if e[i * f // a] == "":
        e[i * f // a] = c[i]
    elif e[i * f // a] != c[i]:
        print(-1)
        exit()
    if i * f // b >= f - 1:
        break
    if e[i * f // b] == "":
        e[i * f // b] = d[i]
    elif e[i * f // b] != d[i]:
        print(-1)
        exit()
print(f)
Problem p03289 (python)

Fixed submission:
a = input()
b = 0
if a[0] != "A":
    print("WA")
    exit()
for i in range(2,len(a)-1):
    if b == 0 and a[i] == "C":
        b = i
    elif b != 0 and [i] == "C":
        print("WA")
        exit()
if b == 0:
    print("WA")
    exit()
for i in range(len(a)):
    if i != 0 and i != b and a[i].isupper():
        print("WA")
        exit()
print("AC")

Buggy submission (verdict: Runtime Error):
a = input()
if len(a) == 0:
    print("WA")
    exit()
if a[0] == "A":
    b = 0
    for i in range(1, len(a)):
        if a[i] == "C" and (1 < i < len(a) - 1):
            b += 1
        else:
            if a[i] != a[i].lower():
                print("WA")
                exit()
if b == 1:
    print("AC")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
a = input()
if a[0] == "A":
    b = 0
    for i in range(1, len(a)):
        if a[i] == "C" and (1 < i < len(a) - 1):
            b += 1
        else:
            if a[i] != a[i].lower():
                print("WA")
                exit()
if b == 1:
    print("AC")
else:
    print("WA")
Problem p03363 (python)

Fixed submission:
a = int(input())
c = list(map(int, input().split()))
d = {0: 1}
e = 0
for i in range(len(c)):
    e += c[i]
    if e not in d:
        d[e] = 1
    else:
        d[e] += 1
ans = 0
for v in d.values():
    if v >= 2:
        ans += v * (v - 1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = list(map(int, input().split()))
Problem p03607 (python)

Fixed submission:
a = int(input())
b = {}
for i in range(a):
    c = int(input())
    if c not in b:
        b[c] = 1
    else:
        b[c] += 1
c = 0
for k, v in b.items():
    if v % 2 != 0:
        c += 1
print(c)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = [False] *(10**5)
for i in range(a):
    c = int(input())
    b[c-1] = not b[c-1]
d = 0
for i in b:
    if i:
        d += 1
print(d)
Problem p03627 (python)

Fixed submission:
a = int(input())
b = list(map(int, input().split()))
b = sorted(b, reverse=True)
c = []
d = []
for i in range(1, len(b)):
    if i-1 not in d:
        if b[i] == b[i-1]:
            c.append(b[i])
            d.append(i)
        if len(c) == 2:
            print(c[0] * c[1])
            exit()
print(0)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = [0] * (10 ** 5)
c = list(map(int, input().split()))
for i in c:
    b[i-1] += 1
d = 0
e = 0
for i in range(len(b)-1, -1, -1):
    if b[i] >= 2:
        if d == 0:
            d = i+1
        elif e == 0:
            e = i+1
        else:
            print(d*e)
            exit()
print(d*e)
Problem p04001 (python)

Fixed submission:
def f(a, b, le, tf):
    b[le] = tf
    if le == len(b)-1:
        t = ""
        s1 = 0
        for i in range(len(b)):
            t += a[i]
            if b[i] == 1:
                s1 += int(t)
                t = ""
        t += a[len(b)]
        s1 += int(t)
        return s1
    else:
        return f(a, b, le+1, 0) + f(a, b, le+1, 1)


aa = input()
bb = [0] * (len(aa)-1)
if len(aa) == 1:
    print(aa)
else:
    print(f(aa, bb, 0, 0) + f(aa, bb, 0, 1))

Buggy submission (verdict: Runtime Error):
def clc(a, b, c, p, t):
    if c == 0:
        b = a[0]
        return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t)
    elif c == len(a)-1:
        if p:
            return t + int(b) + int(a[c])
        else:
            return t + int(b + a[c])
    else:
        if p:
            t += int(b)
            b = a[c]
        else:
            b += a[c]
        return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t)


s = input()
print(clc(s, "", 0, True, 0))

Buggy submission (verdict: Runtime Error):
def f(a, b, le, tf):
    b[le] = tf
    if le == len(b)-1:
        t = ""
        s1 = 0
        for i in range(len(b)):
            t += a[i]
            if b[i] == 1:
                s1 += int(t)
                t = ""
        t += a[len(b)]
        s1 += int(t)
        return s1
    else:
        return f(a, b, le+1, 0) + f(a, b, le+1, 1)


aa = input()
bb = [0] * (len(aa)-1)
if len(a) == 1:
    print(a)
else:
    print(f(aa, bb, 0, 0) + f(aa, bb, 0, 1))

Buggy submission (verdict: Runtime Error):
def f(a, b, le, tf):
    b[le] = tf
    if le == len(b)-1:
        t = ""
        s1 = 0
        for i in range(len(b)):
            t += a[i]
            if b[i] == 1:
                s1 += int(t)
                t = ""
        t += a[len(b)]
        s1 += int(t)
        return s1
    else:
        return f(a, b, le+1, 0) + f(a, b, le+1, 1)


aa = input()
bb = [0] * (len(aa)-1)
print(f(aa, bb, 0, 0) + f(aa, bb, 0, 1))
Problem p04030 (python)

Fixed submission:
a = input()
b = ""
for i in range(len(a)):
    if a[i] == "0":
        b += "0"
    elif a[i] == "1":
        b += "1"
    else:
        b = b[:-1]
print(b)

Buggy submission (verdict: Runtime Error):
a = list(input())
for i in range(len(a)):
    if a[i] == "B":
        if i > 0
            a[i] = ""
            for j in range(i-1, -1, -1):
            if a[j] != "":
                a[j] = ""
print("".join(a))
Problem p03087 (python)

Fixed submission:
N, Q = [int(s) for s in input().split()]
S = input()

t = [0 for i in range(N+1)]
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l, r = [int(s) for s in input().split()]
    print(t[r-1] - t[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = [int(s) for s in input().split()]
S = input()

ac = []
for i in range(len(S)):
    if S[i] == 'A' and S[i+1] == 'C':
        ac.append((i + 1, i + 2))
    i += 1
# print(ac)

for i in range(Q):
    l, r = [int(s) for s in input().split()]
    ans = 0
    for a, b in ac:
        if l <= a and b <= r:
            ans += 1
    print(ans)
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

print((a - 1) * (b - 1))