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

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

Submission status: Runtime Error

Solution code:
N = int(input())

if N == 1:
  print(0)
elif N == 2:
  print(1)
else:
  print(int(N * (N-1) // 2))

Submission status: Runtime Error

Solution code:
n=int(input())

print(int((n-1)*n//2))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
aaa = 0
c = 1
while c < b:
    c += a
    aaa += 1
        
print(aaa)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
res = 0
c = 1
while c < b:
  c += a
  res += 1
        
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())
        A = [list(map(int, input().split())) for _ in range(N)]

        already_p = set()
        days = 0
        done = set()
        while True:
            for i, a in enumerate(A):
                if len(a) == 0:
                    done.add(i + 1)
                    continue
                if i + 1 not in already_p:
                    if a[0] not in already_p:
                        if A[a[0] - 1][0] == i + 1:
                            already_p.add(i + 1)
                            already_p.add(a[0])
                            A[a[0] - 1] = A[a[0] - 1][1:]
                            A[i] = a[1:]

            if len(done) == N:
                break

            if len(already_p) == 0:
                print(-1)
                exit()

            already_p = set()
            days += 1

        print(days)


if __name__ == '__main__':
    AtCoder().main()

Submission status: Runtime Error

Solution code:
s=list(map(int,input().split()))
if s[1]==1:
	print(0)
else:
  	num=1
	cost=s[0]
	while cost < s[1]:
    	num+=1
    	cost+=(s[0]-1)
print(num)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

s = sys.stdin.gets()
t = sys.stdin.gets()

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

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
n = N -1
print((n//2) * (2*1 + (n-1)*1))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = II()
    print(int(n / 2 * (n - 1)))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
s,t=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,t=map(int,input().split())
ans=0
for i in range(3):
	if s[i]==t[i]:
		ans+=1
print(nas)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = int(input())
total=10*10
if(S%2==1):
    total=S*((S-1)//2)
else:
    total=(S-1)*((S-2)//2)+(S-1)

print(total)

Submission status: Runtime Error

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b = MAP()
ans = 0
if b == 1:
    print(ans)
    exit()

while(1):

    if ans == 0:
        b -= a
        ans += 1
    else:
        if b <= 0:
            print(ans)
            exit()
        else:
            b -= (a-1)
            ans += 1

    

# n = INT()
# a, b, c = MAP()
# ans = 1
# # count = 0
# count = a
# flag = False
# # for i in range(30):
# while flag == False:
#     if count >= b:
#         flag = True    
#     else:
#         count += a-1
#         ans += 1
# print(ans)





# k = 1
# count = 0
# ans = 0
# A = []


# count += a
# ans += 1


# while(1):
#     if count >= b:
#         print(ans)
#         exit()
#     else:
#         count += a-1
#         ans += 1
#         # print()




# count += a
# ans += 1

# for i in range(100):
#     if b <= count:
#         print(ans)
#         exit()

#     else:
#         count += a-1
#         ans += 1 
#         # print(ans)

# for i in range(30):
# while(1):
#     count += a
#     ans += 1
#     print(count)

#     if b <= count:
#         print(ans)
#         exit()
#     else:   
#         count = count-1
#     # print(ans)
    
    # # A.append(a)
    # # if sum(A)
    # if count == 0:
    #     count += a
    #     ans += 1
    # else:
    #     count += a-1
    #     ans += 1
    # print(count)
    # print(ans)
    # if b<=count:
    #     # print(count)
    #     print(ans)
    #     exit()

Submission status: Runtime Error

Solution code:
N = int(input())
H = list(map(int, input().split()))
list = []
for i in range(N - 1):
    if H[i] < H[i + 1]:
        list.append('A')
    else:
        list.append('B')
W = ''.join(list)
Wlist = W.split('A')
anslist =[]
for i in range(len(Wlist)):
    anslist.append(len(Wlist[i]))
print(max(anslist))

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
print(int(int(n * (n - 1)) / 2))

Submission status: Runtime Error

Solution code:
cout =0
S= map(str, input().split())
T= map(str, input().split())

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

Submission status: Runtime Error

Solution code:
n = int(input())

max_i = int(n / 2) + 1
max_mod = n % max_i

sum = ((n - 1) * n) / 2

if max_mod > max_i:
  sum = (sum - max_i-1) + max_mod

print(int(sum))

Submission status: Runtime Error

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

c

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

print(c)

Submission status: Runtime Error

Solution code:
def culc(n):
    if n%2==0:
        return (n+1)*(n/2)-n
    if n%2==1:
        return (n+1)*((n-1)/2)+(n+1)/2-n

N = int(input())
if N == 1:
    print(0)
else:
    print(int(culc(N)))

Submission status: Runtime Error

Solution code:
import random
N = int(input())

A = [i+1 for i in range(N)]

ind_max=0

for _ in range(300000):
  B = [i+1 for i in range(N)]
  random.shuffle(B)
  ind = 0
  for i in range(N):
    ind += (A[i] % B[i])
  if ind_max < ind:
    ind_max = ind
print(ind_max)

Submission status: Runtime Error

Solution code:
def culc(n):
    if n%2==0:
        return (n+1)*(n/2)-n
    if n%2==1:
        return (n+1)*((n-1)/2)+(n+1)/2-n

N = int(input())
if N == 1:
    print(0)
else:
    print(culc(N))

Submission status: Runtime Error

Solution code:
pred = [i for i in input()]
data = [i fpr i in input()]
cnt = 0

for i in range(3):
  if pred[i] == data[i]:
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
def main():
    from collections import deque
    import sys
    input = sys.stdin.readline

    n = int(input())
    L = [deque(map(lambda x: int(x) - 1, input().split())) for _ in range(n)]

    ans = 0
    count = 0
    MAX_COUNT = n * (n-1)
    iteration_times = 0
    flag = 0

    while iteration_times <= MAX_COUNT:
        iteration_times += 1

        if count == MAX_COUNT:
            flag = 1
            break
        
        numset = set()
        add = numset.add
        flag = 100
        for i in range(n):
            if len(L[i]) != 0 and i not in numset:
                a = L[i][0]
                b = L[a][0]
                if i == b:
                    add(i)
                    add(b)
                    flag = 0
        
        if flag == 100:
            break
        for elm in numset:
            L[elm].popleft()
            count += 1

        ans += 1

    if flag == 1:
        print(ans)
    else:
        print(-1)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
xy = []
for _ in range(n):
  xy.append(list(map(int,input().split())))
can = []
for i in range(n):
  now = [0,0]
  xp = [0,0]
  xm = [0,0]
  X = - xy[i][1] + 0.00000000000001
  Y = xy[i][0]
  for j in range(n):
    x,y = xy[j]
    if x * X + y * Y > 0:
      now[0] += x
      now[1] += y
    elif x * X + y * Y == 0:
      if x == 0:
        if y > 0:
          xp[0] += x
          xp[1] += y
        else:
          xm[0] += x
          xm[1] += y
      elif x > 0:
        xp[0] += x
        xp[1] += y
      else:
        xm[0] += x
        xm[1] += y
  xp[0] += now[0]
  xp[1] += now[1]
  xm[0] += now[0]
  xm[1] += now[1]
  use = max(xp[0]**2+xp[1]**2,xm[0]**2+xm[1]**2)
  can.append(use)
print(max(can)**.5)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for _ in range(n):
	a.append(list(map(int, input().split())))
# print(a)
b = [[0, 0] for _ in range(n)]
# print(b)
cnt = 0
cntmax = n*(n-1)
while cnt < cntmax:
	flag = True
	for i in range(n):
		pass1 = b[i][0]       
		if pass1 >= n-1: continue
		pass2 = b[a[i][pass1] - 1 ][0]      
		if pass2 >= n-1: continue
		
		if a[a[i][pass1] - 1][pass2] - 1 == i:
			b[a[i][b[i][0]] - 1][1] = b[i][1] = max(b[i][1], b[a[i][b[i][0]] - 1][1]) + 1
			b[a[i][b[i][0]] - 1][0] += 1
			b[i][0] += 1
			cnt += 2
			flag = False
			# print("done");print(a);print(b)
	if flag:
		print(-1)
		exit()
	# print(a)
	# print(b)
ans = 0
for i in range(n):
	ans = max(ans, b[i][1])
print(ans)

Submission status: Runtime Error

Solution code:
import sys
l = int(input())
s = list(map(int, input().split()))

while l > 0:
    for i in range(l-1):
        count = 1
        ss = s[i:i+l-2]
        for j in range(len(ss)-2):
            if ss[j] == ss[j+1]:
                count *= 1
            else:
                count *= 0
        if count == 1:
            print(i)
            sys.exit()
        l -= 1

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

best = 0
for i in range(N-1):
  a=0
  for j in range(i+1,N):
    if H[i] < H[j]: break
    else : 
      a += 1
  if a > best :
    best = a
print(best)

Submission status: Runtime Error

Solution code:
import sys

a, b = map(int, input().split())
add_value = 0

if a >= 20 and a <= 2:
    if b >= 20 and b <= 1:
        sys.exit()
else:
    while True:
            add_value += 1
            a *= add_value
            if a >= b:
                break


print(add_value)

Submission status: Runtime Error

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

need = 1
tap = a


while tap < b:
	if a == 0 or a == 1 or b < a or b == 0:
		need = 0
		break
	tap += (a - 1)
	need += 1
print (need)

Submission status: Runtime Error

Solution code:
import sys
a,b=map(int, input().split())
hole = a
if b==1:
  prnt(0)
for i in range(1,30):
    if hole<b:
        hole = hole + a -1
    elif hole>=b:
        print(int(i))
        break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")

# 無向グラフを仮定する。


class Graph(object):
    def __init__(self, N):
        self.E = [[] for _ in range(N)]

    def add_edge(self, edge):
        s, t = edge
        self.E[s].append(t)


def solve(N: int, A: "List[List[int]]"):
    a_head = [0]*N
    stack = list(range(N))
    next_stack = []
    day = -1
    flag = True
    g = Graph(N)

    while flag:
        day += 1
        g.E = [[] for _ in range(N)]
        flag = False

        for i in stack:
            h = a_head[i]
            if h == N-1:
                continue
            if i in g.E[A[i][h]-1]:
                a_head[i] += 1
                a_head[A[i][h]-1] += 1
                flag = True
                next_stack.append(i)
                next_stack.append(A[i][h]-1)
                g.E[A[i][h]-1].remove(i)
            else:
                g.add_edge([i, A[i][h]-1])
        stack = next_stack[:]

    for h in a_head:
        if h != N-1:
            print(-1)
            return
    print(day)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [[int(next(tokens)) for _ in range(N - 1)]
         for _ in range(N)]  # type: "List[List[int]]"
    solve(N, A)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())
A = 0
B = 0
ans = 0
pre_ans = 0
for i in range(N):
    if x[i]>=0 and y[i]>=0:
        A+=x[i]
        B+=y[i]
    elif x[i]*y[i]<0 and x[i]+y[i]>0:
        A+=x[i]
        B+=y[i]
ans = (A**2+B**2)**0.5

A = 0
B = 0
for i in range(N):
    if x[i]>=0 and y[i]<=0:
        A+=x[i]
        B+=y[i]
    elif x[i]*y[i]>0 and x[i]-y[i]>0:
        A+=x[i]
        B+=y[i]
pre_ans = (A**2+B**2)**0.5
if pre_ans > ans:
    ans = pre_ans

A = 0
B = 0
for i in range(N):
    if x[i]<=0 and y[i]<=0:
        A+=x[i]
        B+=y[i]
    elif x[i]*y[i]<0 and x[i]+y[i]<0:
        A+=x[i]
        B+=y[i]
pre_ans = (A**2+B**2)**0.5
if pre_ans > ans:
    ans = pre_ans

A = 0
B = 0
for i in range(N):
    if x[i]<=0 and y[i]>=0:
        A+=x[i]
        B+=y[i]
    elif x[i]*y[i]>0 and -x[i]+y[i]>0:
        A+=x[i]
        B+=y[i]
pre_ans = (A**2+B**2)**0.5
if pre_ans > ans:
    ans = pre_ans





print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import deque
def main():
    N=int(input())
    A = [deque(map(int, input().split())) for _ in range(N)]

    days = 0
    changed = True
    played = set()
    while changed:
        played.clear()
        changed = False
        for i in range(N-1):
            if len(A[i]) == 0:
                continue
            a1 = A[i][0]
            if len(A[a1-1]) == 0:
                continue
            a2 = A[a1-1][0]
            if a1 in played or a2 in played:
                continue
            if a2-1 == i:
                A[a2-1].popleft()
                A[a1-1].popleft()
                played.add(a2)
                played.add(a1)
                changed = True
        if changed:
            days+=1

    for a in A:
        if len(a) > 0:
            print(-1)
            break
    else:
        print(days)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os, pdb
sys.setrecursionlimit(10**7)
from fractions import Fraction
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)

def main():
    A_list = []
    if 'LOCAL' in os.environ:
        N = 1000
        for i in range(N):
            tmp = [j for j in range(N) if i != j]
            random.shuffle(tmp)
            A_list.append(tmp)

    else:
        N = _I()
        for i in range(N):
            A_list.append(LI())
        #  perr(A_list)
    new_A_list = {}
    for aidx, A in enumerate(A_list):
        new_A_list[aidx] = tuple(i-1 for i in A)
    A_list = new_A_list

    """
    まず、N=1000までなので、
    1000*1000=10**6まである。
    試合の日数を最小かする。
    つまりできるだけ効率よく1日に試合を詰め込むことを考える
    そもそも1のところに2とあったら、
    全通りを求めると？
    どの試合にするかで1000*999/2の階乗=10**6/2の階乗通りある
    まず選手iの1つ目を見ていく
    その相手のところをみて、current_idxがiだったら試合可能

    """

    current_opponent_idx = None
    current_day = 0
    is_ok = False
    # 各選手の試合状況
    current_position_list = {i:0 for i in range(N)}
    done_player_list = tuple()
    position_sum = 0
    done_sum = (N-1)*N
    #  all_done_players = set()
    while True:
        #  print('day: ', current_day)
        #  print('current position list', current_position_list)
        #  pdb.set_trace()
        is_ok = False
        #  if all(position == N-1 for position in current_position_list):
        if position_sum == done_sum:
            # 全試合終了
            break

        for i in range(N-1):
            #  print('--- in for---- current position list', current_position_list)
            # 選手iが試合できるか見る
            if i in done_player_list:
                continue

            #  if i in all_done_players:
            if current_position_list.get(i) == N-1:
                # この選手はすべての試合を終了している
                continue

            # iの試合相手のidx
            opponent_idx = A_list.get(i)[current_position_list.get(i)]
            if opponent_idx in done_player_list:
                # 試合相手がすでに今日試合してた場合
                continue

            #  print('i', i)
            #  print('opponent', opponent_idx)

            # iの試合相手の次の相手が選手iなら成立する
            if A_list[opponent_idx][current_position_list[opponent_idx]] == i:
                #  print('試合した', i, opponent_idx)
                # 試合可能
                #  done_player_list.extend([i, opponent_idx])
                done_player_list += (opponent_idx, i)
                current_position_list[i] += 1
                current_position_list[opponent_idx] += 1
                #  if current_position_list[i] == N-1:
                #      all_done_players.add(i)
                #  if current_position_list[opponent_idx] == N-1:
                #      all_done_players.add(opponent_idx)
                position_sum += 2
                # 試合がまだ可能であるというフラグをつける
                is_ok = True

        if not is_ok:
            # 1試合も成立しなかったらストップする
            print(-1)
            exit()

        done_player_list = tuple()
        current_day += 1

    print(current_day)
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

input = sys.stdin.readline
N = int(input())
As = [[]]
for i in range(N):
    As.append(list(map(int, input().split())))

Cs = [0] * (N + 1)
Ks = [False] * (N + 1)
d = 1
ms = 0
msMax = N * (N - 1) // 2
sw = True
tab = set()
while sw:
    c = 0
    wa = []
    for i in range(1, N + 1):
        if Ks[i]:
            continue
        if Cs[i] == N - 1:
            continue
        a = 0
        b = 0
        if i > As[i][Cs[i]]:
            a = As[i][Cs[i]]
            b = i
        else:
            a = i
            b = As[i][Cs[i]]
        if (a, b) in tab:
            ms = ms + 1
            c = c + 1
            if ms == msMax:
                sw = False
                print(d)
                break
            Cs[a] += 1
            Cs[b] += 1
            # tab.remove((a, b))
            wa.append(a)
            wa.append(b)
        else:
            tab.add((a, b))
            Ks[i] = True
    for i in wa:
        Ks[i] = False
    d += 1
    if c == 0:
        print(-1)
        break

Submission status: Runtime Error

Solution code:
cout =0
S= map(input().split())
T= map(input().split())

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

Submission status: Runtime Error

Solution code:
def solve():
  import sys

  sys.setrecursionlimit(10**7)
  readline = sys.stdin.readline

  
  n = int(readline())
  a = [list(map(int,readline().split())) for _ in range(n)]
  c = [0]*n
  d = 0
  m = list(range(n))
  
  while m:
    candidate = set()
    for i in m:
      if i in candidate:
        continue
      j = a[i][c[i]]-1
      if a[j][c[j]]-1 == i:
        candidate.add(i)
        candidate.add(j)

    if candidate:
      for i in candidate:
        c[i]+=1
        if c[i] == n-1:
          m.remove(i)
      d+=1
    else:
      d=-1
      break
      
  print(d)


if __name__ == '__main__':
  solve()

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_list[0]


total = int(N*(N-1)/2)
print(total)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<string>

int main() {
	int ans;
	ans = 0;
	std::string S, T;
	std::cin >> S >> T;
	if (S[0] == T[0]) {
		ans++;
	}
	if (S[1] == T[1]) {
		ans++;
	}
	if (S[2] == T[2]) {
		ans++;
	}
	std::cout << ans << std::endl;
}

Submission status: Runtime Error

Solution code:
num = list(input().split(" "))
a = int(num[0])
b = int(num[1])

count = 1

while True:
  if count == 1:
  	plug = a
  else:
    plug = plug + (a - 1) 
  if plug >= b:
    break
  count += 1

print(count)

Submission status: Runtime Error

Solution code:
s=list(map(int,input().split()))
num=1
cost=s[0]
while cost < s[1]:
    num+=1
    cost=num*s[0]-1
print(num)

Submission status: Runtime Error

Solution code:
n=int(input())
li = list(map(int,input().split()))

count = [0] * n
dif=0
start=0

for start in range(n-1):
#     print("start"+str(start))

    for i in range(start,n-1):
        dif=li[i]-li[i+1]
#         print(dif)
        if(dif<0):
            break
        count[start]+=1
#     print(count[start])

print(max(count))

Submission status: Runtime Error

Solution code:
# coding:utf-8
def main():
    n = int(input())
    h = list(map(int, input().split()))
    start_num = 0
    best_score = 1000
    best_sc = 0

    min_h = h.index(min(h))

    for i in range(n-1):
        score =  h[i] - h[i+1]
        if best_score >= score and score >= 0:
            if best_score == score:
                if h[i] > h[start_num]:
                    start_num = i
                    sc = 0
                    while  i != n - 1 and h[i] >= h[i+1] :
                        sc = sc + 1
                        i = i + 1
                    if best_sc <= sc:
                        best_sc = sc
                        best_score = score
            else:
                start_num = i
                sc = 0
                while  i != n - 1 and h[i] >= h[i+1] :
                    sc = sc + 1
                    i = i + 1
                    if best_sc <= sc:
                        best_sc = sc
                        best_score = score

    print(best_sc)





if __name__ == '__main__' :
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

mod = (N-1)*N/2
print(int(mod))

Submission status: Runtime Error

Solution code:
n = int(input())
dp = [0]*n
cnt = 0
L = []
flag = True
for i in range(n):
  T = []
  N = list(map(int,input().split()))
  for j in range(n-1):
    T.append((i+1,N[j]))
  L.append(T)
while dp != [n-1]*n:
  B = [0]*n
  act = 0
  for i in range(n):
    if B[i] == 0:
      B[i] = 1
      if dp[i] != n-1:
        miru = L[i][dp[i]][1]
        if dp[miru-1] == n-1:
          flag = False
          break
        else:
          if B[miru-1] != 1:
            if L[miru-1][dp[miru-1]][1] == i+1:
              dp[i] += 1
              dp[miru-1] += 1
              B[miru-1] = 1
              act += 1
  if act == 0:
    dp = [n-1]*n
    flag = False
  if cnt >= 100000:
      dp = [n-1]*n
  cnt += 1
if flag == False:
  print(-1)
else:
  print(cnt)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
s=list(map(int,input().split()))
num=1
cost=s[0]
while cost < s[1]:
  num=num+1
  cost=num*s[0]-1
print(num)

Submission status: Runtime Error

Solution code:
import sys

N = int(sys.stdin.readline())
print(sum(n + 1 for n in range(N - 1)))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
nt = []
for i in range(n):
  tmp = input().split()
  for j in range(n-1):
    tmp[j] = int(tmp[j])
  nt.append(tmp)

day = 0
j = []
for i in range(n):
  j.append(0)
  
while(True):
  #print(j)
  tmp = []
  for i in range(n):
    if j[i] < n-1 and nt[nt[i][j[i]]-1][j[nt[i][ j[i] ]-1]] == i+1:
      tmp.append(i)
  #print(tmp)
  if len(tmp) == 0:
    break
  for i in tmp:
    j[i] += 1
  day += 1
  
error = 0
for i in range(n):
  if j[i] != n-1:
    day = -1

print(day)

Submission status: Runtime Error

Solution code:
import sys
s = input().split()
weather_forecast = s[0]
weather_real = s[1]
weather_forecast_s = list(weather_forecast)
weather_real_s = list(weather_real)
hit = 0
for i in range(3):
    if weather_forecast_s[i] == weather_real_s[i]:
        hit+=1
print(hit)

Submission status: Runtime Error

Solution code:
a, b, c = input()
d, e, f = input()
if a == d and b == e and c == f:
  print(3)
elif a == b and b == e:
  print(2)
elif b == e and c == f:
  print(2)
elif c == f and a == b:
  print(2)
elif a == d or b == e or c == f:
  print(1)
elif a != d and b != e and c != f:
  peint(0)
else:
  pass

Submission status: Runtime Error

Solution code:
import math
a, b = map(int, raw_input().split())
i = 0
if a == b:
    print(1)
else:
    while True:
        if (a-1)*i>=b:
            break
        i +=1
    print(i)

Submission status: Runtime Error

Solution code:
s=list(map(int,input().split()))
num=1
cost=s[0]
while cost < s[1]:
  num+=1
  cost=num*s[0]-1
print(num)

Submission status: Runtime Error

Solution code:
N = int(input())
print(sum(range(1, N)))

Submission status: Runtime Error

Solution code:
N = int(input())
A = []
c=0
f = True
for i in range(N):
  A.append(list(map(int, input().split())))
idx = [0 for i in range(N)]

a = 0

cc = 0

ccc = 0

btlf = [False for i in range(N)]#その周回ですでにバトルしたかどうかのフラグです
m = (N*(N-1))//2
n = 100000
for i in range(min(m,n)):#周回
  btlf = [False for i in range(N)]#リセット
  ccc = 0
  for j in range(N):
    #print(idx)
    if idx[j] != N-1:
      a = A[j][idx[j]]
      if a>j:
        if A[a-1][idx[a-1]]-1==j and btlf[a-1] == False and btlf[j] == False:
          idx[a-1]+=1
          btlf[a-1] = True
          idx[j]+=1
          btlf[j] = True
          cc+=1
          ccc+=1
  if cc == m:#idx == [N-1 for i in range(N)]:
    print(i+1)
    f = False
    break
  if ccc == 0:#対戦が一度もなければ打ち切ります
    break
if f:
  print(-1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
H_list = input().split(" ")
max_count = 0

for i in range(0, N):
    S = int(H_list[i])
    count = 0
    for j in range(i + 1, N):
        if S >= int(H_list[j]):
            S = int(H_list[j])
            count += 1
        else:
            break
    if max_count < count:
        max_count = count
    if max_count >= N - i:
        break
print(max_count)

Submission status: Runtime Error

Solution code:
a, b, c = input()
d, e, f = input()
if a == d and b == e and c == f:
  print(3)
elif a == b and b == e, b == e and c == f, c == f and a == b:
  print(2)
elif a == d or b == e or c == f:
  print(1)
else:
  peint(0)

Submission status: Runtime Error

Solution code:
N = int(input())
tmp = input()
H = [int(x.strip()) for x in tmp.split(' ')]
n = 0
lists = list()
lists.append(0)
count = 0
while n <= N-2:
    if H[n] >= H[n+1]:
        while H[n] >= H[n+1]:
            count += 1
            n += 1
            if n == N-1:
                lists.append(count)
                break
        lists.append(count)
        count = 0
    else:
        n += 1
print(max(lists))

Submission status: Runtime Error

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