Harryxun/stf_run huggingface dataset:
import sys


#torf = [[None for _ in range(m)]for _ in range(n)]
#print(torf)
#print(torf[0][0])
#print(torf[1][0])

s = input()
ans =""
if len(s)==1:
    if s[0]=="?":
        print("D")
        sys.exit()
    else:
        print(s[0])
        sys.exit()

if s[0]=="?":
    if s[1]=="D" or s[1]=="?":
        ans = ans+"P"
    else:
        ans = ans + "D"
else :
    ans = ans + s[0]

for i in range(1,len(s)):
    if s[i]=="?":
        if ans[i-1]=="P":
            ans = ans + "D"
        elif ans[i-1]=="D":
            if i<len(s):
                if s[i+1]=="P":
                    ans = ans + "D"
                else:
                    ans= ans + "P"
            else:
                ans = ans + "P"
        else:
            ans = ans + "P"    
    else:
        ans = ans + s[i]
    

print(ans)


### FIXED CODE ###

import sys


#torf = [[None for _ in range(m)]for _ in range(n)]
#print(torf)
#print(torf[0][0])
#print(torf[1][0])

s = input()
ans =""
if len(s)==1:
    if s[0]=="?":
        print("D")
        sys.exit()
    else:
        print(s[0])
        sys.exit()

if s[0]=="?":
    if s[1]=="D" or s[1]=="?":
        ans = ans+"P"
    else:
        ans = ans + "D"
else :
    ans = ans + s[0]

for i in range(1,len(s)):
    if s[i]=="?":
        if ans[i-1]=="P":
            ans = ans + "D"
        elif ans[i-1]=="D":
            if i<len(s)-1:
                if s[i+1]=="P":
                    ans = ans + "D"
                else:
                    ans= ans + "P"
            else:
                ans = ans + "D"
        else:
            ans = ans + "P"    
    else:
        ans = ans + s[i]
    

print(ans)
S = input()

fl = [False]*len(S)
l = 0
res = 0

for i in range(len(S)-3):
    if fl[i]:
        continue
    
    x = int(S[i:i+3])
    cnt = 0
    for j in range(i+3, len(S)):
        x *= 10
        x += int(S[j])
        x %= 2019
        if x == 0:
            cnt += 1
            fl[l] = True
            l = j+1
    
    res += (cnt+1)*cnt//2

print(res)

### FIXED CODE ###

S = list(map(int, list(input())))
S.reverse()
a = [0]*len(S)
y = 2019
x = 1
t = 0
cnt = [0]*y
res = 0
for i in range(len(S)):
    cnt[t] += 1
    t += S[i]*x
    t %= y
    res += cnt[t]
    x = x*10%y
print(res)
H,W=map(int,input().split())
A=tuple(tuple(input()) for _ in range(H))
next_q=[(i,j) for i in range(H) for j in range(W) if A[i][j]=='#']
L=[[0]*W for _ in range(H)]

res=0
while len(next_q)!=0:
    q,next_q=next_q[:],[]
    while len(q)!=0:
        x,y=q.pop(0)
        if x>0 and L[x-1][y]==0:
            L[x-1][y]=1
            next_q.append((x-1,y))
        if x<W-1 and L[x+1][y]==0:
            L[x+1][y]=1
            next_q.append((x+1,y))
        if y>0 and L[x][y-1]==0:
            L[x][y-1]=1
            next_q.append((x,y-1))
        if y<H-1 and L[x][y+1]==0:
            L[x][y+1]=1
            next_q.append((x,y+1))
    if len(next_q)==0:break
    res+=1
print(res)

### FIXED CODE ###

from collections import deque
import copy
H, W = map(int, input().split())
A = tuple(tuple(input()) for _ in range(H))
L=[[0]*W for _ in range(H)]
next_q=deque()

for i in range(H):
    for j in range(W):
        if A[i][j]=='#':
            L[i][j]=1
            next_q.append((i,j))

q=deque()

res = 0
while len(next_q) != 0:
    q=copy.copy(next_q)
    next_q.clear()
    while q:
        y, x = q.popleft()
        if y > 0 and L[y - 1][x] == 0:
            L[y - 1][x] = 1
            next_q.append((y - 1, x))
        if y < H - 1 and L[y + 1][x] == 0:
            L[y + 1][x] = 1
            next_q.append((y + 1, x))
        if x > 0 and L[y][x - 1] == 0:
            L[y][x - 1] = 1
            next_q.append((y, x - 1))
        if x < W - 1 and L[y][x + 1] == 0:
            L[y][x + 1] = 1
            next_q.append((y, x + 1))
    if len(next_q)==0: break
    res += 1
print(res)
x=int(input())
a=int(x/500)
b=int((x-500a)/5)
print(a*1000+b*5)

### FIXED CODE ###

x=int(input())
a =x // 500
y = x-500*a
b = y // 5
happy = a*1000+b*5
print(happy)
from fractions import gcd
import math
def solve(string):
    a, b = map(int, string.split())
    g = math.gcd(a, b)
    ans = 1 if g % 2 else 2
    while g % 2 == 0:
        g //= 2
    for i in range(3, int(g**0.5) + 1, 2):
        if g % i == 0:
            ans += 1
        while g % i == 0:
            g //= i
    return str(ans + 1) if g > 1 else str(ans)

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

### FIXED CODE ###

from fractions import gcd

def solve(string):
    a, b = map(int, string.split())
    g = gcd(a, b)
    ans = 1 if g % 2 else 2
    while g % 2 == 0:
        g //= 2
    for i in range(3, int(g**0.5) + 1, 2):
        if g % i == 0:
            ans += 1
        while g % i == 0:
            g //= i
    return str(ans + 1) if g > 1 else str(ans)

if __name__ == '__main__':
    print(solve(input()))
a,b,c = int(input())
abc = [a,b,c]
abc.sort()
a

### FIXED CODE ###

a = list(map(int, input().split()))
a.sort()
print(a[0],a[1],a[2])
def dfs(now, prev):
    for nxt, w in edge[now]:
        if nxt == prev:
            continue
        
        dist[nxt] = dist[now] + w
        dfs(nxt, now)


n = int(input())
edge = [[] for _ in range(n)]
for _ in range(n-1):
    u, v, w = map(int, input().split())
    edge[u-1].append([v-1, w])
    edge[v-1].append([u-1, w])

dist = [0] * n
dfs(0, -1)

for d in dist:
    if d % 2 == 0:
        print(0)
    else:
        print(1)

### FIXED CODE ###

from sys import setrecursionlimit

setrecursionlimit(10 ** 6)

def dfs(now, prev):
    for nxt, w in edge[now]:
        if nxt == prev:
            continue
        
        dist[nxt] = dist[now] + w
        dfs(nxt, now)


n = int(input())
edge = [[] for _ in range(n)]
for _ in range(n-1):
    u, v, w = map(int, input().split())
    edge[u-1].append([v-1, w])
    edge[v-1].append([u-1, w])

dist = [0] * n
dfs(0, -1)

for d in dist:
    if d % 2 == 0:
        print(0)
    else:
        print(1)
A,B = map(int,input().split())
S = input()
if S.count('-')==1 and s[A]=='-':
    print('Yes')
else:
    print('No')


### FIXED CODE ###

A,B = map(int,input().split())
S = input()
if S.count('-')==1 and S[A]=='-':
    print('Yes')
else:
    print('No')
import sys
import collections
from collections import Counter
# from collections import deque
# from collections import defaultdict
import itertools
# from itertools import accumulate
# from itertools import permutations
# from itertools import combinations
# from itertools import takewhile
from itertools import compress
import functools
# from functools import reduce
import math
# from math import gcd
# from math import inf
# from math import ceil
# from math import floor
# from math import log10
# from math import log2
# from math import log
from math import factorial

MOD = (10 ** 9) + 7
# import re

# input = sys.stdin.readline

S = input()
N = len(S)


def funcA(idx, q):
    if idx >= N:
        return 0
    ret = 0
    if S[idx] == "A" or S[idx] == "?":
        ret += funcB(idx + 1, q)
    q += 1 if S[idx] == "?" else 0
    ret += funcA(idx + 1, q)
    return ret


def funcB(idx, q):
    if idx >= N:
        return 0
    ret = 0
    if S[idx] == "B" or S[idx] == "?":
        ret += funcC(idx + 1, q)
    q += 1 if S[idx] == "?" else 0
    ret += funcB(idx + 1, q)
    return ret


def funcC(idx, q):
    if idx >= N:
        return 0
    ret = 0
    if S[idx] == "C" or S[idx] == "?":
        addQ = S[idx + 1:].count("?")
        ret += 3 ** (q + addQ)

    q += 1 if S[idx] == "?" else 0
    ret += funcC(idx + 1, q)
    return ret


ans = funcA(0, 0)

print(ans % MOD)


### FIXED CODE ###

import gc

MOD = (10 ** 9) + 7

S = input()
N = len(S)

dp = [[0] * (N + 1) for _ in range(4)]

dp[0][0] = 1
dp[1][0] = 0
dp[2][0] = 0
dp[3][0] = 0

for i in range(1, N + 1):
    for j in range(4):
        s = S[i - 1]
        m = 3 if s == "?" else 1
        dp[j][i] += m * dp[j][i - 1]
        if j == 1:
            if s == "A" or s == "?":
                dp[j][i] += dp[j - 1][i - 1]
        elif j == 2:
            if s == "B" or s == "?":
                dp[j][i] += dp[j - 1][i - 1]
        elif j == 3:
            if s == "C" or s == "?":
                dp[j][i] += dp[j - 1][i - 1]
        dp[j][i] = dp[j][i] % MOD

print(dp[3][N] % MOD)
s=input()
ans = 'Good'
last = s[0]
for i in s[1:]:
    if last==i:
        ans = 'Bad'
        reak
    last = i
print(ans)

### FIXED CODE ###

s=input()
ans = 'Good'
last = s[0]
for i in s[1:]:
    if last==i:
        ans = 'Bad'
        break
    last = i
print(ans)
N = int(input())

import heapq 
from collections import defaultdict
import numpy as np
import math

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum




if is_prime(N):
    ans = 1
elif N == 1:
    ans = 0
else:
    heap = seachPrimeNum(int(math.sqrt(N)))
    # print(heap)
    heapq.heapify(heap)
    ans = 0
    dict_prime = defaultdict(int)

    while(1):
        # print(N)
        # cnt += 1
        # if cnt > 10:break
        # print(N)
        sub = heapq.heappop(heap)
        # print(sub)
        # print(cand)
        # print(heap)
        # print(cand)
        # print(heapq)
        if N < sub:
            # print(N,sub)
            # print("a")
            break
        if N % sub == 0:
            N = N // sub
            ans += 1
            if sub not in dict_prime:
                dict_prime[sub] = sub
                dict_prime[sub*sub] = sub
            else:
                dict_prime[sub*dict_prime[sub]] = dict_prime[sub]
                # print("a")
            heapq.heappush(heap, sub*dict_prime[sub])


print(ans)




### FIXED CODE ###

N = int(input())

import heapq 





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,i, cnt])

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

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

    return arr

# for N in range(1,100000):
# N = 288
# print(N)

heap = factorization(N) 
# print(heap)
# print(heap)
heapq.heapify(heap)
ans = 0

while(heap):
    # print(heap)
    if N == 1:
        break
    sub,prime,cnt = heapq.heappop(heap)
    if N < sub:
        break
    if N % sub == 0:
        N = N // sub
        ans += 1
        if cnt > 0:
            cnt -= 1
            sub *= prime
            heapq.heappush(heap, [sub,prime,cnt])

print(ans)
import itertools
N,K = map(int,input().split())
D = list(map(int,input().split()))

#使用可能数字の取り出し
Num1 = []
for i in range(10):
  if(i in D): continue
  else: Num1.append(i)
 
#組み合わせ
Comb = []
n = len(str(N))
for i in range(n):
  Comb.append(Num1)
Comb = list(itertools.product(*Comb))

for i in range(len(Comb)):
  tmp = Comb[i]
  tmp_num = ''
  for j in range(n): tmp_num += str(tmp[j])
  tmp_num = int(tmp_num)
  if(N <= tmp_num):
    ans = tmp_num
    break
    
print(ans)

### FIXED CODE ###

import itertools
N,K = map(int,input().split())
D = list(map(int,input().split()))

#使用可能数字の取り出し
Num1 = []
for i in range(10):
  if(i in D): continue
  else: Num1.append(i)
 
#組み合わせ
Comb = []
n = len(str(N))
for i in range(n+1):
  Comb.append(Num1)
Comb = list(itertools.product(*Comb))

ans = -1
for i in range(len(Comb)):
  tmp = Comb[i]
  tmp_num = ''
  for j in range(n): tmp_num += str(tmp[j])
  tmp_num = int(tmp_num)
  if(N <= tmp_num):
    ans = tmp_num
    break
    
if(ans == -1):
  for i in range(len(Comb)):
   tmp = Comb[i]
   tmp_num = ''
   for j in range(n+1): tmp_num += str(tmp[j])
   tmp_num = int(tmp_num)
   if(N <= tmp_num):
     ans = tmp_num
     break
print(ans)
# union-find
# https://note.nkmk.me/python-union-find/

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        # 各要素の親要素を格納する

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if x > y:
            self.parents[x] += self.parents[y]
            self.parents[y] = x
            return
        self.parents[y] += self.parents[x]   
        self.parents[x] = y
        return
    
    def size(self, x):
        x = self.find(x)    
        return self.parents[x]*(-1)

def main():
    n, m = map(int, input().split())
    friend = UnionFind(n)

    for _ in range(m):
        a, b = map(int, input().split())
        friend.union(a-1, b-1)
    
    ans = 0
    for i in range(n):
        ans = max(ans, friend.size(i))
    print(ans)

if  __name__ == "__main__":
     main()


### FIXED CODE ###

# union-find
# https://note.nkmk.me/python-union-find/

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        # 各要素の親要素を格納する

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            return self.find(self.parents[x])
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        return
    
    def size(self, x):
        x = self.find(x)    
        return self.parents[x]*(-1)

def main():
    n, m = map(int, input().split())
    friend = UnionFind(n)

    for _ in range(m):
        a, b = map(int, input().split())
        friend.union(a-1, b-1)
    
    ans = 0
    for i in range(n):
        ans = max(ans, friend.size(i))
    print(ans)

if  __name__ == "__main__":
     main()
a, b = map(int, input().split())
print(b*2-a)

### FIXED CODE ###

a=int(input())
b=int(input())
print(b*2-a)
from bisect import bisect_left
import sys
sys.setrecursionlimit(1000000)


def dfs(v, p):
    i = bisect_left(dp, a[v])
    dp[i], old = a[v], dp[i]
    ans[v] = bisect_left(dp, INF)-1
    for u in to[v]:
        if u == p:
            continue
        dfs(u, v)
    dp[i] = old

if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))
    to = [[] for _ in range(n)]
    ans = [0]*n
    INF = 10**10
    for _ in range(n-1):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        to[u].append(v)
        to[v].append(u)
    dp = [INF]*n
    dp[0] = -INF
    dfs(0, -1)
    print("\n".join(list(map(str, ans))))

### FIXED CODE ###

from bisect import bisect_left
import sys
sys.setrecursionlimit(1000000)


def dfs(v, p):
    i = bisect_left(dp, a[v])
    dp[i], old = a[v], dp[i]
    ans[v] = bisect_left(dp, INF)-1
    for u in to[v]:
        if u == p:
            continue
        dfs(u, v)
    dp[i] = old

if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))
    to = [[] for _ in range(n)]
    ans = [0]*n
    INF = 10**20
    for _ in range(n-1):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        to[u].append(v)
        to[v].append(u)
    dp = [INF]*(n+1)
    dp[0] = -INF
    dfs(0, -1)
    print("\n".join(list(map(str, ans))))
N = int(input())
A = [int(_) for _ in input().split() if int(_) < 19]
N = len(A)
while True:
    flag = True
    B = [A[0]]
    for i in range(N - 1):
        if A[i] >= A[i + 1]:
            B += [A[i + 1]]
        else:
            flag = False
    A = B
    N = len(A)
    if flag:
        break

if N == 1:
    print(1)
    exit()


def is_possible(K):
    dp = [0] * 19
    for i in range(N - 1):
        if B[i] >= B[i + 1]:
            dp = dp[: B[i + 1]] + [0] * (19 - B[i + 1])
            flag = True
            for j in range(B[i + 1] - 1, -1, -1):
                if dp[j] < K - 1:
                    dp[j] += 1
                    flag = False
                    break
                else:
                    dp[j] = 0
            if flag:
                return False
    return True


def bis(x, y):
    if y == x + 1:
        return y
    elif is_possible((x + y) // 2):
        return bis(x, (x + y) // 2)
    else:
        return bis((x + y) // 2, y)


print(bis(0, N))


### FIXED CODE ###

import random
input()
A = [int(_) for _ in input().split()]
A = [A[0]] + [j for i, j in zip(A, A[1:]) if i >= j]
N = len(A)


def cut(array, index):
    if index < 1:
        return []
    if index <= array[0][0]:
        return [(index, array[0][1])]
    for _ in range(len(array)-1, 0, -1):
        if array[_ - 1][0] < index:
            return array[:_] + [(index, array[_][1])]


def is_possible(K):
    dp = [(A[0], 0)]
    for a in A[1:]:
        if a <= dp[-1][0]:
            dp = cut(dp, a)
        else:
            dp += [(a, 0)]
        is_added = False
        for j in range(len(dp) - 1, -1, -1):
            if dp[j][1] < K - 1:
                dp = cut(dp, dp[j][0] - 1) + [(dp[j][0], dp[j][1] + 1)]
                if dp[-1][0] < a:
                    dp += [(a, 0)]
                is_added = True
                break
        if not is_added:
            return False
    return True


def bis(x, y):
    if y == x + 1:
        return y
    elif is_possible((x + y) // 2):
        return bis(x, (x + y) // 2)
    else:
        return bis((x + y) // 2, y)


print(bis(0, N))
from math import *
from fractiosn import *
a,b,c,d=map(int,raw_input().split())
lcm=lambda x,y: x*y//gcd(x,y)

def f(a,b,c):
    return (b - a + 1) // c + (1 if b % c <= a % c else 0)

if c != 1 and d != 1:
    print (b-a+1) - f(a,b,c) - f(a,b,d) + f(a,b,lcm(c,d))
else:
    print 0

### FIXED CODE ###

from math import *
from fractions import *
a,b,c,d=map(int,input().split())

def lcm(a,b):
    return a * b // gcd(a, b)

def f(a,b,c):
    return (b - a + 1) // c + (1 if b % c <= a % c else 0)

if c != 1 and d != 1:
    print ((b-a+1) - (b // c - ceil(a / c) + 1) - (b // d - ceil(a / d) + 1) + (b // lcm(c, d) - ceil(a / lcm(c, d)) + 1))
else:
    print (0)
pi = 3.1415926535
r = int(input())
print("{0:.6f} {1:.6f}".format(pi*r**2 , 2*pi*r))


### FIXED CODE ###

pi = 3.141592653589793
r = float(input())
print("{0:.6f} {1:.6f}".format(pi*r**2 , 2*pi*r))
a,b,c = map(int,input().split())
if b−a == c−b:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

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

if (b-a) == (c-b):
  print("YES")
else:
  print("NO")
from collections import defaultdict
n,m = map(int,input().split())
graph = defaultdict(list)
for i in range(m):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

ans = [None]*(n-1)
check = [i for i in range(2,n+1)]
tmp = []
for j in graph[1]:
    ans[j-2] = 1
    check.remove(j)
    tmp.append(j)

count = 0
while check != [] and count < n:
    new_tmp = []
    for i in tmp:
        for j in graph[i]:
            if ans[j-2] == None and j in check:
                ans[j-2] = i
                check.remove(j)
                new_tmp.append(j)
    tmp = new_tmp
    count += 1
if None in ans:
    print('No')
else:
    print('Yes')
    for i in ans:
        print(i)

### FIXED CODE ###

from collections import defaultdict
n,m = map(int,input().split())
graph = defaultdict(list)
for i in range(m):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

ans = defaultdict(int)
next_list = []
for j in graph[1]:
    ans[j] = 1
    next_list.append(j)

target_list = next_list[:]
while True:
    next_list = []
    if len(target_list) == 0:
        break

    for i in target_list:
        for j in graph[i]:
            if j not in ans:
                ans[j] = i
                next_list.append(j)
    target_list = next_list[:]


print('Yes')
for i in range(2,n+1):
    print(ans[i])
N = int(input())
t,x,y = 0,0,0
f = True
for i in range(N):
    ti,xi,yi = map(int, input()split())
    p=ti-t
    d=abs(xi-x)+abs(yi-y)
    if p<d or p%2 != d%2:
        f = False
        break 
    t,x,y = ti,xi,yi
print('Yes' if f else 'No')

### FIXED CODE ###

N = int(input())
t,x,y = 0,0,0
f = True
for i in range(N):
    ti,xi,yi = map(int, input().split())
    p=ti-t
    d=abs(xi-x)+abs(yi-y)
    if p<d or p%2 != d%2:
        f = False
        break 
    t,x,y = ti,xi,yi
print('Yes' if f else 'No')
n=int(input())
s=input()
count=0
i=0
while i<=n-2:
    if s[i]=="A":
        if s[i+1]=="B" and s[i+2]=="C":
            count+=1
            i+=3
        else: i+=1
    else: i+=1
print(count)

### FIXED CODE ###

n=int(input())
s=input()
count=0
i=0
while i<=n-3:
    if s[i]=="A":
        if s[i+1]=="B" and s[i+2]=="C":
            count+=1
            i+=3
        else: i+=1
    else: i+=1
print(count)
a = input()
if a%10==7:
  print(True)
elif( a%100 )//10==7:
  print(True)
elif( a//100 )==7:
  print(True)
else:
  print(False)

### FIXED CODE ###

a = input()
a = int(a)
if a%10==7:
  print("Yes")
elif( a%100 )//10==7:
  print("Yes")
elif( a//100 )==7:
  print("Yes")
else:
  print("No")
N = int(input())


def is_prime(n):
    for i in range(1, n):
        if i != 1 and n % i == 0:
            return False
    return True


def prime_numbers():
    num = 5
    while True:
        is_num_prime = is_prime(num)
        if is_num_prime:
            yield num
        num += 1


prime_gene = prime_numbers()
ans = []

while len(ans) < N:
    prime = next(prime_gene)
    if prime % 5 == 1:
        ans.append(prime)
print(ans)

### FIXED CODE ###

a, b = map(int, input().split())
if a <= b:
    nums = a
else:
    nums = a - 1
print(nums)
N = int(input())
A = list(map(int,input().split()))
B1 = 0
B = []
for i in range(0,N+1):
    if A[i]%2 == 1:
        B1 += A[i]
    else:
        B1 -= A[i]
B.append(B1)
XX = B1
for i in range (0,N-1) :
    X = 2*A[i]-XX
    B.append(X)
    XX = X
print(B)




### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B1 = 0
B = []
for i in range(0,N):
    if i%2 == 0:
        B1 += A[i]
    else:
        B1 -= A[i]
B.append(B1)
XX = B1
for i in range (0,N-1) :
    X = 2*A[i]-XX
    B.append(X)
    XX = X
for i in range(0,N):
    print(B[i])
A, B = input().split()
print(max(0, A-B*2))

### FIXED CODE ###

A, B = map(int, input().split())
print(max(0, A-B*2))
a=int(input())
if a%2==0:
  ans=(a/2)**2
  return
else:
  ans=((a-1)/2)*((a+1)/2)
  return
print(ans)

### FIXED CODE ###

a=int(input())
if a%2==0:
  ans=int((a/2)**2)
else:
  ans=int(((a-1)/2)*((a+1)/2))
print(ans)
n=int(input())
hoge=[]
for i in range(n):
  x,y,z=map(int,input().split())
  if(z!=0):
    hoge.append([x,y,z])
  

if(len(hoge)==1):
  print(*hoge[0])
  exit()

for i in range(101):
  for j in range(101):
    h=[]
    for k in range(n):
      h.append(hoge[k][2]+abs(hoge[k][0]-i)+abs(hoge[k][1]-j))
      
    if(h.count(h[0])==len(h)):
      print(i,j,h[0])

### FIXED CODE ###

n=int(input())
hoge=[]
for i in range(n):
  x,y,z=map(int,input().split())
  if(z!=0):
    hoge.append([x,y,z])
  

if(len(hoge)==1):
  print(*hoge[0])
  exit()

for i in range(101):
  for j in range(101):
    h=[]
    for k in range(len(hoge)):
      h.append(hoge[k][2]+abs(hoge[k][0]-i)+abs(hoge[k][1]-j))
      
    if(h.count(h[0])==len(h)):
      print(i,j,h[0])