fork(2) download
  1. /* package codechef; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Main
  9. {
  10. static int intmax = Integer.MAX_VALUE;
  11. static int intmin = Integer.MIN_VALUE;
  12. static long mod = 1000000007L;
  13.  
  14. public static void main (String[] args) throws java.lang.Exception
  15. {
  16. FastReader get = new FastReader();
  17.  
  18. int T = get.nextInt();
  19.  
  20. while(T-->0)
  21. {
  22. int m=get.nextInt(), n=get.nextInt();
  23.  
  24. int [] X = new int[m-1];
  25. int [] Y = new int[n-1];
  26.  
  27. for(int i=0; i<m-1; i++) X[i]=get.nextInt();
  28. for(int i=0; i<n-1; i++) Y[i]=get.nextInt();
  29.  
  30. ans( X, Y, m, n );
  31.  
  32. put.flush();
  33. }
  34.  
  35. put.close();
  36. }
  37.  
  38. public static void ans( int[] X, int[] Y, int m, int n ) throws java.lang.Exception
  39. {
  40. ArrayList<Pair> pp = new ArrayList<>();
  41.  
  42. for( int i=0; i<X.length; i++) pp.add(new Pair(X[i], 1));
  43. for( int i=0; i<Y.length; i++) pp.add(new Pair(Y[i], 2));
  44.  
  45. int v_cuts = 1, h_cuts =1;
  46. long cost =0;
  47.  
  48. Collections.sort(pp);
  49.  
  50. for(int i=0; i<pp.size(); i++)
  51. {
  52. Pair p = pp.get(i);
  53.  
  54. if(p.b == 2)
  55. {
  56. cost += (long)p.a*v_cuts;
  57. h_cuts++;
  58. }
  59. else
  60. {
  61. cost += (long)p.a*h_cuts;
  62. v_cuts++;
  63. }
  64. }
  65.  
  66. put.write(cost+"\n");
  67. }
  68.  
  69. //
  70. // FUNCTIONS BELOW :
  71. // isPrime(), lcm(), gcd(), totient(), findDiv(), sortInt(), sortLong(),
  72. // power(), freqArr(), MATRIX: multiply(), power()
  73. // CLASSES BELOW :
  74. // DSU, FenwickTree, SegmentTree, LazySegTree, RangeBit, SparseTable, LCA, BitSet, MaxFlow
  75. //
  76.  
  77. public static int[] readArr(int N, FastReader get) throws Exception
  78. {
  79. int[] arr = new int[N];
  80. StringTokenizer st = new StringTokenizer(get.nextLine(), " ");
  81. for(int i=0; i < N; i++) arr[i] = Integer.parseInt(st.nextToken());
  82.  
  83. return arr;
  84. }
  85.  
  86. public static long[] readArr2(int N, FastReader get) throws Exception
  87. {
  88. long[] arr = new long[N];
  89. StringTokenizer st = new StringTokenizer(get.nextLine(), " ");
  90. for(int i=0; i < N; i++) arr[i] = Long.parseLong(st.nextToken());
  91.  
  92. return arr;
  93. }
  94.  
  95. public static int[][] readMat(int N, int M, FastReader get) throws Exception
  96. {
  97. int [][] mat = new int[N][M];
  98.  
  99. for(int i=0; i < N; i++)
  100. {
  101. StringTokenizer st = new StringTokenizer(get.nextLine(), " ");
  102. for(int j=0; j < M; j++) mat[i][j] = Integer.parseInt(st.nextToken());
  103. }
  104.  
  105. return mat;
  106. }
  107.  
  108. public static void print(int[] arr) throws java.lang.Exception
  109. {
  110. for(int x: arr)
  111. put.write(x+" ");
  112. put.write("\n");
  113. }
  114.  
  115. public static void printMat(int[][] arr) throws java.lang.Exception
  116. {
  117. for(int i=0; i < arr.length; i++)
  118. {
  119. for(int j=0; j < arr[0].length; j++)
  120. {
  121. put.write(arr[i][j] + " ");
  122. }
  123. put.write("\n");
  124. }
  125. put.write("\n");
  126. }
  127.  
  128. public static boolean isPrime(long n)
  129. {
  130. if(n < 2) return false;
  131. if(n == 2 || n == 3) return true;
  132. if(n%2 == 0 || n%3 == 0) return false;
  133. long sqrtN = (long)Math.sqrt(n)+1;
  134. for(long i = 6L; i <= sqrtN; i += 6) {
  135. if(n%(i-1) == 0 || n%(i+1) == 0) return false;
  136. }
  137. return true;
  138. }
  139.  
  140. public static long lcm(long a, long b)
  141. {
  142. return (a / gcd(a, b)) * b;
  143. }
  144.  
  145. public static long gcd(long a, long b)
  146. {
  147. if(a > b) a = (a+b)-(b=a);
  148. if(a == 0L) return b;
  149.  
  150. return gcd(b%a, a);
  151. }
  152.  
  153. public static long totient(long n)
  154. {
  155. long result = n;
  156. for (int p = 2; p*p <= n; ++p)
  157. if (n % p == 0)
  158. {
  159. while(n%p == 0)
  160. n /= p;
  161. result -= result/p;
  162. }
  163. if (n > 1) result -= result/n;
  164.  
  165. return result;
  166. }
  167.  
  168. public static ArrayList<Integer> findDiv(int N)
  169. {
  170. //gets all divisors of N
  171. ArrayList<Integer> ls1 = new ArrayList<Integer>();
  172. ArrayList<Integer> ls2 = new ArrayList<Integer>();
  173. for(int i=1; i <= (int)(Math.sqrt(N)+0.00000001); i++)
  174. if(N%i == 0)
  175. {
  176. ls1.add(i);
  177. ls2.add(N/i);
  178. }
  179. Collections.reverse(ls2);
  180. for(int b: ls2)
  181. if(b != ls1.get(ls1.size()-1))
  182. ls1.add(b);
  183. return ls1;
  184. }
  185.  
  186. public static void sortInt(int[] arr)
  187. {
  188. //because Arrays.sort() uses quicksort which is dumb
  189. //Collections.sort() uses merge sort
  190.  
  191. ArrayList<Integer> ls = new ArrayList<Integer>();
  192.  
  193. for(int x: arr) ls.add(x);
  194.  
  195. Collections.sort(ls);
  196. for(int i=0; i < arr.length; i++) arr[i] = ls.get(i);
  197. }
  198.  
  199. public static void sortLong(long[] arr)
  200. {
  201. //because Arrays.sort() uses quicksort which is dumb
  202. //Collections.sort() uses merge sort
  203.  
  204. ArrayList<Long> ls = new ArrayList<Long>();
  205.  
  206. for(long x: arr) ls.add(x);
  207.  
  208. Collections.sort(ls);
  209. for(int i=0; i < arr.length; i++) arr[i] = ls.get(i);
  210. }
  211.  
  212. public static void sortChar(char[] arr)
  213. {
  214. //because Arrays.sort() uses quicksort which is dumb
  215. //Collections.sort() uses merge sort
  216.  
  217. ArrayList<Character> ls = new ArrayList<Character>();
  218.  
  219. for(char x: arr) ls.add(x);
  220.  
  221. Collections.sort(ls);
  222. for(int i=0; i < arr.length; i++) arr[i] = ls.get(i);
  223. }
  224.  
  225. public static String sortString(String inputString)
  226. {
  227. char tempArray[] = inputString.toCharArray();
  228. sortChar(tempArray);
  229. return new String(tempArray);
  230. }
  231.  
  232. public static long power(long x, long y, long p)
  233. {
  234. //0^0 = 1
  235. long res = 1L;
  236. x = x%p;
  237. while(y > 0)
  238. {
  239. if((y&1)==1)
  240. res = (res*x)%p;
  241. y >>= 1;
  242. x = (x*x)%p;
  243. }
  244. return res;
  245. }
  246.  
  247. //custom multiset (replace with HashMap if needed)
  248. public static void push(TreeMap<Integer, Integer> map, int k, int v)
  249. {
  250. //map[k] += v;
  251. if(!map.containsKey(k)) map.put(k, v);
  252. else map.put(k, map.get(k)+v);
  253. }
  254.  
  255. public static void pull(TreeMap<Integer, Integer> map, int k, int v)
  256. {
  257. //assumes map[k] >= v
  258. //map[k] -= v
  259. int lol = map.get(k);
  260.  
  261. if(lol == v) map.remove(k);
  262. else map.put(k, lol-v);
  263. }
  264.  
  265. public static HashMap<Integer, Integer> freqMap(int[] arr)
  266. {
  267. HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
  268.  
  269. for(int x: arr)
  270. if(!map.containsKey(x)) map.put(x, map.get(x) + 1);
  271. else map.put(x, 1);
  272.  
  273. return map;
  274. }
  275.  
  276. public static long[][] multiply(long[][] left, long[][] right)
  277. {
  278. long MOD = 1000000007L;
  279. int N = left.length;
  280. int M = right[0].length;
  281. long[][] res = new long[N][M];
  282. for(int a=0; a < N; a++)
  283. for(int b=0; b < M; b++)
  284. for(int c=0; c < left[0].length; c++)
  285. {
  286. res[a][b] += (left[a][c]*right[c][b])%MOD;
  287. if(res[a][b] >= MOD)
  288. res[a][b] -= MOD;
  289. }
  290. return res;
  291. }
  292.  
  293. public static long[][] power(long[][] grid, long pow)
  294. {
  295. long[][] res = new long[grid.length][grid[0].length];
  296. for(int i=0; i < res.length; i++)
  297. res[i][i] = 1L;
  298. long[][] curr = grid.clone();
  299. while(pow > 0)
  300. {
  301. if((pow&1L) == 1L)
  302. res = multiply(curr, res);
  303. pow >>= 1;
  304. curr = multiply(curr, curr);
  305. }
  306. return res;
  307. }
  308. }
  309.  
  310. class Pair implements Comparable<Pair>
  311. {
  312. int a, b;
  313.  
  314. public Pair(int a, int b)
  315. {
  316. this.a = a;
  317. this.b = b;
  318. }
  319.  
  320. @Override
  321. public int compareTo(Pair p)
  322. {
  323. if(this.a > p.a) return -1;
  324. else if(this.a < p.a) return 1;
  325. else
  326. {
  327. if(this.b > p.b) return -1;
  328. else return 1;
  329. }
  330. }
  331. }
  332.  
  333. class DSU
  334. {
  335. public int[] dsu;
  336. public int[] size;
  337.  
  338. public DSU(int N)
  339. {
  340. dsu = new int[N+1];
  341. size = new int[N+1];
  342. for(int i=0; i <= N; i++)
  343. {
  344. dsu[i] = i;
  345. size[i] = 1;
  346. }
  347. }
  348. //with path compression, no find by rank
  349. public int find(int x)
  350. {
  351. return dsu[x] == x ? x : (dsu[x] = find(dsu[x]));
  352. }
  353. public void merge(int x, int y)
  354. {
  355. int fx = find(x);
  356. int fy = find(y);
  357. dsu[fx] = fy;
  358. }
  359. public void merge(int x, int y, boolean sized)
  360. {
  361. int fx = find(x);
  362. int fy = find(y);
  363. size[fy] += size[fx];
  364. dsu[fx] = fy;
  365. }
  366. }
  367.  
  368. class FenwickTree
  369. {
  370. //Binary Indexed Tree
  371. //1 indexed
  372. public int[] tree;
  373. public int size;
  374.  
  375. public FenwickTree(int size)
  376. {
  377. this.size = size;
  378. tree = new int[size+5];
  379. }
  380. public void add(int i, int v)
  381. {
  382. while(i <= size)
  383. {
  384. tree[i] += v;
  385. i += i&-i;
  386. }
  387. }
  388. public int find(int i)
  389. {
  390. int res = 0;
  391. while(i >= 1)
  392. {
  393. res += tree[i];
  394. i -= i&-i;
  395. }
  396. return res;
  397. }
  398. public int find(int l, int r)
  399. {
  400. return find(r)-find(l-1);
  401. }
  402. }
  403.  
  404. class SegmentTree
  405. {
  406. //Tlatoani's segment tree
  407. //iterative implementation = low constant runtime factor
  408. //range query, non lazy
  409. final int[] val;
  410. final int treeFrom;
  411. final int length;
  412.  
  413. public SegmentTree(int treeFrom, int treeTo)
  414. {
  415. this.treeFrom = treeFrom;
  416. int length = treeTo - treeFrom + 1;
  417. int l;
  418. for (l = 0; (1 << l) < length; l++);
  419. val = new int[1 << (l + 1)];
  420. this.length = 1 << l;
  421. }
  422. public void update(int index, int delta)
  423. {
  424. //replaces value
  425. int node = index - treeFrom + length;
  426. val[node] = delta;
  427. for (node >>= 1; node > 0; node >>= 1)
  428. val[node] = comb(val[node << 1], val[(node << 1) + 1]);
  429. }
  430. public int query(int from, int to)
  431. {
  432. //inclusive bounds
  433. if (to < from)
  434. return 0; //0 or 1?
  435. from += length - treeFrom;
  436. to += length - treeFrom + 1;
  437. //0 or 1?
  438. int res = 0;
  439. for (; from + (from & -from) <= to; from += from & -from)
  440. res = comb(res, val[from / (from & -from)]);
  441. for (; to - (to & -to) >= from; to -= to & -to)
  442. res = comb(res, val[(to - (to & -to)) / (to & -to)]);
  443. return res;
  444. }
  445. public int comb(int a, int b)
  446. {
  447. //change this
  448. return Math.max(a,b);
  449. }
  450. }
  451.  
  452. class LazySegTree
  453. {
  454. //definitions
  455. private int NULL = -1;
  456. private int[] tree;
  457. private int[] lazy;
  458. private int length;
  459.  
  460. public LazySegTree(int N)
  461. {
  462. length = N; int b;
  463. for(b=0; (1<<b) < length; b++);
  464. tree = new int[1<<(b+1)];
  465. lazy = new int[1<<(b+1)];
  466. }
  467. public int query(int left, int right)
  468. {
  469. //left and right are 0-indexed
  470. return get(1, 0, length-1, left, right);
  471. }
  472. private int get(int v, int currL, int currR, int L, int R)
  473. {
  474. if(L > R)
  475. return NULL;
  476. if(L <= currL && currR <= R)
  477. return tree[v];
  478. propagate(v);
  479. int mid = (currL+currR)/2;
  480. return comb(get(v*2, currL, mid, L, Math.min(R, mid)),
  481. get(v*2+1, mid+1, currR, Math.max(L, mid+1), R));
  482. }
  483. public void update(int left, int right, int delta)
  484. {
  485. add(1, 0, length-1, left, right, delta);
  486. }
  487. private void add(int v, int currL, int currR, int L, int R, int delta)
  488. {
  489. if(L > R)
  490. return;
  491. if(currL == L && currR == R)
  492. {
  493. //exact covering
  494. tree[v] += delta;
  495. lazy[v] += delta;
  496. return;
  497. }
  498. propagate(v);
  499. int mid = (currL+currR)/2;
  500. add(v*2, currL, mid, L, Math.min(R, mid), delta);
  501. add(v*2+1, mid+1, currR, Math.max(L, mid+1), R, delta);
  502. tree[v] = comb(tree[v*2], tree[v*2+1]);
  503. }
  504. private void propagate(int v)
  505. {
  506. //tree[v] already has lazy[v]
  507. if(lazy[v] == 0)
  508. return;
  509. tree[v*2] += lazy[v];
  510. lazy[v*2] += lazy[v];
  511. tree[v*2+1] += lazy[v];
  512. lazy[v*2+1] += lazy[v];
  513. lazy[v] = 0;
  514. }
  515. private int comb(int a, int b)
  516. {
  517. return Math.max(a,b);
  518. }
  519. }
  520.  
  521. class RangeBit
  522. {
  523. //FenwickTree and RangeBit are faster than LazySegTree by constant factor
  524. final int[] value;
  525. final int[] weightedVal;
  526.  
  527. public RangeBit(int treeTo)
  528. {
  529. value = new int[treeTo+2];
  530. weightedVal = new int[treeTo+2];
  531. }
  532. private void updateHelper(int index, int delta)
  533. {
  534. int weightedDelta = index*delta;
  535. for(int j = index; j < value.length; j += j & -j)
  536. {
  537. value[j] += delta;
  538. weightedVal[j] += weightedDelta;
  539. }
  540. }
  541. public void update(int from, int to, int delta)
  542. {
  543. updateHelper(from, delta);
  544. updateHelper(to + 1, -delta);
  545. }
  546. private int query(int to)
  547. {
  548. int res = 0;
  549. int weightedRes = 0;
  550. for (int j = to; j > 0; j -= j & -j)
  551. {
  552. res += value[j];
  553. weightedRes += weightedVal[j];
  554. }
  555. return ((to + 1)*res)-weightedRes;
  556. }
  557. public int query(int from, int to)
  558. {
  559. if (to < from)
  560. return 0;
  561. return query(to) - query(from - 1);
  562. }
  563. }
  564.  
  565. class SparseTable
  566. {
  567. public int[] log;
  568. public int[][] table;
  569. public int N; public int K;
  570.  
  571. public SparseTable(int N)
  572. {
  573. this.N = N;
  574. log = new int[N+2];
  575. K = Integer.numberOfTrailingZeros(Integer.highestOneBit(N));
  576. table = new int[N][K+1];
  577. sparsywarsy();
  578. }
  579. private void sparsywarsy()
  580. {
  581. log[1] = 0;
  582. for(int i=2; i <= N+1; i++)
  583. log[i] = log[i/2]+1;
  584. }
  585. public void lift(int[] arr)
  586. {
  587. int n = arr.length;
  588. for(int i=0; i < n; i++)
  589. table[i][0] = arr[i];
  590. for(int j=1; j <= K; j++)
  591. for(int i=0; i + (1 << j) <= n; i++)
  592. table[i][j] = Math.min(table[i][j-1], table[i+(1 << (j - 1))][j-1]);
  593. }
  594. public int query(int L, int R)
  595. {
  596. //inclusive, 1 indexed
  597. L--; R--;
  598. int mexico = log[R-L+1];
  599. return Math.min(table[L][mexico], table[R-(1 << mexico)+1][mexico]);
  600. }
  601. }
  602.  
  603. class LCA
  604. {
  605. public int N, root;
  606. public ArrayDeque<Integer>[] edges;
  607. private int[] enter;
  608. private int[] exit;
  609. private int LOG = 17; //change this
  610. private int[][] dp;
  611.  
  612. public LCA(int n, ArrayDeque<Integer>[] edges, int r)
  613. {
  614. N = n; root = r;
  615. enter = new int[N+1];
  616. exit = new int[N+1];
  617. dp = new int[N+1][LOG];
  618. this.edges = edges;
  619. int[] time = new int[1];
  620. //change to iterative dfs if N is large
  621. dfs(root, 0, time);
  622. dp[root][0] = 1;
  623. for(int b=1; b < LOG; b++)
  624. for(int v=1; v <= N; v++)
  625. dp[v][b] = dp[dp[v][b-1]][b-1];
  626. }
  627. private void dfs(int curr, int par, int[] time)
  628. {
  629. dp[curr][0] = par;
  630. enter[curr] = ++time[0];
  631. for(int next: edges[curr])
  632. if(next != par)
  633. dfs(next, curr, time);
  634. exit[curr] = ++time[0];
  635. }
  636. public int lca(int x, int y)
  637. {
  638. if(isAnc(x, y))
  639. return x;
  640. if(isAnc(y, x))
  641. return y;
  642. int curr = x;
  643. for(int b=LOG-1; b >= 0; b--)
  644. {
  645. int temp = dp[curr][b];
  646. if(!isAnc(temp, y))
  647. curr = temp;
  648. }
  649. return dp[curr][0];
  650. }
  651. private boolean isAnc(int anc, int curr)
  652. {
  653. return enter[anc] <= enter[curr] && exit[anc] >= exit[curr];
  654. }
  655. }
  656.  
  657. class BitSet
  658. {
  659. private int CONS = 62; //safe
  660. public long[] sets;
  661. public int size;
  662.  
  663. public BitSet(int N)
  664. {
  665. size = N;
  666. if(N%CONS == 0)
  667. sets = new long[N/CONS];
  668. else
  669. sets = new long[N/CONS+1];
  670. }
  671. public void add(int i)
  672. {
  673. int dex = i/CONS;
  674. int thing = i%CONS;
  675. sets[dex] |= (1L << thing);
  676. }
  677. public int and(BitSet oth)
  678. {
  679. int boof = Math.min(sets.length, oth.sets.length);
  680. int res = 0;
  681. for(int i=0; i < boof; i++)
  682. res += Long.bitCount(sets[i] & oth.sets[i]);
  683. return res;
  684. }
  685. public int xor(BitSet oth)
  686. {
  687. int boof = Math.min(sets.length, oth.sets.length);
  688. int res = 0;
  689. for(int i=0; i < boof; i++)
  690. res += Long.bitCount(sets[i] ^ oth.sets[i]);
  691. return res;
  692. }
  693. }
  694.  
  695. class MaxFlow
  696. {
  697. //Dinic with optimizations (see magic array in dfs function)
  698. public int N, source, sink;
  699. public ArrayList<Edge>[] edges;
  700. private int[] depth;
  701.  
  702. public MaxFlow(int n, int x, int y)
  703. {
  704. N = n;
  705. source = x;
  706. sink = y;
  707. edges = new ArrayList[N+1];
  708. for(int i=0; i <= N; i++)
  709. edges[i] = new ArrayList<Edge>();
  710. depth = new int[N+1];
  711. }
  712. public void addEdge(int from, int to, long cap)
  713. {
  714. Edge forward = new Edge(from, to, cap);
  715. Edge backward = new Edge(to, from, 0L);
  716. forward.residual = backward;
  717. backward.residual = forward;
  718. edges[from].add(forward);
  719. edges[to].add(backward);
  720. }
  721. public long mfmc()
  722. {
  723. long res = 0L;
  724. int[] magic = new int[N+1];
  725. while(assignDepths())
  726. {
  727. long flow = dfs(source, Long.MAX_VALUE/2, magic);
  728. while(flow > 0)
  729. {
  730. res += flow;
  731. flow = dfs(source, Long.MAX_VALUE/2, magic);
  732. }
  733. magic = new int[N+1];
  734. }
  735. return res;
  736. }
  737. private boolean assignDepths()
  738. {
  739. Arrays.fill(depth, -69);
  740. ArrayDeque<Integer> q = new ArrayDeque<Integer>();
  741. q.add(source);
  742. depth[source] = 0;
  743. while(q.size() > 0)
  744. {
  745. int curr = q.poll();
  746. for(Edge e: edges[curr])
  747. if(e.capacityLeft() > 0 && depth[e.to] == -69)
  748. {
  749. depth[e.to] = depth[curr]+1;
  750. q.add(e.to);
  751. }
  752. }
  753. return depth[sink] != -69;
  754. }
  755. private long dfs(int curr, long bottleneck, int[] magic)
  756. {
  757. if(curr == sink)
  758. return bottleneck;
  759. for(; magic[curr] < edges[curr].size(); magic[curr]++)
  760. {
  761. Edge e = edges[curr].get(magic[curr]);
  762. if(e.capacityLeft() > 0 && depth[e.to]-depth[curr] == 1)
  763. {
  764. long val = dfs(e.to, Math.min(bottleneck, e.capacityLeft()), magic);
  765. if(val > 0)
  766. {
  767. e.augment(val);
  768. return val;
  769. }
  770. }
  771. }
  772. return 0L; //no flow
  773. }
  774. private class Edge
  775. {
  776. public int from, to;
  777. public long flow, capacity;
  778. public Edge residual;
  779.  
  780. public Edge(int f, int t, long cap)
  781. {
  782. from = f;
  783. to = t;
  784. capacity = cap;
  785. }
  786. public long capacityLeft()
  787. {
  788. return capacity-flow;
  789. }
  790. public void augment(long val)
  791. {
  792. flow += val;
  793. residual.flow -= val;
  794. }
  795. }
  796. }
  797.  
  798. class FastReader
  799. {
  800.  
  801. public FastReader()
  802. {
  803. }
  804.  
  805. String next()
  806. {
  807. while (st == null || !st.hasMoreElements())
  808. {
  809. try
  810. {
  811. st = new StringTokenizer(br.readLine());
  812. }
  813. catch (IOException e)
  814. {
  815. e.printStackTrace();
  816. }
  817. }
  818. return st.nextToken();
  819. }
  820.  
  821. int nextInt()
  822. {
  823. return Integer.parseInt(next());
  824. }
  825.  
  826. long nextLong()
  827. {
  828. return Long.parseLong(next());
  829. }
  830.  
  831. double nextDouble()
  832. {
  833. return Double.parseDouble(next());
  834. }
  835.  
  836. String nextLine()
  837. {
  838. String str = "";
  839. try
  840. {
  841. str = br.readLine();
  842. }
  843. catch (IOException e)
  844. {
  845. e.printStackTrace();
  846. }
  847. return str;
  848. }
  849. }
Runtime error #stdin #stdout #stderr 0.09s 49496KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.NullPointerException
	at java.base/java.util.StringTokenizer.<init>(StringTokenizer.java:199)
	at java.base/java.util.StringTokenizer.<init>(StringTokenizer.java:236)
	at FastReader.next(Main.java:815)
	at FastReader.nextInt(Main.java:827)
	at Main.main(Main.java:19)