This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include"Memory_lib.h"
int Memory(int N, int M){
    int roopCount = (M >> 15) % (1 << 7);
    int now = (M >> 8) % (1 << 7);
    int length = (M >> 1) % (1 << 7);
    int stack = (M >> 0) % (1 << 1);
    if(roopCount >= N || now >= N || length >= N) return 0;
    
    char c = Get(now+1);
    if(c == '<'){
        if(length == roopCount) stack = 0;
        length++;
    }
    if(c == '['){
        if(length == roopCount) stack = 1;
        length++;
    }
    if(c == '>'){
        length--;
        if(length == roopCount && stack != 0) return -2;
    }
    if(c == ']'){
        length--;
        if(length == roopCount && stack != 1) return -2;
    }
    now++;
    if(now == N){
        if(length != 0) return -2;
        roopCount++;
        now = 0;
        length = 0;
        stack = 0;
    }
    if(roopCount == N) return -1;
    return (roopCount<<15) | (now<<8) | (length<<1) | (stack<<0);
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |