Problem: There is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)    What is the area of this yard excluding the roads? Find it.

Submission attempts (in order):

def main():
    n = int(input())

    
    
    def divide(n):
        counter = 0
        counter1 = 0
        if n % 2 != 0:
            for i in range(1, n+1, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        else:
            for i in range(1, n, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        return counter1

    print(divide(n))
                         
if __name__ == '__main__':
    main()


def main():
    n = int(input())

    
    
    def divide(n):
        counter = 0
        counter1 = 0
        if n % 2 != 0:
            for i in range(1, n+1, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        else:
            for i in range(1, n, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        return counter1

    print(divide(n))
                         
if __name__ == '__main__':
    main()

def divide(n):
    counter = 0
    counter1 = 0
    if n % 2 != 0:
        for i in range(1, n+1, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    else:
        for i in range(1, n, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    return counter1

                         
if __name__ == '__main__':
    n = int(input())
    print(divide(n))

def divide(n):
    counter = 0
    counter1 = 0
    if n % 2 != 0:
        for i in range(1, n+1, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    else:
        for i in range(1, n, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    return counter1

                         
if __name__ == '__main__':
    n = int(input())
    print(divide(n))


def main():
    n = int(input())

    
    
    def divide(n):
        counter = 0
        counter1 = 0
        if n % 2 != 0:
            for i in range(1, n+1, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        else:
            for i in range(1, n, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        return counter1

    print(divide(n))
                         
if __name__ == '__main__':
    main()


def main():
    n = int(input())

    
    
    def divide(n):
        counter = 0
        counter1 = 0
        if n % 2 != 0:
            for i in range(1, n+1, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        else:
            for i in range(1, n, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        return counter1

    print(divide(n))
                         
if __name__ == '__main__':
    main()

def divide(n):
    counter = 0
    counter1 = 0
    if n % 2 != 0:
        for i in range(1, n+1, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    else:
        for i in range(1, n, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    return counter1

                         
if __name__ == '__main__':
    n = int(input())
    print(divide(n))

def divide(n):
    counter = 0
    counter1 = 0
    if n % 2 != 0:
        for i in range(1, n+1, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    else:
        for i in range(1, n, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    return counter1

                         
if __name__ == '__main__':
    n = int(input())
    print(divide(n))

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

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

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted

Accepted

Accepted

Accepted