dalton-and-compiler-design

As we know , Professor Dalton is teaching Compiler Design.
During his first class, he found that the students are very talkative.
so,he decided to divide the class into two sections, A & B
such that the difference between the strength  of two sections
is minimum. 
Print the strength of two sections in non decreasing 
order. 

Input : First line of the input contains number of test cases T,followed by T integers (n) (total sum of their strengths)

1≤T≤100000 , 1≤n≤100000

Output :For each test cases print strength of both section in non decreasing order

SAMPLE INPUT
2
6
8

SAMPLE OUTPUT
3 3
4 4

Difficulty: EASY
Tags: Fundamentals

Implementation

Starter code:

Solutions:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n  = int(input())
for i in range(0,n):
	strength = int(input())
	mid = strength/2
	print(str(mid) + " " + str(strength - mid))
	


T=int(input())
for i in range(T):
	x=int(input())
	if x%2==0:
		print('%d %d' % (x/2, x/2))
	else:
	    print('%d %d' % (x/2, (x/2)+1))


t=int(eval(input()))
for i in range(t):
	n=int(eval(input()))
	if n%2==0:
		print(n/2,n/2)
	else:
		print(n/2,n/2+1)
		


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t_c = int(input())

for tc in range(0,t_c):
	t = input()
	t_int = int(t)
	# len_of_t = len(t)
	# last_digit_of_t = t[len_of_t-1]
	last_digit_of_t = t[-1:]
	# print type(last_digit_of_t)
	
	if int(last_digit_of_t) % 2 == 0 :
		print(t_int/2,t_int/2)
	else:
		print((t_int-1)/2,(t_int+1)/2)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = eval(input())
for _ in range(t):
	n = eval(input())
	k = n/2
	print(k,n-k)


n = int(input())
while n >= 1:
	a = int(input())
	if a % 2 == 0:
		print(a/2, a/2)
	else:
		print(a/2, a/2+1)
	n -= 1


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t=input()
t=int(t)
for i in range(0,t):
	n=input()
	n=int(n)
	if n%2 == 0:
		print("{0} {1}".format(n/2,n/2))
	else:
		print("{0} {1}".format(n/2,n/2+1))



T = eval(input())

while(T):
	N = eval(input())
	
	if (N%2 == 1):
		print(N/2,end = " ")
		print(N/2+1,end = "\n")
	else:
		print(N/2,end = " ")
		print(N/2,end = "\n")
		
	T = T - 1


for i in range(eval(input())):
	s = eval(input())
	if (s % 2 == 0):
		print(str(s/2) + ' ' + str(s/2))
	else:
		print(str(s/2) + ' ' + str(s/2 + 1))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n = int(input())
for i in range(n):
	x = int(input())
	if x%2 == 0:
		print('%s %s' % (x/2, x/2))
	else:
		print('%s %s' % ((x-1)/2, (x+1)/2))


t=eval(input())
arr=[]
for x in range(t):
	arr.append(eval(input()))
for x in arr:
	print("%d %d" %(x/2,x-(x/2))) 
	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t_c = int(input())

for tc in range(0,t_c):
	t = input()
	t_int = int(t)
	# len_of_t = len(t)
	# last_digit_of_t = t[len_of_t-1]
	last_digit_of_t = t[-1:]
	# print type(last_digit_of_t)
	
	if int(last_digit_of_t) % 2 == 0 :
		print(t_int/2,t_int/2)
	else:
		print((t_int-1)/2,(t_int+1)/2)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t_c = int(input())

for tc in range(0,t_c):
	t = input()
	t_int = int(t)
	len_of_t = len(t)
	last_digit_of_t = t[len_of_t-1]
	# print type(last_digit_of_t)
	
	if int(last_digit_of_t) % 2 == 0 :
		print(t_int/2,t_int/2)
	else:
		print((t_int-1)/2,(t_int+1)/2)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t_c = int(input())

for tc in range(0,t_c):
	t = input()
	t_int = int(t)
	len_of_t = len(t)
	last_digit_of_t = t[len_of_t-1]
	# print type(last_digit_of_t)
	
	if int(last_digit_of_t) % 2 == 0 :
		print(t_int/2,t_int/2)
	else:
		print((t_int-1)/2,(t_int+1)/2)


a = eval(input())
for i in range(a):
	b = eval(input())
	c = b/2
	print(c, b-c)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
inp = int(input())

for i in range(inp):
	num = int(input())
	if num%2 != 0:
		print(num/2, num/2+1)
	else:
		print(num/2, num/2)


T=int(input())
while T>0:
	n=int(input())
	if n%2 == 0:
		print(n/2,n/2)
	else:
		temp=(n+1)/2
		print(n-temp,temp) 
	T=T-1
	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n  = int(input())
for i in range(0,n):
	strength = int(input())
	mid = strength/2
	print(str(mid) + " " + str(strength - mid))
	


n = int(input())
for i in range(n):
	num = int(input())
	print(str(num/2)+' '+str(num-(num/2)))


num=int(input())
for i in range(num):
	test=int(input())
	a=test/2
	b=test-a
	print(a,b)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = int(input())
ans = [[] for num in range(t)]

for i in range(t):
	n = int(input())
	ans[i].append(str((n/2)))
	ans[i].append(str((n - n/2)))

for i in range(t):
	print(' '.join(ans[i]))


for i in range(eval(input())): 
	a = eval(input())
	n = a/2
	if( a%2 == 0 ):
	 print(n,n)
	else:
	 print(n,n+1)	


T=eval(input())

i=1

c=0

d=0

while i<=T:

	n=eval(input())

	c=n/2

	d=n-c

	print(c,d)
        i+=1
    


for _ in range(eval(input())):
	a=eval(input())
	if a%2==0:
		print(a/2,a/2)
	else:
		print(a/2,(a/2)+1)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t_c = int(input())

for tc in range(0,t_c):
	t = input()
	len_of_t =  len(t)
	last_digit_of_t = t[len_of_t-1]
	# print type(last_digit_of_t)
	
	if int(last_digit_of_t) % 2 == 0 :
		print(int(t)/2,int(t)/2)
	else:
		print((int(t)-1)/2,(int(t)+1)/2)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t_c = int(input())

for tc in range(0,t_c):
	t = int(input())
	if t % 2 == 0 :
		print(t/2,t/2)
	else:
		print((t-1)/2,(t+1)/2)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t_c = int(input())

for tc in range(0,t_c):
	t = int(input())
	if t % 2 == 0 :
		print(t/2,t/2)
	else:
		print((t-1)/2,(t+1)/2)


for _ in range(eval(input())):
	x=eval(input())
	if x%2==0: print(x/2,x/2)
	else: print(x/2,x/2 + 1)


# Read input from stdin and provide input before running code

#n = int(raw_input().strip())
n = eval(input())
for j in range(0, n):
	i = eval(input())	
	m = i/2
	n = i - m
	if m > n:
		  print(n, m)
	else:
		print(m, n)