Harryxun/stf_run huggingface dataset:
import numpy as np


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

res_list = []

for i in reversed(range(N-1)):
    tmp_res = 0
    num = i
    pos = (N-1) - num

    if H_list[num] >= H_list[num+1]:
        res_list.append(1)
    else:
        res_list.append(0)

res_arr = np.array(res_list)
offset = 1
res_diff = res_arr[1:] - res_arr[:-1]
pos1to0 = np.where(res_diff == -1)[0] + offset
pos0to1 = np.where(res_diff == +1)[0] + offset
pos0to1 = np.append([0], pos0to1)
tarr = pos1to0 - pos0to1
if len(tarr) != 0:
    len11 = tarr.max()
    print(len11)
else:
    print(0)


### FIXED CODE ###

import numpy as np


N = int(input())
A = np.array(input().split(), dtype=np.int32)

left_idx = np.arange(N)
# 自身が左以下ならば0に
left_idx[1:][A[:-1] >= A[1:]] = 0
np.maximum.accumulate(left_idx, out=left_idx)

answer = (np.arange(N) - left_idx).max()
print(answer)
_=input()
X=eval(input().replace(*' *'))
print(X if X<10**18 else -1)

### FIXED CODE ###

N=int(input())
X=list(map(int, input().split()))
ans=1
if 0 in X:
    print(0)
else:
    for i in range(N):
        ans *= X[i]
        if 10**18<ans:
            print(-1)
            break
    else:
        print(ans)
n,m=map(int,input().split())
A=[]
for i in range(n):
  a,b=map(int,input().split())
  A.append([a,b])

A=sorted(A,key=lambda x:x[0])
ko=0
pri=0
i=0
while ko<=m:
  pri+=A[i][0]*A[i][1]
  ko+=A[i][1]
  i+=1
print(pri-(ko-m)*A[i-1][0])

### FIXED CODE ###

n,m=map(int,input().split())
A=[]
for i in range(n):
  a,b=map(int,input().split())
  A.append([a,b])

A=sorted(A,key=lambda x:x[0])
ko=0
pri=0
i=0
while ko<=m:
  pri+=A[i][0]*A[i][1]
  ko+=A[i][1]
  i+=1
  if ko==m:
    print(pri)
    exit()
print(pri-(ko-m)*A[i-1][0])
a, b = map(int, input().split())
array = list(map(int, input().split()))
impossible = "IMPOSSIBLE"
possible = "POSSIBLE"

if a == 1:
    if b == array[0]:
        print(possible)
    else:
        print(impossible)
    exit(0)

array.sort()
array = list(set(array))

btw = [v1 - v2 for v1, v2 in zip(array[1:], array[0:])]
n = sorted(btw)[0]

same = len(set(btw)) == 1 or all([v % n == 0 for v in btw])

if b in array:
    print(possible)
elif array[-1] < b:
    print(impossible)
elif same and (b - array[0]) % n == 0:
    print(possible)
else:
    print(impossible)


### FIXED CODE ###

a, b = map(int, input().split())
array = list(map(int, input().split()))
impossible = "IMPOSSIBLE"
possible = "POSSIBLE"

array = list(set(array))

if len(array) == 1:
    if b == array[0]:
        print(possible)
    else:
        print(impossible)
    exit(0)

array.sort()

btw = [v1 - v2 for v1, v2 in zip(array[1:], array[0:])]
n = sorted(btw)[0]

same = len(set(btw)) == 1 or all([v % n == 0 for v in btw])

if b in array:
    print(possible)
elif array[-1] < b:
    print(impossible)
elif same and (b - array[0]) % n == 0:
    print(possible)
else:
    print(impossible)
N, C = map(int, input().split())
TV = [list(map(int, input().split())) for _ in range(N)]

TV = sorted([l for l in TV], key=lambda x: x[0])

X = []
for c in range(1, C + 1):
    TV_temp = [l for l in TV if l[2] == c]
    TV_T = list(zip(*TV_temp))
    l = []
    for tv in TV_temp:
        if tv[1] in TV_T[0]:
            i = TV_T[0].index(tv[1])
            l.append([tv[0], TV_T[1][i], c])
            TV_temp.pop(i)
        else:
            l.append(tv)
    
    X.extend(l)

TV = sorted([[l[0] - 0.5, l[1], l[2]] for l in X], key=lambda x: x[1])

c = 0
while TV:
    c += 1
    end = 0
    l_rem = []
    for i, tv in enumerate(TV):
        if tv[0] >= end:
            end = tv[1]
            l_rem.append(i)
    for i in reversed(l_rem):
        TV.pop(i)

print(c)

### FIXED CODE ###

N, C = map(int, input().split())
TV = [list(map(int, input().split())) for _ in range(N)]

TV = sorted(TV, key=lambda x: x[1])

rec = [0] * (10 ** 5 + 1)
cs =  [set() for _ in range(10 ** 5 + 1)]

for s, t, c in TV:
    rec[t] -= 1
    if c not in cs[s]:
        rec[s - 1] += 1
    else:
        rec[s] += 1
    cs[t].add(c)

rec_s = [rec[0]]
for r in rec[1:]:
    rec_s.append(rec_s[-1] + r)

print(max(rec_s))
n, k = map(int, input().split())
ans = 1
for i in range(n):
  ans = min([ans*2, ans+k])
print(ans)

### FIXED CODE ###

n = int(input())
k = int(input())
ans = 1
for i in range(n):
  ans = min([ans*2, ans+k])
print(ans)
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    s = input()
    sl = [i for i in s]
    n = len(s)-1
    sublist = [-1]*n
    anslist = []
    ans = []
    for i in range(1<<n):
        for j in range(n):
            if (i>>j)&1:
                sublist[j] = "+"
        anslist.append(sl[0])
        for j in range(n):
            if sublist[j] == "+":
                anslist.append(sublist[j])
                anslist.append(sl[j+1])
            else:
                anslist.append(sl[j+1])
        ans.append(eval("".join(anslist)))
        anslist = []
        sublist = []
    print(sum(ans))
if __name__ == "__main__":
    main() #endline===============================================
    

### FIXED CODE ###

S = input()
SL = [i for i in S]
sublist = [-1]*(len(S)-1)
anslist = []
ans = []
for i in range(1<<len(S)-1):
    for j in range(len(S)-1):
        if ((i>>j)&1)==1:
            sublist[j] = "+"
    anslist.append(SL[0])
    for j in range(len(S)-1):
        if sublist[j] == "+":
            anslist.append(sublist[j])
            anslist.append(SL[j+1])
        else:
            anslist.append(SL[j+1])
    ans.append(eval("".join(anslist)))
    anslist = []
    sublist = [-1]*(len(S)-1)
print(sum(ans))
def insertion_sort(array, g, result):
    for i in range(g, len(array)):
        v = array[i]
        j = i - g
        while j >= 0 and array[j] > v:
            array[j + g] = array[j]
            j -= g
            result['count'] += 1
        A[j + g] = v


def shell_sort(array, result):
    result['count'] = 0
    G = list(reversed([int((3 ** i - 1) / 2) for i in range(1, len(array)) if (3 ** i - 1) / 2 < len(array)]))
    if not G:
        G = [1]
    m = len(G)
    result['G'] = G
    result['m'] = m
    for i in range(m):
        insertion_sort(array, G[i], result)


if __name__ == '__main__':
    n = int(input())
    A = [int(input()) for _ in range(n)]
    result = {}
    shell_sort(A, result)
    print(result['m'])
    print(' '.join(map(str, result['G'])))
    print(result['count'])
    print('\n'.join(map(str, A)))

### FIXED CODE ###

def insertion_sort(array, g, result):
    for i in range(g, len(array)):
        v = array[i]
        j = i - g
        while j >= 0 and array[j] > v:
            array[j + g] = array[j]
            j -= g
            result['count'] += 1
        A[j + g] = v


def g_gene(n):
    yield 1
    for i in range(2, n):
        x = int((3 ** i - 1) / 2)
        if x < n:
            yield x
        else:
            raise StopIteration()


def shell_sort(array, result):
    result['count'] = 0
    G = list(reversed(list(g_gene(len(array)))))
    m = len(G)
    result['G'] = G
    result['m'] = m
    for i in range(m):
        insertion_sort(array, G[i], result)


if __name__ == '__main__':
    import sys
    n = int(sys.stdin.readline())
    A = []
    for _ in range(n):
        A.append(int(sys.stdin.readline()))
    result = {}
    shell_sort(A, result)
    print(result['m'])
    print(' '.join(map(str, result['G'])))
    print(result['count'])
    for a in A:
        print(a)
import sys

sys.setrecursionlimit(10000)

def biser(lst,func):
    n=len(lst)
    nh=n//2
    if n==1:
        return lst[0]
    if func(nh):
        return biser(lst[nh:],func)
    else:
        return biser(lst[:nh],func)

def findminsum(lst,K,N):
    inf=10**6
    dp=[[inf]*N for s in range(K+1)]
    for s in range(K+1):
        for j in range(N):
            if j==0 and s<=lst[j]:
                dp[s][j]=lst[0]
            elif s>lst[j] and j>0:
                dp[s][j]=min(dp[s-lst[j]][j-1]+lst[j], dp[s][j-1])
            elif s<=lst[j] and j>0:
                dp[s][j]=min(lst[j],dp[s][j-1])
    # print(lst)
    # print(dp[0][:])
    # print(dp[1][:])
    # print(dp[K][:])
    return dp[K][N-1]


def main():
    N,K=map(int,sys.stdin.readline().strip().split())
    cards=list(map(int,sys.stdin.readline().strip().split()))
    # cards=list(filter(lambda x:x<K,cards))
    # N=len(cards)
    cards.sort()
    ci=list(range(N))
    def func(h):
        c=cards[h]
        cards[h]=0
        ret=findminsum(cards,K-c,N)>=K
        cards[h]=c
        return ret
    #nn=0
    nn=biser(ci,func)
    # for i in range(N):
    #     if cards[i]<K:
    #         c=cards[i]
    #         cards[i]=0
    #         if findminsum(cards,K-c,N)>=K:
    #             nn+=1
    #         cards[i]=c
    #     else:
    #         break
    print(nn+1)

if __name__=='__main__':
    main()


### FIXED CODE ###

#4 9
#1 3 5 6
#の時に1（正解は0）と出力されるがACになる

N, K = map(int, input().split())
a=list(map(int, input().split()))
a.sort()
ans = N
t = 0
for i in range(N-1, -1, -1) :
  if t+a[i] < K:
    t += a[i]
  else:
    ans = min(ans, i)
print(ans)
n=int(input())
ans=0
for i in range(1,n+1):
	x=math.floor(n/i)
	ans+=(x*(x+1)*i)/2
print(int(ans))

### FIXED CODE ###

import math
n=int(input())
ans=0
for i in range(1,n+1):
	x=math.floor(n/i)
	ans+=(x*(x+1)*i)/2
print(int(ans))
h, w = map(int, input().split())
ls = [[_ for _ in input()] for _ in range(h)]

for i in range(h):
    ls[i] = ["."] + ls[i] + ["."]

ls_s = [["."] * len(ls[0])]
ls_s.extend(ls)
ls_s.extend([["."] * len(ls[0])])

for i in range(1, len(ls)+1):
    for j in range(1, len(ls)+1):
        if ls_s[i][j] == "#":
            if ls_s[i-1][j] == ls_s[i+1][j] == ls_s[i][j-1] == ls_s[i][j+1] == ".":
                print("No")
                break
        elif i == j == len(ls):
            print("Yes")
    else:
        continue
    break

### FIXED CODE ###

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

for i in range(h):
    ls[i] = ["."] + ls[i] + ["."]

ls_s = [["."] * len(ls[0])]
ls_s.extend(ls)
ls_s.extend([["."] * len(ls[0])])

for i in range(1, h+1):
    for j in range(1, w+1):
        if ls_s[i][j] == "#":
            if ls_s[i-1][j] == ls_s[i+1][j] == ls_s[i][j-1] == ls_s[i][j+1] == ".":
                print("No")
                break
            elif i == h and j == w:
                print("Yes")
        elif i == h and j == w:
            print("Yes")
    else:
        continue
    break
#include<stdio.h>
int main(void)
{
    char s[101]; 
    unsigned long k;
    scanf("%s",&s);
    scanf("%u,&k);
    int len=0;
    int i;
    char ans[2]="1";
    while(s[len++])
    int c=len<k?k:len;
    for(i=0;i<c;i++)
    {
        if(s[i]!='1')
            {ans[0]=s[i];  break;}
    }
    printf("%s",ans);
return 0;
}

### FIXED CODE ###

s = input()
t =int(input())
for i in range(t):
  if s[i]!='1':
    print(s[i])
    exit()
print('1')
N=int(input())
x=0
 
for i range(1,n+1):
  
  if (i%2==1):
    x+=1
    
print(x/n)

### FIXED CODE ###

n=int(input())
x=0
for i in range(1,n+1):
  if (i%2==1):
    x+=1
    
print(x/n)
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

x,y,z = inpm()

print(str(z) + " " + str(x) + " " + str(y))

### FIXED CODE ###

import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

x,y,z = inpm()

print(str(z) + " " + str(x) + " " + str(y))
n = []
n.add = (int(x) for x in input().split())

for num in n:
    if num == 7:
        print("Yes")
        break
    else:
        print("No")

### FIXED CODE ###

num = [int(x) for x in input()]

for i in range(3):
    if num[i] == 7:
        print("Yes")
        break
    elif i == 2:
        print("No")
import math
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)

def mid(a):
    if(a%2!=0):
        return (a+1)//2
    else:
        return a//2
ai=a[0]
temp=list(map(lambda x:abs(x-mid(ai)),a[1:]))
bi=a[temp.index(min(temp))+1]
print(str(ai)+" "+str(ans[bi]))

### FIXED CODE ###

n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)

def mid(a):
    if(a%2!=0):
        return (a+1)//2
    else:
        return a//2

ai=a[0]
temp=list(map(lambda x:abs(x-mid(ai)),a[1:]))
bi=a[temp.index(min(temp))+1]
print(str(ai)+" "+str(bi))
N=int(input())
a=list(map(int,input().split()))
a=sorted(a)
Alice=0
Bob=0
Alice_turn=0
for i in range(N):
  if Alice_turn%2==even:
    Alice+=a[N-1-i]
    Alice_turn+=1
  else:
    Bob+=a[N-1-i]
print(Alice-Bob)

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
na=sorted(a)
Alice=0
Bob=0
Alice_turn=0
for i in range(N):
  if Alice_turn%2==0:
    Alice+=na[N-1-i]
    Alice_turn+=1
  else:
    Bob+=na[N-1-i]
    Alice_turn+=1
print(Alice-Bob)
n, yen = map(int, input().split())
for x in range(n + 1):
    for y in range(n - x + 1):
        z = n - x - y
        if yen == x * 10000 + y * 5000 + z * 1000:
            print(x + " " + y + " " + z)
            exit(0)
print("-1 -1 -1")

### FIXED CODE ###

n, y = map(int, input().split())
for senyen in range(n + 1):
    for gosenyen in range(n + 1 - senyen):
        manyen = n - senyen - gosenyen
        if senyen * 1000 + gosenyen * 5000 + manyen * 10000 == y:
            print(manyen, gosenyen, senyen)
            exit(0)
print("-1 -1 -1")
N = int(input())
A = list(map(int, input().split()))

As = sorted(A)

dellist = []
# A[0]は最小なので同じ数字を除いてそれよりも大きい他の数では割り切れない。
i = 0
while(i < len(As)):
    if As[i] > 1000:
        break
#     print('i:{}'.format(i))
#     print('As:{}'.format(As))
    # As[i]で、A[i+1]～A[len(As)]で割り切れるものを探し、消す。
    j = i+1
    poplist = []
    while(j < len(As)):
#         print('j:{}'.format(j))
#         print('As[i]:{}'.format(As[i]))
#         print('As[j]:{}'.format(As[j]))
        if As[j]%As[i] == 0: # 割り切れちゃった場合
            # A[j]をあとで消すために控える
            poplist.append(j)
            # A[i]とA[j]が同じ数字なら、最後にA[i]も消す必要があるので、
            # A[i]を削除リストに入れる
            if As[i]  == As[j]:
                dellist.append(A[i])
                
        j += 1
        
    # poplistにあるAs[]を消す
    # 前から消していくと順番が狂うので、後ろから消す。参考↓
    # https://gammasoft.jp/blog/remove-multiple-elements-from-python-list/
    for k in sorted(poplist, reverse=True):
        As.pop(k)
    # As[i]で割り切れるものは探しきって、次のAs[i+1]は割り切れないもの。
    # 次はAs[i+1]について考える
    i += 1

# remove は、指定した要素がlistに含まれていないとエラーを吐くみたいなので、
# 重複を排除する
dellist = list(set(dellist))
    
for i in dellist:
    As.remove(i)

# print(As)
print(len(As))
# print(dellist)

### FIXED CODE ###

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

cnt = [0] * ((10 ** 6) + 1)

for elem in a:
    cnt[elem] += 1

unique = []

for i in range((10 ** 6) + 1):
    if cnt[i] == 1:
        unique.append(i)

cnt = [0] * ((10 ** 6) + 1)

a = list(set(a))

for elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

ans = 0
        
for elem in unique:
    if cnt[elem] == 0:
        ans += 1

print(ans)
from functools import lru_cache
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
@lru_cache(maxsize=None)
def f(x):
    if x<2:return x
    elif x-1 in a:return 0
    else:return (f(x-1)+f(x-2))%1000000007
print(f(n+1))

### FIXED CODE ###

n,m=map(int,input().split())
a=[1]*(n+1)
for _ in range(m):a[int(input())]=0
p,q=0,1
for i in range(1,n+1):
    p,q=q,a[i]*(p+q)%(10**9+7)
print(q)
a = input()
b = input()

words = b.split('\n')
print(words)
def main():
    ed = []
    for i in range(int(a)-2):
        w1 = words[i]
        ed.append(w1)
        w2 = words[i+1]
        print(ed)
        if w1[-1] != w2[0] or w1 in ed:
            return 'No'
    return 'Yes'

if __name__ == '__main__':
    main()



### FIXED CODE ###

a = input()

def main():
    ed = []
    for i in range(int(a)):
        neww = input()
        if i != 0:
            if ed[i-1][-1] != neww[0] or neww in ed:
                return 'No'
        ed.append(neww)

    return 'Yes'
                

if __name__ == '__main__':
    print(main())
import numpy as np
 
A,B,C,D = map(int,input().split())
lcm = int(C * D/ np.gcd(C,D))
A = A-1
A_n = A - (A//C + A//D - A//lcm)
B_n = B - (B//C + B//D - B//lcm)
print(int(B_n-A_n))

### FIXED CODE ###

def gcd(a,b):
    while b != 0:
        temp = b
        b = a%b
        a = temp
    return a
A,B,C,D = map(int,input().split())
if C >=D:
    lc = int(C*D/gcd(C,D))
else: lc = int(C*D/gcd(D,C))
A = A-1
A_n = A - (A//C + A//D - A//lc)
B_n = B - (B//C + B//D - B//lc)
print(int(B_n-A_n))
#151c
n,w=map(int,input().split())
ac=0
wa=[0]*n
wa_cnt=[0]*n
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa[p] +=wa_cnt
			#wa_cnt=0
		else:
			wa_cnt[p]+=1

wa_ans=0
for i in range(n):
	wa_ans+=wa[i]

print(ac,wa_ans)


### FIXED CODE ###

#151c
n,w=map(int,input().split())
ac=0
wa=[0]*n
wa_cnt=[0]*n
ac_flg=[0]*n
for i in range(w):
	p,s=input().split()
	p=int(p)-1
	if ac_flg[p]==1:
		continue
	else:
		if s=='AC':
			ac_flg[p]=1
			ac+=1
			wa[p] =wa_cnt[p]
			#wa_cnt=0
		else:
			wa_cnt[p]+=1

wa_ans=0
for i in range(n):
	wa_ans+=wa[i]

print(ac,wa_ans)
N = int(input())
A = list(map(int, input().split()))

count = 0
while True:
  A, mod = zip([divmod(a, 2) for a in A])
  if sum(mod) > 0:
    break
  count++
print(count)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
count = 0
while True:
  A, mod = zip(*[divmod(a, 2) for a in A])
  if sum(mod) > 0:
    break
  count += 1
print(count)
a,b,c = input().split(',')
print(a,b,c)

### FIXED CODE ###

k,s=map(int,input().split())
ret=0
k+=1
for i in range(k):
  for j in range(k):
    d=s-i-j
    if k>d>=0:
      ret+=1
print(ret)
#! /usr/bin/env python3

import sys
from collections import defaultdict
from math import gcd
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)


def formatting(a, b):
    if a == 0:
        return (0, 1)
    g = gcd(a, b)
    a //= g
    b //= g

    if a < 0:
        return (-a, -b)

    return a, b


MOD = pow(10, 9) + 7

N = int(readline())
m = map(int, read().split())
A, B = zip(*zip(m, m))

zz = 0
odd = defaultdict(int)
even = defaultdict(int)

for a, b in zip(A, B):
    if a == b == 0:
        zz += 1
        continue
    a, b = formatting(a, b)
    if b <= 0:
        odd[(a, b)] += 1
    else:
        even[(b, -a)] += 1
        odd[(b, -a)] += 0

ans = zz
k = 1

for key, cnt0 in odd.items():
    cnt1 = even[key]
    acc = pow(2, cnt0, MOD) + pow(2, cnt1, MOD)
    k = k * (acc - 1) % MOD

ans += k - 1
print(ans % MOD)

### FIXED CODE ###

import sys
from collections import deque
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = map(int, readline().split())
graph = [[] for _ in range(N)]
for i in range(M):
    A, B = map(int1, readline().split())
    graph[A].append(B)
    graph[B].append(A)
ans = [None] * (N)

visited = [False] * N
visited[0] = True

que = deque([0])

while len(que) > 0:
    acc = que.popleft()
    for connected in graph[acc]:
        if visited[connected]:
            continue

        ans[connected] = acc + 1
        visited[connected] = True
        que.append(connected)

if sum(visited) == len(visited):
    print("Yes")
    for sign in ans[1:]:
        print(sign)
else:
    print("No")
S = input()
ans = 0
for i in range(len(S)):
  for j in range(i+1, len(S)+1):
	if all('ACTG'.count(c)==1 for c in S[i:j+1]):
      ans = max(ans, j+1-i)
print(ans)

### FIXED CODE ###

import re
pattern = re.compile('[ACGT]+')
S = input()
print(len(max(re.findall(pattern, S), key=len, default='')))
n=int(input())
l=list(map(int,input().split()))
dp=[0]*(n)
dp[0]=0
dp[1]=abs(l[0]-l[1])
dp[2]=abs(l[2]-l[1])
for i in range(2,n):
    dp[i]=min(abs(l[i]-l[i-2])+dp[i-2],abs(l[i]-l[i-1])+dp[i-1])
print(dp[-1])

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
dp=[0]*(n)
dp[0]=0
dp[1]=abs(l[0]-l[1])
for i in range(2,n):
    dp[i]=min(abs(l[i]-l[i-2])+dp[i-2],abs(l[i]-l[i-1])+dp[i-1])
print(dp[-1])
# coding: utf-8
# Your code here!
line= list(map(int,input().split()))
N = line[0]
K = line[1]
#0~Nの連続した整数から
#K個以上(N+1)個以下だけ選ぶ
answer = 0
for i in range (K,N+2):
    minit = i*(i-1)/2
    maximum = (2*N-i+1)*i/2
    
    num = maximum-minit+1
    answer += num
 
if answer >=(10**9+7):
    print(int(answer%(10**9+7)))
    
else:
    print(int(answer))

### FIXED CODE ###

# coding: utf-8
# Your code here!
import collections
num = int(input())
line = list(map(int,input().split()))
clist = collections.Counter(line)
for i in range (1,num+1):
    print(clist[i])
h = int(input())
a = 0
while h > 0:
    h = h//2
    a += 1

f[0] = h
  
print(2**a-1)

### FIXED CODE ###

h = int(input())
a = 0
while h > 0:
    h = h//2
    a += 1
  
print(2**a-1)