1. C, Evgeni Pavlidis
/**
* ACM programming Contest WS 08/09
* UVa Status: accepted
* Run Time: 0.170
* @author Evgeni Pavlidis evgenipavlidis@yahoo.de
*/
#include <stdio.h>
#include <string.h>

#define MAX 1024
#define g 34943

char text[MAX];


int main()
{
while(1)
{
gets(text);
if(text[0] == '#')
return 0;

unsigned int rest = 0;
int i,length = strlen(text);

for(i=0; i < length; i ++)
rest = ((rest << 8) + text[i]) % g;

int result = (g - (rest << 16)%g) % g;
int low = (unsigned char)result << 8;

printf("%02X %02X\n", result >> 8, low >> 8 );
}
}