Problem:
Card Game Taro and Hanako are playing card games. They have n cards each, and they compete n turns. At each turn Taro and Hanako respectively puts out a card.
  The name of the animal consisting of alphabetical letters is written on each card, and the bigger one in lexicographical order becomes the winner of that turn. The winner obtains 3 points. In the case of a draw, they obtain 1 point each. Write a program which reads a sequence of cards Taro and Hanako have and reports the final scores of the game. Input In the first line, the number of cards n is given. In the following n lines, the cards for n turns are given respectively. For each line, the first string represents the Taro's card and the second one represents Hanako's card. Constraints  n ≤ 1000  The length of the string ≤ 100  Output Print the final scores of Taro and Hanako respectively. Put a single space character between them. Sample Input 3
cat dog
fish fish
lion tiger Sample Output 1 7

Solution (Python):
def main():
    n = int(input())
    taro, hanako = 0, 0
    for _ in range(n):
        cards = input().split()
        if cards[0] == cards[1]:
            taro += 1
            hanako += 1
        elif cards[0] != sorted(cards)[0]:
            taro += 3
        else:
            hanako += 3
    print(taro, hanako)


if __name__ == '__main__':
    main()

Solution (Python):
def main():

    TaroScore = HanaScore = 0
    n = int(input())
    for _ in range(n):
        [Taro, Hana] = list(input().lower().split())

        lenT = len(Taro)
        lenH = len(Hana)
        lenMin = min(lenT, lenH)

        if Taro == Hana:
            TaroScore += 1
            HanaScore += 1
        
        else:
            for i in range(lenMin+1):
                if Taro == '':
                    HanaScore += 3
                    break
                elif Hana == '':
                    TaroScore += 3
                    break
                elif ord(Taro[0]) > ord(Hana[0]):
                    TaroScore += 3
                    break
                elif ord(Taro[0]) < ord(Hana[0]):
                    HanaScore += 3
                    break
                else:
                    Taro = Taro[1:]
                    Hana = Hana[1:]

    print(TaroScore, HanaScore)

if __name__ == '__main__':
    main()

Solution (Python):
def main():

    TaroScore = HanaScore = 0
    n = int(input())
    for _ in range(n):
        [Taro, Hana] = list(input().lower().split())

        lenT = len(Taro)
        lenH = len(Hana)
        lenMin = min(lenT, lenH)

        if Taro == Hana:
            TaroScore += 1
            HanaScore += 1
        
        else:
            for i in range(lenMin+1):
                if Taro == '':
                    HanaScore += 3
                    break
                elif Hana == '':
                    TaroScore += 3
                    break
                elif ord(Taro[0]) > ord(Hana[0]):
                    TaroScore += 3
                    break
                elif ord(Taro[0]) < ord(Hana[0]):
                    HanaScore += 3
                    break
                else:
                    Taro = Taro[1:]
                    Hana = Hana[1:]

    print(TaroScore, HanaScore)

if __name__ == '__main__':
    main()

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

    points = {"taro":0, "hanako":0}

    for _ in range(n):
        taro, hanako = input().split()

        if taro > hanako:
            points['taro']   += 3
        elif taro < hanako:
            points['hanako'] += 3
        else:
            points['taro']   += 1
            points['hanako'] += 1

    print(points['taro'], points['hanako'])

if __name__ == '__main__':
    main()

Solution (Python):
pt,ph=0,0
for i in range(int(input())):
    t,h=input().split()
    if t>h:
        pt+=3
    elif t==h:
        pt+=1
        ph+=1
    else:
        ph+=3
print(*[pt,ph])

Solution (Python):
n = int(input())
t_p = 0
h_p = 0
for i in range(n):
    taro, hana = [i for i in input().split()]
    if taro > hana:
        t_p += 3
    elif taro == hana:
        t_p += 1
        h_p += 1
    else:
        h_p += 3
print(f'{t_p} {h_p}')

Solution (Python):
n = int(input())
x = 0
y = 0
for i in range(n):
    a, b = input().split()
    if a > b:
        x += 3
    elif a < b:
        y += 3
    else:
        x += 1
        y += 1
print(x, y)

Solution (Python):
n = int(raw_input())
a = b = 0
for i in range(n):
    tmp = raw_input().split()
    if tmp[0] > tmp[1]:
        a+=3
    elif tmp[0] < tmp[1]:
        b+=3
    else:
        a+=1
        b+=1
print a, b

Solution (Python):
n = int(input())
p1 = p2 = 0
for _ in range(n):
    taro,hanako = map(str,input().split(" "))
    if taro>hanako: p1 += 3
    elif taro<hanako: p2 += 3
    else:
        p1 += 1
        p2 += 1
print(p1,p2)

Solution (Python):

Taro = 0
Hanako = 0

n = int(input())

for i in range(n):
    T,H = map(str, input().split())
    if T > H:
        Taro += 3
    elif T == H:
        Taro += 1
        Hanako += 1
    else:
        Hanako += 3

print(Taro, Hanako)

Solution (Python):
N = int(input())
p = q = 0
for i in range(N):
    a, b = input().split()
    if a < b:
        q += 3
    elif a > b:
        p += 3
    else:
        p += 1
        q += 1
print(p, q)

Solution (Python):
turn = int(input())

taro_score = 0
hanako_score = 0 

for i in range(turn):
    tcard,hcard = input().split()
    tcard = str(tcard)
    hcard = str(hcard)
    taro_card = [0]*len(tcard)
    hanako_card = [0]*len(hcard)
    
    
    for j in range(len(tcard)):
        taro_card[j] = ord(tcard[j])
    
    
    for k in range(len(hcard)):
        hanako_card[k] = ord(hcard[k])
        
    if len(tcard) == len(hcard):
    
        for l in range(len(tcard)):
            if taro_card[l] > hanako_card[l]:
                taro_score += 3
                break
            
            elif taro_card[l] < hanako_card[l]:
                hanako_score += 3
                break   
            
            else:
                if l == len(tcard)-1:
                    taro_score += 1
                    hanako_score += 1
                else:
                    continue
    
    elif len(tcard) < len(hcard):
        
        for a in range(len(tcard)):
            if taro_card[a] > hanako_card[a]:
                taro_score += 3
                break
            
            elif taro_card[a] < hanako_card[a]:
                hanako_score += 3
                break
                
            else:
                if a == len(tcard)-1:
                    
                    hanako_score += 3
                    
                else:
                    continue
                    
    else:
            
        for b in range(len(hcard)):
            if taro_card[b] > hanako_card[b]:
                taro_score += 3
                break

            elif taro_card[b] < hanako_card[b]:
                hanako_score += 3
                break

            else:
                if b == len(hcard)-1:
                    
                    taro_score += 3

                else:
                    continue
                              
print("%d %d"%(taro_score,hanako_score))

Solution (Python):
n = int(input())
T_point = 0
H_point = 0
for loop in range(n):
    T,H=map(str,input().split())
    if T > H:T_point += 3
    elif T == H:
        T_point += 1
        H_point += 1
    else:H_point += 3
print(T_point,H_point)

Solution (Python):
from sys import stdin

score = [
    0, 
    0  
]

n = int(stdin.readline().rstrip())
for i in range(n):
    card_pair = stdin.readline().rstrip().split()
    if card_pair[0] > card_pair[1]:
        score[0] += 3
    elif card_pair[0] < card_pair[1]:
        score[1] += 3
    else:
        score[0] += 1
        score[1] += 1

print(*score)

Solution (Python):
N = int(input())
taro_cnt, hana_cnt = 0, 0
for _i in range(N):
    taro, hana = map(str, input().split())
    if taro > hana:
        taro_cnt += 3
    elif taro == hana:
        taro_cnt += 1
        hana_cnt += 1
    else:
        hana_cnt += 3
print(f'{taro_cnt} {hana_cnt}')

Solution (Python):
n = int(input())

taro = 0
hanako = 0
for _ in range(n):
	line = input().rstrip().split()

	if line[0] > line[1]: taro += 3
	elif line[0] < line[1]: hanako += 3
	else:
		taro += 1
		hanako += 1
print(taro, hanako)

Solution (Python):



num = int(input())

a=0
b=0

for _ in range(num):
    input2 = input().split()
    if input2[0]>input2[1]:
       a=a+3 
    elif input2[0]<input2[1]:
        b=b+3
    else:
        a=a+1
        b=b+1
print(a,b)

Solution (Python):
n = int(input())
t = 0
h = 0
for _ in range(n):
    a_lst = input().rstrip().split(" ")
    
    b_lst = sorted(a_lst)
    
    if a_lst[0] == a_lst[1]:
        t += 1
        h += 1
    elif a_lst == b_lst:
        h += 3
    else:
        t += 3
print(t, h)

Solution (Python):

s=[0,0]
for i in range(int(input())):
	r=input().split()
	if r[0]<r[1]:
		s[1]+=3
	elif r[1]<r[0]:
		s[0]+=3
	else:
		s[0]+=1
		s[1]+=1
print(str(s[0])+' '+str(s[1]))

Solution (Python):
taro_score = 0
hanako_socore = 0
game_times = int(input())
for _ in range(game_times):
    cards = input().split()
    if cards[0] > cards[1]:
        taro_score += 3
    elif cards[0] == cards[1]:
        taro_score += 1
        hanako_socore += 1
    else:
        hanako_socore += 3
print(taro_score, hanako_socore)

Solution (Python):
n = int(input())
p_t = 0
p_h = 0

for i in range(n):
  t,h = str(input()).split()
  if t > h:
    p_t += 3
  elif t < h:
    p_h += 3
  else:
    p_t += 1
    p_h += 1

print (str(p_t) + " " + str(p_h))

Solution (Python):
n = int(input())
x, y = 0, 0
for i in range(n):
    a, b = input().split()
    if a < b:
        y +=  3
    elif a == b:
        x += 1
        y += 1
    else:
        x += 3
print(x, y)

Solution (Python):
num = int(input())
taro, hanako = 0 ,0
for i in range(num):
    lst = list(map(str, input().split()))
    while 1:
        if lst[0] == lst[1]:
            taro = taro + 1
            hanako = hanako + 1
            break
        else:
            length = min(len(lst[0]),len(lst[1]))
            for j in range(length):
                first = ord(lst[0][j:j+1])
                second = ord(lst[1][j:j+1])
                if first > second:
                    taro = taro + 3
                    break
                elif first < second:
                    hanako = hanako + 3
                    break
                elif j == length - 1:
                    if len(lst[0]) > len(lst[1]):
                        taro = taro + 3
                    elif len(lst[0]) < len(lst[1]):
                        hanako = hanako + 3
                    break
            break
print(str(taro) + " " + str(hanako))

Solution (Python):
taro = hanako = 0
for i in range(int(input())):
    lst = list(map(str, input().split()))
    while 1:
        if lst[0] == lst[1]:
            taro = taro + 1
            hanako = hanako + 1
            break
        else:
            length = min(len(lst[0]),len(lst[1]))
            for j in range(length):
                first = ord(lst[0][j:j+1])
                second = ord(lst[1][j:j+1])
                if first > second:
                    taro = taro + 3
                    break
                elif first < second:
                    hanako = hanako + 3
                    break
                elif j == length - 1:
                    if len(lst[0]) > len(lst[1]):
                        taro = taro + 3
                    elif len(lst[0]) < len(lst[1]):
                        hanako = hanako + 3
                    break
            break
print(str(taro) + " " + str(hanako))

Solution (Python):


n = int(input())
point_t = 0
point_h = 0

for i in range(n):
    cards = list(map(str, input().split()))
    taro = cards[0]
    hanako = cards[1]
    if taro < hanako:
        point_h += 3
    elif taro > hanako:
        point_t += 3
    else:
        point_t += 1
        point_h += 1

print(point_t, point_h)

Solution (Python):
num = int(input())

t=0
h=0

for i in range(num):
	Ta,Ha = input().split(" ")
	if Ta > Ha:
		t += 3
	elif  Ta < Ha:
		h += 3
	else:
		t += 1
		h += 1
print(t,h)

Solution (Python):
n = int(input())
tp = 0
hp = 0
for i in range(n):
    tarou, hanako = map(str,input().split())
    if(tarou > hanako):
        tp += 3
    elif(tarou < hanako):
        hp += 3
    else:
        tp += 1
        hp += 1
print("%d %d" %(tp,hp))

Solution (Python):
n=int(input())
tarou=0
hanako=0
for i in range(n):
  
  t,h=map(str,input().split())
  if t==h:
    tarou+=1
    hanako+=1
  elif (t>h)==True:
    tarou+=3
  else:
    hanako+=3

print(tarou,hanako)

Solution (Python):
cnt = int(input())
taro = 0
hanako = 0
for i in range(cnt):
    li = list(input().split())
    if li[0]>li[1]:
        taro +=3
    elif li[0]==li[1]:
        taro +=1
        hanako +=1
    else:
        hanako +=3
print(taro,hanako)

Solution (Python):
n = input()
p = [0] * 2
for i in range(n):
    t, h = raw_input().split()
    if(t > h):
        p[0] += 3
    elif(t < h):
        p[1] += 3
    else:
        p[0] += 1
        p[1] += 1
print("%d %d" %(p[0], p[1]))

Solution (Python):
t, h = 0, 0

for i in range(int(input())):
    tc, hc= input().split()
    if tc > hc:
        t += 3
    elif tc < hc:
        h += 3
    else:
        t += 1
        h += 1

print('%d %d' % (t, h))

Solution (Python):
battle_number = int(raw_input())
Taro_score = 0
Hanako_score = 0

for x in xrange(battle_number):
	tcard, hcard = raw_input().split()

	if tcard > hcard:
		Taro_score += 3
	elif hcard > tcard:
		Hanako_score += 3
	elif tcard == hcard:
		Taro_score += 1
		Hanako_score += 1

print "%d %d" %(Taro_score, Hanako_score)

Solution (Python):
taro , hana = 0 , 0
n = input()
for i in range(n):
	t,h=raw_input().split()
	if t>h : taro+=3
	elif t<h : hana+=3
	else : 
		taro += 1
		hana += 1
print taro,hana

Solution (Python):
n=input()
t=h=0
for i in range(n):
    x,y=map(str,raw_input().split())
    if x==y:
        t+=1
        h+=1
    elif x<y:
        h+=3
    else:
        t+=3
print t,h

Solution (Python):
n = int(raw_input())
tp,hp = 0,0
for i in range(n):
	T,H = raw_input().split(' ')
	if T == H :
		tp += 1
		hp += 1
	elif T > H :
		tp += 3
	else:
		hp += 3
print tp,hp

Solution (Python):
n=int(raw_input())

tarou=0
hanako=0
for i in range(n):
    words=raw_input().split(" ")
    tarou_sum = 0
    hanako_sum = 0
    for idx, c in enumerate(words[0]):
        
        if len(words[1]) -1 < idx:
            tarou += 3
            break
        
        if ord(words[1][idx]) < ord(c):
            tarou += 3
            break
        elif ord(words[1][idx]) > ord(c):
            hanako += 3
            break
        else:
            continue
    else:
        if len(words[0]) < len(words[1]):
            hanako += 3
        else:
            tarou += 1
            hanako += 1

print "%d %d" % (tarou, hanako)

Solution (Python):
t_point, h_point = 0, 0

n = int(input())
for i in range(n):
    t_card, h_card = input().split()
    if t_card == h_card:
        t_point += 1
        h_point += 1
    elif t_card > h_card:
        t_point += 3
    else:
        h_point += 3
print(t_point, h_point)

Solution (Python):
n = int(input())
tp = hp = 0

for nc in range(n):
    (tc, hc) = input().split()
    if tc == hc:
        tp += 1
        hp += 1
    elif tc > hc:
        tp += 3
    elif tc < hc:
        hp += 3

print(tp, hp)

Solution (Python):
count = int(input())
point = {'taro': 0, 'hanako': 0}
for i in range(count):
    (taro, hanako) = [s for s in input().split()]
    if (taro > hanako) - (taro < hanako) == 0:
        point['taro'] += 1
        point['hanako'] += 1
    elif (taro > hanako) - (taro < hanako) > 0:
        point['taro'] += 3
    else:
        point['hanako'] += 3

print(point['taro'], point['hanako'])

Solution (Python):
point = [0,0]
for i in range(int(input())):
    (t,h) = [x for x in input().split()]
    if t == h:
        point[0] += 1
        point[1] += 1
    else:
        a = [t,h]
        q = sorted(a)
        if t == q[0]:
            point[1] += 3
        else:
            point[0] += 3
print(point[0],point[1])

Solution (Python):
n = input()
taro = 0
hanako = 0
for i in range(n):
    x = map(str, raw_input().split())
    
    
    if(x[0] > x[1]):
        taro += 3
    elif(x[0] == x[1]):
        taro += 1
        hanako += 1
    else:
        hanako += 3
print '%d %d' %(taro, hanako)

exit(0)

Solution (Python):
import sys
n = int(sys.stdin.readline())
points = [0, 0]
for i in range(n):
    (taro, hanako) = sys.stdin.readline().split()
    if taro < hanako:
        points[1] += 3
    elif taro > hanako:
        points[0] += 3
    else:
        points[0] += 1
        points[1] += 1
print(points[0], points[1])

Solution (Python):
n = int(raw_input())
tp = 0; hp = 0
for i in range(n):
    tw,hw = raw_input().split()
    if tw == hw:
        tp += 1
        hp += 1
    elif tw > hw:
        tp += 3
    elif tw < hw:
        hp += 3
print '%s %s' % (tp,hp)

Solution (Python):
if __name__ == '__main__':
    p_taro, p_hanako = 0, 0
    n = int(input())
    for i in range(n):
        animal_taro, animal_hanako = input().split()
        if animal_taro > animal_hanako:
            p_taro += 3
        elif animal_taro < animal_hanako:
            p_hanako += 3
        else:
            p_taro, p_hanako = p_taro+1, p_hanako+1
    print(p_taro, p_hanako)

Solution (Python):


n = int(input())
taro = 0
hanako = 0

for i in range(n):
    cards = input().split()
    if cards[0] < cards[1]:
        hanako += 3
    elif cards[0] > cards[1]:
        taro += 3
    else:
        hanako += 1
        taro += 1
print(taro,hanako)

Solution (Python):
taro_p = 0
hana_p = 0
for i in range(input()):
    taro,hana = raw_input().split(' ')
    if taro > hana:
        taro_p = taro_p + 3
        hana_p = hana_p + 0
    elif taro < hana:
        taro_p = taro_p + 0
        hana_p = hana_p + 3
    else:
        taro_p = taro_p + 1
        hana_p = hana_p + 1

print taro_p,hana_p

Solution (Python):
import sys

tscore = hscore = 0
n = int( sys.stdin.readline() )
for i in range( n ):
	tcard, hcard = sys.stdin.readline().rstrip().split( " " )
	if tcard < hcard:
		hscore += 3
	elif hcard < tcard:
		tscore += 3
	else:
		hscore += 1
		tscore += 1

print( "{:d} {:d}".format( tscore, hscore ) )

Solution (Python):
tscore = hscore = 0
n = int( input( ) )
for i in range( n ):
	tcard, hcard = input( ).split( " " )
	if tcard < hcard:
		hscore += 3
	elif hcard < tcard:
		tscore += 3
	else:
		hscore += 1
		tscore += 1

print( "{:d} {:d}".format( tscore, hscore ) )

Solution (Python):
n=int(raw_input())
left=0
right=0
for i in range(n):
	x,y=raw_input().strip().split()
	
	
	if x==y:
		left+=1
		right+=1
	elif x<y:
		right+=3
	elif x>y:
		left+=3
print left,right

Solution (Python):
n = int(input())
t_score, h_score = 0, 0
for i in range(n):
    t, h = input().split()
    if t > h:
        t_score += 3
    elif t < h:
        h_score += 3
    else:
        t_score += 1
        h_score += 1
print(t_score, h_score)

Solution (Python):
n = input()
t, h = 0, 0
for _ in xrange(n):
    taro, hanako = raw_input().split()
    if taro > hanako:
        t += 3
    elif taro == hanako:
        t += 1
        h += 1
    else:
        h += 3
print t, h

Solution (Python):
taro, hanako = 0, 0
n = int(input())
for _ in range(n):
    a, b = input().split()
    if a > b:
        taro += 3
    elif a < b:
        hanako += 3
    else:
        taro += 1
        hanako += 1
print(taro, hanako)

Solution (Python):
n = int(raw_input())

points = [0, 0]
for i in xrange(n):
  card_list = raw_input().split(" ")
  if card_list[0] > card_list[1]:
    points[0] += 3
  elif card_list[0] < card_list[1]:
    points[1] += 3
  else:
    points[0] += 1
    points[1] += 1

print str(points[0]) + " " + str(points[1])

Solution (Python):
N = input()
taro = 0
hanako = 0
for n in range(N):
    cards = raw_input().split()
    if cards[0] > cards[1]:
        taro += 3
    elif cards[0] < cards[1]:
        hanako += 3
    else:
        taro += 1
        hanako += 1
print "%d %d" % (taro, hanako)

Solution (Python):
n = input()
taro_score = 0
hanako_score = 0
for i in range(n):
	taro,hanako = raw_input().split()
	if taro > hanako :
		taro_score += 3
	elif taro == hanako :
		taro_score += 1
		hanako_score += 1
	else :
		hanako_score += 3
print '%d %d' %(taro_score,hanako_score)

Solution (Python):
n = int(input())

T_s = 0
H_s = 0

for i in range(n):
    animals = input().split()
    T_a = animals[0]
    H_a = animals[1]
    if T_a < H_a:
        H_s += 3
    elif T_a > H_a:
        T_s += 3
    else:
        T_s += 1
        H_s += 1

print(T_s, H_s)

Solution (Python):
n = int(raw_input())
a = 0
b = 0
for i in range(n):
    in_line = raw_input().split()
    if in_line[0] == in_line[1]:
        a += 1
        b += 1
    elif in_line[0] > in_line[1]:
        a += 3
    else:
        b += 3
print '{0} {1}'.format(a,b)

Solution (Python):
taro = 0
hanako = 0
n = int(input())
for _ in range(n):
    taro_card, hanako_card = input().split()
    if taro_card > hanako_card:
        taro += 3
    elif taro_card < hanako_card:
        hanako += 3
    else:
        taro += 1
        hanako += 1
print(taro, hanako)

Solution (Python):
n = int(raw_input())
ts=0 
hs=0 
for x in xrange(n):
    
    tc,hc = raw_input().split()
    if tc > hc:
        ts += 3
    elif tc < hc:
        hs += 3
    else:
        ts += 1
        hs += 1
print "%d %d"%(ts,hs)

Solution (Python):
N = int(raw_input())
taro_point = 0
hanako_point = 0
for n in range(N):
  str_card = raw_input().split()
  if str_card[0] > str_card[1]:
    taro_point += 3
  elif str_card[0] < str_card[1]:
    hanako_point += 3
  else:
    taro_point += 1
    hanako_point += 1
print '%d %d' % (taro_point, hanako_point)

Solution (Python):
n = int(input())

t = 0
h = 0

for i in range(n):
    tc, hc = input().split()
    if tc > hc:
        t += 3
    elif tc < hc:
        h += 3
    elif tc == hc:
        t += 1
        h += 1
print(str(t)+' '+str(h))

Solution (Python):
n = input()

taro_score = 0
hanako_score = 0
for i in range(n):
    taro_card, hanako_card = map(str, raw_input().split())
    m = min(len(taro_card), len(hanako_card))
    flag = 0
    for j in range(m):
        if taro_card[j] > hanako_card[j]:
            flag = 1
            break
        elif taro_card[j] < hanako_card[j]:
            flag = -1
            break
        elif j == m - 1:
            if taro_card == hanako_card:
                flag = 0
            elif taro_card in hanako_card:
                flag = -1
            elif hanako_card in taro_card:
                flag = 1

    if flag == 1:
        taro_score += 3
    elif flag == -1:
        hanako_score += 3
    else:
        taro_score += 1
        hanako_score += 1

print "%d %d" % (taro_score, hanako_score)

Solution (Python):



n = int(input())

scores = [0,0]

for i in range(n):
    card = input().split()
    first_card = card[0]
    card.sort()
    if (card[0] == card[1]):
        scores[0] += 1
        scores[1] += 1
    elif(first_card == card[0]):
        scores[1] += 3
    else:
        scores[0] += 3

print(scores[0], scores[1])

Solution (Python):
point = [0, 0]
n = int(input())
for _ in range(n):
    cards = input().split()
    if cards[0] > cards[1]:
        point[0] += 3
    elif cards[0] < cards[1]:
        point[1] += 3
    else:
        point = [n + 1 for n in point]
print(*point)

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    taro, hanako = 0, 0
    for _ in range(n):
        tw, hw = input().split()
        if tw > hw:
            taro += 3
        elif tw < hw:
            hanako += 3
        else:
            taro += 1
            hanako += 1
    print(taro, hanako)

Solution (Python):
n = int(input())
tp = hp = 0
while n:
    t, h = input().split()
    if t > h:
        tp += 3
    elif t < h:
        hp += 3
    else:
        tp += 1
        hp += 1
    n -= 1
print(tp, hp)

Solution (Python):


import sys

printf = sys.stdout.write

taro = 0
hanako = 0

x = input()
for i in range(x):
    word = map(str, raw_input().split())
    if word[0] > word[1]:
        taro += 3
    elif word[0] < word[1]:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print str(taro) + " " + str(hanako)

Solution (Python):
n = int(input())
taro=0
hanako=0
for i in range(n):
	A=list(map(str,input().split()))
	if A[0]==A[1]:
		taro +=1
		hanako +=1
	else:
		B=sorted(A)
		if A == B:
			hanako+=3
		else:
			taro+=3
print(taro,hanako)

Solution (Python):
tpoint = hpoint = 0

for _ in range(int(input())):
  tcard, hcard = input().split()
  if tcard > hcard:
    tpoint += 3
  elif tcard < hcard:
    hpoint += 3
  else:
    tpoint += 1
    hpoint += 1

print(tpoint, hpoint)

Solution (Python):


n = int(raw_input())
tp = hp = 0
for i in range(n):
    ts, hs = map(str, raw_input().split())
    if ts > hs:
        tp += 3
    elif ts < hs:
        hp += 3
    else:
        tp += 1
        hp += 1
print "%d %d" %(tp, hp)

Solution (Python):
n = int(input())
taroP, hanaP = 0, 0
for match in range(n):
    taro, hanako = input().split()
    if taro == hanako:
        taroP += 1
        hanaP += 1
    elif taro > hanako:
        taroP += 3
    else:
        hanaP += 3
print(taroP, hanaP)

Solution (Python):
n = input()
taro = 0
hanako = 0

for i in xrange(n):
    t_card, h_card = raw_input().split(" ")

    if t_card < h_card:
        hanako += 3
    elif t_card > h_card:
        taro += 3
    elif t_card == h_card:
        taro += 1
        hanako += 1

print taro, hanako

Solution (Python):
n = input()
a = [ raw_input().split() for _ in range(n)]
taro = 0
hanako = 0
for i in a:
    b = sorted(i)
    if i != b :
        taro += 3
    elif i[0] != i[1] :
        hanako += 3
    else :
        taro += 1
        hanako += 1
print taro,hanako

Solution (Python):
score1 = score2 = 0
n = int(input())
for _ in range(n):
    s1, s2 = input().split()
    if(s1 > s2): score1 += 3
    elif(s1 < s2): score2 += 3
    else:
        score1 += 1
        score2 += 1
print(score1, score2)

Solution (Python):
n = input()
tp = hp = 0
for i in xrange(n):
    tc, hc = map(str, raw_input().split())
    if   tc > hc:
        tp+=3
    elif tc < hc:
        hp+=3
    else:
        tp+=1
        hp+=1
print tp, hp

Solution (Python):
n = int(input())
sa = sb = 0
for i in range(n):
    a, b = input().strip().split()
    if a > b:
        sa += 3
    elif a < b:
        sb += 3
    else:
        sa += 1
        sb += 1
print(sa, sb)

Solution (Python):
n=int(input())
tc = 0
hc = 0
for _ in range(0,n):
    t,h = input().split()
    if t > h: tc = tc + 3
    if t < h: hc = hc + 3
    if t == h: 
        tc = tc + 1
        hc = hc + 1
print('{0} {1}'.format(tc, hc))

Solution (Python):
n=int(input())
t_won=0
h_won=0
for _ in range(n):
    t_wd,h_wd = input().split()
    if   t_wd > h_wd: t_won += 1
    elif t_wd < h_wd: h_won += 1
print(t_won*3 + (n-t_won-h_won), h_won*3 + (n-t_won-h_won))

Solution (Python):
import sys
import math

def str_input():
    S = raw_input()
    if S[len(S)-1] == "\r":
        return S[:len(S)-1]
    return S

p = [0, 0]

n = input()
for i in xrange(n):
    S = str_input().split()
    if S[0] < S[1]:
        p[1] += 3
    elif S[0] > S[1]:
        p[0] += 3
    else:
        p[0] += 1
        p[1] += 1

print p[0], p[1]

Solution (Python):
point_a,point_b = 0,0
for i in range(int(input())):
	k =[]
	a,b = input().split()
	k = [[i,j] for i,j in zip(a,b) if i != j]
	if k == []:
		if len(a) < len(b):
			point_b+=3
		elif len(a) > len(b):
			point_a += 3
		else:
			point_a+=1
			point_b+=1
	elif ord(k[0][0]) < ord(k[0][1]):
		point_b += 3
	else :
		point_a += 3
print(point_a,point_b)

Solution (Python):
round=int(input())
T_pt=0
H_pt=0

for i in range(round):
	pair=raw_input().split(" ")
	T_card=pair[0].lower()
	H_card=pair[1].lower()

	if T_card<H_card:
		H_pt+=3
	elif T_card>H_card:
		T_pt+=3
	else:
		T_pt+=1
		H_pt+=1
print T_pt,H_pt

Solution (Python):
round=int(input())
T_pt=0
H_pt=0

for i in range(round):
	pair=raw_input().split(" ")
	T_card=pair[0].lower()
	H_card=pair[1].lower()

	if T_card<H_card:
		H_pt+=3
	elif T_card>H_card:
		T_pt+=3
	else:
		T_pt+=1
		H_pt+=1
print T_pt,H_pt

Solution (Python):
n = input()
taro = 0
hanako = 0
for i in range(n):
    t,h = map(str, raw_input().split())
    if t > h: taro += 3
    elif t < h: hanako += 3
    else: taro += 1; hanako += 1;
print "%d %d" % (taro,hanako)

Solution (Python):
n = int(input())

taro_score = 0
hanako_score = 0
for i in range(n):
	words = input().split()
	taro_word = words[0]
	hanako_word = words[1]

	if taro_word == hanako_word:
		taro_score += 1
		hanako_score += 1
	elif taro_word > hanako_word:
		taro_score += 3
	else:
		hanako_score += 3

print("{0} {1}".format(taro_score, hanako_score))

Solution (Python):
n = int(input())
taro = 0
hanako = 0
for i in range(n):
    t,h =input().split()
    if t > h:
        taro+=3
    elif t<h:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print("%d %d" % (taro,hanako))

Solution (Python):
n = int(input())

taro = 0
hanako = 0
for ni in range(n):
    t, h = input().split()

    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1

print(taro, hanako)

Solution (Python):
n = int(input())

taro = 0
hanako = 0
for ni in range(n):
    t, h = input().split()

    if  t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1
    
print(taro, hanako)

Solution (Python):
n = int(input())

taro = 0
hanako = 0
for ni in range(n):
    t, h = input().split()
    
    if t < h :
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1
        
print(taro, hanako)

Solution (Python):
n = int(input())

taro = 0
hanako = 0
for ni in range(n):
    t, h = input().split()
    
    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1
        
print(taro, hanako)

Solution (Python):
n = int(input())

taro = 0
hanako = 0

for ni in range(n):
    t, h = input().split()
    
    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1
        
print(taro, hanako)

Solution (Python):
n = int(input())
taro = 0
hanako =0

for ni in range(n):
    t, h = input().split()

    if t < h :
        hanako += 3
    elif h < t:
        taro += 3
    else:
        hanako += 1
        taro += 1
print(taro, hanako)

Solution (Python):
n = int(input())
taro = 0
hanako = 0
for i in range(n):
    t, h = input().split()

    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1
print(taro,hanako)

Solution (Python):
n = int(input())

taro =0
hanako =0
for ni in range(n):
    t,h = input().split()

    if t<h:
        hanako +=3
    elif t>h:
        taro+=3
    else:
        hanako +=1
        taro +=1

print(taro,hanako)

Solution (Python):
n = int(input())

taro = 0
hanako = 0
for ni in range(n):
    t, h = input().split()

    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1

print(taro,hanako)

Solution (Python):
n = int(input())

taro = 0
hanako = 0
for ni in range(n):
    t, h = input().split()
    
    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1
        
print(taro, hanako)

Solution (Python):
n = int(input())

taro = 0
hanako = 0
for ni in range(n):
    t, h = input().split()
    
    if t < h:
        hanako += 3
    elif t > h:
        taro += 3
    else:
        hanako += 1
        taro += 1
        
print(taro, hanako)