Harryxun/stf_run huggingface dataset:
def xor_gauss_jordan(A):
    """掃き出し法でジョルダン標準形を求める"""
    cnt_row = len(A)
    cnt_col = len(bin(max(A))[2::])
 
    rank = 0
    for col in range(cnt_col):
        # ピボットを探す
        pivot = -1
        for row in range(rank, cnt_row):
            if A[row] & 2**(cnt_col - col - 1):
                pivot = row
                break
 
        #  ピボットがない場合は次の列に
        if pivot == -1:
            continue
 
        # 行をスワップする
        A[pivot], A[rank] = A[rank], A[pivot]
 
        # ピボットのある列の値がすべて0になるように掃き出す
        A_rank = A[rank]
        for row in range(cnt_row):
            if row != rank and A[row] & 2**(cnt_col - col - 1):
                A[row] ^= A[rank]
        rank += 1
 
    return A


t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    s = input()

    hand = [0]
    flag = False

    for i in range(n)[::-1]:
        val = a[i]
        if s[i] == "1":
            # 手持ちでvalを作れるか確認する
            hand.sort(reverse=True)
            for num in memo_0:
                if val & num == num:
                    val -= num
            if val != 0:
                flag = True
        else:
            # valを手持ちに加える
            hand.append(val)
            # 手持ちは基底で管理するので掃き出し法を行う
            hand = xor_gauss_jordan(memo_0)


    if flag:
        print(1)
    else:
        print(0)

### FIXED CODE ###

def xor_gauss_jordan(A):
    """掃き出し法でジョルダン標準形を求める"""
    cnt_row = len(A)
    cnt_col = len(bin(max(A))[2::])
 
    rank = 0
    for col in range(cnt_col):
        # ピボットを探す
        pivot = -1
        for row in range(rank, cnt_row):
            if A[row] & 2**(cnt_col - col - 1):
                pivot = row
                break
 
        #  ピボットがない場合は次の列に
        if pivot == -1:
            continue
 
        # 行をスワップする
        A[pivot], A[rank] = A[rank], A[pivot]
 
        # ピボットのある列の値がすべて0になるように掃き出す
        A_rank = A[rank]
        for row in range(cnt_row):
            if row != rank and A[row] & 2**(cnt_col - col - 1):
                A[row] ^= A[rank]
        rank += 1
 
    return A


t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    s = input()

    hand = [0]
    flag = False

    for i in range(n)[::-1]:
        val = a[i]
        if s[i] == "1":
            # 手持ちでvalを作れるか確認する
            hand.sort(reverse=True)
            for num in hand:
                if val.bit_length() == num.bit_length():
                    val ^= num
            if val != 0:
                flag = True
        else:
            # valを手持ちに加える
            hand.append(val)
            # 手持ちは基底で管理するので掃き出し法を行う
            hand = xor_gauss_jordan(hand)


    if flag:
        print(1)
    else:
        print(0)
import queue
h,w = map(int,input().split())

maze=[]

count_white=0

for i in range(h):
    maze_row = input()
    maze.append(maze_row)
    
    count_white+=maze_row.count(".")
    
dist = [ [-1]*w for i in range(h)]
goal = [w-1,h-1]
q=queue.Queue()
q.put((0,0,0))

moves = [[0,1], [1,0], [0,-1], [-1,0]]
dmax=-1
while not q.empty():
    
    x,y,d = q.get()
    
    if x==goal[0] and y==goal[1]:
        time=d
        dist[x][y]=d
        dmax=d
        break
    
    if dist[y][x] >= 0:
        continue
    
    else:
        
        dist[y][x]=d
        
        for dx,dy in moves:
            
            if 0<=x+dx<w and 0<=y+dy<h:
                if dist[y+dy][x+dx] == -1 and maze[y+dy][x+dx]!="#":
                
                    q.put((x+dx,y+dy,d+1))
if dmax!=-1:
    print(count_white-dmax-1)
    
else:
    print(-1)

### FIXED CODE ###


import queue
h,w = map(int,input().split())

maze=[]

count_white=0

for i in range(h):
    maze_row = input()
    maze.append(maze_row)
    
    count_white+=maze_row.count(".")
    
dist = [ [-1]*w for i in range(h)]
goal = [w-1,h-1]
q=queue.Queue()
q.put((0,0,0))

moves = [[0,1], [1,0], [0,-1], [-1,0]]
dmax=-1
while not q.empty():
    
    x,y,d = q.get()
    
    if x==goal[0] and y==goal[1]:
        time=d
        dist[y][x]=d
        dmax=d
        break
    
    if dist[y][x] >= 0:
        continue
    
    else:
        
        dist[y][x]=d
        
        for dx,dy in moves:
            
            if 0<=x+dx<w and 0<=y+dy<h:
                if dist[y+dy][x+dx] == -1 and maze[y+dy][x+dx]!="#":
                
                    q.put((x+dx,y+dy,d+1))
if dmax!=-1:
    print(count_white-dmax-1)
    
else:
    print(-1)
while True:
    a,b = map(int,input().split())
    if x == 0 and b == 0:
        break
    else:
        if a < b:
            print(a,b)
        elif a > b:
            print(b,a)


### FIXED CODE ###

while True:
    x,y = map(int,input().split(" "))
    if x == 0 and y==0:
        break
    elif y < x:
        print(y,x)
    else:
        print(x,y)
import sys
import random
import bisect
from collections import deque

def cumsum(a):
    tmp = 0
    ret = []
    for i in range(len(a)):
        tmp += a[i]
        ret.append(tmp)
    return ret

x = input().split()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n, m, k = int(x[0]), int(x[1]), int(x[2])

#n, m = 100000, 100000
#time = 100000000
#a = list(random.choices(range(10000), k=n))
#b = list(random.choices(range(10000), k=m))

a_sum, b_sum = cumsum(a), cumsum(b)

ans, j = 0, m
for i in range(n + 1):
    if a_sum[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
        ans = max(ans, i + j)

print (ans)


### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N): a.append(a[i] + A[i])
for i in range(M): b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
a,b = map(int,input().split())
if a == 1:
  if b == 1:
    print(Draw)
  else:
    print(Alice)
elif b == 1:
  print(Bob)
else:
  if a == b:
    print(Draw)
  elif a < b:
    print(Alice)
  else:
    print(Bob)

### FIXED CODE ###

a,b = map(int,input().split())
if a == 1:
  if b == 1:
    print('Draw')
  else:
    print('Alice')
elif b == 1:
  print('Bob')
else:
  if a == b:
    print('Draw')
  elif a > b:
    print('Alice')
  else:
    print('Bob')
n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = list(list(map(int,input().split())) for i in range(m))

a.sort()
print(a)
bc.sort(reverse=True,key=lambda x:x[1])
t = 0
for i in range(m):
    for j in range(bc[i][0]):
        if a[t] < bc[i][1]:
            a[t] = bc[i][1]
            t+=1
        else:
            break

print(sum(a))


### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = list(list(map(int,input().split())) for i in range(m))

a.sort()
bc.sort(reverse=True,key=lambda x:x[1])
t = 0
for i in range(m):
    for j in range(bc[i][0]):
        if t != n:
            if a[t] < bc[i][1]:
                a[t] = bc[i][1]
                t+=1
            else:
                break
        else:
            break
    else:
        continue
    break

print(sum(a))
while True:
    try:
        words = input()
        if words 
        words = words.lower()
        for i in [chr(i) for i in range(97,97+26)]:
            print('{0}:{1}'.format(i,words.count(i)))
    except:
        break

### FIXED CODE ###

wordcount = ""
while True:
    try:
        words = input()
        wordcount = wordcount + words.lower()
    except:
        break    
for i in [chr(i) for i in range(97,97+26)]:
    print('{0} : {1}'.format(i,wordcount.count(i)))
X = int(input())
import random

def is_prime3(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
 i = X
cnt = 0
flg = is_prime3(i)
if flg == False:
    while flg==False:
        i += 1
        cnt = i
        flg = is_prime3(i)
    print(cnt)
else:
    print(i)

### FIXED CODE ###

X = int(input())
import random

def is_prime3(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
  
i = X
cnt = 0
flg = is_prime3(i)
if flg == False:
    while flg==False:
        i += 1
        cnt = i
        flg = is_prime3(i)
    print(cnt)
else:
    print(i)
r=input()
print(2*3.14*r)

### FIXED CODE ###

r=int(input())
print(2*3.14*r)
n = int(input())
s = input()
su = s.count('1')
sun = int(s,2)

def f(m,n_):
    mod = m % n_
    if mod == 0:
        return 1
    return 1 + f(mod,bin(mod).count('1'))


for i in range(n):
    if s[i] == '0':
        print(f(sun+2**(n-1-i),su+1))
    else:
        print(f(sun-2**(n-1-i),su-1))



### FIXED CODE ###

n = int(input())
s = input()

su = s.count('1')
sun = int(s,2)

sun_plus = sun % (su + 1)
sun_minus = 0 if su - 1 == 0 else sun % (su - 1)


table = [0]*200001
table[1] = 1
for i in range(2,200001):
    table[i] = 1 + table[i % bin(i).count('1')]

def pow(n,e,mod):
    ret=1
    b=n
    while e > 0:
        if e % 2 == 1:
            ret = ret * b % mod
        b = b * b % mod
        e = e//2
    return ret

for i in range(n):
    if s[i] == '0':
        print(1+table[(sun_plus+pow(2,n-1-i,su+1))%(su+1)])
    else:
        if su-1 == 0:
            print(0)
        else:
            print(1+table[(sun_minus-pow(2,n-1-i,su-1)+su-1)%(su-1)])
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
E = [0]*N

for i in range(N):
  E[i] = (p[i]+1)/2
  

for i in range(N-2):
  if i == 0:
    ans = sum(E[i:i+K])
  else:
    ans = max(ans,sum(E[i:i+K]))
print(ans)



### FIXED CODE ###

import itertools 
N,K =list(map(int,input().split()))
p =list(map(int,input().split()))
E = [0] * N

for i in range(N):
  E[i]=(p[i]+1)/2
acc = [0]
acc += list(itertools.accumulate(E))

ans = 0
for i in range(N-K+1):
  ans = max(acc[i+K] - acc[i], ans)

print(ans)
import math
n,k = map(int,input().split())
mod = 10**9+7
red = n-k

def combination(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

for i in range(1,k+1):
    print(combination(red+1,i)*combination(k-1, i-1)%mod)

### FIXED CODE ###

import math
n,k = map(int,input().split())
mod = 10**9+7
red = n-k
def combination(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

for i in range(1,k+1):
    print(combination(red+1,i)*combination(k-1, i-1)%mod if red+1>=i else 0)
from sys import stdin

def main():
    n = int(input())
    lst = set([stdin.readline()[:-1] for _ in range(n)])
    print(len(lst)))

if __name__ == '__main__':
    main()

### FIXED CODE ###

from sys import stdin

def main():
    n = int(input())
    lst = list(set([stdin.readline()[:-1] for _ in range(n)]))
    print(len(lst))

if __name__ == '__main__':
    main()
from fractions import gcd
n, m = map(int, input().split())
s = input()
t = input()
l = n * m // gcd(n, m)
a = [""]*l
for i in range(n):
    a[i*l//n] = s[i]
for i in range(m):
    if a[i*l//m] != "":
        if a[i*l//m] == t[i]:
            continue
        else:
            print(-1)
            exit()
    else:
        continue
print(l)



### FIXED CODE ###

from fractions import gcd
n, m = map(int, input().split())
s = input()
t = input()
g = gcd(n,m)
l = n*m//g
for k in range(g):
    if s[k*n//g] != t[k*m//g]:
        print(-1)
        exit()
print(l)
#/usr/bin/env python3
# -*- coding: utf-8 -*-
# D-Grid and Integers

from collections import defaultdict

def readInput():
	return [int(i) for i in input().split(" ")]

(R, C) = readInput()
N = int(input())
rowIdx = list() 
colIdx = list()
grid = defaultdict(lambda:None)
rowGrid = defaultdict(list)
for i in range(N):
	(r, c, a) = readInput()
	r -= 1
	c -= 1
	rowGrid[r].append(c)
	grid[(r, c)] = a 
	rowIdx.append(r)

pairIdx = rowIdx.copy()	
for i in rowIdx:
	pairIdx.remove(i)
	for j in pairIdx:
		tempRow = rowGrid[i]
		tempPair = rowGrid[j]
		mark = 1
		for k in tempRow:
			if (grid[(j, k)] != None):
				diff = grid[(i, k)] - grid[(j, k)]
				mark = 0 
		if (mark  == 1):
			continue
		for m in tempRow:
			anchor = grid[(i, m)]
			anchorP = grid[(j, m)]
			if (anchorP == None and anchor < diff):
				print('No')
				exit()
			elif (anchorP != None and anchor - anchorP != diff):
				print('No')
				exit()
		for n in tempPair:
			anchor = grid[(j, n)]
			anchorP = grid[(i, n)]
			if (anchorP == None and anchor < -diff):
				print('No')
				exit()
print('Yes')

### FIXED CODE ###

#A-Codefestival 2016
str=input()
str1=str[:4]+" "+str[4:]
print(str1)
X = int(input())
N = 100
for i in range(1:10000000000):
  N = int(N*1.01)
  if N >= X:
    print(i)
    break

### FIXED CODE ###

X = int(input())
N = 100
for i in range(1,10000000000):
  N = int(N*1.01)
  if N >= X:
    print(i)
    break
a, b, c = input().splita, b, c = [int(x) for x in input().strip().split()]

water = c - (a - b)
if water < 0:
    print(0)
else:
    print(water)


### FIXED CODE ###

a, b, c = [int(x) for x in input().strip().split()]

water = c - (a - b)
if water < 0:
    print(0)
else:
    print(water)
n,m = map(int,input().split())
ab =  [list(map(int,input().split(" "))) for i in range(m)]
for i in range(m):
  if (ab[i][0] == 1):
    c = ab[i][1]
    for i in range(m):
      if (ab[i][0] == c and ab[i][1] == n):
        ans = 'POSSIBLE'
  else:
    ans = 'IMPOSSIBLE'
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
s=[False]*n
t=[False]*n
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    s[b-1]=True
  if b==n:
    t[a-1]=True
for i in range(n):
  if s[i]==True and t[i]==True:
    print('POSSIBLE')
    exit()
print('IMPOSSIBLE')
import math

while True:
 a,b=map(int,input().split())
 print(math.gcd(a,b),a*b//math.gcd(a,b))

### FIXED CODE ###

def gcd(x,y):
    while y:
        x, y = y, x % y
    return x


def lcm(x,y):
    return x * y // gcd(x,y)


while True:
    try:
        a = list(map(int,input().split()))
        print(gcd(a[0],a[1]),lcm(a[0],a[1]))
    except:
        break
from collections import deque
N=int(input())
S=list(input())
Q=int(input())
K=map(int,input().split())

for k in K:
    ans=0
    d=m=dm=0
    for c in S:
        if c=='D':
            d+=1
        elif c=='M':
            m+=1
            dm+=d
        elif c=='C':
            ans+=dm
        if i>=k-1:
            c=S[i-(k-1)]
            if c=='D':
                d-=1
                dm-=m
            elif c=='M':
                m-=1
    print(ans)

### FIXED CODE ###

N=int(input())
S=tuple(map(ord,input()))
Q=int(input())
K=map(int,input().split())
D,M,C=map(ord,'DMC')

for k in K:
    ans=0
    d=m=dm=0
    for i in range(min(k-1,N)):
        c=S[i]
        if c==D:
            d+=1
        elif c==M:
            m+=1
            dm+=d
        elif c==C:
            ans+=dm
    for i in range(k-1,N):
        c=S[i]
        if c==D:
            d+=1
        elif c==M:
            m+=1
            dm+=d
        elif c==C:
            ans+=dm
        c=S[i-(k-1)]
        if c==D:
            d-=1
            dm-=m
        elif c==M:
            m-=1
    print(ans)
r = int(input())
print((3 * r*r)

### FIXED CODE ###

r = int(input())
print(3 * r*r)
from scipy.sparse import*;f=lambda*z:map(int,raw_input().split());N,M,R=f();r=f();a,b,c=list(zip(*map(f,[0]*M)));a=csgraph.dijkstra(csr_matrix((c,(a,b)),[N+1]*2),0,r);print int(min(sum(a[e[i]][r[e[i+1]]]for i in range(R-1))for e in __import__('itertools').permutations(range(R))))

### FIXED CODE ###

from scipy.sparse import*
N,M,R=map(int,raw_input().split())
r=[int(e) for e in raw_input().split()]
a,b,c=zip(*(map(int,raw_input().split())for _ in range(M)))
a=csgraph.dijkstra(csr_matrix((c,(a,b)),[N+1]*2),0,r)
print int(min(sum(a[e[i]][r[e[i+1]]]for i in range(R-1))for e in __import__('itertools').permutations(range(R))))
import numpy as np

n = int(input())

data = np.zeros((n, 3), dtype=np.int64)

for i in range(n):

  data[i] = list(map(int, input().split()))

dp = np.zeros((n+1, 3), dtype=np.int64)

for i in range(n):
  for j in range(3):
    for k in range(3):
      if j != k:
        dp[i+1][j] = np.maximum(dp[i][k] + data[i][j], dp[i+1][j])

print(np.max(dp[n]))


### FIXED CODE ###

n = int(input())
li = []

for _ in range(n):
  li.append(list(map(int, input().split())))

dp = [[0] * 3 for _ in range(100010)]

for i in range(n):
  for j in range(3):
    for k in range(3):
      if j != k:
        dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + li[i][k])

print(max(dp[n]))
from math import log
n = int(input())
if n % 2 == 1:
    print(0)
else:
    m = n // 2
    total = 0
    for p in range(1, int(log(m, 5)) + 1):
        total += m // (5 ** p)
    print(total)

### FIXED CODE ###

from math import log
n = int(input())
if n % 2 == 1 or n == 0:
    print(0)
else:
    m = n // 2
    total = 0
    for p in range(1, int(log(m, 5)) + 1):
        total += m // (5 ** p)
    print(total)
s = input().split()

s[6], s[14] = ""

print(s)

### FIXED CODE ###

a, b, c = input().split(",")

print(a,b,c)
import math
N,D = map(int,input().split())
3 2
X = [list(map(int,input().split())) for i in range(N)]
1 2
5 5
-2 8

ans = 0
for j in range(N):
    for i in range(j):
        distant2 = 0
        for k in range(D):
            distant2 += (X[j][k]-X[i][k])**2
        if math.sqrt(distant2) % 1 == 0:
            ans += 1

print(ans)


### FIXED CODE ###

import math
N,D = map(int,input().split())
X = [list(map(int,input().split())) for i in range(N)]

ans = 0
for j in range(N):
    for i in range(j):
        distant2 = 0
        for k in range(D):
            distant2 += (X[j][k]-X[i][k])**2
        if math.sqrt(distant2) % 1 == 0:
            ans += 1

print(ans)
from heapq import *
import numpy as np
n,m,s,t=map(int,input().split())
a=[[]for i in range (n+1)]
b=[[]for i in range(n+1)]
for i in range(m):
    p,q,r,g=map(int,input().split())
    a[p].append([q,r])
    a[q].append([p,r])
    b[p].append([q,g])
    b[q].append([p,g])
def f(x,r):
    p=[float("INF")]*(n+1)
    p[x],q=0,[[0,x]]
    while q:
        y,z=heappop(q)
        for i,j in r[z]:
            if p[i]>y+j:
                p[i]=y+i
                heappush(q,[p[i],i])
    return p[1:]
s1,t1=f(s,a),f(t,b)
p=[]
for i in range(n):
    p.append((s1[i]+t1[i],i))
p,e=sorted(p),0
for i in range(n):
    while p[e][1]<=i: e+=1
    print(10**15-p[e][0])

### FIXED CODE ###

from heapq import heappush,heappop
n,m,s,t=map(int,input().split())
a,b=[[]for i in range (n+1)],[[]for i in range(n+1)]
for i in range(m):
    p,q,r,g=(int(i) for i in input().split())
    a[p].append((q,r))
    a[q].append((p,r))
    b[p].append((q,g))
    b[q].append((p,g))
def f(x,r):
    p=[float("inf")for i in range(n+1)]
    p[x],q=0,[[0,x]]
    while q:
        y,z=heappop(q)
        for i,j in r[z]:
            if p[i]>y+j:
                p[i]=y+j
                heappush(q,[p[i],i])
    return p
s1,t1,p=f(s,a),f(t,b),[]
for i in range(1,n+1):
    p.append((s1[i]+t1[i],i))
p,e=sorted(p),0
for i in range(n):
    while p[e][1]<=i: e+=1
    print(10**15-p[e][0])
q=int(input())
n =10**3
prime = {i for i in range(2,n)}
for i in range(2,n):
    if i in prime:
        for j in range(i*2,n,i):
            if j in prime:
                prime.remove(j)
lists=[]
for i in prime:
    lists.append(i)  
lists=sorted(lists) 

checklist=[0]*(10**5+1)
checklist[0]=0
checklist[1]=0
for i in range(2,10**5+1):
    if i%2==0:
        checklist[i]=checklist[i-1]
    elif i%2!=0:
        if (all(i%j!=0 for j in lists) or i in lists) and (all(((i+1)//2)%j!=0 for j in lists) or (i+1)//2 in lists) :
            count+=1
            checklist[i]=checklist[i-1]+1
        else:
            checklist[i]=checklist[i-1]

listss=[0]*q
for i in range(q):
    a,b=map(int,input().split())
    c=checklist[b]-checklist[a-1]
    listss[i]=c
for i in listss:
    print(i)


### FIXED CODE ###

q=int(input())
n =10**3
prime = {i for i in range(2,n)}
for i in range(2,n):
    if i in prime:
        for j in range(i*2,n,i):
            if j in prime:
                prime.remove(j)
lists=[]
for i in prime:
    lists.append(i)  
lists=sorted(lists) 

checklist=[0]*(10**5+1)
checklist[0]=0
checklist[1]=0
count=0
for i in range(2,10**5+1):
    if i%2==0:
        checklist[i]=checklist[i-1]
    elif i%2!=0:
        if (all(i%j!=0 for j in lists) or i in lists) and (all(((i+1)//2)%j!=0 for j in lists) or (i+1)//2 in lists) :
            count+=1
            checklist[i]=checklist[i-1]+1
        else:
            checklist[i]=checklist[i-1]

listss=[0]*q
for i in range(q):
    a,b=map(int,input().split())
    c=checklist[b]-checklist[a-1]
    listss[i]=c
for i in listss:
    print(i)
#import numpy as np
import time

N = int(input())
A = list(map(int, input().split()))
A.sort()#わるほう
remove_list = []

#kouho = sorted([x for x in set(A) if A.count(x) == 1])
#maxA = 10**5

#target = kouho[:]
maxA = 10**5
work=[0]*(maxA+1)

for i in range(len(A)):
    maxN = int(maxA/A[i])
    for n in range(1,maxN+1):
        buf = A[i]*n
        #remove_list.append(buf)
        work[buf]+=1
            #print(A[i]*n)

#target = kouho[:]
#kouho = list(set(kouho) - set(remove_list))

sm=0
for s in A:
    if work[s]==1: sm+=1
print(sm)

#print(len(kouho))

### FIXED CODE ###

#import numpy as np

N = int(input())
A = list(map(int, input().split()))
A.sort()#わるほう

#kouho = sorted([x for x in set(A) if A.count(x) == 1])
#maxA = 10**5

#target = kouho[:]
maxA = A[-1]
work=[0]*(A[-1]+1)

for i in range(len(A)):
    if work[A[i]]<=1:
        maxN = int(maxA/A[i])
        for n in range(1,maxN+1):
            buf = A[i]*n
            #remove_list.append(buf)
            work[buf]+=1
                #print(A[i]*n)

#target = kouho[:]
#kouho = list(set(kouho) - set(remove_list))

sm=0
for s in A:
    if work[s]==1: sm+=1
print(sm)

#print(len(kouho))
print( B * int((T + 0.5)/A) )

### FIXED CODE ###

A, B, T = map(int, input().split())

print( B * int((T + 0.5)/A) )
import numpy as np
N = int(input())
water = np.array(list(map(int, input().split())))
A = np.zeros((N, N))
for i in range(N):
    if i == N-1:
        A[N-1][0] = 1
        A[N-1][N-1] = 1
    else:
        A[i][i] = 1
        A[i][i+1] = 1
D = np.linalg.solve(A, water)
d = [0]*N
for i in range(N):
    d[i] = int(D[i])
print(" ".join([str(2*n) for n in d]))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
rain = [0]
r0 = 0
for i in range(N):
    r0 += A[i] * (-1)**i
rain[0] = r0
for i in range(1, N):
    rain.append(2 * A[i-1] - rain[i-1])
print(" ".join([str(n) for n in rain]))
def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            print(f + "=7")
            exit()
    else:
        dfs(i + 1, f + "+" + s[i + 1], sum + int(s[i + 1]))
        dfs(i + 1, f + "-" + s[i + 1], sum - int(s[i + 1])

s = input()

dfs(0, s[0], int(s[0]))

### FIXED CODE ###

s = input()

for bit in range(1 << 3):
    ans = int(s[0])
    f = s[0]

    for i in range(3):
        if bit & (1 << i):
            ans += int(s[i + 1])
            f += "+"
        else:
            ans -= int(s[i + 1])
            f += "-"
        f += s[i + 1]

    if ans == 7:
        print(f + '=7')
        break