Language: C++

#include <stdio.h>
#include <string.h>

typedef enum
{
	CMD_INIT,
	CMD_ADD,
	CMD_DELETE,
	CMD_CHANGE,
	CMD_SEARCH
} COMMAND;

typedef enum
{
	NAME,
	NUMBER,
	BIRTHDAY,
	EMAIL,
	MEMO
} FIELD;

typedef struct
{
	int count;
	char str[20];
} RESULT;

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

extern void InitDB();
extern void Add(char* name, char* number, char* birthday, char* email, char* memo);
extern int Delete(FIELD field, char* str);
extern int Change(FIELD field, char* str, FIELD changefield, char* changestr);
extern RESULT Search(FIELD field, char* str, FIELD returnfield);

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

static int dummy[100];
static int Score, ScoreIdx;
static char name[20], number[20], birthday[20], email[20], memo[20];

static char lastname[10][5] = { "kim", "lee", "park", "choi", "jung", "kang", "cho", "oh", "jang", "lim" };
static int lastname_length[10] = { 3, 3, 4, 4, 4, 4, 3, 2, 4, 3 };

static int mSeed;
static int mrand(int num)
{
	mSeed = mSeed * 1103515245 + 37209;
	if (mSeed < 0) mSeed *= -1;
	return ((mSeed >> 8) % num);
}

static void make_field(int seed)
{
	int name_length, email_length, memo_length;
	int idx, num;

	mSeed = (unsigned int)seed;

	name_length = 6 + mrand(10);
	email_length = 10 + mrand(10);
	memo_length = 5 + mrand(10);

	num = mrand(10);
	for (idx = 0; idx < lastname_length[num]; idx++) name[idx] = lastname[num][idx];
	for (; idx < name_length; idx++) name[idx] = 'a' + mrand(26);
	name[idx] = 0;

	for (idx = 0; idx < memo_length; idx++) memo[idx] = 'a' + mrand(26);
	memo[idx] = 0;

	for (idx = 0; idx < email_length - 6; idx++) email[idx] = 'a' + mrand(26);
	email[idx++] = '@';
	email[idx++] = 'a' + mrand(26);
	email[idx++] = '.';
	email[idx++] = 'c';
	email[idx++] = 'o';
	email[idx++] = 'm';
	email[idx] = 0;

	idx = 0;
	number[idx++] = '0';
	number[idx++] = '1';
	number[idx++] = '0';
	for (; idx < 11; idx++) number[idx] = '0' + mrand(10);
	number[idx] = 0;

	idx = 0;
	birthday[idx++] = '1';
	birthday[idx++] = '9';
	num = mrand(100);
	birthday[idx++] = '0' + num / 10;
	birthday[idx++] = '0' + num % 10;
	num = 1 + mrand(12);
	birthday[idx++] = '0' + num / 10;
	birthday[idx++] = '0' + num % 10;
	num = 1 + mrand(30);
	birthday[idx++] = '0' + num / 10;
	birthday[idx++] = '0' + num % 10;
	birthday[idx] = 0;
}

static void cmd_init()
{
	scanf("%d", &ScoreIdx);

	InitDB();
}

static void cmd_add()
{
	int seed;
	scanf("%d", &seed);

	make_field(seed);

	Add(name, number, birthday, email, memo);
}

static void cmd_delete()
{
	int field, check, result;
	char str[20];
	scanf("%d %s %d", &field, str, &check);

	result = Delete((FIELD)field, str);
	if (result != check)
		Score -= ScoreIdx;
}

static void cmd_change()
{
	int field, changefield, check, result;
	char str[20], changestr[20];
	scanf("%d %s %d %s %d", &field, str, &changefield, changestr, &check);

	result = Change((FIELD)field, str, (FIELD)changefield, changestr);
	if (result != check)
		Score -= ScoreIdx;
}

static void cmd_search()
{
	int field, returnfield, check;
	char str[20], checkstr[20];
	scanf("%d %s %d %s %d", &field, str, &returnfield, checkstr, &check);

	RESULT result = Search((FIELD)field, str, (FIELD)returnfield);

	if (result.count != check || (result.count == 1 && (strcmp(checkstr, result.str) != 0)))
		Score -= ScoreIdx;
}

static void run()
{
	int N;
	scanf("%d", &N);
	for (int i = 0; i < N; i++)
	{
		int cmd;
		scanf("%d", &cmd);
		switch (cmd)
		{
		case CMD_INIT:   cmd_init();   break;
		case CMD_ADD:    cmd_add();    break;
		case CMD_DELETE: cmd_delete(); break;
		case CMD_CHANGE: cmd_change(); break;
		case CMD_SEARCH: cmd_search(); break;
		default: break;
		}
	}
}

static void init()
{
	Score = 1000;
	ScoreIdx = 1;
}

int main()
{
	setbuf(stdout, NULL);
	//freopen("sample_input.txt", "r", stdin);

	int T;
	scanf("%d", &T);

	int TotalScore = 0;
	for (int tc = 1; tc <= T; tc++)
	{
		init();

		run();

		if (Score < 0)
			Score = 0;

		TotalScore += Score;
		printf("#%d %d\n", tc, Score);
	}
	printf("TotalScore = %d\n", TotalScore);

	return 0;
}


#include<iostream>

using namespace std;

int main(int argc, char** argv)
{
	int test_case;
	int T;
	/* 
	The freopen function below opens input.txt in read only mode and 
	sets your standard input to work with the opened file. 
	When you test your code with the sample data, you can use the function
	below to read in from the sample data file instead of the standard input.
	So. you can uncomment the following line for your local test. But you
	have to comment the following line when you submit for your scores.
	*/

	//freopen("input.txt", "r", stdin);
	cin>>T;

	/*
	   Read each test case from standard input.
	*/
	for(test_case = 1; test_case <= T; ++test_case)
	{

		/////////////////////////////////////////////////////////////////////////////////////////////
		/*
			Please, implement your algorithm from this section.
		*/
		/////////////////////////////////////////////////////////////////////////////////////////////


	}
	return 0;//Your program should return 0 on normal termination.
}


enum FIELD{ NAME, NUMBER, BDAY, EMAIL, MEMO, MAX_FIELD };

struct RESULT{
    int count;
    char str[20];
}res;


void InitDB(){
    
}

void Add(char* name, char* number, char* birthday, char* email, char* memo){
    
}

RESULT Search(FIELD field, char* str, FIELD returnfield){
    
    return res;
}

int Delete(FIELD field, char* str){
    int count = 0;
    
    return count;
}

int Change(FIELD field, char* str, FIELD changefield, char* changestr){
    int count = 0;
    
    return count;
}


Compiler output:
a.cc:213:5: error: conflicting declaration of C function 'int main(int, char**)'
  213 | int main(int argc, char** argv)
      |     ^~~~
a.cc:182:5: note: previous declaration 'int main()'
  182 | int main()
      |     ^~~~
a.cc:247:6: error: using typedef-name 'FIELD' after 'enum'
  247 | enum FIELD{ NAME, NUMBER, BDAY, EMAIL, MEMO, MAX_FIELD };
      |      ^~~~~
a.cc:20:3: note: 'FIELD' has a previous declaration here
   20 | } FIELD;
      |   ^~~~~
a.cc:247:13: error: 'NAME' conflicts with a previous declaration
  247 | enum FIELD{ NAME, NUMBER, BDAY, EMAIL, MEMO, MAX_FIELD };
      |             ^~~~
a.cc:15:9: note: previous declaration 'FIELD NAME'
   15 |         NAME,
      |         ^~~~
a.cc:247:19: error: 'NUMBER' conflicts with a previous declaration
  247 | enum FIELD{ NAME, NUMBER, BDAY, EMAIL, MEMO, MAX_FIELD };
      |                   ^~~~~~
a.cc:16:9: note: previous declaration 'FIELD NUMBER'
   16 |         NUMBER,
      |         ^~~~~~
a.cc:247:33: error: 'EMAIL' conflicts with a previous declaration
  247 | enum FIELD{ NAME, NUMBER, BDAY, EMAIL, MEMO, MAX_FIELD };
      |                                 ^~~~~
a.cc:18:9: note: previous declaration 'FIELD EMAIL'
   18 |         EMAIL,
      |         ^~~~~
a.cc:247:40: error: 'MEMO' conflicts with a previous declaration
  247 | enum FIELD{ NAME, NUMBER, BDAY, EMAIL, MEMO, MAX_FIELD };
      |                                        ^~~~
a.cc:19:9: note: previous declaration 'FIELD MEMO'
   19 |         MEMO
      |         ^~~~
a.cc:249:8: error: using typedef-name 'RESULT' after 'struct'
  249 | struct RESULT{
      |        ^~~~~~
a.cc:26:3: note: 'RESULT' has a previous declaration here
   26 | } RESULT;
      |   ^~~~~~
a.cc: In function 'RESULT Search(FIELD, char*, FIELD)':
a.cc:265:12: error: could not convert 'res' from 'int' to 'RESULT'
  265 |     return res;
      |            ^~~
      |            |
      |            int