Harryxun/stf_run huggingface dataset:
import sys
n=int(input())
X=[]
Y=[]
H=[]
MAX=100
for i in range(n):
    x,y,h=map(int,input().split())
    X.append(x)
    Y.append(y)
    H.append(h)
for posX in range(MAX+1):
    for posY in range(MAX+1):
        needH=-1
        for i in range(n):
            if H[i]>0:
                tmp=H[i]+abs(X[i]-posX)+abs(Y[i]-posY)
                if needH==-1:
                    needH=tmp
                else:
                    if needH!=tmp:
                        needH=-2
                        break
  
        if needH==-2:
            continue
        for i in range(n):
            if H[i]==0:    
                dis=abs(X[i]-posX)+abs(Y[i]-posY)
                if needH>dist:
                    needH=-2
                    break         
        if needH==-2:
            continue
        print(posX,posY,needH)
        sys.exit()          

### FIXED CODE ###

import sys
n=int(input())
X=[]
Y=[]
H=[]
MAX=100
for i in range(n):
    x,y,h=map(int,input().split())
    X.append(x)
    Y.append(y)
    H.append(h)
for posX in range(MAX+1):
    for posY in range(MAX+1):
        needH=-1
        for i in range(n):
            if H[i]>0:
                tmp=H[i]+abs(X[i]-posX)+abs(Y[i]-posY)
                if needH==-1:
                    needH=tmp
                else:
                    if needH!=tmp:
                        needH=-2
                        break
                 
        if needH==-2:
            continue
        for i in range(n):
            if H[i]==0: 
                dis=abs(X[i]-posX)+abs(Y[i]-posY)
                if needH>dis:
                    needH=-2
                    break 
        if needH==-2:
            continue
        print(posX,posY,needH)
a,b = int(input().split(" "))
if (b%a == 0):
  print(a-b)
else :
  print(b-a)

### FIXED CODE ###

a,b = map(int,input().split(" "))
if (b%a == 0):
  print(a+b)
else :
  print(b-a)
import functools as fun

@fun.lru_cache(maxsize = None)
def rec(n):
	if n == 0:
		return 0
	elif n == 1:
		return abs(h[n] - h[n-1])
	else:
		return min(rec(n-1) + abs(h[n] - h[n-1]), rec(n-2) + abs(h[n] - h[n-2]))


### main

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

print(rec(N-1))



### FIXED CODE ###

def main():
	N = int(input())
	h = list( map(int, input().split()) )
	
	dp = [0 for _ in range(N)]
	dp[1] = abs(h[0] - h[1])
	for i in range(2, N):
		dp[i] = min( dp[i-1] + abs(h[i] - h[i-1]),
		             dp[i-2] + abs(h[i] - h[i-2]) )
	print(dp[N-1])

	return

main()
N, K = map(int, input().split())
num = ["0","1","2","3","4","5","6","7","8","9"]
dis = input().split()
can_use = sorted(list(set(num)-set(dis)))

sN = str(N)
L = len(sN)
ans = ""

if sN[0] in can_use:
    ans += sN[0]
else:
    if can_use[0] == "0":
        ans += can_use[1]
    else:
        ans += can_use[0]

for i in range(1,L):
    if sN[i] in can_use:
        ans += sN[i]
    else:
        ans += min(can_use)

if int(ans) < N:
    if can_use[0] != "0":
        ans = ans + can_use[1]
    else:
        ans = ans + can_use[0]

print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
dislike = list(map(str, input().split()))
num = ["0","1","2","3","4","5","6","7","8","9"]
can_use = set(num) - set(dislike)

while not set(list(str(N))) <= can_use:
    N += 1

print(N)
import numpy as np
def main():
    N,W=map(int,input().split())
    dp=np.zeros((N+1,W+1),dtype=int)
    for i in range(1,N+1):
        w,v=map(int,input().split())
        dp[i][w:]=np.maximum(dp[i-1][w:],dp[i-1][:-w]+v)
        dp[i][:w]=dp[i-1][:w]
    print(max(dp))
main()

### FIXED CODE ###

import numpy as np
N,W=map(int,input().split())
dp=np.zeros(W+1,dtype=int)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[-1])
input()
a = input().split()

x = {}
for i in a:
	if x.get(i, False):
		print("No")
		break
    x[i] = True
else:
	print("Yes")

### FIXED CODE ###

input()
a = input().split()

ans = "YES"
x = {}
for i in a:
    if x.get(i, False):
        ans = "NO"
        break
    x[i] = True

print(ans)
n,m,k=map(int,input().split())
edge=[[] for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    edge[a].append(b)
    edge[b].append(a)


from collections import deque
label=[-1]*n

i=0
for start in range(n):
    if label[start]!=-1:
        continue
    else:
        i+=1
        label[start]=i    
    dist_friends=[-1]*n
    dist_friends[start]=0
    f=deque([start])

    while f:
        v=f.popleft()        

        for e in edge[v]:
            if dist_friends[e]==-1 and label[e]==-1:
                dist_friends[e]=dist_friends[v]+1
                label[e]=i
                f.append(e)   

Renketsu=[0]*(n+1)

for i in label:
    Renketsu[i]+=1

Block=[0]*n
for _ in range(k):
    c,d=map(int,input().split())
    c,d=c-1,d-1
    if label[c]==label[d]:
        Block[c]+=1
        Block[d]+=1

ans=[]
for k in range(n):
    ans.append(Renketsu[label[k]]-1 - len(edge[k]) - Block[k])
print(*ans)

### FIXED CODE ###

import sys
import math
# input処理を高速化する
input = sys.stdin.readline

N=int(input())

q,mod = divmod(N,2)

print(q+mod)
print('<' if input() < input() else '>')

### FIXED CODE ###

X, Y = input().split()
print('<' if X < Y else ('>' if X > Y else '='))
N=int(input())
S=str(input())
idx_list=[]
for idx in range(len(S)-1):
    if S[idx]==S[idx+1]:
        idx_list.append(idx)

idx=max(idx_list)+1
sub_X=S[:idx]
sub_Y=S[idx:]

import collections
count_list_X=list(collections.Counter(sub_X).keys())
count_list_Y=list(collections.Counter(sub_Y).keys())


count=0
for str1 in count_list_X:
    for str2 in count_list_Y:
        if str1==str2:
            count+=1
            
print(count)

### FIXED CODE ###

N=int(input())
S=list(input())
a=[]

for i in range(1,N):
    x=set(S[:i-1:])
    y=set(S[i-1::])
    a.append(len(list(x&y)))
    
print(max(a))
import math

A = int(input())
B = int(input())
H = int(input())
M = int(input())

alpha = (H + M/60)/12 * 2*math.pi
beta = M/60 * 2*math.pi

X = A*math.cos(alpha) - B*math.cos(beta)
Y = A*math.sin(alpha) - B*math.sin(beta)

distance = math.sqrt(X*X + Y*Y)

print(distance)


### FIXED CODE ###

import math

A, B, H, M = [int(i) for i in input().split()]

alpha = (H + M/60)/12 * 2*math.pi
beta = M/60 * 2*math.pi

X = A*math.cos(alpha) - B*math.cos(beta)
Y = A*math.sin(alpha) - B*math.sin(beta)

print(math.sqrt(X*X + Y*Y))
(n,m) = [int(i) for i in input().split()]

A = []
for nc in range(n):
    A.append([int(i) for i in input().split()])

b = []
for mc in range(m):
    b.append(int(i) for i in input())

product = []
for nc in range(n):
    total = 0
    for mc in range(m):
        total += A[nc] [mc] * b[mc]

    product.append(total)

[print(p) for p in product]

### FIXED CODE ###

(n,m) = [int(i) for i in input().split()]

A = []
for nc in range(n):
    A.append([int(i) for i in input().split()])

b = []
for mc in range(m):
    b.append(int(input()))

product = []
for nc in range(n):
    total = 0
    for mc in range(m):
        total += A[nc][mc] * b[mc]

    product.append(total)

[print(p) for p in product]
import sys
input=sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort()
    ans = 0
    #print(A)
    for i in range(N):
        flag = True
        now = A[i]
        for j in range(0,i):
            if now/A[j] == now//A[j]:
                flag = False
                break
        if i == 0:
            if now == A[1]:
                flag = False
        if flag:
           ans += 1
    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int,input().split()))

chofuku_dict = {}
chofuku = []

for a in A:
    if a not in chofuku_dict:
        chofuku_dict[a] = 1
    else:
        chofuku.append(a)
        
chofuku = set(chofuku)

A = list(set(A))
A.sort()

bl = np.array([0] + [1]*A[-1])

ans = 0
for a in A:
    if bl[a] == 0:
        continue
    if a not in chofuku:
        ans += 1
    bl[2*a::a] = 0
print(ans)
# https://atcoder.jp/contests/abc088/tasks/abc088_d

H, W = map(int, input().split())
s = [input() for _ in range(H)]
d = [[-1 for _ in range(W)] for _ in range(W)]

# 0,0 to h-1, w-1
d[0][0] = 0

queue = []
queue.append((0, 0))

while len(queue) > 0:
    p = queue.pop(0)
    y, x = p[0], p[1]

    dx4 = [0, 0, 1, -1]
    dy4 = [1, -1, 0, 0]

    for dx, dy in zip(dx4, dy4):
        next_y = y + dy
        next_x = x + dx
        if 0 <= next_y < H and 0 <= next_x < W and s[next_y][next_x] != "#" and d[next_y][next_x] == -1:
            d[next_y][next_x] = d[y][x] + 1
            queue.append((next_y, next_x))

count = 0
for l in s:
    count += l.count(".")

if d[H-1][W-1] == -1:
    print(-1)
else:
    print(count - d[H-1][W-1] - 1)

# [print(l) for l in s]
# [print(l) for l in d]


### FIXED CODE ###

from queue import Queue

inf = 10 ** 20

def bfs(H, W, s):
    d = [[inf for i in range(W)] for j in range(H)]
    q = Queue()

    d[0][0] = 1
    q.put([0, 0])

    dx = (0, -1, 1, 0)
    dy = (-1, 0, 0, 1)

    while not q.empty():
        p = q.get()
        x = p[0]
        y = p[1]
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            if(nx >= 0 and nx < H and ny >= 0 and ny < W):
                if(s[nx][ny] == '.' and d[x][y] + 1 < d[nx][ny]):
                    d[nx][ny] = d[x][y] + 1
                    q.put([nx, ny])

    return d[H-1][W-1]

H, W = map(int, input().split())
s = []
wnum = 0
for i in range(H):
    s.append(input())
    for j in range(W):
        if(s[i][j] == "."):
            wnum += 1
d = bfs(H, W, s)
if(d == inf):
    print("-1")
else:
    print(wnum - d)
from collections import defaultdict as dd
h, w, m = map(int, input().split())

#dic[row, col] -> set(ids)
h_dic = dd(set)
w_dic = dd(set)
spot = set()

for i in range(m):
    h_c, w_c = map(int, input().split())
    h_dic[h_c].add(i)
    w_dic[w_c].add(i)
    spot.add((h_c, w_c))
#print(h_dic, w_dic)

#H_lis -> [i, num_spot(int)]
max_h_num = 0
H_lis = []
for key, val in h_dic.items():
    H_lis.append([key, len(val)])
    max_h_num = max(max_h_num, len(val))
max_w_num = W_lis[0][1]
W_lis = []
for key, val in w_dic.items():
    W_lis.append([key, len(val)])
    max_w_num = max(max_w_num, len(val))


#print(H_lis, W_lis)
#print(max_h)

ans = 0
max_h_lis = [val[0] for val in H_lis if val[1] == max_h_num]
max_w_lis = [val[0] for val in W_lis if val[1] == max_w_num]
for i in max_h_lis:
    for j in max_w_lis:
        count = max_h_num + max_w_num
        if (i, j) in spot:
            count -= 1
        ans = max(ans, count)
print(ans)

### FIXED CODE ###

from sys import exit
from collections import defaultdict as dd
h, w, m = map(int, input().split())

#dic[row, col] -> set(ids)
h_dic = dd(int)
w_dic = dd(int)
spot = set()

for i in range(m):
    h_c, w_c = map(int, input().split())
    h_dic[h_c] += 1
    w_dic[w_c] += 1
    spot.add((h_c, w_c))
#print(h_dic, w_dic)

#H_lis -> [i, num_spot(int)]
max_h_num = 0
for key, val in h_dic.items():
    max_h_num = max(max_h_num, val)
max_w_num = 0
W_lis = []
for key, val in w_dic.items():
    max_w_num = max(max_w_num, val)


#print(H_lis, W_lis)
#print(max_h)

ans = 0
max_h_lis = [key for key in h_dic if h_dic[key] == max_h_num]
max_w_lis = [key for key in w_dic if w_dic[key] == max_w_num]
for i in max_h_lis:
    for j in max_w_lis:
        if (i, j) not in spot:
            print(max_h_num + max_w_num)
            exit()
else:
    print(max_h_num + max_w_num - 1)

"""    
max_counter = 0
for i in h_dic.keys():
    for j in w_dic.keys():
        counter = len(h_dic[i] | w_dic[j])
        #print(i, j, h_dic[i] | w_dic[j],counter)
        max_counter = max(max_counter, counter)
print(max_counter)

"""
##======================================python3
import sys
import collections
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

class Run:
    def build(gv):
        gv.s = input()
    
    def string_reverse_chk(gv, s:str):
        rev_s :_= ''.join(reversed(s))
        if s == rev_s:
            return True
        return False
    
    def solve(gv):
        
        ans:_ = "No"
        
        
if __name__ == '__main__':
    run = Run()
    run.build()
    run.solve()



### FIXED CODE ###

##======================================python3
import sys
import collections
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

class Run:
    def build(gv):
        gv.s = input().strip()
    
    def string_reverse_chk(gv, s:str):
        rev_s = "".join(list(reversed(s))[0:len(s)])
        if s == rev_s:
            return True
        return False
    
    def solve(gv):
        
        ans = "No"
        
        while True:
            slen = len(gv.s)
            reversed_s = "".join(list(reversed(gv.s))[0:slen])
            
            if gv.string_reverse_chk(gv.s) is False : break
            if gv.string_reverse_chk(gv.s[0:int((slen -1)/2)]) is False : break
            if gv.string_reverse_chk(reversed_s[0:int((slen -1)/2)]) is False : break
            
            if gv.string_reverse_chk(gv.s[int((slen +3)/2 -1):slen]) is False : break
            if gv.string_reverse_chk(reversed_s[int((slen +3)/2 -1):slen]) is False : break
            
            
            ans = "Yes"
            break
        
        print(ans)
        
if __name__ == '__main__':
    run = Run()
    run.build()
    run.solve()
n,i = int(input())
print(n-(i-1))

### FIXED CODE ###

n,i = map(int,input().split())
print(n-(i-1))
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
  if(i%K==0):
    print("ok")
    break
  if(i==B and i%K !=0)
    print("NG")
  
 


### FIXED CODE ###

K = int(input())
A, B = map(int, input().split())
mul = 0
for i in range(A, B + 1):
    if i % K == 0:
        mul += 1
print("OK" if mul > 0 else "NG")
n,x=map(int,input().split())
l=list(map(int,input().split()))
p=0
if x==0:
  print(n)
elif n not in l:
  print(n)
else:
  for i in range(101):
    if abs(x-i)>abs(x-p) and i not in p:
      p=i
  print(p)

### FIXED CODE ###

x,n=map(int,input().split())
l=list(map(int,input().split()))
if x not in l:
    print(x)
elif n==0:
    print(x)
else:
    a=101
    p1=0
    for i in range(102):
        if i not in l:
            if abs(x-i)<a:
                a=abs(x-i)
                p1=i

    print(p1)
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
# import numpy as np
starttime = time.time()
# import numpy as np
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

try:
    # sys.setrecursionlimit(int(pow(10,6)))
    sys.stdin = open("input.txt", "r")
    # sys.stdout = open("../output.txt", "w")
except:
    pass


s=input()
t=input()
global x,ans
x=[]
ans=[]
def rec(i,j):
    global x,ans
    if len(x)>len(ans):
        ans=x[::]

    if i>=len(s) or j>=len(t):
        return
    if s[i]==t[j]:
        x.append(s[i])
        rec(i+1,j+1)
        x.pop()
        return
    rec(i+1,j)
    rec(i,j+1)
rec(0,0)
print("".join(ans))


endtime = time.time()
# print(f"Runtime of the program is {endtime - starttime}")



### FIXED CODE ###

from subprocess import*
call(('pypy3','-c',"""
s=input()
t=input()
a=len(s)
b=len(t)
dp=[[0]*(b+1) for i in range(a+1)]
for i in range(a):
  for j in range(b):
    if s[i]==t[j]:
      dp[i+1][j+1]=dp[i][j]+1
    else:
      dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j])
res=''
while a!=0 and b!=0:
  if dp[a][b]==dp[a-1][b]:
    a-=1
  elif dp[a][b]==dp[a][b-1]:
    b-=1
  else:
    a-=1
    b-=1
    res=s[a]+res
print(res)
"""))
"""
from subprocess import*
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
# import numpy as np
starttime = time.time()
# import numpy as np
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

try:
    # sys.setrecursionlimit(int(pow(10,6)))
    # sys.stdin = open("input.txt", "r")
    # sys.stdout = open("../output.txt", "w")
except:
    pass

"""
H,W=map(int,input().split())
s=[input() for _ in range(H)]

for i in range(H):
  h=i
  for j in range(W):
    w=s[h][j]
    if w=='#':
      cnt=0
      for j,k in ([1,0], [-1,0], [0,1], [0,-1]):
        new_h, new_w=h+j, w+k
        if new_h<0 or new_h>=H or new_w<0 or new_w>=W:
          continue
        elif s[new_h][new_w] == '#':
          cnt+=1
          break
      if cnt==0:
        print('No')
        exit()
print('Yes')

### FIXED CODE ###

H,W=map(int,input().split())
s=[input() for _ in range(H)]

for i in range(H):
  h=i
  for j in range(W):
    if s[h][j]=='#':
      w=j
      cnt=0
      for k,l in ([1,0], [-1,0], [0,1], [0,-1]):
        new_h, new_w=h+k, w+l
        if new_h<0 or new_h>=H or new_w<0 or new_w>=W:
          continue
        elif s[new_h][new_w] == '#':
          cnt+=1
          break
      if cnt==0:
        print('No')
        exit()
print('Yes')
W, H, x, y, r = [int(i) for i in input().split]


if x + r <= W and y - r >= 0 and x - r >= 0 and y + r <= H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

W, H, x, y, r = [int(i) for i in input().split()]


if x + r <= W and y - r >= 0 and x - r >= 0 and y + r <= H:
    print("Yes")
else:
    print("No")
, B = map(int, input().split())
 
if A > B:
  for i in range(A):
    k = abs(A - i)
    l = abs(B - i)
    if k == l:
      print(i)
  else:
    print('IMPOSSIBLE')
if A < B:
  for i in range(B):
    k = abs(A - i)
    l = abs(B - i)
    if k == l:
      print(i)
  else:
    print('IMPOSSIBLE')
    
      

### FIXED CODE ###

A, B = map(int, input().split())
 
if (A + B)%2 == 0:
  k = (A + B)/2
  print(round(k))
else:
  print('IMPOSSIBLE')
N,Z,W = map(int,input().split())
A = list(map(int,input().split()))
if abs(A[-1]-A[-2]) >= abs(A[-1]-W):
  print(abs(A[-1]-A[-2]))
else:
  print(abs(A[-1]-W))


### FIXED CODE ###

N,Z,W = map(int,input().split())
A = list(map(int,input().split()))
if N == 1:
  print(abs(A[0]-W))
  exit()
  
if abs(A[-1]-A[-2]) >= abs(A[-1]-W):
  print(abs(A[-1]-A[-2]))
else:
  print(abs(A[-1]-W))
a, b, k = list(map(int, input().split()))
al, bl = [], []
for i in range(min(b-a,k)):
    al.append(a+i)
    bl.append(b-i)
    ans = list(set(al) | set(bl))
ans.sort()
for i in ans:
    print(i)

### FIXED CODE ###

a, b, k = list(map(int, input().split()))
al, bl = [], []
if a == b:
    print(a)
else:   
    for i in range(min(b-a,k)):
        al.append(a+i)
        bl.append(b-i)
        ans = list(set(al) | set(bl))
    ans.sort()
    for i in ans:
        print(i)
n=int(input())
a = [int(input()) for i in range(n)]
a.append(0)
ans = 0
for i in range(n+1):
  if a[i]!=0:
    tmp += a[i]
  else:
    ans += tmp//2
    tmp = 0
print(ans)

### FIXED CODE ###

n=int(input())
a = [int(input()) for i in range(n)]
a.append(0)
ans = 0
tmp = 0
for i in range(n+1):
  if a[i]!=0:
    tmp += a[i]
  else:
    ans += tmp//2
    tmp = 0
print(ans)
n,m = map(int,input().split())
l_n =list(list(map(int,input().split())) for i in range(n))
l_m =list(list(map(int,input().split())) for i in range(m))
q = 1000000
for i in range(n):
  for t in range(m):
    a,b = l_n[i]
    c,d = l_m[t]
    v= abs(a-c)+abs(b-d)
    if v<=q:
      q = v
      z = t
  print(z+1)
  q = 100000
    

### FIXED CODE ###

n,m = map(int,input().split())
l_n =list(list(map(int,input().split())) for i in range(n))
l_m =list(list(map(int,input().split())) for i in range(m))
for i in range(n):
  q = 10**9
  for t in range(m):
    a,b = l_n[i]
    c,d = l_m[t]
    v= abs(a-c)+abs(b-d)
    if v<q:
      q = v
      z = t
  print(z+1)
N,M = map(int,input().split())
AC = 0
penalty = 0
AC_list = [0]*N
WA_list = [0]*N

for i in range(M):
  p,s = map(str,input().split())
  p = int(p-1)
  if s == "AC" and AC_list[p] == 0:
    AC += 1
    AC_list[p] = 1
    penalty += WA_list[p]
  elif s == "WA":
    WA_list[p] += 1
  if AC == N:
    break
print(AC,penalty)

### FIXED CODE ###

N,M = map(int,input().split())
AC = 0
penalty = 0
AC_list = [0]*N
WA_list = [0]*N

for i in range(M):
  p,s = map(str,input().split())
  p = int(p)-1
  if s == "AC" and AC_list[p] == 0:
    AC += 1
    AC_list[p] = 1
    penalty += WA_list[p]
  elif s == "WA":
    WA_list[p] += 1
  if AC == N:
    break
print(AC,penalty)
import math

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

equal = 0
elements = set(A)
for e in elements:
    tmp = A.count(e)
    equal += math.factorial(tmp) // (2 * math.factorial(tmp - 2))

for i in range(n):
    A_tmp = A[: i] + A[i + 1: ]
    equal_i = A_tmp.count(A[i])
    print(equal - equal_i)

### FIXED CODE ###

import math
import collections

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

equal = 0
elements = collections.Counter(A)
equal = sum([v * (v - 1) // 2 for v in elements.values()])

for i in range(n):
    equal_i = elements[A[i]] - 1
    print(equal - equal_i)
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
l=[l1,l2,l3]
for i in range(3):
    for j in range(3):
        l[i][j] -=l[0][0]
if (l[1][1]==l[0][1]+l[1][0]) and (l[2][1]==l[0][1]+l[2][0]) and (l[1][2]==l[0][2]+l[1][0])and (l[2][2]==l[2][0]+l[0][2]):
    print('Yes')
else:
    print("No")


### FIXED CODE ###

n=int(input())
a=int(input())
m=n%500-a
if m<=0:
    print("Yes")
else:
    print("No")
A = int(input())
B = int(input())
C = int(input())
K = int(input())
if A + B + C >= 2 * 10 ** 9:
    print('Error')
elif A >= K:
    print(K)
elif K > A and K < A + B:
    print(A)
elif K > A + B and K <= A + B + C:
    print(-1 * (K - A - B) + A)
else:
    print('Error')

### FIXED CODE ###

S = list(map(int,input().split()))

if S[0] + S[1] + S[2] > 2 * 10 ** 9:
    print('Error')
elif S[0] >= S[3]:
    print(S[3])
elif S[3] > S[0] and S[3] <= S[0] + S[1]:
    print(S[0])
elif S[3] > S[0] + S[1] and S[3] <= S[0] + S[1] + S[2]:
    print(-1 * (S[3] - S[0] - S[1]) + S[0])
else:
    print('Error')