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())
list_point = [0, 0]

for _ in range(n):
    word1, word2 = map(str, input().split(" "))
    if word1 == word2:
        list_point[0] += 1
        list_point[1] += 1
    elif word1 > word2:
        list_point[0] += 3
    elif word1 < word2:
        list_point[1] += 3
    else:
        print("Error!")

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

Submission status: Accepted

Solution code:
n = int(input())
t = 0
h = 0
for _ 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:
n = int(input())

a = 0
b = 0
for i in range(n):
  aw , bw = input().split()
  
  if aw > bw:
    a += 3
  elif aw < bw :
    b += 3
  else :
    a += 1
    b += 1

print(a,b)

Submission status: Accepted

Solution code:
import string
a=0
b=0

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

Submission status: Accepted

Solution code:
cards = int(input())
tarou_win = 0
hanako_win = 0
hikiwake = 0
for _ in range(cards):
    tarou_word, hanako_word = input().split() 
    if tarou_word > hanako_word:
        tarou_win += 1
    elif tarou_word < hanako_word:
        hanako_win += 1
    else :
        hikiwake += 1
print(tarou_win * 3 + hikiwake ,hanako_win * 3 + hikiwake)

Submission status: Accepted

Solution code:
n = input()
hana = 0
taro = 0
while True:
  try:
    a, b = input().split()
    if a < b:
      hana += 3
    elif a == b:
      hana += 1
      taro += 1
    else:
      taro += 3
  except EOFError:
    break
print(taro, hana)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
x = 0
y = 0
for i in range(a):
    b,c = input().split(' ')
    if b < c:
        x = x + 3
    elif b == c:
        x = x + 1
        y = y + 1
    elif b > c:
        y = y + 3
print(str(y) + ' ' + str(x))

Submission status: Accepted

Solution code:
n = int(input())
point = [0,0]
for _ in range(n):
    a,b = input().split()
    if a==b:
        point = list(map(lambda x:x+1 ,point))
    elif a > b:
        point[0]+=3
    else:
        point[1]+=3
print(*point)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

taro_point = 0
hana_point = 0

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

    if t > h:
        taro_point += 3

    elif t < h:
        hana_point += 3

    else:
        taro_point += 1
        hana_point += 1

print(taro_point, hana_point)

Submission status: Accepted

Solution code:
N = int(input())
a_score = 0
b_score = 0
for i in range(N):
  a = list(x for x in input().split())
  if a[0] == a[1]:
    a_score += 1
    b_score += 1
  else:
    b = sorted(a)
    if a[0] == b[0]:
      b_score += 3
    else:
      a_score += 3
print(f'{a_score} {b_score}')

Submission status: Accepted

Solution code:
x = 0
y = 0
n = int(input())
for i in range(n):
    a, b = map(str,input().split())
    if a > b:
        x += 3
    if a < b:
        y += 3
    if a == b:
        x += 1
        y += 1

print(x,y)

Submission status: Accepted

Solution code:
n=int(input())
taro=0
hanako=0
for i in range(n):
    a,b=map(str,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:
a = int(input())
b = 0
c = 0
for i in range(a):
    d, e = map(str,input().split())
    if d < e :
        c += 3
    elif d > e  :
        b += 3
    else:
        b += 1
        c += 1
print(b,c)

Submission status: Accepted

Solution code:
n=int(input())
a=0
b=0

for i in range(n):
    card=input().split()
    if card[0]>card[1]:
        a+=3
    elif card[0]<card[1]:
        b+=3
    else:
        a+=1
        b+=1

print(a, b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#9-3

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

Submission status: Accepted

Solution code:
n = int(input())

i=0
taro=0
hanako=0
while i<n:
  t, h=input().split()
  
  if t>h:
    taro+=3
  
  elif t==h:
    taro+=1
    hanako+=1
  
  elif t<h:
    hanako+=3

  i+=1
  
print(str(taro)+' '+str(hanako))

Submission status: Accepted

Solution code:
n = int(input())

score = [0,0]
for _ in range(n):
    card = list(map(str, input().split()))
    if card[0] > card[1]:
        score = list(map(lambda x,y: x+y, score, [3,0]))
    elif card[0] < card[1]:
        score = list(map(lambda x,y: x+y, score, [0,3]))
    else:
        score = list(map(lambda x,y: x+y, score, [1,1]))
print(*score)

Submission status: Accepted

Solution code:

n=int(input())
a=0
b=0
for i in range(n):
    A,B=map(str,input().split())
    if A>B:
        a+=3
    if A<B:
        b+=3
    if A==B:
        a+=1
        b+=1
print(a,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

p_taro = 0
p_hanako = 0

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

    if t > h:
        p_taro += 3
    elif h > t:
        p_hanako += 3
    else:
        p_taro += 1
        p_hanako += 1

print(p_taro, p_hanako)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p1 = 0
p2 = 0

for i in range(n):
    w1, w2 = map(str, input().split())
    #print(w1, w2)
    size = min(len(w1), len(w2))
    #print('#',size)
    
    if w1 == w2:
        p1 = p1 + 1
        p2 = p2 + 1
        #print(i,'a   ', p1, p2)
        
    elif w1[0:size] == w2[0:size]:
        if len(w1) < len(w2):
            p2 = p2 + 3
        else:
            p1 = p1 + 3
        #print(i,'b   ', p1, p2)
        
    else:
        for j in range(size):
            #print(j, w1[j])
            if ord(w1[j]) == ord(w2[j]):
                pass
            elif ord(w1[j]) < ord(w2[j]):
                p2 = p2 + 3
                #print('     ',p1,p2)
                break
            else:
                p1 = p1 + 3
                break
        #print(i, 'c   ', p1, p2)

print(p1, p2)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin


# 3
# cat dog
# fish fish
# lion tiger

n = int(stdin.readline().rstrip())
p_taro = 0
p_hanako = 0

for i in range(n):
  cardsput = stdin.readline().rstrip().split()
  if (cardsput[0] == cardsput[1]):
    p_taro += 1
    p_hanako += 1
  elif (cardsput[0] < cardsput[1]):
    p_hanako += 3
  else:
    p_taro += 3

else:
  print("{0} {1}".format(p_taro, p_hanako))

Submission status: Accepted

Solution code:
player1, player2 = 0, 0
n = int(input())
for i in range(n):
    card1, card2 = str(input()).split()
    if card1 > card2:
        player1 += 3
    elif card1 < card2:
        player2 += 3
    else:
        player1 += 1
        player2 += 1
print('{} {}'.format(player1, player2))

Submission status: Accepted

Solution code:
point = [0,0]

n = int(input())

for i in range(n):
    
    a,b = map(str,input().split())
    
    if a == b:
        point[0] += 1
        point[1] += 1
        continue
    
    n2 = min(len(a),len(b))
    
    for i2 in range(n2):
        ac = ord(a[i2])
        bc = ord(b[i2])
        
        if ac > bc:
            point[0] += 3
            break
        elif bc > ac:
            point[1] += 3
            break
        
        if i2 == len(a)-1:
            point[1] += 3
        
        elif i2 == len(b)-1:
            point[0] += 3
            

print(' '.join(map(str,point)))

Submission status: Accepted

Solution code:
n = int(input())

taro = 0
hana = 0

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

print(taro, hana, sep=" ")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    tarou, hanako = 0,0
    n = int(input())
    for i in range(n):
        s = input().split()
        if s[0] == s[1]:
            tarou += 1
            hanako += 1
        elif s[0] < s[1]:
            hanako += 3
        elif s[0] > s[1]:
            tarou += 3
        
    print(tarou,hanako)
if __name__ == "__main__":
    main()

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:
def run():
    card_num=int(input())

    player1_point=0
    player2_point=0

    for i in range(card_num):
        card1,card2=input().split()
    
        if card1==card2:
            player1_point+=1
            player2_point+=1
            
        else:
            if card1 == sorted([card1,card2])[1]:
                player1_point+=3
            else:
                player2_point+=3

    print(f"{player1_point} {player2_point}")


run()

Submission status: Accepted

Solution code:
num=int(input())
lis=[]
staro=0
shanako=0
for x in range(num):
	lis.append(input().split(' '))

for i in lis:
	taro=i[0]
	hanako=i[1]

	if taro > hanako:
		staro+=3

	elif taro < hanako:
		shanako+=3

	else:

		staro+=1
		shanako+=1

print(f"{staro} {shanako}")

Submission status: Accepted

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

for _ in range(n):
    x,y=input().split()
    if x<y:
        h+=3
    elif x>y:
        t+=3
    else:
        h+=1 
        t+=1
        
print(t,h)

Submission status: Accepted

Solution code:
n=int(input())
T=0
H=0

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

Submission status: Accepted

Solution code:
n=int(input())

taro = 0
hanako = 0

for idx in range(n):
    cc = input().split()

    if cc[0] == cc[1]:
        taro += 1
        hanako += 1
    elif cc[0] < cc[1]:
        hanako += 3
    else:
        taro += 3

print(taro, hanako)

Submission status: Accepted

Solution code:
n = int(input())
t_score = 0
h_score = 0

for i in range(n):
    cards = list(input().split())
    t_card, h_card = cards[0], cards[1]
    if t_card == h_card:
        t_score += 1
        h_score += 1
    else:
        cards.sort(reverse=True)
        if cards[0] == t_card:
            t_score += 3
        else:
            h_score += 3

print(t_score, h_score)

Submission status: Accepted

Solution code:
n = int(input())

T = 0
H = 0

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

Submission status: Accepted

Solution code:
n=int(input())
t_p,h_p=0,0
for i in range(n):
    t,h=map(str,input().split())
    if t==h:
        t_p+=1
        h_p+=1
    else:
        cmp=[t,h]
        cmp_sort=sorted(cmp)

        if cmp==cmp_sort:
            h_p+=3
        else:
            t_p+=3

print(t_p,h_p)

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(Taro,Hanako)

Submission status: Accepted

Solution code:
n = int(input())
taro_point, hanako_point = 0, 0
for _ in range(n):
    cards = input().split()
    if cards[0] > cards[1]:
        taro_point += 3
    elif cards[1] > cards[0]:
        hanako_point += 3
    else:
        taro_point += 1
        hanako_point += 1
print(taro_point, hanako_point)

Submission status: Accepted

Solution code:
n = int(input())
st, sw = 0, 0

for i in range(n):
    wt, wh = input().split()
    if wt > wh:
        st += 3
    elif wt < wh:
        sw += 3
    else:
        st += 1
        sw += 1

print(st, sw)

Submission status: Accepted

Solution code:
n = int(input())

Data = [input().split() for i in range(n)]

taro = 0
hanako = 0
for a,b in Data:
    if a>b:
        taro += 3
    elif a==b:
        taro += 1
        hanako += 1
    else:
        hanako += 3
print(*[taro, hanako])

Submission status: Accepted

Solution code:
n = int(input())

p1=0
p2=0

for i in range(n):
    
    a,b = input().split()
    
    if a > b:
        p1 += 3
    elif b > a:
        p2 += 3
    else:
        p1 += 1
        p2 += 1
        
print(p1,p2)

Submission status: Accepted

Solution code:
#1_9_C
n = int(input())
t = 0
h = 0
l = 0
for i in range(n):
    word1 , word2 = map(str,input().split())
    if word1 >= word2:
        l = len(word2)
    else:
        l  = len(word1)
    if word1 == word2:
        t += 1
        h += 1
    elif word1[:l] == word2[:l]:
        if len(word1) > len(word2):
            t += 3
        else:
            h += 3
    else:
        for j in range(l):
            if ord(word1[j]) > ord(word2[j]):
                t += 3
                break
            elif ord(word1[j]) < ord(word2[j]):
                h += 3
                break
print(t,h)

Submission status: Accepted

Solution code:
sumt=0
sumh=0

n=int(input())
for i in range(n):
    t,h=input().split()
    if t<h:
        sumh+=3
    if t>h:
        sumt+=3
    if t==h:
        sumh+=1
        sumt+=1
print(f'{sumt} {sumh}')

Submission status: Accepted

Solution code:

tp,hp = 0,0
n = int(input())

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

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(taro,hanako)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

try:
   scores = [0] * 2 #得点
   n = int(input())
   
   for i in range(n):
      cards = []
      animals = input()
      
      #spaceの位置を探す
      for j in range(len(animals)):
         if animals[j] == " ":
            sp = j
            break
      
      taro = animals[0 : sp]
      hanako = animals[sp + 1 : len(animals)]
      
      cards = []
      cards.append(taro)
      cards.append(hanako)
      #print("@", cards)
      
      #得点を計算する
      if taro == hanako:
         scores[0] += 1
         scores[1] += 1
      else:
         #辞書順にソートする
         new_cards = sorted(cards)
         if cards[0] == new_cards[0]:
            #print("True")
            scores[1] += 3
         else:
            #print(False)
            scores[0] += 3

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

except EOFError:
   pass

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
#61

n = int(input())
TP = int()
HP = int()
W=[]
for i in range(n):
    tW,hW = input().split()
    W.append(tW)
    W.append(hW)
    W = sorted(W)
    
    if tW==hW:
        TP += 1
        HP += 1
    elif tW==W[0]:
        HP += 3
    else:
        TP += 3
    #print(tW,hW)
    #print(W)
    W=[]
print(TP,HP)

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    ans = [0] * 2
    for i in range(n):
        s = input().split()
        if s[0] == s[1]:
            ans[0] += 1
            ans[1] += 1
        elif s[0] < s[1]:
            ans[1] += 3
        else:
            ans[0] += 3
    print(*ans)


resolve()

Submission status: Accepted

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

print(taro,hanako)

Submission status: Accepted

Solution code:
num_T = 0
num_H = 0


turnCount = int(input())
for i in range(turnCount):
    T, H = input().split(" ")
    if T == H:
        num_T += 1
        num_H += 1
    elif T > H:
        num_T += 3
    else:
        num_H += 3
    
print(f"{num_T} {num_H}")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=int(input())

Taro=0
Hanako=0

for i in range(n):
    Tcard,Hcard=input().split()
    
    if Tcard==Hcard:
        Taro+=1
        Hanako+=1
    elif Tcard>Hcard:
        Taro+=3
    else:
        Hanako+=3

print(Taro,Hanako)

Submission status: Accepted

Solution code:
n = int(input())

Taro = 0; Hanako = 0
for i in range(n):
    cards = input().split()
    Tcard = list(cards[0]); Hcard = list(cards[1])
    if Tcard == Hcard:
        Taro += 1
        Hanako += 1
        continue

    for c in range(min(len(Tcard), len(Hcard))):
        if Tcard[c] > Hcard[c]:
            Taro += 3
            break
        elif Tcard[c] == Hcard[c]:
            if c+1 == len(Tcard):
                Hanako += 3
            elif c+1 == len(Hcard):
                Taro += 3
            continue
        elif Tcard[c] < Hcard[c]:
            Hanako += 3
            break
            
print(Taro, Hanako)

Submission status: Accepted

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

print(taro, hanako)

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 += 1
        h += 1
    elif a > b:
        t += 3
    else:
        h += 3
print(t, h)

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())
T = 0
H = 0

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

Submission status: Accepted

Solution code:
def card_game():
    n = int(input())
    player1 = 0
    player2 = 0

    for _ in range(n):
        tmp = input().split()
        if tmp[0] > tmp[1]:
            player1 += 3
        elif tmp[0] < tmp[1]:
            player2 += 3
        else:
            player1 += 1
            player2 += 1

    print(f"{player1} {player2}")


if __name__ == "__main__":
    card_game()

Submission status: Accepted

Solution code:
from string import *

n = int(input())

Ta = []
Ha = []

Taro = 0
Hana = 0

for i in range(n):
    T, H = map(str,input().split())
        
    Ta = []
    Ha = []
        
    Tlen = len(T)
    Tlist = list(T)
    tsum = 0
        
    Hlen = len(H)
    Hlist = list(H)
    hsum = 0
        
    for k in range(Tlen):
        t = ascii_lowercase.find(Tlist[k])
        Ta.append(t)
        
    for k in range(Hlen): 
        h = ascii_lowercase.find(Hlist[k])
        Ha.append(h)
    
    if Ta==Ha :
        Taro += 1
        Hana += 1
        
    else :
        while True:
            
            mojisu = min(Tlen, Hlen)
    
            for j in range(mojisu):
                if Ta[j]>Ha[j]:
                    Taro += 3
                    break
                if Ha[j]>Ta[j]:
                    Hana += 3
                    break
                if Ta[j]==Ha[j]:
                    if j==mojisu-1:
                        if Tlen>Hlen:
                            Taro += 3
                            break
                        if Hlen>Tlen:
                            Hana += 3
                            break
                    pass
            break

print(Taro,Hana)

Submission status: Accepted

Solution code:
c = int(input())
x=0
y=0

for i in range(c):
    a,b = input().split()
    
    if a > b:
        x+=3
    elif b > a:
        y+=3
    else:
        x+=1
        y+=1
        
print(x, y)

Submission status: Accepted

Solution code:
N = int(input())
Taro, Hanako = 0, 0

for i in range(N):
    temp_data = list(map(str, input().split()))
    TEMP_data = temp_data.copy()
    TEMP_data.sort(reverse=True)
    if temp_data[0] == temp_data[1]:
        Taro += 1
        Hanako += 1
    else:
        if temp_data[0] == TEMP_data[0]:
            Taro += 3
        elif temp_data[1] == TEMP_data[0]:
            Hanako += 3

print(Taro, Hanako, sep=' ')

Submission status: Accepted

Solution code:
n = int(input())

t_num=0
h_num=0

for i in range(n):
    tarou, hanako = map(str, input().split())
    
    if tarou > hanako:
        t_num += 3
    elif hanako > tarou:
        h_num +=3
    else:
        t_num += 1
        h_num += 1
print(t_num,h_num)

Submission status: Accepted

Solution code:
n = int(input())
taro = 0
hanako = 0
for i in range(n):
    s = input().split()
    card_taro = s[0]
    card_hanako = s[1]
    s_sorted = sorted(s)
    if card_taro == card_hanako:
        taro = taro + 1
        hanako = hanako+1
    elif s_sorted.index(card_taro) > s_sorted.index(card_hanako):
        taro = taro + 3
    elif s_sorted.index(card_taro) < s_sorted.index(card_hanako):
        hanako = hanako + 3
    
print(f"{taro} {hanako}")

Submission status: Accepted

Solution code:
n=int(input())
taro=0
hanako=0
for i in range(n):
    T,H=map(str,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:
n = int(input())
taro_point = 0
hanako_point = 0

for i in range(n):
    taro_card, hanako_card = input().split()
    if taro_card > hanako_card:
        taro_point += 3
    elif taro_card < hanako_card:
        hanako_point += 3
    else:
        taro_point += 1
        hanako_point += 1

print(str(taro_point) + ' ' + str(hanako_point))

Submission status: Accepted

Solution code:
n = int(input())
taro, hanako = 0, 0
for _ in range(n): 
    strlist = input().split()
    if strlist[0] == strlist[1]:
        taro += 1
        hanako += 1
    else:
        sortedlist = sorted(strlist)
        if strlist == sortedlist:
            hanako += 3
        else:
            taro += 3
print(taro, hanako)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

taro = 0
hanako = 0

for i in range(n):
    taro_card,hanako_card = input().split(' ')
    if taro_card > hanako_card:
        taro += 3
    elif hanako_card > taro_card:
        hanako += 3
    else:
        taro += 1
        hanako += 1
print(taro , hanako)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
table = [input().split() for _ in range(num)]

score_taro = 0
score_hanako = 0

for duel in table:
    if duel[0] > duel[1]:
        score_taro += 3
    elif duel[0] < duel[1]:
        score_hanako += 3
    else:
        score_taro += 1
        score_hanako += 1
        
print(score_taro, score_hanako)

Submission status: Accepted

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

Taro = []
Hanako = []

for a in range(n):
    x,y = input().split()
    Taro.append(x)
    Hanako.append(y)

point_Taro = 0
point_Hanako = 0

for a,b in zip(Taro,Hanako):
    if a<b:
        point_Hanako += 3
    elif a>b:
        point_Taro += 3
    else:
        point_Hanako += 1
        point_Taro += 1
print('{} {}'.format(point_Taro,point_Hanako))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
d = {'taro': 0,'hana': 0}
point = [0,0]
for i in range(num):
  d['taro'],d['hana'] = input().split()
  result = sorted(d.items(),key=lambda x: x[1],reverse=True)
  if result[0][1] == result[1][1]:
    point[0] += 1
    point[1] += 1
  elif result[0][0] == 'taro':
    point[0] += 3
  elif result[0][0] == 'hana':
    point[1] += 3
print(' '.join(map(str,point)))

Submission status: Accepted

Solution code:
m = int(input())
T = 0
H = 0

for i in range(m):
    arr = input().split()
    #print(arr,T,H)
    if arr[0] == arr[1]:
        T+=1
        H+=1
    elif sorted(arr)[0] == arr[0]: H+=3
    else: T+=3

print(T,H)

Submission status: Accepted

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

print(s,t)

Submission status: Accepted

Solution code:
n = int(input())
tarou_point = 0
hanako_point = 0
for _ in range(n):
    tarou_card, hanako_card = input().split()
    for i in range(len(tarou_card)):
        if ord(tarou_card[i]) > ord(hanako_card[i]):
            tarou_point += 3
            break
        elif ord(tarou_card[i]) < ord(hanako_card[i]):
            hanako_point += 3
            break
        else:
            if i == len(tarou_card) - 1 or i == len(hanako_card) - 1:
                if len(tarou_card) > len(hanako_card):
                    tarou_point += 3
                    break
                elif len(tarou_card) < len(hanako_card):
                    hanako_point += 3
                    break
                tarou_point += 1
                hanako_point += 1
print(tarou_point, hanako_point)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
x=0
y=0
for i in range(N):
    a,b=input().split() #pythonでは辞書も比較可能 
    if a<b:
        y+=3
    elif a==b:
        x+=1
        y+=1
    else:
        x+=3
print(x,y)

Submission status: Accepted

Solution code:
def main():
  n = int(input())
  p = [0 for _ in range(n)]

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

    if taro > hanako:
      p[0] += 3
    elif hanako > taro:
      p[1] += 3
    else:
      p[0] += 1
      p[1] += 1

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

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n = int(input())
arr = []
for i in range(0, n):
	arr.append(list(map(str, input().split())))

# print(arr)
a, b = 0, 0
for s in arr:
	if s[0] > s[1]:
		a += 3
	elif s[0] == s[1]:
		a += 1
		b += 1
	elif s[0] < s[1]:
		b += 3

print('{0} {1}'.format(a, b))

Submission status: Accepted

Solution code:
n = int(input())
taro = 0
hanako = 0
for i 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(input())
taro = 0
hana = 0
for i in range(n):
    a, b = map(str, input().split())
    if a == b:
        taro += 1
        hana += 1
    elif a < b:
        hana += 3
    else:
        taro += 3
print(taro, hana)

Submission status: Accepted

Solution code:
n = int(input())
t_scr = 0
h_scr = 0
for _ in range(n):
    t_crd,h_crd = input().split()
    if t_crd>h_crd:
        t_scr += 3
    elif t_crd<h_crd:
        h_scr += 3
    else:
        t_scr += 1
        h_scr += 1
print(t_scr,h_scr)

Submission status: Accepted

Solution code:
N = int(input())
t_p = 0
h_p = 0

for i in range(N):
    t, h = input().split()
    if t < h:
        h_p += 3
    elif t == h:
        t_p += 1
        h_p += 1
    else:
        t_p += 3
print(t_p, h_p)

Submission status: Accepted

Solution code:
n=int(input())
tarou,hanako=0,0
for i in range(n):
    lis=list(input().split())
    lis_1=sorted(lis)
    if lis[0]==lis[1]:
        tarou+=1
        hanako+=1
    elif lis[0]==lis_1[0]:
        hanako+=3
    else:
        tarou+=3
print(str(tarou)+" "+str(hanako))