Harryxun/stf_run huggingface dataset:
Welcome to fish, the friendly interactive shell
kuwanakengo@kuwanakengonoMacBook ~/python> 
python3 test2.py 
kuwanakengo@kuwanakengonoMacBook ~/python> 
python3 test2.py
kuwanakengo@kuwanakengonoMacBook ~/python> 
kuwanakengo@kuwanakengonoMacBook ~/python> 
python3 test2.py
kuwanakengo@kuwanakengonoMacBook ~/python> 
python3 test2.py 3
10 40 70
20 50 80
30 60 90
fish: Unknown command 10
fish: 
10 40 70
^
fish: Unknown command 20
fish: 
20 50 80
^
fish: Unknown command 30
fish: 
30 60 90
^
kuwanakengo@kuwanakengonoMacBook ~/python> 
python3 test2.py
  File "test2.py", line 17
    dp[i][j] = max(dp[i-1][0], dp[i-1][1)+A[i][j]
                                        ^
SyntaxError: invalid syntax
kuwanakengo@kuwanakengonoMacBook ~/python> 
python3 test2.py
3
10 40 70
20 50 80
30 60 90
3
[[10, 40, 70], [20, 50, 80], [30, 60, 90]]
kuwanakengo@kuwanakengonoMacBook ~/python> 
python3 test2.py
3
10 40 70
20 50 80
30 60 90
Traceback (most recent call last):
  File "test2.py", line 18, in <module>
    print(mas(dp[n]))
NameError: name 'mas' is not defined
kuwanakengo@kuwanakengonoMacBook ~/python> 
python3 test2.py
3
10 40 70
20 50 80
30 60 90
Traceback (most recent call last):
  File "test2.py", line 18, in <module>
    print(max(dp[n]))
IndexError: list index out of range
kuwanakengo@kuwanakengonoMacBook ~/python> 
python3 test2.py
3
10 40 70
20 50 80
30 60 90
[[10, 40, 70], [90, 120, 120], [150, 180, 210]]
kuwanakengo@kuwanakengonoMacBook ~/python> python3 test2.py
3
10 40 70
20 50 80
30 60 90
210
kuwanakengo@kuwanakengonoMacBook ~/python> 

### FIXED CODE ###

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


dp = [['' for i in range(3)] for j in range(n)]
for i in range(n):
    if(i == 0):
        dp[i] = A[i]
        continue
    for j in range(3):
        if(j ==0):
            dp[i][j] = max(dp[i-1][1], dp[i-1][2])+A[i][j]
        elif(j ==1):
            dp[i][j] = max(dp[i-1][0], dp[i-1][2])+A[i][j]
        elif(j ==2):
            dp[i][j] = max(dp[i-1][0], dp[i-1][1])+A[i][j]

print(max(dp[n-1]))
n, y = map(int, input().split())

for i in range(int(round(y/10000, 0)) + 1):
    for j in range(int(round(y/5000, 0)) + 1):
        for k in range(int(round(y/1000, 0)) + 1):
            if i+j+k > n:
                break
            elif (10000*i) + (5000*j) + (1000*k) == y and i+j+k == n:
                print(i, j, k)
                exit()

print("-1 -1 -1")

### FIXED CODE ###

s = input()
print("2018{}".format(s[4::]))
n = int(input())

ans = [0] * 10010
for x in range(1,n//2):
    for y in range(1,n//2):
        for z in range(1,n//2):
            tmp = x*x + y*y + z*z + x*y + y*z + z*x
            ans[tmp] = ans[tmp] + 1

for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

n = int(input())

ans = [0] * 10050
for x in range(1,105):
    for y in range(1,105):
        for z in range(1,105):
            tmp = x*x + y*y + z*z + x*y + y*z + z*x
            if tmp<10050:
                ans[tmp] += 1

for i in range(n):
    print(ans[i+1])
yy,mm,dd =map(int,input().split('/'))
    x = 0
    if(yy<=2019):
      if(mm<=4):
        if(dd<=30):
         x = 1
     
    if(x == 1):
      print('Heisei')
    else:
      print('TBD')

### FIXED CODE ###

yy,mm,dd =map(int,input().split('/'))
x = 0
if(yy<=2019):
  if(mm<=4):
    if(dd<=30):
      x = 1
         
if(x == 1):
  print('Heisei')
else:
  print('TBD')
def calc():
  n=int(input())
  s=list(input())
  cnt1=0
  cnt2=0
  cnt3=0
  for i in range(n):
      if s[i]=='R':
          cnt1+=1
          s[i]=1
      elif s[i]=='G':
          cnt2+=1
          s[i]=2
      elif s[i]=='B':
          cnt3+=1
          s[i]=4
  ans=cnt1*cnt2*cnt3
  for i in range(n):
      for j in range(i+1,n):
        k=1*j-i
          if k>=n:
            continue
          if s[i]+s[j]+s[k]==7:
            ans-=1
  print(ans)
calc()

### FIXED CODE ###

n=int(input())
s=input()
cnt=[[0,0,0] for _ in range(n)]
for i in range(n):
    if s[i]=='R':
        cnt[i][0]+=1
    elif s[i]=='G':
        cnt[i][1]+=1
    elif s[i]=='B':
        cnt[i][2]+=1
acum=[[0,0,0]]
for i in range(n):
    tmp=[0,0,0]
    for j in range(3):
        tmp[j]+=acum[-1][j]
        tmp[j]+=cnt[i][j]
    acum.append(tmp)
ans=0
for i in range(n):
    for j in range(i+1,n):
        if s[i]==s[j]:
            continue
        if 'R' not in (s[i],s[j]):
            ans+=acum[-1][0]-acum[j][0]
            if 2*j-i<n and s[2*j-i]=='R':
                ans-=1
        elif 'G' not in (s[i],s[j]):
            ans+=acum[-1][1]-acum[j][1]
            if 2*j-i<n and s[2*j-i]=='G':
                ans-=1
        elif 'B' not in (s[i],s[j]):
            ans+=acum[-1][2]-acum[j][2]
            if 2*j-i<n and s[2*j-i]=='B':
                ans-=1
print(ans)
S = input()
if S == 'hi' or S == 'hihi' or S == 'hihihi' or S == 'hihihihi' or S == 'hihihihihi'
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S = input()
if S == 'hi' or S == 'hihi' or S == 'hihihi' or S == 'hihihihi' or S == 'hihihihihi':
    print('Yes')
else:
    print('No')
s=input()
n=len(s)-2
print(s[:1]+str(n)+s[-1:])

### FIXED CODE ###

s=input()
n=len(s)-2
print(s[:1]+str(n)+s[-1:])
import sys

sys.setrecursionlimit(10 ** 7)
# ----------

INF = float("inf")
MOD = 10 ** 9 + 7
# ----------

s = input().strip()
K = int(input())
N = len(s)

sub = set()
for i in range(N):
    for j in range(N):
        sub.add(s[i:j + 1])

print(sorted(sub)[K])


### FIXED CODE ###


S = input().strip()
K = int(input())
L = len(S)
substr = set()

for i in range(L):
    for j in range(5):
        s = S[i:min(i+j+1, L)]
        if s:
            substr.add(s)

print(sorted(substr)[K-1])
n, a, b = list(map(int, input().split()))
result = 0
if a + b != 0:
  roop = n // (a +b)
  extra = n - roop*(a+b)
  result = a*roop
  cycle = [1]*a +  [0]*b
  if extra != 0:
   result += sum(cycle[:extra]) 
print(result)

### FIXED CODE ###

n, a, b = list(map(int, input().split()))
result = 0
if a + b != 0:
  roop = n // (a +b)
  extra = n - roop*(a+b)
  result = a*roop
  if extra >= a:
    result += a
  else:
    result += extra
print(result)
n, M = map(int, input().split())
a = list(map(int, input().split()))
A = sum(A) / (4 * M)
N = sum(x >= A for x in A)
print('Yes' if n >= M else 'No')

### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(float, input().split()))
A = sum(a) / (4 * m)
N = sum(x >= A for x in a)
print('Yes' if N >= m else 'No')
def Main(A,B,C):

  if A == B:
    if C!=A:
      print("true")
    else:
      print("false")
  elif A == C:
    if B!=A:
      print("true")
    else :
      print("false")
  elif B == C:
    if A!=B :
      print("true")
    else:
      print("false")
  else:
    print("false")
A = int(input())
B = int(input())
C = int(input())
Main(A,B,C)


### FIXED CODE ###

def Main(A,B,C):

  if A == B:
    if C!=A:
      print("Yes",end="")
    else:
      print("No",end="")
  elif A == C:
    if B!=A:
      print("Yes",end="")
    else :
      print("No",end="")
  elif B == C:
    if A!=B :
      print("Yes",end="")
    else:
      print("No",end="")
  else:
    print("No",end="")
A,B,C = [int(num) for num in input().split(' ')]
Main(A,B,C)
n,m=map(int,input().split())
nexts=[None for i in range(n)]
for i in range(n):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  if nexts[a]==None:
    nexts[a]=[b]
  else:
    nexts[a].append(b)
  if nexts[b]==None:
    nexts[b]=[a]
  else:
    nexts[b].append(a)

ans=0
stack=[]
stack.append([0,set()])
while stack:
  node=stack.pop()
  v=node[0]
  seen=set(node[1])
  seen.add(v)
  if len(seen)==n:
    ans+=1
    continue
  childs=nexts[v]
  if childs:
    for child in (set(childs)-seen):
      stack.append([child,seen])
  
print(ans)


### FIXED CODE ###

n,m=map(int,input().split())
nexts=[None for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  if nexts[a]==None:
    nexts[a]=[b]
  elif b not in nexts[a]:
    nexts[a].append(b)
  if nexts[b]==None:
    nexts[b]=[a]
  elif a not in nexts[b]:
    nexts[b].append(a)

ans=0
stack=[]
stack.append([0,[]])
while stack:
  node=stack.pop()
  v=node[0]
  seen=node[1][:]
  seen.append(v)
  if len(seen)==n:
    ans+=1
    continue
  childs=nexts[v]
  if childs:
    for child in (set(childs)-set(seen)):
      stack.append([child,seen])
  
print(ans)
from collections import Counter
from math import gcd
n = int(input())
same, diff, zero_a, zero_b = 0, 0, 0, 0
same_cnt = Counter()
diff_cnt = Counter()

def change(a, b):
    x = gcd(a, b)
    return a // x, b // x

for _ in range(n):
    a, b = map(int, input().split())
    x = gcd(a, b)
    a, b = a // x, b // x
    if a == b == 0:
        continue
    elif a == 0:
        zero_a += 1
    elif b == 0:
        zero_b += 1
    elif a * b > 0:
        same += 1
        same_cnt[(abs(a), abs(b))] += 1
    else:
        diff += 1
        diff_cnt[(abs(a), -abs(b))] += 1


ans = 1
mod = 10 ** 9 + 7

for (a, b) in diff_cnt.keys():
    s = same_cnt[(-b, a)]
    d = diff_cnt[(a, b)]
    if s > 0:
        same -= s
        diff -= d
        ans = ans * (pow(2, s, mod) + pow(2, d, mod) - 1) % mod

ans = ans * pow(2, same + diff, mod)

ans = ans * (pow(2, zero_a, mod) + pow(2, zero_b, mod) - 1) - 1
print(ans)

### FIXED CODE ###

from collections import Counter
from math import gcd
import sys
input = sys.stdin.readline
n = int(input())
same, diff, zero_a, zero_b, zero_zero = 0, 0, 0, 0, 0
same_cnt = Counter()
diff_cnt = Counter()

for i in range(n):
    a, b = map(int, input().split())
    if a == b == 0:
        zero_zero += 1
    elif a == 0:
        zero_a += 1
    elif b == 0:
        zero_b += 1
    elif a * b > 0:
        x = gcd(a, b)
        a, b = a // x, b // x
        same += 1
        same_cnt[(abs(a), abs(b))] += 1
    else:
        x = gcd(a, b)
        a, b = a // x, b // x
        diff += 1
        diff_cnt[(abs(a), -abs(b))] += 1


ans = 1
mod = 10 ** 9 + 7

for (a, b) in diff_cnt.keys():
    s = same_cnt[(-b, a)]
    d = diff_cnt[(a, b)]
    if s > 0:
        same -= s
        diff -= d
        ans = ans * (pow(2, s, mod) + pow(2, d, mod) - 1) % mod

ans = ans * pow(2, same + diff, mod) % mod

ans = ans * (pow(2, zero_a, mod) + pow(2, zero_b, mod) - 1) - 1
print((ans + zero_zero) % mod)
a, b = int(input().split())
print(a * b)


### FIXED CODE ###

a, b = map(int, input().split())
print(a * b)
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args, **kwargs):
    print(*args, **kwargs, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B, C, K):
    ans = A - B if K % 2 == 0 else B - A
    if ans > 1e+18:
        return 'Unfair'
    return ans


def main():
    A, B, C, K = read_int_n()

    print(slv(A, B, C, K))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


# @mt
def slv(A, B, C, K):
    ans = A - B if K % 2 == 0 else B - A
    if abs(ans) > 1e+18:
        return 'Unfair'
    return ans


def main():
    A, B, C, K = read_int_n()

    print(slv(A, B, C, K))


if __name__ == '__main__':
    main()
if int(input()) == 1:
    print("Hello World")

else:	
    A=int(input())
	B=int(input())
	print(A+B)


### FIXED CODE ###

if int(input()) == 1:
    print("Hello World")

else:	
    A=int(input())
    B=int(input())
    print(A+B)
print("YNeos"[input()[0]=='s'||'k'::2])

### FIXED CODE ###

a,b=open(0);print("YNeos"[a[:-1]!=b[:-2]::2])
input().split()
s = int(a[0])
w = int(a[1])
 
if w >= s:
    print('unsafe')
else:
    print('safe')


### FIXED CODE ###

a = input().split()
s = int(a[0])
w = int(a[1])
 
if w >= s:
    print('unsafe')
else:
    print('safe')
import fractions
  
A,B,C,D= map(int,input().split())
 
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
 
CD=lcm(C, D)
 
dc =  B//C -  (A-1)//C
dd = B//D - (A-1)//D
dcd = B//CD - (A-1)//CD
 
print(B-A+1-dc-dd+dcd)

### FIXED CODE ###

S = input()
dif = False
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        dif=True
if dif:
    print("Bad")
else:
    print("Good")
import sys
from collections import deque
input = sys.stdin.readline

H,W = map(int,input().split())
D = [list(input()) for i in range(H)]
ans = 0

for i in range(H):
    for j in range(W):
        sy = i
        sx = j
        if D[sy][sx] == ".":
            Q = deque()
            Q.append((sx,sy))
            dist = [[-1]*W for i in range(H)]
            dist[sy][sx] = 0
            dx = [1,0,-1,0]
            dy = [0,-1,0,1]
            while Q:
                x,y = Q.popleft()
                if D[y][x] == "#":
                    d = dist[y][x]
                    ans = max(ans,d)
                    break
                for i in range(4):
                    nx = x+dx[i]
                    ny = y+dy[i]
                    if 0<=nx<=W-1 and 0<=ny<=H-1 and dist[ny][nx] == -1:
                        Q.append((nx,ny))
                        dist[ny][nx] = dist[y][x]+1

print(ans)

### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
A = [input() for i in range(H)]
X = [1,0,-1,0]
Y = [0,-1,0,1]

INF = 99999
dp = [[-1]*W for i in range(H)]
q = deque()
for y, row in enumerate(A):
  for x,c in enumerate(row):
    if c == "#":
      dp[y][x] = 0
      q.append((y,x))
while q:
  y,x = q.popleft()
  d = dp[y][x]
  for i in range(4):
    nx = x + X[i]
    ny = y + Y[i]
    if (0 <= nx < W) and (0 <= ny < H) and (dp[ny][nx] == -1):
      dp[ny][nx] = d + 1
      q.append((ny,nx))
print(max(max(row) for row in dp))
N,M = map(int,input().split())
X = list(map(int,(input().split())))

X.sort()

memo = dict()
def get_min(n,x):
    key = str((n,x))
    tmp = memo.get(key,None)
    if tmp != None:
        return tmp
    if x == []:
        tmp = 10**8
        memo[key] = tmp
        return tmp
    elif len(x) == 1:
        memo[key] = 0
        return 0
    x0 = x[0]
    if n == 1:
        tmp = x[-1]-x0
        memo[key] = tmp
        return tmp
    tmp = min([y - x0 + get_min(n-1,x[i+1:]) for i,y in enumerate(x)])
    memo[key] = tmp
    return tmp

print(get_min(N,X))

### FIXED CODE ###

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

X.sort()

dif_X = [X[i+1]-x for i,x in enumerate(X[:-1])]
dif_X.sort()
print(sum(dif_X[:max(0,M-N)]))
from collections import deque
from math import sqrt

N = int(input())
step = deque()

for i in range(1, int(sqrt(N))):
    if N % i == 0:
        step.append(i - 1 + N // i - 1)

print(min(step))

### FIXED CODE ###

from collections import deque
from math import sqrt

N = int(input())
step = deque()

for i in range(1, int(sqrt(N)) + 1):
    if N % i == 0:
        step.append(i - 1 + N // i - 1)

print(min(step))
N=int(input())
word=[]
for i in range(N):
  word.append(input())
  
alphalist=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
numlist=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]


alphalist=[]
alpha=[[] for i in range(N)]
for i in range(N):
  word0=word[i]
  for v in range(10):
    alpha[i].append(word0[i])
  alpha[i].sort()
  alphalist.append(alpha[i])


number=0
for i in range(N):
  freq=alphalist.count(alphalist[i])
  if freq!=1:
    number0=(freq*(freq-1))/2
    number0=number0/freq
    number+=number0
  
print(int(number))

### FIXED CODE ###

n = int(input())
s = [input()for _ in range(n)]

for i in range(n):
    s[i] = ''.join(sorted(s[i]))

s.sort()

ans = 0
count = 0

for i in range(1, n):
    if count == 0:
        if s[i] == s[i-1]:
            count = 2
    else:
        if s[i] == s[i-1]:
            count += 1
        else:
            ans += count * (count - 1) // 2
            count = 0

ans += count * (count - 1) // 2

print(ans)
import sys
input = sys.stdin.readline
import numpy as np
sys.setrecursionlimit(1000000000)

N, Q = list(map(int, input().split()))
graph = [[] for i in range(N)]
# 最初にroot pointを定めて:
# graph構造に大して点を与える...
for i in range(N-1):
    a, b = list(map(int, input().split()))
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

points = np.zeros(N, dtype=int)
for _ in range(Q):
    p, x = list(map(int, input().split()))
    points[p-1] += x

visited = np.zeros(N, dtype=bool)
tot_points = np.zeros(N, dtype=int)
tot_points[0] = points[0]
top_nodes = np.full(N, -1, dtype=int)

nodes = graph[0]
top_nodes[nodes] = 0
old_node = 0
visited[0] = True


def dfs(old_node, node):
    if visited[node]:
        return
    tot_points[node] = tot_points[old_node] + points[node]
    visited[node] = True
    nodes = graph[node]
    while len(nodes):
        dfs(node, nodes.pop())
while len(nodes):
    dfs(0, nodes.pop())
    

for x in tot_points.tolist():
    print(x, end=" ")
    
    

### FIXED CODE ###

import sys
from queue import deque
input = sys.stdin.readline

def main():
    N, Q = list(map(int, input().split()))
    graph = [[] for i in range(N)]
    # 最初にroot pointを定めて:
    # graph構造に大して点を与える...
    for i in range(N-1):
        a, b = list(map(int, input().split()))
        graph[a-1].append(b-1)
        graph[b-1].append(a-1)
    
    points = [0] * N
    for _ in range(Q):
        p, x = list(map(int, input().split()))
        points[p-1] += x
    
    visited = [False] * N
    
    nodes = deque([0])

    while nodes:
        node = nodes.pop()
        visited[node] = True
        for _node in graph[node]:
            if visited[_node]:
                continue
            points[_node] += points[node]
            nodes.append(_node)
    
    print(*points)
    
main()
import sys
input = sys.stdin.buffer.readline

def main():
    n, m, k = map(int,input().split())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))

    asum = [0]*(n+1)
    bsum = [0]*(m+1)

    for i in range(n):
        asum[i+1] = asum[i] + a[i]

    for i in range(m):
        bsum[i+1] = bsum[i] + b[i]

    cnt = 0
    t = 0
    res = 0

    bb = 0
    for i in range(m):
        while bb < m and asum[i] + bsum[bb+1] <= k:
            cnt += 1
            t += bsum[bb+1] - bsum[bb]
            bb += 1

        res += (bb - i)

        if bb == i:
            bb += 1
        else:
            t -= asum[i]
            cnt -= 1

    print(res)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

def main():
    n, m, k = map(int,input().split())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))

    asum = [0]*(n+1)
    bsum = [0]*(m+1)

    for i in range(n):
        asum[i+1] = asum[i] + a[i]

    for i in range(m):
        bsum[i+1] = bsum[i] + b[i]

    # jを小さくしていく発想がなかった
    j = m
    res = 0
    for i in range(n+1):
        # asumの分岐をさせてからbsumとの和を考えていく
        if asum[i] > k:
            break
        while asum[i] + bsum[j] > k:
            j -= 1
        
        res = max(res, j+i)
    print(res)


if __name__ == '__main__':
    main()
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
X = [0,0,0]

m = 10**9+7
patern = 1

for a in A:
    patern *= X.count(a)
    patern %= m
    X[X.index(a)]+=1
    

print(patern % m)
    


### FIXED CODE ###

import sys,math,collections,itertools
input = sys.stdin.readline
 
N=int(input())
A=list(map(int,input().split()))
color1 = -1
color2 = -1
color3 = -1
 
m = 10**9+7
patern = 1
 
for a in A:
    if color1 == a-1 and color2 == a-1 and color3 == a-1:
        patern = (patern * 3)%m
        color1 = a
 
    elif (color1 != a-1 and color2 == a-1 and color3 == a-1):
        patern = (patern * 2)%m
        color2 = a
 
    elif (color1 == a-1 and color2 == a-1 and color3 != a-1):
        patern = (patern * 2)%m
        color1 = a
    elif (color1 == a-1 and color2 != a-1 and color3 != a-1):
        color1 = a
 
    elif (color1 != a-1 and color2 == a-1 and color3 != a-1):
        color2 = a
 
    elif (color1 != a-1 and color2 != a-1 and color3 == a-1):
        color3 = a
 
    elif (color1 != a-1 and color2 != a-1 and color3 != a-1):
        patern = 0
        break
print(patern)
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(1,n+1):
  if l[i-1]>l[i]:
     m.append(l[i-1]-l[i])
    l[i] = l[i-1]

print(sum(m))
  


### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(n-1):
  if l[i]>l[i+1]:
     m.append(l[i]-l[i+1])
     l[i+1] = l[i]

print(sum(m))
import iterools

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

for i in range(n):
  if i == len(n)-1:
    print(1)
  else:
    combos = itertools.combinations(a, i)
    print(len(set(combos)))

### FIXED CODE ###

import itertools

N = int(input())
A = list(map(int, input().split()))

MOD = 10**9 + 7
MAX_NUM = 10**5 + 10

def inv_mod(n):
  return pow(n, MOD-2, MOD)

FACTS = [1 for _ in range(MAX_NUM+1)]
for n in range(1, MAX_NUM+1):
  FACTS[n] = (n*FACTS[n-1]) % MOD

INV_FACTS = [1 for _ in range(MAX_NUM+1)]
INV_FACTS[MAX_NUM] = inv_mod(FACTS[MAX_NUM])
for n in range(MAX_NUM-1, -1, -1):
  INV_FACTS[n] = (INV_FACTS[n+1]*(n+1)) % MOD
  
for i in range(MAX_NUM+1):
  assert (FACTS[i]*INV_FACTS[i])%MOD == 1

def ncr(n, r):
  if r > n:
    return 0
  if r < 0:
    return 0
  # C(n, r) = n!/(n-r)!r!
  ans = FACTS[n]*INV_FACTS[n-r]*INV_FACTS[r]
  return ans % MOD

from collections import defaultdict
v2i = defaultdict(list)
for i, v in enumerate(A):
  v2i[v].append(i)

fst, snd = -1, -1
for v in v2i:
  if len(v2i[v]) == 2:
    fst, snd = v2i[v]

K = snd - fst - 1
for ell in range(1, N+2):
  ans = ncr(N+1, ell) - ncr(N-1-K, ell-1)
  print(ans%MOD)
a, b, k= map(str, input().split(" "))
for i in range(k):
    if a > 0:
        a-=1
    elif b > 0:
        b-=1
print(a, b)

### FIXED CODE ###

a, b, k= map(int, input().split(" "))
if a > k:
    a -= k
else:
    k-=a
    a = 0
    if b > k:
        b-=k
    else:
        b = 0

print(a, b)
N,M = map(int,input().split())
A = list(map(int,input().split()))
k = 0
for i in range(N-1):
    if A[i]/sum(A) > 1/(4*M):
        k = k+1

if k >= M:
    print('Yes')
else:
    peint('No')

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
k = 0
for i in range(N):
    if A[i]/sum(A) >= 1/(4*M):
        k = k+1

if k >= M:
    print('Yes')
else:
    print('No')