Перевести код и С++ в Python
#include
#include
using namespace std;
int main()
{
int n, m;
int flag = 0;
cin >> n >> m;
char alphabet[26] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
vector saturday(n);
vector sunday(n);
for (int i = 0; i < n; i++)
{
cin >> saturday[i];
}
for (int i = 0; i < n; i++)
{
cin >> sunday[i];
}
for (int i = 0; i < 26; i++)
{
for (int j = 0; j < 26; j++)
{
int sum = 0;
int sat = 0;
int sun = 0;
char liter1 = alphabet[i];
char liter2 = alphabet[j];
for (int last = 0; last < n; last++)
{
if (saturday[last] == liter1)
{
sum++;
sat++;
}
if (sunday[last] == liter2)
{
sum++;
sun++;
}
if (sunday[last] == liter2 && saturday[last] == liter1)
{
sum--;
}
}
if (sum == m && sat > 0 && sun > 0)
{
flag++;
cout << liter1 << " " << liter2;
break;
}
}
if (flag == 1)
{
break;
}
}
if (flag == 0)
{
cout << "Impossible";
}
return 0;
}