Harryxun/stf_run huggingface dataset:
class Work:
    count=0
    def __init__(self,payday,money):
        Work.count+=1
        self.count=count
        self.payday=payday
        self.money=money
 #moneyが大きい方、同じなら早くもらえる方、それも同じなら最初に書いてある方が強い方
    def __ft__(self,other):
        if self.money>other.money:
            return True
        if self.money==other.money:
            if self.payday<other.payday:
                return True
            if self.payday==other.payday:
                if self.count<other.count:
                    return True
        return False

    def __gt__(self,other):
        if self.money<other.money:
            return True
        if self.money==other.money:
            if self.payday>other.payday:
                return True
            if self.payday==other.payday:
                if self.count>other.count:
                    return True
        return False

#バイトの数、いつまでに稼ぐのか 
n,limit=[int(i) for i in input().split()]

#バイトのリストを作り、クラスを入れる O(n)
baitolist=[]
for i in range(n):
    payday,money=[int(i) for i in input().split()]
    work=Work(payday,money)
    baitolist.append(work)

#日数でランク付け　O(n)
summoney=0    
rank=[[] for i in range(limit+1)]
for baito in baitolist:
    if baito.payday<=limit:
        rank[baito.payday].append(baito)

        
import heapq
accessible=[]
count=1


for i in range(limit):
    for baito in rank[count]:
        heapq.heappush(accessible,baito)
    if accessible!=[]:
        dowork=heapq.heappop(accessible)
        summoney+=dowork.money
    count+=1
    
    
print(summoney)   

### FIXED CODE ###

class Work:
    count=0
    def __init__(self,payday,money):
        Work.count+=1
        self.count=Work.count
        self.payday=payday
        self.money=money
 #moneyが大きい方、同じなら早くもらえる方、それも同じなら最初に書いてある方が強い方
    def __ft__(self,other):
        if self.money>other.money:
            return True
        if self.money==other.money:
            if self.payday<other.payday:
                return True
            if self.payday==other.payday:
                if self.count<other.count:
                    return True
        return False

    def __gt__(self,other):
        if self.money<other.money:
            return True
        if self.money==other.money:
            if self.payday>other.payday:
                return True
            if self.payday==other.payday:
                if self.count>other.count:
                    return True
        return False

#バイトの数、いつまでに稼ぐのか 
n,limit=[int(i) for i in input().split()]

#バイトのリストを作り、クラスを入れる O(n)
baitolist=[]
for i in range(n):
    payday,money=[int(i) for i in input().split()]
    work=Work(payday,money)
    baitolist.append(work)

#日数でランク付け　O(n)
summoney=0    
rank=[[] for i in range(limit+1)]
for baito in baitolist:
    if baito.payday<=limit:
        rank[baito.payday].append(baito)

        
import heapq
accessible=[]
count=1


for i in range(limit):
    for baito in rank[count]:
        heapq.heappush(accessible,baito)
    if accessible!=[]:
        dowork=heapq.heappop(accessible)
        summoney+=dowork.money
    count+=1
    
    
print(summoney)
N,A,B=map(int, input())
ans=(N-N%(A+B))*A/(A+B)+min(A,N%(A+B))
print(ans)

### FIXED CODE ###

N, A, B=map(int, input().split())
K=int((N-N%(A+B))/(A+B))
ans=(K*A+min(A,N%(A+B)))
print(ans)
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

def main():
    n = int(input())
    a = [int(a) for a in input().split()]

    maxv = 0
    for nn in range(n):
        gcdv = gcd_list(a[:nn]+a[nn+1:])
        if gcdv > maxv:
            maxv = gcdv
    print(maxv)

if __name__ == '__main__':
    main()


### FIXED CODE ###

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

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MAT(h): return [list(map(int, input().split())) for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = INT()
    A = LIST()
    L = [0] * N
    R = [0] * N
    M = [0] * N
    for i in range(N - 1):
        L[i + 1] = gcd(L[i], A[i])
        R[N - i - 2] = gcd(R[N - i - 1], A[N - i - 1])
    maxv = 0
    for i in range(N):
        M[i] = gcd(L[i], R[i])
        if maxv < M[i]:
            maxv = M[i]
    print(maxv)

if __name__ == '__main__':
    main()
A,B,C = map(int,input().split())
ans = None

if A == B and B == C:
  print(-1)
  exit()
  
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  A,B,C = (B+C)//2,(C+A)//2,(A+B)//2
  ans += 1
  
  if A == B and B == C:
    print(-1)
    exit()
    
print(ans)


### FIXED CODE ###

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

if not (A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
  print(0)
  exit()

if A == B and B == C:
  print(-1)
  exit()
  
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
  A,B,C = (B+C)//2,(C+A)//2,(A+B)//2
  ans += 1
  
  if A == B and B == C:
    print(-1)
    exit()
    
print(ans)
def print_heap():
    for i in range(n):
        if (i-1)//2 in range(n):
            if 2*i+1 in range(n):
                if 2*1+2 in range(n):
                    print("node {}: key = {}, parent key = {}, left key = {}, right key = {},"
                          .format(i+1, heap[i], heap[(i-1)//2], heap[2*i+1], heap[2*i+2]))
                else:
                    print("node {}: key = {}, parent key = {}, left key = {},"
                          .format(i+1, heap[i], heap[(i-1)//2], heap[2*i+1]))
            else:
                print("node {}: key = {}, parent key = {},"
                      .format(i+1, heap[i], heap[(i-1)//2]))
        else:
            if 2*i+1 in range(n):
                if 2*1+2 in range(n):
                    print("node {}: key = {}, left key = {}, right key = {},"
                          .format(i+1, heap[i], heap[2*i+1], heap[2*i+2]))
                else:
                    print("node {}: key = {}, left key = {},"
                          .format(i+1, heap[i], heap[2*i+1]))
            else:
                print("node {}: key = {},".format(i+1, heap[i]))


if __name__ == "__main__":
    n = int(input())
    heap = list(map(int, input().split()))
    print_heap()

### FIXED CODE ###

def print_heap():
    for i in range(n):
        if (i-1)//2 in range(n):
            if 2*i+1 in range(n):
                if 2*i+2 in range(n):
                    print("node {}: key = {}, parent key = {}, left key = {}, right key = {}, "
                          .format(i+1, heap[i], heap[(i-1)//2], heap[2*i+1], heap[2*i+2]))
                else:
                    print("node {}: key = {}, parent key = {}, left key = {}, "
                          .format(i+1, heap[i], heap[(i-1)//2], heap[2*i+1]))
            else:
                print("node {}: key = {}, parent key = {}, "
                      .format(i+1, heap[i], heap[(i-1)//2]))
        else:
            if 2*i+1 in range(n):
                if 2*i+2 in range(n):
                    print("node {}: key = {}, left key = {}, right key = {}, "
                          .format(i+1, heap[i], heap[2*i+1], heap[2*i+2]))
                else:
                    print("node {}: key = {}, left key = {}, "
                          .format(i+1, heap[i], heap[2*i+1]))
            else:
                print("node {}: key = {}, ".format(i+1, heap[i]))


if __name__ == "__main__":
    n = int(input())
    heap = list(map(int, input().split()))
    print_heap()
N,M=map(int,input().split())
cake=[list(map(int,input().split())) for _ in range(N)]
ans=0
if M=0:
    print(ans)
    exit()
for i in range(1<<3):
    point=[0]*N
    for j in range(N):
        for k in range(3):
            point[j]+=(-1+(i>>k & 1)*2)*cake[j][k]
    point.sort()
    ans=max(ans,sum(point[-M:]))
print(ans)


### FIXED CODE ###

N,M=map(int,input().split())
cake=[list(map(int,input().split())) for _ in range(N)]
ans=0
for i in range(1<<3):
    point=[0]*N
    for j in range(N):
        for k in range(3):
            point[j]+=(-1+(i>>k & 1)*2)*cake[j][k]
    point.sort()
    ans=max(ans,sum(point[-M:]))
    if M==0:
        ans=0
print(ans)
x,a=map(int, input().split())
if x<a:
	return 0
else:
	return 10


### FIXED CODE ###

x,a=map(int, input().split())
if x<a:
	print(0)
else:
	print(10)
N, M = map(int, input().split())

# 隣接リストを作成
adjacencyList = [[0] for i in range(N)]

# 距離の情報
dp = [0] * N

# 入次数　（いりじすう）
deg = [0] * N

for _ in range(M):
    v, nv = map(int, input().split())
    adjacencyList[v-1].append(nv-1)
    #　入次数に1を足す
    deg[nv-1] += 1
    
queue = []

# BFS探索
# 入次数がゼロの頂点から探索を始める
for v in range(N):
    if deg[v] == 0:
        queue.append(v)

while queue:
    # 現在の頂点をqueueからpop
    v = queue.pop(0)
    for nv in adjacencyList[cur]:
        # 探索済みの頂点の入次数を減らす
        deg[nv] -= 1
        
        # 完全に探索済みの頂点の入次数がゼロの時、経路の距離を出発点から計算
        if deg[nv] == 0:
            # 頂点をqueueに追加する
            queue.append(nv)
            dp[nv] = max(dp[v] + 1, dp[nv])
            
print(max(dp))

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**9)

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

g = [[] for i in range(n+1)]

dp = [-1] * (n+1)
for _ in range(m):
    v1 , v2 = map(int,input().split())
    g[v1].append(v2)
    
# finding longest path for vertice i
def dfs(i):
    if dp[i]!=-1:
        return dp[i]
    temp = 0
    for nv in g[i]:
        temp = max(temp, dfs(nv)+1)

    dp[i]=temp
    return temp
  
# finding overall longest path  
res = 0  
for i in range(1,n+1):
    res = max(res, dfs(i))
print(res)
t = input()
if(t[0] == '?'):
    if(t[1] == 'D'):  t = "".join(['P' , t[1:]])
    elif(t[1] == '?'): t = "".join(['PD', t[2:]])
    else: t = "".join(['D', t[1:]])
if(t[len(t) -1] == '?'):
    t = "".join([t[:len(t) - 1], 'D'])
for i in range(len(t)):
    if(t[i] == '?'):
        if(t[i-1] == 'P'): t = "".join([t[:i], 'D', t[i+1:]])
        elif(t[i+1] == 'D'):  t = "".join([t[:i], 'P', t[i+1:]])
        elif(t[i+1] == '?'):  t = "".join([t[:i], 'PD', t[i+2:]])
print(t)

### FIXED CODE ###

t = input()
if(len(t) == 1):
    if (t[0] == '?'): t = "D"
if(t[0] == '?'):
    if  (t[1] == 'D'): t = "".join(['P' , t[1:]])
    elif(t[1] == '?'): t = "".join(['PD', t[2:]])
    else:              t = "".join(['D' , t[1:]])
if(t[-1] == '?'):
    t = "".join([t[:-1], 'D'])
for i in range(len(t)-1):
    if(t[i] == '?'):
        if(t[i-1] == 'P'):    t = "".join([t[:i], 'D' , t[i+1:]])
        elif(t[i+1] == 'D'):  t = "".join([t[:i], 'P' , t[i+1:]])
        elif(t[i+1] == 'P'):  t = "".join([t[:i], 'D' , t[i+1:]])
        elif(t[i+1] == '?'):  t = "".join([t[:i], 'PD', t[i+2:]])
print(t)
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''

from collections import deque, defaultdict, Counter
import math
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


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

# a/b の切り上げ


def round_up(a, b):
    """ a/b の切り上げ """
    c = (a + b - 1) / b
    return c


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)
"""

def main():
    s = input()

    cnt = [0] * 2019
    # print(cnt)
    cnt[0] = 1
    ans = 0
    b = 0
    t = 1
    for i in s:
        b = b + int(i) * t
        amari = b % 2019
        cnt[amari] += 1
        t *= 10 % 2019

    for i in cnt:
        ans += i * (i - 1) // 2
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

s = input()[::-1]

sum_of_digits = 0

cnts = [0] * 2019

cnts[0] = 1

d = 1

for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019
    cnts[sum_of_digits] += 1

ans = 0

for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

print(ans)
import functools

def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    return a * b / gcd(a, b)

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

lcmVal = int(functools.reduce(lcm, a))
print(sum(map(lambda x: (lcmVal-1) % x, a)))


### FIXED CODE ###

import functools

def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    return a * b / gcd(a, b)

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

lcmVal = int(functools.reduce(lcm, a, 0))
print(sum(map(lambda x: (lcmVal-1) % x, a)))
mod = 10**9 + 7


def main():
    n = int(input())
    A = [int(a) for a in input().split()]
    ans = 0
    for k in range(60):
        a = 0
        for i in range(n):
            a += A[i] & 1
            A[i] << = 1
        da = (1 << k) % mod
        da *= (n - a)*a
        da %= mod
        ans += da
        ans %= mod
    print(ans)


main()


### FIXED CODE ###


mod = 10**9 + 7


def main():
    n = int(input())
    A = [int(a) for a in input().split()]
    ans = 0
    for k in range(60):
        a = 0
        for i in range(n):
            a += A[i] & 1
            A[i] >>= 1
        da = (1 << k) % mod
        da *= (n - a)*a
        da %= mod
        ans += da
        ans %= mod
    print(ans)


main()
l,r,d=map(input().split(""))
c=0
for i in range(l,r+1,1):
  if i%d==0:
    c+=1
print(c)


### FIXED CODE ###

l,r,d=map(int,input().split(" "))
c=0
for i in range(l,r+1,1):
    if i%d==0:
        c+=1
print(c)
a,b=map(int,input().split());print('Zero'*(a+b==0or abs(a+b)<abs(a)+abs(b))or'NPeogsaittiivvee'[a>0or(b-a)%2::2])

### FIXED CODE ###

a,b=map(int,input().split());print('Zero'*(a+b==0or abs(a+b)<abs(a)+abs(b))or'NPeogsaittiivvee'[a>0or(b-a)%2::2])
l = list(map(int,input().split()))
a = l[0]
b = l[1]
c = l[2]
k = l[3]-1
if (c-k-a-b) >0:
  print(a-1(c-k-a-b))
else:
  print(a)

### FIXED CODE ###

l = list(map(int,input().split()))
a = l[0]
b = l[1]
c = l[2]
k = l[3]
if (k-a-b) >0:
  print(a-1*(k-a-b))
else:
  print(min(a,k))
N = int(input())
n = N[-1]
if n == "2" or n == "4" or n == "5" or n == "7" or n == "9":
    print("hon")
elif n == "0" or n == "1" or n == "6" or n == "8":
    print("pon")
else:
    print("bon")

### FIXED CODE ###

N = input()
n = N[-1]
if n == "2" or n == "4" or n == "5" or n == "7" or n == "9":
    print("hon")
elif n == "0" or n == "1" or n == "6" or n == "8":
    print("pon")
else:
    print("bon")
r, l, m = map(int, input().split())
rr, ll = [0] * r, [0] * l
tt = [[0] * l for i in range(r)]
for i in range(m):
    hi, wi = map(int, input().split())
    rr[hi-1] += 1
    ll[wi-1] += 1
    tt[hi-1][wi-1] = 1
i = rr.index(max(rr))
flag = max(ll)
ans = max(rr)
for j in range(l):
    if ll[j] == flag and tt[i][j] != 1:
        ans += flag
        print(ans)
        exit()

print(ans + flag - 1)


### FIXED CODE ###

import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  H,W,M=LI()
  h=[0]*H
  w=[0]*W
  d={}
  for _ in range(M):
    a,b=LI()
    a-=1
    b-=1
    h[a]+=1
    w[b]+=1
    d[(a,b)]=1

  h_koho=[]
  w_koho=[]

  h_max=max(h)
  w_max=max(w)

  for i,x in enumerate(h):
    if x==h_max:
      h_koho.append(i)
  for i,x in enumerate(w):
    if x==w_max:
      w_koho.append(i)

  for x in h_koho:
    for y in w_koho:
      if (x,y) not in d:
        return h_max+w_max

  return h_max+w_max-1

# main()
print(main())
N = int(input())
Ar =list(map(str,input().split))

S = list(Ar[0])
T = list(Ar[1])

Ans_Ar = []

for i in range(N):
  Ans_Ar.append(S[i])
  Ans_Ar.append(T[i])

result = ''.join(Ans_Ar)
print(result)

### FIXED CODE ###

N = int(input())
Ar =list(map(str,input().split()))

S = list(Ar[0])
T = list(Ar[1])

Ans_Ar = []

for i in range(N):
  Ans_Ar.append(S[i])
  Ans_Ar.append(T[i])

result = ''.join(Ans_Ar)
print(result)
K=int(input())

ARGS=input().split()
A=int(ARGS[0])
B=int(ARGS[1])

largest=B / K * K
if A <= largest
    print('OK')
else:
    print('NG')

### FIXED CODE ###

K=int(input())

ARGS=input().split()
A=int(ARGS[0])
B=int(ARGS[1])

if A <= B//K*K:
    print('OK')
else:
    print('NG')
import copy


cnt = 0


def insSort(A, n, g):
    global cnt

    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v


def shellSort(A, n):
    G = []
    i = 1
    while True:
        G.append(i)
        i *= 4
        if i > n - 1:
            break
    G.reverse()

    print(len(G))
    print(*G)

    for i in G:
        insSort(A, n, i)


n = int(input())
arr = []
for i in range(n):
    arr.append(int(input()))

shellSort(arr, n)

print(cnt)

for s in arr:
    print(s)



### FIXED CODE ###

cnt = 0


def insSort(A, n, g):
    global cnt

    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v


def shellSort(A, n):
    G = []
    i = 1
    while True:
        G.append(i)
        i = i * 3 + 1
        if i > n - 2:
            break
    G.reverse()

    print(len(G))
    print(*G)

    for i in G:
        insSort(A, n, i)


n = int(input())
arr = []
for i in range(n):
    arr.append(int(input()))

shellSort(arr, n)

print(cnt)

for s in arr:
    print(s)
S = list(input())
length = []
t = 0
for i in range(len(S)):
  if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
    t += 1
  else:
    length.append(t)
    t = 0
print(max(length))
    

### FIXED CODE ###

S = list(input())
length = []
t = 0
for i in range(len(S)):
  if S[i] == "A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
    t += 1
  else:
    length.append(t)
    t = 0
length.append(t)
print(max(length))
A,B,C = map(int, input().split())
if A==7 and B==5 and C==5:
  print("Yes")
else if A==5 and B==5 and C==7:
  print("Yes")
else if A==5 and B==7 and C==5:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

A,B,C = map(int, input().split())
if A==7 and B==5 and C==5:
  print("YES")
elif A==5 and B==5 and C==7:
  print("YES")
elif A==5 and B==7 and C==5:
  print("YES")
else:
  print("NO")
n, m = map(int, input().split())
a = [0] * m
dp = [1, 1]
x = 0
for i in range(m):
    a[i] = int(input())
if a[0] == 1:
    dp[1] = 0
    x = 1

for i in range(len(a)-1):
    if a[i+1] - a[i] == 1:
        print(0)
        exit(0)


for i in range(2, n+1):
    if i != a[x]:
        dp.append((dp[-1] + dp[-2]) % 1000000007)
    else:
        dp.append(0)
        if x < len(a)-1:
            x += 1
# print(dp)
print(dp[-1])


### FIXED CODE ###

n, m = map(int, input().split())
a = [0] * 100100
dp = [1, 1]
x = 0
for i in range(m):
    a[i] = int(input())
if a[0] == 1:
    dp[1] = 0
    x = 1

for i in range(len(a)-1):
    if a[i+1] - a[i] == 1:
        print(0)
        exit(0)


for i in range(2, n+1):
    if i != a[x]:
        dp.append((dp[-1] + dp[-2]) % 1000000007)
    else:
        dp.append(0)
        if x < len(a)-1:
            x += 1
# print(dp)
print(dp[-1])
N=input();print('DENIED'if any([x%2==0 and(x%3andx%5)for x in map(int,input().split())])else'APPROVED')

### FIXED CODE ###

import sys
N = int(input())
A = [int(i) for i in input().split()]
for i in A:
  if i%2 == 0 and (not i%3 == 0 and not i % 5 == 0):
    print("DENIED")
    sys.exit()
  else :
    continue
print("APPROVED")
import numpy as np
print(char(ord(input()[0])+1))

### FIXED CODE ###

print(chr(ord(input()[0])+1))
I = [int(input()) for _ in range(6)]

I[0] = a
I[4] = e
I[5] = k

if e-a > k:
	print(":(")
else :
	print("Yay!")

### FIXED CODE ###

I =[int(input())for i in range(6)]

if I[4] - I[0] > I[5] :
	print(":(")
else :
	print("Yay!")
ab = int(input().replace(' ', ''))
if type(sqrt(ab)) is int:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

ab = int(input().replace(' ', ''))
import math
sq = math.sqrt(ab)
if sq - int(sq) == 0:
  print('Yes')
else:
  print('No')
while true:
    (H,W) = [int(i) i in input().split()]
    if H == W ==0:
         break

    for hc in range(H):
        for wc in range(W):
            if (hc + wc) % 2 == 0:
                print('#', end=' ')
            else:
                print('.', end=' ')
            print()
     print()

### FIXED CODE ###

while True:
    (H, W) = [int(x) for x in input().split()]
    if H == W == 0:
        break
  
    for hc in range(H):
        for wc in range(W):
            if (hc + wc)  % 2 == 0:
                print('#', end='') 
            else:
                print('.', end='')
        print()
    print()
A,B,Q = list(map(int, input().split()))
s,t,xx=[],[],[]

for i in range(A):
    s.append(int(input()))
for i in range(B):
    t.append(int(input()))
for i in range(Q):
    xx.append(int(input()))
    
import bisect
M = float('inf')

for x in xx:
    i = bisect.bisect_left(s,x)
    j = bisect.bisect_left(t,x)
    
    if (i > 0) and (j > 0):
        ll = abs(min(s[i-1]-x, t[j-1]-x))
    else:
        ll = M
    if (i > 0) and (j < B):
        lr = abs(s[i-1]-x) * 2 + (t[j]-x)
    else:
        lr = M
    if (i < A) and (j > 0):
        lr_2 = abs(t[j-1]-x) * 2 + (s[i]-x)
    else:
        lr_2 = M
    if (i < A) and (j > 0):
        rl = (s[i]-x) * 2 + abs(t[j-1] - x)
    else:
        rl = M
    if (i > 0) and (j < B):
        rl_2 = (t[j]-x) * 2 + abs(s[i-1] - x)
    else:
        rl_2 = M
    if (i < A) and (j < B):
        rr = max(s[i]-x,t[i]-x)
    else:
        rr = M

    print(min(ll,lr,rl,rr,lr_2,rl_2))

### FIXED CODE ###

A,B,Q = list(map(int, input().split()))
s,t,xx=[],[],[]

for i in range(A):
    s.append(int(input()))
for i in range(B):
    t.append(int(input()))
for i in range(Q):
    xx.append(int(input()))
    
import bisect
M = 10000000000000

for x in xx:
    i = bisect.bisect_left(s,x)
    j = bisect.bisect_left(t,x)
    
    if (i > 0) and (j > 0):
        ll = abs(min(s[i-1]-x, t[j-1]-x))
    else:
        ll = M
        
    if (i > 0) and (j < B):
        lr = abs(s[i-1]-x) * 2 + (t[j]-x)
    else:
        lr = M
        
    if (i < A) and (j > 0):
        lr_2 = abs(t[j-1]-x) * 2 + (s[i]-x)
    else:
        lr_2 = M
        
    if (i < A) and (j > 0):
        rl = (s[i]-x) * 2 + abs(t[j-1] - x)
    else:
        rl = M
        
    if (i > 0) and (j < B):
        rl_2 = (t[j]-x) * 2 + abs(s[i-1] - x)
    else:
        rl_2 = M
        
    if (i < A) and (j < B):
        rr = max(s[i]-x,t[j]-x)
    else:
        rr = M

    print(min(ll,lr,rl,rr,lr_2,rl_2))