fork download
  1. int i=0;
  2. for(int j=0; j<voter_count; j++){
  3. for(int k=0;k<candidate_count;k++){
  4. if(preferences[j][i]==k){
  5. candidates[k].votes++;
  6. printf("votes :%i",candidates[k].votes);
  7. break;
  8. }
  9.  
  10. }
  11. }
  12. i++;
  13. return;/* package whatever; // don't place package name! */
  14. /*
  15.  
  16.   This source code accompanies the article, "Using The Golay Error Detection And
  17.   Correction Code", by Hank Wallace. This program demonstrates use of the Golay
  18.   code.
  19.   Usage: G DATA Encode/Correct/Verify/Test
  20.   where DATA is the data to be encoded, codeword to be corrected,
  21.   or codeword to be checked for errors. DATA is hexadecimal.
  22.   Examples:
  23.   G 555 E encodes information value 555 and prints a codeword
  24.   G ABC123 C corrects codeword ABC123
  25.   G ABC123 V checks codeword ABC123 for errors
  26.   G ABC123 T tests routines, ABC123 is a dummy parameter
  27.   This program may be freely incorporated into your programs as needed. It
  28.   compiles under Borland's Turbo C 2.0. No warranty of any kind is granted.
  29.   */
  30. #include "stdio.h"
  31. #include "conio.h"
  32. #define POLY 0xAE3 /* or use the other polynomial, 0xC75 */
  33.  
  34. /* ====================================================== */
  35.  
  36. unsigned long golay(unsigned long cw)
  37. /* This function calculates [23,12] Golay codewords.
  38.   The format of the returned longint is
  39.   [checkbits(11),data(12)]. */
  40. {
  41. int i;
  42. unsigned long c;
  43. cw&=0xfffl;
  44. c=cw; /* save original codeword */
  45. for (i=1; i<=12; i++) /* examine each data bit */
  46. {
  47. if (cw & 1) /* test data bit */
  48. cw^=POLY; /* XOR polynomial */
  49. cw>>=1; /* shift intermediate result */
  50. }
  51. return((cw<<12)|c); /* assemble codeword */
  52. }
  53.  
  54. /* ====================================================== */
  55.  
  56. int parity(unsigned long cw)
  57. /* This function checks the overall parity of codeword cw.
  58.   If parity is even, 0 is returned, else 1. */
  59. {
  60. unsigned char p;
  61.  
  62. /* XOR the bytes of the codeword */
  63. p=*(unsigned char*)&cw;
  64. p^=*((unsigned char*)&cw+1);
  65. p^=*((unsigned char*)&cw+2);
  66.  
  67. /* XOR the halves of the intermediate result */
  68. p=p ^ (p>>4);
  69. p=p ^ (p>>2);
  70. p=p ^ (p>>1);
  71.  
  72. /* return the parity result */
  73. return(p & 1);
  74. }
  75.  
  76. /* ====================================================== */
  77.  
  78. unsigned long syndrome(unsigned long cw)
  79. /* This function calculates and returns the syndrome
  80.   of a [23,12] Golay codeword. */
  81. {
  82. int i;
  83. cw&=0x7fffffl;
  84. for (i=1; i<=12; i++) /* examine each data bit */
  85. {
  86. if (cw & 1) /* test data bit */
  87. cw^=POLY; /* XOR polynomial */
  88. cw>>=1; /* shift intermediate result */
  89. }
  90. return(cw<<12); /* value pairs with upper bits of cw */
  91. }
  92.  
  93. /* ====================================================== */
  94.  
  95. int weight(unsigned long cw)
  96. /* This function calculates the weight of
  97.   23 bit codeword cw. */
  98. {
  99. int bits,k;
  100.  
  101. /* nibble weight table */
  102. const char wgt[16] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
  103.  
  104. bits=0; /* bit counter */
  105. k=0;
  106. /* do all bits, six nibbles max */
  107. while ((k<6) && (cw))
  108. {
  109. bits=bits+wgt[cw & 0xf];
  110. cw>>=4;
  111. k++;
  112. }
  113.  
  114. return(bits);
  115. }
  116.  
  117. /* ====================================================== */
  118.  
  119. unsigned long rotate_left(unsigned long cw, int n)
  120. /* This function rotates 23 bit codeword cw left by n bits. */
  121. {
  122. int i;
  123.  
  124. if (n != 0)
  125. {
  126. for (i=1; i<=n; i++)
  127. {
  128. if ((cw & 0x400000l) != 0)
  129. cw=(cw << 1) | 1;
  130. else
  131. cw<<=1;
  132. }
  133. }
  134.  
  135. return(cw & 0x7fffffl);
  136. }
  137.  
  138. /* ====================================================== */
  139.  
  140. unsigned long rotate_right(unsigned long cw, int n)
  141. /* This function rotates 23 bit codeword cw right by n bits. */
  142. {
  143. int i;
  144.  
  145. if (n != 0)
  146. {
  147. for (i=1; i<=n; i++)
  148. {
  149. if ((cw & 1) != 0)
  150. cw=(cw >> 1) | 0x400000l;
  151. else
  152. cw>>=1;
  153. }
  154. }
  155.  
  156. return(cw & 0x7fffffl);
  157. }
  158.  
  159. /* ====================================================== */
  160.  
  161. unsigned long correct(unsigned long cw, int *errs)
  162. /* This function corrects Golay [23,12] codeword cw, returning the
  163.   corrected codeword. This function will produce the corrected codeword
  164.   for three or fewer errors. It will produce some other valid Golay
  165.   codeword for four or more errors, possibly not the intended
  166.   one. *errs is set to the number of bit errors corrected. */
  167. {
  168. unsigned char
  169. w; /* current syndrome limit weight, 2 or 3 */
  170. unsigned long
  171. mask; /* mask for bit flipping */
  172. int
  173. i,j; /* index */
  174. unsigned long
  175. s, /* calculated syndrome */
  176. cwsaver; /* saves initial value of cw */
  177.  
  178. cwsaver=cw; /* save */
  179. *errs=0;
  180. w=3; /* initial syndrome weight threshold */
  181. j=-1; /* -1 = no trial bit flipping on first pass */
  182. mask=1;
  183. while (j<23) /* flip each trial bit */
  184. {
  185. if (j != -1) /* toggle a trial bit */
  186. {
  187. if (j>0) /* restore last trial bit */
  188. {
  189. cw=cwsaver ^ mask;
  190. mask+=mask; /* point to next bit */
  191. }
  192. cw=cwsaver ^ mask; /* flip next trial bit */
  193. w=2; /* lower the threshold while bit diddling */
  194. }
  195.  
  196. s=syndrome(cw); /* look for errors */
  197. if (s) /* errors exist */
  198. {
  199. for (i=0; i<23; i++) /* check syndrome of each cyclic shift */
  200. {
  201. if ((*errs=weight(s)) <= w) /* syndrome matches error pattern */
  202. {
  203. cw=cw ^ s; /* remove errors */
  204. cw=rotate_right(cw,i); /* unrotate data */
  205. return(s=cw);
  206. }
  207. else
  208. {
  209. cw=rotate_left(cw,1); /* rotate to next pattern */
  210. s=syndrome(cw); /* calc new syndrome */
  211. }
  212. }
  213. j++; /* toggle next trial bit */
  214. }
  215. else
  216. return(cw); /* return corrected codeword */
  217. }
  218.  
  219. return(cwsaver); /* return original if no corrections */
  220. } /* correct */
  221.  
  222. /* ====================================================== */
  223.  
  224. int decode(int correct_mode, int *errs, unsigned long *cw)
  225. /* This function decodes codeword *cw in one of two modes. If correct_mode
  226.   is nonzero, error correction is attempted, with *errs set to the number of
  227.   bits corrected, and returning 0 if no errors exist, or 1 if parity errors
  228.   exist. If correct_mode is zero, error detection is performed on *cw,
  229.   returning 0 if no errors exist, 1 if an overall parity error exists, and
  230.   2 if a codeword error exists. */
  231. {
  232. unsigned long parity_bit;
  233.  
  234. if (correct_mode) /* correct errors */
  235. {
  236. parity_bit=*cw & 0x800000l; /* save parity bit */
  237. *cw&=~0x800000l; /* remove parity bit for correction */
  238.  
  239. *cw=correct(*cw, errs); /* correct up to three bits */
  240. *cw|=parity_bit; /* restore parity bit */
  241.  
  242. /* check for 4 bit errors */
  243. if (parity(*cw)) /* odd parity is an error */
  244. return(1);
  245. return(0); /* no errors */
  246. }
  247. else /* detect errors only */
  248. {
  249. *errs=0;
  250. if (parity(*cw)) /* odd parity is an error */
  251. {
  252. *errs=1;
  253. return(1);
  254. }
  255. if (syndrome(*cw))
  256. {
  257. *errs=1;
  258. return(2);
  259. }
  260. else
  261. return(0); /* no errors */
  262. }
  263. } /* decode */
  264.  
  265. /* ====================================================== */
  266.  
  267. void golay_test(void)
  268. /* This function tests the Golay routines for detection and correction
  269.   of various patterns of error_limit bit errors. The error_mask cycles
  270.   over all possible values, and error_limit selects the maximum number
  271.   of induced errors. */
  272. {
  273. unsigned long
  274. error_mask, /* bitwise mask for inducing errors */
  275. trashed_codeword, /* the codeword for trial correction */
  276. virgin_codeword; /* the original codeword without errors */
  277. unsigned char
  278. pass=1, /* assume test passes */
  279. error_limit=3; /* select number of induced bit errors here */
  280. int
  281. error_count; /* receives number of errors corrected */
  282.  
  283. virgin_codeword=golay(0x555); /* make a test codeword */
  284. if (parity(virgin_codeword))
  285. virgin_codeword^=0x800000l;
  286. for (error_mask=0; error_mask<0x800000l; error_mask++)
  287. {
  288. /* filter the mask for the selected number of bit errors */
  289. if (weight(error_mask) <= error_limit) /* you can make this faster! */
  290. {
  291. trashed_codeword=virgin_codeword ^ error_mask; /* induce bit errors */
  292.  
  293. decode(1,&error_count,&trashed_codeword); /* try to correct bit errors */
  294.  
  295. if (trashed_codeword ^ virgin_codeword)
  296. {
  297. printf("Unable to correct %d errors induced with error mask = 0x%lX\n",
  298. weight(error_mask),error_mask);
  299. pass=0;
  300. }
  301.  
  302. if (kbhit()) /* look for user input */
  303. {
  304. if (getch() == 27) return; /* escape exits */
  305.  
  306. /* other key prints status */
  307. printf("Current test count = %ld of %ld\n",error_mask,0x800000l);
  308. }
  309. }
  310. }
  311. printf("Golay test %s!\n",pass?"PASSED":"FAILED");
  312. }
  313.  
  314. /* ====================================================== */
  315.  
  316. void main(int argument_count, char *argument[])
  317. {
  318. int i,j;
  319. unsigned long l,g;
  320. const char *errmsg = "Usage: G DATA Encode/Correct/Verify/Test\n\n"
  321. " where DATA is the data to be encoded, codeword to be corrected,\n"
  322. " or codeword to be checked for errors. DATA is hexadecimal.\n\n"
  323. "Examples:\n\n"
  324. " G 555 E encodes information value 555 and prints a codeword\n"
  325. " G ABC123 C corrects codeword ABC123\n"
  326. " G ABC123 V checks codeword ABC123 for errors\n"
  327. " G ABC123 T tests routines, ABC123 is a dummy parameter\n\n";
  328.  
  329. if (argument_count != 3)
  330. {
  331. printf(errmsg);
  332. exit(0);
  333. }
  334.  
  335. if (sscanf(argument[1],"%lx",&l) != 1)
  336. {
  337. printf(errmsg);
  338. exit(0);
  339. }
  340.  
  341. switch (toupper(*argument[2]))
  342. {
  343. case 'E': /* encode */
  344. l&=0xfff;
  345. l=golay(l);
  346. if (parity(l)) l^=0x800000l;
  347. printf("Codeword = %lX\n",l);
  348. break;
  349.  
  350. case 'V': /* verify */
  351. if (decode(0,&i,&l))
  352. printf("Codeword %lX is not a Golay codeword.\n",l);
  353. else
  354. printf("Codeword %lX is a Golay codeword.\n",l);
  355. break;
  356.  
  357. case 'C': /* correct */
  358. g=l; /* save initial codeword */
  359. j=decode(1,&i,&l);
  360. if ((j) && (i))
  361. printf("Codeword %lX had %d bits corrected,\n"
  362. "resulting in codeword %lX with a parity error.\n",g,i,l);
  363. else
  364. if ((j == 0) && (i))
  365. printf("Codeword %lX had %d bits corrected, resulting in codeword %lX.\n",g,i,l);
  366. else
  367. if ((j) && (i == 0))
  368. printf("Codeword %lX has a parity error. No bits were corrected.\n",g);
  369. else
  370. if ((j == 0) && (i == 0))
  371. printf("Codeword %lX does not require correction.\n",g);
  372. break;
  373.  
  374. case 'T': /* test */
  375. printf("Press SPACE for status, ESC to exit test...\n");
  376. golay_test();
  377. break;
  378.  
  379. default:
  380. printf(errmsg);
  381. exit(0);
  382. }
  383. }
  384.  
  385. /* end of G.C */
  386.  
  387.  
  388. import java.util.*;
  389. import java.lang.*;
  390. import java.io.*;
  391.  
  392. /* Name of the class has to be "Main" only if the class is public. */
  393. class Ideone
  394. {
  395. public static void main (String[] args) throws java.lang.Exception
  396. {
  397. // your code goes here
  398. }
  399. }
Success #stdin #stdout 0.02s 25936KB
stdin
Standard input is empty
stdout
int i=0;
        for(int j=0; j<voter_count; j++){
            for(int k=0;k<candidate_count;k++){
                if(preferences[j][i]==k){
                    candidates[k].votes++;
                    printf("votes :%i",candidates[k].votes);
                    break;
                }

            }
        }
        i++;
        return;/* package whatever; // don't place package name! */
/*
    
    This source code accompanies the article, "Using The Golay Error Detection And
    Correction Code", by Hank Wallace. This program demonstrates use of the Golay
    code.
      Usage: G DATA Encode/Correct/Verify/Test
        where DATA is the data to be encoded, codeword to be corrected,
        or codeword to be checked for errors. DATA is hexadecimal.
      Examples:
        G 555 E      encodes information value 555 and prints a codeword
        G ABC123 C   corrects codeword ABC123
        G ABC123 V   checks codeword ABC123 for errors
        G ABC123 T   tests routines, ABC123 is a dummy parameter
    This program may be freely incorporated into your programs as needed. It
    compiles under Borland's Turbo C 2.0. No warranty of any kind is granted.
    */
    #include "stdio.h"
    #include "conio.h"
    #define POLY  0xAE3  /* or use the other polynomial, 0xC75 */
    
    /* ====================================================== */
    
    unsigned long golay(unsigned long cw)
    /* This function calculates [23,12] Golay codewords.
      The format of the returned longint is
      [checkbits(11),data(12)]. */
    {
      int i;
      unsigned long c;
      cw&=0xfffl;
      c=cw; /* save original codeword */
      for (i=1; i<=12; i++)  /* examine each data bit */
        {
          if (cw & 1)        /* test data bit */
            cw^=POLY;        /* XOR polynomial */
          cw>>=1;            /* shift intermediate result */
        }
      return((cw<<12)|c);    /* assemble codeword */
    }
    
    /* ====================================================== */
    
    int parity(unsigned long cw)
    /* This function checks the overall parity of codeword cw.
      If parity is even, 0 is returned, else 1. */
    {
      unsigned char p;
    
      /* XOR the bytes of the codeword */
      p=*(unsigned char*)&cw;
      p^=*((unsigned char*)&cw+1);
      p^=*((unsigned char*)&cw+2);
    
      /* XOR the halves of the intermediate result */
      p=p ^ (p>>4);
      p=p ^ (p>>2);
      p=p ^ (p>>1);
    
      /* return the parity result */
      return(p & 1);
    }
    
    /* ====================================================== */
    
    unsigned long syndrome(unsigned long cw)
    /* This function calculates and returns the syndrome
      of a [23,12] Golay codeword. */
    {
      int i;
      cw&=0x7fffffl;
      for (i=1; i<=12; i++)  /* examine each data bit */
        {
          if (cw & 1)        /* test data bit */
            cw^=POLY;        /* XOR polynomial */
          cw>>=1;            /* shift intermediate result */
        }
      return(cw<<12);        /* value pairs with upper bits of cw */
    }
    
    /* ====================================================== */
    
    int weight(unsigned long cw)
    /* This function calculates the weight of
      23 bit codeword cw. */
    {
      int bits,k;
    
      /* nibble weight table */
      const char wgt[16] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
    
      bits=0; /* bit counter */
      k=0;
      /* do all bits, six nibbles max */
      while ((k<6) && (cw))
        {
          bits=bits+wgt[cw & 0xf];
          cw>>=4;
          k++;
        }
    
      return(bits);
    }
    
    /* ====================================================== */
    
    unsigned long rotate_left(unsigned long cw, int n)
    /* This function rotates 23 bit codeword cw left by n bits. */
    {
      int i;
    
      if (n != 0)
        {
          for (i=1; i<=n; i++)
            {
              if ((cw & 0x400000l) != 0)
                cw=(cw << 1) | 1;
              else
                cw<<=1;
            }
        }
    
      return(cw & 0x7fffffl);
    }
    
    /* ====================================================== */
    
    unsigned long rotate_right(unsigned long cw, int n)
    /* This function rotates 23 bit codeword cw right by n bits. */
    {
      int i;
    
      if (n != 0)
        {
          for (i=1; i<=n; i++)
            {
              if ((cw & 1) != 0)
                cw=(cw >> 1) | 0x400000l;
              else
                cw>>=1;
            }
        }
    
      return(cw & 0x7fffffl);
    }
    
    /* ====================================================== */
    
    unsigned long correct(unsigned long cw, int *errs)
    /* This function corrects Golay [23,12] codeword cw, returning the
      corrected codeword. This function will produce the corrected codeword
      for three or fewer errors. It will produce some other valid Golay
      codeword for four or more errors, possibly not the intended
      one. *errs is set to the number of bit errors corrected. */
    {
      unsigned char
        w;                /* current syndrome limit weight, 2 or 3 */
      unsigned long
        mask;             /* mask for bit flipping */
      int
        i,j;              /* index */
      unsigned long
        s,                /* calculated syndrome */
        cwsaver;          /* saves initial value of cw */
    
      cwsaver=cw;         /* save */
      *errs=0;
      w=3;                /* initial syndrome weight threshold */
      j=-1;               /* -1 = no trial bit flipping on first pass */
      mask=1;
      while (j<23) /* flip each trial bit */
        {
          if (j != -1) /* toggle a trial bit */
            {
              if (j>0) /* restore last trial bit */
                {
                  cw=cwsaver ^ mask;
                  mask+=mask; /* point to next bit */
                }
              cw=cwsaver ^ mask; /* flip next trial bit */
              w=2; /* lower the threshold while bit diddling */
            }
    
          s=syndrome(cw); /* look for errors */
          if (s) /* errors exist */
            {
              for (i=0; i<23; i++) /* check syndrome of each cyclic shift */
                {
                  if ((*errs=weight(s)) <= w) /* syndrome matches error pattern */
                    {
                      cw=cw ^ s;              /* remove errors */
                      cw=rotate_right(cw,i);  /* unrotate data */
                      return(s=cw);
                    }
                  else
                    {
                      cw=rotate_left(cw,1);   /* rotate to next pattern */
                      s=syndrome(cw);         /* calc new syndrome */
                    }
                }
              j++; /* toggle next trial bit */
            }
          else
            return(cw); /* return corrected codeword */
        }
    
      return(cwsaver); /* return original if no corrections */
    } /* correct */
    
    /* ====================================================== */
    
    int decode(int correct_mode, int *errs, unsigned long *cw)
    /* This function decodes codeword *cw in one of two modes. If correct_mode
      is nonzero, error correction is attempted, with *errs set to the number of
      bits corrected, and returning 0 if no errors exist, or 1 if parity errors
      exist. If correct_mode is zero, error detection is performed on *cw,
      returning 0 if no errors exist, 1 if an overall parity error exists, and
      2 if a codeword error exists. */
    {
      unsigned long parity_bit;
    
      if (correct_mode)               /* correct errors */
        {
          parity_bit=*cw & 0x800000l; /* save parity bit */
          *cw&=~0x800000l;            /* remove parity bit for correction */
    
          *cw=correct(*cw, errs);     /* correct up to three bits */
          *cw|=parity_bit;            /* restore parity bit */
    
          /* check for 4 bit errors */
          if (parity(*cw))            /* odd parity is an error */
            return(1);
          return(0); /* no errors */
        }
      else /* detect errors only */
        {
          *errs=0;
          if (parity(*cw)) /* odd parity is an error */
            {
              *errs=1;
              return(1);
            }
          if (syndrome(*cw))
            {
              *errs=1;
              return(2);
            }
          else
            return(0); /* no errors */
        }
    } /* decode */
    
    /* ====================================================== */
    
    void golay_test(void)
    /* This function tests the Golay routines for detection and correction
      of various patterns of error_limit bit errors. The error_mask cycles
      over all possible values, and error_limit selects the maximum number
      of induced errors. */
    {
      unsigned long
        error_mask,         /* bitwise mask for inducing errors */
        trashed_codeword,   /* the codeword for trial correction */
        virgin_codeword;    /* the original codeword without errors */
      unsigned char
        pass=1,             /* assume test passes */
        error_limit=3;      /* select number of induced bit errors here */
      int
        error_count;        /* receives number of errors corrected */
    
      virgin_codeword=golay(0x555); /* make a test codeword */
      if (parity(virgin_codeword))
        virgin_codeword^=0x800000l;
      for (error_mask=0; error_mask<0x800000l; error_mask++)
        {
          /* filter the mask for the selected number of bit errors */
          if (weight(error_mask) <= error_limit) /* you can make this faster! */
            {
              trashed_codeword=virgin_codeword ^ error_mask; /* induce bit errors */
    
              decode(1,&error_count,&trashed_codeword); /* try to correct bit errors */
    
              if (trashed_codeword ^ virgin_codeword)
                {
                  printf("Unable to correct %d errors induced with error mask = 0x%lX\n",
                    weight(error_mask),error_mask);
                  pass=0;
                }
    
              if (kbhit()) /* look for user input */
                {
                  if (getch() == 27) return; /* escape exits */
    
                  /* other key prints status */
                  printf("Current test count = %ld of %ld\n",error_mask,0x800000l);
                }
            }
        }
      printf("Golay test %s!\n",pass?"PASSED":"FAILED");
    }
    
    /* ====================================================== */
    
    void main(int argument_count, char *argument[])
    {
      int i,j;
      unsigned long l,g;
      const char *errmsg = "Usage: G DATA Encode/Correct/Verify/Test\n\n"
                 "  where DATA is the data to be encoded, codeword to be corrected,\n"
                 "  or codeword to be checked for errors. DATA is hexadecimal.\n\n"
                 "Examples:\n\n"
                 "  G 555 E      encodes information value 555 and prints a codeword\n"
                 "  G ABC123 C   corrects codeword ABC123\n"
                 "  G ABC123 V   checks codeword ABC123 for errors\n"
                 "  G ABC123 T   tests routines, ABC123 is a dummy parameter\n\n";
    
      if (argument_count != 3)
        {
          printf(errmsg);
          exit(0);
        }
    
      if (sscanf(argument[1],"%lx",&l) != 1)
        {
          printf(errmsg);
          exit(0);
        }
    
      switch (toupper(*argument[2]))
        {
          case 'E': /* encode */
            l&=0xfff;
            l=golay(l);
            if (parity(l)) l^=0x800000l;
            printf("Codeword = %lX\n",l);
            break;
    
          case 'V': /* verify */
            if (decode(0,&i,&l))
              printf("Codeword %lX is not a Golay codeword.\n",l);
            else
              printf("Codeword %lX is a Golay codeword.\n",l);
            break;
    
          case 'C': /* correct */
            g=l; /* save initial codeword */
            j=decode(1,&i,&l);
            if ((j) && (i))
              printf("Codeword %lX had %d bits corrected,\n"
                     "resulting in codeword %lX with a parity error.\n",g,i,l);
            else
              if ((j == 0) && (i))
                printf("Codeword %lX had %d bits corrected, resulting in codeword %lX.\n",g,i,l);
              else
                if ((j) && (i == 0))
                  printf("Codeword %lX has a parity error. No bits were corrected.\n",g);
                else
                  if ((j == 0) && (i == 0))
                    printf("Codeword %lX does not require correction.\n",g);
            break;
    
          case 'T': /* test */
            printf("Press SPACE for status, ESC to exit test...\n");
            golay_test();
            break;
    
          default:
            printf(errmsg);
            exit(0);
        }
    }
    
    /* end of G.C */


import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
	}
}