Harryxun/stf_run huggingface dataset:
#!/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))

### FIXED CODE ###

#!/usr/bin/env python

n = int(input())

tScore = 0
hScore = 0

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

import cmath

class Point(object):
    def __init__(self, x, y):
        self.point = complex(x, y)
    def __str__(self):
        return "x = {0}, y = {1}".format(self.point.real, self.point.imag)

class Triangle(Point):
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c

        self.edgeA = abs(b.point-c.point)
        self.edgeB = abs(c.point-a.point)
        self.edgeC = abs(a.point-b.point)

        self.angleA = Triangle.angle(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = Triangle.angle(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = Triangle.angle(self.edgeC, self.edgeA, self.edgeB)


    def angle(A, B, C):
        return cmath.acos( (B*B+C*C-A*A)/(2*B*C) )



    def circumscribedCircleRadius(self):
        return abs((self.edgeA/cmath.sin(self.angleA))/2)


    def circumscribedCircleCenter(self):
        A = cmath.sin(2*self.angleA)
        B = cmath.sin(2*self.angleB)
        C = cmath.sin(2*self.angleC)
        X = (self.a.point.real*A + self.b.point.real*B + self.c.point.real*C) / (A+B+C)
        Y = (self.a.point.imag*A + self.b.point.imag*B + self.c.point.imag*C) / (A+B+C)
        return complex(X, Y)

line = list(map(float, input().split()))
p1 = Point(line[0], line[1])
p2 = Point(line[2], line[3])
p3 = Point(line[4], line[5])
T = Triangle(p1, p2, p3)
center = T.circumscribedCircleCenter()
print("{0:.4f} {1:.4f} {2:.4f}".format(center.real, center.imag, T.circumscribedCircleRadius()))

### FIXED CODE ###

# -*- coding: utf-8 -*-

import cmath

class Point(object):
    def __init__(self, x, y):
        self.point = complex(x, y)
    def __str__(self):
        return "x = {0}, y = {1}".format(self.point.real, self.point.imag)

class Triangle(Point):
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c
        # ３辺の長さ
        self.edgeA = abs(b.point-c.point)
        self.edgeB = abs(c.point-a.point)
        self.edgeC = abs(a.point-b.point)
        # ３角の大きさ
        self.angleA = Triangle.angle(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = Triangle.angle(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = Triangle.angle(self.edgeC, self.edgeA, self.edgeB)

    # 角度を求める
    def angle(A, B, C):
        return cmath.acos( (B*B+C*C-A*A)/(2*B*C) )


    # 外接円の半径
    def circumscribedCircleRadius(self):
        return abs((self.edgeA/cmath.sin(self.angleA))/2)

    # 外心
    def circumscribedCircleCenter(self):
        A = cmath.sin(2*self.angleA)
        B = cmath.sin(2*self.angleB)
        C = cmath.sin(2*self.angleC)
        X = (self.a.point.real*A + self.b.point.real*B + self.c.point.real*C) / (A+B+C)
        Y = (self.a.point.imag*A + self.b.point.imag*B + self.c.point.imag*C) / (A+B+C)
        return complex(X, Y)

n = int(input())
for i in range(n):
    line = list(map(float, input().split()))
    p1 = Point(line[0], line[1])
    p2 = Point(line[2], line[3])
    p3 = Point(line[4], line[5])
    T = Triangle(p1, p2, p3)
    center = T.circumscribedCircleCenter()
    print("{0:.3f} {1:.3f} {2:.3f}".format(center.real, center.imag, T.circumscribedCircleRadius()))
def resolve():
    N = int(input())
    hs = list(map(int, input().split(" ")))
    dps = [None] * N

    def rec(dest):
        if dest == 0:
            dps[dest] = 0
        if dest == 1:
            dps[dest] = abs(hs[1]-hs[0])

        if dps[dest] is None:
            dps[dest] = min(rec(dest-1)+abs(hs[dest]-hs[dest-1]), rec(dest-2)+abs(hs[dest]-hs[dest-2]))
        
        return dps[dest]

    print(rec(N-1))

if __name__ == '__main__':
    resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    hs = list(map(int, input().split(" ")))
    dps = [0] * N

    dps[0] = 0
    dps[1] = abs(hs[1] - hs[0])
    for i in range(2, N):
        dps[i] = min(dps[i-1]+abs(hs[i]-hs[i-1]), dps[i-2]+abs(hs[i]-hs[i-2]))
    
    print(dps[-1])

if __name__ == '__main__':
    resolve()
N = int(input())
A = map(int,input().split())
sum = 0
a = []
for i in range(N):
  a.append(1/A[i])
  sum += a[i]

print(1/sum)

### FIXED CODE ###

N = int(input())
A = map(float,input().split())
sum = 0

for i in A:
  a = 1/i
  
  sum += a

print(1/sum)
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(input())
h = np.array(read().split(),dtype=np.int32)
dp = np.zeros(n,dtype=np.int32)
k = 2

for i in range(1,n):

    l = max(i-k,0)
    dp[i] = np.min(np.abs(h[i]-h[l:i])+dp[l:i])

print(dp[-1])


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,*H = list(map(int,read().split()))
h = [0]
h.extend(H)

dp = [100] * (n+1)
dp[1] = 0
dp[2] = abs(h[2]-h[1])

for i in range(3,n+1):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[-1])
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    for i in range(h)
        print("#" * w)

### FIXED CODE ###

while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    for i in range(h):
        print("#"*w)
    print("")
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(n-2):
  dp(i+2)=min(dp[i]+abs(h[i+2]-h[i]),dp[i+1]+abs(h[i+2]-h[i]))
print(dp[n-1])

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(n-2):
  dp[i+2]=min(dp[i]+abs(h[i+2]-h[i]),dp[i+1]+abs(h[i+2]-h[i+1]))
print(dp[n-1])
import sys
from collections import deque
N,M,P = map(int, input().split())
ABC = []
Adake = [[] for _ in range(M)]
Bdake = [[] for _ in range(M)]
for _ in range(M):
    A,B,C = map(int, input().split())
    ABC.append((A-1,B-1,C-P))
    Adake[A-1].append(B-1)
    Bdake[B-1].append(A-1)
    
def dfs(x,s):
    used = {s}
    search = deque([s])
    while search:
        ss = search.pop()
        for sss in x[ss]:
            if sss in used:
                continue
            used.add(sss)
            search.append(sss)
    return used

U = dfs(Adake,0) & dfs(Bdake,N-1)
ABC = [(a,b,c) for (a,b,c) in ABC if a in U and b in U]

dist = [-float("inf")]*N
dist[0]=0
    
for i in range(N):
    for a,b,c in ABC:
        if dist[a] + c > dist[b]:
            dist[b] = dist[a] + c
            if i == N-1 and b == N-1:
                print(-1)
                sys.exit()
if dist[-1] == -float("inf"):
    print(-1)
elif dist[-1]<0:
    print(0)
else:
    print(dist[-1])

### FIXED CODE ###

import sys
from collections import deque

    
def dfs(x,s):
    used = {s}
    search = deque([s])
    while search:
        ss = search.pop()
        for sss in x[ss]:
            if sss in used:
                continue
            used.add(sss)
            search.append(sss)
    return used


def bellmanford(edges):
    coins = [-float("inf")] * N
    coins[0] = 0
    for _ in range(N):
        f = True
        for u,v,c in edges:
            if coins[u] + c > coins[v]:
                coins[v] = coins[u] + c
                f = False
        if f:
            return max(0, coins[-1])
    return -1

N,M,P = map(int, input().split())
ABC = []
Adake = [[] for _ in range(N)]
Bdake = [[] for _ in range(N)]
for _ in range(M):
    A,B,C = map(int, input().split())
    ABC.append((A-1,B-1,C-P))
    Adake[A-1].append(B-1)
    Bdake[B-1].append(A-1)

U = dfs(Adake,0) & dfs(Bdake,N-1)
ABC = [(a,b,c) for (a,b,c) in ABC if a in U and b in U]

print(bellmanford(ABC))
s = input()
s = s.replace('eraser','z')
s = s.repalace('erase','z')
s = s.repalace('dreamer','z')
s = s.repalace('dream','z')
for  S in s:
    if S != 'z':
        print('NO')
    else:
        print('YES')

### FIXED CODE ###

s = input()
s = s.replace('eraser','z')
s = s.replace('erase','z')
s = s.replace('dreamer','z')
s = s.replace('dream','z')
for  S in s:
    if S != 'z':
        print('NO')
        exit()
print('YES')
n, m, l = map(int, input().split())
A = [[int(n) for n in input().split()] for i in range(n)]
B = [[int(n) for n in input().split()] for i in range(m)]
C = [[0 for i in range(l)] for j in range(n)]
for i in range(l):
    for j in range(n):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
for i in range(n):
    for j in range(l):
        if j == l - 1:
            print(C[i][j])
        else:
            print(C[i][j], end = " ")

### FIXED CODE ###

n, m, l = map(int, input().split())
a = [[int(num) for num in input().split()] for i in range(n)]
b = [[int(num) for num in input().split()] for i in range(m)]
c = [[0 for i in range(l)] for j in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j] += a[i][k] * b[k][j]
for i in range(n):
    for j in range(l):
        if j == l - 1:
            print(c[i][j])
        else:
            print(c[i][j], end=" ")
taka_h, taka_a, aoki_h, aoki_a = map(int, input().split())

while True:
    aoki_h -=taka_a
    taka_h -= aoki_a
    if(aoki_h <=0):
        print("Yes")
        break
    elif(taka_h <= 0):
        print("No")
        break


### FIXED CODE ###

from collections import defaultdict
N = int(input())
d = defaultdict(int)

for _ in range(N):
  s = input()
  if s == 'AC':
    d[s] += 1
  elif s == 'WA':
    d[s] += 1
  elif s == 'TLE':
    d[s] += 1
  else:
    d[s] += 1
    
    
for k in ['AC', 'WA', 'TLE', 'RE']:
  print('{} x {}'.format(k, d[k]))
from collections import deque
LIM=200004
L=[0]*LIM

def bin_sum(Y):
    S=bin(Y)[2:]
    count=0
    for i in range(len(S)):
        count+=int(S[i])
    return count

def bin_sum2(Y):
    count=0
    for i in range(len(Y)):
        count+=int(Y[i])
    return count

for i in range(1,LIM):
    L[i]+=bin_sum(i)

def pop_num(N,b,L):
    if N==0:
        return 0
    v=N%b
    return pop_num(v,L[v],L)+1
    
M=[0]*200005
for i in range(1,200004):
    M[i]+=pop_num(i,L[i],L)
X=int(input())
Y=input()
zero=deque()
for i in range(X):
    if Y[i]=="1":
        zero.append(i)
d=bin_sum2(Y)
e=int(Y,2)%(d+1)
f=int(Y,2)%max(1,(d-1))
for i in range(X):
    if i==zero[0]:
        b=max(d-1,1)
        flag=max(0,d-1)
        g=(f-2**(X-1-i)%b+b)%b
        zero.popleft()
    else:
        b=d+1
        flag=1
        g=(e+2**(X-1-i))%b

    if flag==0:
        print(0)
    elif g==0:
        print(1)
    else:
        print(M[g]+1)

### FIXED CODE ###

from collections import deque
LIM=200004
L=[0]*LIM

def bin_sum(Y):
    S=bin(Y)[2:]
    count=0
    for i in range(len(S)):
        count+=int(S[i])
    return count

def bin_sum2(Y):
    count=0
    for i in range(len(Y)):
        count+=int(Y[i])
    return count

for i in range(1,LIM):
    L[i]+=bin_sum(i)

def pop_num(N,b,L):
    if N==0:
        return 0
    v=N%b
    return pop_num(v,L[v],L)+1
    
M=[0]*200005
for i in range(1,200004):
    M[i]+=pop_num(i,L[i],L)
X=int(input())
Y=input()
d=bin_sum2(Y)
e=int(Y,2)%(d+1)
f=int(Y,2)%max(1,(d-1))
O=[1]*(X+2)
P=[1]*(X+2)
q=max(d-1,1)
for i in range(1,X+1):
    O[i]=O[i-1]*2%q
    P[i]=P[i-1]*2%(d+1)
for i in range(X):
    
    if int(Y[i])==1:
        b=max(d-1,1)
        flag=max(0,d-1)
        g=(f-O[X-1-i]+b)%b
    else:
        b=d+1
        flag=1
        g=(e+P[X-1-i])%b

    if flag==0:
        print(0)
    elif g==0:
        print(1)
    else:
        print(M[g]+1)
def gcd(a,b):
    while b > 0:
        a, b = b, a%b
    return a

def gcd_list(lst):
    a = gcd(lst[0],lst[1])
    i=2
    while a > 0 and i<len(lst):
        a = gcd(a, lst[i])
        if a == 1:
            return 1
            break
        i+=1
    return a
    
n, k = (int(i) for i in input().split())
print(n,k)
a = list(int(i) for i in input().split())  
print(a)
maxA=max(a)

if maxA >= k and gcd_list(a)%k == 0:
    print("POSSIBLE")
elif k in a:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
    

### FIXED CODE ###

def gcd(a,b):
    while b > 0:
        a, b = b, a%b
    return a

def gcd_list(lst):
    g = lst[0]
    for i in range(1,len(lst)):
        g = gcd(g,lst[i])
    return g
    
n, k = (int(i) for i in input().split())
a = list(int(i) for i in input().split())  

maxA=max(a)

if (k <= maxA and k%gcd_list(a) == 0) or (k in a):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
S = list(input())
count = list(S.count(i) for i in set(S))
if count[0] == count[1] and count[0] == 2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S = list(input())
count = list(S.count(i) for i in set(S))
if len(count) == 2 and count[0] == count[1] and count[0] == 2:
    print('Yes')
else:
    print('No')
i=(input().split())
j=(input().split())
k=(input())

A=int(i[0])
V=int(i[1])
B=int(j[0])
W=int(j[1])
T=int(k)

print(B)

if B>=A:
    if (B-A)+W*T <= V*T:
        print("YES")
    else (B-A)+W*T > V*T:
        print("NO")

if B<A:
    if (A-B)+W*T <= V*T:
        print("YES")
    else (A-B)+W*T > V*T:
        print("NO")

### FIXED CODE ###

i=(input().split())
j=(input().split())
k=(input())

A=int(i[0])
V=int(i[1])
B=int(j[0])
W=int(j[1])
T=int(k)

if abs(B-A)+W*T <= V*T:
    print("YES")
elif abs(B-A)+W*T > V*T:
    print("NO")
l=int(input())
ans=0
sum=0
 
for i in range(l):
 for j in range(l-i):
   sum=i*j*(l-i-j)
   if ans<sum:
      ans=sum
print(ans)

### FIXED CODE ###

n,m=map(int, input().split())
 
a=n*(n-1)/2+m*(m-1)/2
 
print(str(int(a)))
def primes(x):
  is_prime = [True] * (x + 1)
  is_prime[0] = False
  is_prime[1] = False
  for i in range(2, int(x**0.5) + 1):
    if not is_prime[i]:
      continue
    for j in range(i * 2, x + 1, i):
      is_prime[j] = False
  return [i for i in range(x + 1) if is_prime[i]]

n=int(input())
P=primes(n)
A=[int(i) for i in input().split()]
Ans=[]
C=[False]*n
for i in reversed(range(n)):
  if A[i]==1:    
    if 2*(i+1)>n:
      Ans.append(i+1)
      C[i]=True
    else:
      c=1
      j=0
      while P[j]*(i+1)<=n:
        if C[P[j]*(i+1)-1]==True:
          c^=1
        j+=1
      if c==1:
        Ans.append(i+1)
        C[i]=True
  elif A[i]==1:    
    c=0
    j=0
    while P[j]*(i+1)<=n:
      if C[P[j]*(i+1)-1]==True:
        c^=1
      j+=1
    if c==1:
      Ans.append(i+1)
      C[i]=True
if len(Ans)==0:
  print(0)
else:
  print(len(Ans))
  Ans.sort()
  print(*Ans)

### FIXED CODE ###

n=int(input())

A=[int(i) for i in input().split()]
Ans=[]
C=[False]*n
for i in reversed(range(n)):
  if A[i]==1:    
    if 2*(i+1)>n:
      Ans.append(i+1)
      C[i]=True
    else:
      c=0
      j=2
      while j*(i+1)<=n:
        if C[j*(i+1)-1]==True:
          c^=1
        j+=1
      if c==0:
        Ans.append(i+1)
        C[i]=True
        
  elif A[i]==0:    
    c=0
    j=2
    while j*(i+1)<=n:
      if C[j*(i+1)-1]==True:
        c^=1
      j+=1
    if c==1:
      Ans.append(i+1)
      C[i]=True
      
if len(Ans)==0:
  print(0)
else:
  print(len(Ans))
  Ans.sort()
  print(*Ans)
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a_counter = Counter(a)
k = list(a_counter.keys())
v = list(a_counter.values())

if len(a_counter) == 3 and k[0]^k[1]^k[2] == 0 and v[0] == v[1] == v[2]:
    print("Yes")
elif len(a_counter) == 2 and 0 in k and v[0] == v[1]*2 or v[1] == v[0]*2:
    print("Yes")
elif len(a_counter) == 1 and 0 in k:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a_counter = Counter(a)
a_counter_li = list(a_counter)
if sum(a) == 0:
    print("Yes")
elif len(a)%3 != 0:
    print("No")
elif len(a_counter) > 3 or len(a_counter) <= 1:
    print("No")
elif len(a_counter) == 3:
    if a_counter[a_counter_li[0]] == n // 3 and a_counter[a_counter_li[1]] == n // 3 and a_counter[a_counter_li[2]] == n // 3:
        if a_counter_li[0]^a_counter_li[1]^a_counter_li[2] == 0:
            print("Yes")
        else:
            print('No')
    else:
        print("No")
else:
    a_counter_li.sort()
    if a_counter_li[0] == 0 and a_counter[a_counter_li[0]] == n // 3:
        print("Yes")
    else:
        print("No")
s, t = map(int, input().split())
a, b = map(int, input().split())
u = input()

if u == s:
  print(a-1, b)

if u == t:
  print(a, b-1)

### FIXED CODE ###

def resolve():
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()

    if u == s:
        print(a - 1, b)

    if u == t:
        print(a, b - 1)

resolve()
from scipy.sparse.csgraph import dijkstra

n, m = map(int,input().split())
A = []
C = []
for i in range(m):
    ab = list(map(int,input().split()))
    A.append(ab)
    cc = list(map(int,input().split()))
    C.append(cc)

M = [[float("inf")] * 2**n for i in range(2**n)]

for i in range(2**n):
    M[i][i] = 0

for i in range(m):
    t = 0
    for j in C[i]:
        t += 2**(j-1)
    for j in range(2**n):
        for k in range(2**n):
            if (t-(k-j)) ^ (k-j) == t:
                # print(t,j)
                M[j][k] = min(M[j][k], A[i][0])
# print(M)

d = dijkstra(M, indices = 0)

ans = d[-1]
if ans == float("inf"):
    ans = -1
print(int(ans))


### FIXED CODE ###

n, m = map(int,input().split())
A = []
C = []
for i in range(m):
    ab = list(map(int,input().split()))
    A.append(ab)
    cc = list(map(int,input().split()))
    C.append(cc)
T = []
for i in range(m):
    t = 0
    for j in C[i]:
        t += 2**(j-1)
    T.append(t)


n2 = 2**n

DP = [[float("inf") for i in range(n2)] for j in range(m+1)]
for i in range(m+1):
    DP[i][0] = 0

for i in range(1,m+1):
    t = T[i-1]
    for j in range(n2):
        # print(i,j,t)
        # print(DP[i][j|t], DP[i-1][j|t], DP[i-1][j] + A[i-1][0])
        DP[i][j|t] = min(DP[i][j|t], DP[i-1][j|t], DP[i-1][j] + A[i-1][0])
        DP[i][j] = min(DP[i][j], DP[i-1][j])
        # print(DP[i][j|t])

ans = DP[-1][-1]
if ans == float("inf"):
    ans = -1
print(int(ans))
N = int(input())
A = list(map(int, input().split()))

import collections
dic=dict(collections.Counter(A))
li=list(dic.values())

ans='No'
if N%3 == 0:
    if len(li)==3:
        if li[0]==li[1] and li[0]==li[2]:
            ans='Yes'
else:
    if len(li)==1:
        if dic.keys[0]==0:
            ans='Yes'

print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import Counter

def main():
    N = int(input())
    a = list(map(int, input().split()))
    l = Counter(a)
    if len(l)==1 and 0 in l:
        print('Yes')
        exit()
    if N%3==0 and len(l)==2 and 0 in l and l[0] == N//3:
        print('Yes')
        exit()
    if N%3==0 and len(l)==3:
        x,y,z = l.keys()
        if l[x] == l[y] == N//3 and x^y^z == 0:
            print('Yes')
            exit()
    print('No')

    

if __name__ == '__main__':
    main()
#!/usr/bin/env python3

#import
#import math
#import numpy as np
#= int(input())
S = input()
K = int(input())

t1 = []

t = 1
for i in range(1, len(S)):
    if S[i - 1] == S[i]:
        t += 1
    else:
        if t > 1:
            t1.append(t)
        t = 1

if t > 1:
    t1.append(t)

ans1 = 0
for t in t1:
    ans1 += t // 2

if K == 1:
    print(ans1)
    exit()

if len(t1) == 1:
    if t1[0] == len(S):
        print(t1[0] * K // 2)
        exit()

ans2 = 0
if S[0] == S[-1]:
    tt = t1.pop(0)
    ttt = t1.pop(len(t1) - 1)
    t = tt + ttt
    t1.append(t)
    for t in t1:
        ans2 += t // 2

else:
    ans2 = ans1 * (K - 1)

print(ans1 + ans2)







### FIXED CODE ###

#!/usr/bin/env python3

#import
#import math
#import numpy as np
#= int(input())
S = input()
K = int(input())
ls = len(S)
t1 = []

t = 1
for i in range(1, ls):
    if S[i - 1] == S[i]:
        t += 1
    else:
        if t > 1:
            t1.append(t)
        t = 1

if t > 1 or t == ls:
    t1.append(t)

ans = 0
for t in t1:
    ans += t // 2

if len(t1) == 1:
    if t1[0] == ls:
        print(ls * K // 2)

else:
    if S[0] != S[-1]:
        print(ans * K)
    
    else:
        ta = t1[0]
        tb = t1[-1]
        print(ans * K - (ta // 2 + tb // 2 - (ta + tb) // 2) * (K - 1))
def main():
    N, M = map(int, input().split())
    d = dict()
    for _ in range(M):
        a, b = map(int, input().split())
        d[a] = d.get(a, 0) + 1
        d[b] = d.get(b, 0) + 1

    for a in range(1, N+1):
        print(d[a])


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N, M = map(int, input().split())
    d = dict()
    for _ in range(M):
        a, b = map(int, input().split())
        d[a] = d.get(a, 0) + 1
        d[b] = d.get(b, 0) + 1

    for a in range(1, N+1):
        if a in d:
            print(d[a])
        else:
            print(0)

if __name__ == '__main__':
    main()
N, M = MAP()

S = input()
T = input()

if S[0] != T[0]:
	print(-1)
	exit()

G = gcd(N, M)

if G == 1:
	print(N*M)
	exit()

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N, M = MAP()

S = input()
T = input()

if S[0] != T[0]:
	print(-1)
	exit()

G = gcd(N, M)

n = N//G
m = M//G

for i in range(G):
	if S[::n][i] != T[::m][i]:
		print(-1)
		break
else:
	print(N*M//G)
s = input()
n = len(s)

if n == 2 and s[0] == s[1]:
    print(1, 2)
    exit()

for i in range(n):
    if s[i] == s[i + 1] or s[i] == s[i + 2] or s[i + 1] == s[i + 2]:
        print(i + 1, i + 3)
        exit()

print(-1, -1)

### FIXED CODE ###

s = input()
n = len(s)

if n == 2 and s[0] == s[1]:
    print(1, 2)
    exit()

for i in range(n - 2):
    if s[i] == s[i + 1] or s[i] == s[i + 2] or s[i + 1] == s[i + 2]:
        print(i + 1, i + 3)
        exit()

print(-1, -1)
n=int(input())
if(n<1200):
  print("ABC")
elif(n<2800):
  print("ARC"):
elif(n>=2800):
  print("AGC")

### FIXED CODE ###

print(["ABC","ARC","AGC"][int(input())//50+8>>5])
import statistics

N = int(input())
X = [int(i) for i in input().split()]
X.sort()
mid = statistics.mean(X)
ans = 0
ans1 = 0
ans2 = 0
print(mid)
for i in range(N):
    ans1 += (X[i] - int(mid)) ** 2
    ans2 += (X[i] - int(mid) - 1) ** 2
ans = min(ans1, ans2)

print(ans)

### FIXED CODE ###

import statistics

N = int(input())
X = [int(i) for i in input().split()]
X.sort()
mid = statistics.mean(X)
ans = 0
ans1 = 0
ans2 = 0

for i in range(N):
    ans1 += (X[i] - int(mid)) ** 2
    ans2 += (X[i] - int(mid) - 1) ** 2
ans = min(ans1, ans2)

print(ans)
n = int(input())
 
for i in range(1,n):
  ans += (n-1)//i
print(ans)

### FIXED CODE ###

n = int(input())
 
ans = 0
for i in range(1,n):
  ans += (n-1)//i
print(ans)