Problem:


Card Game

  Taro and Hanako are playing card games. They have n cards each, and they compete n turns. At each turn Taro and Hanako respectively puts out a card.
  The name of the animal consisting of alphabetical letters is written on each card, and the bigger one in lexicographical order becomes the winner of that turn. The winner obtains 3 points. In the case of a draw, they obtain 1 point each.

  Write a program which reads a sequence of cards Taro and Hanako have and reports the final scores of the game.

Input

  In the first line, the number of cards n is given. In the following n lines, the cards for n turns are given respectively. For each line, the first string represents the Taro's card and the second one represents Hanako's card.

Constraints

n ≤ 1000

The length of the string ≤ 100

Output

  Print the final scores of Taro and Hanako respectively. Put a single space character between them.

Sample Input

3
cat dog
fish fish
lion tiger

Sample Output

1 7



Sample input:
3
cat dog
fish fish
lion tiger


Sample output:
1 7

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

for i in range(N):
    words = input().lower().split()
    if words[0] > words[1]:
        taro += 3
    elif words[0] < words[1]:
        hanako += 3
    else:
        taro += 1
        hanako += 1

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

Submission status: Accepted

Solution code:
n = int(input())
taro = 0
hana = 0
for i in range(n):
    list1 = list(map(str, input().split()))
    if list1[0] == list1[1]:
        taro += 1
        hana += 1
    elif list1 == sorted(list1):
        hana += 3
    else:
        taro += 3
print(str(taro) + " " + str (hana))

Submission status: Accepted

Solution code:
num_t = int(input())
T_point = 0
H_point = 0
for i in range(num_t):
    TH = input()
    TH_list = TH.split(" ")
    if TH_list[0] > TH_list[1]:
        T_point += 3
    elif TH_list[0] < TH_list[1]:
        H_point += 3
    else:
        T_point += 1
        H_point += 1
print(str(T_point) + " " + str(H_point))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
t = 'taro'
h = 'hanako'
score = { t: 0, h: 0}

n = int(input())

for _ in range(n):
    ls = input().split()
    
    t_card = ls[0]
    h_card = ls[1]
    
    new_ls = sorted(ls)
    if t_card == h_card:
        score[t] += 1
        score[h] += 1
    elif t_card == new_ls[0]:
        score[h] += 3
        
    elif h_card == new_ls[0]:
        score[t] += 3
    
print(score[t], score[h])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p1 = 0
p2 = 0
for i in range(n):
    k , p = input().split()
    z = 0
    if k == p:
        p1,p2 = p1+1,p2+1
        continue
    elif len(k) <len(p):
        z = len(k)
    else:
        z = len(p)
    for i in range(z):
        if ord(k[i])<ord(p[i]):
           p2 += 3
           break
        elif ord(k[i])>ord(p[i]):
           p1 += 3
           break
    else:
        if len(k) < len(p):
            p2 +=3
        else:
            p1 +=3

print("%d %d" %(p1,p2))

Submission status: Accepted

Solution code:
h = 0
t = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
Taro = 0
Hanako = 0

n = int(input())
for i in range(n):
  T_card, H_card = input().split()
  if T_card > H_card:
    Taro += 3
  elif T_card < H_card:
    Hanako += 3
  else:
    Taro += 1
    Hanako += 1

print(Taro,Hanako)

Submission status: Accepted

Solution code:
N = int(input())

taro =[]
hanako=[]
for i in range(N):
    columns = list(input().split())
    taro.append(columns[0])
    hanako.append(columns[1])

taroScore = 0
hanakoScore = 0

for t, h in zip(taro, hanako):
    if t > h:
        taroScore += 3
    elif t == h:
        taroScore +=1
        hanakoScore +=1
    else:
        hanakoScore +=3
print(taroScore, hanakoScore, sep=" ")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input().rstrip())
taro = 0
hanako = 0
for i in range(n):
    t, h = input().rstrip().split()
    if t > h:
        taro += 3
    elif t < h:
        hanako +=3
    else:
        taro += 1
        hanako += 1

print(str(taro) + " " + str(hanako))

Submission status: Accepted

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

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

print(taro, hanako)

Submission status: Accepted

Solution code:
cardNumber = int(input())
Taro = 0
Hanako = 1
TaroScore = 0
HanakoScore = 0
winIndex = 0

for drawNumber in range(cardNumber):
    card = input().split(" ")
    sortedCard = sorted(card, reverse=True)
    winCard = card[card.index(sortedCard[winIndex])]
    if card[Taro] == winCard and card[Hanako] == winCard:
        TaroScore += 1
        HanakoScore += 1
    elif card[Taro] == winCard and card[Hanako] != winCard:
        TaroScore += 3
    elif card[Taro] != winCard and card[Hanako] == winCard:
        HanakoScore += 3
print("%d %d" %(TaroScore,HanakoScore))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
Tpoint = 0
Hpoint = 0
for i in range(n):
    Taro ,Hanako = map(str,input().split())

    if Taro<Hanako:
        Tpoint+=0
        Hpoint+=3
    elif Taro==Hanako:
        Tpoint+=1
        Hpoint+=1
    else:
        Tpoint+=3
        Hpoint+=0
print(Tpoint,Hpoint)

Submission status: Accepted

Solution code:
Tpoint,Hpoint = 0,0
for i in range(int(input())):
    T,H = map(str,input().split())
    if T==H:
        Tpoint+=1
        Hpoint+=1
    elif T>H:Tpoint+=3
    else:Hpoint+=3
print(Tpoint,Hpoint)

Submission status: Accepted

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

for i in range(n):
    a = input().split()
    if a[0] > a[1] :
        result[0] += 3
    if a[0] < a[1] :
        result[1] += 3
    if a[0] == a[1] :
        result[0] += 1
        result[1] += 1

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

Submission status: Accepted

Solution code:
def check(left, right):
    if left == "" and right == "":
        return 1, 1
    elif left == "":
        return 0, 3
    elif right == "":
        return 3, 0

    l_c = ord(left[0])
    r_c = ord(right[0])
    if l_c < r_c:
        return 0, 3
    elif l_c > r_c:
        return 3, 0
    else:
        return check(left[1:], right[1:])


n = int(input())
l_p = 0
r_p = 0
for x in range(n):
    left, right = input().split()
    tmp = check(left, right)
    l_p += tmp[0]
    r_p += tmp[1]
print(l_p, r_p)

Submission status: Accepted

Solution code:
n = int(input())
taro = 0
hanako = 0
for i in range(n):
    vs = list(input().split())
    if vs[0] == vs[1]:
        taro+=1
        hanako+=1
        continue
    short = min(len(vs[0]), len(vs[1]))
    if vs[0][:short] == vs[1][:short]:
        if len(vs[0]) == short:
            hanako += 3
        else:
            taro += 3
        continue
    for j in range(short):
        if ord(vs[0][j]) < ord(vs[1][j]):
            hanako += 3
            break
        elif ord(vs[0][j]) > ord(vs[1][j]):
            taro += 3
            break
print(str(taro) + " " + str(hanako))

Submission status: Accepted

Solution code:
taroScore = 0
hanakoScore = 0
num = int(input())
for i in range(num):
        list = input().split()
        taroStr = list[0]
        hanakoStr = list[1]
        if taroStr > hanakoStr:
                taroScore += 3
        elif taroStr < hanakoStr:
                hanakoScore += 3
        else:
                taroScore += 1
                hanakoScore += 1

print(taroScore, hanakoScore)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

A = 0
B = 0

for i in range(n):
    a, b = input().split()

    if a > b:
        A += 3
    elif b > a:
        B += 3
    else:
        A += 1
        B += 1

print(A, B)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
x,y=0,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:
import sys

points = [0, 0]

turns = int(sys.stdin.readline())
for _ in range(turns):
    w1, w2 = sys.stdin.readline().strip().split()
    if w1 > w2:
        points[0] += 3
    elif w2 > w1:
        points[1] += 3
    else:
        points[0] += 1
        points[1] += 1

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

Submission status: Accepted

Solution code:
cnt=int(input())
taro,hanako=0,0

for i in range(cnt):
    A,B=input().split()
    if A>B:
        taro+=3
    elif B>A:
        hanako+=3
    else:
        hanako+=1;taro+=1
print(taro,hanako)

Submission status: Accepted

Solution code:
n = int(input())
taro_p, hanako_p = 0, 0
for i in range(n):
    taro, hanako = input().split()
    x, y = [(3,0), (1,1), (0,3)][(taro < hanako) + (taro <= hanako)]
    taro_p += x
    hanako_p += y
print(taro_p, hanako_p)

Submission status: Accepted

Solution code:
def main():
	n = int(input())
	pointTaro = 0
	pointHanako = 0
	for i in range(n):
		l = input().split()
		if l[0] > l[1]:
			pointTaro += 3
		elif l[0] == l[1]:
			pointTaro += 1
			pointHanako += 1
		else:
			pointHanako += 3
	print(pointTaro, pointHanako)

main()

Submission status: Accepted

Solution code:
maisu=int(input())
taro_tokuten=0
hanako_tokuten=0

for i in range(maisu):
    huda=list(map(str,input().split()))
    taro=huda[0]
    hanako=huda[1]
    if taro>hanako:
        taro_tokuten+=3
    elif taro<hanako:
        hanako_tokuten+=3
    else:
        taro_tokuten+=1
        hanako_tokuten+=1

print(str(taro_tokuten)+" "+str(hanako_tokuten))

Submission status: Accepted

Solution code:
s1=s2=0
n = int(input())
while ( n > 0 ):
    n = n -1
    (a,b)  =  map(str,input().split())

    if (a > b):
        s1 += 3
    elif (b > a):
        s2 += 3
    else:
        s1 += 1
        s2 += 1
print (s1,s2)

Submission status: Accepted

Solution code:
def cardFight(taro, hanako):
    if taro < hanako:
        return 0, 3
    elif taro == hanako:
        return 1, 1
    else:
        return 3, 0

if __name__ == '__main__':
    taroP, hanakoP = 0, 0
    m = int(input())
    for i in range(m):
        t, h = input().split()
        tP, hP = cardFight(t, h)
        taroP += tP
        hanakoP += hP
    print(taroP, hanakoP)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

tlist = []
hlist = []

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

tscore = 0
hscore = 0

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

print(tscore, hscore)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
t_p=0
h_p=0
for i in range(0,n):
    Taro,Hana = input().split()
    if(Taro==Hana):
        t_p+=1
        h_p+=1
    elif(Taro > Hana):
        t_p+=3
    else:
        h_p+=3
print(f"{t_p} {h_p}")

Submission status: Accepted

Solution code:
print(*[sum(x)for x in zip(*[[3,0]if a>b else[0,3]if a<b else[1,1]for a,b in[input().split()for i in[0]*int(input())]])])

Submission status: Accepted

Solution code:
card_n = int(input())
A = 0
B = 0
for i in range(card_n):
    Acard, Bcard = input().split()
    if Acard == Bcard:
        A += 1
        B += 1
    else:
        for a, b in zip(Acard, Bcard):
            if ord(a) > ord(b):
                A += 3
                break
            elif ord(a) < ord(b):
                B += 3
                break
            elif a == Acard[-1] or b == Bcard[-1]:
                if len(Acard) > len(Bcard):
                    A += 3
                else:
                    B += 3
print(A, B)

Submission status: Accepted

Solution code:
num=int(input())
H=0
T=0
for i in range(num):
	a=input().split()
	if a[0]<a[1]:
		T+=3
	elif a[1]<a[0]:
		H+=3
	else:
		T+=1
		H+=1
print(str(H)+' '+str(T))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
taro = 0
hana = 0
s=[]
ss=[]

for i in range(n):
    s = list(map(str, input().split()))
    # print(s)
    ss = sorted(s)
    # print(ss)

    if s[0] == s[1]:
        taro += 1
        hana += 1
    elif s == ss:
        hana += 3
    else:
        taro += 3
    

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

Submission status: Accepted

Solution code:
round_n = int(input())

Taro = 0
Hanako = 0

for n in range(0, round_n):
    _in = input().split()
    if (_in[0] > _in[1]):
        Taro += 3
    elif (_in[0] < _in[1]):
        Hanako += 3
    else :
        Taro += 1
        Hanako += 1

print(str(Taro) + ' ' + str(Hanako))

Submission status: Accepted

Solution code:
n = int(input())
listA = []
listB = []
pntA = pntB = 0 

for i in range(n):
    A, B = map(str, input().split())
    listA.append(A)
    listB.append(B)

    if listA[i] > listB[i]:
        pntA += 3
    elif listA[i] == listB[i]:
        pntA += 1
        pntB += 1
    else:
        pntB += 3

print(str(pntA) + ' ' + str(pntB))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(taro, hanako)

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

Submission status: Accepted

Solution code:
T=0
H=0
n=int(input())
for i in range(n):
    s=input()
    s=s.rstrip().split()
    if s[0]==s[1]:
        T+=1
        H+=1
    else:
        t=[s[0],"t"]
        h=[s[1],"h"]
        S=[t,h]
        S.sort()
        if S[1][1]=="t":
            T+=3
        elif S[1][1]=="h":
            H+=3
print(T,H)

Submission status: Accepted

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

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

loops = int(input())

for _ in range(loops):
    c_taro, c_hanako = map(str, input().split())
    if c_taro < c_hanako:
        points['hanako'] += 3
    elif c_taro > c_hanako:
        points['taro'] += 3
    else:
        points['hanako'] += 1
        points['taro'] += 1

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

Submission status: Accepted

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

if __name__ == '__main__':
    point = [0]*2
    n = int(raw_input())

    for _ in range(n):
        t, h = raw_input().split()
        if t == h:
            point = map(lambda x: x+1, point)
        else:
            point[t<h] += 3

    print '%d %d' % tuple(point)

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

Submission status: Accepted

Solution code:
n = int(input())
pt = 0
ph = 0
for _ in range(n):
	t,h = map(str, tuple(input().split(' ')))
	if t > h: pt += 3
	elif h > t: ph += 3
	elif t == h:
		pt += 1
		ph += 1
print(pt,ph)

Submission status: Runtime Error

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)

        if Taro == Hana:
            TaroScore += 1
            HanaScore += 1
        
        else:
            for _ in range(min(lenT, lenH)+1):
                if Taro == '' or ord(Taro[0]) < ord(Hana[0]):
                    HanaScore += 3
                    break
                elif Hana == '' or ord(Taro[0]) > ord(Hana[0]):
                    TaroScore += 3
                    break
                else:
                    Taro = Taro[1:]
                    Hana = Hana[1:]

    print(TaroScore, HanaScore)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:

Taro = 0
Hanako = 0

n = int(input())

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

print(Taro, Hanako)

Submission status: Runtime Error

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: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input() #カードの枚数
taro = 0
hanako = 0
for i in range(n):
    x = map(str, raw_input().split())  #x[0]:太郎，x[1]:花子
    #print x[0]
    #print x[1]
    if(x[0] > x[1]):
        taro += 3
    elif(x[0] == x[1]):
        taro += 1
        hanako += 1
    else:
        hanako += 3
print '%d %d' %(taro, hanako)

Submission status: Runtime Error

Solution code:
n = input() #カードの枚数
taro = 0
hanako = 0
for i in range(n):
    x = map(str, raw_input().split())  #x[0]:太郎，x[1]:花子
    #print x[0]
    #print x[1]
    if(x[0] > x[1]):
        taro += 3
    elif(x[0] == x[1]):
        taro += 1
        hanako += 1
    else:
        hanako += 3
print '%d %d' %(taro, hanako)
exit(0)

Submission status: Runtime Error

Solution code:
dic = {'dog':5,'fish':4,'tiger':3,'cat':2,'lion':1}
taro_p = 0
hana_p = 0
for i in range(input()):
    taro,hana = raw_input().split(' ')
    if dic[taro] > dic[hana]:
        taro_p = taro_p + 3
        hana_p = hana_p + 0
    elif dic[taro] < dic[hana]:
        taro_p = taro_p + 0
        hana_p = hana_p + 3
    else:
        taro_p = taro_p + 1
        hana_p = hana_p + 1

print taro_p,hana_p

Submission status: Runtime Error

Solution code:
import sys
 
def shuffle( cards ):
    h = int( sys.stdin.readline() )
    cards = cards[ h : ] + cards[ 0 : h ]
    return cards
 
while True:
    cards = sys.stdin.readline().rstrip()
    if '-' == cards:
        break
    m = int( sys.stdin.readline() )
    for i in range( m ):
        cards = shuffle( cards )
    print( cards )

Submission status: Runtime Error

Solution code:
n = int(input())

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

Submission status: Runtime Error

Solution code:
n = int(input())

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

print(taro.hanako)

Submission status: Runtime Error

Solution code:
n = int(input())

t_score = 0
h_score = 0


for i in range(n):
 t, h = input().split()
 if ord(t[0]) > ord(h[0]):
  t_score += 3
 elif ord(t[0]) < ord(h[0]):
  h_score += 3
 elif ord(t[0]) == ord(h[0])
  t_score += 1
  h_score += 1

print("{0} {1}".format(t_score, h_score))

Submission status: Runtime Error

Solution code:
n = int(input())

t_score = 0
h_score = 0


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

Submission status: Runtime Error

Solution code:
round = int(raw_input())
score = {"taro":0, "hanako":0}
counter = 0
while counter < round:
    [taro,hanako] = raw_input.split()
    if taro < hanako:
        score["hanako"] += 3
    elif taro > hanako:
        score["taro"] += 3
    else:
        score["taro"] += 1
        score["hanako"] += 1
    counter += 1

print score["taro"], score["hanako"]

Submission status: Runtime Error

Solution code:
n = int(input())
st, sh = 0, 0
for i in range(n):
    t, h = map(str, input().split())
    if ord(t[0]) > ord(h[0]):
        st += 3
    elif ord(t[0]) < ord(h[1]):
        sh += 3
    else:
        m = h if len(t) > len(h) else t
        l = 1
        for j in range(m):
            if ord(t[j]) > ord(h[j]):
                st += 3
                j = m
                l = 0
            else:
                sh += 3
                j = m
                l = 0
        if l:
            st += 1
            sh += 1
print(st, sh)

Submission status: Runtime Error

Solution code:
n = int(input())
st, sh = 0, 0
for i in range(n):
    t, h = map(str, input().split())
    if ord(t[0]) > ord(h[0]):
        st += 3
    elif ord(t[0]) < ord(h[0]):
        sh += 3
    else:
        m = h if len(t) > len(h) else t
        l = 1
        for j in range(m):
            if ord(t[j]) > ord(h[j]):
                st += 3
                j = m
                l = 0
            else:
                sh += 3
                j = m
                l = 0
        if l:
            st += 1
            sh += 1
print(st, sh)

Submission status: Runtime Error

Solution code:
s=list(input())
n=int(input())
for i in range(n):
	l=input().split()
	if l[0]=="replace":
		a=int(l[1])
		b=int(l[2])
		s[a:b+1]=list(l[3])
	elif l[0]=="reverse":
		a=int(l[1])
		b=int(l[2])
		c=s[a:b+1][::-1]
		s[a:b+1]=c
	else:
		a=int(l[1])
		b=int(l[2])
		print("".join(s[a:b+1]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

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

    if card_taro == card_hanako:            # DRAW
        score_taro += 1
        score_hanako += 1
        #print("draw")#
        continue
    for i in range(n):
        if ord(card_taro[i:i+1]) > ord(card_hanako[i:i+1]):         # TARO WIN
            score_taro += 3
            #print("taro win")#
            break
        if ord(card_taro[i:i+1]) < ord(card_hanako[i:i+1]):         # HANAKO WIN
            score_hanako += 3
            #print("hanako win")#
            break
        if ord(card_taro[i:i+1]) == ord(card_hanako[i:i+1]):        # NEXT CHAR
            continue

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

Submission status: Runtime Error

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[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: Runtime Error

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:
                    tScores +=3
            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: Runtime Error

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:
                    tScores +=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: Runtime Error

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:
                    tScores +=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: Runtime Error

Solution code:
#coding:utf-8

n = int(input().rstrip())
toku =[0,0]
narabe = []

for i in range(n):
    taro, hana = input().rstrip().split()
    if taro == hana:
        toku[0] +=1
        toku[1] +=1

    else:
        narabe = [taro, hana]
        narabe.sort()
        toku[0] += narabe.index(taro)*3
        toku[1] += narabe.index(hana)*3
    
print(" ".join(toku))