output_description: Print the maximum number of tasty cookies that Takahashi can eat.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A B C
attempt: N = input()
  a_list = list(map(int, input().split()))
  b_list = list(map(int, input().split()))
  
  if all([a >= b for a, b in zip(a_list, b_list)]):
      # すべての準備度が必要度を上回っている場合
      print(0)
  else:
      # 準備度が足りていない試験がある場合
      if sum(a_list) < sum(b_list):
          # そもそも準備度の総量が足りない場合
          print(-1)
      else:
          # 準備度を移動すれば受かる場合
          # 一番数の大きいところから足りていないところに割り振る戦略
          # a_listをcopy
          c_list = [a for a in a_list]
          # 準備度の余裕をリストに格納
          diff_list = [c - b for c, b in zip(c_list, b_list)]
          # 一度減算し始めたら対象が0になるまで続ける
          selected_biggest_idx = diff_list.index(max(diff_list))
          while not all([c >= b for c, b in zip(c_list, b_list)]):
              if diff_list[selected_biggest_idx] == 0:
                  selected_biggest_idx = diff_list.index(max(diff_list))
              min_idx = diff_list.index(min(diff_list))
              # 最大と最小で移し替えを行う
              if diff_list[selected_biggest_idx] < abs(diff_list[min_idx]):
                  # 足りていない値のほうが大きい場合
                  c_list[selected_biggest_idx] -= diff_list[selected_biggest_idx]
                  c_list[min_idx] += diff_list[selected_biggest_idx]
              else:
                  # 足りていない値のほうが小さい場合
                  c_list[selected_biggest_idx] -= abs(diff_list[min_idx])
                  c_list[min_idx] += abs(diff_list[min_idx])
              # diff_listを更新
              diff_list = [c - b for c, b in zip(c_list, b_list)]
          result_count = len([1 for a, c in zip(a_list, c_list) if a != c])
          print(result_count)
  
problem_description: Statement
  
  Takahashi has A untasty cookies containing antidotes, B tasty cookies
  containing antidotes and C tasty cookies containing poison.
  
  Eating a cookie containing poison results in a stomachache, and eating a
  cookie containing poison while having a stomachache results in a death. As he
  wants to live, he cannot eat one in such a situation. Eating a cookie
  containing antidotes while having a stomachache cures it, and there is no
  other way to cure stomachaches.
  
  Find the maximum number of tasty cookies that Takahashi can eat.
samples: [{"input": "3 1 4", "output": "5\n    \n\nWe can eat all tasty cookies, in the following order:\n\n  * A tasty cookie containing poison\n  * An untasty cookie containing antidotes\n  * A tasty cookie containing poison\n  * A tasty cookie containing antidotes\n  * A tasty cookie containing poison\n  * An untasty cookie containing antidotes\n  * A tasty cookie containing poison\n\n* * *"}, {"input": "5 2 9", "output": "10\n    \n\n* * *"}, {"input": "8 8 1", "output": "9"}]