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:
def cardgame(animal1, animal2, taro, hanako):
    if animal1==animal2:
        return [taro+1, hanako+1]
    anim_list = sorted([animal1, animal2])
    if anim_list[0]==animal1:
        return [taro, hanako+3]
    else:
        return [taro+3, hanako]

n = int(input())
taro, hanako = 0, 0
for i in range(n):
    data = input().split()
    result = cardgame(data[0], data[1], taro, hanako)
    taro, hanako = result[0], result[1]
print(taro, end=" ")
print(hanako)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
t_point = h_point = 0
for i in range(n):
    t_card,h_card = [x for x in 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())
T_point = H_point = 0
for _ in range(n):
    T_card,H_card = [x for x in 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:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

n = int(sys.stdin.readline())
t_score = h_score = 0

for i in range(n):
    t_card, h_card = sys.stdin.readline().split()
    if t_card > h_card:
        t_score += 3
    elif t_card < h_card:
        h_score += 3
    else:
        t_score += 1
        h_score += 1

print(t_score, h_score)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def card_game(pairs):
    points = [0, 0]
    for pair in pairs:
        if (pair[0] > pair[1]):
            points[0] += 3
        elif (pair[0] < pair[1]):
            points[1] += 3
        else:
            points[0] += 1
            points[1] += 1

    return points

if __name__ == '__main__':
    n = int(input())
    pairs = []
    for _ in range(n):
        pairs.append(input().split())

    points = card_game(pairs)
    print(' '.join(map(str, points)))

Submission status: Accepted

Solution code:
n = int(input())
score = [0,0]
for _ in range(n):
    tc, hc = input().split()
    if tc == hc:
        score[0] += 1
        score[1] += 1
    elif tc > hc:
        score[0] += 3
    else:
        score[1] += 3
print(*score)

Submission status: Accepted

Solution code:
tp = hp = 0
for i in range(int(input())):
    taro, hana = map(list, input().split())
    short = min(len(taro), len(hana))
    result = 0
    for k in range(short):
        if ord(taro[k]) != ord(hana[k]):
            result = ord(taro[k]) - ord(hana[k])
            break
    if not result:
        if len(taro) < len(hana):
            result = -1
        elif len(taro) > len(hana):
            result = 1
    if result > 0:
        tp += 3
    elif result < 0:
        hp += 3
    else:
        tp += 1
        hp += 1
print(tp, hp)

Submission status: Accepted

Solution code:
n = int(input())
i = 0
p0 = 0
p1 = 0
while i < n:
    s = list(map(str, input().split(' ')))
    if s[0] > s[1]:
        p0 += 3
    elif s[0] < s[1]:
        p1 += 3
    else:
        p0 += 1
        p1 += 1
    i += 1
print(str(p0) + ' ' + str(p1))

Submission status: Accepted

Solution code:
def scores(card1, card2):
    """returns scores of a card game.

    >>> scores('cat', 'dog')
    (0, 3)
    >>> scores('fish', 'fish')
    (1, 1)
    >>> scores('tiger', 'lion')
    (3, 0)
    """
    if card1 == card2:
        return (1, 1)
    elif card1 > card2:
        return (3, 0)
    else:
        return (0, 3)


def run():
    c = int(input())
    taro, hanako = 0, 0

    for i in range(c):
        pt, ph = scores(*(input().split()))
        taro += pt
        hanako += ph

    print(taro, hanako)


if __name__ == '__main__':
    run()

Submission status: Accepted

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

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

print(t_score, h_score)

Submission status: Accepted

Solution code:
#coding: utf-8

p = [0,0]
n = int(input())
for i in range(n):
    c1 = input().split(" ")
    c2 = sorted(c1)

    if c1[0] == c1[1]:
        p[0] += 1
        p[1] += 1

    elif c1[0] == c2[0]:
        p[1] += 3
    else:
        p[0] += 3

print(str(p[0]) + " " + str(p[1]))

Submission status: Accepted

Solution code:
t = 0; h = 0
for _ in range(int(input())):
  a, b = map(str, input().split())
  if a == b:
    t += 1
    h += 1
    continue
  l = sorted([a, b])
  if [a, b] == l:
    h += 3
  else:
    t += 3
print("{0} {1}".format(t, h))

Submission status: Accepted

Solution code:
t = h = 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:
import sys

l = []
for i in sys.stdin:
    l.append(i.split())

taro = 0
hanako = 0
for i in range(1,len(l)):
    if l[i][1] > l[i][0]:
        hanako += 3
    elif l[i][0] > l[i][1]:
        taro += 3
    else:
        hanako += 1
        taro += 1

print(taro,hanako)

Submission status: Accepted

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

Submission status: Accepted

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

for _ in range(n):
    idiom_list = list(input().split(' '))
    sort_list = sorted(idiom_list)
    if idiom_list[0] == idiom_list[1]:
        taro += 1
        hana += 1
    else:
        if idiom_list == sort_list:
            hana += 3
        else:
            taro += 3

print('{a} {b}'.format(a=taro, b=hana))

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

Submission status: Accepted

Solution code:
N=int(input())
Taro=0
Hanako=0
for i in range(N):
    T,H=map(str,input().split())
    if T<H:
        Hanako+=3
    elif H<T:
        Taro+=3
    else:
        Hanako+=1
        Taro+=1
print(Taro,Hanako)

Submission status: Accepted

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

n = int(input())
t_point, h_point = 0, 0

for i in range(n):
    t_card,  h_card  = map(str, input().split())

    if t_card == h_card:
        t_point += 1
        h_point += 1
    elif t_card > h_card:
        t_point += 3
    elif t_card < h_card:
        h_point += 3

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#! python3
# card_game.py

n = int(input())
turns = [input() for i in range(n)]

taro, hanako = 0, 0
for turn in turns:
    t, h = turn.split(' ')
    min_len = len(t) if len(t) <= len(h) else len(h)

    win_flag = 0 # -1: taro, 1: hanako, 0: draw
    for i in range(min_len):
        if ord(t[i]) < ord(h[i]):
            win_flag = 1
            break
        elif ord(h[i]) < ord(t[i]):
            win_flag = -1
            break

    if win_flag == 0:
        if len(t) < len(h):
            win_flag = 1
        elif len(h) < len(t):
            win_flag = -1

    if win_flag == -1:
        taro += 3
    elif win_flag == 1:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro, hanako)

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:
t = int(input())
q,w = 0,0
for i in range(t):
	a,b = input().split()
	if a == b:
		q += 1
		w += 1
	elif a<b :
		w+=3
	elif a>b:
		q+=3
print(q,w)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())
taro = 0
hanako = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
from itertools import zip_longest

turn = int(input())
dic = {s: i for i, s in enumerate(string.ascii_lowercase)}
t_s, h_s = 0, 0

for _ in range(turn):
    t, h = input().split()
    if t == h:
        t_s += 1
        h_s += 1
    for t_c, h_c in zip_longest(t, h, fillvalue='a'):
        if dic[t_c] > dic[h_c]:
            t_s += 3
            break
        elif dic[t_c] < dic[h_c]:
            h_s += 3
            break

print(t_s, h_s)

Submission status: Accepted

Solution code:
n = int(input())
T_p, H_p = 0, 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:
# AOJ ITP1_9_C

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    SCORE_taro = 0
    SCORE_hanako = 0
    n = int(input())
    for i in range(n):
        words = input().split()
        if words[0] > words[1]: SCORE_taro += 3
        elif words[0] < words[1]: SCORE_hanako += 3
        else:
            SCORE_taro += 1; SCORE_hanako += 1
    print(str(SCORE_taro) + " " + str(SCORE_hanako))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def judge():
    if t > h:
        point["t"] += 3
    elif t < h:
        point["h"] += 3
    else:
        point["t"] += 1; point["h"] += 1

n = int(input())
point = {"t": 0, "h": 0}
for i in range(n):
    t, h = input().split()
    judge()
print(point["t"], point["h"])

Submission status: Accepted

Solution code:
n = int(input())

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

print(str(t) + ' ' + str(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 += 3
    else:
        x += 1
        y += 1
print(x,y)

Submission status: Accepted

Solution code:
taro = 0
hana = 0
n = int(input())
for _ in range(n):
    taro_s, hana_s = map(str, input().split())
    if taro_s > hana_s:
        taro += 3
    elif hana_s > taro_s:
        hana += 3
    else:
        taro += 1
        hana += 1
print(taro, hana)

Submission status: Accepted

Solution code:
s = [0, 0, 0]
loop = int(raw_input())
for i in range(loop):
    w1, w2 = raw_input().split()
    tmp = 1 - cmp(w1, w2)
    if tmp == 1:
        s[0] += 1
        s[2] += 1
    else:
        s[tmp] += 3
print s[0], s[2]

Submission status: Accepted

Solution code:
n = int(input())
T = H = 0
for x in range(n):
    t, h = input().split()
    tl = list(t)
    hl = list(h)
    z = min([int(len(tl)),int(len(hl))])
    for k in range(z):
        if ord(tl[k]) > ord(hl[k]):
            T += 3
            break
        elif ord(tl[k]) == ord(hl[k]):
            pass
        else:
            H += 3
            break
    else:
        if len(hl) == len(tl):
            T += 1
            H += 1
        elif z == len(tl):
            H += 3
        else:
            T += 3
print(f"{str(T)} {str(H)}")

Submission status: Accepted

Solution code:
# Card Game

cardAmount = int(input())

taro = 0
hanako = 0
for i in range(cardAmount):
    cards = input().rstrip().split()
    sortedCards = sorted(cards)
    if cards[0] == cards[1]:
        taro += 1
        hanako += 1
    elif cards == sortedCards:
        hanako += 3
    else:
        taro += 3
print(taro, hanako)

Submission status: Accepted

Solution code:
n = int(input())
tscore = 0
hscore = 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()):
        tscore += 1
        hscore += 1
    elif (order[1] == t):
        tscore += 3
    elif (order[1] ==h ):
        hscore += 3
print(tscore, hscore)

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

Submission status: Accepted

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

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

print("%d %d" % (T, H))

Submission status: Accepted

Solution code:
import sys

def judge(word1, word2):
    lena = len(word1)
    lenb = len(word2)
    for i in range(min(lena,lenb)):
        if word1[i] > word2[i]: return 1
        elif word1[i] < word2[i]: return 2
    if lena > lenb: return 1
    elif lena < lenb: return 2
    else: return 0

p = 0
s = [0, 0, 0]
for line in sys.stdin:
    ls = line.strip('\n')
    if p ==0:
        loop = int(ls)
        p = 1
    elif p == 1:
        if loop <= 0: break
        w1, w2 = ls.split()
        tmp = judge(w1, w2)
        if tmp == 0:
            s[1] += 1
            s[2] += 1
        else:
            s[tmp] += 3
        loop -= 1
print s[1], s[2]

Submission status: Accepted

Solution code:
def judge(w1, w2):
    la = len(w1)
    lb = len(w2)
    for i in range(min(la,lb)):
        if w1[i] > w2[i]: return 1
        elif w1[i] < w2[i]: return 2
    if la > lb: return 1
    elif la < lb: return 2
    else: return 0

s = [0, 0, 0]
loop = int(raw_input())
for i in range(loop):
    w = raw_input().split()
    tmp = judge(*w)
    if tmp == 0:
        s[1] += 1
        s[2] += 1
    else:
        s[tmp] += 3
print s[1], s[2]

Submission status: Accepted

Solution code:
s = [0, 0, 0]
loop = int(raw_input())
for i in range(loop):
    w1, w2 = raw_input().split()
    tmp = 1 - cmp(w1, w2)
    if tmp == 1:
        s[0] += 1
        s[2] += 1
    else:
        s[tmp] += 3
print s[0], s[2]

Submission status: Accepted

Solution code:
n=input()
t,h=0,0
for i in range(n):
    a,b=raw_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(raw_input())
p=[0,0]
for i in range(n):
        c=[0 for i in range(100)]
        c=map(list,raw_input().split())
        m=0
        while 1:
                try:
                        if c[0]==c[1]:
                                p[0]+=1
                                p[1]+=1
                                break
                        elif c[0][m]<c[1][m]:
                                p[1]+=3
                                break
                        elif c[1][m]<c[0][m]:
                                p[0]+=3
                                break
                        m+=1
                except IndexError:
                        if len(c[0])<len(c[1]):
                                p[1]+=3
                                break
                        if len(c[1])<len(c[0]):
                                p[0]+=3
                                break
print p[0], p[1]

Submission status: Accepted

Solution code:
from __future__ import division, print_function
from sys import stdin
n = int(stdin.readline())
result = [0, 0]
for _ in range(n):
    taro, hanako = stdin.readline().split()
    if taro > hanako:
        result[0] += 3
    elif taro < hanako:
        result[1] += 3
    else:
        result[0] += 1
        result[1] += 1
print(*result)

Submission status: Accepted

Solution code:
taro,hanako = 0,0
w=[]
n = int(raw_input())
for i in xrange(n):
    w.append(map(str, raw_input().split()))
for j in xrange(n):
    if w[j][0]>w[j][1]:
        taro+=3
    elif w[j][0]<w[j][1]:
        hanako+=3
    else:
        taro+=1
        hanako+=1
#print n
#print w
print taro,hanako

Submission status: Accepted

Solution code:
n = input()
s = [0, 0]
while n>0:
	n -= 1
	l = raw_input().split()
	if l[0] == l[1]:
		s[0] += 1
		s[1] += 1
	elif sorted(l) == l:
		s[1] += 3
	else:
		s[0] += 3
print s[0], s[1]

Submission status: Accepted

Solution code:
n = int(raw_input())
t = 0
h = 0
for i in range(0,n):
    tW,hW, = raw_input().split()
    if tW >hW:
        t += 3
    elif tW == hW:
        t += 1
        h += 1
    else:
        h +=3
print t,h

Submission status: Accepted

Solution code:
score = [0, 0]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
score=[0,0,0]
for _ in range(n):
    tc,hc=map(str,input().split())
    if tc==hc:
        score[1]+=1
        score[-1]+=1
        continue
    i=0
    ml=min(len(tc),len(hc)) 
    while tc[i]==hc[i]:
        i+=1
        if i>=ml:
            tc+="0"
            hc+="0"
            break
    r=ord(tc[i])-ord(hc[i])
    r=r//abs(r)
    score[r]+=3

print("{} {}".format(score[1],score[-1]))

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:
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())
T = 0
H = 0
for i 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:
n = int(input())
Taro_ten = 0
Hanako_ten = 0
for i in range(n) :
    a, b = list(input().split())
    Taro = list(a)
    Hanako = list(b)
    length = min(len(Taro), len(Hanako))
    for i in range(length) :
        if ord(Taro[i]) > ord(Hanako[i]) :
            Taro_ten += 3
            break
        elif ord(Taro[i]) < ord(Hanako[i]) :
            Hanako_ten += 3
            break
        if i == length -1 :
            if len(Taro) > length :
                Taro_ten += 3
            elif len(Hanako) > length :
                Hanako_ten += 3
            else :
                Taro_ten += 1
                Hanako_ten += 1
print(Taro_ten, Hanako_ten)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:

x=int(input())
list=[]
c=0
d=0
for i in range(x):
    a,b=input().split()
    
    if a<b:
        d+=3
    elif a>b:
        c+=3
    else:
        c+=1
        d+=1
print(c,d)

Submission status: Accepted

Solution code:
n = int(input())

a= 0
b= 0

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

Submission status: Accepted

Solution code:
t=0
h=0
for i in range(int(input())):
    A,B=list(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:
x = int(input())
T = 0
H = 0
for i in range(x):
    a,b = map(str,input().split())
    if a < b:
        H+=3
    elif a == b:
        T+=1
        H+=1
    else:
        T+=3

print(T,H)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from string import ascii_lowercase as asc
n = int(input())
card = []
point = [0,0]
for i in range(n):
	card.append(list(map(str,input().split())))
for k in range(len(card)):
	if card[k][0] == card[k][1]:
		point[0] += 1
		point[1] += 1
	elif card[k][0] == card[k][1][:len(card[k][0])]:
		point[1] += 3
	elif card[k][1] == card[k][0][:len(card[k][1])]:
		point[0] += 3
	else:
		s = 0
		while True:
			if card[k][0][s] == card[k][1][s]:
				s += 1
			else:
				break
		for kk in asc:
			if card[k][0][s] == kk:
				point[1] += 3
				break
			elif card[k][1][s] == kk:
				point[0] += 3
				break
print(" ".join(list(map(str,point))))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
T = 0
H = 0
for i in range(x):
    a, b = map(str, 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())
H=[]
T=[]
for i in range (n):
    a=list(map(str, input().split())) 
    if a[0]>a[1] :
        H.append(3)
    elif a[0]<a[1] :
        T.append(3)
    else :
        H.append(1)
        T.append(1)
        

print(sum(H), sum(T))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
leftp,rightp=0,0
loopnum = int(input())

for i in range(loopnum):
    st=input().split()
    stnew = sorted(st)
        
    if st[0]==st[1]:
        leftp = leftp+1
        rightp = rightp+1
    elif st != stnew:
        leftp=leftp+3
    elif st == stnew:
        rightp = rightp+3
        
print(str(leftp)+" "+str(rightp))

Submission status: Accepted

Solution code:
n=int(input())

taro=0
hanako=0

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

print(taro, hanako)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
class Human:
    def __init__(self, name, card = "", point = 0):
        self.name = name
        self.card = card
        self.point = point
    
    def add_point(self, opponent):
        if self.card > opponent:
            self.point += 3
        elif self.card == opponent:
            self.point += 1
        else:
            pass

Taro = Human('Taro')
Hanako = Human('Hanako')

N = int(input())
for n in range(N):
    Taro.card, Hanako.card = input().split()
    Taro.add_point(Hanako.card)
    Hanako.add_point(Taro.card)

print(Taro.point, Hanako.point)

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

AP = 0
BP = 0


for i in range(N):
    A,B = input().split()
    sa = 0
    X = max( len(A) , len(B) )
    A = A.ljust(X, '0')
    B = B.ljust(X, '0')
    if A == B:
        AP += 1
        BP += 1
    else:
        for j in range(X):
            if ord( A[j] ) > ord( B[j] ):
                AP += 3
                break
            elif ord( B[j] ) > ord( A[j] ):
                BP += 3
                break
            else:
                pass
print( AP,BP, sep=' ')

Submission status: Accepted

Solution code:
n = int(input())
a = 0
b = 0
for i in range(n):
    word = list(input().split())
    new_word = sorted(word)
    if word[0] == word[1]:
        a += 1
        b += 1
    elif new_word == word:
        b += 3
    else:
        a += 3
print('{} {}'.format(a, b))

Submission status: Accepted

Solution code:
turn = int(input())

point_taro = point_hanako = 0

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

    if taro > hanako:
        point_taro += 3
    elif hanako > taro:
        point_hanako += 3
    else:
        point_taro += 1
        point_hanako += 1

print("{} {}".format(point_taro,point_hanako))

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

Submission status: Accepted

Solution code:
taro_point = 0
hanako_point = 0
N = int(input())
for _ in range(N):
    taro,hanako = input().split()
    list = [taro,hanako]
    list_new = sorted(list)
    if taro == hanako:
        taro_point += 1
        hanako_point += 1
    elif list_new[1] == hanako:
        hanako_point +=3
    elif list_new[1] == taro:
        taro_point += 3
print(str(taro_point),str(hanako_point))

Submission status: Accepted

Solution code:
#
# 9c
#

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

    print(f"{T} {H}")


if __name__ == '__main__':
    main()

Submission status: Accepted

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