Harryxun/stf_run huggingface dataset:
import math
N ,X = list(map(int,input().strip().split()))
xlist = list(map(int,input().strip().split()))
abs_xlist = list(map(lambda x:abs(X - x), xlist))
abs_xlist.sort()
ans = abs_xlist[0]

for i in range(N):
    if abs_xlist[i] % ans != 0:
        num = math.gcd(xlist[i],ans)
        ans = min(num,ans)
print(ans)


### FIXED CODE ###

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

N ,X = list(map(int,input().strip().split()))
xlist = list(map(int,input().strip().split()))
abs_xlist = list(map(lambda x:abs(X - x), xlist))
abs_xlist.sort()
ans = abs_xlist[0]

for i in range(N):
    if abs_xlist[i] % ans != 0:
        num = gcd(abs_xlist[i],ans)
        ans = min(num,ans)
print(ans)
n=input()
l=[]
for i in range(n):
  l.append(int(input()))
print(len(set(l)))
        

### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
  l.append(int(input()))
print(len(set(l)))
import re

S = input()
xs = list(S)

i, j = 0, 1
while j < len(xs):
    if xs[i] != xs[j]:
        xs[i:j + 1] = []
        i -= 1
        j = i + 1
    else:
        i += 1
        j += 1
print(len(S) - len(xs))


### FIXED CODE ###

S = input()

xs = [S[0]]
for c in S[1:]:
    if xs and xs[-1] != c:
        xs.pop()
    else:
        xs.append(c)
print(len(S) - len(xs))
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

int main(void){
    int H,W;
    scanf("%d%d",&H,&W);

    char map[H][W+1];
    for(int i=0;i<H;i++) scanf("%s",map[i]);

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            int flg=0;
            if(map[i][j]=='#'){
                if(i>0 && map[i-1][j]=='#') flg=1;
                if(i<H-1 && map[i+1][j]=='#') flg=1;
                if(j>0 && map[i][j-1]=='#') flg=1;
                if(j<W-1 && map[i][j+1]=='#') flg=1;
                if(!flg){
                    printf("No\n");
                    return 0;
                }
            }
        }
    }
    
    printf("Yes\n");

    return 0;
}

### FIXED CODE ###

#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

s = ['.'*(W+2)]
for i in range(H):
    row = input()
    s.append('.' + row + '.')
s.append('.'*(W+2))

flg = 1
for i in range(1,H+1):
    for j in range(1,W+1):
        if s[i][j] == "#":
            if s[i-1][j] == "." and s[i+1][j] == "." and s[i][j-1] == "." and s[i][j+1] == ".":
                flg = 0

if flg:
    print("Yes")
else:
    print("No")
prime = sieve_of_eratosthenes(2*10**5+1)
g = gcd_list(A)
if g != 1: print('not coprime');exit();

for p in prime:
  cnt = 0
  for a in A:
    if a%p == 0: cnt += 1
    if cnt == 2:
      print('setwise coprime')
      exit()
print('pairwise coprime')


### FIXED CODE ###

import math
from functools import reduce

def gcd_list(numbers):
  return reduce(math.gcd, numbers)

N=int(input())
A=list(map(int,input().split()))
mA = max(A)
D = [-1]*(mA+1)
D[0]=1
D[1]=1
for i in range(2,mA+1):
  if D[i] != -1: continue
  D[i] = i
  cnt = 2*i
  while cnt < mA+1:
    if D[cnt] == -1:
      D[cnt]=i
    cnt += i
done = set()
for a in A:
  tmp = set()
  while a > 1:
    tmp.add(D[a])
    a //= D[a]
  if len(done&tmp) > 0:
    if gcd_list(A) == 1: print('setwise coprime')
    else: print('not coprime')
    exit()
  done |= tmp
print('pairwise coprime')
import math
mod=1000000007
N,M=map(int,input().split())
if abs(N-M)>1:
  print(0)
else:
  n=math.factorial(N)
  m=math.factorial(M)
if n==m:
  print(2*n*m%mod)
else:
  print(n*m%mod) 

### FIXED CODE ###

import math
mod=1000000007
N,M=map(int,input().split())
if abs(N-M)>1:
  print(0)
else:
  n=math.factorial(N)
  m=math.factorial(M)
  if n==m:
    print(2*n*m%mod)
  else:
    print(n*m%mod)
import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))

	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = np.array([])
	for i in range(N):
		ans = np.append(ans, np.dot(dam, index_))
		index_ = np.roll(index_, 1)
	ans = [str(int(i)) for i in ans]

	print(' '.join(ans))

### FIXED CODE ###

N, A, B = map(int, input().split())
if N*A < B:
	print(N*A)
else :
	print(B)
a=input()
b=input()


if (int(a)*int(b))%2 ==0:
    print('Even')
else:
    print('Odd')


### FIXED CODE ###

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


if (a*b)%2 ==0:
    print('Even')
else:
    print('Odd')
AB, BC, CA = int(input())

print((AB * BC) // 2)


### FIXED CODE ###

AB, BC, CA = map(int, input().split())

print((AB * BC) // 2)
n,k = map(int, input().split())
 
str = input()
print(str[0])
happy = 0
unhappy = 0
hashi = 0
 
for i in range(n-1):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
if(str[0] != str[1] and str[n-1] != str[n-2]):
  hashi = 2
if(str[n-1] != str[n-2] or str[0] != str[1]):
  hashi = 1
if(k >= 2):
  print(happy + 2 * k - hashi)
if(k == 1):
  print(happy + 2 * k - hashi * k)

### FIXED CODE ###

n,k = map(int, input().split())
 
str = input()
happy = 0
unhappy = 0
 
for i in range(n-1):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
print( min(n-1,(happy + 2 * k )))

# 10 1
# LLLLLRRRRRの時、happy + 2 * kだけやったら10になるけど、幸福になる人数は最高でも9人(n-1人)
import math

a, b = map(int, input().split())
gcd = math.gcd(a, b)
if gcd == 0:
    print(0)
else:
    result = int(a*b / gcd)
    print(result)


### FIXED CODE ###

from fractions import gcd
import sys
sys.setrecursionlimit(100000)

a, b = map(int, input().split())
gcd = gcd(a, b)
if gcd <= 0:
    print(0)
else:
    result = int(a*b / gcd)
    print(result)
a=map(int,input().split(" "))
Ai=map(int,input().split(" "))
n=a[0]
days=0
for i in range(a[1]):
    days+=Ai[i]
if days>n:
    print(-1)
else:
    print(n-days)

### FIXED CODE ###

n,m=map(int,input().split(" "))
Ai=list(map(int,input().split(" ")))
days=0
for a in Ai:
    days+=a
if days>n:
    print(-1)
else:
    print(n-days)
a=int(input())
b=int(input())
Z=[1,2,3]
X=Z.remove(a,b)

print(X)

### FIXED CODE ###

a=int(input())
b=int(input())
Z=[1,2,3]
Z.remove(a)
Z.remove(b)

print(Z[0])
n = int(raw_input())
hs = [int(x) for x in raw_input().split()]
if n == 1:
  return hs[0]
dp = [0]*n
dp[0] = hs[0]
dp[1] = abs(hs[1] - hs[0])
if n == 2:
  return dp[1]

for i in range(2, n):
  dp[i] = min(dp[i-1] - hs[i], dp[i-2] - hs[i])

print(dp[-1])


### FIXED CODE ###

a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])
a, b, c = [int(x) for x in input().split()]

from math import gcd

def foo(a, b, c):
    if a == 1:
        return "YES"
    elif b == 1:
        return "NO"
    elif gcd(a, b) ==1:
        return "NO"
    else:
        return "YES"
    
print(foo(a, b, c))

### FIXED CODE ###

a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j] == "#" and s[i - 1][j] != "#" and s[i][j - 1] != "#" and s[i + 1][j] != "#" and s[i][j + 1] != "#":
            print("No")
            exit()
print("Yes")

### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
ans = "Yes"
for i in range(1, h - 1):
    for j in range(1, w - 1):
        if s[i][j] == "#" and s[i-1][j] == "." and s[i][j-1] == "." and s[i+1][j] == "." and s[i][j+1] == ".":
            ans = "No"
print(ans)
# -*- coding:utf-8 -*-
import copy

INF = 2*(10**8)+1
memo = INF  # メモ化用変数

def solve():
    N, K = list(map(int, input().split(" ")))
    X = [0]
    X.extend(list(map(int, input().split(" "))))
    X.sort()


    def dfs(depth, cost, i, Xs):
        global memo
        if depth == K:
            memo = min(cost, memo)
            return cost
        
        if cost > memo:
            # 探索を打ち切る
            return INF
        
        ret1, ret2 = INF, INF
        if i+1 < len(Xs):
            # 右に移動
            tmpCost = abs(Xs[i] - Xs[i+1])
            tmpXs = copy.deepcopy(Xs)
            del tmpXs[i]
            ret1 = dfs(depth+1, cost+tmpCost, i, tmpXs)
        if i-1 >= 0:
            # 左に移動
            costCost = abs(Xs[i] - Xs[i-1])
            tmpXs = copy.deepcopy(Xs)
            del tmpXs[i]
            ret2 = dfs(depth+1, cost+tmpCost, i-1, tmpXs)
        
        return min(ret1, ret2)

    # 0座標のインデックスは？
    for i in range(len(X)):
        if X[i] == 0:
            break
    ans = dfs(0, 0, i, X)
    print(ans)


if __name__ == "__main__":
    solve()

### FIXED CODE ###

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

"""解説
https://www.youtube.com/watch?v=5O4k1n5Ejzw

区間を考える問題

-30 -10 0 10 20 50

・K = 3のとき、

0座標を必ず含める、ある連続するK個のロウソクについて考える

・-30 -10 0 10
・-10 0 10 20
・0 10 20 50

左端と右端に到達する最小値を求めていけばよくて、間のロウソクは無視してよい（必ず移動中に火をつけるので）

すべての場合について求めて、その中の最小値が答え
"""
def solve():
    N, K = list(map(int, input().split()))
    X = list(map(int, input().split()))
    if 0 in X:
        # 0座標にロウソクがあるなら、火をつけるロウソクをひとつ減らしてよい
        K -= 1
    else:
        X.append(0)
    X.sort()

    origin_i = X.index(0)
    left_i = max(origin_i-K, 0)

    INF = 10**12
    ans = INF
    while left_i <= origin_i:
        if left_i+K < len(X):
            tmp1 = abs(X[left_i]-0)*2 + abs(X[left_i+K]-0)
            tmp2 = abs(X[left_i]-0) + abs(X[left_i+K]-0)*2
        else:
            break
        ans = min(ans, tmp1, tmp2)
        left_i += 1
    print(ans)

if __name__ == "__main__":
    solve()
a = ["Sunny", "cloudy", "Rainy"]
s = input()
for i in range(0, 3):
  if s == a[i]:
    print(a[(i+1)/3])


### FIXED CODE ###

a = ["Sunny", "Cloudy", "Rainy"]
s = input()
for i in range(0, 3):
  if s == a[i]:
    print(a[(i+1)%3])
import sys
import heapq


def dfs(u,s,target, vs):
    vs[u] = 1
    if(u == target):
        global h
        heapq.heappush(h,s)
        return
    for j in range(e):
        if(e_1[j] == u):
            if(vs[e_2[j]] != 1):
                count = s + e_w[j]
                print(s,e_2[j],vs)
                dfs(e_2[j],count,target,vs[0:])

def dijsktra(start, v, e):
    d = [0]*v
    prev = [0]*v
    v_q=[[] for i in range(v)];

    INF = 9999999999999999999
    for u in range(v):
        if(u != start):
            d[u] = INF
        else:
            d[u] = 0 
        prev[u] = -1
        heapq.heappush(v_q[u],d[u])

    

    while(True):
        min = INF
        for i in range(len(v_q)):
            if(len(v_q[i]) != 0):
                if(min > v_q[i][0]):
                    min = v_q[i][0]
                    u = i
        heapq.heappop(v_q[u])
        if(min == (INF)):
            break
        for j in range(e):
            if(u == e_1[j]):
                alt = d[u]+e_w[j]
                if(d[e_2[j]] > alt):
                    d[e_2[j]] = alt
                    prev[e_2[j]] = u
                    heapq.heappush(v_q[e_2[j]],alt)

    for i in range(v):
        if(d[i] != INF):
            print(d[i])
        else:
            print("INF")

v,e,r=map(int, input().split());

e_1=[0]*e;
e_2=[0]*e;
e_w=[0]*e;

for i in range(e):
    e_1[i], e_2[i], e_w[i] = map(int, input().split());

dijsktra(r,v,e)



### FIXED CODE ###

import sys
from collections import deque

v,e,r=map(int, input().split());

edge_info=[0]*v;
for i in range(v):
    edge_info[i] = []

for i in range(e):
    e1, e2, w = map(int, input().split());
    edge_info[e1].append((e2,w))

v_q=deque();

INF = 9999999999999999999
d = [INF for i in range(v)]
d[r] = 0
v_q.append((0,r))
while(len(v_q) != 0):
    cost,u = v_q.popleft()
    if(cost > d[u]):
        continue
    for j in range(len(edge_info[u])):
        e2,w = edge_info[u][j]
        alt = cost+w
        if(d[e2] > alt):
            d[e2] = alt
            v_q.append((alt,e2))

for i in range(v):
    if(d[i] != INF):
        print(d[i])
    else:
        print("INF")
N,K=map(int,input().split())
A=list(map(int,input().split()))
MOD=10**9+7
ans=0
C=[0 for _ in range(N+1)]
for i in range(N-1):
    for j in range(i+1,N):
        a=A[j]-A[i]
        if a<0:
            #ans+=1
            C[A[i]]+=1
D=[0 for i in range(N+1)]
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        a=A[i]-A[j]
        if a>0:
            D[A[i]]+=1
x=A[0]-A[-1]
if x<0:
    #ans+=1
    C[A[0]]+=1
for i in range(len(C)):
    a=K*C[i]%MOD
    ans+=a
k=(K*(K-1))//2
k=k%MOD
for i in range(len(D)):
    b=k*D[i]%MOD
    ans+=b
print(ans%MOD)

### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
MOD=10**9+7
ans=0
C=[0 for _ in range(max(A)+1)]
for i in range(N-1):
    for j in range(i+1,N):
        a=A[j]-A[i]
        if a<0:
            #ans+=1
            C[A[i]]+=1
D=[0 for i in range(max(A)+1)]
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        a=A[i]-A[j]
        if a>0:
            D[A[i]]+=1

for i in range(len(C)):
    a=K*C[i]%MOD
    ans+=a
k=(K*(K-1))//2
k=k%MOD
for i in range(len(D)):
    b=k*D[i]%MOD
    ans+=b
print(ans%MOD)
N=int(input())
d=list(map(int,input().split()))

ans=0
for i in range(N-1):
    for j in range(i+1,N):
        ans+=d[i]*d[j]
print(result)

### FIXED CODE ###

N=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(N-1):
    for j in range(i+1,N):
        ans+=d[i]*d[j]
print(ans)
# エラトステネスの篩, フェルマーの小定理
from math import sqrt


def mpow(x, n):
    result = 1
    while n != 0:
        if n & 1 == 1:
            result *= x
            result %= 1000000007
        x *= x
        x %= 1000000007
        n >>= 1
    return result


max_A = 1000000

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

sieve = [0] * (max_A + 1)
sieve[0] = -1
sieve[1] = -1
for i in range(2, int(sqrt(max_A)) + 1):
    if sieve[i] != 0:
        continue
    sieve[i] = i
    for j in range(i * i, max_A + 1, i):
        if sieve[j] == 0:
            sieve[j] = i

lcm_factors = {}
for i in range(N):
    t = []
    a = A[i]
    while a != 1:
        if len(t) != 0 and t[-1][0] == sieve[a]:
            t[-1][1] += 1
        else:
            t.append([sieve[a], 1])
        a //= sieve[a]
    for k, v in t:
        if k not in lcm_factors or lcm_factors[k] < v:
            lcm_factors[k] = v

lcm = 1
for k in lcm_factors:
    for i in range(lcm_factors[k]):
        lcm *= k
        lcm %= 1000000007

result = 0
for i in range(N):
    result += lcm * mpow(A[i], 1000000007-2)
    result %= 1000000007
print(result)


### FIXED CODE ###

def mpow(x, n):
    result = 1
    while n != 0:
        if n & 1 == 1:
            result *= x
            result %= 1000000007
        x *= x
        x %= 1000000007
        n >>= 1
    return result


max_A = 1000000

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

sieve = [0] * (max_A + 1)
sieve[0] = -1
sieve[1] = -1
for i in range(2, max_A + 1):
    if sieve[i] != 0:
        continue
    sieve[i] = i
    for j in range(i * i, max_A + 1, i):
        if sieve[j] == 0:
            sieve[j] = i

lcm_factors = {}
for i in range(N):
    t = []
    a = A[i]
    while a != 1:
        if len(t) == 0:
            t.append([sieve[a], 1])
        elif t[-1][0] == sieve[a]:
            t[-1][1] += 1
        else:
            t.append([sieve[a], 1])
        a //= sieve[a]
    for k, v in t:
        if k not in lcm_factors or lcm_factors[k] < v:
            lcm_factors[k] = v

lcm = 1
for k in lcm_factors:
    for i in range(lcm_factors[k]):
        lcm *= k
        lcm %= 1000000007

result = 0
for i in range(N):
    result += lcm * mpow(A[i], 1000000007-2)
    result %= 1000000007
print(result)
n = int(input())
for i in range(2,10):
  while n%i == 0:
    n = n/i
if n==1:
  print("Yes)
else:
        print("No")

### FIXED CODE ###

n = int(input())
for i in range(1,10):
    if n%i == 0:
        if n//i in range(1,10):
            print("Yes")
            break
else:
    print("No")
from itertools import chain,repeat
K,N = map(int,input().split())

def dec(seq):
  if seq[-1] == 1:
    seq.pop()
  else:
    seq[-1] -= 1
    if len(seq) < N:
      seq += list(repeat(K,N-len(seq)))
  return seq

if K % 2 == 0:
  print(' '.join(chain((K-1,),repeat(K,N-1))))
else:
  seq = list(repeat(K//2+1,N))
  d = (N-1)//2
  for _ in range(d+1):
    seq = dec(seq)
  print(' '.join(map(str, seq)))


### FIXED CODE ###

from itertools import chain,repeat
K,N = map(int,input().split())

def solve():

  if K % 2 == 0:
    return ' '.join(map(str, chain((K//2,),repeat(K,N-1))))
  else:
    seq = [K//2+1]*N
    d = N//2
    for _ in range(d):
      if seq[-1] == 1:
        seq.pop()
      else:
        seq[-1] -= 1
        seq.extend(repeat(K,N-len(seq)))
    return ' '.join(map(str, seq))

def naive():
  from itertools import product
  s = sorted(chain.from_iterable(product(range(1,K+1),repeat=i) for i in range(1,N+1)))
  return ' '.join(map(str, s[(len(s)-1)//2]))

print(solve())
# print(naive())
i=input;i();l=i().split();x=1-('0'in l)
for j in l:
  x*=j-48
  if x>1e18:
    print(-1);quit()
print(x)


### FIXED CODE ###

i = input
i()
x = 1
l = i().split()
if '0' in l:
    print(0)
    quit()
for j in l:
    x *= int(j)
    if x > 1e18:
        print(-1)
        quit()
print(x)
import copy
def warshall_floyd(dist):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                dist[i][j] = min(dist[i][j],
                              dist[i][k] + dist[k][j])
    return dist

n, m, l = map(int, input().split()) #N:頂点数　M:辺の数 L:容量
dist = [[float("inf") for i in range(n)] for j in range(n)]
dist2 = copy.deepcopy(dist) 
for i in range(n):
    dist[i][i] = 0

for i in range(m):
    a, b, c = map(int, input().split())
    dist[a-1][b-1] = c
    dist[b-1][a-1] = c

warshall_floyd(dist)


for i in range(n):
    for j in range(n):
        if dist[i][j] <= l:
            dist2[i][j] = 1

warshall_floyd(dist2)
q = int(input())
for i in range(q):
    s, t = map(int, input().split())
    ans = dist2[s-1][t-1]-1
    if dist2[s-1][t-1] == float("inf"):
        ans = -1
    print(ans)

### FIXED CODE ###

A, B = input().split()
A = int(A)
B = int(B)

if (B*2) >= A:
    print(0)
else:
    print(A-(B*2))
S=input()
Sc=S.count("R")
SSc=S.count("RR")
if Sc==3:
  print(3)
elif SSc=1:
  print(2)
elif Sc==0:
  print(0)
else:
  print(1)

### FIXED CODE ###

S=input()
Sc=S.count("R")
SSc=S.count("RR")
if Sc==3:
  print(3)
elif SSc==1:
  print(2)
elif Sc==0:
  print(0)
else:
  print(1)
import math
K = int(input())      
ans = 0           
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += math.gcd(a,b,c)
print(ans)

### FIXED CODE ###

import math
K = int(input())      
ans = 0           
for a in range(1,K+1):
    for b in range(1,K+1):
        g = math.gcd(a,b)
        for c in range(1,K+1):
            ans += math.gcd(g,c)
print(ans)
A, B, C, K = (int(x) for x in input().split())
tmp = [1] * A + [0] * B + [-1] * C
ans = 0
for k in range(K):
    ans += tmp[k]
print(ans)

### FIXED CODE ###

A, B, C, K = (int(x) for x in input().split())
if A >= K:
    ans = K
else:
    ans = A
    tmp = K - A
    if B >= tmp:
        pass
    else:
        tmp = tmp - B
        ans += tmp * (-1)
print(ans)
import itertools
R,G,B,N = map(int, input().split())
count = 0
Rc = [i * R for i in range(0, int(N / R) +1)]
Gc = [i * G for i in range(0, int(N / G) +1)]
#Bc = [i * B for i in range(0, int(N / B) +1)]
#print(Rc)
#print(Gc)
#print(Bc)
for r in Rc :
    if r == N :
        p#rint(r)
        count += 1
    else :
        for g in Gc :
            if r + g == N :
                #print(r, g)
                count += 1
            elif r + g > N :
                break
            else :
                if (N - r + g) > B and (N - r + g) % B == 0 :
                    #print(N, r,g)
                    count += 1
print(count)

### FIXED CODE ###

R,G,B,N = map(int, input().split())
count = 0
for r in range(N // R + 1) :
    for g in range((N - r*R) // G + 1) :
        if (N - r*R - g*G) %B == 0 :
            count += 1
print(count)
import math
A, B = [int(x) for x in input().split()]


def lcm(x, y):
    return (x*y)//math.gcd(A,B)
print(lcm(A,B))


### FIXED CODE ###

from fractions import gcd
A, B = [int(x) for x in input().split()]


def lcm(x, y):
    return (x*y)//gcd(A,B)
print(lcm(A,B))
a,b=map(int,input()split())
print("Yes" if a%2 and b%2 else "No")

### FIXED CODE ###

a,b=map(int,input().split())
print("Yes" if a%2 and b%2 else "No")
s = input()
def dfs(i,f,sum):
  if i == 3:
    if sum == 7:
      print(f + "=7")
      exit()
  dfs(i+1,f + "+" + s[i+1],sum+int(s[i+1]))
  dfs(i+1,f + "-" + s[i+1],sum-int(s[i+1]))
dfs(0,s[0],int(s[0]))

### FIXED CODE ###

s = input()
def dfs(i,f,sum):
  if i == 3:
    if sum == 7:
      print(f + "=7")
      exit()
  else:
    dfs(i+1,f + "+" + s[i+1],sum+int(s[i+1]))
    dfs(i+1,f + "-" + s[i+1],sum-int(s[i+1]))
dfs(0,s[0],int(s[0]))
N = int(input())

counts = [0] * 10001
for i in range(1, 311):
    for j in range(1, i + 1):
        for k in range(1, j + 1):
            result = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if result > 10000:
                continue
            if i == j and j == k:
                counts[result] += 1
            elif i == j or j == k:
                counts[result] += 3
            else:
                counts[result] += 6

for n in range(1, N + 1):
    print(counts[n])

### FIXED CODE ###

L, R, d = map(int, input().split())

a = L // d
b = R // d
ans = b - a

if (L % d == 0) and (R % d == 0):
    ans += 1
print(ans)
#import sys
#input = sys.stdin.readline


def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    return gcd(b, a % b)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    gcdA = [0]*n
    gcdB = [0]*n
    gcdA[0] = A[0]
    gcdB[0] = A[n-1]
    for i in range(1, n):
        gcdA[i] = gcd(A[i], gcdA[i-1])
        gcdB[i] = gcd(A[n-i-1], gcdB[n-1])
    ans = max(gcdA[n-2], gcdB[1])
    for i in range(1, n):
        ans = max(ans, gcd(gcdA[i-1], gcdB[i+1]))
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#import sys
#input=sys.stdin.readline

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    return gcd(b, a % b)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    gcdA = [0]*n
    gcdB = [0]*n
    gcdA[0] = A[0]
    gcdB[n-1] = A[n-1]
    for i in range(1, n):
        gcdA[i] = gcd(A[i], gcdA[i-1])
        gcdB[n-i-1] = gcd(A[n-i-1], gcdB[n-i])
    ans = max(gcdA[n-2], gcdB[1])
    for i in range(1, n-1):
        ans = max(ans, gcd(gcdA[i-1], gcdB[i+1]))
    print(ans)


if __name__ == "__main__":
    main()
N, M = map(int, input().split())
X = [0 for _ in range(N)]
if N % 2 == 0:
    l, r = 0, 1
    for i in range(M):
        X[l] = 1
        X[r] = 1
        print(l+1, r+1)
        while X[l] != 0 or X[(l+i+2)%N]:
            l += 1
        r = (l + i + 2) % N
else:
    for i in range(M):
        print(N-i-1, i+1)


### FIXED CODE ###

N, M = map(int, input().split())
X = [0 for _ in range(N)]
if N % 2 == 0:
    X = [0 for _ in range((N-1)//2)]
    l, r = 1, N // 2
    for i in range((N//2)//2):
        X[i] = [l, r]
        l += 1
        r -= 1
    l, r = N, N // 2 + 2
    for i in range((N-1)//2-(N//2)//2):
        X[i+(N//2)//2] = [l, r]
        l -= 1
        r += 1
    for i in range(M):
        print(X[i][0], X[i][1])
else:
    for i in range(M):
        print(N-i, i+1)
n,l = input().split()
n = int(n)
s = []
for i in range(n):
    s.append(input())
s.sort()
print(s[0]+s[1]+s[2])


### FIXED CODE ###

n,l = input().split()
n = int(n)
s = []
for i in range(n):
    s.append(input())
s.sort()
print("".join(s))
for i in range(1, 10):
	for j in range(1, 10):
		print "%dx%d=%d" % (i, j, i*j)

### FIXED CODE ###

#coding: UTF-8

for i in range(1, 10):
	for j in range(1, 10):
		print "%dx%d=%d" % (i, j, i*j)