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

print(str(taro_p)+' '+str(hanako_p))

Submission status: Accepted

Solution code:
n = int(input())

taro_score = 0
hanako_score = 0

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

    if taro>hanako:
        taro_score +=3
    elif taro<hanako:
        hanako_score += 3
    else:
        taro_score += 1
        hanako_score += 1
print("%d %d" % (taro_score,hanako_score))

Submission status: Accepted

Solution code:
n = int(input())
t_p = 0
h_p = 0
for i in range(n):
    t_w, h_w= input().split()
    if t_w > h_w:
        t_p += 3
    elif t_w < h_w:
        h_p += 3
    else:
        t_p += 1
        h_p += 1
print(t_p, h_p)

Submission status: Accepted

Solution code:
n = int(input())
i = 0
tp, hp = 0, 0
tc, hc = [], []

while n > i:
    tc, hc = map(str, input().split())
    if tc > hc:
        tp += 3
    elif tc < hc:
        hp += 3
    elif tc == hc:
        tp += 1
        hp += 1
    i += 1

print("{} {}".format(tp, hp))

Submission status: Accepted

Solution code:
score_t = 0
score_h = 0

n = int(input())
for _ in range(n):
    a, b = input().split()
    if a > b:
        score_t += 3
    elif b > a:
        score_h += 3
    else:
        score_t += 1
        score_h += 1

print(score_t, score_h)

Submission status: Accepted

Solution code:
n = int(input())

t = 0
h = 0

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

Submission status: Accepted

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

print(tp,hp)

Submission status: Accepted

Solution code:
num = int(input())
h = 0
t = 0
for n in range(num):
    str_list = input().split(" ")
    str0 = str_list[0]
    str1 = str_list[1]
    str_list.sort()
    if str1 == str0:
        h += 1
        t += 1
        continue
    else:
        if str0 == str_list[0]:
            t += 3
            continue
        elif str0 == str_list[1]:
            h += 3
            continue
print(str(h) + " " + str(t))

Submission status: Accepted

Solution code:

card_num = int(input())
Tarou_score = 0
Hanako_score = 0

for i in range(card_num):
    Tarou_card,Hanako_card = input().split()
    if Tarou_card > Hanako_card:
        Tarou_score += 3
    elif Tarou_card < Hanako_card:
        Hanako_score += 3
    else:
        Tarou_score += 1
        Hanako_score += 1

print(f'{Tarou_score} {Hanako_score}')

Submission status: Accepted

Solution code:
n = int(input())
taro =0
hanako=0
alfa='abcdefghijklmnopqrstuvwxyz'
for i in range(n):
    A,B = input().split()
    a = len(A)
    b=len(B)
    j=0
    while j<a and j<b:
        ta=alfa.find(A[j])
        ha=alfa.find(B[j])
        if ta>ha:
            taro+=3
            break
        elif ha>ta:
            hanako+=3
            break
        elif j==a-1 and j==b-1:
            taro+=1
            hanako+=1
            break
        j+=1
    else:
        if a>b:
            taro+=3
        else:
            hanako+=3
print(taro,hanako)

Submission status: Accepted

Solution code:
n = int(input())

score_taro = 0
score_hanako = 0

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

print('{} {}'.format(score_taro, score_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:
        Taro += 3
    elif H > T:
        Hanako += 3
    else:
        Taro += 1
        Hanako += 1
print(Taro, Hanako)

Submission status: Accepted

Solution code:
turn = int(input())
tarou_point = 0
hanako_point = 0
for x in range(turn):
    tarou,hanako = map(str,input().split())
    count = 0
    flg = False
    if len(tarou) >= len(hanako):
        count = len(hanako)
    else:
        count = len(tarou)

    for y in range(count):
        if ord(tarou[y:y+1]) > ord(hanako[y:y+1]):
            tarou_point += 3
            flg = True
            break
        elif ord(tarou[y:y+1]) < ord(hanako[y:y+1]):
            hanako_point += 3
            flg = True
            break
    
    if flg == False:
        if len(tarou) > len(hanako):
            tarou_point += 3
        elif len(tarou) < len(hanako):
            hanako_point += 3
        else:
            tarou_point += 1
            hanako_point += 1

print(tarou_point,end=' ')
print(hanako_point)

Submission status: Accepted

Solution code:
n=int(input())

taro=0
hanako=0

for i in range(n):
    s1,s2=input().split(" ")
    if(s1<s2):
        hanako+=3
    elif(s1>s2):
        taro+=3
    else:
        taro+=1
        hanako+=1
print(taro,hanako)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

T = 0
H = 0

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

Submission status: Accepted

Solution code:
set_num = int(input())
list_a = []
list_b = []
for i in range(set_num):
    card_set = input().split()
    list_a.append(card_set[0])
    list_b.append(card_set[1])

a_s = 0
b_s = 0
for a_dic,b_dic in zip(list_a,list_b):
    if a_dic > b_dic:
        a_s += 3
    elif a_dic < b_dic:
        b_s += 3
    else:
        a_s += 1
        b_s += 1

print('{} {}'.format(a_s,b_s))

Submission status: Accepted

Solution code:
N = int(input())
pt_taro = 0
pt_hana = 0
for _ in range(N):
    taro, hanako = input().split()
    if taro < hanako:
        pt_hana += 3
    elif hanako < taro:
        pt_taro += 3
    elif taro == hanako:
         pt_taro += 1
         pt_hana += 1

print(pt_taro, pt_hana)

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 t_card < h_card:
        h_point += 3
    else:
        t_point += 1
        h_point += 1
print(t_point, h_point)

Submission status: Accepted

Solution code:
n = int(input())
points = [0]*2

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

l = list(map(str, points))
print(" ".join(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
score = [0, 0]
for i in range(n):
    T, H= input().split()
    if T>H:
        score[0] += 3
    elif H>T:
        score[1] += 3
    elif T == H:
        score[0] += 1
        score[1] += 1
print (*score)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def judge(card_a, card_b):
    if card_a == card_b:
        return 1, 1
    elif card_a < card_b:
        return 0, 3
    else:
        return 3, 0


if __name__ == "__main__":
    num_turns = int(input())

    pair_cards = []

    for _ in range(num_turns):
        pair_cards.append(input().split())

    scores = list(map(lambda pair: judge(*pair), pair_cards))

    total_score = list(map(sum, zip(*scores)))

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

Submission status: Accepted

Solution code:
n  = int(input())

taro = 0
hanako = 0

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

        w_t = words[0]
        w_h = words[1]
        flag = 0
        n = min(len(w_t),len(w_h))

        for i in range(n):
                if w_t[i] > w_h[i]:
                        taro += 3
                        flag = 1
                        break
                elif w_t[i] == w_h[i]:
                        pass
                
                else:
                        hanako += 3
                        flag = 1
                        break

        if flag == 0:
                if len(w_t) == len(w_h):
                        taro += 1
                        hanako += 1

                elif len(w_t) > len(w_h):
                        taro += 3
                else:
                        hanako += 3

        
        

print(taro,hanako)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    taro = 0
    hanako = 0
    for _ in range(0, n):
        taroCard, hanakoCard = input().split()
        if taroCard < hanakoCard:
            hanako += 3
        elif taroCard > hanakoCard:
            taro += 3
        else:
            taro += 1
            hanako += 1
    print("{0} {1}".format(taro, hanako))

if __name__ == '__main__':
    main()

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(f"{taro} {hanako}")

Submission status: Accepted

Solution code:
n = input()
a_cnt = 0
b_cnt = 0
while True:
    try:
        a_order = 0
        b_order = 0
        s = list(input().split())
        if s[0] > s[1]:
            a_cnt += 3
        elif s[0] == s[1]:
            a_cnt += 1
            b_cnt += 1
        else:
            b_cnt += 3
    except EOFError:
        break

print(a_cnt,b_cnt)

Submission status: Accepted

Solution code:
n = int(input())
t = 0
h = 0
for i in range(n):
    cardt,cardh = input().split()
    if cardt == cardh:
        t += 1
        h += 1
    elif cardt > cardh:
        t += 3
    else:
        h += 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:
        x += 3
    elif a < b:
        y += 3
    else:
        x += 1
        y += 1
print(x, y)

Submission status: Accepted

Solution code:
n = int(input())
taro = []
hanako = []

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

taros_point = 0
hanakos_point = 0

for i in range(n):
    if taro[i] > hanako[i]:
        taros_point += 3
    elif taro[i] == hanako[i]:
        taros_point += 1
        hanakos_point += 1
    else:
        hanakos_point += 3

print(taros_point, hanakos_point)

Submission status: Accepted

Solution code:
taro_point = 0
hanako_point = 0

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

Submission status: Accepted

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

taro, hanako = 0, 0
for match in cards:
    if match[0] > match[1]:
        taro += 3
    elif match[0] < match[1]:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro, hanako)

Submission status: Accepted

Solution code:
N=int(input())
points1=0
points2=0
for i in range(N):
    card1,card2=input().split()
    if card1==card2:
        points1+=1
        points2+=1
        continue
    M=min(len(card1),len(card2))
    c=""
    d=""
    for j in range(M):
        c+=card1[j]
        d+=card2[j]
    if c==d and len(card1)>len(card2):
        points1+=3
        continue
    elif c==d and len(card1)<len(card2):
        points2+=3
        continue
    for j in range(M):
        a=card1[j]
        b=card2[j]
        if a>b:
            points1+=3
            break
        elif a<b:
            points2+=3
            break
        elif a==b:
            continue
print(points1,points2)

Submission status: Accepted

Solution code:
scores = [0, 0]
for i in range(int(input())):
    cards = input().split()
    if cards[0] == cards[1]:
        scores = [score+1 for score in scores]

    else:
        sorted_cards = sorted(cards)
        if sorted_cards == cards:
            scores[1] += 3
        else:
            scores[0] += 3

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

Submission status: Accepted

Solution code:
t=h=0
for _ in[0]*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:
out = [0, 0]

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

print(*out)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
score_taro = 0
score_hanako = 0
for i in range(n):
    animal_taro, animal_hanako = input().split()
    if animal_taro < animal_hanako:
        score_hanako += 3
    elif animal_taro == animal_hanako:
        score_taro += 1
        score_hanako += 1
    else:
        score_taro += 3
print(f"{score_taro} {score_hanako}")

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

Submission status: Accepted

Solution code:
n = int(input())
score_set = [0, 0]

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

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

Submission status: Accepted

Solution code:
# Problem - カードゲーム

# input
n = int(input())

# initialization
taro_score = 0
hanako_score = 0

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

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

Submission status: Accepted

Solution code:
a,b=0,0
for i in [0]*int(input()):
  A,B = input().split()
  if A>B:a += 3
  elif B>A:b += 3
  else:a +=1;b += 1
print(str(a)+" "+str(b))

Submission status: Accepted

Solution code:
n = int(input())
i=0
T_point=H_point=0
while i < n:
    Taro_card, Hana_card = list(input().split())
    if Taro_card>Hana_card:
        T_point+=3
    elif Taro_card==Hana_card:
        T_point+=1
        H_point+=1
    else:
        H_point+=3
    i+=1

print(T_point, H_point)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
info = [[str(x) for x in input().split()] for _ in range(n)]
taro, hanako = 0, 0
for x, y in info:
    if x > y:
        taro += 3
    elif x < y:
        hanako += 3
    else:
        taro += 1
        hanako += 1
print(taro, hanako)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(taro,hanako)

Submission status: Accepted

Solution code:
n = int(input())
versus = []
T_point = 0
H_point = 0

for i in range(n):

    Taro, Hanako = input().split()
    
    versus.append(Taro)
    versus.append(Hanako)
    
    versus.sort()
    
    if Hanako == Taro == versus[0]:
        T_point += 1
        H_point += 1
    
    elif versus[0] == Taro:
        H_point += 3
        
    else:
        T_point += 3
        
    versus.clear()
    
print(f"{T_point} {H_point}")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l="abcdefghijklmnopqrstuvwxyz"
a,b=0,0
s=int(input())
for _ in range(s):
    t,h=input().split()
    for n in range(min(len(t),len(h))):
        t_=l.find(t[n])
        h_=l.find(h[n])
        if t_>h_:
            a+=3
            break
        elif t_<h_:
            b+=3
            break
        elif n ==min(len(t),len(h))-1:
            if len(t)==len(h):
                a+=1
                b+=1
            elif len(t)>len(h):
                a+=3
            elif len(t)<len(h):
                b+=3
print(a,b)

Submission status: Accepted

Solution code:
num = int(input())

tarou = 0
hanako = 0
for i in range(num):
  s = input().rstrip().split(' ')
  taroucard = str(s[0])
  hanakocard = str(s[1])
  if taroucard > hanakocard:
    tarou += 3
  elif taroucard == hanakocard:
    tarou += 1
    hanako += 1
  elif taroucard < hanakocard:
    hanako += 3
print(str(tarou) + " " + str(hanako))

Submission status: Accepted

Solution code:
n = int(input())
num_t, num_h = 0, 0

for _ in range(n):
    card = input().split()
    if card[0] == card[1]:
        num_t += 1
        num_h += 1
    elif card[0] > card[1]:
        num_t += 3
    else:
        num_h += 3

print(num_t, num_h)

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

score_a = 0
score_b = 0

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

print(score_a, score_b)

Submission status: Accepted

Solution code:
tarop, hanakop = 0, 0
n = int(input())

for i in range(n):
    taroc, hanakoc = input().split()
    if taroc > hanakoc:
        tarop += 3
    elif taroc < hanakoc:
        hanakop += 3
    elif taroc == hanakoc:
        tarop += 1
        hanakop += 1

print(tarop, hanakop)

Submission status: Accepted

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

taro = 0
hanako = 0

for i in range(n):
    taro_card = card[i][0]
    hanako_card = card[i][1]
    
    if taro_card == hanako_card:
        taro += 1
        hanako += 1
        continue
    if taro_card > hanako_card:
        taro += 3
    else:
        hanako += 3
    
print(taro, hanako)

Submission status: Accepted

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = int(input())
ans_a = 0
ans_b = 0

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

print(ans_a, ans_b)

Submission status: Accepted

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

print("{} {}".format(taropt,hanapt))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    ans = [0, 0]
    for i in range(N):
        s = input().strip().split()
        if s[0] == s[1]:
            ans[0] += 1
            ans[1] += 1
        elif s[0] > s[1]:
            ans[0] += 3
        else:
            ans[1] += 3
    
    print(ans[0], ans[1])



if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
pair_list = list()
for i in range(n):
    pair = list(map(str,input().split()))
    pair_list.append(pair)

a = 0
b = 0
for card in pair_list:
    if card[0] == card[1]:
        a += 1
        b += 1
        continue

    if card == sorted(card):
        b += 3
    else:
        a += 3

print(a,b)

Submission status: Accepted

Solution code:
N = int(input())

point_t = 0
point_h = 0
for i in range(N):
    t, h = input().split()
    if t > h:
        point_t += 3
    elif t < h:
        point_h += 3
    else:
        point_t += 1
        point_h += 1  

print(point_t, point_h)

Submission status: Accepted

Solution code:
taro = 0
hanako = 0
for i in range(int(input())):
    line = str(input()).split()
    t = line[0]
    h = line[1]
    if (t == h):
        taro += 1
        hanako += 1
    elif (t < h):
        hanako += 3
    elif (t > h):
        taro += 3

print('{} {}'.format(taro, hanako))

Submission status: Accepted

Solution code:
#2020-03-21
turn = int(input())
s = 0
t = 0

for i in range(turn):
    a,b = map(str,input().split())
    if a > b :
        s += 3
    elif a < b:
        t += 3
    elif a == b:
        s += 1
        t += 1
print(s,t)

Submission status: Accepted

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

print(p,q)

Submission status: Accepted

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

print("{0} {1}".format(c1,c2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
battle = [input().split(" ") for i in range(n)]
result = [0] * 2
for i in battle:
  taro = i[0]
  hanako = i[1]

  if taro > hanako:
    result[0] += 3
  elif taro < hanako:
    result[1] += 3
  else:
    result[0] += 1
    result[1] += 1
print("{} {}".format(result[0], result[1]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ts = 0
hs = 0
for i in range(n):
    c = list(input().split())
    if c[0] > c[1]:
        ts += 3
    elif c[0] < c[1]:
        hs += 3
    else:
        ts += 1
        hs += 1

print(ts, hs)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
A = 0
B = 0
for i in range(n):
    animals = list(input().split())
    if animals[0] == animals[1]:
        A += 1
        B += 1
    else:
        A_sorted = sorted(animals)
        if animals[0] == A_sorted[1]:
            A +=3
        else:
            B += 3
print(A, B)

Submission status: Accepted

Solution code:
taro=0
hanako=0
time=int(input())
for i in range(time):
    lst=input().split()
    if lst[0]==lst[1]:
        taro+=1
        hanako+=1
    #card_t=lst[0]
    #card_h=lst[1]
    else:
        sort_lst=sorted(lst)
        if lst[0]==sort_lst[1]:
            taro+=3
        elif lst[1]==sort_lst[1]:
            hanako+=3
print(taro,hanako)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a, b = 0, 0
for i in range(n):
    c = input().split()
    if c[0] == c[1]:
        a += 1
        b += 1
    else:
        pc = c[0]
        sc = sorted(c)
        if pc == sc[0]:
            b += 3
        else:
            a += 3
print(a, b)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

hanako_score, taro_score = 0, 0

for i in range(n):
    card_list = [x for x in input().split()]
    sorted_card_list = sorted(card_list)
    
    if card_list[0] == card_list[1]:
        hanako_score += 1
        taro_score += 1
    
    elif card_list[0] == sorted_card_list[0]:
        hanako_score += 3
    
    else:
        taro_score += 3
        
print('{} {}'.format(taro_score, hanako_score))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

t_score = h_score=0

for i in range(n):
    taro, hanako = input().split()
    if taro==hanako:
        t_score+=1
        h_score+=1
    elif taro < hanako:
        h_score+=3
    else:
        t_score+=3

print("%d %d" %(t_score,h_score))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import itertools
import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
a = 0
b = 0
for _ in range(N):
    L = readline().decode('utf8').split()
    if L[0] == L[1]:
        a += 1
        b += 1
    elif L[0] > L[1]:
        a += 3
    else:
        b += 3

print(a, b)