QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#817190#9863. BracketsXY_ElevenAC ✓862ms67632kbC++205.8kb2024-12-16 20:49:222024-12-16 20:49:23

Judging History

你现在查看的是最新测评结果

  • [2024-12-16 20:49:23]
  • 评测
  • 测评结果:AC
  • 用时:862ms
  • 内存:67632kb
  • [2024-12-16 20:49:22]
  • 提交

answer

#include <bits/stdc++.h>
// #include <windows.h>
// #include <bits/extc++.h>
// using namespace __gnu_pbds;
using namespace std;
//#pragma GCC optimize(3)
#define DB double
#define LL long long
#define ULL unsigned long long
#define in128 __int128
#define cint const int
#define cLL const LL
#define For(z,e1,e2) for(int z=(e1);z<=(e2);z++)
#define Rof(z,e1,e2) for(int z=(e2);z>=(e1);z--)
#define For_(z,e1,e2) for(int z=(e1);z<(e2);z++)
#define Rof_(z,e1,e2) for(int z=(e2);z>(e1);z--)
#define inint(e) scanf("%d",&e)
#define inll(e) scanf("%lld",&e)
#define inpr(e1,e2) scanf("%d%d",&e1,&e2)
#define in3(e1,e2,e3) scanf("%d%d%d",&e1,&e2,&e3)
#define outint(e) printf("%d\n",e)
#define outint_(e) printf("%d%c",e," \n"[i==n])
#define outint2_(e,e1,e2) printf("%d%c",e," \n"[(e1)==(e2)])
#define outll(e) printf("%lld\n",e)
#define outll_(e) printf("%lld%c",e," \n"[i==n])
#define outll2_(e,e1,e2) printf("%lld%c",e," \n"[(e1)==(e2)])
#define exc(e) if(e) continue
#define stop(e) if(e) break
#define ret(e) if(e) return
#define ll(e) (1ll*(e))
#define pb push_back
#define ft first
#define sc second
#define pii pair<int,int> 
#define pli pair<long long,int> 
#define vct vector 
#define clean(e) while(!e.empty()) e.pop()
#define all(ev) ev.begin(),ev.end()
#define sz(ev) ((int)ev.size())
#define debug(x) printf("%s=%d\n",#x,x)
#define x0 __xx00__
#define y1 __yy11__
#define ffo fflush(stdout)
cLL mod=998244353,G=404;
const ULL base=166686661;
// cLL mod[2]={1686688681ll,1666888681ll},base[2]={166686661ll,188868881ll};
template <typename Type> void get_min(Type &w1,const Type w2) { if(w2<w1) w1=w2; } template <typename Type> void get_max(Type &w1,const Type w2) { if(w2>w1) w1=w2; }
template <typename Type> Type up_div(Type w1,Type w2) { return (w1/w2+(w1%w2?1:0)); }
template <typename Type> Type gcd(Type X_,Type Y_) { Type R_=X_%Y_; while(R_) { X_=Y_; Y_=R_; R_=X_%Y_; } return Y_; } template <typename Type> Type lcm(Type X_,Type Y_) { return (X_/gcd(X_,Y_)*Y_); }
template <typename Type> Type md(Type w1,const Type w2=mod) { w1%=w2; if(w1<0) w1+=w2; return w1; } template <typename Type> Type md_(Type w1,const Type w2=mod) { w1%=w2; if(w1<=0) w1+=w2; return w1; }
void ex_gcd(LL &X_,LL &Y_,LL A_,LL B_) { if(!B_) { X_=1ll; Y_=0ll; return ; } ex_gcd(Y_,X_,B_,A_%B_); X_=md(X_,B_); Y_=(1ll-X_*A_)/B_; } LL inv(LL A_,LL B_=mod) { LL X_=0ll,Y_=0ll; ex_gcd(X_,Y_,A_,B_); return X_; }
template <typename Type> void add(Type &w1,const Type w2,const Type M_=mod) { w1=md(w1+w2,M_); } void mul(LL &w1,cLL w2,cLL M_=mod) { w1=md(w1*md(w2,M_),M_); } template <typename Type> Type pw(Type X_,Type Y_,Type M_=mod) { Type S_=1; while(Y_) { if(Y_&1) mul(S_,X_,M_); Y_>>=1; mul(X_,X_,M_); } return S_; }
template <typename Type> Type bk(vector <Type> &V_) { auto T_=V_.back(); V_.pop_back(); return T_; } template <typename Type> Type tp(stack <Type> &V_) { auto T_=V_.top(); V_.pop(); return T_; } template <typename Type> Type frt(queue <Type> &V_) { auto T_=V_.front(); V_.pop(); return T_; }
template <typename Type> Type bg(set <Type> &V_) { auto T_=*V_.begin(); V_.erase(V_.begin()); return T_; } template <typename Type> Type bk(set <Type> &V_) { auto T_=*prev(V_.end()); V_.erase(*prev(V_.end())); return T_; }
mt19937 gen(time(NULL)); int rd() { return abs((int)gen()); }
int rnd(int l,int r) { return rd()%(r-l+1)+l; }
int gt[1<<7];
map <int,char> gt2;
cint K=4;
ULL h[K+1];
mt19937_64 genll(time(NULL));
void main_init()
{
    gt['(']=1,gt[')']=-1,gt2[1]='(',gt2[-1]=')';
    gt['[']=2,gt[']']=-2,gt2[2]='[',gt2[-2]=']';
    gt['{']=3,gt['}']=-3,gt2[3]='{',gt2[-3]='}';
    gt['<']=4,gt['>']=-4,gt2[4]='<',gt2[-4]='>';
    For(i,0,4) h[i]=genll();
}
cint N=5.01e5;
int n,Q;
char str[N];
vct <int> q[N],q2[N];
deque <pair<int,ULL> > st;
ULL d[N];
multiset <ULL> mp;
int dep[N];
bool check(int l,int r)
{
    return (l>r?true:(gt[str[l]]>0&&gt[str[r]]<0&&dep[l]==dep[r]));
}
int solve(bool opt)
{
    // printf("solve\n");
    st={{0,(ULL)0}};
    int lst=0;
    if(opt) mp.clear();
    int ans=0,cnt=0;
    For(i,1,n)
    {
        int t=gt[str[i]];
        // printf("t=%d(%d)\n",t,gt[str[st.back().ft]]);
        dep[i]=dep[i-1]+(t>0)-(gt[str[i-1]]<0);
        if(t>0)
            st.pb({i,st.back().sc*base+h[t]});
        else if(gt[str[st.back().ft]]+t)
            lst=i,st={{0,(ULL)0}};
        else
            st.pop_back();
        // printf("i=%d,lst=%d,dep=%d\n",i,lst,dep[i]);
        for(auto j:q[i])
        {
            exc(j<=lst);
            int len=sz(st);
            int l=0,r=len,mid;
            while(l+1<r)
                (st[mid=l+r>>1].ft>=j?r:l)=mid;
            // printf("[%d,%d]:%d,%d,%d\n",j,i,l,r,len);
            // For_(j,1,len) printf("%d",st[j].ft); printf("\n");
            exc(!check(j,r<len?(st[r].ft-1):i));
            assert(j-i<=40);
            ULL hs=st.back().sc-st[l].sc*d[len-r];
            // For_(j,1,len) printf("%c",str[st[j].ft]); printf("\n");
            // printf("%lld\n",(LL)hs);
            if(opt) mp.insert(hs);
            else if(!hs) cnt++;
            else if(mp.find(hs)!=mp.end()) ans++,mp.erase(mp.find(hs));
        }
    }
    return (ans+(cnt>>1));
}
void main_solve()
{
    inpr(n,Q); scanf("%s",str+1);
    d[0]=1; For(i,1,n) d[i]=d[i-1]*base;
    For(i,1,n) q[i].clear(),q2[i].clear();
    while(Q--)
    {
        int x,y; inpr(x,y);
        q[y].pb(x),q2[n-x+1].pb(n-y+1);
    }
    solve(true);
    For(i,1,n) q2[i].swap(q[i]);
    reverse(str+1,str+n+1); For(i,1,n) str[i]=gt2[-gt[str[i]]];
    outint(solve(false));
}
int main()
{
    // ios::sync_with_stdio(0); cin.tie(0);
    // freopen("ex_hotspot3.in","r",stdin);
    // freopen("out.txt","w",stdout);
    // srand(time(NULL));
    main_init();
    int _; inint(_); For(__,1,_) // T>1 ?
        // printf("\n------------\n\n"),
        main_solve();
    return 0;
}
/*

*/

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 7972kb

input:

4
8 1
()[]{}<>
3 6
2 6
)(
1 1
1 1
1 1
2 2
2 2
2 2
6 2
([)(])
1 3
4 6
22 8
([{}<<<<])>>>>([]){()}
3 8
11 14
1 10
3 4
19 22
20 21
17 20
21 22

output:

0
3
0
2

result:

ok 4 number(s): "0 3 0 2"

Test #2:

score: 0
Accepted
time: 75ms
memory: 8260kb

input:

10000
50 50
]][][>([<)}{>(([<<>[]}[}>(}([}[><[}<[}<<(]]<>[]>)<
16 50
19 31
6 34
19 49
14 44
26 49
10 43
28 49
13 16
23 39
4 26
30 43
20 27
10 20
25 44
12 42
27 34
2 8
29 44
11 42
18 42
1 4
1 47
31 31
26 47
22 44
16 35
15 48
35 41
17 20
11 13
20 21
9 45
13 46
33 47
35 46
22 26
2 37
14 39
34 34
41 44
...

output:

0
1
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
2
1
0
0
0
0
1
0
0
0
0
...

result:

ok 10000 numbers

Test #3:

score: 0
Accepted
time: 47ms
memory: 8276kb

input:

1000
50 500
[]]})<{>]){[[><>[{](}}{<(<)<{]{><><}>([[{(}(><}>{]
25 46
19 30
23 41
27 34
5 11
8 42
40 46
24 34
7 47
44 45
13 13
9 44
18 32
12 23
24 38
35 49
31 36
14 46
2 9
7 44
27 41
15 22
42 44
21 49
27 50
28 36
6 26
15 47
22 40
6 25
25 43
5 45
19 19
10 40
6 20
30 36
39 44
14 32
17 31
7 47
24 34
2 8...

output:

3
6
11
4
6
6
3
4
5
9
6
5
6
6
3
4
7
4
1
2
11
3
3
2
4
9
5
13
5
8
4
4
4
3
2
1
4
4
3
5
6
4
7
8
3
6
7
5
4
4
5
2
2
7
3
6
3
8
13
5
0
2
8
2
6
2
12
2
4
3
4
3
4
7
2
3
9
7
4
12
1
2
4
5
6
4
4
3
3
7
5
6
6
10
9
8
8
9
3
3
5
6
0
7
9
8
3
3
5
2
4
9
7
6
10
3
4
5
4
3
7
3
5
7
4
2
3
2
7
4
4
4
6
10
3
6
8
8
6
5
2
3
4
3
6
4...

result:

ok 1000 numbers

Test #4:

score: 0
Accepted
time: 37ms
memory: 8048kb

input:

100
50 5000
[)[){>})}>>][<>}[{{))}<(<]}[})>>})<)[((({}<}>}}>[[
38 49
47 48
43 46
5 50
8 11
21 29
11 32
8 8
9 13
1 18
35 48
12 12
24 45
6 19
13 42
30 37
23 41
17 21
40 43
3 31
3 11
9 31
17 35
1 49
9 50
43 47
1 9
8 43
11 19
40 47
6 42
7 31
23 37
30 46
5 30
33 38
8 25
21 39
1 1
27 31
15 35
9 11
7 37
26...

output:

54
99
81
80
54
68
58
33
67
78
73
78
86
95
74
46
101
99
89
82
85
57
53
96
112
76
91
72
42
78
98
72
77
106
63
76
60
91
83
68
64
69
106
77
81
66
41
73
93
61
58
55
63
51
43
78
48
71
134
64
69
112
53
73
61
50
80
91
79
63
75
80
49
62
75
80
78
54
59
48
55
73
63
71
69
94
69
51
87
68
69
102
61
70
61
80
54
62...

result:

ok 100 numbers

Test #5:

score: 0
Accepted
time: 47ms
memory: 10824kb

input:

10
50 50000
[(>><<)>][<]<>>>]{>{>{<({>[[(>[[<{)>]()>[{}]))}>[(
15 24
12 46
2 21
3 38
13 31
3 29
24 37
11 27
11 24
21 42
14 15
15 23
15 45
11 19
17 45
2 16
38 49
9 32
18 30
17 46
29 35
16 24
16 44
31 50
37 45
25 50
39 46
14 46
45 50
21 36
6 14
16 39
38 47
21 22
22 32
14 46
5 31
39 41
37 48
23 33
10 1...

output:

804
1376
493
630
817
973
747
761
810
694

result:

ok 10 numbers

Test #6:

score: 0
Accepted
time: 47ms
memory: 13340kb

input:

1
50 500000
({>([[[]>)>)[)(<<[}({]>{){<[}}{{}}(]){{[>)()<{{]{}
39 42
2 15
13 38
8 15
39 50
2 11
9 33
11 47
28 39
26 29
7 33
38 39
19 25
3 24
11 38
6 30
7 32
8 34
12 50
21 27
26 39
20 46
27 32
46 48
30 41
22 48
32 37
17 26
28 31
23 29
24 40
10 43
28 49
39 45
40 45
24 28
11 29
10 27
21 31
10 18
1 38
7...

output:

9905

result:

ok 1 number(s): "9905"

Test #7:

score: 0
Accepted
time: 74ms
memory: 8060kb

input:

1000
500 500
)<}]<{>((]>]<[}}[}>{[]][[((}(}<<>])[}{[{{[<){<}[([{}}>{}<((<[}][{[(<[}(}>]({[]({})}{<}>})[{{{>]]))[>(>)][}}}>[<{))((>{<[]{[>{[>)}[(<{]}>{(}[])>)}]()>{({{({>{><}({([>>}(}{)}<[]]><[(<}}]}}[}]{(}[>{][}(<}[><)}]]))(]{(<(}][()]}{{{{){{<[{))]](<(]>({[{)[{]<(>]<>}[<{<}([])><{}{[]}}[>))[[]}<]}[...

output:

0
0
1
0
0
1
0
0
1
0
0
1
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 numbers

Test #8:

score: 0
Accepted
time: 89ms
memory: 8160kb

input:

100
500 5000
}(>]<{[>}>)(><<})(}<[](]{}]<<]>{{}]>}(<>{]>{)[<<}<(<)]<[>)<{>{){{{][}<>}{((<[))})><])>)>{(<[)(>[{<([}<{)})<>{[)]<))>){([()[}]<)>}[))}(}]}])}<}}>[<()){]]}}[>}<>[}>>>}}[]<>>[([<)>}{[)}]])[>>()[]<(([}{{[><[}][[){>{([[<)>[>}[}(]([<{<}[>(>(<<]]()[(}[(<}{}{)}{]()>({>){[[[{<)>({>(((])[>[)<{(}]...

output:

7
5
9
2
6
4
3
12
5
5
2
3
7
6
3
8
9
9
10
9
3
6
7
6
8
2
13
6
7
2
5
6
5
7
4
8
5
4
4
5
5
6
9
7
6
5
1
3
1
7
7
2
10
3
6
3
5
6
12
5
13
4
14
4
6
5
4
7
4
3
3
3
7
7
3
5
6
4
6
5
10
1
6
6
2
2
6
8
4
4
5
6
4
2
8
9
4
10
4
4

result:

ok 100 numbers

Test #9:

score: 0
Accepted
time: 79ms
memory: 8788kb

input:

10
500 50000
]}){>(](][]>>[]}>{(>][](<)]((([({}{>[>](<{}[>}{>)<}}{>[([}(<})[)<({)>)(>][{]({[({[([}<<>>{[][}>[[<)[}<]<)]){]<<(([(>()>}<>)>[})[>>][}>[{((]{>]>><}}]{>}[<}<][())}{][<[>)(>[{{]}<{{><)()>><><{<}>{{()())}[[<][>){{}>)(})])]<)>>(}}>[>]])(}((([<[[}[{](}><{[][]{>[<<[{>)}]))><[((<([<])(]()}{]({{...

output:

104
101
118
107
118
122
136
107
109
113

result:

ok 10 numbers

Test #10:

score: 0
Accepted
time: 81ms
memory: 11656kb

input:

1
500 500000
<[)[}](<}[{}>{>>()(><>){>>>([<<{]}][{[([>}]}}{<}[>)]<{{(}{<}({)[[<[]{}<<[{(<{({]<)(((}}{<<[)(>)({[)]>}[[(({><(([{(}}{]}()]}<]}(>>]}}}(}>((<()}[(}]([[}[}<}<{((<<}(><{(}]]]<)(<]>([[(]]<[<]})(>)}})(><}}(>{{](])<}}[}<}(>>}]>)]]{><>)[}[<<()}]}<<{{(]]{)}]{>}}[]]{(}])[<]>){>(])}<(})]>([[>)]]<)...

output:

1109

result:

ok 1 number(s): "1109"

Test #11:

score: 0
Accepted
time: 132ms
memory: 8580kb

input:

100
5000 5000
[][]}(<{>{(](}]>}<>}(]<}})(]<]>>(<{}{<(<><{<[}[{[{){)){(]<{]][[}]><[>[]]]>(](]([{(]<<{]<<[(}]>{}]<()>}})]<{[]>>{)[}[(<[}{{{[>[>><{[[[<([(]){))<>]]((<})>>{)(({]]<>}}[}{})<}>{[}}))](({(]<[<)}]<[[)([<[>[<([}])}{]><]<(([)>]{<)[]])][<<][(((<><}<)[)((]([)[([{<<<>(>{]>>{}<}(<)}]{{}>>{(}}]<)<(...

output:

0
0
2
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #12:

score: 0
Accepted
time: 98ms
memory: 9320kb

input:

10
5000 50000
}}>]]}][()]]{)(>)[)>({>{{}>}{}]{<())>>[}]>{)]()}[><)({}>>}]<))[)><(<]{>(>(]<{[>)}>([)>(){({><)>}[(}])})[}}>[<>[}([>[]<)][<]>}{))>}>>()(]]{(<)(](}){)>><{)(><}](]{}<[(({{]>>)<{([{]<({{){[{(}<{{}])]{)]<{{<]]{]]{](}<[{[]{{>]()<<](}<{(}]>>{{]<{}{()])>>[>>[({)}>{[{<()))[{[}]{)}<{]([<[(]<]{)}...

output:

7
3
8
9
8
7
5
6
3
8

result:

ok 10 numbers

Test #13:

score: 0
Accepted
time: 131ms
memory: 15256kb

input:

1
5000 500000
>([><])])><{<>)(>[>()]>[)[<<[){[(>}<()[)}{}[}{(>[)>[[})<(>]<([}><>[[(>}]()>{][[[{()>)<}>}{[]}{>)]<[)<{[[(>]]>(}[{(})>)]])[]{(<{><<{}]]){>})<)<]<[({>[]{{[><)))])(}(}})]]{][})}{<>(}){}>[]<{[(]}>(<<)<(>>>){(>{<][()>{({]){{><<()}<<[<>}<(>)({]]]](<[]]])<]<)[)<([>)>]<<[(<){>[[([)<)>>}]()[>{}...

output:

117

result:

ok 1 number(s): "117"

Test #14:

score: 0
Accepted
time: 169ms
memory: 14744kb

input:

10
50000 50000
][[<(}{{[{[<<(<}>)[<[)))][]}<]}[>>>}[}{({)}>>[>{[[(]>)<>{[(][}][)]<([}<>]<]]>{)<{](}][}(]]><}>[>)(>()<[])]]{}><}]{]]{[<<(}(}>[{((<]{<>(]}(})[[}()<>}{])(]<](<}(}}]){)()>(<)[{}<>}><]]}>>{((>{(<<()))[){>({((}()]>)(<><>){[(]({>{)>])[]){>[))}{>[>]]{[()([{[][([<)<(<(}(}}({>[(>><<)>][<]<>>>]...

output:

0
0
0
1
0
1
0
0
0
0

result:

ok 10 numbers

Test #15:

score: 0
Accepted
time: 210ms
memory: 18744kb

input:

1
50000 500000
<<[})>}]{]}{>)]]{{{}){(])<{{]((()<[<]([>[){(}[){>}<(<[]<<}{[{<{({><{{[[(<)<[[{[])<])]()}[}(<}{]}<[{>{}<<[[{(<><<][]<>([[<<>>}{}>(<<>{)}[}{{{[{<>{<<[])<}))[<{<[>(]]}]>>](>(}}[)}{{}[}]<{]}>)](]](){([<{)[{(]>)>){[>>>>)){[([){<}>(((><}{[)[>([))]]}[){>]})}(})}}<)><{((}]((>)]}>){}[)[)[{({{[...

output:

5

result:

ok 1 number(s): "5"

Test #16:

score: 0
Accepted
time: 323ms
memory: 51632kb

input:

1
500000 500000
>}<(]){){[<)<[)(<[<})<)>]}]>)[[](<{}]]>[([{{{<>(]>))()<]][((<>[>(>}([<<){{<{){)><}([>{>}](>>]}}(>[)((](}>>])}]<[)}))})]])([]>{]<}<)}<(<>)]]{)]<]]}>}]([>>)({[}})]]](]><}])>{]{)){>><(>{){])]}>[[([)>(([)](<)<<({}][{{()>)>}<<[]({[]{]))[]((]>[[{}>)(>[[]{]}>><<]>]>><{{)])}](>>[{}]))<<{>)(}...

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 579ms
memory: 28996kb

input:

1
50000 500000
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

208440

result:

ok 1 number(s): "208440"

Test #18:

score: 0
Accepted
time: 295ms
memory: 12684kb

input:

10
5000 50000
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

20871
20772
20815
20864
20869
20894
20859
20778
20929
20988

result:

ok 10 numbers

Test #19:

score: 0
Accepted
time: 208ms
memory: 10316kb

input:

100
500 5000
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))...

output:

2098
2095
2104
2080
2090
2048
2090
2092
2063
2099
2110
2083
2083
2084
2066
2077
2069
2128
2097
2054
2056
2094
2076
2062
2061
2060
2103
2086
2116
2061
2090
2099
2075
2097
2084
2115
2113
2141
2025
2124
2080
2056
2086
2079
2074
2094
2069
2066
2135
2117
2067
2099
2081
2082
2086
2090
2083
2080
2093
2082
...

result:

ok 100 numbers

Test #20:

score: 0
Accepted
time: 165ms
memory: 10356kb

input:

1000
50 500
((((((((((((((((((((((((()))))))))))))))))))))))))
16 37
28 47
8 41
13 47
6 9
7 11
22 27
14 18
29 45
7 43
34 45
5 29
24 28
5 26
24 46
3 11
1 13
27 40
10 43
34 40
3 48
40 50
22 42
10 40
1 24
10 42
17 24
6 24
26 45
7 38
1 32
9 39
22 43
14 50
9 47
11 39
14 17
5 28
28 42
7 44
27 34
7 11
27 2...

output:

204
198
212
215
203
200
209
197
194
207
203
196
214
216
204
196
205
207
207
202
206
199
208
208
206
213
209
211
209
211
211
211
195
209
213
215
195
199
213
196
198
203
214
208
212
216
205
216
210
216
199
196
208
213
217
212
214
209
201
207
218
204
206
199
211
208
204
213
200
214
205
220
206
215
208
...

result:

ok 1000 numbers

Test #21:

score: 0
Accepted
time: 126ms
memory: 8088kb

input:

10000
5 50
(()))
3 3
4 5
3 5
4 5
2 5
3 5
4 5
1 3
5 5
2 3
2 5
3 5
1 5
4 5
1 3
3 3
2 5
1 5
2 5
1 2
2 5
2 2
1 5
4 5
2 4
5 5
5 5
2 5
2 2
1 2
3 5
2 5
1 5
2 5
2 3
4 5
1 3
4 5
2 2
4 5
3 3
1 4
3 4
1 3
1 4
2 4
2 4
5 5
5 5
1 4
5 50
(()))
3 3
3 4
4 5
2 4
3 4
1 2
2 5
3 5
1 2
1 1
4 4
4 5
5 5
1 2
4 4
2 4
3 5
3 4
...

output:

11
13
17
14
14
11
19
13
14
22
14
9
16
19
14
13
11
13
16
16
19
16
16
14
10
16
15
17
18
19
14
16
17
17
17
19
20
12
12
12
21
13
16
13
16
14
13
19
16
13
16
18
15
19
15
15
19
13
15
15
11
13
18
17
9
15
21
14
17
17
12
13
15
11
16
17
13
13
12
15
11
16
20
21
16
14
14
14
16
12
20
17
12
17
19
15
19
15
16
14
20...

result:

ok 10000 numbers

Test #22:

score: 0
Accepted
time: 524ms
memory: 63884kb

input:

1
500000 500000
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

248787

result:

ok 1 number(s): "248787"

Test #23:

score: 0
Accepted
time: 379ms
memory: 56576kb

input:

1
500000 500000
[}<(>[<[([)]{(()}{(>][)])[[(<[][<>){>(}}{]}<}<[<}>)<]{[<[}{<(}><]{(<>>(<)><((<()<}<{])(<[)[]][>(>]]>>)(<<{[([(][><(>{()}](}<}[{({}]}(}{{]{]<}}[)((}){)>[}){>(]}>[(>[){{((<([({}>)}()}})}<{>>]>[]><>}[{([<])}]}{]]{<>>](>([<}<<]<}<{<]>(]{[><<)(}}}({(][>[[[)[<)(]({<}}}[[[(}[<><>)><[})}{{[]...

output:

53182

result:

ok 1 number(s): "53182"

Test #24:

score: 0
Accepted
time: 324ms
memory: 53828kb

input:

1
500000 500000
](([>{)<([(]>[>)]]>{]<)}}{<>]](])}<{(({{<>(}{>>)<]<]>)){[]>>[>]{]>})<[>{)))[}]<{<)}}>[(}])()}[>()({>)[]<)[[)[}<)]}{(][((){)}{]]<{(](>)>]{){]{}<(](]<{((<[<]]([><[}]][<][{<<>[]<)()]>){(<(>{{((])})])))>]()>}{(<})(])[<)([}<>{{(<{]]({[{<(][}[]>]>}]<><)})[)}}<{}({][][){}]{>{{(](({})}[{]}]{...

output:

5475

result:

ok 1 number(s): "5475"

Test #25:

score: 0
Accepted
time: 233ms
memory: 53860kb

input:

1
500000 500000
>((>)(([(){}}[(({}]>>>(]{{<>[((}(><<><[}]>{}})><{<){>{>({}>}}<{{<]})([<])]}([><<><(]]><>){>}{]><(<{}<{)]{<<}]]<)({>}](<([)(>><[)<>]{){}<{>>{(}}<{(<)>(}{(}[]>><>)>[{>]([>}(}[}}}{]<>(<}))>][[<[(>{[([(})>][)(]}>)]<>}[<[>(}][{>[[([})])[]<{>[(<][[<)<{<{[<><<(]>)[[}{{<<](<>(]<(((<<]{>((])]...

output:

474

result:

ok 1 number(s): "474"

Test #26:

score: 0
Accepted
time: 279ms
memory: 53760kb

input:

1
500000 500000
{}][>>]]{}]}]]<(}](}]>][((][[[[[}}}<(<{)}]<(}]]([{({{]>(}({(}>)[<([>(>[<>}}[(}{>(({(})>{[[)}><{(>{{>)[{[((()])){}}{{<[]>(<[>]>]{)]]}[(]][}>><>[>]<)}>}]><}((<[><]{}[{(}]{}]][((()()})[(<{<)>[(<<}({}<[{)<>]}<][(>}<[]))][)>}<([}(<><(>>})]><[((<<]>>}]<>)<[)[[][[<>}[<<(][>}<>[[}{})>>(((<([...

output:

45

result:

ok 1 number(s): "45"

Test #27:

score: 0
Accepted
time: 218ms
memory: 53308kb

input:

1
500000 500000
{{)<]]>><>()))<>[<}<}{()())}({}<][<){[>(]){)[>>>)){>[}<}}(>}<]{[[[>[<{{>(<{({(}<(<>>(((>][)[]}(]){{)(({{}}({}]<]>}><<}>>(<(<))>]))<<[<)(]<)>(>{<>>[[{{[<<{]((>][)({[{>[[))<([><>>][}[<)]{}[(<>]<))<]>[>[>>>(}({>>)><)[{<[(}>}[()){{])>((}>}}>{>}>)>}(({((}}]{<([[)>[{<<}{)<)][})({{[>)>>>{)<...

output:

6

result:

ok 1 number(s): "6"

Test #28:

score: 0
Accepted
time: 316ms
memory: 61268kb

input:

1
500000 500000
{}[()]{}<>({}<[]>)[[{}]]<><><()>{{<<>>}{<>}}{}(<>)[]<[[]{}]><<{}>([[]<(<<><[[]]>{[{<<>(()){{{}[[{((){()((<>{(){<>}[{}()<()>[((()))]]}))})[[]]}<{}[((){}<>){[<[(<><><[<<[]>[]>]<[]>{<[<>]<()[]><{{}<<>[{{{{<>}<><<>{}>}}}{[]}]>}>>}<>>)]>]()}]{()<{}>}{}>[]()]]()[<>]{}}}{}()([]{})>}]<{}>{<>...

output:

142356

result:

ok 1 number(s): "142356"

Test #29:

score: 0
Accepted
time: 336ms
memory: 56788kb

input:

1
500000 500000
[{}]{}<>{}{}{}[][[{}[{(()[()])}]]()<()(<>{}[[()]])[<>][]>(<><{}[]>()[])]<[]<>>{[{}[][()]]}<>[{((){[{}[{<>}({[[]{}]([]<()<[]>{}><{[]}>{[][{}]})})()]<>]}<[]>)}(){}]<>()()(<>)()[(({}))<>]()()()<()[{}][][]>{}{}[{}]()()(){()[((<{}>())<()[[[]]{(()())(([][])(<>)<<>>)({})()}]>{}{()})]}(){[{<...

output:

38282

result:

ok 1 number(s): "38282"

Test #30:

score: 0
Accepted
time: 348ms
memory: 54672kb

input:

1
500000 500000
{}<>()()[]{}<>()[]{}((<[[(<>()<{{{[[{}]]}}}[<<[]>{(){<[<>]>}}>[]<{<({{{{}}}}[])>([]<<>>)<{}()(){}>{}<()>}>]<>>)]<<<>><>{}[([])]{{[({}[<([[[]{<()<><><{{}}[]({<><>}<><[()[()]][]>{}{})>[<[]>[]]>}([(<>())]){[]}<>[]]<{<<<>><[]<()>>[<[<[{([]{})<(())([(())]<>)[]<(){}>>}]>{}{}]>]<<>>>{}<>}()...

output:

4449

result:

ok 1 number(s): "4449"

Test #31:

score: 0
Accepted
time: 327ms
memory: 53852kb

input:

1
500000 500000
<>[]{<[[]]{{[]}}>}<[<>][]>[<{{}[[]]}>][][<>[{(<><>)}{}]]<<>(([]))><[()]<()>>[(<>[])]<>{()()[[][]]<{}>{[]}}[[{()<>(){{[]}[]}[<>]{[]()}()}[]]<>][]<>{}[]<>[{}]()<<[]<<{}>>{()}>><>{<({}[]<<>>)>([][(<{[[<><()><>[<><>([[<>([])]][{}<[([](())){}]()[]>{{}}])[]<>{{}}]]({{}}[]()()){{<>{[]}<>}}]...

output:

375

result:

ok 1 number(s): "375"

Test #32:

score: 0
Accepted
time: 291ms
memory: 53192kb

input:

1
500000 500000
[{}<>]{}{([{}])<{<{<{([[<([]<<><{[](()){[[[()][]]]}}[]{}>>{([][])}[{<>[]<[<>[]]>}])>{<(({})()){}{<><(<><[[{[<<>>]<>}[{<()<>[]>}]]<>{}()<{<>}[{}]{[{}][[()({{<<>>[(<>)]}})[]]]<>()}[[]<>][]>]>[][{}{}<>[<(){}[]>()]]<<({}[{<>[]{}<>{}}<{()}>]())>{}>){()}>(<>)}{[{}]{(<>)}[](()[()]<>)}>{[(<>...

output:

42

result:

ok 1 number(s): "42"

Test #33:

score: 0
Accepted
time: 336ms
memory: 61260kb

input:

1
500000 500000
(((()()(())(())()))()()())((()))()()(())(()((())()()))()()()(())(()()()(()))()(()())()()(())()()()(())()()()()(()(()()))(()())()(((()()))())()(((())(())())()(()))()()(())()((()()()()()(())(()((()))()((()(()))()))()))(()())()((()))()(()()(()(()())())((()((()((())()(()()))())(())())())...

output:

152712

result:

ok 1 number(s): "152712"

Test #34:

score: 0
Accepted
time: 359ms
memory: 56804kb

input:

1
500000 500000
(()())(((())((()())(((((())(((())))())((((()()(((())(()))()))(())))()(())()((())(((()()()()))(())))(((())()(((((((())(((())))(())((()()))(()()()))((()()(()())()))(()(()())()()((())))))()()))(((())(((()()(())))()(()())()((())()((((()()()(())(((()((())()()))))()((())(((()()(())(()((())...

output:

67010

result:

ok 1 number(s): "67010"

Test #35:

score: 0
Accepted
time: 423ms
memory: 54668kb

input:

1
500000 500000
(())(()(())((())(())))()(())()()()((()((()(()()((()))((((()))((())))(()()(((((()))(()(()))(()))(())))))))(())()(()())(((()((()()())())()()))((())()()(()(()(())()()))()()()()))()))(())()(())(((((()()())((()())())())()((()(())()((()))())(()(((((((()(())(()())((()()()()))()(((((()()))()...

output:

23151

result:

ok 1 number(s): "23151"

Test #36:

score: 0
Accepted
time: 440ms
memory: 54092kb

input:

1
500000 500000
()()((()))(())((((())(()()))((())()((())(()()))((((()((((())))())))(())())((())(())(()((((((())((())))(()())(((()))())((()(())()))))()(((((())(()())))())())(())()()((())))((()(()())()()(()(((()())())(((()()(()))()((())))())(()())()))()))))))())))(())(((((((())))((()()())())(())(((()(...

output:

7026

result:

ok 1 number(s): "7026"

Test #37:

score: 0
Accepted
time: 307ms
memory: 53152kb

input:

1
500000 500000
()()((()))(())()(())(((((()((((((())())))))))()(((()))))(((((())))(()(())((())())((()))))))())()(()()())(()(()(()(())())()(((()(())))()()()))(((())()()()()()))(()(((())(((()()())(()(())(()((()))(()))))()))))())()((()((())())))(((()((((()()()(((())()()((()()))))(()(())))(())(((()))))(...

output:

1762

result:

ok 1 number(s): "1762"

Test #38:

score: 0
Accepted
time: 827ms
memory: 67416kb

input:

1
500000 500000
{(([[{[((({[([({[({[<(([{[<[{(<{<<((<{{(<<[[{([{{<{{([{((({<<<[<<{{{<<([({[[{{({[{[{<[[<[<([{{[[[[{[[([{({([([{{{{<([<<{<{(<<[(({[([{[(<{[[[(([{[{{[[(({({{{{([{([[([<{[{[([{(<<<{(<<[{[({{(((([[[(({({<[[[{<(((<{((<<<[[<[<(([(([[({{<[[{[<{({[[{{<{[{[[<{<{([<{{((<((<(<<[<(<{{<<[<<({<([{...

output:

1

result:

ok 1 number(s): "1"

Test #39:

score: 0
Accepted
time: 862ms
memory: 67364kb

input:

1
500000 500000
(<[<({([[{<[[<<<[([<({<(<{{{(<<[{{<({([<{(({[{{(([{(({<<[<<(([[{{{<{(<(<[<((<<<{{({<<({<{[<<(({[{<<{((((((<(([([<([<[<[[{({<<[{[[{{{({{{[{{[[(([([((<(<({[([{{{{({((([<{<[(<[((<(([{<[((({{<<[[([<[<{[({<[[{({{{<<{{((([{[{<([<({[{<({((<<{<<(({{(<<<(((({{((<[[{[{[[[(<[{[[[([(<{{[[[<<(<{<...

output:

1

result:

ok 1 number(s): "1"

Test #40:

score: 0
Accepted
time: 836ms
memory: 67632kb

input:

1
500000 500000
<{<{<<<{<<<(<[<<[<[((<[{[([<[{{(([[[{{({([<<<[<[{<[<<(({{{<[{<([[{({(([[[({((<<[<{{<{<<(<<[[<<{[<[<{<({{<{<<[(<([{({[({<[{<<(([{[<<<<{<[[{<({<<(<[[<(<{{<<{<[(<{<<{<{<[{<[(((((<[{<{([[{[<[{<<{([[{{{{<{[[[{{<[(<[[<([[[<((<[<[(<[<{{<[((({{([{({{<<(<{{{(<{<{(<{(<[{{<(<[<({[([[{{[(({[[<<(...

output:

0

result:

ok 1 number(s): "0"

Test #41:

score: 0
Accepted
time: 840ms
memory: 67352kb

input:

1
500000 500000
{{(({<{<[[<((<<([<({[(<[{[(({({(<(([[(<[<{{({((<({[[{[[[<{<[<[((({{{[([<{[[([({[(<<<[[<([[({[[<(((({{((<{({{{({{{({[[[<{(([<((<<((([[<[<(<((({{<[(<{{<[(({({[{({{([<[[<<<(([<((<[(([[[<[{<([{(<<[<([{{{[<[({<[(<<{<[({<[(<[<[[<([[<[(<{<[[{[[{([{((<[{<([<(({[([{<({(<<((({(({{<{[[[<{{<{{([...

output:

0

result:

ok 1 number(s): "0"

Test #42:

score: 0
Accepted
time: 813ms
memory: 67456kb

input:

1
500000 500000
[<{<{<((<[<[{{({(<[<[(([<{[{<{(<(<[[[({{<([({(<[<[<[(<({(<{<<[{<<<[<{[{<[<[[{{((<{[{[[{<<<(((([[({<(<({<(([[({{{[<{<<<{<{{(({<{<{({({(({[[([<{[<<<<{{<{{<[(({((<[{[<[{<[{{<(<[{(<{[[<<(([<{<{[<({{<[<((<[[<<((<<(([<[<<{[({[[[<<<{[<[([([([(<[{{<{{[([<{{({{(([[{{[([(([{{([<{{[{{[[(<({<(({...

output:

0

result:

ok 1 number(s): "0"

Test #43:

score: 0
Accepted
time: 672ms
memory: 67572kb

input:

1
500000 500000
[<<<<{<{<({<{<<{({{[(([[[(({}<([<{{[[({<>({<{[[<{{[[[(<{[()]<<{[{}{{}<<(((<[([[[(<{[(({[<<<([([[<[{{{[]<><((<<({{((<([(((({}{[(<<[{{{<[[[({[[[{(<>[<><<([<{<[(({<<({[({{([{[({<{{{(((((({[{[{(({(((<{}({(<[[<{[<>]}[<(<[{[[((((({}<([<<<[([{[(<{<<[<>{(<<(<[({<({(<><[[<<<((<{((<<<([{<{}{({...

output:

162821

result:

ok 1 number(s): "162821"

Test #44:

score: 0
Accepted
time: 697ms
memory: 67512kb

input:

1
500000 500000
{}{{[{({{[<>[[]([<{({{{([<{[{<([{[]<<<{(({[<[{<[[<[<(<><({({{{[]}{[]([()][{<[[({()[{{((((([][<({}<([((<[({<(<>(<<<<(({({[[{{<<[[<<(){<[<(([({}<[{{{<[<<<()<<{[{({<{([<(<[]{{}{[[{{[<[[[(<><><{}{(<>)(({{[{<[(((<<<([{({<(({}<(<{[(<({(([{[<[<<[[[[<<>()<<<((<[(({<<[<[[<<{[{{<{[[][[[[{{{}{<...

output:

16576

result:

ok 1 number(s): "16576"

Test #45:

score: 0
Accepted
time: 723ms
memory: 67188kb

input:

1
500000 500000
{([((([<>[{[((((<({{({[([{[]{<[{[([{[<<<{({([[][[(({[[<([{([{<{([{(<(<(<>{[[(({<({[]<[<>[<{<(<([<{(<[()<[{<<[((([[({[[<{(<{{[{{{{[((<<>[[<<{}((<({(({(([{({{{<[<><{<({[{{({[]{([<{<[{<<((<[[{{[({{[{(<{<[{({{[[<([{{[{({([<><((<{(([<<[(<<(<(<[[[<{[([<{}{({(<{{{{[[<<[[(){}<[({<><([()[[(<(...

output:

1262

result:

ok 1 number(s): "1262"

Test #46:

score: 0
Accepted
time: 712ms
memory: 67100kb

input:

1
500000 500000
{(([[{{}{<{()[]([<<<>{[(([]({}<[((<{[]<[[]<({[((<[[[{[{(({([{([<[({[<<<[<<{(()[<{[{(<[[[[][](<(<{<{()()[{}{}<<{}<(([[{[<[((<[[<{(({([{(<>{<[[{({[{}[[[{<[{{{(){<[[[<{}((((<(<([<(<((<[<<{[[{{{[[<{{[{}<>({{({[[<(<{{(<<{{{[()()[[()]<{<({[(([[[({[]<{[[{<[([()((([]([[[((<<[<(()[]{{<<<({{[(...

output:

340

result:

ok 1 number(s): "340"

Test #47:

score: 0
Accepted
time: 801ms
memory: 65996kb

input:

1
500000 500000
[[]<<<[(()(<()(<<(<[({{[{[{[(<{[[][<{([[({<<{<[[]{{<[{{}((<({<{}[{<()>{[<{((<[{<({[{{({{<{[([[(({}({{()[<{{[{}((({<<><{}[[(<[[{{({}<{<[[]{{[{{([({{<{{{[(([<>{{[[(([[(<[[[<{(<<[[({<<<>(({([{([<[({[<<<><[({<{[<{[{(<[[[[[{(<(<{<{(({}{{{}<<>(<(([[{[<[((){[({({({([[]<<{{[[<{[<{[[[{<><<{<(...

output:

100

result:

ok 1 number(s): "100"

Test #48:

score: 0
Accepted
time: 493ms
memory: 66764kb

input:

1
500000 500000
(((((((((())())((()((()()((((()((()(()((()((((((((((((((((((((((((((((((())(()(((((((((()((((((((((((((((((((((((())((((((((((((((((((((((((((((((((((((((((((((()((((((((((()((()((((((((((((()(((((())((((()((((((((((()(((()((((((()((()(()((((((((((((((((((((((((((((((()()((((()((((((...

output:

224975

result:

ok 1 number(s): "224975"

Test #49:

score: 0
Accepted
time: 397ms
memory: 67244kb

input:

1
500000 500000
((((((((((((()(((((((((((((((((((()()()((((()((((((((((((((((((()(((((((((((((((((((((((((((())(((((((()))(()()((((((((((((((()(((((((((((((((((((((((((()(((((()(((((((((()(()((((((((()(((((()((()((((((((((()((((((((((((((((((())((((()((((((((((((((((((((((((((((((()(((())(((((((((((...

output:

220198

result:

ok 1 number(s): "220198"

Test #50:

score: 0
Accepted
time: 439ms
memory: 67188kb

input:

1
500000 500000
((((((((()()(((((((((((((((((()(((((()((((((((((((((((((((((((((((((((((((()((((((((((((((((((((((((((()((((((((((((()())(((((((((((((((((()((((((((((((()(((((((((((((((((()(((()(((((((()((((((((()((((((((()(((((((((((((()((((((((((((((((((((((((((((((((()(((()((((((((()(((((((((((((...

output:

214328

result:

ok 1 number(s): "214328"

Test #51:

score: 0
Accepted
time: 495ms
memory: 66480kb

input:

1
500000 500000
(((((((((((((((((()(((((((((((((((((((((((((((((((()(((((((((((((((()((((((()(((((((((()(((((((((((((((((((((((()(((((((((((((((()((((()(((((((((((((((((((()((())(((((((()()((((((((()()(((((((((((()(()((()()((((((()()((((((((((((((()(((((((((((((()((((()()((((((((((((((((((((()((((((...

output:

198470

result:

ok 1 number(s): "198470"

Test #52:

score: 0
Accepted
time: 557ms
memory: 65272kb

input:

1
500000 500000
(((((((((((((((((((((((()((((((((((((((((((((((((((()(((((((()(((((((((((((((((((()((()((((((((((((()((((((())(()(((()((((((((((((((((((((((((((((()()((((()((((()((((((()((((())((((((((((()((((()((((()(((((((((((()(((((((((((()(((((((((())((((((((((((((((((((((((((((()(((((((()((((((...

output:

144248

result:

ok 1 number(s): "144248"

Test #53:

score: 0
Accepted
time: 158ms
memory: 56620kb

input:

1
500000 500000
()[](){}{{}[[]][]}[<>{{[[<>([{}]){<>}<[]><()>()]]}({}([](){}{{()}}))}][]<>{{<[]>}}<[[]]{}>[]{}<>([]){<>}{(())[]}()[<>]()<>()<<>>()({}){}{[][{<{(<>[[[(([()]{<{<>}><>}(<>))<{(<<>>{})}>{()}[])]{}]<<<{({}){{}}}[]>>{}{}>][]())()<()>}<>>}(){(<>){([](())<><((){}<{{}}>({(<>{<<[{}[][]]>[]<[]{...

output:

108

result:

ok 1 number(s): "108"

Test #54:

score: 0
Accepted
time: 161ms
memory: 56576kb

input:

1
500000 500000
<[(<>)]()({{}{(){[<[[]]>]}{{}{}()<>}<>}}(<[{<>{}{[]}{}{{{{[<[][]>]<>}({[]{{}}[<[[[]({})({}){}[{}]()]]<{}<{[][]<>}>>{[{}](){}}>]}({})[[{<>}[]()]](<<>[]>))}}}()}((([]([]))<{{}({})}[][]{}>[]{<>})<><>[])]>[]){}({}))>{[]}<>[][]{{}(())}<<><{{}[]{}}<><()<()>>>()>[<><{}>]<>[(){}]<>{}<{}>{{}}...

output:

40

result:

ok 1 number(s): "40"

Test #55:

score: 0
Accepted
time: 177ms
memory: 56696kb

input:

1
500000 500000
{()}<><<><{[]}<>>[](([[{<>}{}][[]]]{}{})[(<<>>)][])<[][]><[[]{}][[{}]]>>{{}}[<>][]{[]}(){{}}<>{}[(<>)]<{()}<{[[{{[]<>}[<>]}{<<>>}]{}{{[](<>{}{}[{}])}{}{}[[]][{{}[]}][([([]())<>])()<>]{}}[]]([]<{{}}{{}}>[]{})([])}>><{}<>(((){}[]))([])>()([]{()[<{}>]}<>)<()>(([]))(<<(()){}>({}{}<([<>])...

output:

53

result:

ok 1 number(s): "53"

Test #56:

score: 0
Accepted
time: 149ms
memory: 56820kb

input:

1
500000 500000
{}(<[][]><[]<>>[]){[(()[[{}]()[]]<>((())))](()((){()([{<>}][]{()}())[{}()]<{[]}><>[[<[][<>()[{}]]>[()]{}]{[()]}]}<><>(){(({()<>[<(([]{}[]){<[{[]{{<<{[{<><(){[]{<>}[[]]<{[]<<()>><>{[<{<>}[<{}<>><[]>]()>{}]<>{}[[]][]}}>}>}]{}{()}<{}<()()>(<>)<>()()>[]}<>{[<>]<<><[<>()<[][]{}()>]><{<[]>...

output:

28

result:

ok 1 number(s): "28"

Test #57:

score: 0
Accepted
time: 167ms
memory: 56720kb

input:

1
500000 500000
[]<{<[[]{[]<>([]){}}<<{()(<>)}>>]>}<[]>>{<>}(([]())<{}([]){}>((<>)[]){})<[()]({{[]}<{[{[<{}>]}]}{()}{{}}>}<>[[]({})()])>{}()[<>]<(<[]>{([])}()[])>[{([])()}]<[{}]{[](<[[<>{<()><<<>{}{}>>}]](){}>)<>}{}{()<()>[][{}][{[]<()[]{}>}()](){[[]]<<>[]({})()>(<>)}}[[<[<{}<>><<([[[({{}{{}}[(<>[[(...

output:

27

result:

ok 1 number(s): "27"

Test #58:

score: 0
Accepted
time: 147ms
memory: 56688kb

input:

1
500000 500000
{{}}()<>()[][[]]{(({}[[[[]][{(<>)[<>((((<<{{}(<>)[]({[()]}()<>)[]}><>[][]{}[[(<([])>())](({}{})<([])>[[]]{<<{(()()())<[](<>)[]>}>>}<><[(<>[])({({<{}{{(<{[]({})}[]>)}}()[]>(()<><[<(()()[()])>](()<><([]<>)<>{()}{{}}()>()){{{([(){[]}{}<()[{[]}{}]<>{}>{}]){}}}}[<><>]><{<>([{{<>{}}<<>>[]}...

output:

146

result:

ok 1 number(s): "146"

Test #59:

score: 0
Accepted
time: 168ms
memory: 56644kb

input:

1
500000 500000
[[]{{}([])[]}<>()][]{(){}[]<>}{<>{}}{<>([])[[][[[{{{}{<<>{}<[]<>()>>}<>}([]()[{()()(<>)<{}>}[]])}]<<<>>[{}()<([])()>{}]>][]]([[[]<>[()([]()<<<>[]>>())]([])]])](()[][])[]}<{}>()<[<>]{}<>><><({()}{<><({{[<><>]<{(<>())}>}<[<>{()}(){}][]{(<>)}()[([<<[{}][]{}>>])(<><><>{<>})]>}[[]{}])[[][...

output:

133

result:

ok 1 number(s): "133"

Test #60:

score: 0
Accepted
time: 163ms
memory: 56668kb

input:

1
500000 500000
<[][]><><>({}([()]{[[][(){<{}[]><[((<>)[({}{{}})])[<<<>{<><>}>((<<>>)(<>{()(<>)()(){{}}<>(<<<<()>>()>>)<>})){}{}<[{}]>>{}[]]]{[([](<{}{[][]()}<{{[([]{<()>[<>[]{}][]})<{()}>]}{[][[[][[](()[][])<<>{{}}[]([[<>]])[()]>][]]][]}[]()(<>)<>}>{<<{<<>><>([]){{}[{}]}(<<<<>>>([<>[{{(<>{}[]{}<>{}...

output:

38

result:

ok 1 number(s): "38"

Test #61:

score: 0
Accepted
time: 162ms
memory: 56524kb

input:

1
500000 500000
{}((<{([()]<>)({{<([{<[[<[]{({})}>{{}<>}()]<({}){<<><>[]>[{({[][][](<>)})<>[{{}{[](())}<{()(([][[{[[()]]([{{}(<>[][{<<>>}])[]}]()(<>))}][<({{}[]}[[[]]<>])()({})[[[]<>({[]{<{<>}(<>)>{{([(<{}<>>)<[<()[[<[]>]((<>))([[]](){{()<><>}{([{}(<{}>)])[{<[]>[]}]}}{}){}[]]>]><([[]])>[](())[()]]()...

output:

45

result:

ok 1 number(s): "45"

Test #62:

score: 0
Accepted
time: 174ms
memory: 56596kb

input:

1
500000 500000
[[(){[{[]}]}<>([](())(<<(<()[{}()]>[(<([[]()])>)<<<>{}{([])}>><<>()<>{}>][])>>){})[<><[]<>[(<><{}>[<>[]])[[()]]]({})>]]()]{}({}){}<[][()]>(<{()}>)(<>)<()><(<<<><><>>()>)>()<>()<{}>[]{}()[]({}){{<>{}[]}{[]}}[<>][]({}{})<>[[]<>()]<[<>{[]({{}<[[]()]{}>})({}<>(<>[()]{}(<>))())<(){(){{{}[...

output:

128

result:

ok 1 number(s): "128"

Test #63:

score: 0
Accepted
time: 103ms
memory: 45228kb

input:

1
500000 500000
<><><>{}(){}[[[]]][[[[{}]]{}<{[](([]{<>{}}))}>]<[({<><>[]}[])[(())]](){[]()<>[]{({{}})}}()[()<>{{}{([()])}}]>]({{[((<(<>)>[(<[]>)[]]){}{}()<<>()><([]<[[]{<{}>}]{}[]>([[]()]){}<[<{<({(()({}<{}>{[]([[]]{}([()({}[(){}{}[[]]<>[](<[[]][](([]<>{[[]]}())(<>)(<{}()>[]))[[{[()]{}}[<>()[][{[{}...

output:

32

result:

ok 1 number(s): "32"

Test #64:

score: 0
Accepted
time: 98ms
memory: 44948kb

input:

1
500000 500000
{{<<{}[]{([<>][]{}()(){})()}>()>}}(){(<>[])}(){}[{(()[]{})()(<>[]<<>>)<>}]{[<{{}[]}>{[[<<<[[(<>[]){}]][[[[[]{}<<<>{<><>[]}([({})]{{()}})>><>]]<<>>]]>{{<>(){}[()]<>[]}}>{<><<>><<>>}>]]<>[](<>[()][])}]}{}{()<>}{[][][]{{{}{}}[(([]))[()[[](((){}[{()}][[][([])(()())([{(()[([][]())<>])}{<<...

output:

15

result:

ok 1 number(s): "15"

Test #65:

score: 0
Accepted
time: 108ms
memory: 44976kb

input:

1
500000 500000
[{}]<>{<{<><<>>}>}{{<({})>}}{()}(((<>)))<>{}()[]()(<{()}>)(({{{{{}{}{{}(){}()}[]<{}>{<>}}}[{}]{<>()}}}(<<(({{}}))>>))){{([<>({{{}}}[]{}[])[[[{{}()<{[]<><()<>>[]}>}(<{<{{}(<>){{()}<>{}}()}>}[[][{{()}}[]]<>{}<>]>)][[<>]]]]{[](<>)<[[[[[<[]>]]]]]<[(()[])]>><>}])(<><[]{}>({}({}[({{}[{()()...

output:

9

result:

ok 1 number(s): "9"

Test #66:

score: 0
Accepted
time: 104ms
memory: 45004kb

input:

1
500000 500000
()[{[<>]<{<>}[[<[](){}>]<>([])]>{(<{}{<{[]}[]>}>)}}()]<<>><>{}()<<(([<><{[]}>{}{{}{}<>([][]({}){}<>())(<><<>>)<(()){()}>}]{}<>{}<>))[[]]{[](<{}((){[]})>())}>>[][]()<[](<({(()[{}<>][<<>>])({})})>{{<>}{}{}})><><>{{}[]<{}>{}()[{<>}]}[][]<[[][()]]{}>()<[<>[<>[<>]]]>[]()(){}[]<<>>{[[[]{}<...

output:

6

result:

ok 1 number(s): "6"

Test #67:

score: 0
Accepted
time: 96ms
memory: 45172kb

input:

1
500000 500000
<>([<><>][<<>()><<()>>])(())<[]><>(<>){}(())[]()<{[]}>[({})[(<<((<>[])<[]>)([[]])>()((<>{[]()()<()>})()()<<>><(()<>)><{<{<>{}}[]>}{}[]>())<>>{<>[(())(())]<>()}{<>})]][()[]{{{}()<>}}{<>}]{}{<>({}<[()]>)[]}[{}]{{<>}}{[[{{}}()]{()()[{<[]>}{{{}[<>]}}<{}><<>>()()[(<><>[])]]()[]}][({}<{}>)...

output:

4

result:

ok 1 number(s): "4"

Test #68:

score: 0
Accepted
time: 100ms
memory: 45020kb

input:

1
500000 500000
(<>()){}[]()<[[]]<<[]>>>[]{<>}({(){()[<{(<[([[]<>])]<>>[[[]{{{}}}]])}<[]>>]{[()<>]([{[(<<>>)]{}}{[]({})}{()}])}}})(<>)<>{[[]][]{}}<<<>{}>>(<>{})(<<(){}<><>>>)<>[]{}{}(()){{}[][[][()]<>]()}[{}(<>)][[][]]{}<()()[{()}][()](())<>>{<>}<()><><>([]{})<>[]<>[[(())<[]<({})>>][[]<()[]{}<>><{}>...

output:

7

result:

ok 1 number(s): "7"

Test #69:

score: 0
Accepted
time: 106ms
memory: 45076kb

input:

1
500000 500000
(<>){}(){}<<>([])>[]<<[]<<>>>>(){<([]())({<<>(){}<{}[()([{}]({}<>([][]){()})<{}{}[]>)]>[]>}{})>[[{}[<>[]][{}][]]]}{<>}{}<[]>{{}({})}{{<><>[[<>]](<[]>)()}}()<{()(){{}({})}}>()(()<>[])[]{}()<>{[]([[[{()(((([()]<([()]){([][]<({}[{}])><[<>{[()]}<<>>[<>]{}]>()){}{<>}}>))))}()<>]<>][()(){[...

output:

5

result:

ok 1 number(s): "5"

Test #70:

score: 0
Accepted
time: 99ms
memory: 45164kb

input:

1
500000 500000
[{<<>{()}{}>}](){}<[]>[{[<>]({<>}){}<>}]<({<>}{})>[<()>(<>{[<<[]([{}][[[]()()]])>>{}()]}[])()({}[{}]<><()><(<>[{}<>()]){}>{}(<<>>[[]<>{()}{}]{[]}))<<[<[()[]][[{<<<{(()(())<{[]<<{({(<{{[]{{}({})}<{{()[]()}}>[]()}}{}>)}<[({{}})][]{}{}>{})<{[{}(<([[]{}])><{}>)<>]}>[{()}]}>><>{<(){}>()[<...

output:

2

result:

ok 1 number(s): "2"

Test #71:

score: 0
Accepted
time: 91ms
memory: 45104kb

input:

1
500000 500000
()[<(<[[]]><>{<()[][]>[]}<(({}[])[[[]]][(<>{})])[[]]<>{[]}>)>][][][][(((<[]>)))][()]<>[[()]{{[<>][[[]](<{[]}{}{}><[]>){[(<{}(()<[{}]()<><<>><<>{[]<([])>}>{<[{}]><>}[(([[({}[][]{}{[<>]((({{}})))<>})[]]][<<()><>(())>]({}{})))<(<>())[{}]()[[]{{{<<(())({}()())<{{<<{{}[()]((((({})[](<()()...

output:

1

result:

ok 1 number(s): "1"

Test #72:

score: 0
Accepted
time: 90ms
memory: 45040kb

input:

1
500000 500000
<>{<{{<{}{}()<{([]{<>})}>[(<><>)]>(){}[][]}}<>>{}<>}<[{{<>}}{<[<><>[[]]]{[<{}[[<>{}][([])]<>]>][[]]}>}(()){}]><[]>[(<(<><>)>[[]])[]()]{}({}[[[]({[<>]}{{}<>})<<>>]])<>([](({<>({})}))([[]][]))[[{[<{}>]<()[[][][]]()<<><>>>[]<>}]()]<()()[]>[]<>[{({}{})<>}]<{}({})>{}<[]{}[<><>()[]][]>(())...

output:

3

result:

ok 1 number(s): "3"

Test #73:

score: 0
Accepted
time: 163ms
memory: 56704kb

input:

1
500000 500000
[][]{{[]}[{{()}(<{({<><>}[])[]{[<>]}}[[<{(<<{[]}{[]()}>{{[(<>)<[]>]{}[{}({{{}}}<(()[]<{}>){<<[]>[{({}){}}<()()>{}<>[]]>}([{()<[<>]>[]}]){}{}>())(<>)]}}{<<>>([]{{({}<{}>)[]}}<{}<>()[<()()>{}<[][{<[]{}{[]()()<<{[()<<<>{{[[(<()<{[<{}[]<{<{()}[]<<([[]][]()<>)>{<>{}}><>[()]{{}}>}>>[]<>]{[...

output:

42

result:

ok 1 number(s): "42"

Test #74:

score: 0
Accepted
time: 162ms
memory: 56744kb

input:

1
500000 500000
<(<({{}()}[]{})>()()<<[]><>(<>){{}}()()>())><<{{{}}}{}>><><[[[]][{{<>[]}{}[{[]}]<[][{[]<>({}[<(<>[])>{{{()}<[]>[]{}}([()[<(<()({}(([])[{<<[]{[]}>{{<>[(){([]{()})}][<>]}}>()}]{}))()>[[][]])>[][]{()}]{}[](){()}[[]](){}[[([])]<{}>]]<()>[]<>){}}])({<[[]<(){}<{}[][]>{}>[([<>]<<>{<><()<<{(...

output:

157

result:

ok 1 number(s): "157"

Test #75:

score: 0
Accepted
time: 162ms
memory: 56628kb

input:

1
500000 500000
()()<>{}<>{}<>(){(<>)<>()}<{()((<{}([<((){}{<>(<><><()(())()[]><>)}<>()[(){}{}]()){}({})><<[]>>][]<><{<(<({})[]>)>[(<>){<>{(())[([<(){}()>[]]{}<[((){[()]()}{{[]}})]()()>([{<[{()}]{[]}()><>{}}][]{({{<[]>[[]<>[{[]<>}{}][]]{{}[]}<[[]([])]><>}{[][<>][{{<()>}}<>](()())<>}[{}]}{([]())})({[...

output:

164

result:

ok 1 number(s): "164"

Test #76:

score: 0
Accepted
time: 173ms
memory: 56564kb

input:

1
500000 500000
([]<>){}<[]>{}[[([]{})({[]()}<>)<[][]{{[<><([]<><[]{}>[{{({})}}])[[()[]]]([{[([])<>{}]}(<<>([]<>)>[]((())[()<[<>[]]<(<>{})<>[()<>]>>](())[()]({({})[[][][]][[[]]<>[[<>{}<>[]<>]]][]()([{}()[]]){<>{{}{}({})<>}}[](){{()}}{[]}}(<>){}{{}}((){}<<>()>)<>))<>)]<>)>[[<>][]([])()([<<>[<>]>]){}[...

output:

46

result:

ok 1 number(s): "46"

Test #77:

score: 0
Accepted
time: 158ms
memory: 56772kb

input:

1
500000 500000
{<((<(<>{}[][[]]<>({(())}{}<><<>>){}<<<>>>){{([<>][])}}{{(())()([])}<<>><[[({})<>]]>}<<>[]{}[()]{}{<{[]}([])>}{<>}<{}<({[<<>({})(<<>>()<>)>]{}}{}{}[{{}()<{}>}()[]{(<>)[]}])>>([<>[][]]())()[[]](<>)((<>)())<>>{(<>)()}>{{({(<>)}){<{<>([(())]({[]})<>)}((<>))>{}}{[(){}[]{<>[][]}]()}<[[<>]...

output:

160

result:

ok 1 number(s): "160"

Test #78:

score: 0
Accepted
time: 79ms
memory: 44976kb

input:

1
500000 500000
<>{<{{}<()[]()[][]><>}>}{[]}(){[]}()([()({})])([]<{}{}>)<>()(){[]()<>()<>}<<>>{}({(<><(<>)>)<{}[]>})((){[]()}){}<{{[()]}<[(<>)]>}([{{}<<{(<{()<>}><<>[](<()<><[][(){}<>]<()><[]()[<([()])<>>()[]<<>>{}<>[]<<><()>><()<>[(<([])(()[])>)]>]>()<{}><{(){}([]<()>)[]}<[]()<>>[]([]{<{}>}[])>>>)(...

output:

3

result:

ok 1 number(s): "3"

Test #79:

score: 0
Accepted
time: 96ms
memory: 45228kb

input:

1
500000 500000
{()}<<<[<>[]<>]{([<{}>])}>>>{<>}[](<>{(<()>)[([{{}}<>]()[[][<>]]){}<>][{}{}()[{}[<>]][(){(<>{})}][]]}[<>{[[<>]{[]<[({[]})]<><{<()<{}>>}[]>>}]}][])<>()()()[]{()()}[](){[]()[{(){}}]<(()(){{}})>}(([([]<><(()()<[]>{<{{}}>}()<<()>>)>)]<<<>><<({()})(<{}<>>[]<<>><{{(<>)}}>){}>>>()<<>[{<>([<...

output:

6

result:

ok 1 number(s): "6"

Test #80:

score: 0
Accepted
time: 84ms
memory: 45232kb

input:

1
500000 500000
<>(())()[<>{{}}<>(())[(([])<<>>()[]){(<>)<[]([])>}]{()<{}>[]()<[<>]>}{}]()({}[](())<[<>](){[[<>]][[[]<><({{}(){<()>}[()(<[()<([[(([]([][]<>)){})([]<<>[][{}]{}>(<><>))][()[{(<{}>)<>}]]{<[]>}{{}[]}<><{(([])[[(<>())<>(<[[]<>{{()[[](<[][<([[<>()([({<{}>([{<()><>}<><>{}<<(<{}(({{{}<>}{}}<...

output:

5

result:

ok 1 number(s): "5"

Test #81:

score: 0
Accepted
time: 109ms
memory: 45096kb

input:

1
500000 500000
<{()}><[][[]]>[]{}([]){}{}(){()(){()<>()(([[]{{[]{[]{}()}}}{<[{}][<[[]{[]<[]>}]{{{}<[<>[]]()><{}[{}[[]](<>[({})<<>>{{}()<>}])[][()[]{([[]])}]{}][<[]>]>{}<({}[(<[][<<()><>{<>{([]){[]{({[]}[]<((())){}>[{}])<>[<>[<[]()({}<>)(<>()((){}))()[]>{}]]}}}}[][]>]>)])>}}>]<>>[<[]><>[<>]<{<>}[[<[...

output:

6

result:

ok 1 number(s): "6"

Test #82:

score: 0
Accepted
time: 104ms
memory: 45188kb

input:

1
500000 500000
{[]}[]<>[]{[{[]}[<>(){}[<[[]({(<(({<><>{}}(((([][(){()}])())())){}))>)}[])]>{}<>[<>{}]]]]}[]((){}){[<>(<{}(<([<>(({<[[[]{}]]>}))][][])>)[(<>{(<>{})<[<>]>}[[()<([]())>()]()])<<>[<[[][]]>[]]>]>()(((<><(()){}<<>>[]>)<>{{<><>}}{<()[]()>([((()[{{}[()]}<>]))()<[{}]<{{}}>{}([[]()()])>][]<<>...

output:

4

result:

ok 1 number(s): "4"

Test #83:

score: 0
Accepted
time: 159ms
memory: 56596kb

input:

1
500000 500000
<[()[]()[{}]{}]>()[{}{[[(){{}}]]<><>[]}]{<>{{}{<({<([])>}{(){{[]}}{<>(())}})>}}<()>{}}<>{<()>}<>{{()<>}{{()[][({<[<{{}<>{()<(<<>{{<{}>}}>{{{}}}<>)>{[]<>}{}}}>{}{<>[](<[]>())}]<>>[()()]})]}<{({})(<><>)}>}{(([]{}))}{}()}()()(<<>[]>{{}})([(([<[]<[]>{}<>[]><>]))[]])[]<>{}<>(<<<<<{}<>[]>>...

output:

120

result:

ok 1 number(s): "120"

Test #84:

score: 0
Accepted
time: 96ms
memory: 45060kb

input:

1
500000 500000
(){[]}<>[<<>()>][[()]{<<>[{[[][<<>>](<([[]{{}}((()<<({{}({}{{[]({}([])<(){}[{}]<{{{}}}>>)}})}<<>>)[()<{{}()[]}(<[<{[][][<[[<>]<>]>[<>]([<[]>[{}<>][(()[[]<(((([])[][[]()])))(<>)>])]])[]]}>]>{})>({}[()])()]<>{}>>{}<[]>()))(){}{<>()}])>[()]([]<<[]<()({()})>><>{}{}()(<>{{}})>[]{{}}{<<>>[...

output:

3

result:

ok 1 number(s): "3"

Extra Test:

score: 0
Extra Test Passed