Problem:


Score : 100 points

Problem Statement

In K-city, there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city?

Constraints

2 ≤ n, m ≤ 100

Input

Input is given from Standard Input in the following format:

n m

Output

Print the number of blocks in K-city.

Sample Input 1

3 4

Sample Output 1

6

There are six blocks, as shown below:

Sample Input 2

2 2

Sample Output 2

1

There are one block, as shown below:



Sample input:
3 4


Sample output:
6

Submission status: Runtime Error

Solution code:
num = input()
list = map(int, raw_input().split())
count1 = 0
count4 = 0
for x in list:
    if x % 2 == 1:
        count1 = count1 + 1
    if x % 4 == 0:
        count4 = count4 + 1
if count1 > count4 and num > 3 and count1 + count4 < num:
    print("No")
elif count1 > count4 + 1 and num > 3 and count1 + count4 == num:
    print("No")
elif num == 2 and count4 - count1 < 0:
    print("No")
elif num == 3 and count4 == 0 and count1 > 0:
    print("No") 
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
a = int(raw_input())
b,c = map(int, raw_input().split())
s = raw_input()
print a+b+c, " ", s

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one =< four:
  print('Yes')
else :
  if two == 0:
    if four == one-1:
      print('Yes')
    else :
      print("No")
  else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

print("Yes" if four >= one or (four == one - 1 and two == 0) else "No")

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one <= four:
  print('Yes')
else :
  if two == 0:
    if four >= (one+1):
      print('Yes')
  else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

  
if one <= four:
  print('Yes')
else :
  if two == 0:
    if four == (two+1):
      print('Yes')
  else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
Kisuu = 0
YonBaisuu = 0
NiBaisuu = 0

for j in range(N):

  if a[j]%2 == 1:
    Kisuu += 1
  elif a[j]%4 == 0:
    YonBaisuu += 1
  else :
    NiBaisuu +=1

  
if Kisuu <= YonBaisuu:
  print('Yes')
else :
  if NiBaisuu == 0:
    if YonBaisuu >= (Kisuu+1):
      print('Yes')
  else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,input().split()))
Kisuu = 0
YonBaisuu = 0
NiBaisuu = 0

for j in range(N):

  if a[j]%2 == 1:
    Kisuu += 1
  elif a[j]%4 == 0:
    YonBaisuu += 1
  else :
    NiBaisuu +=1

  
if Kisuu <= YonBaisuu:
  print('Yes')
else :
  if NIBaisuu == 0:
    print('Yes')
  else:
    print('No')

Submission status: Runtime Error

Solution code:
H,W=[int(x) for x in input().split()]
N=int(input())
a=[int(x) for x in input().split()]
s=""
for i in range(N):
    s=s+str(i+1)*a[i]
for l in range(H):
    if l%2==0:
        print(" ".join(s[W*l:W*(l+1)]))
    else:
        print(" ".join(s[W*l:W*(l+1)][::-1]))

Submission status: Runtime Error

Solution code:
input(sum([int(x)-1 for x in input().split()]))

Submission status: Runtime Error

Solution code:
n = int(raw_input())
a = map(int,raw_input().split())
a = sorted(a)

def gcd(a,b):
    while b!=0:
        t = b
        b=a%b
        a=t
    return a

i,j=0,0
good=True
while i<n-1:
    if (a[i]*a[i+1]) % 4 != 0:
        j = i+1
        while j<n-1 and gcd(a[i],a[j]) % 4 != 0:
            j+=1
        (a[i+1],a[j]) = a[j],a[i+1]
    if (a[i]*a[i+1]) % 4 != 0:
        good=False
    i+=1
if good:
    print(''.join(map(str,a)))
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
l = input().split()
H = int(l[0])
W = int(l[1])
N = int(input())


c= [[0 for i in range(W)] for j in range(H)]

color_num = [int(i) for i in input().split()]
row = 0
column = 0

for i in range(N):
    index = color_num[i]
    for j in range(0, index):
        c[row][column] = i+1
        if column % (W-1) == 0 and column != 0:
            row += 1
            column = 0
        else:
            column += 1

for i in range(H):
    if i%2 == 1:
        print('change')
        c[i].reverse()


for i in range(0, H):
    for j in range(0, W):
        print(c[i][j], end=' ')
    print('')

Submission status: Runtime Error

Solution code:
n = input()
nStr = input().split()
number = list(map(int,nStr))
 
frby = 1
twby = -1
 
for i in number:
    if i % 4 == 0:
        frby += 2
    elif i % 2 == 0:
        twby += 1
        
if int(n) == 1 and frby == 3:
    print("Yes")
elif int(n) == (twby + 1):
    print("Yes")
elif int(n) <= (frby):
    print("Yes")
elif int(n) <= (frby + twby):
    print("Yes")
else :
    print("No")

Submission status: Runtime Error

Solution code:

n,m = list(map(int, input().split()))

print ((n-1)*(m-1)

Submission status: Runtime Error

Solution code:
temp_arr = input().split(' ')
n = temp_arr[0]
m = temp_arr[1]

print(str((n-1) * (m-1)))