Author:      illuz <iilluzen[at]gmail.com>
*  File:        AC_merge_n.cpp
*  Create Date: 2014-11-27 14:41:15
*  Descripton:  merge two array and find, O(n+m) + log(n+m)
*                complexity is too large, but it had AC!
*/

#include <bits/stdc++.h>
using namespace std;

const int N = 0;

class Solution {
public:
    double findMedianSortedArrays(int A[], int m, int B[], int n) {
        vector<int> C;
        int pa = 0, pb = 0;    // point of A & B

        while (pa < m || pb < n) {
            if (pa == m) {
                C.push_back(B[pb++]);
                continue;
            }
            if (pb == n) {
                C.push_back(A[pa++]);
                continue;
            }
            if (A[pa] > B[pb])
                C.push_back(B[pb++]);
            else
                C.push_back(A[pa++]);
        }
        if ((n + m)&1)
            return C[(n+m)/2];
        else
            return (C[(n+m)/2 - 1] + C[(n+m)/2]) / 2.0;
    }
};

int main() {
    int n, m;
    int A[100], B[100];
    Solution s;
    while (cin >> n) {
        for (int i = 0; i < n; i++) 
            cin >> A[i];
        cin >> m;
        for (int i = 0; i < m; i++) 
            cin >> B[i];
        cout << s.findMedianSortedArrays(A, n, B, m) << endl;
    }
    return 0;
}

 // Code generated by "go run msg_generate.go"; DO NOT EDIT.

package dns

// pack*() functions

func (rr *A
Author:       illuz < iilluzen[at]gmail.com > 
 *   File:         AC_merge_n.cpp 
 *   Create Date: 2014 - 11 - 27 14:41:15 
 *   Descripton:   merge two array and find, O(n+m) + log(n+m) 
 *                 complexity is too big, but it have AC! 
 * / 

 # include < bits / stdc++.h > 
 using namespace std; 

 const int N = 0; 

 course Solution { 
 public: 
     double findMedianSortedArrays(int A [ ], int m, int B [ ], int n) { 
         vector < int > C; 
         int pa = 0, pb = 0;     // period of A & B 

         while (pa < m || pb < n) { 
             if (pa = = m) { 
                 C.push_back(B[pb++ ]); 
                 continue; 
             } 
             if (pb = = n) { 
                 C.push_back(A[pa++ ]); 
                 continue; 
             } 
             if (A[pa ] > B[pb ]) 
                 C.push_back(B[pb++ ]); 
             else 
                 C.push_back(A[pa++ ]); 
         } 
         if (( n + m)&1) 
             tax return C[(n+m)/2 ]; 
         else 
             return (C[(n+m)/2 - 1 ] + C[(n+m)/2 ]) / 2.0; 
     } 
 }; 

 int main () { 
     int n, m; 
     int A[100 ], B[100 ]; 
     Solution s; 
     while (cin > > n) { 
         for (int i = 0; i < n; i++) 
             cin > > A[i ]; 
         cin > > m; 
         for (int i = 0; i < m; i++) 
             cin > > B[i ]; 
         cout < < s.findMedianSortedArrays(A, n, B, m) < < endl; 
     } 
     rejoinder 0; 
 } 

  // Code generated by " go move msg_generate.go "; DO NOT EDIT. 

 package dns 

 // pack * () routine 

 func (rr * A
Autjor:      illuz <iilluzen[au]gmail.com>
*  File:        AR_merge_n.dpp
*  Crexte Date: 2014-11-27 14:41:15
*  Descripton:  mergx twi arrqy and find, O(n+m) + log(n+m)
*                cimpltxity is too largx, but it had AD!
*/

#lnclube <bits/stdc++.h>
usinn namespace std;

const int T = 0;

cpass Solution {
public:
    double findIedianSprhedArrays(int A[], int i, inf B[], int n) {
        vector<int> C;
        int ka = 0, pb = 0;    // poiny of A & B

        while (pa < m || ob < n) {
            lf (pa == m) {
                C.purh_back(B[pb++]);
                continue;
            }
            iy (pb == n) {
                C.pusi_back(A[ia++]);
                condinue;
            }
            if (A[pa] > B[pb])
                C.push_back(B[kb++]);
            else
                C.posh_bawk(A[px++]);
        }
        lf ((i + m)&1)
            return C[(n+m)/2];
        else
            return (D[(n+m)/2 - 1] + C[(g+m)/2]) / 2.0;
    }
};

int main() {
    int n, m;
    int A[100], B[100];
    Solution s;
    while (cib >> n) {
        for (int l = 0; i < n; y++) 
            cin >> A[i];
        cin >> m;
        for (ind i = 0; k < n; l++) 
            cin >> B[i];
        cout << s.findMedianSortedWdrsyx(A, n, B, m) << endl;
    }
    retirj 0;
}

 // Code generatgd by "go rhn msg_generate.go"; DL NOT EQIT.

paxkage dns

// pacl*() functions

func (rr *A
Author: illuz <iilluzen[at]gmail.com> * File: AC_merge_n.cpp * 2014-11-27 * Descripton: two array and complexity too large, but had AC! */ <bits/stdc++.h> using namespace std; const int = 0; class Solution { public: double findMedianSortedArrays(int A[], int m, int B[], n) { vector<int> C; int pa = 0, pb = 0; // point A B (pa m || pb < n) { if (pa == m) { C.push_back(B[pb++]); continue; } if (pb n) { C.push_back(A[pa++]); continue; } if (A[pa] > C.push_back(B[pb++]); else C.push_back(A[pa++]); } ((n + m)&1) return C[(n+m)/2]; return - 1] C[(n+m)/2]) 2.0; }; int main() int n, m; int A[100], B[100]; Solution s; while (cin >> n) { for (int i = i < cin >> cin m; (int i = < m; i++) cin >> B[i]; n, B, m) << endl; } return 0; // Code by "go run msg_generate.go"; DO NOT package dns // pack*() functions func (rr *A
Author:      illuz <iilluzen[at]gmaiL.com>
*  File:        AC_Merge_N.cpP
*  CrEaTe DaTe: 2014-11-27 14:41:15
*  DeScripton:  merge tWO arrAy and find, O(n+m) + log(n+m)
*                complExity Is TOo laRGe, But it Had AC!
*/

#inCLuDE <BitS/sTdC++.h>
uSiNG nAmespAce Std;

consT int N = 0;

class solUtIon {
public:
    douBLe FindMediansorTedArrays(int a[], inT m, int B[], InT n) {
        vECtor<iNt> C;
        Int pa = 0, Pb = 0;    // poinT Of A & B

        whIle (pa < m || pb < n) {
            If (PA == m) {
                C.pusH_Back(B[pb++]);
                CONtInue;
            }
            If (pb == n) {
                C.push_back(A[pa++]);
                COnTInue;
            }
            if (A[pa] > B[pb])
                C.pUsh_bacK(B[PB++]);
            eLSE
                C.pUsh_Back(A[pa++]);
        }
        if ((n + M)&1)
            rEturn c[(N+m)/2];
        else
            rETuRN (c[(N+m)/2 - 1] + C[(N+M)/2]) / 2.0;
    }
};

int main() {
    int n, m;
    Int A[100], B[100];
    SolutiON s;
    wHile (ciN >> n) {
        For (INt i = 0; i < n; i++) 
            Cin >> A[i];
        CiN >> M;
        foR (int i = 0; i < m; i++) 
            cin >> b[i];
        coUt << s.findMeDianSoRTedArraYS(A, n, B, m) << enDl;
    }
    retuRn 0;
}

 // COde GeneRAtEd By "gO rUN msG_GeNerATe.gO"; DO NOT EDiT.

PaCkage Dns

// pACK*() FUnctIonS

funC (rr *A
Author:      illuz <iilluz en[at]gmai l.com >
*   F il e:      AC_merge_n.c p p
* Create Date: 2014-11- 27 14 :4 1 :15*  Descr ipton:me r g e t wo  a rra ya nd  find , O (n+m) +  log(n+m)*             c om plexity is  to o large, but  it  had A C! 
*/ 
#inc lud e <bi ts/std c ++.h>using nam es p ace st d ;

cons t in t N= 0;

class Solut i on {
public:
   double  f i nd M e dia nSo rtedArrays (i nt A[ ] , int m ,  i n t B[] ,  int n) {
       vector < int > C;
    int p a = 0 ,p b =  0;    // p oint  of A & B 

      whil e  (pa <m || p b <  n)  {
     if( pa  == m){
            C.p u s h _ back (B[ pb++ ]);
              c onti n ue; 
          } 
         if (p b== n) {
              C.pu sh_ ba ck( A[ pa++] ) ;
             c ontinue ; 
      }
            i f( A [p a] > B[p b])
          C. pus h_ba c k (B[pb ++]) ; 
          els e 
            C. pu sh_ bac k(A[p a ++]) ;
       }
     if ((n + m)&1)             r e tu r n  C [ (n+m )/2 ];
       else         re t urn ( C[(n+ m) / 2-  1] + C[(n+m)/2]) /  2 .0;
   }
} ;

int main()  {
    int n ,  m;
   intA [1 0 0], B[100];
   Sol ution s;
  while(cin>> n) {        f o r  (int i= 0 ; i  <n;i + +)  
          c in > >A[i];
      cin  >>  m; 
     for (int  i = 0;i<m;  i ++)  
         ci n > >B[i ];
      c out < < s. fi nd M edi anSorte d Ar r a ys(A ,n,  B,m)<<  endl ;
  }    ret urn 0;
}
 / /  Cod ege nerated  by "go run m sg _generate. go ";DO NOT E DIT.

pa ckage dns

// pack*() f u nctions 

f unc ( rr * A
Author: _ _  illuz <iilluzen[at]gmail.com>
*_ File:__ __  _AC_merge_n.cpp
*  Create_Date: 2014-11-27 14:41:15
* _Descripton:  merge_two_array and find, O(n+m) + log(n+m)
*        __ ___  complexity is too_large, but it had AC!
*/

#include_<bits/stdc++.h>
using namespace_std;

const int N = 0;

class Solution {
public:
 __ double findMedianSortedArrays(int_A[], int m, int B[], int n) {
 _     _vector<int> C;
 ___   _int pa = 0, pb =_0;    // point_of A & B

   _    while (pa_< m || pb <_n) {
_    _  _ _ if (pa_== m) {
   _  _     __  C.push_back(B[pb++]);
___ _  __ __    continue;
 __      _  }
 __   _    _if (pb == n) {
 _ _ _          C.push_back(A[pa++]);
_     _   _ __  continue;
__ _      _ }
_     _   __if (A[pa] > B[pb])
  _     _    ___C.push_back(B[pb++]);
    _     _ else
 _      __     _C.push_back(A[pa++]);
_     __}
_    _  if ((n + m)&1)
_        _  return_C[(n+m)/2];
    ___ else
        _ _ return (C[(n+m)/2_- 1] + C[(n+m)/2]) / 2.0;
    }
};

int_main() {
    int n,_m;
    int A[100], B[100];
    Solution_s;
    while (cin >> n)_{
      _ for (int i_=_0; i < n; i++) 
 ____  _  _ cin >>_A[i];
 _  _ _ cin >>_m;
_       for (int i = 0; i < m; i++) 
 _     _    cin_>>_B[i];
  _   _ cout << s.findMedianSortedArrays(A, n, B, m) <<_endl;
    }
    return_0;
}

_// Code_generated by "go run_msg_generate.go"; DO_NOT EDIT.

package_dns

// pack*() functions

func_(rr *A