Problem:


Score : 100 points

Problem Statement

You will be given a string S of length 3 representing the weather forecast for three days in the past.

The i-th character (1 \leq i \leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.

You will also be given a string T of length 3 representing the actual weather on those three days.

The i-th character (1 \leq i \leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.

Print the number of days for which the forecast was correct.

Constraints

S and T are strings of length 3 each.

S and T consist of S, C, and R.

Input

Input is given from Standard Input in the following format:

S
T

Output

Print the number of days for which the forecast was correct.

Sample Input 1

CSS
CSR

Sample Output 1

2

For the first day, it was forecast to be cloudy, and it was indeed cloudy.

For the second day, it was forecast to be sunny, and it was indeed sunny.

For the third day, it was forecast to be sunny, but it was rainy.

Thus, the forecast was correct for two days in this case.

Sample Input 2

SSR
SSR

Sample Output 2

3

Sample Input 3

RRR
SSS

Sample Output 3

0



Sample input:
CSS
CSR


Sample output:
2

Submission status: Runtime Error

Solution code:
n,m = input().split()
n = int(n)
m = int(m)

i = m - n

if i <= 0:
        print(0)
else:
        count = 1
        while i > 0:
                i -= n-1
                count += 1
        print(count)

Submission status: Runtime Error

Solution code:
s = input() 
t = input()

ans = 0

for i in range(3):
	if s[i]=t[i]:
		ans += ans

print(ans)

Submission status: Runtime Error

Solution code:
s = input() 
t = input()

ans = 0

for i in range(3){
	if s[i]=t[i]
		ans += ans

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
H = list(map(int, input().split()))
ans = 0
start = 0

while ( start < N ):
    tmp_ans = 0
    for j in range(start, N-1):
        if (H[j] >= H[j+1]):
            tmp_ans += 1
        else:
            start += tmp_ans
            break
            
    ans = max(ans, tmp_ans)
    start += 1
    
print(ans)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
count = 0
if b==1:
  print(0)
else :
  while(b>=0):
    b-=a
    a-=1
    count+=1
  print(count)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
count = 0
for i in renge(3):
	if a[i] == b[i]:
    	count += 1
print(count)

Submission status: Runtime Error

Solution code:
a = str(input())
b = str(input())
count = 0
for i in renge(3):
	if a[i] == b[i]:
    	count += 1
print(count)

Submission status: Runtime Error

Solution code:
a = str(input())
b = str(input())
count = 0
for i in renge(3)
	if a[i] == b[i]:
    	count += 1
print(count)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
count = 0
for i in renge(3)
	if a[i] == b[i]:
    	count += 1
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())

allList = []
days = 0

while len(allList) < N:
    allList.append(list(map(int, input().split())))

sum = 100

while sum > 0:
    toBePopped = []
    for i in range(N):
        if allList[i] and i+1 == allList[allList[i][0]-1][0]:
            toBePopped.append(i)
            toBePopped.append(allList[i][0]-1)
    if len(toBePopped) == 0:
        days = -1
        break
    days += 1
    for i in set(toBePopped):
        allList[i].pop(0)

    sum = 0
    for i in range(N):
        sum += len(allList[i])

print(days)

Submission status: Runtime Error

Solution code:
print(sum(c is d for c, d in input(), input()))

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())
print(sum[s[i] == t[i] for i in range(3)])

Submission status: Runtime Error

Solution code:
s = input().split()
t = input().split()
print(sum[s[i] == t[i] for i in range(3)])

Submission status: Runtime Error

Solution code:
s = input()
t = input()
print(sum[s[i] == t[i] for i in range(3)])

Submission status: Runtime Error

Solution code:
    forecasts = list(input())
    actuals = list(input())
    ex_count = 0
    for x in range(3):
        if forecasts[x] == actuals[x]:
            ex_count = ex_count + 1
    print("{}".format(ex_count))

Submission status: Runtime Error

Solution code:
N = int(intput())
print(N * (N-1) // 2)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

import math
import statistics
import numpy as np

n = int(input())
h = list(int(i) for i in input().split())

i = 0
ans = 0
cnt = 0
while i + 1 < n:
  if h[i] >= h[i + 1]:
    cnt += 1
  else:
    if ans < cnt:
      ans = cnt
    cnt = 0
  i += 1

if ans < cnt:
  ans = cnt
print(ans)

Submission status: Runtime Error

Solution code:
S = list(input())
T = list(input())
s = 0
for i in range(3):
  if S[i] = T[i]:
    s += 1
print(s)

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())
s = 0
for i in range(3):
  if s[i] = t[i]:
    s += 1
print(s)

Submission status: Runtime Error

Solution code:
s = list(input())
t = list(input())
s = 0
for i in range(3):
  s[i] = t[i]
  s += 1
print(s)

Submission status: Runtime Error

Solution code:
s,t=input(),input() print((s[0]==t[0])+(s[1]==t[1])+(s[2]==t[2]))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
xy = []
for i in range(N):
  x, y = map(int, input().split())
  xy += [(x, y, math.atan2(y,x))]
xy.sort(key=lambda val:val[2])
x_accum = [0]
y_accum = [0]
for i in range(N):
  x_accum += [x_accum[-1] + xy[i][0]]
  y_accum += [y_accum[-1] + xy[i][1]]
  
ans = 0
for i in range(N):
  for j in range(N):
    ans = max(ans,  math.hypot(x_accum[j]-x_accum[i] ,y_accum[j]-y_accum[i]))
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
h = list(map(int,input().split()))
ans = 0
ls = []
for i in range(n-1):
    if h[i] >= h[i+1]:
        ans += 1
    else:
        ls.append(ans)
        ans = 0
ls.append(ans)
print(max(ls))

Submission status: Runtime Error

Solution code:
a,b=map(int, input().split())
c = (b-1) / (a-1)

if( (b-1) % (a-1) > 0):
   c = c+1
print(c)

Submission status: Runtime Error

Solution code:
S = input()
T = input()

c = 0
for i range(3):
  if S[i] == T[i]:
    c += 1
  else:
    next
    
print(c)

Submission status: Runtime Error

Solution code:
A,B=map(int(input().split())
c=A
x=1
while c>B:
        c=c-1+A
        x+=1
print(x)

Submission status: Runtime Error

Solution code:
N = int(input())
L = [int(i) for i in input().split()]

counter = 0

max_n = 0

for i in range(1,N):
	if L[i] <= L[i-1]:
		counter += 1
	else:
		max_m = max(max_n,counter)
		ct = 0
			
print(max(max_n,counter))

Submission status: Runtime Error

Solution code:
N = int(input())
L = [int(i) for i in input().split()]

counter = 0

max_n = 0

for i in range(N-1):
	if L[i] <= L[i-1]:
		counter += 1
	else:
		max_m = max(max_n,counter)
		ct = 0
			
print(max(max_n,counter))

Submission status: Runtime Error

Solution code:
s = input()
t = input()

ans = 0
for i in range(3)
  
  a = s[i]
  b = t[i]
  
  if a == b:
    ans += 1
    
print(ans)

Submission status: Runtime Error

Solution code:
a,b = [int(i) for i in input().split()]

count=0
sum=1
while(sum<b):
    sum+=a-1
    count+=1
print(count)

Submission status: Runtime Error

Solution code:
a,b = [int(i) for i in input().split()]

for B in range(1,21):

    if B==1 and a>=2:
        lim=B*a
    elif B>1 and a>=2:
        lim=(B-1)*(a-1)+a

    if lim>=b:
        break
print(B)

Submission status: Runtime Error

Solution code:
s = [input() for i in range(3)]
print(s)

Submission status: Runtime Error

Solution code:
s=input()
t=input()

x=0
for i in renge(3):
  if s[i]==t[i]:
    x+=1
    
print(x)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
i=0
x=0
while i<=2:
  i+=1
  if s[i]==t[i]:
    x+=1
        
print(x)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
i=0
x=0
while i<=2:
  i+=1
  if S[i]==T[i]:
    x+=1
        
print(x)

Submission status: Runtime Error

Solution code:
s=input()
t=input()
i=0
x=0
while i<=2:
  i+=1
  if S[i]==T[i]:
    X+=1
        
print(x)

Submission status: Runtime Error

Solution code:
S=input()
T=input()
c=0
for i in range(3):
    if s[i]==t[i]:
        c+=1

print(c)

Submission status: Runtime Error

Solution code:
S=input()
T=input()
i=0
x=0
while i<=2:
  i+=1
  if S[i]==T[i]:
    X+=1
        
print(x)

Submission status: Runtime Error

Solution code:
S=input()
T=input()
num=range(1,4)
x=0
for i in num:
  if S[i]==T[i]:
    X+=1
print(x)

Submission status: Runtime Error

Solution code:
a, b, c = (i for i in input().split())

d, e, f = (i for i in input().split())

count = 0
if a==d:
    count+=1
elif d==e:
    count+=1
elif c==f:
    count+=1
print(str(count))

Submission status: Runtime Error

Solution code:
S=input()
T=input()
ans=0
for i in range(3):
	if S[i] == T[i]:
  	ans += 1
    print(ans)

Submission status: Runtime Error

Solution code:
S=input()
T=input()
ans=0
for i in range(3):
	if S[i] == T[i]:
  	ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
    S=input()
    T=input()
    a=0
    for i in range(3):
        if S[i]==T[i]:
            a+=1
    print(a)

Submission status: Runtime Error

Solution code:
S=input()
T=input()
ans=0
for i in range(3)
	if S[i] == T[i]
  	ans += 1
    print(ans)

Submission status: Runtime Error

Solution code:
S = input()
T = input()
cnt = 0

if S[0] === T[0]:
    cnt += 1

if S[1] === T[1]:
    cnt += 1

if S[2] === T[2]:
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
def main():
  n = int(input())
  print(n * (n-1) // 2)
 

main()

Submission status: Runtime Error

Solution code:
import sys
from collections import deque
input = sys.stdin.readline

n = int(input())
a = [deque([x for x in list(map(int, input().split()))]) for _ in range(n)]

f = True
day = 1
while(f):
  if day > 2500:
    print(-1)
    sys.exit()
  done = set()
  nokori_games = 0
  
  for m in range(n):
    la = len(a[m])
    nokori_games += la
    if m in done:
      pass
    elif la:
      teki = a[m][0]
      jibun = m + 1
      if a[teki - 1][0] == jibun and teki - 1 not in done:
        a[m].popleft()
        a[teki - 1].popleft()
        done.add(m)
        done.add(teki - 1)
        nokori_games -= 1
      elif not len(a[teki - 1]):
        print(-1)
        sys.exit()
  if nokori_games:
    if not len(done):
      print(-1)
      sys.exit()
  else:
    print(day)
    sys.exit()
  day += 1

Submission status: Runtime Error

Solution code:
s = raw_input()
t = raw_input()
ans = 0
for i in len(s):
  if s[i] == t[i]: ans += 1
print ans

Submission status: Runtime Error

Solution code:
list(S)
list(T)

a=0

if S[0] = T[0]:
  a = a + 1

if S[1] = T[1]:
  a = a + 1

if S[2] = T[2]:
  a = a +1

Submission status: Runtime Error

Solution code:
s = input()
t = input()

s = [_ for _ in s]
t = [_ for _ in t]

count = 0
for i in 3:
  if s[i] == t[i]:
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
s = int(input())
t = int(input())

s = [_ for _ in s]
t = [_ for _ in t]

count = 0
for i in 3:
  if s[i] == t[i]:
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
n = 45

x = [None] * N
y = [None] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())

ans = 0
for i in range(n):
    theta = (2 * math.pi / n) * i
    c = math.cos(theta)
    s = math.sin(theta)
    tmp_x = 0
    tmp_y = 0
    for j in range(N):
        if x[j] * c + y[j] * s > 0:
            tmp_x += x[j]
            tmp_y += y[j]
    if tmp_x**2 + tmp_y**2 > ans**2:
        ans = math.sqrt(tmp_x**2 + tmp_y**2)

print(ans)

Submission status: Runtime Error

Solution code:
S=input()
T=input()

output=0

for i in range(3):
    if int(S[0,i])==int(T[0,i]):
        output=output+1
    else :
        pass
    
print(output)

Submission status: Runtime Error

Solution code:
S=input()
T=input()

output=0

for i in range(3):
    if S[0,i]==T[0,i]:
        output=output+1
    else :
        pass
    
print(output)

Submission status: Runtime Error

Solution code:
s = input(); a = input(); c = 0
for i in range(4):
  if s[i] == a[i]: c += 1
print(c)

Submission status: Runtime Error

Solution code:
import sys
from collections import deque
input = sys.stdin.readline

n = int(input())
a = [deque([x for x in list(map(int, input().split()))]) for _ in range(n)]

f = True
day = 1
while(f):
  if day > 10000:
    print(-1)
    sys.exit()
  done = set()
  nokori_games = 0
  
  for m in range(n):
    la = len(a[m])
    nokori_games += la
    if m in done:
      pass
    elif la:
      teki = a[m][0]
      jibun = m + 1
      if a[teki - 1][0] == jibun and teki - 1 not in done:
        a[m].popleft()
        a[teki - 1].popleft()
        done.add(m)
        done.add(teki - 1)
        nokori_games -= 1
      elif not len(a[teki - 1]):
        print(-1)
        sys.exit()
  if nokori_games:
    if not len(done):
      print(-1)
      sys.exit()
  else:
    print(day)
    sys.exit()
  day += 1

Submission status: Runtime Error

Solution code:
l = input()
t = input().sprit()
c = 0
for i in range(0,3):
  if l[i] == t[i]:
    c = c+1
  else:
    continue

print(c)

Submission status: Runtime Error

Solution code:
l = list(input().sprit())
t = list(input().sprit())
c = 0
for i in range(0,2):
  if l[i] == t[i]:
    c = c+1
  else:
    continue

print(c)

Submission status: Runtime Error

Solution code:
### INPUT
N = int(input())
A = list(map(int,input().split()))
cont = 0
CN = [0]
b = N-1
### MAIN
for i in range(b):
    s = i
    while A[s]>=A[s+1] and s+1!=b:
        cont = cont + 1
        s = 1 + s
    if  (A[s]>=A[s+1]) and (s+1==b):
        cont =cont + 1
    if  cont != 0:
        CN.extend([cont])
        cont = 0
### MAX

print(max(CN))

Submission status: Runtime Error

Solution code:
s = input()
t = input()
cnt = 0
for i in range(3):
  if(s[i]==t[i]):
    cnt += 1
prirnt(cnt)

Submission status: Runtime Error

Solution code:
### INPUT
N = int(input())
A = list(map(int,input().split()))
A.extend([1000])
cont = 0
CN = [0]
b = N-1
### MAIN
for i in range(b):
    s = i
    while (A[s]>A[s+1]) and ((s+1)!=(b+1)):
        cont = cont + 1
        s = 1 + s
    if  cont != 0:
        CN.extend([cont])
        cont = 0
### MAX
print(max(CN))

Submission status: Runtime Error

Solution code:
predict, actual = input(),input()
a = 0
for i in range(3):
	if(predict[i] == actual[i]):
    	a = a + 1
print(a)

Submission status: Runtime Error

Solution code:
predict = input()
actual  = input()

a = 0
for i in range(3):
	if(predict[i] == actual[i]):
    	a = a + 1
print(a)

Submission status: Runtime Error

Solution code:
import sys

s = input()
t = input()

count =0
for i, c in enuemrate(s):
    if c == t[i]:
        count += 1
print count

Submission status: Runtime Error

Solution code:
n = int(input())
inp = list(map(int, input().split()))
length = len(inp)
ans = 0
curr_max = 0
for i in range(-1,-length,-1):
    if inp[i] <= inp[i-1]:
        ans += 1
        if ans > curr_max:
            curr_max = ans
    else:
        ans = 0
print(curr_max)

Submission status: Runtime Error

Solution code:
s = input("")                                                                                                           t = input("")                                                                                                           s_list = list(s)                                                                                                        t_list = list(t)                                                                                                        n = 0                                                                                                                                                                                                                                           for i in range(3):                                                                                                          if s_list[i] == t_list[i]:                                                                                                  n += 1                                                                                                                                                                                                                                  print(n)  s = input("")                                                                                                           t = input("")                                                                                                           s_list = list(s)                                                                                                        t_list = list(t)                                                                                                        n = 0                                                                                                                                                                                                                                           for i in range(3):                                                                                                          if s_list[i] == t_list[i]:                                                                                                  n += 1                                                                                                                                                                                                                                  print(n)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
s = input("")
t = input("")
s_list = list(s)
t_list = list(t)
n = 0

for i in range(3):
  if s_list.get(i) = t_list.get(i):
    n += 1
print(n)

Submission status: Runtime Error

Solution code:
n = int(input())
print(n * (n-1)//2)

Submission status: Runtime Error

Solution code:
S=input().split()
T=input().split()
c=0
for i in S
 if S[i]==T[i]:
   c+=1
print(c)

Submission status: Runtime Error

Solution code:
a = input()
first = True
A = ""
B = ""
for i in range(len(a)):
    if a[i] != " " and first:
        A = A + a[i]
    else:
        first = False
        B = B + a[i]
A = int(A)
B = int(B)
count = 0
if B > A:
    while B > 0:
        B = B - A
        count = count + 1
print(count)

Submission status: Runtime Error

Solution code:
    a = input()
    b = input()
    c = 0
    for i in range(3):
      if a[i] == b[i]:
        c += 1
    print(c)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
c = 0
for i in range(3):
  if a[a] == b[i]:
    c += 1
print(c)

Submission status: Runtime Error

Solution code:
S=input()
T=input()
c=0
for i in S
 if S[i]==T[i]:
   c+=1
print(c)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
A = int(a)
B = int(b)
count = 0
while B > 0:
    B = B - A
    count = count + 1
print(count)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
c = 1
for i in range(20):
    if b > c:
        c += a-1
    else:
        break
print(-(-(c-1) // a-1))

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

c = 1
for i in range(20):
    if b > c:
        c += a-1
    else:
        break
print(-(-c // a-1)-1)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

c = 1
for i in range(20):
    if b > c:
        c += a-1
    else:
        break
print(-(-c // a-1))

Submission status: Runtime Error

Solution code:
s = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
s = list(map(int, input().sprit()))
t = list(map(int, input().sprit()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
s = list(map(int, input().strip()))
t = list(map(int, input().strip()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
s = list(map(int, input().strip()))
t = list(map(int, input().strip()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 0
print(ans)

Submission status: Runtime Error

Solution code:
'''
CSS
CSR
'''
prin( sum([1 for x, y in zip(input(), input()) if x == y]

Submission status: Runtime Error

Solution code:
N = int(input())
ans = N * (N - 1) // 2
print(ans)

Submission status: Runtime Error

Solution code:
def power(X):
    A, B= map(int, input().split())
    socket = A
    numberOfStrips = 1
    while socket < B:
        socket = socket + A - 1
        numberOfStrips = numberOfStrips + 1

    return numberOfStrips


print(power())

Submission status: Runtime Error

Solution code:
S,T=input(),input()
print((S==T).sum())

Submission status: Runtime Error

Solution code:
import time
start = time.time()
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
s = [0 for i in range(n)] #それぞれ何試合目か
ans = 0
need = n*(n-1)//2
while need:
    c = [0 for i in range(n)] #今日試合をするかどうか
    ans += 1
    for first in range(n):
        if c[first] == 0 and s[first] < n-1:
            second = a[first][s[first]]-1 # firstが対戦したい相手
            second_num = s[second] # #secondの対戦番号
            if c[second] == 0 and a[second][second_num]-1 == first:
                c[first] = 1
                c[second] = 1
                s[first] += 1
                s[second] += 1
                need -= 1
    if sum(c) == 0:
        print(-1)
        exit()
    now = time.time()-start
    if now > 1.83:
        print(n*(n-1)//2)
        exit()
print(ans)

Submission status: Runtime Error

Solution code:
import time
start = time.time()
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
s = [0 for i in range(n)] #それぞれ何試合目か
ans = 0
need = n*(n-1)//2
while need:
    c = [0 for i in range(n)] #今日試合をするかどうか
    ans += 1
    for first in range(n):
        if c[first] == 0 and s[first] < n-1:
            second = a[first][s[first]]-1 # firstが対戦したい相手
            second_num = s[second] # #secondの対戦番号
            if c[second] == 0 and a[second][second_num]-1 == first:
                c[first] = 1
                c[second] = 1
                s[first] += 1
                s[second] += 1
                need -= 1
    if sum(c) == 0:
        print(-1)
        exit()
    now = time.time()-start
    if now > 1.81:
        print(n*(n-1)//2)
        exit()
print(ans)

Submission status: Runtime Error

Solution code:
limit=int(input())
sum=((limit-1)*limit//2)
print(sum)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]

for i in range(N):
  leng = ((A[i][0]) ** 2 + (A[i][1]) ** 2) ** (1/2)
  if (A[i][0] == 0) and (A[i][1] == 0):
    angle = 0
  elif A[i][0] == 0:
    if A[i][1] > 0:
      angle = 90
    else:
      angle = 270
  elif A[i][1] == 0:
    if A[i][0] > 0:
      angle = 0
    else:
      angle = 180
  else:  
    radian = math.atan2(A[i][1], A[i][0])
    angle = math.degrees(radian)
  A[i].append(leng)
  A[i].append(angle)
  
#エンジンは100しかないからN**2でも間に合うはず

ans = 0
for i in range(N):
  x, y = A[i][0], A[i][1]
  for j in range(N):
    angle =A[i][3] 
    if i != j:
      if -90 < angle < 90 :
        if angle - 90 < A[j][3] < angle + 90:
          x += A[j][0]
          y += A[j][1]
      elif -180 < angle < -90:
        if (A[j][3] < angle + 90) or (angle + 270 < A[j][3]):
          x += A[j][0]
          y += A[j][1]
      else: 
        if (angle - 90 < A[j][3]) or (A[j][3] < angle - 270):
          x += A[j][0]
          y += A[j][1]
  ans1 = (x ** 2 + y ** 2 ) ** (1/2)
  ans = max(ans, ans1)
  
print(ans)
#print(A)

Submission status: Runtime Error

Solution code:
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]

total = [0]*n

i = 0
count = 0
day = 0
while count < (n*(n-1))//2:
    while total[i] < n-1:
        game = [0] * n
        flag = False
        for j in range(i,n):
            if total[j] == n-1 or game[j] == 0:
                continue
            tmp = a[j][total[j]]
            if game[tmp-1] == 0 and a[tmp-1][total[tmp-1]] == j+1:
                total[j] += 1
                total[tmp-1] += 1
                game[j] += 1
                game[tmp-1] += 1
                count += 1
                flag = True
        if flag == False:
            break
        day += 1
    if flag == False:
        break
    i += 1

if flag == False:
    print(-1)
else:
    print(day)

Submission status: Runtime Error

Solution code:
 S = input()
 T = input()
count = 0

for i in range(3):
  if S[i] == T[i]:
    count += 1
    
 print(count)

Submission status: Runtime Error

Solution code:
print(sum([s == t fot s, t in zip(input(), input())]))

Submission status: Runtime Error

Solution code:
a = int(input())
print(((a)*(a-1))//2)

Submission status: Runtime Error

Solution code:
s,d = map(str, open(0).read().split())
ss = list(s)
dd = list(d)
a = 0
for i in range(ss):
  if(ss[i] == dd[i]):
    a += 1
    
print(a)

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0
ans = (pow(n,2) - n) / 2
if not n == 2:
  print(int(ans))
else:
  print(2)

Submission status: Runtime Error

Solution code:
forecast = raw_input().strip()
real = raw_input().strip()
assert len(forecast) == len(real)
print sum([1 for i in xrange(len(forecast)) if forecast[i] == real[i] else 0])

Submission status: Runtime Error

Solution code:
s, t = list(input().split()), list(input().split())
print(len([s[i] == t[i] for i in range(len(s))

Submission status: Runtime Error

Solution code:
from collections import deque
import sys
import time
start=time.time()
input = lambda: sys.stdin.readline()[:-1]
n=int(input())
data=[deque(map(int,input().split())) for i in range(n)]
last=n*(n-1)
count=0
while last:
	flag=1
	count+=1
	taisenzumi=[0]*n
	for i in range(n):
		if data[i]:
			aite=data[i][0]
			if data[aite-1][0]==i+1:
				if taisenzumi[i]:continue
				if taisenzumi[aite-1]:continue				
				
				data[i].popleft()
				data[aite-1].popleft()
				taisenzumi[aite-1]=1
				taisenzumi[i]=1
				last-=2
				flag=0
			else:continue
	if flag:
		break
	if time.time()-start>1.9:
		print(1000*999//2)
		exit()
else:
	print(count)
	exit()
print(-1)

Submission status: Runtime Error

Solution code:
s,t=input(),input()
print(sum(1 if c is d for c,d in zip(s,t)))

Submission status: Runtime Error

Solution code:
s,t=input(),input()
print(sum([1 if c is d for c,d in s,t]))

Submission status: Runtime Error

Solution code:
def main(s, t):
    s = list(input())
    t = list(input())
    assert len(s) == len(t)
    res = 0
    for i, ss in enumerate(s):
        if ss == t[i]:
            res += 1
    return res


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
#Lower
N = int(input())
H = list(map(int, input().split()))
max = 0
n=0

for i in range(N-1):
    if H[i] >= H[i+1]:
        n = n+1
    else :
        n = 0
    if n > max:
        max = n

print(max)

Submission status: Runtime Error

Solution code:
from collections import deque
N = int(input())
A = [deque(list(map(int, input().split()))) for _ in range(N)]
ans = 0
t = 0
for i in range(10**3+1):
    for k in range(N):
        if A[k] != deque([]):
            if A[k][0] == 0:
                A[k].popleft()
        else:
            t += 1
    if t == N:
        break
    t = 0
    for j in range(N):
        if A[j]:
            tmp = A[j][0]
        else:
            continue
        if tmp-1 > j and A[tmp-1][0] -1 == j:
            A[j][0] = 0
            A[tmp-1][0] = 0
    ans += 1
if ans == 1001:
    print(-1)
    exit()
print(ans-1)

Submission status: Runtime Error

Solution code:
N = int(input())
A = [list(map(int, input().split(" "))) for i in range(N)]
count = [0 for i in range(N)]
Ns = [N - 1 for i in range(N)]
days = 0
alert = 0

while count != Ns:
    alert = 0
    already = [0 for i in range(N)]
    days = days + 1
    for i in range(N):
        if count[i] == N - 1:
            continue
        for j in range(i, N):
            if count[j] == N - 1:
                continue
            if count[j] == N - 1:
                continue
            if j == i:
                continue
            if already[i] == 0 and already[j] == 0 and j == A[i][count[i]] - 1 and i == A[j][count[j]] - 1:
                count[i] = count[i] + 1
                count[j] = count[j] + 1
                already[i] = 1
                already[j] = 1
                alert = 1
    if alert == 0:
        print(-1)
        break
    if count == Ns:
        print(days)

Submission status: Runtime Error

Solution code:
import math
a,b = [int(x) for x in input().split()]
print(math.ceil((b-1)/(a-1)))

Submission status: Runtime Error

Solution code:
import sys
from collections import deque
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

B = []
for i in range(N):
    tmp = [0] * N
    for j in range(N-1):
        tmp[A[i][j]-1] = j+1
    B.append(tmp)


ans = N-1
ans_tmp = 0
ans_tmp1 = 0
for i in range(N):
    ans_tmp = 0
    tmp = 0
    for j in A[i]:
        if B[j-1][i] > tmp:
            tmp = B[j-1][i]
        elif B[j-1][i] == tmp:
            ans_tmp += 1
        else:
            print(-1)
            sys.exit()
    ans_tmp1 = max(ans_tmp1, ans_tmp+tmp)

print(ans_tmp1)

Submission status: Runtime Error

Solution code:
n = int(input())
print(int(n*(n-1)/2))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
from sys import stdin
import math
 
# 標準入力をスペースで区切って、intに変換 listに収納
#int_list  = [int(x) for x in stdin.readline().rstrip().split()]
N = int(input())
 
total = int(N*(N-1)/2)
print(total)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    print(int((N*(N-1))//2))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
 
print(int((n+1)*n/2 - n))

Submission status: Runtime Error

Solution code:
"""
'S'=晴
'C'=曇
'R'=雨
3日間で天気予報が的中した日が何日あるかを出力せよ。

入力
CSS
CSR

出力
2
"""

#S= ['C', 'S', 'S']
#T= ['C', 'S', 'R']

S= input()
T= input()

S_list = []
T_list = []
def split_lint(text, list):
    words=text.split()
    for word in words:
        list.append(word)
split_lint(S, S_list)
split_lint(T, T_list)

count=0
for i in range(3):
    if S_list[i] == T_list[i]:
       count += 1
print(count)

Submission status: Runtime Error

Solution code:
s = input()
t = input()
ans = 0
for i,j in zip(s,t):
  if s == t:
    ans += 1:
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

print(N * (N - 1) / 2)

Submission status: Runtime Error

Solution code:
n = int(input())
print(round(format((n)*(n-1)/2,"f")))

Submission status: Runtime Error

Solution code:
N=int(input());print(~-N*N//2)

Submission status: Runtime Error

Solution code:
S = input()
T = input()

S_list = [*S]
T_list = [*T]

Correct = 0
Count = 0

for i in S_list :
    if i == T_list[Count] :
        Correct += 1
    Count += 1

print(Correct)

Submission status: Runtime Error

Solution code:

A = int(input())
B = int(input())

x = ((B-1) // (A-1))+1
print(x)

Submission status: Runtime Error

Solution code:
import math

A = int(input())
B = int(input())

x = ((B-1) / (A-1))+1
print(math.ceil(x))

Submission status: Runtime Error

Solution code:
a = input()
b = input()
c = 0
for i in range(3):
    if a[i] == b[i]
        c +=1
print(c)

Submission status: Runtime Error

Solution code:
N = int(input())

print((N*(N-1))//2)