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

str="abcdefghijklmnopqrstuvwxyz"
char=[]
for i in range(26):
    char.append(str[i])
#print(char)
index=[i for i in range(26)]
#print(index)

alphabet=dict(zip(char,index))

#print(alphabet)
Taro=0
Hanako=0
for i in range(n):
    s = input().split()
    str1 = s[0]
    str2 = s[1]



    len1=len(str1)
    len2=len(str2)
    if len1>len2:
        for i in range(len2):
            if alphabet[str1[i]]>alphabet[str2[i]]:
                Taro+=3
                break
            elif alphabet[str1[i]]<alphabet[str2[i]]:
                Hanako+=3
                break
            elif i==len2-1:
                Taro+=3
    elif len1<len2:
        for i in range(len1):
            if alphabet[str1[i]]>alphabet[str2[i]]:
                Taro+=3
                break
            elif alphabet[str1[i]]<alphabet[str2[i]]:
                Hanako+=3
                break
            elif i==len1-1:
                Hanako+=3
    else:
        for i in range(len1):
            if alphabet[str1[i]]>alphabet[str2[i]]:
                Taro+=3
                break
            elif alphabet[str1[i]]<alphabet[str2[i]]:
                Hanako+=3
                break
            elif alphabet[str1[i]]==alphabet[str2[i]] and i==len1-1:
                Taro+=1
                Hanako+=1
    #print(i,":",Taro,Hanako)

print(Taro,Hanako)

Submission status: Accepted

Solution code:
#coding: utf-8

ta = 0
ha = 0
n = int(input())
for i in range(n):
    names = list(map(str, input().split()))
    if names[0] == names[1]:
        ta += 1
        ha += 1
    else:
        sorted_n = sorted(names)
        if names[0] == sorted_n[0]:
            ha += 3
        else:
            ta += 3
print(ta, ha)

Submission status: Accepted

Solution code:
def test():

	n = int(input())

	Taro = 0
	Hanako = 0

	for i in range(n):

		cards = input().split()

		cards[0] = cards[0].upper()
		cards[1] = cards[1].upper()
		
		if cards[0] == cards[1]:
			Taro += 1
			Hanako += 1
		elif cards[0] > cards[1]:
			Taro += 3
		else:
			Hanako += 3
		
	print(f"{Taro} {Hanako}")

if __name__ == "__main__":
	test()

Submission status: Accepted

Solution code:

taro = 0
hanako = 0

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

print(taro, hanako)

Submission status: Accepted

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

for _ in range(n):
    a, b = input().split()
    if a == b:
        h += 1; t += 1
    elif a < b:
        t += 3
    else:
        h += 3

print(h, t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ts=0
hs=0
for i in range(int(input())):
	t,h=input().split()
	if t<h:
		hs+=3
	elif t>h:
		ts+=3
	else:
		ts+=1
		hs+=1
print(f"{ts} {hs}")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
s = [0, 0]
while True:
    line = sys.stdin.readline() 
    if not line: break 
    line = line.rstrip('\r\n') 
    if line.isdigit():
        next
    else:
        words = line.split()
        if words[0] < words[1]:
            s[1] += 3
        elif words[0] > words[1]:
            s[0] += 3
        else:
            s[0] += 1
            s[1] += 1
print(s[0], s[1])

Submission status: Accepted

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

pa, pb = 0, 0
for a, b in X:
    if a > b:
        pa += 3
    elif a < b:
        pb += 3
    else:
        pa += 1
        pb += 1
print(pa, pb)

Submission status: Accepted

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

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:
from enum import Enum
import sys
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
class Type(Enum):
    win_Taro = 0
    win_Hanako = 1
    EVEN = 2
 
def comp_str(A,B):
    if A > B:
        return Type.win_Taro
    elif A < B:
        return Type.win_Hanako
    else:
        return Type.EVEN
 
N = int(input())
 
point_Taro = 0
point_Hanako = 0
 
for loop in range(N):
    line = str(input()).split()
    ret_type = comp_str(line[0],line[1])
    if ret_type == Type.win_Taro:
        point_Taro += 3
    elif ret_type == Type.win_Hanako:
        point_Hanako += 3
    else:
        point_Taro += 1
        point_Hanako += 1
 
print("%d %d"%(point_Taro,point_Hanako))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
Taro_score = 0
Hanako_score = 0
for i in range(n):
    wlist = []
    t,h = map(str, input().split())
    wlist.append(t)
    wlist.append(h)
    order = sorted(wlist, key = str.lower)
    if (t.lower() == h.lower()):
        Taro_score += 1
        Hanako_score += 1
    elif (order[1] == t):
        Taro_score += 3
    elif (order[1] ==h ):
        Hanako_score += 3
print(Taro_score, Hanako_score)

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:
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:
tt = 0
th = 0
n = int(input())
for i in range(n):
    t, h = map(str, input().split())
    if [t, h] != sorted([t, h]):
        tt += 3
    elif t == h:
        tt += 1
        th += 1
    else:
        th += 3
print(str(tt) + " " + str(th))

Submission status: Accepted

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

taro, hanako = 0, 0
for g in G:
	if g[0] < g[1]:
		hanako += 3
	elif g[0] > g[1]:
		taro += 3
	else:
		hanako += 1
		taro += 1
print(taro, hanako)

Submission status: Accepted

Solution code:
n = 0
n = int(input())
ls = []
for i in range(n):
    x = list(input().split())
    ls.append(x)

score1 = 0;score2 = 0
for i in range(n):
    s1 = ls[i][0];s2 = ls[i][1]
    if s1==s2:
        score1 += 1;score2 += 1
        continue
    len1,len2 = len(s1),len(s2)
    flag = 0
    for i in range(min(len1,len2)):
        if s1[i] > s2[i]:
            flag = 1 
            score1 += 3
            break;
        elif s1[i] < s2[i]:
            flag = 1
            score2 += 3
            break
    if flag == 0 and len1!=len2:
        if len1>len2:
            score1 += 3
        else:
            score2 += 3
    
print(score1,score2)

Submission status: Accepted

Solution code:
n = int(input())
score = {"taro": 0, "hanako": 0}
for _ in range(n):
    t, h = input().split()
    if t > h:
        score["taro"] += 3
    elif t < h:
        score["hanako"] += 3
    else:
        for player in score.keys():
            score[player] += 1
print(score["taro"], score["hanako"])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num=int(input())
taro_point=hanako_point=0

for n in range(num):
  taro_card,hanako_card = input().split()
  min_cards_num=min(len(taro_card),len(hanako_card))
  
  if taro_card==hanako_card:
    taro_point+=1
    hanako_point+=1
  else:
    for c in range(min_cards_num):
      if taro_card[c]<hanako_card[c] :
        hanako_point+=3
        #print("hanako3point")
        break
      elif(taro_card[c]>hanako_card[c]):
        taro_point+=3
        #print("taro3point")
        break
      #最後まで同じ文字の場合は文字数が多いほうの勝ち
      elif c == min_cards_num -1:
        #print("同じ文字数")
        if len(hanako_card)>len(taro_card):
          hanako_point+=3
          #print("hanako3point")
        else:
          taro_point+=3
          #print("taro3point")

print(taro_point,hanako_point)

Submission status: Accepted

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

for i in range(n):
    tw, hw = input().split()
    if tw > hw:
        tp += 3
    elif hw > tw:
        hp += 3
    else:
        tp += 1
        hp += 1
print(tp,hp)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
  tc, hc = input().split()
  
  if tc > hc:
    taro += 3
  elif tc < hc:
    hana += 3
  else:
    taro += 1
    hana += 1
    
print(taro, hana)

Submission status: Accepted

Solution code:
n = int(input())

tlist = [] #太郎
hlist = [] #花子

for _ in range(n):
  a = list(map(str, input().split()))
  tlist.append(a[0])
  hlist.append(a[1])
  
tscore = 0
hscore = 0

for t,h in zip(tlist,hlist):
  if t > h:
    tscore += 3
  elif t == h:
    tscore += 1
    hscore += 1
  else:
    hscore += 3

print(tscore, hscore)

Submission status: Accepted

Solution code:
point = [0,0]
card = ["",""]
n=int(input())
for i in range(n):
    card = input().split()
    if card[0]==card[1]:
        point[0]+=1
        point[1]+=1
    elif card==sorted(card):
        point[1]+=3
    else:
        point[0]+=3
print("{} {}".format(point[0],point[1]))

Submission status: Accepted

Solution code:
# coding=utf-8
 
###
### for atcorder program
###
 
import sys
import math
 
# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338
 
    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []
 
        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist
 
    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)
 
    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)
 
    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans
 
mymath = mymath()
 
### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()
 
output = output()
 
### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]
 
#R = float(input())
#A.append(list(map(int,input().split())))
 
#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]
 
#abc list
#abc = [chr(ord('a') + i) for i in range(26)]
 
### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")  

def get_input():
  N = []
  while True:
    try:
      N.append(input())
      #N.append(int(input()))
    except EOFError:
      break
  return N


N = int(input())
W = []

a = 0
b = 0

for i in range(N):
  W.append([x for x in input().split()])
  
for aw, bw in W:
  if aw == bw:
    a += 1
    b += 1
  elif aw > bw:
    a += 3
  else:
    b += 3
    
print(a,b,sep=' ')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

taro = 0
hanako = 0

for _ in range(n):
    left, right = input().split()

    if left > right:
        taro += 3
    elif left < right:
        hanako += 3
    else:
        taro += 1
        hanako += 1

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)

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:
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 i in range(N):
    str=list(input().split())
    if str[0]>str[1]:
        Taro+=3
    elif str[0]<str[1]:
        Hanako+=3
    else:
        Taro+=1
        Hanako+=1
print(f'{Taro} {Hanako}')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    scores = [0, 0]
    turn_num = int(input())
    for turn in range(turn_num):
        cards = input().split()
        if cards[0] == cards[1]:
            scores[0] += 1
            scores[1] += 1
        elif cards[0] > cards[1]:
            scores[0] += 3
        else:
            scores[1] += 3
    print(f"{scores[0]} {scores[1]}")

Submission status: Accepted

Solution code:
n = int(input())
taro = 0
hanako = 0
for i in range(n):
    a = [s for s in input().split()]
    b = sorted(a)
    if a[0] == a[1]:
        taro += 1
        hanako += 1
    elif a == b:
        taro += 3
    else:
        hanako +=3
print(str(hanako) + " " + str(taro))

Submission status: Accepted

Solution code:
t = 0
h = 0

num = input()
i = 0
while i < num:
    animals = raw_input().split()
    if animals[0] < animals[1]:
        h += 3
    elif animals[0] > animals[1]:
        t += 3
    else:
        t += 1
        h += 1
    i += 1

print t,h

Submission status: Accepted

Solution code:
n = int(input())

taro_list=[]
hana_list=[]
alfa = list('abcdegfhijklmnopqrstuvwxyz')

while n>0:
  taro, hana = map(str,input().split())
  taro_list.append(taro)
  hana_list.append(hana)
  n = n - 1

a=0
b=0
for (ta, ha) in zip (taro_list, hana_list):
  if ta > ha:
    a = a + 3
  elif ta < ha:
    b = b + 3
  else:
    a = a + 1
    b = b + 1
    
print(a, b)

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:
acount = 0
bcount = 0



n = int(input())
 
for i in range(n) :
  A = []
  a,b = map(str,input().split())
  A.append(a)
  A.append(b)
  A .sort()
  
    
  if A[1] == a and A[0] != a   :
    acount += 3
   
  elif A[1] == b and A[0] != b:
    bcount += 3
  elif A[0] == A[1]:
    acount += 1 
    bcount += 1
    

print(acount , bcount)

Submission status: Accepted

Solution code:
n = int(input())

s_t = 0
s_h = 0
for i in range(n):
    c_t, c_h = input().split()
    if c_t > c_h:
        s_t += 3
    elif c_t < c_h:
        s_h += 3
    else:
        s_t += 1
        s_h += 1

print(s_t, s_h)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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:
n=int(input())
cntt,cnth=0,0
for i in range(n):
    t,h=input().split()
    if t>h:
        cntt+=3
    elif t<h:
        cnth+=3
    else:
        cnth+=1
        cntt+=1
print(cntt,cnth)

Submission status: Accepted

Solution code:
import random

n = int(input(""))
Taro = 0
Hanako = 0
get_point_w = 3
get_point_d = 1

def judge(card_a, card_b, get_point_w, get_point_d, point_a, point_b):
    win_card = max(card_a, card_b)
    if card_a == card_b:
        point_a += get_point_d
        point_b += get_point_d
    elif win_card == card_a:
        point_a += get_point_w
    elif win_card == card_b:
        point_b += get_point_w
    else:
        print("bad input!")  
    
    return point_a, point_b
    
if n <= 1000:
    for i in range(n):
        card_Taro_Hanako = input()
        card_Taro = card_Taro_Hanako.split(" ")[0]
        card_Hanako = card_Taro_Hanako.split(" ")[1]
        if len(card_Taro) <= 100 and len(card_Hanako) <= 100:
            Taro, Hanako = judge(card_Taro, card_Hanako, get_point_w, get_point_d, Taro, Hanako)
        else:
            print("animal name string length > 100, bad input!")
else:
    print("n > 1000, bad input!")
print(Taro, Hanako)

Submission status: Accepted

Solution code:
a=int(input())
ts=0
hs=0
while a>0:
   tarou , hanako = input().split(" ")
   if tarou < hanako:
     hs+=3
   elif tarou > hanako:
     ts+=3
   else:
     hs+=1													
     ts+=1
   a=a-1
print(str(ts)+' '+str(hs))

Submission status: Accepted

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

Submission status: Accepted

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

print(t,h)

Submission status: Accepted

Solution code:
a = b = 0
for i in range(int(input())):
    ac, bc = input().split()

    if bc < ac:
        a += 3
    elif bc == ac:
        a += 1
        b += 1
    else:
        b += 3
print(a, b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce

point_judge = {
    'card_taro > card_hanako': (3,0),
    'card_taro == card_hanako': (1,1),
    'card_taro < card_hanako': (0,3)
}

def solve():
    input_line = input()
    n = int(input_line)
    input_lines = [input() for _ in range(n)]

    print("{0} {1}".format(
        *reduce(lambda x,y: (x[0]+y[0],x[1]+y[1]) , 
                [ v for card_taro, card_hanako in 
                 [ input_line.split(' ') for input_line in input_lines ]
                 for k,v in point_judge.items() if eval(k) ]
               )))

solve()

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)

Submission status: Accepted

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

Submission status: Accepted

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

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:
n = int(input())

point_tarou = 0
point_hanako = 0

for turn in range(n):

    tarou, hanako = input().split()

    if   tarou >  hanako:
        point_tarou += 3
    elif tarou <  hanako:
        point_hanako += 3
    else:
        point_tarou += 1
        point_hanako += 1

print(f"{point_tarou} {point_hanako}")

Submission status: Accepted

Solution code:
taro = 0
hanako = 0
n = int(input())
for _ in range(n):
    moji1, moji2 = input().split()
    if moji1 == moji2:
        taro += 1
        hanako += 1
    else:
        for m1, m2 in zip(moji1, moji2):
            p1, p2 = map(ord, (m1, m2))
            if p1 != p2:
                break
        else:
            p1 = len(moji1)
            p2 = len(moji2)
        if p1 > p2:
            taro += 3
        else:
            hanako += 3
print(f'{taro} {hanako}')

Submission status: Accepted

Solution code:
def lexicographical_order(a, b):
    if a > b:
        return 0
    elif a < b:
        return 1
    else:
        return 2

if __name__ == "__main__":
    n = int(input())
    taro_point, hanako_point = 0, 0
    for _ in range(n):
        taro_hand, hanako_hand = input().split()
        res = lexicographical_order(taro_hand, hanako_hand)

        if res == 0: 
            taro_point += 3
        elif res == 1:
            hanako_point += 3
        elif res == 2:
            taro_point += 1
            hanako_point += 1

    print(taro_point, hanako_point)

Submission status: Accepted

Solution code:
#ITP_9_C
taro = 0
hanako = 0
for i in range(int(input())):
    x, y = input().split()
    if x > y:
        taro+=3
    elif x < y:
        hanako+=3
    else:
        taro+=1
        hanako+=1
print(str(taro) + ' ' + str(hanako))

Submission status: Accepted

Solution code:
from enum import Enum

class Type(Enum):
    win_Taro = 0
    win_Hanako = 1
    EVEN = 2

def comp_str(A,B):
    if (A>B):
        return Type.win_Taro
    elif (A<B):
        return Type.win_Hanako
    else:
        return Type.EVEN

game_num = int(input())

point_Taro = 0
point_Hanako = 0

for i in range(game_num):
        line = str(input()).split()
        ret_type=comp_str(line[0],line[1])
        if ret_type == Type.win_Taro:
            point_Taro += 3
        elif ret_type == Type.win_Hanako:
            point_Hanako += 3
        else:
            point_Taro += 1
            point_Hanako += 1

print("%d %d"%(point_Taro,point_Hanako))

Submission status: Accepted

Solution code:
N = int(input())
alice = 0
bob = 0
for _ in range(N):
    a, b = input().split()
    if a == b:
        alice += 1
        bob += 1
    elif a > b:
        alice += 3
    else:
        bob += 3
print(alice, bob)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	turn = int(input())
	taro, hanako = 0,0
	for i in range(turn):
		t_card, h_card = map(str,input().split())
		if t_card > h_card:
			taro += 3
		elif h_card > t_card:
			hanako += 3
		else:
			taro +=1
			hanako += 1
	print("%d %d" % (taro,hanako))

Submission status: Accepted

Solution code:
N = int(input())
point_a = 0
point_b = 0
for i in range(N):
    a,b = input().split()
    if a > b:
        point_a+=3
    elif a < b:
        point_b+=3
    else:
        point_a+=1
        point_b+=1
print("{} {}".format(point_a,point_b))

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# coding=utf_8

def btlcmp(taro, hanako):
    if taro > hanako :
        return 0
    elif taro == hanako :
        return 1

    return 2

res = [[3,0],[1,1],[0,3]]

taro_p = 0
hanako_p = 0

btltime = int(input())

for i in range(btltime):
    s = input().split()
    resi = btlcmp(s[0], s[1])
    taro_p += res[resi][0]
    hanako_p += res[resi][1]

print(str(taro_p) +" "+ str(hanako_p))

Submission status: Accepted

Solution code:
num = int(input())
T = 0
H = 0
for i in range(num):
    line = list(map(str, input().split()))
    sorted_line = sorted(line)
    if line[0] == line[1]:
        T += 1
        H += 1
    elif line[0] == sorted_line[0]:
        H += 3
    elif line[0] == sorted_line[1]:
        T += 3
print(T,H)

Submission status: Accepted

Solution code:
num = int(input())
point= [0,0]
while(num > 0):
    x = input()
    t,h = x.split(" ")
    if(t > h):
        point[0] += 3
    elif(t == h):
        point[0] += 1
        point[1] += 1
    else:
        point[1] +=3
    
    num -= 1
print("{} {}".format(point[0],point[1]))

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:
num = int(input())
taro = 0
hanako = 0
for _ in range(num):
    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:
n=int(input())
w=d=0
for _ in[0]*n:
	t,h=input().split()
	if t>h:w+=1
	if t==h:d+=1
print(w*3+d,(n-w-d)*3+d)

Submission status: Accepted

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

for k in range(0, i):
    a = input()
    a = a.split()
    [x, y] = a

    if x > y:
        taro = taro + 3
    elif y > x:
        hanako = hanako + 3
    elif x == y:
        taro = taro + 1
        hanako = hanako + 1

taro = str(taro)
hanako = str(hanako)
k = " "

ans = taro + k + hanako
print(ans)

Submission status: Accepted

Solution code:
# cardGame.py
num = int(input())
result = {'taro':0, 'hanako':0}
for i in range(num):
    cards = input().split()
    taro = cards[0]
    hanako = cards[1]
    sorted_cards = sorted(cards)
    if taro == hanako:
        result['taro'] += 1
        result['hanako'] += 1
    elif cards == sorted_cards:
        result['hanako'] += 3
    else :
        result['taro'] += 3
print(result['taro'], result['hanako'])

Submission status: Accepted

Solution code:
n = int(input())
points = [0, 0]
for i in range(n):
    cards = input().split()
    c0, c1 = len(cards[0]), len(cards[1])
    c = min(c0, c1)
    for i in range(c):
        if cards[0][i] > cards[1][i]:
            points[0] += 3
            break
        elif cards[0][i] < cards[1][i]:
            points[1] += 3
            break
    else:
        if c0 > c1:
            points[0] += 3
        elif c0 < c1:
            points[1] += 3
        else:
            points[0] += 1
            points[1] += 1
print(points[0], points[1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
tscore = 0
hscore = 0

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

    if t > h:
        tscore += 3
    elif t < h:
        hscore += 3
    else:
        tscore += 1
        hscore += 1

print(tscore, hscore)

Submission status: Accepted

Solution code:
n = int(input())
result = [0]*2
for i in range(n):
    s = input().strip().split()
    ss = sorted(s)
    if s[0] == s[1]:
        result[0] += 1
        result[1] += 1
    elif s[1] == ss[0]:
        result[0] += 3
    elif s[1] == ss[1]:
        result[1] += 3
        
print('{} {}'.format(result[0],result[1]))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# ITP1_9_C
# カードゲーム

tpt = hpt = 0
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
ans_taro = 0
ans_hanako = 0

for i in range(n):
  c_taro, c_hanako = input().split()
  if c_taro > c_hanako:
    ans_taro += 3
  elif c_taro == c_hanako:
    ans_taro += 1
    ans_hanako += 1
  else:
    ans_hanako += 3

print('%d %d' %(ans_taro, ans_hanako))

Submission status: Accepted

Solution code:
class Type:
    win_Taro = 0
    win_Hanako = 1
    EVEN = 2
 
def comp_str(A,B):
    if A > B:
        return Type.win_Taro
    elif A < B:
        return Type.win_Hanako
    else:
        return Type.EVEN
 
N = int(input())
 
point_Taro = 0
point_Hanako = 0
 
for loop in range(N):
    line = str(input()).split()
    ret_type = comp_str(line[0],line[1])
    if ret_type == Type.win_Taro:
        point_Taro += 3
    elif ret_type == Type.win_Hanako:
        point_Hanako += 3
    else:
        point_Taro += 1
        point_Hanako += 1
 
print("%d %d"%(point_Taro,point_Hanako))

Submission status: Accepted

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

print(taro_point,hanako_point)

Submission status: Accepted

Solution code:
n = int(input())

p1 = 0
p2 = 0

for i in range(n):
        str = input()
        i = str.find(" ")
        str1 = str[: i]
        str2 = str[i+1 :]

        if str1 > str2:
                p1 += 3
        elif str1 < str2:
                p2 += 3
        else:
                p1 += 1
                p2 += 1
        
print("%d %d" % (p1, p2))