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: Wrong Answer

Solution code:
n = int(input())

score_taro, score_hanako = 0, 0
for _ in range(n):
    card_taro, card_hanako = input().split()

    point_taro, point_hanako = 0, 0
    if card_taro == card_hanako:
        point_taro = 1
        point_hanako = 1
        #print("draw")#
        continue
    for i in range(min(len(card_taro), len(card_hanako))):
        if len(card_taro) > len(card_hanako):
            point_taro = 3
        if len(card_taro) < len(card_hanako):
            point_hanako = 3
        if ord(card_taro[i:i+1]) > ord(card_hanako[i:i+1]):
            point_taro = 3
            point_hanako = 0
            break
        if ord(card_taro[i:i+1]) < ord(card_hanako[i:i+1]):
            point_taro = 0
            point_hanako = 3
            break

    score_taro += point_taro
    score_hanako += point_hanako

print("{0} {1}".format(score_taro, score_hanako))

Submission status: Wrong Answer

Solution code:
n = int(input())

score_taro, score_hanako = 0, 0
for _ in range(n):
    card_taro, card_hanako = input().split()

    point_taro, point_hanako = 0, 0
    if card_taro == card_hanako:
        score_taro = 1
        score_hanako = 1
        continue
    for i in range(min(len(card_taro), len(card_hanako))):
        if len(card_taro) > len(card_hanako):
            point_taro = 3
        if len(card_taro) < len(card_hanako):
            point_hanako = 3
        if ord(card_taro[i:i+1]) > ord(card_hanako[i:i+1]):
            point_taro = 3
            point_hanako = 0
            break
        if ord(card_taro[i:i+1]) < ord(card_hanako[i:i+1]):
            point_taro = 0
            point_hanako = 3
            break

    score_taro += point_taro
    score_hanako += point_hanako

print("{0} {1}".format(score_taro, score_hanako))

Submission status: Wrong Answer

Solution code:
n = int(input())

score_taro, score_hanako = 0, 0
for _ in range(n):
    card_taro, card_hanako = input().split()

    point_taro, point_hanako = 0, 0
    if card_taro == card_hanako:
        score_taro = 1
        score_hanako = 1
        continue
    for i in range(min(len(card_taro), len(card_hanako))):
        if ord(card_taro[i:i+1]) > ord(card_hanako[i:i+1]):
            score_taro += 3
            break
        if ord(card_taro[i:i+1]) < ord(card_hanako[i:i+1]):
            score_hanako += 3
            break
    if len(card_taro) > len(card_hanako):
        score_taro += 3
    elif len(card_taro) < len(card_hanako):
        score_hanako += 3

print("{0} {1}".format(score_taro, score_hanako))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

n = int(input())

tScore = 0
hScore = 0

for i in range(n):
    T, H = input().split()
    if T == H:
        tScore += 1
        hScore += 1
    else:
        j = 0
        while True:
            if T in H or H in T:
                if len(T) > len(H):
                    hScore += 3
                else:
                    tScore +=3
                break
            if T[j] != H[j]:
                if ord(T[j]) > ord(H[j]):
                    tScore += 3
                else:
                    hScore += 3
                break
            j += 1
print("%d %d" % (tScore, hScore))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

n = int(input())

tScore = 0
hScore = 0

for i in range(n):
    T, H = input().split()
    if T == H:
        tScore += 1
        hScore += 1
    else:
        j = 0
        while True:
            if T in H or H in T:
                if len(T) > len(H):
                    tScore +=3
                else:
                    hScore += 3
                break
            if T[j] != H[j]:
                if ord(T[j]) > ord(H[j]):
                    tScore += 3
                else:
                    hScore += 3
                break
            j += 1
print("%d %d" % (tScore, hScore))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

n = int(input())

tScore = 0
hScore = 0

for i in range(n):
    T, H = input().split()
    if T == H:
        tScore += 1
        hScore += 1
    elif T > H:
        hScore +=3
    elif H > T:
        tScore += 3
print("%d %d" % (tScore, hScore))

Submission status: Wrong Answer

Solution code:
t=int(input())
taro=0
hanako=0
for i in range(t):
    S=input().split()
    if S[0]==S[1]:
        taro+=1
        hanako+=1
    elif S==S.sort():
        taro+=3
    elif S!=S.sort():
        hanako+=3
print(taro,hanako)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    Card = tuple(tuple(input().split()) for _ in range(N))

    taro = 0
    hanako = 0
    for c in Card:
        if c[0] > c[1]:
            taro += 3
        if c[0] < c[1]:
            hanako += 3
        else:
            taro += 1
            hanako += 1

    print(taro, hanako)

main()

Submission status: Wrong Answer

Solution code:
loop = int(raw_input())
taro = []
hanako = []
taro_score = 0
hanako_score = 0
for i in range(loop):
    t, h = raw_input().split()
    taro += [t]
    hanako += [h]

for t, h in zip(taro,hanako):
    if t[0] < h[0]:
        hanako_score += 3
    if t[0] > h[0]:
        taro_score += 3
    if t[0] == h[0]:
        taro_score += 1
        hanako_score += 1
print "%d %d" % (taro_score, hanako_score)

Submission status: Wrong Answer

Solution code:
zisyo=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
turn=int(input())
ten=[0,0]

for _ in range(turn):
    hikaku = input().split()
    if zisyo.index(hikaku[0][0])<zisyo.index(hikaku[1][0]):
        ten[1] +=3
    elif zisyo.index(hikaku[0][0]) == zisyo.index(hikaku[1][0]):
        ten[0]+=1
        ten[1]+=1
    elif zisyo.index(hikaku[0][0]) > zisyo.index(hikaku[1][0]):
        ten[0] +=3

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

Submission status: Wrong Answer

Solution code:
n = int(input())

score = [0, 0]
for i in range(n):
    c = input().split()
    if c[0] == c[1]:
        score = list(map(lambda x: x+1, score))
    elif c[0] > c[0]:
        score[1] += 3
    else:
        score[0] += 3

print(*score)

Submission status: Wrong Answer

Solution code:
t,h=0,0
n=int(input())
for i in range(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: Wrong Answer

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

    Lc = [chr(i) for i in range(97, 97 + 26)] #LowerCase

    B = []
    B_num = []
    t = 0
    h = 0

    for x in range(n):
        B.append(input().split())
        B[x][0] = list(B[x][0])
        B[x][1] = list(B[x][1])
        for y in range(2):
            hoge = []
            for z in range(len(B[x][y])):
                hoge.append(Lc.index(B[x][y][z]))
            B_num.append(hoge)

    for x in range(0, len(B_num), 2):
        for y in range(len(B_num[x])):
            if B_num[x][y] < B_num[x + 1][y]:
                h += 3
                break
            elif B_num[x][y] > B_num[x + 1][y]:
                t += 3
                break
            else:
                if y == len(B_num[x]) - 1:
                    t += 1
                    h += 1

    print(t, h)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():

    match_count = int(input())
    matches = [input().split() for i in range(match_count)]
    
    taro_result = [3 if match[0] > match[1] else 1 if match[0] == match[1] else 0 for match in matches]
    print('%d %d' % (sum(taro_result), sum(3 if item == 0 else 1 for item in taro_result)) )


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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 result > 0:
        tp += 3
    elif result < 0:
        hp += 3
    else:
        tp += 1
        hp += 1
print(tp, hp)

Submission status: Wrong Answer

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

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

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

    if t_card is h_card:
        t_point += 1
        h_point += 1
    else:
        for j in range(min(len(t_card), len(h_card))):
            if ord(t_card[j]) > ord(h_card[j]):
                t_point += 3
                break

            elif ord(t_card[j]) < ord(h_card[j]):
                h_point += 3
                break

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

Submission status: Wrong Answer

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

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

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

    if t_card in h_card:
        t_point += 1
        h_point += 1
    else:
        for j in range(min(len(t_card), len(h_card))):
            if ord(t_card[j]) > ord(h_card[j]):
                t_point += 3
                break

            elif ord(t_card[j]) < ord(h_card[j]):
                h_point += 3
                break

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

Submission status: Wrong Answer

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
        elif ord(h[i]) < ord(t[i]):
            win_flag = -1

    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: Wrong Answer

Solution code:
n=int(input())
i=0
Taro=0
Hana=0
while i<n:
    l=list(input())
    m=l.index(" ")
    #if ord(l[0])<ord(l[m+1]):
        #Hana+=1
    #elif ord(l[0])>ord(l[m+1]):
        #Taro+=1
    #else:
        #ord(l[1])
    p=0
    while True:
        if l[p]>l[m+1+p]:
            Taro+=3
            break
        elif l[p]<l[m+1+p]:
            Hana+=3
            break
        else:
            if p<m-1:
                p+=1
            else:
                Taro+=1
                Hana+=1
                break
    i+=1
Ans=str(Taro)+" "+str(Hana)
print(Ans)

Submission status: Wrong Answer

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()
    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
        elif t_c == h_c:
            t_s += 1
            h_s += 1
            break

print(t_s, h_s)

Submission status: Wrong Answer

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()
        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: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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)}")
print(f"{str(T)} {str(H)}")

Submission status: Wrong Answer

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[0]+=3
                                break
                        if len(c[1])<len(c[0]):
                                p[1]+=3
                                break
print p[0], p[1]

Submission status: Wrong Answer

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

print score[0], score[1]

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
taro, hanako = 0 ,0
for i in range(num):
    lst = list(map(str, input().split()))
    while 1:
        j = 0
        if lst[0] == lst[1]:
            taro = taro + 1
            hanako = hanako + 1
            break
        else:
            first = ord(lst[0][j:j+1])
            second = ord(lst[1][j:j+1])
            if first > second:
                taro = taro + 3
                break
            elif first < second:
                hanako = hanako + 3
                break
print(str(taro) + " " + str(hanako))

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():

    TaroScore = HanaScore = 0
    n = int(input())
    for _ in range(n):
        [Taro, Hana] = list(input().lower().split())

        lenT = len(Taro)
        lenH = len(Hana)
        lenMin = min(lenT, lenH)

        if Taro == Hana:
            TaroScore += 1
            HanaScore += 1
        
        else:
            for i in range(lenMin+1):
                if Taro == '':
                    HanaScore += 3
                    break
                elif Hana == '':
                    TaroScore += 3
                    break
                elif ord(Taro[0]) > ord(Hana[0]):
                    TaroScore += 3
                    break
                elif ord(Taro[0]) < ord(Hana[0]):
                    HanaScore += 3
                    break
                else:
                    Taro = Taro[1:]
                    Hana = Hana[1:]

    print(TaroScore, HanaScore)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

    points = {"taro":0, "hanako":0}

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

        if taro > hanako:
            points['taro']   += 3
        elif taro < hanako:
            points['hanako'] += 3
        else:
            points['taro']   += 1
            points['hanako'] += 1

    print(points['taro'], points['hanako'])

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
t_p = 0
h_p = 0
for i in range(n):
    taro, hana = [i for i in input().split()]
    if taro > hana:
        t_p += 3
    elif taro == hana:
        t_p += 1
        h_p += 1
    else:
        h_p += 3
print(f'{t_p} {h_p}')

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(raw_input())
a = b = 0
for i in range(n):
    tmp = raw_input().split()
    if tmp[0] > tmp[1]:
        a+=3
    elif tmp[0] < tmp[1]:
        b+=3
    else:
        a+=1
        b+=1
print a, b

Submission status: Accepted

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

Submission status: Accepted

Solution code:

Taro = 0
Hanako = 0

n = int(input())

for i in range(n):
    T,H = map(str, 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())
p = q = 0
for i in range(N):
    a, b = input().split()
    if a < b:
        q += 3
    elif a > b:
        p += 3
    else:
        p += 1
        q += 1
print(p, q)

Submission status: Accepted

Solution code:
turn = int(input())

taro_score = 0
hanako_score = 0 

for i in range(turn):
    tcard,hcard = input().split()
    tcard = str(tcard)
    hcard = str(hcard)
    taro_card = [0]*len(tcard)
    hanako_card = [0]*len(hcard)
    
    
    for j in range(len(tcard)):
        taro_card[j] = ord(tcard[j])
    
    
    for k in range(len(hcard)):
        hanako_card[k] = ord(hcard[k])
        
    if len(tcard) == len(hcard):
    
        for l in range(len(tcard)):
            if taro_card[l] > hanako_card[l]:
                taro_score += 3
                break
            
            elif taro_card[l] < hanako_card[l]:
                hanako_score += 3
                break   
            
            else:
                if l == len(tcard)-1:
                    taro_score += 1
                    hanako_score += 1
                else:
                    continue
    
    elif len(tcard) < len(hcard):
        
        for a in range(len(tcard)):
            if taro_card[a] > hanako_card[a]:
                taro_score += 3
                break
            
            elif taro_card[a] < hanako_card[a]:
                hanako_score += 3
                break
                
            else:
                if a == len(tcard)-1:
                    #taro_score += 3
                    hanako_score += 3
                    
                else:
                    continue
                    
    else:
            
        for b in range(len(hcard)):
            if taro_card[b] > hanako_card[b]:
                taro_score += 3
                break

            elif taro_card[b] < hanako_card[b]:
                hanako_score += 3
                break

            else:
                if b == len(hcard)-1:
                    #hanako_score += 3
                    taro_score += 3

                else:
                    continue
                              
print("%d %d"%(taro_score,hanako_score))

Submission status: Accepted

Solution code:
n = int(input())
T_point = 0
H_point = 0
for loop in range(n):
    T,H=map(str,input().split())
    if T > H:T_point += 3
    elif T == H:
        T_point += 1
        H_point += 1
    else:H_point += 3
print(T_point,H_point)

Submission status: Accepted

Solution code:
from sys import stdin

score = [
    0, # Taro
    0  # Hanako
]

n = int(stdin.readline().rstrip())
for i in range(n):
    card_pair = stdin.readline().rstrip().split()
    if card_pair[0] > card_pair[1]:
        score[0] += 3
    elif card_pair[0] < card_pair[1]:
        score[1] += 3
    else:
        score[0] += 1
        score[1] += 1

print(*score)

Submission status: Accepted

Solution code:
N = int(input())
taro_cnt, hana_cnt = 0, 0
for _i in range(N):
    taro, hana = map(str, input().split())
    if taro > hana:
        taro_cnt += 3
    elif taro == hana:
        taro_cnt += 1
        hana_cnt += 1
    else:
        hana_cnt += 3
print(f'{taro_cnt} {hana_cnt}')

Submission status: Accepted

Solution code:
n = int(input())

taro = 0
hanako = 0
for _ in range(n):
	line = input().rstrip().split()

	if line[0] > line[1]: taro += 3
	elif line[0] < line[1]: hanako += 3
	else:
		taro += 1
		hanako += 1
print(taro, hanako)

Submission status: Accepted

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

num = int(input())

a=0
b=0

for _ in range(num):
    input2 = input().split()
    if input2[0]>input2[1]:
       a=a+3 
    elif input2[0]<input2[1]:
        b=b+3
    else:
        a=a+1
        b=b+1
print(a,b)

Submission status: Accepted

Solution code:
n = int(input())
t = 0
h = 0
for _ in range(n):
    a_lst = input().rstrip().split(" ")
    #print(a_lst)
    b_lst = sorted(a_lst)
    #print(b_lst)
    if a_lst[0] == a_lst[1]:
        t += 1
        h += 1
    elif a_lst == b_lst:
        h += 3
    else:
        t += 3
print(t, h)

Submission status: Accepted

Solution code:

s=[0,0]
for i in range(int(input())):
	r=input().split()
	if r[0]<r[1]:
		s[1]+=3
	elif r[1]<r[0]:
		s[0]+=3
	else:
		s[0]+=1
		s[1]+=1
print(str(s[0])+' '+str(s[1]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p_t = 0
p_h = 0

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

print (str(p_t) + " " + str(p_h))

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:
num = int(input())
taro, hanako = 0 ,0
for i in range(num):
    lst = list(map(str, input().split()))
    while 1:
        if lst[0] == lst[1]:
            taro = taro + 1
            hanako = hanako + 1
            break
        else:
            length = min(len(lst[0]),len(lst[1]))
            for j in range(length):
                first = ord(lst[0][j:j+1])
                second = ord(lst[1][j:j+1])
                if first > second:
                    taro = taro + 3
                    break
                elif first < second:
                    hanako = hanako + 3
                    break
                elif j == length - 1:
                    if len(lst[0]) > len(lst[1]):
                        taro = taro + 3
                    elif len(lst[0]) < len(lst[1]):
                        hanako = hanako + 3
                    break
            break
print(str(taro) + " " + str(hanako))

Submission status: Accepted

Solution code:
taro = hanako = 0
for i in range(int(input())):
    lst = list(map(str, input().split()))
    while 1:
        if lst[0] == lst[1]:
            taro = taro + 1
            hanako = hanako + 1
            break
        else:
            length = min(len(lst[0]),len(lst[1]))
            for j in range(length):
                first = ord(lst[0][j:j+1])
                second = ord(lst[1][j:j+1])
                if first > second:
                    taro = taro + 3
                    break
                elif first < second:
                    hanako = hanako + 3
                    break
                elif j == length - 1:
                    if len(lst[0]) > len(lst[1]):
                        taro = taro + 3
                    elif len(lst[0]) < len(lst[1]):
                        hanako = hanako + 3
                    break
            break
print(str(taro) + " " + str(hanako))

Submission status: Accepted

Solution code:
#coding: UTF-8

n = int(input())
point_t = 0
point_h = 0

for i in range(n):
    cards = list(map(str, input().split()))
    taro = cards[0]
    hanako = cards[1]
    if taro < hanako:
        point_h += 3
    elif taro > hanako:
        point_t += 3
    else:
        point_t += 1
        point_h += 1

print(point_t, point_h)

Submission status: Accepted

Solution code:
num = int(input())

t=0
h=0

for i in range(num):
	Ta,Ha = input().split(" ")
	if Ta > Ha:
		t += 3
	elif  Ta < Ha:
		h += 3
	else:
		t += 1
		h += 1
print(t,h)

Submission status: Accepted

Solution code:
n = int(input())
tp = 0
hp = 0
for i in range(n):
    tarou, hanako = map(str,input().split())
    if(tarou > hanako):
        tp += 3
    elif(tarou < hanako):
        hp += 3
    else:
        tp += 1
        hp += 1
print("%d %d" %(tp,hp))

Submission status: Accepted

Solution code:
n=int(input())
tarou=0
hanako=0
for i in range(n):
  #print(tarou,hanako)
  t,h=map(str,input().split())
  if t==h:
    tarou+=1
    hanako+=1
  elif (t>h)==True:
    tarou+=3
  else:
    hanako+=3

print(tarou,hanako)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
p = [0] * 2
for i in range(n):
    t, h = raw_input().split()
    if(t > h):
        p[0] += 3
    elif(t < h):
        p[1] += 3
    else:
        p[0] += 1
        p[1] += 1
print("%d %d" %(p[0], p[1]))

Submission status: Accepted

Solution code:
t, h = 0, 0

for i in range(int(input())):
    tc, hc= input().split()
    if tc > hc:
        t += 3
    elif tc < hc:
        h += 3
    else:
        t += 1
        h += 1

print('%d %d' % (t, h))

Submission status: Accepted

Solution code:
battle_number = int(raw_input())
Taro_score = 0
Hanako_score = 0

for x in xrange(battle_number):
	tcard, hcard = raw_input().split()

	if tcard > hcard:
		Taro_score += 3
	elif hcard > tcard:
		Hanako_score += 3
	elif tcard == hcard:
		Taro_score += 1
		Hanako_score += 1

print "%d %d" %(Taro_score, Hanako_score)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(raw_input())
tp,hp = 0,0
for i in range(n):
	T,H = raw_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(raw_input())

tarou=0
hanako=0
for i in range(n):
    words=raw_input().split(" ")
    tarou_sum = 0
    hanako_sum = 0
    for idx, c in enumerate(words[0]):
        
        if len(words[1]) -1 < idx:
            tarou += 3
            break
        
        if ord(words[1][idx]) < ord(c):
            tarou += 3
            break
        elif ord(words[1][idx]) > ord(c):
            hanako += 3
            break
        else:
            continue
    else:
        if len(words[0]) < len(words[1]):
            hanako += 3
        else:
            tarou += 1
            hanako += 1

print "%d %d" % (tarou, hanako)

Submission status: Accepted

Solution code:
t_point, h_point = 0, 0

n = int(input())
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(t_point, h_point)

Submission status: Accepted

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

for nc in range(n):
    (tc, hc) = input().split()
    if tc == hc:
        tp += 1
        hp += 1
    elif tc > hc:
        tp += 3
    elif tc < hc:
        hp += 3

print(tp, hp)