Harryxun/stf_run huggingface dataset:
import queue

def push(n, dist, dist_list):
	if dist_list[n] > dist:
		dist_list[n] = dist
		q.put(n)



q = queue.Queue()
n, x, y = [int(i) for i in input().split()]
result = [0] * (n-1)

for p in range(n):
	dist_list = [111111] * n
	dist = 0
	q.put(p)
	dist_list[p] = dist 
	while not q.empty():
		p = q.get()
		dist = dist_list[p]
		if p+1 < n: push(p+1, dist+1, dist_list)
		if p-1 >= 0: push(p-1, dist+1, dist_list)
		if p == (x-1): push(y-1, dist+1, dist_list)
		if p == (y-1): push(x-1, dist+1, dist_list)
	
	for i in dist_list:
		if i != 0:
			result[i-1] += 1

for ans in result:
	print(ans//2)
		






### FIXED CODE ###

S = input()
if S[2] == S[3] and S[4] == S[5]:
	print("Yes")
else:
	print("No")
from fractions import Fraction

count = int(input())
number_list = map(int, input().split(' '))

sum = 0
for number in number_list:
  sum += Fraction(1, number)

  up, down = map(int, str(sum).split('/'))
  print(down / up)    

### FIXED CODE ###

if __name__ == "__main__":
    N = int(input())
    s = input().split()
    sum = 0

    for i in range(N):
        sum = sum + 1/(int(s[i]))
    print(1/sum)
S = int(input.())

h = S // 3600
m = S // 60 % 60
s = S % 60

print('{0}:{1}:{2}'.format(h, m, s))

### FIXED CODE ###

S = int(input())

h = S // 3600
m = S // 60 % 60
s = S % 60

print('{0}:{1}:{2}'.format(h, m, s))
from math import sqrt

a, b, c = map(int, input().split())
A = sqrt(c) - (sqrt(a) + sqrt(b))
B = 0.0

if abs(A - B) <= max(1e-09 * max(abs(A), abs(B)), 0.0):

    print("Yes")
else:
    print("No")


### FIXED CODE ###

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(A[K - 1])
S = input()
W = []

for i, s enumerate(S):
  if s == 'W':
    W.append(i)

idx = 0
ans = 0
for w in W:
  ans += w-idx
  idx += 1

print(ans)

### FIXED CODE ###

S = input()
W = []
 
for i, s in enumerate(S):
  if s == 'W':
    W.append(i)

idx = 0
ans = 0
for w in W:
  ans += w-idx
  idx += 1

print(ans)
N, Z, W = map(int, input().split())
*A, = map(int, input().split())

memo = {}
def dfs(i, turn):
    if (i, turn) in memo:
        return memo[i, turn]
    if turn == 0:
        # X
        if i == 0:
            res = abs(W - A[-1])
        else:
            res = abs(A[i-1] - A[-1])
        for j in range(i+1, N):
            res = max(res, dfs(j, 1))
    else:
        # Y
        if i == 0:
            res = abs(Z - A[-1])
        else:
            res = abs(A[i-1] - A[-1])
        for j in range(i+1, N):
            res = min(res, dfs(j, 0))
    memo[i, turn] = res
    return res
print(dfs(0, 0))


### FIXED CODE ###

N, Z, W = map(int, input().split())
*A, = map(int, input().split())

import sys
sys.setrecursionlimit(10**6)

memo = {}
def dfs(i, turn):
    if (i, turn) in memo:
        return memo[i, turn]
    if turn == 0:
        # X
        if i == 0:
            res = abs(W - A[-1])
        else:
            res = abs(A[i-1] - A[-1])
        for j in range(i+1, N):
            res = max(res, dfs(j, 1))
    else:
        # Y
        if i == 0:
            res = abs(Z - A[-1])
        else:
            res = abs(A[i-1] - A[-1])
        for j in range(i+1, N):
            res = min(res, dfs(j, 0))
    memo[i, turn] = res
    return res
print(dfs(0, 0))
diN, M = map(int,input().split())
L = sorted(list(map(int,input().split())))
distance = []
for i in range(len(L)-1):
    distance.append(abs(L[i]-L[i+1]))
distance = sorted(distance)
for _ in range(N-1):
    if len(distance) > 0:
        del distance[-1]
    else:
        print(0)
        quit()
print(sum(distance))


### FIXED CODE ###

N, M = map(int,input().split())
L = sorted(list(map(int,input().split())))
distance = []
for i in range(len(L)-1):
    distance.append(abs(L[i]-L[i+1]))
distance = sorted(distance)
for _ in range(N-1):
    try:
        del distance[-1]
    except:
        print(0)
        quit()
print(sum(distance))
from math import sqrt

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

def divisor(a):
    lim = int(sqrt(a))
    divset = set()
    for i in range(1, lim + 1):
        if a % i == 0:
            divset |= {i, a//i}
    divset -= {1}
    return divset

def is_prime(a):
    lim = int(sqrt(a))
    for i in range(2, lim + 1):
        if a != i and a % i == 0: return False
    else: return True

N = int(input())
A = [int(input()) for n in range(N+1)]

gcd_of_A = A[N]
for i in reversed(range(N)):
    if A[i] != 0:
        gcd_of_A = gcd(abs(A[i]), gcd_of_A)

primes = [int(i) for i in range(2, N+1)]
primes = set(primes)
for i in range(2, N+1):
    temp = set()
    for p in primes:
        if p % i > 0 or p == i: temp |= {p}
    primes = temp

ans = []
for p in primes:
    for i in range(p-1):
        coefficient = 0
        index_a = i
        while index_a <= N:
            coefficient += A[index_a] % p
            coefficient %= p
            index_a += p-1
        if coefficient % p > 0: break
    else: 
        ans.append(p)
        
#if gcd_of_A > 1:
    #divisor_of_A = divisor(gcd_of_A)
    #for d in divisor_of_A:
        #if d > N:
            #if is_prime(d):
                #ans.append(d)

ans.sort()
for a in ans: print(a)


### FIXED CODE ###

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

def divisor(a):
    i = 1
    divset = set()
    while i * i <= a:
        if a % i == 0: divset |= {i, a//i}
        i += 1
    divset.remove(1)
    return divset

def is_prime(a):
    if a <= 3: 
        prime = [False, False, True, True]
        return prime[a]
    i = 2
    while i * i <= a:
        if a % i == 0: return False
        i += 1
    else: return True

N = int(input())
A = [None] * (N+1)
for i in reversed(range(N+1)):
    A[i] = int(input())

primes_bool = [True] * (N + 1)
primes = []
for p in range(2, N+1):
    if primes_bool[p]:
        primes.append(p)
        p_mult = p * 2
        while p_mult <= N:
            primes_bool[p_mult] = False
            p_mult += p

ans = []
used = set()
gcd_of_A = abs(A[N])
for a in A[:N]:
    if a != 0: gcd_of_A = gcd(abs(a), gcd_of_A)

commondiv = divisor(gcd_of_A)
for d in commondiv:
    if d > 1 and is_prime(d): 
        ans.append(d)
        used |= {d}

for p in primes:
    if A[0] % p == 0:
        for i in range(1, p):
            coefficient = 0
            index_a = i
            while index_a <= N:
                coefficient += A[index_a]
                coefficient %= p
                index_a += p-1
            if coefficient > 0: break
        else:
            if p not in used: ans.append(p)

ans.sort()
for a in ans: print(a)
H, W = map(int, input().split())
s = np.array([list(input()) for _ in range(H)])
s = np.pad(s, 1, "constant")
white = (s == ".").sum()
q = [(0, 1, 1)]

while q:
    d, x, y = q.pop(0)
    if x ==H and y == W :
        print(white - (d + 1))
        exit()
    for dx, dy in [[0,1], [0, -1], [1,0], [-1,0]]:
        x = x + dx
        y = y + dy
        if s[x][y] == '.':
            s[x][y] = '#'
            q.append((d+1, x, y))
print(-1)

### FIXED CODE ###

H, W = map(int,input().split())
s = []
black = 0
for i in range(H):
    tmp = list(input())
    s.append(tmp)
    for j in range(W):
        if tmp[j] == "#":
            black += 1
white = H*W - black
 
 
q = [(0,0,0)]
s[0][0] = "#"
while q:
    i, j, cnt = q.pop(0)
    for di, dj in [(1,0),(0,1),(-1,0),(0,-1)]:
        ni, nj = i+di, j+dj
        if ni == H-1 and nj == W-1:
            print(white-cnt-2)
            exit(0)
        elif 0 <= ni < H and 0 <= nj < W and s[ni][nj] == ".":
            s[ni][nj] = "#"
            q.append((ni,nj,cnt+1))
print(-1)
from sys import stdin
n,k=list(map(int,input().split()))
c=1
while True:
    n//=k
    if n == 0
        break
    else:
        c+=1

print(c)


### FIXED CODE ###

from sys import stdin

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

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)
c,a,b = map(int,input().split())
area = c * a // 2
print(ans)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(a*b//2)
W, H = map(int, raw_input().split())
p = sorted([(i, int(raw_input())) for i in xrange(W)], key=lambda x:-x[1])
q = sorted([(i, int(raw_input())) for i in xrange(H)], key=lambda x:-x[1])

class UnionFind(object):
    def __init__(self, n):
        self.uf = [-1 for _ in xrange(n)]

    def union(self, x, y):
        x = self.find(x[0] + x[1]*(W+1))
        y = self.find(y[0] + y[1]*(W+1))
        if x == y:
            return False
        if self.uf[x] >= self.uf[y]:
            self.uf[y] += self.uf[x]
            self.uf[x] = y
        else:
            self.uf[x] += self.uf[y]
            self.uf[y] = x
        return True

    def find(self, x):
        leaves = []
        while self.uf[x] >= 0:
            leaves.append(x)
            x = self.uf[x]
        for lf in leaves:
            self.uf[lf] = x
        return x

uf = UnionFind((W+1)*(H+1))
ans = 0
while len(p) > 0 or len(q) > 0:
    if len(q) == 0 or (len(p) > 0 and p[-1][1] <= q[-1][1]):
        i, cost = p.pop()
        for j in xrange(H+1):
            if uf.union((i, j), (i+1, j)):
                ans += cost
    else:
        j, cost = q.pop()
        for i in xrange(W+1):
            if uf.union((i, j), (i, j+1)):
                ans += cost
print ans


### FIXED CODE ###

W, H = map(int, raw_input().split())
p = sorted([(i, int(raw_input())) for i in xrange(W)], key=lambda x:-x[1])
q = sorted([(i, int(raw_input())) for i in xrange(H)], key=lambda x:-x[1])
ans = 0
pe, qe, ae = 0, 0, (W+1)*(H+1)-1
while len(p)> 0 or len(q) > 0:
    if len(q) == 0 or (len(p) > 0 and p[-1][1] <= q[-1][1]):
        i, cost = p.pop()
        pe += 1
        ans += cost*(H+1-qe)
    else:
        j, cost = q.pop()
        qe += 1
        ans += cost*(W+1-pe)

print ans
s = input()
if s[0] == "A":
    x = s.find("C")
    if 2<=x and x != len(s)-1:
        s[0]="a"
        s[x]="c"
        if s.islower():
            print("AC")
            exit()
print("WA")

### FIXED CODE ###

s = input()
e = 0
if s[0] == "A":
  for i in range(2,len(s)-1):
    b = s[i]
    if b == "C":
      e = 1
      f = i
      break
  if e == 1:
    s = s[:f] + s[f+1:]
    s = s[1:]
    if s.islower():
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")
from itertools import accumulate
N = int( input())
A = list( map( int, input().split()))
A.sort()
l = -1
r = N-1
B = list( accumulate(A))
while r - l > 1:
    m = (l+r)//2
    # now = sum(A[:m+1])
    check = 1
    for i in range(m+1,N):
        if B[i] <= now*2:
            pass
        else:
            check = 0
            break
    if check == 1:
        r = m
    else:
        l = m
print(N-r)

### FIXED CODE ###

N = int( input())
A = list( map( int, input().split()))
A.sort()
l = -1
r = N-1
while r - l > 1:
    m = (l+r)//2
    now = sum(A[:m+1])
    check = 1
    for i in range(m+1,N):
        if A[i] <= now*2:
            now += A[i]
        else:
            check = 0
            break
    if check == 1:
        r = m
    else:
        l = m
print(N-r)
# coding: utf-8

import math
from functools import reduce


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


def main():
    n, x = map(int, input().split())
    xi = map(int, input().split())

    diffs = []
    for i in xi:
        diffs.append(abs(x - i))

    print(gcd_list(diffs))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# coding: utf-8

from functools import reduce


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


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


def main():
    n, x = map(int, input().split())
    xi = map(int, input().split())

    diffs = []
    for i in xi:
        diffs.append(abs(x - i))

    print(gcd_list(diffs))


if __name__ == '__main__':
    main()
import sys

x, y = map(int, sys.stdin.readline().split())

if ord(x) < ord(y):
    print("<")
elif ord(x) > ord(y):
    print(">")
else:
    print("=")

### FIXED CODE ###

import sys

x, y = map(str, sys.stdin.readline().split())

if ord(x) < ord(y):
    print("<")
elif ord(x) > ord(y):
    print(">")
else:
    print("=")
n = int(input())
s = str(input())
r = [i + 1 for i in range(n) if s[i] == 'R']
g = [i + 1 for i in range(n) if s[i] == 'G']
b = [i + 1 for i in range(n) if s[i] == 'B']

def count(x,y,z):
    c = 0
    for i in x:
        for j in y:
            if i > j: continue 
            for k in z:
                if j > k: continue 
                if j - i != k - j:
                    c += 1
    return c

ans = 0
ans += count(r,g,b)
ans += count(r,b,g)
ans += count(b,r,g)
ans += count(b,g,r)
ans += count(g,r,b)
ans += count(g,b,r)

print(ans)n = int(input())
s = str(input())
r = [i + 1 for i in range(n) if s[i] == 'R']
g = [i + 1 for i in range(n) if s[i] == 'G']
b = [i + 1 for i in range(n) if s[i] == 'B']

def count(x,y,z):
    c = 0
    for i in x:
        for j in y:
            if i > j: continue 
            for k in z:
                if j > k: continue 
                if j - i != k - j:
                    c += 1
    return c

ans = 0
ans += count(r,g,b)
ans += count(r,b,g)
ans += count(b,r,g)
ans += count(b,g,r)
ans += count(g,r,b)
ans += count(g,b,r)

print(ans)

### FIXED CODE ###


def main():
    n = int(input())
    s = str(input())
    cnt = 0
    r = s.count('R')
    g = s.count('G')
    b = s.count('B')

    for i in range(n):
        for j in range(i,n):
            if i == j:
                continue
            k = 2 * j - i
            if k > len(s) - 1:
                continue
            if s[i] == s[j] or s[j] == s[k] or s[k] == s[i]:
                continue

            cnt +=1

    all = r * g * b
    print(all - cnt) 
if __name__ == "__main__":
    main()
S=input()
T=input()
print("T"+"S")

### FIXED CODE ###

S, T=input().split()
print(T+S)
k, s = input().split()
k = int(k)

if len(s) <= k:
    print(s)
else:
    print(s[0:k] + "...")


### FIXED CODE ###

K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    S = S[0:K]+"..."
    print(S)
if __name__ == "__main__":

	n,k = list(map(int, input().split()))
	s = input()
	s += '0' if s[n-1] == '1' else '0'
	c = []

	j = 0
	for i in range(1, n+1):
		if s[i-1] == s[i]:
			j += 1
		else:
			c.append([s[i-1], j+1])
			j = 0

	for i in range(1, len(c)):
		c[i][1] += c[i-1][1]

	if 2*k >= 2*len(c):
		print(c[-1][1])
		quit()
	else:
		p = 0
		res = 0
		if c[0][0] == '0':
			res = c[(k-1)+1][1] if k == 1 else c[k+1][1]
			p += 1
		else:
			res = c[(k-1)+2][1] if k == 1 else c[k+2][1]
			p += 2

		while p+2*k < len(c):
			res = max(res, c[p+2*k][1] - c[p-1][1])
			p += 2

		print(res)
		quit()

### FIXED CODE ###

n,k = list(map(int, input().split()))
s = input()
if (s.find('0') < 0) or (s.find('1') < 0):
	print(len(s))
	quit()
else:
	s += '0' if s[n-1] == '1' else '1'
c = []

j = 0
for i in range(1, n+1):
	if s[i-1] == s[i]:
		j += 1
	else:
		c.append([s[i-1], j+1])
		j = 0

for i in range(1, len(c)):
	c[i][1] += c[i-1][1]

if 2*k >= len(c):
	print(c[-1][1])
	quit()
else:
	p = 0
	res = 0
	if c[0][0] == '0':
		res = c[1][1] if k == 1 else c[2*k-1][1]
		p += 1
	else:
		res = c[2][1] if k == 1 else c[2*k][1]
		p += 2

	while p+2*k < len(c):
		res = max(res, c[p+2*k][1] - c[p-1][1])
		p += 2

	res = max(res, c[-1][1] - c[(len(c)-1) - 2*k][1]) if c[-1][0] == '0' else max(res, c[-1][1] - c[(len(c)-1) - (2*k+1)][1])

	print(res)
	quit()
S = input()
	if S[-1] = "s"
		print( S + "es" )
		else print( S + "s" )

### FIXED CODE ###

S = input()
if S[-1] == "s":
  print( S + "es" )
else: 
  print( S + "s" )
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

N = int(sys.stdin.readline())
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(N - 1)]
Q, K = list(map(int, sys.stdin.readline().split()))
X, Y = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(Q)]))


def dfs(v, a, graph, ret=None):
    ret = ret or {}
    ret[v] = a
    for u, w in graph[v]:
        if u in ret:
            continue
        dfs(u, a + w, graph, ret)
    return ret


#: :type: list of (list of (int, int))
graph = [[] for _ in range(N + 1)]
for a, b, c in ABC:
    graph[a].append((b, c))
    graph[b].append((a, c))

dists = dfs(K, 0, graph)
for x, y in zip(X, Y):
    print(int(dists[x] + dists[y]))


### FIXED CODE ###

import heapq
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

N = int(sys.stdin.readline())
ABC = [list(map(int, sys.stdin.readline().split())) for _ in range(N - 1)]
Q, K = list(map(int, sys.stdin.readline().split()))
X, Y = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(Q)]))


def dijkstra(graph, start):
    """
    TODO: start していしなかったときに全部の距離を知りたい

    マイナスの辺があっちゃダメ
    scipy.sparse.csgraph.dijkstra は内部で使われてるフィボナッチヒープが一部のケースでめっちゃ遅いのであんまり使わないほうがよさげ
    https://atcoder.jp/contests/soundhound2018-summer-qual/submissions/5311823

    :param list of (list of (int, int)) graph:
        graph[from_index]: (to_index, weight)
    :param int start:
    :return:
    """
    dist = [float('inf') for _ in range(len(graph))]
    dist[start] = 0
    heap = []
    heapq.heappush(heap, (0, start))

    while len(heap) > 0:
        w, v = heapq.heappop(heap)
        if w > dist[v]:
            continue
        for u, dw in graph[v]:
            if w + dw < dist[u]:
                dist[u] = w + dw
                heapq.heappush(heap, (w + dw, u))
    return dist


#: :type: list of (list of (int, int))
graph = [[] for _ in range(N + 1)]
for a, b, c in ABC:
    graph[a].append((b, c))
    graph[b].append((a, c))

dists = dijkstra(graph, K)

for x, y in zip(X, Y):
    print(int(dists[x] + dists[y]))
n = int(input())
arr = list(map(int, input().split()))
if 0 in arr:
    print(0 + '\n')
else:
    mul = 1
    for n in arr:
        mul *= n
        if mul > 10**18:
            print(-1 + '\n')
            break
    else:
        print(mul + '\n')

### FIXED CODE ###

n = int(input())
arr = list(map(int, input().split()))
if 0 in arr:
    print('0' + '\n')
else:
    mul = 1
    for n in arr:
        mul *= n
        if mul > 10**18:
            print('-1' + '\n')
            break
    else:
        print(str(mul) + '\n')
N = int(input())
A=[int(i) for i in input().split()]

B = [0 for i in range(len(A))]
for i in A:
    B[i] =B[i] + 1

for i in B:
    print(i)

### FIXED CODE ###

N = int(input())
A=[int(i) for i in input().split()]

B = [0 for i in range(N)]
for i in A:
    B[i-1] =B[i-1] + 1

for i in B:
    print(i)
def sig(x):
    return 1 if x==1 else sig(x-1)+x


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

upper=int(sig(b-a))
print(upper-b)




### FIXED CODE ###

print('ABD' if int(input())>999 else 'ABC')
#from operator import itemgetter
#from collections import Counter
#import heapq
N = int(input())
S = input()
#N, M = map(int, input().split())
#A = list(map(lambda x: int(x)*(-1), input().split()))
#A = [int(input()) for i in range(N)]
#C = [list(map(int, input().split())) for i in range()]
R  =[]
G  =[]
B  =[]

START_TIME = time.time()
for i, s in enumerate(S):
    if s == 'R':
        R.append(i)
    elif s == 'G':
        G.append(i)
    else:
        B.append(i)
answer = len(R)*len(G)*len(B)
hiku = 0
for r in R:
    for g in G:
        for b in B:
            if b > max(r,g)+abs(r-g):
                break
            if abs(r-g) == abs(g-b) or abs(r-b) == abs(b-g) or abs(b-r) == abs(r-g):
                hiku += 1
answer -= hiku
print(answer)



### FIXED CODE ###

N = int(input())
S = input()
#N, M = map(int, input().split())
#A = list(map(lambda x: int(x)*(-1), input().split()))
#A = [int(input()) for i in range(N)]
#C = [list(map(int, input().split())) for i in range()]
R  =[]
G  =[]
B  =[]
for i, s in enumerate(S):
    if s == 'R':
        R.append(i)
    elif s == 'G':
        G.append(i)
    else:
        B.append(i)
answer = len(R)*len(G)*len(B)
hiku = 0

for i in range((N-1)//2):
    for j in range(N-i-i-2):
        if S[j] != S[j+i+1] and S[j+i+1] != S[j+i+i+2] and S[j] != S[j+i+i+2]:
            hiku += 1


answer -= hiku
print(answer)
n,x,t=list(map(int,input().split()))
a=n%x
b=n//x

if a==0:
  c=b*t
else :
  c=(b+1)*t
print(C)



### FIXED CODE ###

n,x,t=list(map(int,input().split()))
a=n%x
b=n//x
 
if a==0:
  c=b*t
else:
  c=(b+1)*t
print(c)
#import numpy as np
#ins = [int(input()) for _ in range(5)] 

times = []
#for num in ins:
tmp = []
for _ in range(5):
    num = int(input())
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    tm = num % 10
    if tm >= 1:
        tmp.append(tm)
    #print(num)
    yobun = min(tmp)

#tmp = np.asarray(ins) % 10
#tmp = tmp[tmp >= 1]
#yobun = np.min(tmp)

if yobun == 0:
    yobun = 10

all_time = sum(times) - (10-yobun)
print(all_time)

### FIXED CODE ###


times = []
#for num in ins:
tmp = []
for _ in range(5):
    num = int(input())
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    tm = num % 10
    if tm >= 1:
        tmp.append(tm)
    #print(num)

if len(tmp) == 0:
    tmp = [0]

yobun = min(tmp)
if yobun == 0:
    yobun = 10

all_time = sum(times) - (10-yobun)
print(all_time)
day=['SUN','MON','TUE','WED','THU','FRY','SAT']
print(7-day.index(input()))

### FIXED CODE ###

day=['SUN','MON','TUE','WED','THU','FRI','SAT']
print(7-day.index(input()))
x, y = map(int, input().split())

if(x == 0 & y == 0):
    false
elif(x < y) :
    print("{0} {1}".format(x, y))
else:
    print("{0} {1}".format(y, x))



### FIXED CODE ###

while True:
    x,y = map(int, input().split(" "))
    if (x,y) == (0,0): 
        break
    elif (x < y):
        print(x, y)
    else :
        print(y, x)
n,k,m=map(int,input().split())
a=list((map(int,input(),split()))
ans=max(0,n*m-sum(a))
print(ans if n*m-s<=k else -1)


### FIXED CODE ###

c=input()
print(chr(ord(c)+1))
import bisect

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

l.sort()
b_c.sort(key=lambda x:x[1],reverse=True)

print(b_c)

idx = 0
ans = 0

for i in range(m):
    if l[idx:][0] >= b_c[i][1]:
        break
    
    temp = bisect.bisect_left(l[idx:],b_c[i][1])
    if temp > b_c[i][0]:
        temp = b_c[i][0]
    ans += temp*b_c[i][1]
    idx += temp

ans += sum(l[idx:])
print(ans)

### FIXED CODE ###

from heapq import heappush, heappop

n,m = map(int,input().split())
heap = []

for i in map(int,input().split()):
    heappush(heap,i)

bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key = lambda x: -x[1])

for b,c in bc:
    for j in range(b):
        a = heappop(heap)
        if a < c:
            heappush(heap,c)
        
        else:
            heappush(heap, a)
            break
        
print(sum(heap))
n=int(input())
w=list(map(int,input().split()))
ans=[]
total=sum(w)
for i in range(n):
    diff=abs(total-w[:i])
    ans.append(diff)
print(min(ans))



### FIXED CODE ###

n=int(input())
w=list(map(int,input().split()))
ans=[]
total=sum(w)
for i in range(n):
    diff=total-sum(w[:i])
    ans.append(abs(diff-sum(w[:i])))
print(min(ans))