Harryxun/stf_run huggingface dataset:
N = int(input())
S1 = input()
S2 = input()
mod = 10 ** 9 + 7
 
if S1[0] == S2[0] :
    ret = 3
    pre = False
    i = 1
else :
    ret = 6
    pre = True
    i = 2
 
while i < N :
    cur = (S1[i] != S2[i])
    if not pre :
        ret *= 2
    elif pre and cur :
        ret *= 3
    
    ret %= mod
    
    if cur :
        i += 2
    else :
        i += 1
    pre = cur
    
print(ret)
N = int(input())
S1 = input()
S2 = input()
mod = 10 ** 9 + 7

# False->tate True->yoko
if S1[0] == S2[0] :
    ret = 3
    pre = False
    i = 1
else :
    ret = 6
    pre = True
    i = 2

while i < N :
    cur = (S1[i] != S2[i])
    if not pre :
        ret *= 2
    elif pre and cur :
        ret *= 3
    
    ret %= mod
    
    if cur :
        i += 2
    else :
        i += 1
    pre = cur
    
print(ret)

### FIXED CODE ###

N = int(input())
S1 = input()
S2 = input()
mod = 10 ** 9 + 7

# False->tate True->yoko
if S1[0] == S2[0] :
    ret = 3
    pre = False
    i = 1
else :
    ret = 6
    pre = True
    i = 2

while i < N :
    cur = (S1[i] != S2[i])
    if not pre :
        ret *= 2
    elif pre and cur :
        ret *= 3
    
    ret %= mod
    
    if cur :
        i += 2
    else :
        i += 1
    pre = cur
    
print(ret)
a = input()
print(a[3]+a[4]+a[5])

### FIXED CODE ###

a = input()
print(a[0]+a[1]+a[2])
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

s = 1
g = 0
i = 1
history = [s]
flag = [False] * n
flag[0] = True

while True:
    g = a[s-1]
    if flag[g-1] == True:
        break
    else:
        flag[g-1] = True
        history.append(g)
        s = g
        i += 1


x = history.index(g)

if k < n:
    ans = history[k]
else:
    d = (k-x) % (i - x)

    ans = history[x + d]

print(ans)


### FIXED CODE ###

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

s = 1
g = 0
i = 1
history = [s]
flag = [False] * n
flag[0] = True

while True:
    g = a[s-1]
    if flag[g-1] == True:
        break
    else:
        flag[g-1] = True
        history.append(g)
        s = g
        i += 1


x = history.index(g)

if k < i:
    ans = history[k]
else:
    d = (k-x) % (i - x)

    ans = history[x + d]

print(ans)
X = input()
if X=3 or X=5 or X=7:
  print("YES")
else:
  print("NO")


### FIXED CODE ###

x = int(input())
if x==3 or x==5 or x==7:
  print("YES")
else:
  print("NO")
import copy

N, Q = map(int, input().split())
graph = [[] for i in range(N)]

def dfs(v, d, p_list=[0]):
    seen[v] = True
    depth[v] = d
    parents_list[v] = copy.copy(p_list)
    for i in graph[v]:
        if seen[i] == True:
            continue
        p_list.append(i)
        dfs(i, d+1, p_list)
        p_list.pop()

for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

seen = [False for i in range(N)]
depth = [0 for i in range(N)]
parents_list = [[] for i in range(N)]
dfs(0, 0)

ans = [0 for i in range(N)]

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1

    for j, parent in enumerate(parents_list):
        if p in parent:
            ans[j] += x

print(*ans)


### FIXED CODE ###

N, Q = map(int, input().split())
graph = [[] for i in range(N)]

for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

ans = [0 for i in range(N)]

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1

    ans[p] += x

seen = [False for i in range(N)]

stack = [0]

# dfs
while stack != []:
    v = stack.pop()
    seen[v] = True

    for i in graph[v]:
        if seen[i] == True:
            continue
        ans[i] += ans[v]
        stack.append(i)

print(*ans)
S = int(input())
if S == "Sunny":
  ans = "Cloudy"
elif S == "Cloudy":
  ans = "Rainy"
else:
  ans = "Sunny"
print(ans)

### FIXED CODE ###

S = input()
if S == "Sunny":
  ans = "Cloudy"
elif S == "Cloudy":
  ans = "Rainy"
else:
  ans = "Sunny"
print(ans)
a,b,c,x=map(int,[input() for i in range(4)])

ans=0
for p in range(a+1): 
    for q in range(b+1):
        for r in range(c+1):
            if 500*p+100*q+50*r==x:
                ans=ans+1
print(ans)


### FIXED CODE ###

x,a,b=map(int,[input() for i in range(3)])
print((x-a)%b)
#n,m = list(map(int,input().split()))
    s = input()
     
    if s[0] == s[1] == s[2]:
      print('No')
    else:
      print('Yes')

### FIXED CODE ###

#n,m = list(map(int,input().split()))
s = input()

if s[0] == s[1] == s[2]:
  print('No')
else:
  print('Yes')
N, A, B, C = list(map(int, input().split()))
s = [input() for _ in range(N)]

DP = [[0] * 3 for _ in range(N + 1)]
DP[0] = [A, B, C]

L = [""] * N
R = {}
R[0] = "A"
R[1] = "B"
R[2] = "C"
A = []
B = []
for i in range(N):
  t = s[i]
  if t == "AB":
    x = 0
    y = 1
  if t == "BC":
    x = 1
    y = 2
  if t == "AC":
    x = 0
    y = 2
  if DP[i][y] != 0:
    DP[i + 1] = DP[i]
    DP[i + 1][x] += 1
    DP[i + 1][y] -= 1
    L[i] = R[x]
    if x == 0:
      A.append([i, y])
    else:
      B.append([i, y])
  elif DP[i][x] != 0:
    DP[i + 1] = DP[i]
    DP[i + 1][x] -= 1
    DP[i + 1][y] += 1
    L[i] = R[y]
  else:
    if x == 0:
      if len(B) == 0:
        print("No")
        exit()
      z = 1
      k, n = pop(B)
    if x == 1:
      if len(A) == 0:
        print("No")
        exit()
      z = 0
      k, n = pop(A)
    DP[i + 1] = DP[i]
    DP[i + 1][z] -= 2
    DP[i + 1][n] += 2
    if n == x:
      x, y = y, x
    DP[i + 1][x] += 1
    DP[i + 1][y] -= 1
    if DP[i + 1][z] < 0:
      print("No")
      exit()
    L[i] = R[x]
    L[t] = R[y]


print("Yes")
for i in L:
  print(i)

### FIXED CODE ###

N, A, B, C = list(map(int, input().split()))
s = [input() for _ in range(N)]

DP = [[0] * 3 for _ in range(N + 1)]
DP[0] = [A, B, C]

L = [""] * N
R = {}
R[0] = "A"
R[1] = "B"
R[2] = "C"
A = []
B = []
for i in range(N):
  t = s[i]
  if t == "AB":
    x = 0
    y = 1
  if t == "BC":
    x = 1
    y = 2
  if t == "AC":
    x = 0
    y = 2
  if DP[i][y] != 0:
    DP[i + 1] = DP[i]
    DP[i + 1][x] += 1
    DP[i + 1][y] -= 1
    L[i] = R[x]
    if x == 0:
      A.append([i, y])
    else:
      B.append([i, y])
  elif DP[i][x] != 0:
    DP[i + 1] = DP[i]
    DP[i + 1][x] -= 1
    DP[i + 1][y] += 1
    L[i] = R[y]
  else:
    if x == 0:
      if len(B) == 0:
        print("No")
        exit()
      z = 1
      k, n = B.pop()
    if x == 1:
      if len(A) == 0:
        print("No")
        exit()
      z = 0
      k, n = A.pop()
    DP[i + 1] = DP[i]
    DP[i + 1][z] -= 2
    DP[i + 1][n] += 2
    if n == x:
      x, y = y, x
    DP[i + 1][x] += 1
    DP[i + 1][y] -= 1
    if DP[i + 1][z] < 0:
      print("No")
      exit()
    L[i] = R[x]
    L[k] = R[y]

print("Yes")
for i in L:
  print(i)
n=int(input())
A=[]
X=[]
Y=[]
x=[]
y=[]
l=[1]*n
for i in range(n):
  a=int(input())
  A.append(a)
  for j in range(a):
    x1,y1=[int(s) for s in input().split()]
    x.append(x1)
    y.append(y1)
  X.append(x)
  Y.append(y)
  
c=0
for i in range(n):
  for j in range(i,n):
    if l[j]==0:continue
    for k in range(A[i]):
    　　l[X[j][k]] *= Y[j][k]
  if c<l.count(1):
    c=l.count(1) 
  
        
  
print(c)  
  
  
  
  
  
  
  
  
  
  
  
  
  

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
import math
n, l = map(int, input().split())

total = sum(list(range(l, n+l)))
pie = []
min_abs = math.inf
for i in range(n):
    a = list(range(l, n+l))
    a.pop(i)
    if abs(total-sum(a)) < min_abs:
        min_abs = abs(total-sum(a))
        ans = sum(a)
print(ans)

### FIXED CODE ###

n, l = map(int, input().split())

total = sum(list(range(l, n+l)))
pie = []
min_abs = 9999999
for i in range(n):
    a = list(range(l, n+l))
    a.pop(i)
    if abs(total-sum(a)) < min_abs:
        min_abs = abs(total-sum(a))
        ans = sum(a)
print(ans)
a = int(input())
b = int(input())

x =[1,2,3]
x = x.remove(a)
x = x.remove(b)

print(x[0])

### FIXED CODE ###

a = int(input())
b = int(input())
 
p = list(map(int,range(1,4)))
p.remove(a)
p.remove(b)
print(p[0])
a,b = map(int,input().split())
li = []
for i in range(a):
  li.append(int(input())
sum1 = sum(li)
min1 = min(li)
b = b -sum1
print(a+ b//min1)

### FIXED CODE ###

a,b = map(int,input().split())
li = []
for i in range(a):
  li.append(int(input()))
sum1 = sum(li)
min1 = min(li)
b = b -sum1
print(a+ b//min1)
N=int(input())
count=0
a=list(map(int,input().split()))
w=[]
s=[]
num=[0]*10000000

for i in range(N):
  w.append(1+i+a[i])
  s.append(1+i-a[i])
  num[1+i-a[i]]+=1
for i in range(N):
  count+=num[w[i]]
print(count)

### FIXED CODE ###

N=int(input())
count=0
a=list(map(int,input().split()))
w=[]
s=[]
num=[0]*N
maxi=max(a)
for i in range(N):
  s.append(1+i-a[i])
  if 1+i+a[i]<N:
    num[1+i+a[i]]+=1
for i in range(N):
  if s[i]>=0:
    count+=num[s[i]]
print(count)
N=list(map(int,input().split()))
A=list(map(int,input().split()))
n=N[0]
k=N[1]
for i in range(k+1):
    if A[i]<A[k+i]:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

N=list(map(int,input().split()))
A=list(map(int,input().split()))
n=N[0]
k=N[1]
for i in range(n-k):
    if A[i]<A[k+i]:
        print("Yes")
    else:
        print("No")
n = int(input())
p = list(map(int, input()))

ans = 0
for i in range(1, n-1):
  if p[i] > p[i-1] and p[i] < p[i+1]: ans += 1

print(ans)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
 
ans = 0
for i in range(1, n-1):
  M = max(p[i-1], p[i], p[i+1])
  m = min(p[i-1], p[i], p[i+1])
  if p[i] != M and p[i] != m: ans += 1

print(ans)
w,h,x,y=map(int,input().split())
ans=[w*h/2]
if y/x==h/w or y/x==w/h:
    ans.append(1)
else:ans.append(0)
print(*ans)


### FIXED CODE ###

w,h,x,y=map(int,input().split())
ans=[w*h/2]
if (x==0 and y==0) or (x==0 and y==h) or (x==w and y==0) or (x==w and y==h):
    ans.append(0)
elif y*w==x*h or y*h==x*w:
    ans.append(1)
else:ans.append(0)
print(*ans)
n, k, *A = map(int, open(0).read().split())
t = sum(A) / (n+k)
A = [a for a in A if int(a/t) >= 1]
X = []
for a in A:
    X.append(ceil(a / ceil(a/t)))
    X.append(ceil(a / int(a/t)))
X.sort()
print(X[k] if k < len(X) else X[-1])

### FIXED CODE ###

from math import ceil
n, k, *A = map(int, open(0).read().split())
t = sum(A) / (n+k)
A = [a for a in A if int(a/t) >= 1]
c = k - sum(int(a/t)-1 for a in A)
X = []
for a in A:
    X.append(ceil(a / ceil(a/t)))
    X.append(ceil(a / int(a/t)))
X.sort()
print(X[-c-1])
import sys
sys.setrecursionlimit(10**7)
N, Q = map(int, input().split())
to = [[] for _ in range(N)]
ans = [0] * N
def dfs(v, p=-1):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x
dfs(0)
print(*ans)

### FIXED CODE ###

A = int(input())
S = input()
if A >= 3200:
  print(S)
else:
  print("red")
w, h, n = list(map(int, input().split()))
xya = []
for i in range(n):
    xya.append(list(map(int, input().split())))

min_x_1 = w
max_x_2 = 0
min_y_3 = h
max_y_4 = 0
for i in range(n):
    ai = xya[i][2]
    if ai == 1:
        if xya[i][0] < min_x_1:
            min_x_1 = xya[i][0]
    if ai == 2:
        if xya[i][0] > max_x_2:
            max_x_2 = xya[i][0]
    if ai == 3:
        if xya[i][1] < min_y_3:
            min_y_3 = xya[i][1]
    if ai == 4:
        if xya[i][1] > max_y_4:
            max_y_4 = xya[i][1]

x = max_x_2 - min_x_1
if x <= 0:
    print("0")
else:
    y = max_y_4 - min_y_3
    if y <= 0:
        print("0")
    else:
        print(str(x * y))


### FIXED CODE ###

a, b, c = list(map(int, input().split()))
if (a + b == c) or (b + c == a) or (c + a == b):
    print("Yes")
else:
    print("No")
n=int(input())
TREE=[[] for _ in range(n)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    a-=1
    b-=1
    TREE[a].append([b,c])
    TREE[b].append([a,c])
q,k=map(int,input().split())
k-=1
cost=[0]*n
visited=[False]*n

def DFS(s,d):
    cost[s]=d
    visited[s]=True
    for i in TREE[s]:
        if not visited[i[0]]:
            DFS(i[0],d+i[1])
    return

DFS(k,0)
for _ in range(q):
    start,goal=map(int,input().split())
    print(cost[start-1]+cost[goal-1])

### FIXED CODE ###

import heapq
import itertools
n=int(input())
edges=[[] for _ in range(n)]
for _ in range(n-1):
    a,b,c=map(int, input().split())
    a,b=a-1,b-1
    edges[a].append((b,c))
    edges[b].append((a,c))

def dijkstra(x,route):
    d=[float('inf')]*n
    d[x]=0
    visited={x}
    hq=[(0,x)]
    while hq:
        u=heapq.heappop(hq)[1]
        visited.add(u)
        for node,cost in route[u]:
            if (node not in visited) and d[node]>d[u]+cost:
                d[node]=d[u]+cost
                heapq.heappush(hq,(d[node],node))
    return d
q,k=map(int,input().split())
k-=1
dist=dijkstra(k,edges)
for _ in range(q):
    start,goal=map(int,input().split())
    print(dist[start-1]+dist[goal-1])
# -*- coding utf-8 -*-

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

for i in range(a,b+1):
    if i%x==0:
        ans+=1
    else:
        ans=ans
print(ans)


### FIXED CODE ###

# -*- coding utf-8 -*-

x,y,z =list(map(str,input().split()))

print(x[0].upper() + y[0].upper() + z[0].upper())
N, W = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(N)]
memo = [[0] * (W + 1) for i in range(N + 1)]

def dfs(i, j):
    if memo[i][j] != 0:
        ans = memo[i][j]
    elif i == N:
        return 0
    elif A[i][0] > j:
        return 0
    else:
        ans  = max(dfs(i + 1, j), A[i][1] + dfs(i + 1, j - A[i][0]))
        memo[i][j] = ans
    return ans
        
print(dfs(0, W))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 8)

N, W = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(N)]
memo = {i : {} for i in range(N)}

def dfs(i, j):
    if i == N:
        return 0
    elif j in memo[i]:
        return memo[i][j]
    elif A[i][0] > j:
        ans = dfs(i + 1, j)
    else:
        ans  = max(dfs(i + 1, j), A[i][1] + dfs(i + 1, j - A[i][0]))
    memo[i][j] = ans
    return ans
        
print(dfs(0, W))
a, b, c, d = map(int,input().split())
dp = [[0 for j in range(d+1)] for i in range(c+1)]
for i in range(a, c+1):
  for j in range(b, d+1):
    if i == a and j == b:
      dp[i][j] = 1
      continue
    dp[i][j] = (dp[i-1][j] * j + dp[i][j-1] * i - dp[i-1][j-1] * (i-1) * (j-1) ) % 998244353
    dp[i][j] += 998244353
    dp[i][j] %= 998244353
print(dp[c][d])

### FIXED CODE ###

x = int(input())
for i in range(1, 361):
  if 360*i % x == 0:
    print(360*i//x)
    break
else:
  print(360)
N = int(input())
L_num = int(input())
list = []

for i in range(1,N+1,1):
    list.append(input())

list.sort(reverse = False)

ans = ""
for i in range(1,N+1,1):
    ans = ans + list[0]
    list.pop(0)

print(ans)


### FIXED CODE ###

N = input().split()
list = []

N = int(N[0])
for i in range(1,N+1,1):
    list.append(input())

list.sort(reverse = False)

ans = ""
for i in range(1,N+1,1):
    ans = ans + list[0]
    list.pop(0)

print(ans)
# xの逆元は、x*y = 1 mod pとなるようなy
N, K = map(int, input().split())
mod = 10**9 + 7
a = N - K + 1
print(a)
for i in range(K-1):
    a = a * (N - K - i) * (K - (i + 1)) / ((i+2) * (i+1))
    print(int(a % mod))



### FIXED CODE ###

# xの逆元は、x*y = 1 mod pとなるようなy
N, K = map(int, input().split())
mod = 10**9 + 7
a = N - K + 1
print(a)
for i in range(K-1):
    a = a * (N - K - i) * (K - (i + 1)) // ((i+2) * (i+1))
    print(a % mod)
from sys import stdin, setrecursionlimit as srl
from threading import stack_size, Thread
srl(int(1e9)+7)
stack_size(int(1e8))
 
def f(d):
    ans = 0
    try:
        return stored[(d[0],d[1],d[2])]
    except:
        pass
    ans = ans + n/(d[0]+d[1]+d[2]) + (d[2]/(d[0]+d[1]+d[2]))*x*f([d[0],d[1]+1,d[2]-1]) + (d[1]/(d[0]+d[1]+d[2]))*x*f([d[0]+1,d[1]-1,d[2]]) + (d[0]/(d[0]+d[1]+d[2]))*f([d[0]-1,d[1],d[2]])
    stored[(d[0],d[1],d[2])] = ans
    return ans
 
 
n = int(input())
a = list(map(int,input().split()))
d = [0 for i in range(3)]
stored = {(0,0,0):0}
 
for i in a:
    d[i-1] +=1
 
print(f(d))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
d = [0 for i in range(3)]
dp = [[[0 for i in range(n+1)] for j in range(n+1)] for k in range(n+1)] 
for i in a:
    d[i-1] +=1
for k in range(n+1):
    for j in range(n+1):
        for i in range(n+1):
            if i+j+k==0 or i+j+k>n:
                continue
            ans = n/(i+j+k)
            x = i/(i+j+k)
            if x:
                ans += x*dp[k][j][i-1]
            x = j/(i+j+k)
            if x:
                ans += x*dp[k][j-1][i+1]
            x = k/(i+j+k)
            if x:
                ans += x*dp[k-1][j+1][i]
            dp[k][j][i] = ans
print(dp[d[2]][d[1]][d[0]])
class Job:

    def __init__(self, reward, days):
        self.reward = reward
        self.days = days


def dfs(jobs, remaing_days, selected_jobs):
    reward = 0

    # print(jobs, remaing_days)

    if remaing_days == 0:
        return 0

    for job in jobs:
        if job.days <= remaing_days:
            # print(
            #     f'trying {job} sum: {reward} remaing_days:{remaing_days} selected:{selected_jobs}')

            next_selected_jobs = selected_jobs | set([job])
            remaining_jobs = jobs - set([job])
            new_reward = job.reward + \
                dfs(remaining_jobs, remaing_days - 1, next_selected_jobs)

            # if reward < new_reward:
            #     print(
            #          f'pickup {job} sum: {new_reward} remaing_days:{remaing_days} selected:{selected_jobs}')
            reward = max(reward, new_reward)
        # else:
        #     print(
        #         f'fail to pickup {job} sum: {reward} remaing_days:{remaing_days} selected:{selected_jobs}')

    return reward


N, M = list(map(int, input().split()))
jobs = set()

for i in range(N):
    A, B = list(map(int, input().split()))
    jobs.add(Job(reward=B, days=A))

print(dfs(jobs, M, set()))


### FIXED CODE ###

import heapq


class Job:

    def __repr__(self):
        return "%d,%d".format(self.days, self.reward)

    def __lt__(self, other):
        return self.reward < other.reward

    def __init__(self, job_id, reward, days):
        self.id = job_id
        self.reward = reward
        self.days = days

N, M = list(map(int, input().split()))
h = []
jobs = []

for i in range(N):
    A, B = list(map(int, input().split()))
    jobs.append(Job(job_id=i, reward=B, days=A))


jobs = sorted(jobs, key=lambda j: j.days)
idx = 0
c = 0

for i in range(1, M+1):
    while idx < N and jobs[idx].days <= i:
        heapq.heappush(h, -jobs[idx].reward)
        idx += 1

    if len(h) != 0:
        c += -heapq.heappop(h)

print(c)
x,y=map(int,input().split())
m=list(map(int,input().split())
ans=0
for i in m:
       if m[i]>=y:
       ans += 1
print(ans)

### FIXED CODE ###

x,y=map(int,input().split())
m=list(map(int,input().split()))
ans=0
for i in m:
    if i>=y:
        ans += 1
print(ans)
n, k = map(int, input().split())
ans = []
aru = []
nai = []
spe = set()
f = []
m = 0
for i in range(n):
    t, d = map(int, input().split())
    nai.append([t,d])
nai = sorted(nai, key=lambda x: x[1], reverse = True)
for i in range(k):
    anstmp = nai.pop(0)
    if(anstmp[0] not in spe):
        ans.append(anstmp[1])
        spe.add(anstmp[0])
    else:
        aru.append(anstmp[1])

s = len(spe)
m = sum(ans) + sum(aru) + s**2
print(ans, aru, s)

for i in range(len(nai)):
    if(len(aru) == 0): break
    if(nai[i][0] not in spe):
        aru.pop()
        ans.append(nai[i][1])
        s += 1
        print(ans, aru, s)
    m = max(m, sum(ans) + sum(aru) + s**2)
print(m)


### FIXED CODE ###

n, k = map(int, input().split())
nai = [list(map(int, input().split())) for _ in range(n)]

nai = sorted(nai, key=lambda x: -x[1])

ans = 0
aru = []
spe = set()
m = 0
for i in range(k):
    anstmp = nai.pop(0)
    if(anstmp[0] not in spe):
        ans+=anstmp[1]
        spe.add(anstmp[0])
    else:
        aru.append(anstmp[1])
sumaru = sum(aru)
m = ans + sumaru + len(spe)**2

for i in range(len(nai)):
    if(len(aru) == 0): break
    if(nai[i][0] not in spe):
        sumaru-=aru.pop()
        ans+=nai[i][1]
        spe.add(nai[i][0])
    m = max(m, ans + sumaru + len(spe)**2)
print(m)
import sys
input=sys.stdin.readline

N,M = (int(x) for x in input().rstrip('\n').split())
As = [int(x) for x in input().rstrip('\n').split()]
ad = {x:As.count(x) for x in set(As)}
rest = M
for _ in range(M):
  m = max(ad.keys())
  x = ad[m]
  if x < rest:
    if m//2 in ad:
      ad[m//2] += x
    else:
      ad[m//2] = x
    del ad[m]
    rest -= x
  else:
    ad[m] -= rest
    if m//2 in ad:
      ad[m//2] += rest
    else:
      ad[m//2] = rest
    break
print(sum(x*y for x,y in ad.items()))

### FIXED CODE ###

import sys
input=sys.stdin.readline

N,M = (int(x) for x in input().rstrip('\n').split())
As = [int(x) for x in input().rstrip('\n').split()]
As = sorted(As,reverse = True)
rest = M
for _ in range(M):
  if rest == 0:
    break
  d = As[0]
  b = d//2 - d//4
  for i in range(N):
    a = As[i]
    check = 0
    if a-a//2<b:
      if rest > i:
        ad = [x//2 for x in As[:i]]
        As = As[i:]
        As.extend(ad)
        rest -= i
        check += 1
        As = sorted(As,reverse = True)
        break
      else:
        ad = [x//2 for x in As[:rest]]
        As = As[rest:]
        As.extend(ad)
        check += 1
        rest = 0
        break
    if i == N-1:
      if check == 0:
        if rest > N:
          As = [x//2 for x in As]
          rest -= N
        else:
          ad = [x//2 for x in As[:rest]]
          As = As[rest:]
          As.extend(ad)
          rest = 0
          break
print(sum(As))
S = inout()
T = input()

print(T + S)

### FIXED CODE ###

S,T = input().split()

print(T + S)
import math

def f(base, n):
    # 10進数 n を, base 進数に変換して各桁を足し合わせる
    lis = []
    while n > 0:
        # print('除', n // base, 'あまり', n % base)
        lis.append(n % base)
        n = n // base
    return sum(lis)


def solve():
    N, S = int(input()), int(input())
    # print(N, S)
 
    if N == S:
        return N + 1
 
    for b in range(2, int(math.sqrt(N)) + 1):
        if f(b, N) == S:
            return b
 
    largest = N + 2
    lowest = largest
    for p in range(1, int(math.sqrt(N)) + 1):
        buf = (N - S) / p
        if buf.is_integer():
            if f(buf + 1, N) == S:
                b = int(buf + 1)
                lowest = min(lowest, b)
 
    if not lowest == largest:
        return lowest
 
    return -1


if __name__ == '__main__':
    res = solve()
    print(res)


### FIXED CODE ###

import math


def f(base, n):
    # 10進数 n を, base 進数に変換して各桁を足し合わせる
    total = 0
    while n > 0:
        # print('除', n // base, 'あまり', n % base)
        total += n % base
        n = n // base
    return total


def solve():
    N, S = int(input()), int(input())
    # print(N, S)

    if N == S:
        return N + 1

    for b in range(2, int(math.sqrt(N)) + 1):
        if f(b, N) == S:
            return b

    largest = N**2
    lowest = largest
    for p in range(1, int(math.sqrt(N)) + 1):
        b = int((N - S) / p + 1)
        if b > 1 and f(b, N) == S:
            lowest = min(lowest, b)

    if not lowest == largest:
        return lowest

    return -1


if __name__ == '__main__':
    res = solve()
    print(res)
n = int(input())
c = list(input())

r = c.count("R")
g = c.count("G")
b = c.count("B")

ans = r*g*b
count  = 0
sub1 = 0

for i in range(n):
    for j in range(i+1,n):
        if 2*j-i >= n or 2*j-i <0:
            break
        elif c[2*j-i] != c[i] and c[i] != c[j] and c[2*j-i] != c[j]:
                sub1 += 1


print(ans-sub1)


### FIXED CODE ###

N = int(input());

if N%10 == 7:
  print("Yes")
elif (N - N%10)%100 == 70:
  print("Yes")
elif (N - N%100) == 700:
  print("Yes") 
else :
  print("No")