func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 450007;   int read() {     int ans = 0, f = 1, c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       ans = ans * 10 + (c -  0 );       c = getchar();     }     return ans * f;   }   int n, k, sum1, sum2;   int x[M], y[M], f[M];   int main() {     n = read();     for (int i = 1; i <= n; i++) {       k = read();       if (k) x[sum1++] = k;     }     for (int i = 1; i <= n; i++) {       k = read();       if (k) y[sum2++] = k;     }     int now = sum1 - 1;     for (int i = 0; i < now; i++) x[sum1++] = x[i];     for (int i = 1; i < sum2; i++) {       int j = f[i];       while (j && y[i] != y[j]) j = f[j];       f[i + 1] = (y[i] == y[j]) ? f[j] + 1 : 0;     }     int j = 0;     for (int i = 0; i < sum1; i++) {       while (j && x[i] != y[j]) j = f[j];       if (x[i] == y[j]) j++;       if (j == sum2) break;     }     if (j == sum2)       printf( YES n );     else       printf( NO n );     return 0;   }   