Harryxun/stf_run huggingface dataset:
# 入力
R, C, K = map(int, input().split())
point_map = [[0 for _ in range(C+1)] for _ in range(R+1)]
max_point = [[[0 for _ in range(4)] for _ in range(C + 1)]
             for _ in range(R + 1)]
maxmax_point = [[0 for _ in range(C + 1)] for _ in range(R + 1)]


for i in range(K):
    _r, _c, _k = map(int, input().split())
    point_map[_r][_c] = _k

for i in range(1, R+1):
    itemss = [[]]
    im = i-1
    for j in range(1, C + 1):
        jm = j - 1
        mxi = max_point[i]
        mxij = mxi[j]
        mxijm = mxi[jm]
        point = point_map[i][j]
        mxij[0] = max(
            mxijm[0], maxmax_point[im][j])
        if point == 0:
            mxij[1] = mxijm[1]
            mxij[2] = mxijm[2]
            mxij[3] = mxijm[3]
        else:
            itemss = [[]] + [items + [point]
                             for items in itemss]  # items[1] アイテム一つ
            itemss_len = len(itemss)
            #print(i, j, itemss)

            mxij[1] = max(
                mxijm[0] + point, maxmax_point[i - 1][j]+point)
            mxij[2] = mxijm[1] + point

            if itemss_len > 4:
                items = itemss[4]  # 4 こアイテムがあるやつ
                del_item = min(items)
                items.remove(del_item)
                sa = mxijm[3] - del_item
                #print("aaaaa", sa, mxijm[2])
                if sa > mxijm[2]:
                    mxij[3] = sa + point
                    itemss = itemss[:3] + [items]
                else:
                    mxij[3] = mxijm[2] + point
                    itemss = itemss[:4]
            else:
                mxij[3] = mxijm[2] + point

            #print(i, j, itemss)

        #[print(i, j, n, mxij[n])
        # for n in range(len(mxij))]
        maxmax_point[i][j] = max(mxij)
        #print(i, j, maxmax_point[i][j])

print(maxmax_point[R][C])


### FIXED CODE ###

ss = input().split('S')
m = 0
for li in ss:
  m = max(m,len(li))
  
print(m)
A,B,K = map(int,input().split())
l = list(range(A,B+1)) 
if B-A+1 <= 2*(K+1):
  for e in l:
    print(e)
elif B-A+1 > 2*(K+1):
  del l[K:-K]
  for e in l:
    print(e)

### FIXED CODE ###

A,B,K = map(int,input().split())
if B - A + 1 <= 2 * K:
    l = list(range(A,B + 1))
else:
    l1 = list(range(A,A + K))
    l2 = list(range(B - K + 1,B + 1))
    l = l1 + l2
for e in l:
    print(e)
N, K = map(int, input().split())
xyc = [[int(i) for i in input().split()] for _ in range(N)]

def check(n) :
  global K
  for i in range(N) :
    xi, yi, ci = xyc[i]
    ri = n / ci
    for j in range(i + 1, N) :
      xj, yj, cj = xyc[j]
      xj -= xi
      yj -= yi
      rj = n / cj
      a = (xj ** 2 + yj ** 2 + ri ** 2 - rj ** 2) / 2
      root = (xj ** 2 + yj ** 2) * (ri ** 2) - a ** 2
      if root + eps < 0 : continue
      for sgn in [1, -1] :
        cnt = 0
        X = (a * xj + sgn * yj * (root ** 0.5)) / (xj ** 2 + yj ** 2) + xi
        Y = (a * yj - sgn * xj * (root ** 0.5)) / (xj ** 2 + yj ** 2) + yi
        for x, y, c in xyc :
          if (x - X) ** 2 + (y - Y) ** 2 <= (n / c) ** 2 + eps :
            cnt += 1
        if cnt >= K :
          return True
  
  for X, Y, _ in xyc :
    cnt = 0
    for x, y, c in xyc :
      if (x - X) ** 2 + (y - Y) ** 2 + eps <= (n / c) ** 2 :
        cnt += 1
    if cnt >= K :
      return True
      
  return False

eps = 1e-7
ng, ok = -1, 10 ** 6
while ok - ng > eps :
  n = (ng + ok) / 2
  if check(n) :
    ok = n
  else :
    ng = n
 
print(ok)

### FIXED CODE ###

N, K = map(int, input().split())
xyc = [[int(i) for i in input().split()] for _ in range(N)]

def check(n) :
  for i in range(N) :
    xi, yi, ci = xyc[i]
    ri = n / ci
    for j in range(i + 1, N) :
      xj, yj, cj = xyc[j]
      xj -= xi
      yj -= yi
      rj = n / cj
      a = (xj ** 2 + yj ** 2 + ri ** 2 - rj ** 2) / 2
      root = max(0, (xj ** 2 + yj ** 2) * (ri ** 2) - a ** 2) ** 0.5
      for sgn in [1, -1] :
        cnt = 0
        X = (a * xj + sgn * yj * root) / (xj ** 2 + yj ** 2) + xi
        Y = (a * yj - sgn * xj * root) / (xj ** 2 + yj ** 2) + yi
        for x, y, c in xyc :
          if (x - X) ** 2 + (y - Y) ** 2 <= (n / c) ** 2 + eps :
            cnt += 1
        if cnt >= K :
          return True
  
  for X, Y, _ in xyc :
    cnt = 0
    for x, y, c in xyc :
      if (x - X) ** 2 + (y - Y) ** 2 <= (n / c) ** 2 + eps :
        cnt += 1
    if cnt >= K :
      return True
      
  return False

eps = 1e-8
ng, ok = 0, 10 ** 6
while ok - ng > eps :
  n = (ng + ok) / 2
  if check(n) :
    ok = n
  else :
    ng = n
 
print(ok)
x, y = map(int, input().split(" "))
print(x * y + " " + (x + y) * 2)

### FIXED CODE ###

a, b = map(int, raw_input().split())
print(str(a * b) + " " + str((a + b) * 2))
k=int(input())
if k%2==0 k%5==0:
    print(-1)
    exit()
a=0
for i in range(k):
    a=(a*10+7)%k
    if a==0:
        print(i+1)
        exit()

### FIXED CODE ###

k=int(input())
if k%2==0 or k%5==0:
    print(-1)
    exit()
a=0
for i in range(k):
    a=(a*10+7)%k
    if a==0:
        print(i+1)
        exit()
n, m = map(int, input().split())
x = [x for x in map(int, input().split())]
y = [y for y in map(int, input().split())]
sum_x = 0
sum_y = 0
ans = 0
for i in range(n):
    sum_x += (2*i - n + 1) * x[i+1] 
for j in range(m):
    sum_y += (2*j - m + 1) * y[j+1]
ans = sum_x * sum_y
print(ans%1000000007)

### FIXED CODE ###

n, m = map(int, input().split())
x = [x for x in map(int, input().split())]
y = [y for y in map(int, input().split())]
sum_x = 0
sum_y = 0
ans = 0
for i in range(n):
    sum_x += (2*i - n + 1) * x[i] 
for j in range(m):
    sum_y += (2*j - m + 1) * y[j]
ans = sum_x * sum_y
print(ans%1000000007)
n=int(input())
a=list(map(int,input().split()))
if n=1:
    print(0)
    exit()
for i in range(n):
    a[i]=a[i]-i-1
a.sort()
b1=a[n//2]
b2=a[n//2+1]
ans1=[]
ans2=[]
for i in range(n):
    ans1.append(abs(a[i]-b1))
for i in range(n):
    ans2.append(abs(a[i]-b2))
print(min(sum(ans1),sum(ans2)))


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
if n==1:
    print(0)
    exit()
for i in range(n):
    a[i]=a[i]-i-1
a.sort()
b1=a[n//2]
b2=a[n//2+1]
ans1=[]
ans2=[]
for i in range(n):
    ans1.append(abs(a[i]-b1))
for i in range(n):
    ans2.append(abs(a[i]-b2))
print(min(sum(ans1),sum(ans2)))
import sys
import math
import heapq
import bisect
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

# j - i == S[j] - S[i] # MOD K
# S[i] - i == S[j] - j

N,K=LI()
As=LI()

Cum=[0]*(N+1)
for i in range(N):
    Cum[i+1] = Cum[i] + As[i]

REM2IDX = {}
for i in range(1,N+1):
    rem = (Cum[i] - i) % K
    if not rem in REM2IDX: REM2IDX[rem] = []
    REM2IDX[rem].append(i)

res = 0
for i in range(0,N+1):
    rem = (Cum[i] - i) % K
    cnt = len(REM2IDX[rem])
    l = bisect.bisect_right(REM2IDX[rem], i)
    r = bisect.bisect_right(REM2IDX[rem], i+K-1)
    res += (r-l)

print(res)

### FIXED CODE ###

import sys
import math
import heapq
import bisect
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

# j - i == S[j] - S[i] # MOD K
# S[i] - i == S[j] - j

N,K=LI()
As=LI()

Cum=[0]*(N+1)
for i in range(N):
    Cum[i+1] = Cum[i] + As[i]

REM2IDX = {}
for i in range(0,N+1):
    rem = (Cum[i] - i) % K
    if not rem in REM2IDX: REM2IDX[rem] = []
    REM2IDX[rem].append(i)

res = 0
for i in range(0,N+1):
    rem = (Cum[i] - i) % K
    cnt = len(REM2IDX[rem])
    l = bisect.bisect_right(REM2IDX[rem], i)
    r = bisect.bisect_right(REM2IDX[rem], i+K-1)
    res += (r-l)

print(res)
from itertools import permutations as pe
n,m,r=map(int,input().split())
s=[[(0 if i==j else float("inf"))for j in range(n+1)]for i in range(n+1)]
g=list(pe(list(map(int,input().split()))))
for i in range(n):
    a,b,c=map(int,input().split())
    s[a][b]=c
    s[b][a]=c
for h in range(n):
    for i in range(n):
        for j in range(n):
            if s[i][j]>s[i][h]+s[h][j]:
                s[i][j]=s[i][h]+s[h][j]
k=float("inf")
for i in range(len(g)):
    d=g[i]
    c=0
    for j in range(1,len(d)):
        c+=s[d[j-1]][d[j]]
        if c>k:
            break
    else:
        k=min(c,k)
print(k)

### FIXED CODE ###

from itertools import permutations as pe
from scipy.sparse.csgraph import floyd_warshall as wf
n,m,r=map(int,input().split())
s=[[(0 if i==j else float("inf"))for j in range(n+1)]for i in range(n+1)]
g=list(pe(list(map(int,input().split()))))
for i in range(m):
    a,b,c=map(int,input().split())
    s[a][b]=c
    s[b][a]=c
s=wf(s,directed=False)
k=float("inf")
for i in range(len(g)):
    d=g[i]
    c=0
    for j in range(1,len(d)):
        c+=s[d[j-1]][d[j]]
        if c>=k:
            break
    else:
        k=min(c,k)
print(int(k))
N,x = map(int,input().split())
hito = input()
poo = [hito]
zyun = sorted(hito)
ok = 0
for i in range(len(poo)):
	if x-zyun[i]>=0:
      ok+=1
    else:
      print(ok)
    



### FIXED CODE ###

a,b=map(int,input().split())
L=list(map(int,input().split()))
L=sorted(L)
ans=0
if sum(L)<b:
  print(a-1)
elif sum(L)==b:
  print(a)
else:
  for i in range(a):
    ans+=L[i]
    if ans>b:
      print(i)
      exit()
A,B,C,K = map(int, input().split())

if(A - K < 0):
    if(A + B - K < 0):
        print(2 * A - K + B))
    else:
        print(A)
else:
    print(K)

### FIXED CODE ###

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

if(A - K < 0):
    if(A + B - K < 0):
        print(2 * A - K + B)
    else:
        print(A)
else:
    print(K)
s=int(input())
an=[0]*1000000
tmp=[False]*300
an[0] = s
for i in range(1, 1000000):
    if an[i-1] % 2 == 0:
        an[i] = int(an[i-1]/2)
    else:
        an[i] = 3*an[i-1] + 1
    if not tmp[an[i]]:
        tmp[an[i]] = True
    else:
        print(i+1)
        exit()


### FIXED CODE ###

s = int(input())
def f(x):
  if x % 2 == 0:
    return x/2
  else:
    return 3 * x + 1

X = [s]
m = 1
next = s

while True:
  m += 1
  next = f(next)
  if next in X:
    break
  else:
    X.append(next)
    
print(m)
N = int(input())
l = list(map(int,input().split()))
count = 1
max = l[0]
for i in range(len(l)):
  if max <= l[i]:
   	count += 1
    max = l[i]
print(count)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
max = l[0]
count = 0
for i in range(n):
  if l[i] >= max:
    count += 1
    max = l[i]
    
print(count)
from collections import Counter

s=input()
s=Couter(s)

for i in s.values():
    if i%2!=0:
        print("No")
        break
else:
    print("Yes")

### FIXED CODE ###

w= input()
w_set =set(w)

for i in w_set:
    if w.count(i)%2==1:
        print("No")
        exit()
print("Yes")
from collections import deque
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def bfs(field, d, sx, sy, gx, gy):
    queue = deque([(sx, sy)])
    d[sx][sy] += 1
    
    while queue:
        x, y = queue.popleft()
        if (x, y) == (gx, gy):
            return d[x][y]

        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            
            # field内かつ障害物じゃないかつ未訪問なら追加
            if (0 <= nx <= gx and 0 <= ny <= gy
                and field[nx][ny] != "#" 
                and d[nx][ny] == -1):
                d[nx][ny] = d[x][y] + 1
                queue.append((nx, ny))

def main():
    H,W = map(int, readline().split())
    s = [readline() for i in range(H)]

    #スタートからの距離(-1は未訪問)
    d = [[-1]*W for i in range(H)]

    min_path = bfs(s, d, 0, 0, H-1, W-1) + 1

    black = 0
    for line in s:
        black += line.count("#")

    ans = H * W - min_path - black
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def bfs(field, d, sx, sy, gx, gy):
    queue = deque([(sx, sy)])
    d[sx][sy] += 1
    
    while queue:
        x, y = queue.popleft()
        if (x, y) == (gx, gy):
            return d[x][y]

        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            
            # field内かつ障害物じゃないかつ未訪問なら追加
            if (0 <= nx <= gx and 0 <= ny <= gy
                and field[nx][ny] != "#" 
                and d[nx][ny] == -1):
                d[nx][ny] = d[x][y] + 1
                queue.append((nx, ny))

def main():
    H,W = map(int, readline().split())
    s = [readline() for i in range(H)]

    #スタートからの距離(-1は未訪問)
    d = [[-1]*W for i in range(H)]

    min_path = bfs(s, d, 0, 0, H-1, W-1)
    if min_path is not None:
        min_path += 1
    else:
        print(-1)
        exit()

    black = 0
    for line in s:
        black += line.count("#")

    ans = H * W - min_path - black
    print(ans)


if __name__ == "__main__":
    main()
import math

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

if math.floor(a*12.5) == math.floor(b*10):
  print(math.floor(b*10)
else:
  print("-1")

### FIXED CODE ###

a,b=map(int,input().split())
c=[]

for i in range(1240):
  if int(i*0.08) == a and int(i*0.1) == b:
    c.append(i)
c.append(-1)

print(c[0])
a = int(input())
b = [int(i) for i in input().split()]

numbers = min(b)

b = [i - min(b) for i in b]

theend = False

while theend == False:

    indexnotzero = 0

    for i in range(len(b)):
        if b[i] == 0:
            continue
        else:
            indexnotzero = i
            break
    try:
        length = b.index(0, indexnotzero)
    except ValueError:
        length = len(b)
    minimum = min(b[indexnotzero:length])

    numbers += minimum

    b[indexnotzero:length] = [i - minimum for i in b[indexnotzero:length]]

    if b.count(0) == a:
        theend = True

print(numbers)

### FIXED CODE ###

a = int(input())
b = [int(i) for i in input().split()]

numbers = min(b)

b = [i - min(b) for i in b]

theend = False

while theend == False:
  
    if b.count(0) == a:
        theend = True
        break

    indexnotzero = 0

    for i in range(len(b)):
        if b[i] == 0:
            continue
        else:
            indexnotzero = i
            break

    if indexnotzero == len(b) - 1:
        numbers += b[len(b) - 1]
        break

    try:
        length = b.index(0, indexnotzero)
    except ValueError:
        length = len(b)
    minimum = min(b[indexnotzero:length])

    numbers += minimum

    b[indexnotzero:length] = [i - minimum for i in b[indexnotzero:length]]

print(numbers)
INF = 10**30
def bellman_ford(s, g):
    d = [INF for _ in range(n)] # 各頂点への最小コスト
    d[s] = 0 # 自身への距離は0
    for i in range(n):
        update = False # 更新が行われたか
        for x, y, z in g:
            if d[y] > d[x] + z:
                d[y] = d[x] + z
                update = True
        if not update:
            break
        # 負閉路が存在
        if i == n-1:
            return []
    return d

def connected_subgraph(s, g_pre):
  visited[s] = 1
  conn.add(s)
  for y in I[s]:
    if visited[y] == 0:
      connected_subgraph(y, g_pre)

n, m = map(int, input().split()) # n:頂点数, m:辺の数
g_pre = []
for _ in range(m):
    x, y, z = map(int, input().split()) # 始点,終点,コスト
    x -= 1
    y -= 1
    z *= -1
    g_pre.append([x, y, z])
    
I = [set() for _ in range(n)] #隣接グラフ
visited = [0 for _ in range(n)]
for x, y, z in g_pre:
  I[x].add(y)    
conn = set() 
connected_subgraph(0, g_pre)

g = []
for x, y, z in g_pre:
    if x in conn:
      g.append([x, y, z])
#print(conn, g)
ans = bellman_ford(0, g)
#print(ans)
print(-ans[n-1] if ans else "inf")

### FIXED CODE ###

import sys
from collections import deque

INF = 10 ** 20
def Bellman_Ford(I):
  N = len(I)
  d = [INF for _ in range(N)] # 各頂点への最小コスト
  d[0] = 0 # 自身への距離は0
  visited = [0 for _ in range(N)]
  for i in range(N-1):
    update = False # 更新有無
    task = deque([(0,0,0)])

    visited[0] = i-1
    while task: 
      a, b, c = task.popleft() 
      if d[b] > d[a] + c:
        d[b] = d[a] + c 
        update = True   
      if visited[b] <= i:
        for x, ct in I[b]:
          task.append((b, x, ct))
        visited[b] += 1
    if not update:
        break
        
  # 負閉路の検知
  visited = [0 for _ in range(N)]
  neg = [0 for _ in range(N)]
  for i in range(N):
    update = False # 更新有無
    task = deque([(0,0,0)])
    visited[0] = i-1
    while task: 
      a, b, c = task.popleft() 
      if d[b] > d[a] + c:
        d[b] = d[a] + c 
        update = True 
        neg[b] = 1
        
      if visited[b] <= i:
        for x, ct in I[b]:
          task.append((b, x, ct))
        visited[b] += 1
        
    if not update:
        break
        
    if neg[N-1] == 1:
      return []
    
  return d

N, M = map(int,input().split()) # N:頂点数, M:辺の数
I = [[] for _ in range(N)]
for _ in range(M):
  a, b, c = map(int,input().split()) # 始点,終点,コスト
  I[a-1].append((b-1,-c))
  #I.append((b,a,c)) 
#print(I)
d = Bellman_Ford(I)
print(-d[N-1] if d else "inf")
from math import atan, degrees
a, b, x = map(int, input().split())
if x<=a*a*b//2:
  tan = (2*x)/(a*b*b)
  print(90-degrees(atan(tan)))
else:
  m = a*b*a-x
  tan = a*a*a/(2*m)
  print(90-degrees(atan(tan)))

### FIXED CODE ###

from math import atan, degrees
a, b, x = map(int, input().split())
if x<=a*a*b//2:
  tan = (2*x)/(a*b*b)
  print(90-degrees(atan(tan)))
else:
  m = a*b*a-x
  if m==0:
    print(0)
  else:
    tan = a*a*a/(2*m)
    print(90-degrees(atan(tan)))
import collections
n=int(input())
s=list(map(str,input().split()))
k=collections.Counter(s).c.most_common()
l=[]
for i in k:
    if  i[1]==i[0][1]:
      l.append(i[0])
l.sort()
for i in l:
    print(i)

### FIXED CODE ###

import collections

N=int(input())
S=[]
for i in range(N):
	S.append(input())
M=collections.Counter(S)
A=max(M.values())
tmp=[]
for i,j in M.items():
	if j==A:
		tmp.append(i)
ans=sorted(tmp)
for i in range(len(ans)):
	print(ans[i])
import math
n=int(input())
a=list(map(int,input().split()))
mxa=max(a)

def get_sieve_of_eratosthenes(mxa):
    fact = [0]*(mxa+1)
    limit = math.sqrt(mxa)
    data = [i + 1 for i in range(1, mxa)]
    while True:
        p = data[0]
        if limit <= p:
            return fact
        fact[p]=p
        for i in data:
            if i%p==0:
                fact[i]=p
        data = [e for e in data if e % p != 0]

fact= get_sieve_of_eratosthenes(mxa)

for i,j in enumerate(fact):
    if j==0:
        fact[i]=i
lst=[0]*(len(fact))
for i in range(n):
    prm_check = [False]*(mxa+1)
    while a[i]!=1:
        if not prm_check[fact[a[i]]]:
            lst[fact[a[i]]]+=1
            prm_check[fact[a[i]]] = True
        a[i]//=fact[a[i]]


pair=True
st=True

for i in lst:
    if i>=2:
        pair=False
    if i==n:
        st=False

if pair:
    print("pairwise coprime")
elif st:
    print("setwise coprime")
else:
    print("not coprime")


### FIXED CODE ###

import math
n=int(input())
a=list(map(int,input().split()))
mxa=max(a)

def get_sieve_of_eratosthenes(mxa):
    fact = [0]*(mxa+1)
    limit = int(math.sqrt(mxa))
    for i in range(2,limit+1):
        if fact[i]!=0:
            continue
        else:
            fact[i]=i
            for j in range(i, mxa+1, i):
                if fact[j]==0:
                    fact[j]=i
    for i in range(2,mxa+1):
        if fact[i]==0:
            fact[i]=i

    return fact

fact = get_sieve_of_eratosthenes(mxa)

lst=[0]*(len(fact))
for i in range(n):
    divisor = set()
    while a[i]!=1:
        divisor.add(fact[a[i]])
        a[i]//=fact[a[i]]
    for d in divisor:
        lst[d]+=1

pair=True
st=True

for i in lst:
    if i>=2:
        pair=False
    if i==n:
        st=False
if pair:
    print("pairwise coprime")
elif st:
    print("setwise coprime")
else:
    print("not coprime")
a, b, k = map(int, input().split())

if a <= k:
  k -= a
  a = 0
else:
  a -= k
  k = 0

b = max(0, b - k)

print(a, b)

### FIXED CODE ###

a, b = input().split()

print(b+a)
import fractions
n,m=map(int, input().split())
a=list(map(int, input().split()))
b=[]
buf=0
for i in range(n): #aは偶数なので、1/2した値の配列を作った
    b.append(int(a[i]//2))
    if (a[i]//2)%2!=0:
        buf+=1
    else:
        continue

def lcm(x,y): #最小公倍数を求める関数の定義
    return (x*y)//fractions.gcd(x,y)
  
if buf!=0 and buf!=n:
    print(0)
else:
    c=[lcm(b[0],b[1])] #以下のサイクルで求めた最小公倍数を入れる配列
    for i in range(1,n):
        x=lcm(c[i-1],b[i])
        c.append(x)
        if x<m:
            continue
        else:
            break
    
    d=int(m//c[len(c)-1]) #最後の値(c[len(c)-1])が配列bの最小公倍数
    ans=int((d+1)//2)
    print(ans)

### FIXED CODE ###

import math
import fractions
n,m=map(int, input().split())
a=list(map(int, input().split()))
b=[]
s=math.floor(math.log2(max(a)))
buf=0
for i in range(n): #aは偶数なので、1/2した値の配列を作った
    b.append(int(a[i]//2))

for i in range(s+1): #2のi乗ですべての数が割れるかどうか
    for j in b:
        if j%(2**i)==0:
            buf+=1
        else:
            continue
    if buf==n:
        buf=0
        continue
    else:
        break

def lcm(x,y): #最小公倍数を求める関数の定義
    return (x*y)//fractions.gcd(x,y)

if buf!=0 and buf!=n: #偶奇が入り混じってるとき
    print(0)
elif n==1: #配列の要素が1つしかないとき
    d=int(m//b[0])
    print(int((d+1)//2))
else:
    c=[lcm(b[0],b[1])] #以下のサイクルで求めた最小公倍数を入れる配列
    for i in range(1,n):
        x=lcm(c[i-1],b[i])
        c.append(x)
        if x<m:
            continue
        else:
            break
    d=int(m//c[len(c)-1]) #最後の値(c[len(c)-1])が配列bの最小公倍数
    ans=int((d+1)//2)
    print(ans)
N = int(input())
p = [int(x) for x in input().split()]
a = sorted(P)
c = 0
for i in range(N):
  if p[i] != a[i]:
    c+=1
if c <= 2 :
  print("YES")
if c >3:
  print("No")
    

### FIXED CODE ###

N = int(input())
p = [int(x) for x in input().split()]
a = sorted(p)

c = 0
for i in range(N):
  if p[i] != a[i]:
    c += 1
if c <= 2 :
  print("YES")
if c > 2:
  print("NO")
from collections import deque,defaultdict
N,X,D = map(int,input().split())
d = defaultdict(list)
if D<0:
    D *= -1
    X *= -1

if D != 0:
    for m in range(N+1):
        if m==0:
            a = 0
            b = 0
        else:
            a = X*m+(m*(m-1)*D)//2
            b = X*m+(m*(2*N-m-1)*D)//2
        d[a%D].append([a,b])


    ans = 0
    for k in d:
        q = d[k]
        q.sort()
        q = deque(q)
        while q:
            a1,b1 = q.popleft()
            if q:
                a2,b2 = q.popleft()
                if a2 <= b1:
                    q.appendleft([a1,b2])
                else:
                    ans += (b1-a1)//D+1
                    l.append([a1,b1])
                    q.appendleft([a2,b2])
            else:
                ans += (b1-a1)//D+1

if D == 0:
    ans = N
    if X == 0:
        ans = 1
print(ans)

### FIXED CODE ###

from collections import defaultdict
N,X,D = map(int,input().split())
d = defaultdict(list)
if D<0:
    D *= -1
    X *= -1

if D != 0:
    for m in range(N+1):
        a = X*m+(m*(m-1)*D)//2
        b = X*m+(m*(2*N-m-1)*D)//2
        d[a%D].append([a,b])


    ans = 0
    for k in d:
        q = d[k]
        q.sort()
        l,r = q[0]
        for i in range(len(q)):
            a,b = q[i]
            if a<=r:
                r = max(r,b)
            else:
                ans += (r-l)//D+1
                l = a
                r = b
        ans += (r-l)//D+1

if D == 0:
    ans = N+1
    if X == 0:
        ans = 1
print(ans)