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:
t = int(input())
score = [0, 0]
for i in range(t):
    pair = input().split(" ")
    if pair[0] > pair[1]:
        score[0] += 3
    elif pair[0] < pair[1]:
        score[1] += 3
    else:
        score[0] += 1
        score[1] += 1
print(" ".join(map(lambda x: str(x), score)))

Submission status: Accepted

Solution code:
n = int(input())
A, B = 0, 0

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

Submission status: Accepted

Solution code:
n = int(input())

taro = 0
hana = 0

for i in range(n) :
    taro_c, hana_c = input().split()
    if taro_c > hana_c :
        taro += 3
    elif taro_c == hana_c :
        taro += 1
        hana += 1
    elif taro_c < hana_c :
        hana += 3

print(taro, hana)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
x, y = 0, 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())
l = [input().split() for _ in range(N)]

a = 0
b = 0
for i in range(N):
    if l[i][0] > l[i][1]:
        a += 3
    elif l[i][0] < l[i][1]:
        b += 3
    else:
        a += 1
        b += 1
print(a,b)

Submission status: Accepted

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

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

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

print(t, h)

Submission status: Accepted

Solution code:
n = int(input())

points= [0, 0]
for _ in range(n):
    s, t = input().lower().split()
    if s > t:
        points[0] += 3
    elif s < t:
        points[1] += 3
    else:
        points[0] += 1
        points[1] += 1

print(*points)

Submission status: Accepted

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

for i in range(N):
    m,n = map(str,input().split())
    if m > n:
        taro += 3
    elif m < n:
        hanako += 3
    else:
        taro += 1
        hanako += 1
print("%d %d"%(taro,hanako))

Submission status: Accepted

Solution code:
n = int(input())
ans = [0, 0]
for _ in range(n):
    a, b = map(str, input().split())
    if a == b:
        *ans, = map(lambda x: x+1, ans)
        continue

    ans[a < b] += 3

print(*ans)

Submission status: Accepted

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

for i in range(n):
    if card[i][0] < card[i][1]:
        ans[1] += 3
    elif card[i][0] > card[i][1]:
        ans[0] += 3
    else:
        ans[0] += 1
        ans[1] += 1

print(*ans)

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

Submission status: Accepted

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

n=int(input())
sum1=0
sum2=0
for i in range(n):
    a,b=input().split()
    sum1+=game(a,b)
    sum2+=game(b,a)
print(sum1,sum2)

Submission status: Accepted

Solution code:
a = int(input())

t = 0
h = 0
for i in range(a):
    x, y = input().split()
    if(x < y):
        t +=3
    elif(y < x):
        h +=3
    else:
        t +=1
        h +=1
print("{0} {1}".format(h, t))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

score_taro = 0
score_hanako = 0

for i in range(n):
    
    a = input().split()
    b = sorted(a)
    
    if a[0] == a[1]:
        score_taro += 1
        score_hanako += 1
        
    elif a[0] == b[0]:
        score_hanako += 3
        
    else:
        score_taro += 3
        
print(score_taro, score_hanako)

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:
        t_p += 3
    elif t<h:
        h_p += 3
    else:
        t_p += 1
        h_p += 1

print(t_p, h_p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

answer = [0, 0]

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

print(*answer)

Submission status: Accepted

Solution code:
n = int(input())

t = 0
h = 0

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

    if w[0] == w[1]:
        t += 1
        h += 1
    else:
        sw = sorted(w)

        if w[0] == sw[0]:
            h += 3
        else:
            t += 3

print(str.format('{} {}', t, h))

Submission status: Accepted

Solution code:
N = int(input())
taro,hanako = 0,0
for n in range(N):
    taro_str,hanako_str = input().split(' ')
    if taro_str == hanako_str:
        taro += 1
        hanako += 1
    if taro_str > hanako_str:
        taro += 3
    if hanako_str > taro_str:
        hanako += 3
print(taro,hanako)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#初期値の準備
challeng_count = int(input())
score = [0] * 2

#判定
for i in range(challeng_count):
    check_data = input().split()
    check_data_sort = sorted(check_data)
    if check_data[0] == check_data[1]:
        score[0] += 1
        score[1] += 1
    elif check_data[0] == check_data_sort[0]:
        score[1] += 3
    else:
        score[0] += 3

#結果表示
print(" ".join(map(str, score)))

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:
tpoint = 0
hpoint = 0
num = int(input())
for i in range(num):
    taro,hanako = map(str,input().split())
    A = sorted(list([taro,hanako]))
    if taro == hanako:
        tpoint +=1
        hpoint +=1
    else:
        if A[0]==taro:
            tpoint += 3
        elif A[0]==hanako:
            hpoint +=3
print(str(hpoint)+' '+str(tpoint))

Submission status: Accepted

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

print(Asum,Bsum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
t_score = 0
h_score = 0

for i in range(int(input())):
  card1, card2 = input().split(' ')

  if card1 < card2:
    h_score += 3
  elif card1 > card2:
    t_score += 3
  else:
    h_score += 1
    t_score += 1

print(t_score, h_score)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
c = int(input())
p1 = 0
p2 = 0
for i in range(c):
    s1,s2 = map(str,input().split())
    if s1 > s2:
        p1 = p1 + 3
    elif s1 < s2:
        p2 = p2 + 3
    else:
        p1 = p1 + 1
        p2 = p2 + 1
print("{0} {1}".format(p1,p2))

Submission status: Accepted

Solution code:
x = int(input())
ctr_A = 0
ctr_B = 0

for idx in range(x):
    A,B = input().split()
    
    xSw_OK = False
    if len(A) > len(B):
        xLoop = len(A)
    else:
        xLoop = len(B)
    
    for y in range(xLoop):
        if A[y:y+1] == B[y:y+1]:
            True
        elif A[y:y+1] > B[y:y+1]:
            xSw_OK = True
            ctr_A += 3
        else:
            xSw_OK = True
            ctr_B += 3
        if xSw_OK == True:
            break
    if xSw_OK == False:
        ctr_A += 1
        ctr_B += 1

print(ctr_A,ctr_B)

Submission status: Accepted

Solution code:
n = int(input())

taro = 0
hanako = 0
for _ in range(n):
    
    cards = list(input().split())
    win_card = sorted(cards, reverse=True)[0]
    
    if cards[0] == cards[1]:
        taro += 1
        hanako += 1
    elif cards.index(win_card) == 0:
        taro += 3
    elif cards.index(win_card) == 1:
        hanako += 3

print(f"{taro} {hanako}")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# カードの数を受け取る
n = int(input())

# スコア変数を定義
t_score = 0
h_score = 0

# カードを受け取って処理実行
for i in range(n):
    inp = input()
    inp_list = [j for j in inp.split()]
    t, h = inp.split()
    srtd_inp_list = sorted(inp_list)
    if inp_list[0] == inp_list[1]:
        t_score += 1
        h_score += 1
    elif inp_list[0] != srtd_inp_list[0]:
        t_score += 3
    else:
        h_score += 3

print(f"{t_score} {h_score}")

Submission status: Accepted

Solution code:

def card_game():
    T = 0
    H = 0

    n = int(input())

    for _ in range(n):
        param = input()
        param = param.split(" ")
        c1 = param[0]
        c2 = param[1]

        if c1 > c2 :
            T += 3
        elif c1 < c2:
            H += 3
        else:
            T += 1
            H += 1

    print(str(T) + " " + str(H) )

if __name__ == "__main__":
    card_game()

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

Submission status: Accepted

Solution code:
n = int(input())

ans = [0, 0]

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

print(*ans)

Submission status: Accepted

Solution code:
turn_n = int(input())

taro_score = 0
hanako_score = 0

for _ in range(turn_n):
    taro_card, hanako_card = input().split()
    
    if taro_card > hanako_card:
        taro_score += 3
    elif taro_card < hanako_card:
        hanako_score += 3
    else:
        taro_score += 1
        hanako_score += 1
print(taro_score, hanako_score)

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
    elif t_card == h_card:
        t_point += 1
        h_point += 1
    else:
        pass
print("{} {}".format(t_point, h_point))

Submission status: Accepted

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

Submission status: Accepted

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

for t in range(times):
    t,h = input().split()
    if t > h:
        T += 3
    elif t == h:
        T += 1
        H += 1
    else:
        H += 3
        
print("%d %d"%(T,H))

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

Submission status: Accepted

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

for i in range(turns):
    t_card, h_card = input().split(" ")
    if t_card > h_card:
        taro += 3
    elif t_card == h_card:
        taro += 1
        hanako += 1
    else:
        hanako += 3
print(taro, hanako)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
score_t = score_h = 0
n = int(input())
for _ in range(n):
    animal_t, animal_h = input().split()
    if animal_t == animal_h:
        score_t += 1
        score_h += 1
    elif animal_t > animal_h:
        score_t += 3
    else:
        score_h += 3

print(score_t, score_h)

Submission status: Accepted

Solution code:
ts, hs = 0, 0
n, *S = open(0).read().split()
for t, h in zip(*[iter(S)]*2):
    if t < h:
        hs += 3
    elif t > h:
        ts += 3
    else:
        hs += 1
        ts += 1
print(f'{ts} {hs}')

Submission status: Accepted

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

print(ts,hs)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    # h0,w0h1,w1 = map(int, input().split())
    n=int(input())
    taro=hanako=0
    for _ in range(n):
        tw,hw=input().split()
        if tw>hw:
            taro+=3
        elif tw==hw:
            taro+=1
            hanako+=1
        else:
            hanako+=3
    print(taro,hanako)

main()

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 x == y:
        a += 1
        b += 1
    else:
        b += 3

print(a, b)

Submission status: Accepted

Solution code:
n = int(input())

l = "abcdefghijklmnopqrstuvwxyz"

taroscore = 0
hanakoscore = 0


for i in range(n):
  card = input().split()
  taro = card[0]
  hanako = card[1]
  tn = len(taro)
  hn = len(hanako)

  if tn > hn :
    tryn = hn

  else:
    tryn = tn

  for o in range(tryn):


    for j in range(26):
      if taro[o] == l[j]:
        taros = j

    for k in range(26):
      if hanako[o] == l[k]:
        hanakos = k

    if taros > hanakos:
      result = "taro"
      break
    elif taros < hanakos:
      result = "hanako"
      break
    else:
      result = "even"

  if result == "taro":
    taroscore += 3

  elif result == "hanako":
    hanakoscore += 3

  else:
    if tn == hn:
      taroscore += 1
      hanakoscore += 1
    elif tn < hn:
      hanakoscore += 3
    else:
      taroscore += 3

print(taroscore, hanakoscore)

Submission status: Accepted

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

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

print(taro, hanako)

Submission status: Accepted

Solution code:
n=int(input())
taro=0
hanako=0
for i in range(n):
    w1,w2=input().split()
    o1,o2=0,0
    m=max(len(w1),len(w2))
    for i in range(len(w1)):
        o1+=ord(w1[i])*123**(m-i)
    for i in range(len(w2)):
        o2+=ord(w2[i])*123**(m-i)
    if o1>o2:
        taro+=3
    elif o1<o2:
        hanako+=3
    else:
        taro+=1
        hanako+=1
print(str(taro)+' '+str(hanako))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    a,b = input().split()
    if ord(a[0]) < ord(b[0]):
        h += 3
    elif a == b:
        h += 1
        t += 1
    elif ord(a[0]) == ord(b[0]):
        if len(a) >= len(b):
            if b == a[:len(b)]:
                t += 3
            else:
                for i in range(len(b)):
                    if ord(a[i]) == ord(b[i]):
                        pass
                    elif ord(a[i]) < ord(b[i]):
                        h += 3
                        break
                    else:
                        t += 3
                        break
        elif len(a) < len(b):
            if a == b[:len(a)]:
                h += 3
            else:
                for i in range(len(a)):
                    if ord(b[i]) == ord(a[i]):
                        pass
                    elif ord(b[i]) < ord(a[i]):
                        t += 3
                        break
                    else:
                        h += 3
                        break
    else:
        t += 3
print(f"{t} {h}")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(t, h)

Submission status: Accepted

Solution code:
import sys
n=int(input())
p1=0
p2=0
for i in range(n):
    x=input().split()
    if x[0]>x[1]:
        p1+=3
    elif x[0]<x[1]:
        p2+=3
    else:
        p1+=1
        p2+=1
print(p1,p2)

Submission status: Accepted

Solution code:
n = int(input())
scoreT = 0
scoreH = 0
for i in range(0, n):
    words = input().split(" ")
    if words[0] < words[1]:
        scoreH += 3
    elif words[1] < words[0]:
        scoreT += 3
    elif words[0] == words[1]:
        scoreT += 1
        scoreH += 1
print(str(scoreT)+" "+str(scoreH))

Submission status: Accepted

Solution code:
turn = int(input())
taro, hana = 0, 0
for i in range(turn):
    p1, p2 = input().split()
    if p1 > p2:
        taro += 3
    elif p1 == p2:
        taro += 1
        hana += 1
    else:
        hana += 3
print(taro, hana)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
tarou=0
hanako=0
cnt=0

while True:
    t,h=input().split()
    a=0
    if t==h:
        tarou+=1
        hanako+=1
        a=1
    if a==0:
        for i in range(min(len(t),len(h))):
            if t[i]>h[i]:
                tarou+=3
                break
            elif t[i]<h[i]:
                hanako+=3
                break
            if i==min(len(t),len(h))-1:
                if len(t)>len(h):
                    tarou+=3
                    break
                else:
                    hanako+=3
                    break
    cnt+=1
    if cnt==n:
        break
print(tarou,hanako)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    lines.append(input().split(" "))
    if lines[i][0] > lines[i][1]:
        Taro+=3
    elif lines[i][0] == lines[i][1]:
        Taro+=1
        Hanako+=1
    else:
        Hanako+=3

print(Taro, Hanako)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
game_count = int(input())
point_p1 = 0
point_p2 = 0

for _ in range(game_count):
    card_p1, card_p2 = input().split()
    
    if card_p1 < card_p2:
        point_p2 += 3
    elif card_p1 > card_p2:
        point_p1 += 3
    else:
        point_p1 += 1
        point_p2 += 1

print(point_p1, point_p2)

Submission status: Accepted

Solution code:
N = int(input())
Taro_point = 0
Hanako_point = 0
for i in range(N):
    list = input().split()
    if list[0] == list[1]:
        Taro_point += 1
        Hanako_point += 1
    elif list == sorted(list):
        Hanako_point += 3
    else:
        Taro_point += 3
print(Taro_point,Hanako_point)

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 += 1
        h_point += 1
    elif t_card> h_card:
        t_point += 3
    else:
        h_point += 3

print('{} {}'.format(t_point, h_point))

Submission status: Accepted

Solution code:
#import pysnooper
#import os,re,sys,operator,math,heapq,string
from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from copy import deepcopy

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

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

Submission status: Accepted

Solution code:
a,b=0,0
for i in range(int(input())):
    x,y=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:
n = int(input())
taro=0
hanako=0
for _ in range(n):
    s1,s2 = input().split( )
    #print(s1>s2,s1<s2,s1==s2)
    
    if s1 > s2:
        taro += 3
        #print("tr")
        
    elif s1 < s2:
        hanako += 3
        #print("hn")
    
    elif s1 == s2:
        taro += 1
        hanako += 1
        #print("drw")
print(taro, hanako)

Submission status: Accepted

Solution code:
# inputs
n = int(input())
matches = []
for i in range(n):
    matches.append(input().split())

# output
point_a = 0
point_b = 0
for match in matches:
    if match[0] > match[1]:
        point_a += 3
    elif match[0] < match[1]:
        point_b += 3
    elif match[0] == match[1]:
        point_a += 1
        point_b += 1

print('{} {}'.format(point_a, point_b))

Submission status: Accepted

Solution code:
games = int(input())

taro = 0
hanako = 0

for _ in range(games):
    taroinput, hanakoinput = input().split()
    if taroinput == hanakoinput:
        taro += 1
        hanako += 1
        continue
    attempts = min(len(taroinput), len(hanakoinput))
    if len(taroinput) > len(hanakoinput):
        isTaroLonger = True
    else:
        isTaroLonger = False
    iter_taro = iter(taroinput)
    iter_hanako = iter(hanakoinput)
    for i in range(attempts):
        next_taro = next(iter_taro)
        next_hanako = next(iter_hanako)
        if next_taro > next_hanako:
            taro += 3
            break
        elif next_hanako > next_taro:
            hanako += 3
            break
    else:
        if isTaroLonger:
            taro += 3
        else:
            hanako += 3

print(taro, hanako)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
t_tp = 0
h_tp = 0
for i in range(n):
    t_c,h_c = map(str,input().split())

    if t_c == h_c:
        t_tp += 1
        h_tp += 1
    else:
        t_p = 0
        h_p = 0
        for j in range(len(t_c)):
            t_p += ord(t_c[j])
        for k in range(len(h_c)):
            h_p += ord(h_c[k])
        if t_c > h_c:
            t_tp += 3
        else:
            h_tp += 3
            
        
            
print(t_tp,h_tp)

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:
taro_score = 0
hanako_score = 0
for _ in range(int(input())):
    taro, hanako = [str(x) for x in input().split()]
    if taro > hanako:
        taro_score += 3
    elif taro == hanako:
        taro_score += 1
        hanako_score += 1
    else:
        hanako_score += 3
print(taro_score, hanako_score)

Submission status: Accepted

Solution code:
taro=0;hanako=0
for i in range(int(input())):
    l=list(map(str,input().split()))
    if l[0]>l[1]:
        taro+=3
    elif l[0]<l[1]:
        hanako+=3
    else:
        taro+=1;hanako+=1
print(taro,hanako)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())

p = [0, 0]

for i in range(num):
    list = input().split()
    if list[0] == list[1]:
        p[0] += 1
        p[1] += 1
    elif sorted(list)[0] == list[0]:
        p[1] += 3
    else:
        p[0] += 3

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import zip_longest
n = int(input())
c = [0]*2
for _ in range(n):
    s = input().split()
    for a, b in zip_longest(s[0], s[1], fillvalue='`'):
        if ord(a) > ord(b):
            c[0] += 3
            break
        if ord(a) < ord(b):
            c[1] += 3
            break
    if ord(a) == ord(b):
        c[0] += 1;c[1] += 1

print(*c)