Harryxun/stf_run huggingface dataset:
import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])
A = A[A<=2*(10**5)]

H = [0]*(4*(10**5))
L = [0]*(4*(10**5))

for i in range(N):
    H[A[i]+i] += 1
    if i-A[i] >= 0:
        L[i-A[i]] += 1

ans = 0

for i in range(N):
    ans += H[i]*L[i]

print(ans)


### FIXED CODE ###

import numpy as np

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

H = [0]*(5*(10**5))
L = [0]*(5*(10**5))

for i in range(N):
    if A[i] <= 2*(10**5):
        H[A[i]+i] += 1
    if i-A[i] >= 0:
        L[i-A[i]] += 1

ans = 0

for i in range(5*(10**5)):
    ans += H[i]*L[i]

print(ans)
H,N = map(int, input().split())
A = list(int(input()))
if sum(A) >= H:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

H,N = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) >= H:
  print('Yes')
else:
  print('No')
a=map(float,input().split())
print(((a[0]-a[2])**2+(a[1]-a[3])**2)**0.5)

### FIXED CODE ###

a,b,c,d=map(float,input().split())
print(abs(complex(c-a,d-b)))
N, A, B, C = map(int, input().split())
ABC = [A, B, C]
if ABC == [0, 0, 0]:
  print("No")
  quit()

p = [0] * N
for i in range(N):
  p[i] = str(input())
  
s = [0] * N
for i in range(N):
  x = p[i]
  if x == "AB":
    if A > B:
      A, B = A - 1, B + 1
      s[i] = "B"
    elif B > A:
      A, B = A + 1, B - 1
      s[1] = "A"
    else:
      if A == 0:
        A, B = A + 1, B - 1
        s[1] = "A"  
      elif B == 0:
        A, B = A - 1, B + 1
        s[1] = "B"
      else:
        A, B = A - 1, B + 1
        s[1] = "B"
  elif x == "BC":
    if B > C:
      B, C = B - 1, C + 1
      s[i] = "C"
    elif B > A:
      B, C = B + 1, C - 1
      s[1] = "B"
  else:
    if C > A:
      C, A = C - 1, A + 1
      s[i] = "A"
    elif B > A:
      C, A = C + 1, A - 1
      s[1] = "C"    
  
print("Yes")  
for i in range(N):
  print(s[i])
  
    
    
    

### FIXED CODE ###

N, A, B, C = map(int, input().split())
ABC = [A, B, C]

s = [0] * N
for i in range(N):
  s[i] = str(input())
  
d = {"AB":(0, 1, 2), "BC": (2, 1, 0), "AC": (0, 2, 1)}  
dl = ["A", "B", "C"]  

if ABC == [0, 0, 0]:
  print("No")
  quit()

ans = [0] * N  
if A + B + C == 1:
  for n in range(N):
    i, j, k = d[s[n]]
    #print(i, j, k)
    if ABC[i] == 1:
      ABC[i] = 0
      ABC[j] = 1
      ans[n] = dl[j]
    elif ABC[j] == 1:
      ABC[i] = 1
      ABC[j] = 0
      ans[n] = dl[i]
    else:
      print("No")
      quit()
  print("Yes")
  for i in range(N):
    print(ans[i])
    
else:
  for n in range(N):
    i, j, k = d[s[n]]
    #print(i, j, k)
    if ABC[i] == 0:
      if ABC[j] == 0:
        print("No")
        quit()
      else:
        ABC[i] += 1
        ABC[j] -= 1
        ans[n] = dl[i]
    elif ABC[j] == 0:
      ABC[i] -= 1
      ABC[j] += 1
      ans[n] = dl[j]
    else:
      if n < N - 1:
        if (ABC[i] == 1) or (ABC[j] == 1):
          if s[n] != s[n + 1]:
            n1, n2, n3 = d[s[n + 1]]
            if (i == n1) or (i == n2):
              ABC[i] += 1
              ABC[j] -= 1
              ans[n] = dl[i]
            else:
              ABC[i] -= 1
              ABC[j] += 1
              ans[n] = dl[j]
              
          else:
            ABC[i] -= 1
            ABC[j] += 1
            ans[n] = dl[j]
        else:
          ABC[i] -= 1
          ABC[j] += 1
          ans[n] = dl[j]
      else:
        ABC[i] -= 1
        ABC[j] += 1
        ans[n] = dl[j]
        
  print("Yes")
  for i in range(N):
    print(ans[i])
s = [ str( input() ) for x in range(3) ]
flag = 0
t = 0
while flag == 0
   if len( s[t] ) != 0
      t = s[t][0]
      s[t] = s[t][1:]
   else :
      print( char( ord("A")+ t ) )
   

### FIXED CODE ###

s = [ str( input() ) for x in range(3) ]
flag = 0
t = 0
while flag == 0 :
   if len( s[t] ) != 0 : 
      tnext = s[t][0]
      s[t] = s[t][1:]
      t = ord( tnext ) - ord( "a" )
   else :
      flag = 1
      print( chr( ord("A")+ t ) )
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

m = 2*10**5+10
ans = [0] * m
for i in range(1,m):
    nnow = i
    res = 0
    stnow = bin(nnow).count('1')
    while nnow:
        # print(nnow)
        nnow %= stnow
        stnow = bin(nnow).count('1')
        res += 1
    ans[i] = res
# for i in range(10):
#     print(i,ans[i])
n = inp()
s = list(input())
st = s.count('1')
num = 0
for i,x in enumerate(s[::-1]):
    if x == '1': num += pow(2,i)
for i in range(n):
    ntmp = pow(2,n-i-1)
    if s[i] == '0':
        nnow = num + ntmp
        stnow = st + 1
    else:
        nnow = num - ntmp
        stnow = st - 1
    nnow %= stnow
    print(ans[nnow]+1)


### FIXED CODE ###

from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

m = 2*10**5+10
ans = [0] * m
for i in range(1,m):
    nnow = i
    res = 0
    stnow = bin(nnow).count('1')
    while nnow:
        # print(nnow)
        nnow %= stnow
        stnow = bin(nnow).count('1')
        res += 1
    ans[i] = res
# for i in range(10):
#     print(i,ans[i])
n = inp()
s = list(input())
tmp = s.count('1')
stm = tmp-1
stp = tmp+1
numm = 0
nump = 0
for i,x in enumerate(s):
    if x == '1': 
        nump += pow(2,n-i-1,stp)
        nump %= stp
        if stm > 0:
            numm += pow(2,n-i-1,stm)
            numm %= stm

for i in range(n):
    if s[i] == '0':
        nnow = (nump+pow(2,n-i-1,stp))%stp
    else:
        if stm <= 0:
            print(0)
            continue
        nnow = (numm-pow(2,n-i-1,stm))%stm
    # print(nnow)
    print(ans[nnow]+1)
n=int(input())
a=[]
for i in range(n):
    x,y,h=map(int,input().split())
    a.append([x,y,h])

def hight(inp):
    cx,cy,x,y,h=inp
    if h==0:
        return -1
    else:
        return abs(x-cx)+abs(y-cy)+h
    
for cx in range(101):
    for cy in range(101):
        H=set()
        for i in range(n):
            h=hight([cx,cy]+a[i])
            if h!=-1:
                H.add(h)
        if len(H)==1:
            flg=True
            for i in H:
                d=i
            for i in range(n):
                x,y,h=a[i]
                if max(0,abs(x-cx)+abs(y-cy)+h)!=d:
                    flg=False
            if flg:
                ans=cx,cy,d
print(*ans)


### FIXED CODE ###

n=int(input())
a=[]
for i in range(n):
    x,y,h=map(int,input().split())
    a.append([x,y,h])

def hight(inp):
    cx,cy,x,y,h=inp
    if h==0:
        return -1
    else:
        return abs(x-cx)+abs(y-cy)+h
    
for cx in range(101):
    for cy in range(101):
        H=set()
        for i in range(n):
            h=hight([cx,cy]+a[i])
            if h!=-1:
                H.add(h)
        if len(H)==1:
            flg=True
            for i in H:
                d=i
            for i in range(n):
                x,y,h=a[i]
                if max(0,d-abs(x-cx)-abs(y-cy))!=h:
                    flg=False
            if flg:
                ans=cx,cy,d
print(*ans)
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
for i in range(k):
  try:
    h.pop(0)
  except IndexError:
    pass
print(sum(h)+t)

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
for i in range(k):
  try:
    h.pop(-1)
  except IndexError:
    pass
print(sum(h))
X, Y, Z = map(int, input().split())
 
print(Z+" "+X+" "+Y)

### FIXED CODE ###

x,y,z=map(int,input().split())
print(z,x,y)
def unchi(x,m,n):
  a=x//m+x//n-x//(m＊n)
  return a
a,b,c,d=(int(i) for i in input().split())
print(unchi(b,c,d)-unchi(a,c,d))

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def unchi(x,m,n):
  r=x//m+x//n-x//(m*n//(gcd(m,n)))
  return r
a,b,c,d=(int(i) for i in input().split())
print(b-a+1-(unchi(b,c,d)-unchi(a-1,c,d)))
w,h,n=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]

xmin,ymin=0
xmax=w
ymax=h

for i in range(n):
    if a[i][2]==1:
        xmin=max([xmin,a[i][0]])
    elif a[i][2]==2:
        xmax=min([xmax,a[i][0]])
    elif a[i][2]==3:
        ymin=max([ymin,a[i][1]])
    else:
        ymax=min([ymax,a[i][1]])
ptint((xmax-xmin)*(ymax-ymin))

### FIXED CODE ###

w,h,n = map(int,input().split())
l = [list(map(int,input().split())) for _ in range(n)]
xmin = 0
ymin = 0
xmax = w
ymax = h
for i in range(n):
    if l[i][2] == 1:
        xmin = max([xmin,l[i][0]])
    elif l[i][2] == 2:
        xmax = min([xmax,l[i][0]])
    elif l[i][2] == 3:
        ymin = max([ymin,l[i][1]])
    elif l[i][2] == 4:
        ymax = min([ymax,l[i][1]])
if xmax <= xmin or ymax <= ymin:
    print(0)
else:
    print((xmax - xmin) * (ymax - ymin))
import numpy as np
from scipy.sparse.csgraph import dijkstra, csgraph_from_dense

sX, sY, eX, eY = map(int, input().split())
N = int(input())

circles = [(sX, sY, 0)]
for _ in range(N):
    cx, cy, r = map(int, input().split())
    circles.append((cx, cy, r))
circles.append((eX, eY, 0))

minDist = [[float('inf')] * (N + 2) for _ in range(N + 2)]

for i, (cx1, cy1, r1) in enumerate(circles):
    for j, (cx2, cy2, r2) in enumerate(circles):
        cDist = ((cx1 - cx2)**2 + (cy1 - cy2)**2)**0.5
        dist = max(0, cDist - r1 - r2)

        minDist[i][j] = dist
        minDist[j][i] = dist

l = csgraph_from_dense(minDist, null_value=float('inf'))

ans = dijkstra(l, indices=0, directed=False)
print(ans[-1])

### FIXED CODE ###

sX, sY, eX, eY = map(int, input().split())
N = int(input())

circles = [(sX, sY, 0)]
for _ in range(N):
    cx, cy, r = map(int, input().split())
    circles.append((cx, cy, r))
circles.append((eX, eY, 0))

edges = [[float('inf')] * (N + 2) for _ in range(N + 2)]

for i, (cx1, cy1, r1) in enumerate(circles):
    for j, (cx2, cy2, r2) in enumerate(circles):
        cDist = ((cx1 - cx2)**2 + (cy1 - cy2)**2)**0.5
        dist = max(0, cDist - r1 - r2)

        edges[i][j] = dist
        edges[j][i] = dist

minDist = [float('inf')] * (N + 2)
minDist[0] = 0
confilm = [False] * (N + 2)

for _ in range(N + 2):
    md = float('inf')
    minNode = -1
    for n in range(N + 2):
        if not confilm[n] and md > minDist[n]:
            minNode = n
            md = minDist[n]
    confilm[minNode] = True
    for to in range(N + 2):
        minDist[to] = min(minDist[to], minDist[minNode] + edges[minNode][to])

print(minDist[-1])
from DataStructures.UnionFind import UnionFind


def main():
    N, M, K = map(int, input().split())
    cnt = [0] * N
    uf = UnionFind(N)

    for _ in range(M):
        A, B = map(lambda x: int(x)-1, input().split())
        cnt[A] += 1
        cnt[B] += 1
        uf.union(A, B)

    for _ in range(K):
        C, D = map(lambda x: int(x)-1, input().split())
        if uf.same(C, D):
            cnt[C] += 1
            cnt[D] += 1

    for i in range(N):
        print(uf.size(i) - cnt[i] - 1, end=" ")


if __name__ == '__main__':
    main()



### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n  # 要素の総数．
        self.parents = [-1] * n  # 各要素の親要素の番号を格納するリスト．要素がrootの場合は-(そのグループの要素数)を返す

    def find(self, x):
        """要素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が属するグループと要素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

    def size(self, x):
        """要素xが属するグループの要素数を返す"""
        return -self.parents[self.find(x)]

    def same(self, x, y):
        """要素x, yが同じグループに属するかどうかを返す"""
        return self.find(x) == self.find(y)

    def members(self, x):
        """要素xが属するグループに属する要素をリストで返す"""
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        """全ての根の要素をリストで返す"""
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        """グループの数を返す"""
        return len(self.roots())

    def all_group_members(self):
        """{ルート要素: [そのグループの要素のリスト]} の辞書を返す"""
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    N, M, K = map(int, input().split())
    cnt = [0] * N
    uf = UnionFind(N)

    for _ in range(M):
        A, B = map(lambda x: int(x)-1, input().split())
        cnt[A] += 1
        cnt[B] += 1
        uf.union(A, B)

    for _ in range(K):
        C, D = map(lambda x: int(x)-1, input().split())
        if uf.same(C, D):
            cnt[C] += 1
            cnt[D] += 1

    for i in range(N):
        print(uf.size(i) - cnt[i] - 1, end=" ")


if __name__ == '__main__':
    main()
x, n = map(int, input().split())

if n == 0:
    print(100)
else:
    p = list(map(int, input().split()))
    a = list(set(range(1, 101)) - set(p))
    abs_diff = [abs(i - x) for i in a]
    min_abs_diff = min(abs_diff)
    for i, j in zip(a, abs_diff):
        if j == min_abs_diff:
            print(i)
            break


### FIXED CODE ###

# ABC170C

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

if n == 0:
    p = set([])
else:
    p = list(map(int, input().split()))
a = list(set(range(201)) - set(p))
abs_diff = [abs(i - x) for i in a]
min_abs_diff = min(abs_diff)
for i, j in zip(a, abs_diff):
    if j == min_abs_diff:
        print(i)
        break
N = int(input())
t = list(map(int, input().split()))
T = sum(t)
M = int(input())
for _ in range(M):
  p, x = map(int, input().split())
  print(T+(T[p-1]-x))

### FIXED CODE ###

N = int(input())
t = list(map(int, input().split()))
T = sum(t)
M = int(input())
for _ in range(M):
  p, x = map(int, input().split())
  print(T-(t[p-1]-x))
a=input()
op=list("+-")
flag = False
for i in range(op):
    for j in range(op):
        for k in range(op):
            s = a[0]+i+a[1]+j+a[2]+k+a[3]
            flag = True
            if eval(s) == 7:
                break
        if flag:
            break
    if flag:
        break
print(s+"=7")

### FIXED CODE ###

a=input()
op=list("+-")
flag = False
for i in op:
    for j in op:
        for k in op:
            s = a[0]+i+a[1]+j+a[2]+k+a[3]
            if eval(s) == 7:
                flag = True
                break
        if flag:
            break
    if flag:
        break
print(s+"=7")
N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
def dfs(cur, a, b, c):
  if cur == N:
    return abs(a-A)+abs(b-B)+abs(c-C) if min(a,b,c) > 0 else return 10**8
  ret0 = dfs(cur+1, a, b, c)
  ret1 = dfs(cur+1, a+l[cur], b, c) + 10
  ret2 = dfs(cur+1, a, b+l[cur], c) + 10
  ret3 = dfs(cur+1, a, b, c+l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0,0,0,0))






### FIXED CODE ###

N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
def dfs(cur, a, b, c):
  if cur == N:
    return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c) > 0 else 10**9
  ret0 = dfs(cur+1, a, b, c)
  ret1 = dfs(cur+1, a+l[cur], b, c) + 10
  ret2 = dfs(cur+1, a, b+l[cur], c) + 10
  ret3 = dfs(cur+1, a, b, c+l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)

print(dfs(0,0,0,0))
#coding:utf-8
n,x=map(int, input().split())

a,p=[1],[1]
for i in range(n):
	a.append(a[i]*2+3)
	p.append(p[i]*2+1)

def f(n,x):
	if n==0:
		return0 if x<=0 else 1
	elif x<=1+a[n-1]:
		return f(n-1,x-1)
	else:
		return p[n-1]+1+f(n-1,x-2-a[n-1])

print(f(n,x))

### FIXED CODE ###

#coding:utf-8
n,x=map(int, input().split())

a,p=[1],[1]
for i in range(n):
	a.append(a[i]*2+3)
	p.append(p[i]*2+1)

def f(n,x):
	if n==0:
		return 0 if x<=0 else 1
	elif x<=1+a[n-1]:
		return f(n-1,x-1)
	else:
		return p[n-1]+1+f(n-1,x-2-a[n-1])

print(f(n,x))
def factorial(x):
  if x == 1: return 1
  else: return x*factorial(x-1)
 
n = int(input())
n_bikkuri = factorial(n)
 
total = 1
 
for i in range(2, n_bikkuri+1):
  n_b = n_bikkuri
  while(n_b % i == 0):
    total += 1
    n_b /= i
  
print(total % int(1e9+7))

### FIXED CODE ###

mod = 1000000000 + 7

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, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

n = int(input())
dat = [0] * 2000 # 約数として求められたある数の合計

# N! の各要素の素因数分解をする
res = 1
for i in range(1, n + 1):
    d = factorization(i)
    for j in range(len(d)):
        dat[d[j][0]] += d[j][1]

for i in range(2, n + 1):
    res *= (dat[i] + 1)
    res %= mod

print(res)
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
#from fractions import gcd
from math import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    h, w = map(int, input().split())
    C = [None] * h
    for i in range(h):
        C[i] = input()
    for i in range(h):
        print(C[i])
        print(C[i])

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
#from math import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    h, w = map(int, input().split())
    C = [None] * h
    for i in range(h):
        C[i] = input()
    for i in range(h):
        print(C[i])
        print(C[i])

if __name__ == '__main__':
    main()
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1]

### FIXED CODE ###

n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])
D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
    if score>=G :
        if D*100>solve :
            point=min(point,solve)
        continue

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想
    rest=G-score
    for j in range(D) :
        if (i>>j) & 1==0 :
            needproblem=j+1
            sum=needproblem*100*(P[needproblem-1]-1)
            if rest>sum :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
                continue
            elif rest<=sum :
                resolve=solve+rest//(needproblem*100)
                point=min(point,resolve)

print(point)


### FIXED CODE ###

D,G=map(int,input().split())
# bit全探索で、全問解く問題の組み合わせをすべて試す
 
scores=[None]*D
for i in range(D):
  p,c=map(int,input().split())
  # 一問の得点、問題数、ボーナス、全てといたときの得点
  scores[i]=[(i+1)*100,p,c,((i+1)*100)*p+c]
 
# あとあとのために点数高い順に並べる
scores=sorted(scores,key=lambda x:x[0])[::-1]
 
# 全問とく組み合わせに対して、最小の問題数
ans=D*100
for i in range(2**D):
  total=0
  solve=0
  for j in range(D):
    if (i>>j)&1:
      # 全問とく問題のボーナスを足していく
      total+=scores[j][3]
      solve+=scores[j][1]
  if total>=G:
    if ans>solve:
      ans=solve
    continue
  rest=G-total
  for j in range(D):
    if (i>>j)&1==0:
      point=scores[j][0]
      num=scores[j][1]-1 # 全問とかないので1減らす
      if point*num<rest:
        rest-=point*num
        solve+=num
      else:
        solve+=(rest//point+(rest%point>0))
        rest=0
    if rest<=0 and ans>solve:
      ans=solve
  
print(ans)
A,B=map(int,input().split())
if A%2==B%2:
  print(int.(A+B)/2)
else:
  print("IMPOSSIBLE")

### FIXED CODE ###

A,B=map(int,input().split())
if A%2==B%2:
  print(int((A+B)/2))
else:
  print("IMPOSSIBLE")
h, w = (list)(map(int, input().split()))
l = [[lin for lin in input()] for _ in range(h)]

gri = [[0 for i in range(w+2)] for _ in range(h+2)]
for i in range(h+2):
    for j in range(w+2):
        if i == 0 or i == h+1 or j == 0 or j == w+1:
            gri[i][j] = '.'
        else:
            gri[i][j] = l[i-1][j-1]

flag = 0
for i in range(1, h+1):
    for j in range(1, w+1):
        if gri[i][j] == '#':
            flag = 0
            if gri[i-1][j] == '.' and gri[i+1][j] == '.' and gri[i][j-1] == '.' and gri[i][j+1] == '.':
                print("No")
                exit(1)

if flag == 0:
    print("No")
else:
    print("Yes")
# print(l)
# print(gri)


### FIXED CODE ###

h, w = (list)(map(int, input().split()))
l = [[lin for lin in input()] for _ in range(h)]

gri = [['.' for i in range(w+2)] for _ in range(h+2)]
for i in range(1, h+1):
    for j in range(1, w+1):
        gri[i][j] = l[i-1][j-1]

flag = 1
for i in range(1, h+1):
    for j in range(1, w+1):
        if gri[i][j] == '#':
            if gri[i-1][j] == '.' and gri[i+1][j] == '.' and gri[i][j-1] == '.' and gri[i][j+1] == '.':
                flag = 0
if flag == 1:
    print("Yes")
else:
    print("No")
r,g=map(int,input().split())
print(2*g-r)

### FIXED CODE ###

r=int(input())
g=int(input())
print(2*g-r)
a = input()
a.sprit
if a[0] == a[1]:
     if a[1] == a[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

### FIXED CODE ###

a = input()
b = a.split()
if b[0] == b[1]:
    if b[1] == b[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
n = int(input())
count = 0
for i in range(n):
  if len(i) % 2 == 1:
    count += 1
    
print(count)


### FIXED CODE ###

n = int(input())
count = 0
for i in range(1,n+1):
  if len(str(i)) % 2 == 1:
    count += 1
    
print(count)
weat = ['Sunny', 'Cloudy', 'Rainy', 'Sunny']
for c in weat:
  if c == S:
    print(weat[weat.index(c)+1])
    break

### FIXED CODE ###

weather = ["Sunny", "Cloudy", "Rainy", "Sunny"]
s = input()
for c, i in enumerate(weather):
    if i == s:
        print(weather[c+1])
        break
S,W = int(input().split())
if S <= W:
    print('unsafe')
print('safe')

### FIXED CODE ###

S,W = map(int,input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')
a,b=raw_input().split()
n=int(a+b)
if(sqrt(n)**2==n):
  print "Yes"
else:
  print "No"

### FIXED CODE ###

import math
a,b=raw_input().split()
n=int(a+b)
if(int(math.sqrt(n))**2==n):
  print "Yes"
else:
  print "No"