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



Sample input:
3
cat dog
fish fish
lion tiger


Sample output:
1 7

Submission status: Accepted

Solution code:
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'])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
n = input()
taro = 0
hanako = 0
for i in range(n):
    x = map(str, raw_input().split())
    #print x[0]
    #print x[1]
    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)

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#coding:utf-8
#1_9_C 2015.4.10
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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 ) )

Submission status: Accepted

Solution code:
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 ) )

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n = int(raw_input())
ts=0 #taro score
hs=0 #hanako score
for x in xrange(n):
    #tc:taro card/hc:hanako card
    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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# coding: utf-8


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])

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#encoding=utf-8

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)

Submission status: Accepted

Solution code:
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)#A???????????????????????????
		if A == B:#hanako??????????°???????
			hanako+=3
		else:
			taro+=3
print(taro,hanako)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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]

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n=int(input())
T,H=0,0
for i in range(n):
    t_card,h_card=input().split()
    if t_card>h_card:
        T+=3
    elif t_card<h_card:
        H+=3
    else:
        T+=1
        H+=1
print(str(T)+" "+str(H))

Submission status: Accepted

Solution code:
i = int(input())

tarou = 0
hanako = 0

for x in range(i):
    a,b = input().split()
    if b > a:
        hanako += 3
    elif a > b:
        tarou += 3
    else:
        hanako += 1
        tarou += 1
print("{0} {1}".format(tarou, hanako))

Submission status: Accepted

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

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

print(taro, hanako)

Submission status: Accepted

Solution code:
t = h = 0
for _ in range(int(input())):
    taro, hanako = input().split()
    if taro > hanako:
        t += 3
    elif hanako > taro:
        h += 3
    elif taro == hanako:
        t += 1
        h += 1
print(t, h)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = input()
x = y = 0
for _ in xrange(n):
 a, b = raw_input().split()
 if a==b:
  x += 1
  y += 1
 elif a>b:
  x += 3
 else:
  y += 3
print x, y

Submission status: Accepted

Solution code:
tarou = 0
hanako = 0
n = int(input())
for i in range(n):
    str1, str2 = input().split()
    if str1 > str2:
        tarou += 3
    elif str1 < str2:
        hanako += 3
    else:
        tarou += 1
        hanako += 1
print("{0} {1}".format(tarou, hanako))

Submission status: Accepted

Solution code:
n = int(raw_input())
score_taro, score_hana = 0, 0

for i in range(n):
    taro, hana = raw_input().split(" ")

    if taro > hana:
        score_taro += 3
    elif taro < hana:
        score_hana += 3
    else:
        score_taro += 1
        score_hana += 1

print(str(score_taro) + " " + str(score_hana))

Submission status: Accepted

Solution code:
t = 0
h = 0

for i in range(int(input())):
    cards = input().split()
    if cards[0] > cards[1]:
        t += 3
    elif cards[0] == cards[1]:
        t += 1
        h += 1
    else:
        h += 3
        
print(str(t) + " " + str(h))

Submission status: Accepted

Solution code:
n = int(raw_input())

point = [0, 0]
for i in range(n):
    word = map(str, raw_input().split())
    if word[0] == word[1]:
        point[0] += 1
        point[1] += 1
    elif len(word[0]) >= len(word[1]):
        for j in range(len(word[1])):
            if word[0][j] == word[1][j]:
                if j == len(word[1])-1:
                    point[0] += 3
                continue
            elif word[0][j] > word[1][j]:
                point[0] += 3
                break
            else:
                point[1] += 3
                break
    else:
        for j in range(len(word[0])):
            if word[0][j] == word[1][j]:
                if j == len(word[0])-1:
                    point[1] += 3
                continue
            elif word[0][j] > word[1][j]:
                point[0] += 3
                break
            else:
                point[1] += 3
                break
print "%d %d" % (point[0], point[1])

Submission status: Accepted

Solution code:
s = int(input())
t = h = 0
for _ in range(s):
    tc, hc = input().split()
    if tc == hc:
        t += 1
        h += 1
    elif tc > hc :
        t += 3
    else:
        h += 3
print(t, h)

Submission status: Accepted

Solution code:
n = int(input())
tarou = 0
hanako = 0
for i in range(n):
    w1, w2 = input().split()
    if w1 == w2:
        tarou += 1
        hanako += 1
    elif w1 > w2:
        tarou += 3
    else:
        hanako += 3

print(tarou, hanako)

Submission status: Accepted

Solution code:
n = int(input())
Taro = 0
Hanako = 0

for i in range(n):
    x = 0
    t,h = input().split()
    for j in range(min(len(t),len(h))):
        if t == h:
            Hanako += 1
            Taro += 1
            x = 1 
            break
        if ord(t[j:j+1]) > ord(h[j:j+1]):
            Taro += 3
            x = 1
            break
        if ord(t[j:j+1]) < ord(h[j:j+1]):
            Hanako += 3
            x = 1
            break
    if x == 0:
        if len(t) > len(h):
            Taro += 3
        elif len(t) < len(h):
            Hanako += 3
	

print("{} {}".format(Taro,Hanako))

Submission status: Accepted

Solution code:
n = int(input())
Taro = 0
Hanako = 0

for i in range(n):
    t,h = input().split()
    if t == h:
        Hanako += 1
        Taro += 1
    elif t> h:
        Taro += 3
    else:
         Hanako += 3
print("{} {}".format(Taro,Hanako))

Submission status: Accepted

Solution code:
n = int(input())

t_score = 0
h_score = 0


for i in range(n):
 t, h = input().split()
 if t == h:
  t_score += 1
  h_score += 1
  continue
 if len(t) >= len(h):
  for j in range(len(h)):
   if ord(t[j]) > ord(h[j]):
    t_score += 3
    break
   elif ord(t[j]) < ord(h[j]):
    h_score += 3
    break
  else:
   t_score += 3
 elif len(t) < len(h):
   for j in range(len(t)):
    if ord(t[j]) > ord(h[j]):
     t_score += 3
     break
    elif ord(t[j]) < ord(h[j]):
     h_score += 3
     break
   else:
    h_score += 3

   
print("{0} {1}".format(t_score, h_score))

Submission status: Accepted

Solution code:
# coding:utf-8
N=int(input())

taro_pt=0
hanako_pt=0
for i in range(0,N):
    taro_str,hanako_str=map(str,input().split())
    if taro_str>hanako_str:
        taro_pt=taro_pt+3
    elif taro_str<hanako_str:
        hanako_pt=hanako_pt+3
    else:
        taro_pt=taro_pt+1
        hanako_pt=hanako_pt+1

print(str(taro_pt)+" "+str(hanako_pt))

Submission status: Accepted

Solution code:
round = int(raw_input())
score = {"taro":0, "hanako":0}
counter = 0
while counter < round:
    [taro,hanako] = raw_input().split()
    if taro < hanako:
        score["hanako"] += 3
    elif taro > hanako:
        score["taro"] += 3
    else:
        score["taro"] += 1
        score["hanako"] += 1
    counter += 1

print score["taro"], score["hanako"]

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    # ??????????????\???
    game_count = int(input())
    deck_taro = [''] * game_count
    deck_hanako = [''] * game_count
    for i in range(game_count):
        data = [x for x in input().split(' ')]
        deck_taro[i] = data[0]
        deck_hanako[i] = data[1]

    # ?????????????????????????????¨?????°?¨????
    point_taro = 0
    point_hanako = 0
    for i in range(game_count):
        if deck_taro[i] < deck_hanako[i]:
            point_hanako += 3
        elif deck_taro[i] > deck_hanako[i]:
            point_taro += 3
        else:
            point_hanako += 1
            point_taro += 1

    # ???????????????
    print('{0} {1}'.format(point_taro, point_hanako))

Submission status: Accepted

Solution code:
n = int(input())
taro = 0
hana = 0
for c in range(0,n):
    word = input().split(' ')
    taro_w, hana_w = word[0], word[1]
    word.sort()
    if word[0] == word[1]:
        taro += 1
        hana += 1
    elif taro_w == word[0]:
        hana += 3
    else:
        taro += 3
print("%d %d" % (taro, hana))

Submission status: Accepted

Solution code:
N=int(input())
x=0
y=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)

Submission status: Accepted

Solution code:
taro = hanako = 0                    
for _ in range(int(input())):        
  t, h = input().split()             
  if t == h:                         
    taro += 1                        
    hanako += 1                      
  elif t > h:                        
    taro += 3                        
  else:                              
    hanako += 3                      
print("{} {}".format(taro, hanako))

Submission status: Accepted

Solution code:
n = int(input())
st, sh = 0, 0
for i in range(n):
    t, h = map(str, input().split())
    if t > h:
        st += 3
    elif t < h:
        sh += 3
    else:
        st += 1
        sh += 1
print(st, sh)

Submission status: Accepted

Solution code:
n=int(input())
A=0
B=0
for i in range(n):
	a,b=input().split()
	if a>b:
		A+=3
	elif a==b:
		A+=1
		B+=1
	else:
		B+=3
print(A,B)

Submission status: Accepted

Solution code:
t,h=0,0
for _ in range(int(input())):
    a,b=input().split()
    if a == b:
        t+=1
        h+=1
    elif a < b:
        h+=3
    else:
        t+=3
print(t,h)

Submission status: Accepted

Solution code:
i = int(input())

taro = 0
hanako = 0
for i in range(i):
    a, b = input().split()

    if a > b:
        taro += 3
    elif a < b:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro, hanako)

Submission status: Accepted

Solution code:
n = int(input())

t, h = 0, 0

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

print(t, h)

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
t_p = 0
h_p = 0

for _ in range(n):
    t_w, h_w = input().split()
    if t_w > h_w:
        t_p += 3
    elif h_w > t_w:
        h_p += 3
    else:
        t_p += 1
        h_p += 1
        
print(t_p, h_p)

Submission status: Accepted

Solution code:
n=eval(input())
taro=[]
hanako=[]
for i in range(n):
    x,y=input().split()
    taro.append(x)
    hanako.append(y)
T=0
H=0
for i in range(n):
    if taro[i]<hanako[i]:
        H=H+3
    elif taro[i]>hanako[i]:
        T=T+3
    else:
        H=H+1
        T=T+1
print(T,H)

Submission status: Accepted

Solution code:
count = int(input())
t, h = 0, 0
for line in range(count):
    s1,s2 = input().split()
    if s1 > s2:
        t += 3
    elif s1 < s2:
        h += 3
    else:
        t += 1
        h += 1
print(t, h)

Submission status: Accepted

Solution code:
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:
        taro += 1
        hanako += 1
print(taro, hanako)

Submission status: Accepted

Solution code:
score = {"taro":0, "hanako":0}
n = int(input())

for i in range(n):
    words = input().split()

    if words[0] > words[1]:
        score["taro"] += 3
    elif words[0] < words[1]:
        score["hanako"] += 3
    else:
        score["taro"] += 1
        score["hanako"] += 1

print(score["taro"], score["hanako"])

Submission status: Accepted

Solution code:
#coding:utf-8

N = int(input())
taro = 0
hanako = 0
for i in range(N):
	strs = input().split()
	if strs[0] > strs[1]:
		taro += 3
	elif strs[0] < strs[1]:
		hanako += 3
	else:
		taro+=1
		hanako+=1

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

Submission status: Accepted

Solution code:
n=int(input())
s=[0,0]
for i in range(n):
    t, h = input().strip().split()
    if t>h:
        s[0] += 3
    elif t<h:
        s[1] += 3
    else:
        s[0] += 1
        s[1] += 1
print(*s)

Submission status: Accepted

Solution code:
n = int(input())

card = ['' for i in range(n)]
score1 = 0
score2 = 0


def win(score):
    score += 3
    return score


def draw(score):
    score += 1
    return score

for i in range(n):
    card[i] = [j for j in input().split()]

for i in range(n):
    if card[i][0] == card[i][1]:
        score1 = draw(score1)
        score2 = draw(score2)
    else:
        if card[i][0] > card[i][1]:
            score1 = win(score1)
        else:
            score2 = win(score2)

print(score1,score2)

Submission status: Accepted

Solution code:
n = int(raw_input())
taro = 0
hanako = 0

for i in range(n):
    S = (raw_input()).split(" ")
    if (S[0] > S[1]):
        taro += 3
    elif (S[0] == S[1]):
        hanako += 1
        taro += 1
    else:
        hanako += 3

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

Submission status: Accepted

Solution code:
n = int(input())
TARO = HANAKO = 0
for i in range(n):
    taro, hanako = input().split()
    if taro == hanako:
        TARO += 1
        HANAKO += 1
    elif taro > hanako:
        TARO += 3
    elif taro < hanako:
        HANAKO += 3
print(TARO, HANAKO)

Submission status: Accepted

Solution code:
h=t=0
for _ in range(int(input())):
    a,b=input().split()
    if a>b:t+=3
    elif a<b:h+=3
    else:t+=1;h+=1
print(t,h)