#include #include #include #include using namespace std; vector>> v; string s1 = "UPD",s2 = "AND",s3 = "XOR"; int a[110]; void UPD(int i,int x){ a[i] = x; vector u(2); u[0] = i,u[1] = x; v.push_back({s1,u}); } void AND(int i,int j,int k){ a[i] = a[j]&a[k]; vector u(3); u[0] = i,u[1] = j,u[2] = k; v.push_back({s2,u}); } void XOR(int i,int j,int k){ a[i] = a[j]^a[k]; vector u(3); u[0] = i,u[1] = j,u[2] = k; v.push_back({s3,u}); } int main(){ int i,j,n,k; cin >> n >> k; /*int t; cin >> t; for(i=0;i> a[i];*/ for(i=1;i=0;j--){ UPD(n,0); AND(n,j,j + 1); XOR(n,j,n); XOR(n,j + 1,n); AND(j + 1,j,j + 1); UPD(j,0); XOR(j,j,n); } } UPD(n,0); XOR(n,n,k - 1); /*for(i=0;i<=n;i++) cout << a[i] << " "; cout << endl;*/ cout << v.size() << endl; for(auto x:v){ cout << x.first << " "; for(int y:x.second) cout << y << " "; cout << endl; } }