#include <iostream>
int main() {
int *arr1, *arr2;
// Dynamically allocate an array of 10 integers
arr1 = new int[10];
// Initialize arr1 with some values
for (int i = 0; i < 10; ++i) {
arr1[i] = i + 1; // Assign values 1 through 10
}
// Dynamically allocate an array of 20 integers
arr2 = new int[20];
// Copy elements from arr1 to the first 10 elements of arr2
for (int i = 0; i < 10; ++i) {
arr2[i] = arr1[i];
}
// Initialize the remainder of arr2 to 0
for (int i = 10; i < 20; ++i) {
arr2[i] = 0;
}
// Display arr2 for verification
for (int i = 0; i < 20; ++i) {
std::cout << arr2[i] << " ";
}
std::cout << std::endl;
// Free dynamically allocated memory
delete[] arr1;
delete[] arr2;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKSB7CiAgICBpbnQgKmFycjEsICphcnIyOwoKICAgIC8vIER5bmFtaWNhbGx5IGFsbG9jYXRlIGFuIGFycmF5IG9mIDEwIGludGVnZXJzCiAgICBhcnIxID0gbmV3IGludFsxMF07CgogICAgLy8gSW5pdGlhbGl6ZSBhcnIxIHdpdGggc29tZSB2YWx1ZXMKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMTA7ICsraSkgewogICAgICAgIGFycjFbaV0gPSBpICsgMTsgLy8gQXNzaWduIHZhbHVlcyAxIHRocm91Z2ggMTAKICAgIH0KCiAgICAvLyBEeW5hbWljYWxseSBhbGxvY2F0ZSBhbiBhcnJheSBvZiAyMCBpbnRlZ2VycwogICAgYXJyMiA9IG5ldyBpbnRbMjBdOwoKICAgIC8vIENvcHkgZWxlbWVudHMgZnJvbSBhcnIxIHRvIHRoZSBmaXJzdCAxMCBlbGVtZW50cyBvZiBhcnIyCiAgICBmb3IgKGludCBpID0gMDsgaSA8IDEwOyArK2kpIHsKICAgICAgICBhcnIyW2ldID0gYXJyMVtpXTsKICAgIH0KCiAgICAvLyBJbml0aWFsaXplIHRoZSByZW1haW5kZXIgb2YgYXJyMiB0byAwCiAgICBmb3IgKGludCBpID0gMTA7IGkgPCAyM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