Harryxun/stf_run huggingface dataset:
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

n = int(input())
a = is_prime(n)
if a:
    print(1)
else:
    ans = 0
    con = 2
    while True:
        if n % con == 0:
            ans +=1
            n = n // con
            b = is_prime(n)
        if n == 1 or b:
            break
        con +=1
    print(ans)

### FIXED CODE ###

import math


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = int(input())
a = factorization(n)
if a[0][0] == 1:
    print(0)
else:
    b = []
    c = [0,1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190]
    for i in range(len(a)):
        b.append(a[i][1])
    ans = 0
    for i in range(len(b)):
        for j in range(len(c)):
            if b[i] == c[j]:
                ans +=j
                break
            elif b[i] < c[j]:
                ans += j-1
                break
                
    print(ans)
N = int(input())

if N==1:
  ans = 0
elif N==2:
  ans = 1:
else:
  ans = ((N-1)*N)//2 + N%2
  print(ans)
  
print(ans)
  
  
  

### FIXED CODE ###

N = int(input())

if N==1:
  ans = 0
elif N==2:
  ans = 1
else:
  ans = ((N-1)*N)//2
  
print(ans)
S = str(input())
T = str(input())

if .S == T:
  print(Yes)
else:
  No


### FIXED CODE ###

S = str(input())
T = str(input())
t = int(len(T)) - 1
U = T[:t]

if S == U:
  print('Yes')
else:
  print('No')
a = int(input())
)
a = int(a ** 3)
print(a)



### FIXED CODE ###

a = int(input())

b = int(a + a ** 2 + a ** 3)
print(b)
a,b,c,d = input()
pirnt("Yes",if a==b==c or b==c==d else "No")

### FIXED CODE ###

abcd = list(input())
print("Yes") if abcd[2]==abcd[3]==abcd[1] or abcd[0]==abcd[1]==abcd[2] else print("No")
n=int(input())
a=[ 0 for _ in range (10000)]
for i in range(100):
  for j in range(100):
    for k in range(100):
      v=i**2+j**2+k**2+i*j+j*k+k*i
      if v<=10000:
        a[v]+=1
for m in range(n):
  print(a[m+1])

### FIXED CODE ###

n=int(input())
a=[0]*10001
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      v=i**2+j**2+k**2+i*j+j*k+k*i
      if v<10001:
        a[v]+=1
for m in range(n):
  print(a[m+1])
# -*- coding: utf-8 -*-
# モジュールのインポート
import math


def get_input() -> tuple:
    """
    標準入力の取得

    Returns:\n
        tuple: 標準入力
    """
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    return N, K, A


def main(N: int, K: int, A: list) -> None:
    """
    求解処理.

    Args:
        N (int): 町の数
        K (int): テレポーターの使用回数
        A (list): テレポーターの転送先
    """
    # タブリング表の作成
    to = [A]
    for i in range(math.ceil(math.log2(K))):
        to_i = to[i]
        to_next = []
        # 使用する場合のみ、要素を入れておく
        if ((K >> i) & 1):
            for j in range(N):
                to_next.append(to_i[to_i[j]-1])

        to.append(to_next)

    result = 1
    for i in range(math.ceil(math.log2(K))):
        if ((K >> i) & 1):
            result = to[i][result-1]

    print(result)


if __name__ == "__main__":
    N, K, A = get_input()
    main(N, K, A)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# モジュールのインポート
import math


def get_input() -> tuple:
    """
    標準入力の取得

    Returns:\n
        tuple: 標準入力
    """
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    return N, K, A


def main(N: int, K: int, A: list) -> None:
    """
    求解処理.

    Args:
        N (int): 町の数
        K (int): テレポーターの使用回数
        A (list): テレポーターの転送先
    """
    # タブリング表の作成
    to = [A]
    for i in range(math.ceil(math.log2(K))):
        to_i = to[i]
        to_next = []
        for j in range(N):
            to_next.append(to_i[to_i[j]-1])

        to.append(to_next)

    result = 1
    for i in range(math.ceil(math.log2(K))):
        if ((K >> i) & 1):
            result = to[i][result-1]

    print(result)


if __name__ == "__main__":
    N, K, A = get_input()
    main(N, K, A)
import itertools


c = list(itertools.product(range(10), repeat=4))

if __name__ == '__main__':
    for line in sys.stdin.readlines():
        print sum([l for l in c if int(n) == sum(l)])

### FIXED CODE ###

import sys


for n in sys.stdin:
    ret = 0
    for a in xrange(10):
        for b in xrange(10):
            for c in xrange(10):
                for d in xrange(10):
                    if a+b+c+d == int(n):
                        ret += 1
    print ret
import heapq
n=int(input())
x=[]
y=[]
for i in range(n):
  xx,yy=map(int,input().split())
  x.append([xx,i])
  y.append([yy,i])
x=sorted(x)
y=sorted(y)
px=[]
py=[]
for i in range(n-1):
  px.append([x[i+1][0]-x[i][0],x[i][1],x[i+1][1]])
  py.append([y[i+1][0]-y[i][0],y[i][1],y[i+1][1]])
p=px+py
heapq.heapify(p)
r=[i for i in range(n)]
def root(x):
  if x==r[x]:
    return x
  else:
    r[x]=root(r[x])
    return r[x]
def union(x,y):
  rx=root(x)
  ry=root(y)
  if rx==ry:
    return
  else:
    r[rx]=ry
ans=0
while p:
  path=heapq.heappop(p)
  if root(path[1])==root(path[2]):
    continue
  union(path[1],path[2])
  ans+=path[0]
print(ans)

### FIXED CODE ###

n=int(input())
x=[]
y=[]
for i in range(n):
  xx,yy=map(int,input().split())
  x.append([xx,i])
  y.append([yy,i])
x.sort()
y.sort()
px=[]
py=[]
for i in range(n-1):
  px.append([x[i+1][0]-x[i][0],x[i][1],x[i+1][1]])
  py.append([y[i+1][0]-y[i][0],y[i][1],y[i+1][1]])
p=px+py
x=[]
y=[]
px=[]
py=[]
p.sort()
r=[i for i in range(n)]
rank=[1 for i in range(n)]
def root(x):
  if x==r[x]:
    return x
  else:
    r[x]=root(r[x])
    return r[x]
def union(path):
  rx=root(path[1])
  ry=root(path[2])
  if rx==ry:
    return 0
  else:
    if rank[rx]>rank[ry]:
      r[rx]=ry
      rank[rx]+=rank[ry]
    else:
      r[ry]=rx
      rank[ry]+=rank[rx]
    return path[0]
ans=0
for i in range(len(p)):
  ans+=union(p[i])
print(ans)
N, M = [int(i) for i in input().split()]
parent = [i for i in range(N+1)]
node_num = [1 for i in range(N+1)]
def find(x):
    if parent[x] == x:
        return x
    else:
        parent[x] = find(parent[x])
        return parent[x]

bridge = []
for i in range(M):
    A, B = [int(i) for i in input().split()]
    bridge.append([A, B])

bridge = bridge[::-1]
ans_rev = [N*(N-1)//2]
combi = 0
for i in range(M-1):
    A, B = bridge[i]
    r_A = find(A)
    r_B = find(B)
    if r_A != r_B:
        parent[r_B] = r_A
        combi += node_num[r_B] * node_num[r_A]
        node_num[r_A] += node_num[r_B]
    ans_rev.append(N*(N-1)//2-combi)

ans = ans_rev[::-1]
print(*ans, sep="\n")


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

N, M = [int(i) for i in input().split()]
parent = [i for i in range(N+1)]
node_num = [1 for i in range(N+1)]
def find(x):
    if parent[x] == x:
        return x
    else:
        parent[x] = find(parent[x])
        return parent[x]

bridge = []
for i in range(M):
    A, B = [int(i) for i in input().split()]
    bridge.append([A, B])

bridge = bridge[::-1]
ans_rev = [N*(N-1)//2]
combi = 0
for i in range(M-1):
    A, B = bridge[i]
    r_A = find(A)
    r_B = find(B)
    if r_A != r_B:
        parent[r_B] = r_A
        combi += node_num[r_B] * node_num[r_A]
        node_num[r_A] += node_num[r_B]
    ans_rev.append(N*(N-1)//2-combi)

ans = ans_rev[::-1]
print(*ans, sep="\n")
import numpy as np

class Tropical():
    def __init__(self, values):
        self.values = values

    def __add__(self, x):
        return min(self.values, x.values)

    def __mul__(self, x):
        return self.values + x.values

    def Tropical_sum(self):
        return min(self.values)

# INF
INF = float('inf')
Infty = Tropical(INF)

# Tropical Product
def Tropical_Product(A, B):
    return [[(lambda x: Tropical(x).Tropical_sum())(list(map(lambda x: Tropical(x[0]) * Tropical(x[1]), zip(A[i], [[B[j][i] for j in range(len(B))] for i in range(len(B))][j])))) for j in range(len(A))] for i in range(len(B))]

def Tropical_Pow(A, num):
    tmp = A
    B = A
    for _ in range(num-1):
        B = Tropical_Product(B,tmp)
    return B

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

Z = np.zeros((N,N))
Z = Z.full((N,N),INF)
for i in range(N+1):
    for j in range(i+1,i+3):
        #print(i,j)
        if j <= N:
            print(i,j)
            if abs(i-j)==1 and i+1 < N:
                Z[i][j] = abs(h[i]-h[i+1])
            elif abs(i-j)==2 and i+2 < N:
                Z[i][j] = abs(h[i]-h[i+2])

for i in range(N):
    tmp = Tropical_Pow(Z,i)
    if tmp[0][-1] != INF:
        print(int(tmp[0][-1]))
        exit()

### FIXED CODE ###

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

# input
N = int(input())
h = list(map(int, input().split()))

# dp table
dp = [float('inf')]*(10**5 + 10)

# 初期条件
dp[0] = 0

for i in range(1,N):
    dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i > 1:
        dp[i] = chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

# ans
print(dp[N-1])
H, W, M = map(int, input().split())

X = [0] * W
Y = [0] * H
Map = [[0] * W for _ in range(H)]

for _ in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    Y[h] += 1
    X[w] += 1
    Map[h][w] = 1

MX = max(X)
MY = max(Y)
ans = MX + MY - 1
Xans = []
Yans = []
for i, x in enumerate(X):
    if x == MX:
        Xans.append(i)
for i, y in enumerate(Y):
    if y == MY:
        Yans.append(i)
flag = False
for x in Xans:
    if flag:
        break
    for y in Yans:
        if Map[y][x] == 0:
            ans += 1
            flag = True
            break
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

H, W, M = map(int, input().split())

X = [0] * W
Y = [0] * H
Map = []

for _ in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    Y[h] += 1
    X[w] += 1
    Map.append((h, w))

MX = max(X)
MY = max(Y)
ans = MX + MY
Xans = set()
Yans = set()
for i, x in enumerate(X):
    if x == MX:
        Xans.add(i)
for i, y in enumerate(Y):
    if y == MY:
        Yans.add(i)
cnt = 0
for h, w in Map:
    if h in Yans and w in Xans:
        cnt += 1
if cnt == len(Xans) * len(Yans):
    ans -= 1
print(ans)
# -*- coding: utf-8 -*-

a, b = map(str, raw_input().split())
result = ''
if a == ‘H’:
	if b== ‘H’:
		result = ‘H’
	else:
		result = ‘D’
else:
	if b==‘H’
		result=‘D’
	else:
		result=‘H'

# 出力
print result

### FIXED CODE ###

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

a, b = map(str, raw_input().split())
result = ''
if a == 'H':
    if b== 'H':
       	result = 'H'
    else:
	result = 'D'
else:
    if b=='H':
        result='D'
    else:
	result='H'

# 出力
print result
a,b,t=map(int,input().split())
ans=0
ans=(((t+0.5)//a)*b
print(int(ans))

### FIXED CODE ###

a,b,t=map(int,input().split())
ans=int(((t+0.5)//a)*b)
print(ans)
from collections import deque
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A = sorted(A)
B = deque()
C = deque()
mod = (10**9)+7
for h in range(N):
    B.append(A[h])
    C.append(A[h])


def cmb(n, r):  # 【Python】組み合わせ(nCr) 計算の高速化より引用
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


mod = 10**9+7  # 出力の制限
N_cmb = 10**4
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for ZZZ in range(2, N_cmb + 1):
    g1.append((g1[-1] * ZZZ) % mod)
    inverse.append((-inverse[mod % ZZZ] * (mod//ZZZ)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


ans = 0
for i in range(N):
    if N - i >= K:
        kari = cmb((N - i - 1), K-1) % mod
        # print(kari)
        ans += (kari * B.pop()) % mod
        ans -= (kari * C.popleft()) % mod
        ans = ans % mod
print(ans)


### FIXED CODE ###

from collections import deque
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A = sorted(A)
B = deque()
C = deque()
mod = (10**9)+7
for h in range(N):
    B.append(A[h])
    C.append(A[h])


def cmb(n, r):  # 【Python】組み合わせ(nCr) 計算の高速化より引用
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


N_cmb = 10**5
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for ZZZ in range(2, N_cmb + 1):
    g1.append((g1[-1] * ZZZ) % mod)
    inverse.append((-inverse[mod % ZZZ] * (mod//ZZZ)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


ans = 0
for i in range(N):
    if N - i >= K:
        kari = cmb(N - i - 1, K-1) % mod
        # print(kari)
        ans += (kari * B.pop()) % mod
        ans -= (kari * C.popleft()) % mod
        ans = ans % mod
print(ans)
N = int(input())
R = int(input())
if 0 <= R <= 4111:
    if 10 <= N <= 100:
        print(R)
    else:
        K = 100 * (10 - N)
        M = R + K
        print(M)

### FIXED CODE ###

NR= input().split()
N= int (NR[0])
R= int (NR[1])
if (N >= 10):
    print(R)
else:
    print (R+100*(10-N))
x = int(input())
if 360 % x == 0:
    print(360 // x)
else:
    common = 360 * x // math.gcd(360, x)
    ans = common // x
    print(ans)

### FIXED CODE ###

import math

x = int(input())
if 360 % x == 0:
    print(360 // x)
else:
    common = 360 * x // math.gcd(360, x)
    ans = common // x
    print(ans)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import gcd

n = int(readline())
a = list(map(int, readline().split()))
b = a[::-1]
cumsum_m = [0] * (n - 1)
cumsum_p = [0] * (n - 1)
cumsum_m[0] = b[0]
cumsum_p[0] = a[0]
for i in range(1, n - 1):
    cumsum_p[i] = gcd(cumsum_p[i - 1], a[i])
    cumsum_m[i] = gcd(cumsum_m[i - 1], b[i])
ans = max(cumsum_m.pop(), cumsum_p.pop())
for p, m in zip(cumsum_p, cumsum_m[::-1]):
    v = gcd(p, m)
    if ans < v:
        ans = v
print(ans)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

n, *a = map(int, read().split())
b = a[::-1]
cumsum_m = [0] * (n - 1)
cumsum_p = [0] * (n - 1)
cumsum_m[0] = b[0]
cumsum_p[0] = a[0]
for i in range(1, n - 1):
    cumsum_p[i] = gcd(cumsum_p[i - 1], a[i])
    cumsum_m[i] = gcd(cumsum_m[i - 1], b[i])
ans = max(cumsum_m.pop(), cumsum_p.pop())
for p, m in zip(cumsum_p, cumsum_m[::-1]):
    v = gcd(p, m)
    if ans < v:
        ans = v
print(ans)
### A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if abs(A-B) < abs(W-V)*T:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if abs(A-B) <= (V-W)*T:
    print("YES")
else:
    print("NO")
N,M=map(int,input().split())
Islands=[[] for i in range(N)]
Edge=[]
S=0
for i in range(M):
  a,b,c=map(int,input().split())
  Islands[a-1].append([b-1,c])
  Islands[b-1].append([a-1,c])
  Edge.append([a-1,b-1])
for m in range(M):
  a=Edge[m][0]
  b=Edge[m][1]
  for i in Islands[a]:
    if i[0]==b:
      c_m=i[1]
  List=[[a,-1]]
  for l in List:
    c=(-1)*(l[-1]+1)
    if l[-2]==b:
      if c_m>c:
        S+=1
        break
    else:        
      for n in Islands[l[-2]]:
        if n[0] in l:
          pass
        else:
          c+=n[1]
          del l[-1]
          List.append(l+[n[0],(-1)*(c+1)])
          
print(S)      

### FIXED CODE ###

N,M=map(int,input().split())
Islands=[[10**9]*N for i in range(N)]
Edge=[]
S=0
for i in range(M):
  a,b,c=map(int,input().split())
  Islands[a-1][b-1]=c
  Islands[b-1][a-1]=c
  Edge.append([a-1,b-1,c])
for k in range(N):
  for i in range(N):
    for j in range(N):
      Islands[i][j]=min(Islands[i][j],Islands[i][k]+Islands[k][j])

ans=0
for a,b,c in Edge:
  if Islands[a][b]!=c:
    ans+=1
print(ans)
import sys

N,K,C=map(int,input().split())

S=list(input())
left=[0]*N
right=[0]*N

if S[0]=="o":
    left[0]=1
for i in range(1,C+1):
    left[i]=left[i-1]
    if S[i]=="o":
        left[i]=1
for i in range(C+1,N):
    if S[i]=="o":
        left[i]=max(left[i-1],left[i-C-1]+1)
    else:
        left[i]=left[i-1]

if S[-1]=="o":
    right[-1]=1
for i in range(N-2,N-C-2,-1):
    right[i]=right[i+1]
    if S[i]=="o":
        right[i]=1
for i in range(N-C-2,-1,-1):
    if S[i]=="o":
        right[i]=max(right[i+1],right[i+C+1]+1)
    else:
        right[i]=right[i+1]

data=[]
for i in range(N):
    if S[i]=="o":
        L=i-C-1
        R=i+C+1
        num=1
        if L>=0:
            num+=left[L]
        if R<N:
            num+=right[R]
        if num>K:
            sys.exit()
        if num==K:
            data.append(i)

for i in range(len(data)):
    if i==0:
        if data[i+1]-data[i]>C:
            print(data[i]+1)
    elif i==len(data)-1:
        if data[i]-data[i-1]>C:
            print(data[i]+1)
    else:
        if data[i+1]-data[i]>C and data[i]-data[i-1]>C:
            print(data[i]+1)
            

### FIXED CODE ###

import sys

N,K,C=map(int,input().split())

S=list(input())
if C>=N-1:
    if K==1:
        if S.count("o")>=2:
            sys.exit()
        else:
            print(S.index("o")+1)
            sys.exit()
    else:
        sys.exit()
    
    
left=[0]*N
right=[0]*N

if S[0]=="o":
    left[0]=1
for i in range(1,C+1):
    left[i]=left[i-1]
    if S[i]=="o":
        left[i]=1
for i in range(C+1,N):
    if S[i]=="o":
        left[i]=max(left[i-1],left[i-C-1]+1)
    else:
        left[i]=left[i-1]

if S[-1]=="o":
    right[-1]=1
for i in range(N-2,N-C-2,-1):
    right[i]=right[i+1]
    if S[i]=="o":
        right[i]=1
for i in range(N-C-2,-1,-1):
    if S[i]=="o":
        right[i]=max(right[i+1],right[i+C+1]+1)
    else:
        right[i]=right[i+1]

data=[]
for i in range(N):
    if S[i]=="o":
        L=i-C-1
        R=i+C+1
        num=1
        if L>=0:
            num+=left[L]
        if R<N:
            num+=right[R]
        if num>K:
            sys.exit()
        if num==K:
            data.append(i)

for i in range(len(data)):
    if i==0:
        if data[i+1]-data[i]>C:
            print(data[i]+1)
    elif i==len(data)-1:
        if data[i]-data[i-1]>C:
            print(data[i]+1)
    else:
        if data[i+1]-data[i]>C and data[i]-data[i-1]>C:
            print(data[i]+1)
a,b,k=map(int,input().split())
print(max(0,A-K),max(0,B-max(0,K-A)))

### FIXED CODE ###

a,b,k=map(int,input().split())
print(a-k,b) if a>=k else print(0,b-k+a) if a+b>=k else print(0,0)
N = int(input())
H = list(map(int, input().split()))
k = 0
m = 0
for i in range(N-1):
    while H[i] >= H[i+1]:
        i += 1
        m += 1
    if k < m:
        k = m
    m = 0
print(k)


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
k = 0
m = 0
for i in range(N):
    if k < m:
        k = m
    if i != N - 1 and H[i] >= H[i+1]:
        m += 1
    else:
        m =0
print(k)
def solve(string):
    ins = string.split("\n")
    h, w = map(int, ins[0].split(" "))
    a = [list(map(int, _i.split(" "))) for _i in ins[1:]]
    move = []
    cnt = 0
    for j in range(h):
        for i in range(w):
            if a[j][i] % 2 == 0:
                continue
            a[j][i] -= 1
            if i < w - 1:
                a[j][i + 1] += 1
                move.append("{} {} {} {}".format(j + 1, i + 1, j + 1, i + 2))
                cnt += 1
            elif j < h - 1:
                a[j + 1][i] += 1
                move.append("{} {} {} {}".format(j + 1, i + 1, j + 2, i + 1))
                cnt += 1
    return "{}\n{}".format(cnt, "\n".join(move)) if cnt else str(cnt)


if __name__ == '__main__':
    line = input()
    tmp = [line]
    for _ in range(int(line[0])):
        tmp.append(input())
    print(solve('\n'.join(tmp)))


### FIXED CODE ###

h,w = map(int,input().split())
a = []
for i in range(h):
    tmp = list(map(lambda x:int(x)%2,input().split()))
    a.append(tmp)
result = []
 
for i in range(h):
    for j in range(w-1):
        if a[i][j] == 1:
            #a[i][j] == 0
            a[i][j+1] = 1 ^ a[i][j+1]
            result.append((i+1,j+1,i+1,j+2)) 
for i in range(h-1):
    if a[i][w-1] == 1:
        a[i+1][w-1] = 1 ^ a[i+1][w-1]
        result.append((i+1,w,i+2,w))
print(len(result))
for row in result:
    print("{} {} {} {}".format(row[0],row[1],row[2],row[3]))
N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
INF = 10**9

def dfs(cur,a,b,c):
    if(cur == N):
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c)>0 else INF
    ret0 = dfs(cur+1, a, b, c)
    re1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b+l[cur],c)+10
    ret3 = dfs(cur + 1,a,b,c+l[cur])+10
    return min(ret0,ret1,ret2,ret3)
print(dfs(0,0,0,0))

### FIXED CODE ###

N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
INF = 10**9

def dfs(cur,a,b,c):
    if(cur == N):
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c)>0 else INF
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b+l[cur],c)+10
    ret3 = dfs(cur + 1,a,b,c+l[cur])+10
    return min(ret0,ret1,ret2,ret3)
print(dfs(0,0,0,0))
s = input()
w = input()

if s <= w:
    print('unsafe')
else:
    print('safe')

### FIXED CODE ###

s ,w = map(int, input().split())

if s <= w:
    print('unsafe')
else:
    print('safe')
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]

roots = [(i,1) for i in range(N+1)] # root, num_islands_in_group

inconveniences = [0]*(M+1)
inconveniences[-1] = N*(N-1)//2 #すべての橋が崩落するとNC2

def find_root(a, roots=roots):
  if roots[a][0] == a:
    return roots[a]
  else:
    roots[a] = find_root(roots[a][0])
  return roots[a]

def reduce_inconvenience_with_unite(a, b, roots=roots):
  root_a, n_a = find_root(a)
  root_b, n_b = find_root(b)
  if root_a == root_b:
    return 0
  else:
    if n_a > n_b:
      roots[root_a] = (root_a, n_a + n_b)
      roots[root_b] = (root_a, n_a + n_b)
    else:
      roots[root_a] = (root_b, n_a + n_b) 
      roots[root_b] = (root_b, n_a + n_b)
    return n_a * n_b

for i, ab in enumerate(AB[:0:-1]): #実は1個めの橋は全く関係ない
  a, b = ab
  inconveniences[M-1-i] = inconveniences[M-i] - reduce_inconvenience_with_unite(a,b)

for inc in inconveniences[1:]:
  print(inc)


### FIXED CODE ###

import math


A, B, C = list(map(int, input().split()))

print(min(math.floor(B/A), C))
str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for index in range(len(str)):
  if str[index] in allow:
    count = count + 1
  else:
    ans.append(count)
    count = 0
print(sorted(ans)[-1])

### FIXED CODE ###

str = input()
ans = []
allow = ["A","C","G","T"]
count = 0
for s in str:
  if s in allow:
    count = count + 1
    ans.append(count)
  else:
    count = 0
    
if len(ans) == 0:
  print(0)
else:
  print(sorted(ans)[-1])
H, M = map(int,input().split())
l = [H, M]

max = max(l)
min = min(l)

if max == min:
  if max % 2 == 0:
    N = (H * M) / 2
  else:
    N = ((H * M) - 1)/2)+1

else:
  r = max - min
  r2 = max - r
  r3 = r * min
  if r2 % 2 == 0:
    n1 = (r2 * r2) / 2
  else:
    n1 = (((r2 * r2) - 1)/2)+1
 
  if r3 % 2 == 0:
    n2 = r3 / 2
  else:
    n2 = (r3 - 1) / 2

  N = n1 + n2

print(N)

### FIXED CODE ###

H, M = map(int,input().split())
l = [H, M]

max = max(l)
min = min(l)

if min == 1:
  N = 1
  
else:
  if max == min:
    if max % 2 == 0:
      N = (H * M) / 2
    else:
      N = (((H * M) - 1)/2)+1

  else:
    r = max - min
    r2 = max - r
    r3 = r * min
    if r2 % 2 == 0:
      n1 = (r2 * r2) / 2
    else:
      n1 = (((r2 * r2) - 1)/2)+1
 
    if r3 % 2 == 0:
      n2 = r3 / 2
    else:
      n2 = (r3 - 1) / 2

    N = n1 + n2
    
print(int(N))
s = input()

a = s[0]
b =len(s[1:len(s)-1])
c = s[-1]

print(a+b+c)


### FIXED CODE ###

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

print((n-1)*(m-1))
imp = imput()
alp = ['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']
print(alp[alp.index(str(imp)) + 2])

### FIXED CODE ###

imp = input()
alp = ['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']
print(alp[alp.index(imp) + 1])