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:
n = int(input())
x,y = 0,0
for i in range(n):
    d = input().split()
    if d[0] == d[1]:
        x += 1
        y += 1
    else:
        a = list(d[0])
        b = list(d[1])
        for i in range(min(len(a),len(b))):
            if int(a[i],36) > int(b[i],36):
                x += 3
                break
            elif int(a[i],36) < int(b[i],36):
                y += 3
                break
            if i == min(len(a),len(b))-1:
                if len(a) < len(b):
                    y += 3
                else:
                    x += 3

print(x,y)

Submission status: Accepted

Solution code:
import sys
lines = [line.split() for line in sys.stdin]
T = H = 0
n = int(lines[0][0])
for w1,w2 in lines[1:]:
    if w1 > w2:
        T += 3
    elif w1 < w2:
        H += 3
    else:
        T += 1
        H += 1
print (str(T) + " " + str(H))

Submission status: Accepted

Solution code:
n = int(input())
t_point = 0
h_point = 0
for i in range(n):
    card = input().split()
    taro = card[0]
    card.sort()
    card.reverse()
    if card[0] == card[1]:
        t_point += 1
        h_point += 1
    elif card[0] == taro:
        t_point += 3
    else:
        h_point += 3

print(t_point,h_point)

Submission status: Accepted

Solution code:
import sys

#fin = open("test.txt", "r")
fin = sys.stdin

n = int(fin.readline())

taros_score = 0
hanakos_score = 0
winner_points = 3
draw_points = 1

for i in range(n):
	s0, s1 = fin.readline().split()

	if s0 > s1:
		taros_score += winner_points
	elif s0 < s1:
		hanakos_score += winner_points
	else:
		taros_score += draw_points
		hanakos_score += draw_points

print(taros_score, hanakos_score)

Submission status: Accepted

Solution code:
#!usr/bin/env python3


import sys


def main():
    n = int(sys.stdin.readline().strip('\n'))
    taro_score = 0
    hanako_score = 0

    for turn in range(n):
        animals = [animal for animal in
                   sys.stdin.readline().strip('\n').split(' ')]
        if animals[0] == animals[1]:
            taro_score += 1
            hanako_score += 1
        elif max(animals[0], animals[1]) == animals[0]:
            taro_score += 3
        elif max(animals[0], animals[1]) == animals[1]:
            hanako_score += 3

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

TP = 0
HP = 0

for i in range(N):
	TC, HC = 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())
t = 0
h = 0
for i in range(n):
    taro,hana = input().split()
    if taro == hana:
        t += 1
        h += 1
    else:
        m = list((taro,hana))
        m.sort()
        if m == list((taro,hana)):
            h += 3
        else:
            t += 3
print("{} {}".format(t,h))

Submission status: Accepted

Solution code:
n = int(raw_input())
t = 0
h = 0
for i in range(n):
    line = raw_input().split()
    if line[0] == line[1]:
        t += 1
        h += 1
    elif line[0] > line[1]:
        t += 3
    else:
        h += 3
print '{0} {1}'.format(t,h)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
game_time = int(input().strip())
game_cnt = 0
p_Taro = 0
p_Hanako = 0

while game_cnt < game_time:
    game_cnt = game_cnt + 1
    Taro, Hanako = input().split(" ")
    
    if Taro > Hanako:
        p_Taro = p_Taro + 3
    elif Taro < Hanako:
        p_Hanako = p_Hanako + 3
    else:
        p_Taro = p_Taro + 1
        p_Hanako = p_Hanako + 1
    
print(p_Taro, p_Hanako)

Submission status: Accepted

Solution code:
n = int(input())
p_t = 0
p_h = 0
for i in range(n):
    c_t,c_h = map(str,input().split())
    if c_t > c_h:
        p_t += 3
    elif c_t < c_h:
        p_h += 3
    else:
        p_t += 1
        p_h += 1
print(p_t,p_h)

Submission status: Accepted

Solution code:
round = int(input())
points =[0, 0]
for r in range(round):
    taro, hanako = input().split(" ")
    if taro == hanako:
        points[0] += 1
        points[1] += 1
    elif taro > hanako:
        points[0] += 3
    elif taro < hanako:
        points[1] += 3

print(*points)

Submission status: Accepted

Solution code:
n = int(input())
a = b = 0
for _ in range(n):
    s1, s2 = [i for i in input().split()]
    if s1 == s2:
        a += 1
        b += 1
    elif s1 > s2: a += 3
    else: b += 3
print(a,b)

Submission status: Accepted

Solution code:
import sys
n = int(input())
p_t = 0
p_h = 0

for i in range(n):
	taro, hanako = input().split()
	if taro == hanako:
		p_t += 1
		p_h += 1
	else:
		l_t = list(taro)
		l_h = list(hanako)
		for j in range(min(len(l_t), len(l_h))):
			if l_t[j] != l_h[j]:
				if ord(l_t[j])<ord(l_h[j]):
					p_h += 3
					#print('taro')
					break
				else:
					p_t += 3
					#print('hanako')
					break
			else:
				if j == min(len(l_t), len(l_h))-1:
					if len(l_t)>len(l_h):
						p_t += 3
					else:
						p_h += 3
					

print(p_t, p_h)

Submission status: Accepted

Solution code:
n = int(input())
a = [[i for i in input().split()] for i in range(n)]
taroup = 0
hanakop = 0
for i in range(n):
    array =[]
    array.append(a[i][0])
    array.append(a[i][1])
    array.sort()
    if array[1] == a[i][0] and  array[1] != a[i][1]:
        taroup += 3
    elif array[1] == a[i][1] and  array[1] != a[i][0]:
        hanakop += 3
    elif array[0] == array[1]:
        taroup += 1
        hanakop += 1
print(str(taroup)+" "+str(hanakop))

Submission status: Accepted

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

print(taro, hanako)

Submission status: Accepted

Solution code:
poi = [0,0]
for mak in range(int(input())) :
    tem = input().split()
    if tem[0] == tem[1] :
        poi[0] += 1
        poi[1] += 1
    else :
        che = sorted(tem)

        if tem[0] != che[0] : poi[0] += 3
        else                : poi[1] += 3

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

Submission status: Accepted

Solution code:
n = int(input())
ans = [0, 0]
for i in range(n):
    [t, h] = input().split()
    sort = [t, h]
    sort.sort()
    if t==h:
        ans[0] += 1
        ans[1] += 1
    elif [t, h]==sort:
        ans[1] += 3
    else:
        ans[0] += 3

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

Submission status: Accepted

Solution code:
taro_score = 0
hanako_score = 0

for i in range(int(input())):
    taro,hanako = input().split()
    if taro < hanako:
        hanako_score += 3
    elif taro > hanako:
        taro_score += 3
    else:
        taro_score += 1
        hanako_score += 1
        
print(str(taro_score),str(hanako_score))

Submission status: Accepted

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

import sys
import os


N = int(input())
score0 = 0
score1 = 0
for i in range(N):
    word0, word1 = input().split()
    if word0 < word1:
        score1 += 3
    elif word0 > word1:
        score0 += 3
    else:
        score0 += 1
        score1 += 1
print(score0, score1)

Submission status: Accepted

Solution code:
count = int(input())
Taro_an = []
Hanako_an = []
Ts = 0
Hs = 0
for i in range(count) :
    animal = input().split(" ")
    Taro_an = animal[0]
    Hanako_an = animal[1]
    if Taro_an > Hanako_an :
        Ts += 3
    else :
        if Hanako_an > Taro_an :
            Hs += 3
        else :
            Ts += 1; Hs += 1
print(Ts,Hs)

Submission status: Accepted

Solution code:
n = int(input())
s_taro,s_hanako = 0,0

for trial in range(n):
    taro,hanako = list(map(str, input().split()))
    if taro > hanako:
        s_taro += 3
    elif taro < hanako:
        s_hanako += 3
    else:
        s_taro += 1
        s_hanako += 1

print(s_taro, s_hanako)

Submission status: Accepted

Solution code:
n = int(input())

score_taro, score_hanako = 0, 0
for _ in range(n):
    card_taro, card_hanako = input().split()

    point_taro = 0
    point_hanako = 0
    if card_taro == card_hanako:
        score_taro += 1
        score_hanako += 1
        continue
    for i in range(min(len(card_taro), len(card_hanako))):
        if len(card_taro) > len(card_hanako):
            point_taro = 3
        elif len(card_taro) < len(card_hanako):
            point_hanako = 3
        if ord(card_taro[i:i+1]) > ord(card_hanako[i:i+1]):
            point_taro = 3
            point_hanako = 0
            break
        if ord(card_taro[i:i+1]) < ord(card_hanako[i:i+1]):
            point_taro = 0
            point_hanako = 3
            break
    score_taro += point_taro
    score_hanako += point_hanako
print("{0} {1}".format(score_taro, score_hanako))

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !

def compute_card_game_score():
    players = ("player_A", "player_B")
    (score, cards) = ("score", "cards")
    
    #load data
    game_log = {player : {score : 0, cards : []} for player in players}
    try:
        tmp = input()
        while(True):
            cards_pair = input().rstrip().split()
            [ game_log[player][cards].append(cards_pair[i]) for i,player in enumerate(players) ]
    except EOFError:
        pass
    except:
        return inputError()
    
    #compute score
    for pairs in zip(game_log[players[0]][cards], game_log[players[1]][cards]):
        if pairs[0] == pairs[1] :
            for player in players:
                game_log[player][score] += 1
        elif pairs[0] > pairs[1] :
            game_log[players[0]][score] += 3
        elif pairs[0] < pairs[1] :
            game_log[players[1]][score] += 3
    
    print( " ".join([ str(game_log[player][score]) for player in players ]) )
    
def inputError():
    print("input Error")
    return -1


#test
if __name__ == "__main__" :
    compute_card_game_score()

Submission status: Accepted

Solution code:
n = int( input() )
t_won = 0
h_won = 0

for _ in range(n):
    t, h = input().split(" ")
    if t < h:
        h_won += 1
    if t > h:
        t_won += 1
print(t_won*3 + (n - t_won - h_won), h_won*3 + (n - t_won - h_won))

Submission status: Accepted

Solution code:
#!/usr/bin/env python

n = int(input())

tScore = 0
hScore = 0

for i in range(n):
    T, H = input().split()
    if T == H:
        tScore += 1
        hScore += 1
    elif T > H:
        tScore += 3
    elif H > T:
        hScore +=3
print("%d %d" % (tScore, hScore))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
Taro, Hanako = 0, 0
for _ in range(n):
    a, b = input().split()
    li = sorted(list((a, b)))
    if a == b:
        Taro += 1
        Hanako += 1
    elif a == li[1]:
        Taro += 3
    else:
        Hanako += 3
print("{} {}".format(Taro,Hanako))

Submission status: Accepted

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

    points = [0, 0]

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

        points = map(lambda x, y: x+y, points, judge(t, h))

    print("{0[0]} {0[1]}".format(list(points)))

def judge(t, h):
    if t < h:
        return (0, 3)
    elif t > h:
        return (3, 0)

    return (1, 1)

if __name__ == '__main__': main()

Submission status: Accepted

Solution code:
n = int(input())
ts = 0
hs = 0
for i in range(n):
 taro, hanako = input().split()
 if taro > hanako:
  ts += 3
 elif taro < hanako:
  hs += 3
 else:
  ts += 1
  hs += 1
print(str(ts) + " " + str(hs))

Submission status: Accepted

Solution code:
#coding:utf-8

n = int(input().rstrip())
toku =[0,0]
narabe = []

for i in range(n):
    taro, hana = input().rstrip().split()
    if taro == hana:
        toku[0] +=1
        toku[1] +=1

    else:
        narabe = [taro, hana]
        narabe.sort()
        toku[0] += narabe.index(taro)*3
        toku[1] += narabe.index(hana)*3
    
print(" ".join(list(map(str,toku))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
point_t = 0
point_h = 0
n = int(input())
for i in range(n):
    card_t, card_h = input().split()
    if card_t > card_h:
        point_t += 3
    if card_t < card_h:
        point_h += 3
    if card_t == card_h:
        point_t += 1
        point_h += 1
print(point_t, point_h)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(taro, hanako)

Submission status: Accepted

Solution code:
n=input()
t_p=0
h_p=0
for i in range(int(n)):
    t,h=input().split()
    a=sorted([t,h])
    if t == h:
        t_p+=1
        h_p+=1
    elif t  == a[1]:
        t_p+=3
    else:
        h_p+=3
print(t_p, h_p)

Submission status: Accepted

Solution code:
n = int(input())
T_point = 0
H_point = 0
for i in range(n):
    Taro, Hanako = input().split()
    if Taro > Hanako:
        T_point += 3
    elif Hanako > Taro:
        H_point += 3
    else:
        T_point += 1
        H_point += 1
print(T_point, H_point)

Submission status: Accepted

Solution code:
t=int(input())
taro=0
hanako=0
for i in range(t):
    S=input().split()

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

Submission status: Accepted

Solution code:
n = int(input())

a = 0
b = 0

for _ in range(n):
    word_a, word_b = input().split()

    words = [word_a, word_b]
    words.sort()

    if word_a == word_b:
        a += 1
        b += 1
    elif words.index(word_a) == 1:
        a += 3
    else:
        b += 3

print(a, b)

Submission status: Accepted

Solution code:
n = int(input())
a, b = 0, 0
for i in range(n):
    s1, s2 = input().split()
    if s1 > s2:
        a += 3
    elif s1 == s2:
        a += 1
        b += 1
    else:
        b += 3
print('{0} {1}'.format(a, b))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????????????????£?????????
"""
turns = int(input().strip())
hanako = 0
tarou = 0
for i in range(turns) :
   tcard, hcard = input().strip().split()

   if tcard == hcard :
       hanako += 1
       tarou += 1
   elif tcard > hcard :
       tarou += 3
   else:
       hanako += 3

print("{0} {1}".format(tarou,hanako))

Submission status: Accepted

Solution code:
n=int(input())
pointx=0
pointy=0
for i in range(n):
    x,y=[j for j in input().split()]
    p=1
    if len(x)<len(y):
        for j in range(len(x)):
            if ord(list(x)[j])>ord(list(y)[j]):
                pointx=pointx+3
                p=0
                break
            elif ord(list(x)[j])<ord(list(y)[j]):
                pointy=pointy+3
                p=0
                break
        if p:
            pointy=pointy+3
    elif len(x)==len(y):
        for j in range(len(x)):
            if ord(list(x)[j])>ord(list(y)[j]):
                pointx=pointx+3
                p=0
                break
            elif ord(list(x)[j])<ord(list(y)[j]):
                pointy=pointy+3
                p=0
                break
        if p:
            pointx=pointx+1
            pointy=pointy+1
    else:
        for j in range(len(y)):
            if ord(list(x)[j])>ord(list(y)[j]):
                pointx=pointx+3
                p=0
                break
            elif ord(list(x)[j])<ord(list(y)[j]):
                pointy=pointy+3
                p=0
                break
        if p:
            pointx=pointx+3
print("{0} {1}".format(pointx,pointy))

Submission status: Accepted

Solution code:
n = int(input())
taro,hanako = 0,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('{0} {1}'.format(taro,hanako))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    Card = tuple(tuple(input().split()) for _ in range(N))

    taro = 0
    hanako = 0
    for c in Card:
        if c[0] > c[1]:
            taro += 3
        elif c[0] < c[1]:
            hanako += 3
        else:
            taro += 1
            hanako += 1

    print(taro, hanako)

main()

Submission status: Accepted

Solution code:
n = int(input())
L=[]
st=0
sh=0
for i in range(n):
    x,y=input().split()
    L.append([x,y])




for i in L:
    j=sorted(i)
    if i[0] == i[1]:
        st+=1
        sh+=1
    else:
        if i[0] ==j[0]:
            sh += 3
        else:
            st+=3


print (st,sh)

Submission status: Accepted

Solution code:
n=int(input())

T=0
H=0

for i in range(n):
    t,h=list(input().split())
    if t==h:
        T+=1
        H+=1
    elif t>h:
        T+=3
    elif t<h:
        H+=3
        
print(T,H)

Submission status: Accepted

Solution code:
n_turn = int(input())
t_point = h_point = 0
for i in range(n_turn):
    t_card, h_card = input().split()
    if t_card > h_card:
        t_point += 3
    elif t_card == h_card:
        t_point += 1
        h_point += 1
    else:
        h_point += 3
print("{} {}".format(t_point, h_point))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
HPOINT=0
TPOINT=0
for _ in range(n):
  HANAKO,TAROU=input().split()
  if HANAKO>TAROU:
    HPOINT += 3
  elif HANAKO<TAROU:
    TPOINT += 3
  elif HANAKO==TAROU:
    HPOINT+=1
    TPOINT+=1
print(HPOINT,TPOINT)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
tp = 0
hp = 0
for _ in range(n):
    taro,hanaco = input().split()
    if taro == hanaco :
        tp +=1
        hp +=1
    elif taro > hanaco :
        tp += 3
    else: hp += 3
print('{} {}'.format(tp,hp))

Submission status: Accepted

Solution code:
loop = int(raw_input())
taro = []
hanako = []
taro_score = 0
hanako_score = 0
for i in range(loop):
    t, h = raw_input().split()
    taro += [t]
    hanako += [h]

for t, h in zip(taro,hanako):
    if t < h:
        hanako_score += 3
    if t > h:
        taro_score += 3
    if t == h:
        taro_score += 1
        hanako_score += 1
print "%d %d" % (taro_score, hanako_score)

Submission status: Accepted

Solution code:
# Aizu Problem ITP_1_9_C: String Game
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


taro, hanako = 0, 0
n = int(input())
for _ in range(n):
    s1, s2 = input().split()
    if s1 == s2:
        taro += 1
        hanako += 1
    elif s1 > s2:
        taro += 3
    else:
        hanako += 3

print(taro, hanako)

Submission status: Accepted

Solution code:
turn=int(input())
ten=[0,0]

for _ in range(turn):
    hikaku = input().split()
    if hikaku[0] < hikaku[1]:
        ten[1] +=3

    elif hikaku[0] > hikaku[1]:
        ten[0] +=3

    else:
        ten[0]+=1
        ten[1]+=1

print(" ".join(map(str,ten)))

Submission status: Accepted

Solution code:
n = int(input())
T_point = 0
H_point = 0
for i in range(n):
    T_card, H_card = input().split()
    if T_card > H_card:
        T_point += 3
    elif H_card > T_card:
        H_point += 3
    else:
        T_point += 1
        H_point += 1
print(T_point, H_point)

Submission status: Accepted

Solution code:
n=int(input())
t=0
h=0
for i in range(n):
    a,b=map(str,input().split())
    if a<b:
        h+=3
    
    elif a>b:
        t+=3
    else:
        t+=1
        h+=1
print("{} {}".format(t,h))

Submission status: Accepted

Solution code:
n = int(input())
taro = 0
hana = 0
for _ in range(n):
	taro_c, hana_c = input().split()
	if taro_c > hana_c:
		taro += 3
	elif hana_c > taro_c:
		hana += 3
	else:
		taro += 1
		hana += 1

print(taro, hana)

Submission status: Accepted

Solution code:
n = int(input())
t = 0
h = 0

for _ in range(n):
    tc, hc = input().split()

    if tc > hc:
        t += 3
    elif tc < hc:
        h += 3
    else:
        t += 1
        h += 1

print(t, h)

Submission status: Accepted

Solution code:
Pt = 0
Ph = 0

n = int(input())

for i in range(n):
    I = input().split()
    Taro = I[0]
    Hanako = I[1]
    if Taro > Hanako:
        Pt += 3
    if Taro < Hanako:
        Ph += 3
    if Taro == Hanako:
        Pt += 1
        Ph += 1

print(str(Pt) + ' ' + str(Ph))

Submission status: Accepted

Solution code:
n = int(input())

score = [0, 0]
for i in range(n):
    c = input().split()
    if c[0] == c[1]:
        score[0] += 1
        score[1] += 1
    elif c[0] < c[1]:
        score[1] += 3
    else:
        score[0] += 3

print(*score)

Submission status: Accepted

Solution code:
times = int(input())
taro_s = 0
hanako_s = 0
for i in range(times):
    taro_a, hanako_a = input().split()
    if taro_a > hanako_a:
        taro_s += 3
    elif taro_a < hanako_a:
        hanako_s += 3
    else:
        hanako_s += 1
        taro_s += 1
print(taro_s, hanako_s)

Submission status: Accepted

Solution code:
class Reader:
    def __init__(self):
        self.l = 0
        self.r = 0

    def __call__(self, s):
        l, r = s.split()
        if l > r:
            self.l += 3
        elif l < r:
            self.r += 3
        else:
            self.l += 1
            self.r += 1

    def __str__(self):
        return "{} {}".format(self.l, self.r)

reader = Reader()

n = int(input())
for _ in range(n):
    reader(input())
print(reader)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num_of_match=int(input())
poi_of_1=0
poi_of_2=0
for i in range(num_of_match):
    car_1,car_2=input().split()
    if car_1==car_2:
        poi_of_1+=1
        poi_of_2+=1
    elif car_1>car_2:
        poi_of_1+=3
    elif car_1<car_2:
        poi_of_2+=3
print(poi_of_1,poi_of_2)

Submission status: Accepted

Solution code:
taro = hanako = 0
for i in range(int(input())):
    tcard, hcard = input().split()
    if tcard == hcard:
        taro += 1
        hanako += 1
    elif tcard > hcard:
        taro += 3
    else:
        hanako += 3

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

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(raw_input())
scores = [0,0]
for i in range(n):
    tarou, hanako = raw_input().split()
    if tarou > hanako:
        scores[0] += 3
    elif tarou < hanako:
        scores[1] += 3
    else:
        scores[0] += 1
        scores[1] += 1

print scores[0], scores[1]

Submission status: Accepted

Solution code:
T, H = 0, 0
for i in range(int(input())):
    a, b = input().split()
    if a == b:
        T, H = T + 1, H + 1
    if a < b:
        H += 3
    if a > b:
        T += 3
print(T, H)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
taro_p = hana_p = 0
for n in range(N):
  tw,hw = input().split()
  if tw == hw:
    taro_p += 1
    hana_p += 1
  elif tw < hw:
    hana_p += 3
  else :
    taro_p += 3

print(taro_p,hana_p)

Submission status: Accepted

Solution code:
num = int(raw_input())

taro = 0
hanako = 0

for i in range(num):
	cards = raw_input().split()
	if cards[0] < cards[1]:
		hanako += 3
	elif cards[0] == cards[1]:
		taro += 1
		hanako += 1
	else:
		taro += 3

print("{:} {:}".format(taro, hanako))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

tp = 0
hp = 0

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

print('%d %d' % (tp, hp) )

Submission status: Accepted

Solution code:
def main():

    match_count = int(input())
    matches = [input().split() for i in range(match_count)]
    
    taro_result = [3 if match[0] > match[1] else 1 if match[0] == match[1] else 0 for match in matches]
    print('%d %d' % (sum(taro_result), sum(3 if item == 0 else 1 if item == 1 else 0 for item in taro_result)) )


main()

Submission status: Accepted

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

print('%d %d' % (tc, hc))

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
taro = hanako = 0
for i in range(n):
    a, b = input().split()
    if a == b:
        taro += 1
        hanako += 1
    elif a > b:
        taro += 3
    else:
        hanako += 3
print(taro, hanako)

Submission status: Accepted

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

def main():

    inputLine = int(input())

    taro = hanako = 0

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

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



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
p_taro = 0
p_hanako = 0
for i in range(n):
	taro, hanako = map(str, input().split())
	cards = tuple(sorted((taro, hanako)))
	#print(cards)

	if taro == hanako:
		p_taro += 1
		p_hanako += 1
	else:
		if cards == (taro, hanako):
			p_hanako += 3
			#print("hanako win")
		else:
			p_taro += 3
			#print("taro win")

print(p_taro, p_hanako)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    point_t = 0
    point_h = 0
    for _ in range(n):
        t, h = input().split()
        if t == h:
            point_t += 1
            point_h += 1
        elif t > h:
            point_t += 3
        else:
            point_h += 3

    print(point_t, point_h)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(list(map(str, input().split())))   
    
taro = []
hanako = []
for i in range(len(a)):
    if a[i][0] > a[i][1]:
        taro.append(3)
    elif a[i][0] == a[i][1]:
        taro.append(1)
        hanako.append(1)
    else:
        hanako.append(3)
print(sum(taro),sum(hanako))

Submission status: Accepted

Solution code:
n1 = n2 = 0
for _ in range(int(input())):
    a, b = input().split()
    if a == b:
        n1 += 1
        n2 += 1
        continue
    if sorted((a,b))[0] == b:
        n1 += 3
    else:
        n2 += 3

print(n1, n2)

Submission status: Accepted

Solution code:
count = int(input())
Tpoint = 0
Hpoint = 0
for i in range(count):
    Twrite,Hwrite = map(str,input().split())
    if Twrite == Hwrite:
        Tpoint = Tpoint + 1
        Hpoint = Hpoint + 1
    elif Twrite > Hwrite:
        Tpoint = Tpoint + 3
    else:
        Hpoint = Hpoint + 3
print('{0} {1}'.format(Tpoint,Hpoint))

Submission status: Accepted

Solution code:
num = int(input())

tscore, hscore = 0, 0
for i in range(num):
    ts, hs = input().split()
    if ts > hs:
        tscore += 3
    elif ts < hs:
        hscore += 3
    else:
        tscore += 1
        hscore += 1
print(tscore, hscore)

Submission status: Accepted

Solution code:
tarou = hanako = 0
for _ in range(int(input())):
    s1, s2 = input().split()
    if s1 == s2:
        tarou += 1
        hanako += 1
    elif s1 > s2:
        tarou += 3
    else:
        hanako += 3
print(tarou, hanako)

Submission status: Accepted

Solution code:
n = int(input())
t = 0
h = 0

for _ in range(n):
    tc, hc = input().split()

    if tc > hc:
        t += 3
    elif tc < hc:
        h += 3
    else:
        t += 1
        h += 1

print(t, h)

Submission status: Accepted

Solution code:
# coding:utf-8
n = input()
taro_cnt = 0
hanako_cnt = 0
taro = ["" for i in range(n)]
hanako = ["" for i in range(n)]
for i in range(n):
    split = raw_input().split()
    taro[i] = split[0]
    hanako[i] = split[1]
for i in range(n):
    if taro[i] > hanako[i]:
        taro_cnt += 3
    elif taro[i] < hanako[i]:
        hanako_cnt += 3
    else:
        taro_cnt += 1
        hanako_cnt += 1
else:
    print taro_cnt,hanako_cnt

Submission status: Accepted

Solution code:
taro = 0
hanako = 0
n = int(input())
for _ in range(n):
    t_c, h_c = input().strip().split()
    if t_c < h_c:
        hanako += 3
    elif t_c == h_c:
        taro += 1
        hanako += 1
    else:
        taro += 3
print ('{} {}'.format(taro, hanako))