Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    n, m = map(int, input().split())
    l = []
    r = []
    ans = 0
    for i in range(m):
        a, b = map(int, input().split())
        l.append(a)
        r.append(b)
    for i in range(1, n+1):
        if i >= max(l) and i <= min(r):
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n, m = map(int, input().split())
    l = []
    r = []
    ans = 0
    for i in range(m):
        a, b = map(int, input().split())
        l.append(a)
        r.append(b)
    ml = max(l)
    mr = min(r)
    for i in range(1, n+1):
        if i >= ml and i <= mr:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, m = map(int, input().split())
    G = [0] * m
    ans = 0
    for i in range(m):
        G[i] = list(map(int, input().split()))
    for i in range(1, n+1):
        f = 0
        for j in range(m):
            if i < G[j][0] or G[j][1] < i:
                f = 0
                break
            else:
                f = 1
        if f == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n, m = map(int, input().split())
    l = []
    r = []
    ans = 0
    for i in range(m):
        a, b = map(int, input().split())
        l.append(a)
        r.append(b)
    ml = max(l)
    mr = min(r)
    for i in range(1, n+1):
        if i >= ml and i <= mr:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#
# abc096 c
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5
WEEWW"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """12
WEWEWEEEWWWE"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """8
WWWWWEEE"""
        output = """3"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    S = list(input())

    ans = float("inf")
    for i in range(N):
        if i == 0:
            ans = min(ans, S[1:].count("E"))
        elif i == N-1:
            ans = min(ans, S[0:N-1].count("W"))
        else:
            ans = min(ans, S[0:i].count("W") + S[i+1:].count("E"))

    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Fixed submission:
#
# abc096 c
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5
WEEWW"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """12
WEWEWEEEWWWE"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """8
WWWWWEEE"""
        output = """3"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    S = list(input())

#    ans = float("inf")
#    for i in range(N):
#        if i == 0:
#            ans = min(ans, S[1:].count("E"))
#        elif i == N-1:
#            ans = min(ans, S[0:N-1].count("W"))
#        else:
#            ans = min(ans, S[0:i].count("W") + S[i+1:].count("E"))
#    print(ans)

    W = [0] * N
    E = [0] * N
    L = 0
    R = 0

    for i in range(N):
        if S[i] == "W":
            L += 1
        if S[N-1-i] == "E":
            R += 1
        W[i] = L
        E[N-1-i] = R

    ans = float("inf")
    for i in range(N):
        ans = min(ans, E[i]+W[i]-1)
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()
Buggy python submission (verdict: Runtime Error):
#
# abc090 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11009 11332"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """31415 92653"""
        output = """612"""
        self.assertIO(input, output)


def resolve():
    A, B = map(int, input().split())
    ans = 0
    for i in range(A, B+1):
        s = str(i)
        for j in range((3):
            if s[j] != s[-1-j]:
                break
        else:
            ans += 1
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Fixed submission:
#
# abc090 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11009 11332"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """31415 92653"""
        output = """612"""
        self.assertIO(input, output)


def resolve():
    A, B = map(int, input().split())
    ans = 0
    for i in range(A, B+1):
        s = str(i)
        for j in range((len(s)+1)//2):
            if s[j] != s[-1-j]:
                break
        else:
            ans += 1
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()
Buggy python submission (verdict: Runtime Error):
#
# abc086 a
#
a, b = map(input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")

Fixed submission:
#
# abc086 a
#
a, b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")

Buggy python submission (verdict: Runtime Error):
#
# abc086 a
#
a, b = map(input().split())
if a*b % 2 == 0:
    print("Even")
else:
    priont("Odd")

Fixed submission:
#
# abc086 a
#
a, b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
#
# abc064 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4
2100 2500 2700 2700"""
        output = """2 2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
1100 1900 2800 3200 3200"""
        output = """3 5"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """20
800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990"""
        output = """1 1"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    C = [0] * 9
    for a in A:
        for i in range(8):
            if 400*i <= a <= 400*i+399:
                C[i] = 1
                break
        else:
            C[8] += 1

    print(f"{max(1, C[:8].count(1))} {C[:8].count(1)+C[8])}")


if __name__ == "__main__":
    # unittest.main()
    resolve()


Fixed submission:
#
# abc064 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4
2100 2500 2700 2700"""
        output = """2 2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
1100 1900 2800 3200 3200"""
        output = """3 5"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """20
800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990"""
        output = """1 1"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    C = [0] * 9
    for a in A:
        for i in range(8):
            if 400*i <= a <= 400*i+399:
                C[i] = 1
                break
        else:
            C[8] += 1

    print(f"{max(1, C[:8].count(1))} {C[:8].count(1)+C[8]}")


if __name__ == "__main__":
    # unittest.main()
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
#
# abc055 b
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3"""
        output = """6"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10"""
        output = """3628800"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """100000"""
        output = """457992974"""
        self.assertIO(input, output)


def resolve():
    N = int(input())

    p = 1
    for i in range(1, N+1):
        p *= i

    print(p % (10**9+7))


if __name__ == "__main__":
    # unittest.main()
    resolve()


Fixed submission:
#
# abc055 b
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3"""
        output = """6"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10"""
        output = """3628800"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """100000"""
        output = """457992974"""
        self.assertIO(input, output)


def resolve():
    N = int(input())

    ans = 1
    for i in range(1, N+1):
        ans *= i
        ans %= (10**9+7)

    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()
Buggy python submission (verdict: Runtime Error):
#
# agc010 a
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
1 2 3"""
        output = """YES"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
1 2 3 4 5"""
        output = """NO"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    e = 0
    o = 0
    for a in A:
        if a % 2 == 0:
            e += 1
        else:
            o += 1

    if o % 2 == 0:
        if (o // 2 + e) % 2 == 0:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    # unittest.main()
    resolve()


Fixed submission:
#
# agc010 a
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
1 2 3"""
        output = """YES"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
1 2 3 4 5"""
        output = """NO"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    e = 0
    o = 0
    for a in A:
        if a % 2 == 0:
            e += 1
        else:
            o += 1

    if o % 2 == 0:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    # unittest.main()
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
#
# abc049 c
#
s = input()
words = ['dream', 'dreamer', 'erase', 'eraser']

flag = 0
while len(s) > 0:
    for w in words:
        if s[-1 * len(w):] == w:
            s = s.replace(w, "").rstrip()
            flag = 1
            break
    if flag == 0:
        print("NO")
        exit()

print("YES")


Fixed submission:
#
# abc049 c
#
s = input()
words = ['dream', 'dreamer', 'erase', 'eraser']

s = s[::-1]
while len(s) > 0:
    flag = 0
    for w in words:
        w = w[::-1]
        if s[0:len(w)] == w:
            s = s[len(w)::]
            # s = s.replace(w, "").lstrip()
            flag = 1
            break
    if flag == 0:
        print("NO")
        exit()

print("YES")

Buggy python submission (verdict: Runtime Error):
#
# abc049 c
#
s = input()
words = ['dream', 'dreamer', 'erase', 'eraser']

while len(s) > 0:
    flag = 0
    for w in words:
        if s[-1 * len(w):] == w:
            s = s.replace(w, "").rstrip()
            flag = 1
            break
    if flag == 0:
        print("NO")
        exit()

print("YES"

Fixed submission:
#
# abc049 c
#
s = input()
words = ['dream', 'dreamer', 'erase', 'eraser']

s = s[::-1]
while len(s) > 0:
    flag = 0
    for w in words:
        w = w[::-1]
        if s[0:len(w)] == w:
            s = s[len(w)::]
            # s = s.replace(w, "").lstrip()
            flag = 1
            break
    if flag == 0:
        print("NO")
        exit()

print("YES")
Buggy python submission (verdict: Runtime Error):
#
# abc047 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5 4 2
2 1 1
3 3 4"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5 4 3
2 1 1
3 3 4
1 4 2"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10 10 5
1 6 1
4 1 3
6 9 4
9 4 2
3 1 3"""
        output = """64"""
        self.assertIO(input, output)


def resolve():
    W, H, N = map(int, input().split())
    a = []
    ox = 0
    oy = 0
    for _ in range(N):
        a.append(list(map(int, input().split())))
    for i in range(N):
        if a[i][2] == 1:
            ox = max(a[i][0], ox)
        elif a[i][2] == 2:
            W = min(a[i][0], W)
        elif a[i][2] == 3:
            oy = max(a[i][1], oy)
        elif a[i][2] == 4:
            H = min(a[i][1], H)
    print(max((W-ox))*max((H-oy), 0))


if __name__ == "__main__":
    # unittest.main()
    resolve()


Fixed submission:
#
# abc047 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5 4 2
2 1 1
3 3 4"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5 4 3
2 1 1
3 3 4
1 4 2"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10 10 5
1 6 1
4 1 3
6 9 4
9 4 2
3 1 3"""
        output = """64"""
        self.assertIO(input, output)


def resolve():
    W, H, N = map(int, input().split())
    a = []
    ox = 0
    oy = 0
    for _ in range(N):
        a.append(list(map(int, input().split())))
    for i in range(N):
        if a[i][2] == 1:
            ox = max(a[i][0], ox)
        elif a[i][2] == 2:
            W = min(a[i][0], W)
        elif a[i][2] == 3:
            oy = max(a[i][1], oy)
        elif a[i][2] == 4:
            H = min(a[i][1], H)
    print(max(W-ox, 0)*max(H-oy, 0))


if __name__ == "__main__":
    # unittest.main()
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range (1,n):
  for b in range (1,n):
    if n > (a * b):
        ans += 1
print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range (1,n):
    for b in range(a, n, a):
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range (1,n):
    temp = 0
    for b in range(1, n):
        temp = a * b
        if n <= temp:
            break
        ans += 1
print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range (1,n):
    for b in range(a, n, a):
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range (1,n):
    for b in range(1, n):
        if n <= a * b:
            break
        ans += 1
print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range (1,n):
    for b in range(a, n, a):
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range (1,n):
    for b in range(1, n):
        temp = a * b
        if n <= temp:
            break
        ans += 1
print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range (1,n):
    for b in range(a, n, a):
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range (1,n):
  for b in range (1,n):
    if n > (a * b):
        ans += 1
    else:
        break

print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range (1,n):
    for b in range(a, n, a):
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range (1,n):
  for b in range (1,n):
    if n > (a * b):
        ans += 1
print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range (1,n):
    for b in range(a, n, a):
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
c = 0
for a in range (1,n):
  for b in range (1,n):
    c = n - (a * b)
    if c > 0:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range (1,n):
    for b in range(a, n, a):
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
if a == b[0:-1]:
    print('Yes')
else:
    print('No')

Fixed submission:
a = input()
b = input()
if a == b[0:-1]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
print(b[0:-1])
if a == b[0:-1]:
    print('Yes')
else:
    print('No')

Fixed submission:
a = input()
b = input()
if a == b[0:-1]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a,b = input().split()
if a == b[0:-1]:
    print('Yes')
else:
    print('No')

Fixed submission:
a = input()
b = input()
if a == b[0:-1]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
mylist = list(range(0))
inp = ''
for i in range(n):
    inp = input()
    if (inp not in mylist):
        mylist.append(inp)
print(len(mylist))

Fixed submission:
n = int(input())
print(len(set([input() for i in range(n)])))

Buggy python submission (verdict: Runtime Error):
n = int(input().split())
mylist = list(range(0))
inp = ''
for i in range(n):
    inp = input()
    if (inp not in mylist):
        mylist.append(inp)
print(len(mylist))

Fixed submission:
n = int(input())
print(len(set([input() for i in range(n)])))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = input().split(" ")
n = int(n)
k = int(k)
min = 1000000000000000001
abs0 = 0
if n == 0:
    print(0)
elif k == 1:
    print(0)
elif n == 1:
    print(1)
else:
    for i in range(1000000000):
        abs0 = abs(k - n)
        n = abs0
        if abs0 < min:
            min = abs0
        elif min == abs0:
            print(abs0)
            break

Fixed submission:
n,k = input().split(" ")
n = int(n)
k = int(k)
min = 1000000000000000001
abs0 = 0
if n == 0:
    print(0)
elif k == 1:
    print(0)
elif n == 1:
    print(1)
else:
    if n > k:
        n = n % k
        print(abs(k-n))
    else:        
        for i in range(1000000000):
            abs0 = abs(k - n)
            n = abs0
            if abs0 < min:
                min = abs0
            elif min == abs0:
                print(abs0)
                break
Buggy python submission (verdict: Runtime Error):
a,b = (long(x) for x in input().split())
if a > b:#b対象
    anb1 = long(b * b) 
    anb2 = (long((a-b) * b))
    if (anb1 % 2) == 0:#偶数
        if  anb2 % 2 == 0:#anb2 偶数
            print(long(anb1/2) + long(anb2/2))
        else:#奇数
            print(long(anb1/2) + long(anb2/2))
    else:#奇数
        if  anb2 % 2 == 0:#anb2 偶数
            print(long(anb1/2 + 1) + long(anb2/2))
        else:#奇数
            print(long(anb1/2 + 1) + long(anb2/2))
            
elif a < b:#a対象            
    anb1 = long(a * a )
    anb2 = long((b-a) * a)
    if (anb1 % 2) == 0:#偶数
        if  anb2 % 2 == 0:#anb2 偶数
            print(long(anb1/2) + long(anb2/2))
        else:#奇数
            print(long(anb1/2) + long(anb2/2))
    else:#奇数
        if  anb2 % 2 == 0:#anb2 偶数
            print(long(anb1/2 + 1) + long(anb2/2))
        else:#奇数
            print(long(anb1/2 + 1) + long(anb2/2))
elif a == b:
    if a % 2 == 0:
        print(long(a / 2) * a)
    else:
        print(long((a * a) / 2) + 1)
    

Fixed submission:
a,b = (int(x) for x in input().split())

            
if a == 1 or b == 1:
    print(1)
elif a > b:#b対象
    anb1 = int(b * b) 
    anb2 = (int((a-b) * b))
    if (anb1 % 2) == 0:#偶数
            print(int(anb1/2) + int(anb2/2))
    else:#奇数
            print(int(anb1/2 + 1) + int(anb2/2))
elif a < b:#a対象            
    anb1 = int(a * a)
    anb2 = int((b-a) * a)
    if (anb1 % 2) == 0:#偶数
            print(int(anb1/2) + int(anb2/2))
    else:#奇数
            print(int(anb1/2 + 1) + int(anb2/2))
elif a == b:
    if a % 2 == 0:
        print(int(a / 2) * a)
    else:
        print(int((a * a) / 2) + 1)
Buggy python submission (verdict: Runtime Error):
N,A,B = (int(x) for x in input().split())
S =  n % (A+B) - A
Acount = n % (A+B)
Ansn = n / (A+ B) * A
if S <= 0
    print(Ansn + Acount)
else
    print(Ansn + A)

Fixed submission:
N,A,B = (int(x) for x in input().split())
S =  N % (A+B) - A
Acount = N % (A+B)
Ansn = int(N / (A + B)) * A
if S <= 0:
    print(Ansn + Acount)
else:
    print(Ansn + A)