node_ids
sequencelengths
4
1.4k
edge_index
sequencelengths
1
2.22k
text
sequencelengths
4
1.4k
source
stringlengths
14
427k
[ 7, 15, 13, 15, 13, 12, 13, 0, 13, 17, 0, 13, 4, 13, 17, 4, 18, 13, 13, 2, 17, 17, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 17, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 29, 39, 2, 13, 13, 2, 13, 13, 23, 13, 23, 13, 23, 13, 23, 13, 0, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 0, 13, 13, 0, 13, 17, 13, 17, 28, 13, 13, 13, 0, 13, 4, 13, 13, 13, 13, 13, 13, 4, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 9, 8 ], [ 12, 11 ], [ 41, 40 ], [ 66, 46 ], [ 70, 47 ], [ 70, 49 ], [ 68, 53 ], [ 72, 54 ], [ 72, 56 ], [ 70, 60 ], [ 40, 61 ], [ 72, 63 ], [ 40, 64 ], [ 66, 66 ], [ 68, 68 ], [ 70, 70 ], [ 72, 72 ], [ 75, 74 ], [ 25, 76 ], [ 80, 79 ], [ 74, 82 ], [ 31, 85 ], [ 88, 87 ], [ 91, 90 ], [ 93, 92 ], [ 100, 99 ], [ 37, 101 ], [ 90, 102 ], [ 99, 102 ], [ 92, 103 ], [ 106, 103 ], [ 100, 106 ], [ 99, 110 ], [ 90, 110 ], [ 106, 111 ], [ 92, 111 ], [ 120, 117 ] ]
[ "#!/usr/bin/env python3\n\nimport sys\n# import time\nimport math\n# import numpy as np\n# import scipy.sparse.csgraph as cs # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall\n# import random # random, uniform, randint, randrange, shuffle, sample\n# import string # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits\n# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)\n# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).\n# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()\n# from collections import defaultdict # subclass of dict. defaultdict(facroty)\n# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)\n# from datetime import date, datetime # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj\n# from datetime.datetime import strptime # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj\n# from datetime import timedelta # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.\n# from copy import copy, deepcopy # use deepcopy to copy multi-dimentional matrix without reference\n# from functools import reduce # reduce(f, iter[, init])\n# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)\n# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).\n# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).\n# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])\n# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]\n# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]\n# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])\n# from itertools import combinations, combinations_with_replacement\n# from itertools import accumulate # accumulate(iter[, f])\n# from operator import itemgetter # itemgetter(1), itemgetter('key')\n# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)\n\n\n\ndef main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n\n def calc_minimum_card_pair(a, b, s, t):\n \"\"\"\n ็พๅœจ a, b ๆžšใงใ‚ใ‚‹ใจใ™ใ‚‹\n ใ‚ซใƒผใƒ‰ใ‚’ๅข—ใ‚„ใ™ๆ“ไฝœใ‚’่กŒใ„ๆฏ”ใ‚’ s : t ใซใ™ใ‚‹ใจใใ€ๅค‰ๅŒ–ๅพŒใฎใ‚ซใƒผใƒ‰ๆžšๆ•ฐใ‚’่ฟ”ใ™\n \"\"\"\n # multiply_rate = max(math.ceil(a / s), math.ceil(b / t))\n multiply_rate = max((a + s - 1) // s, (b + t - 1) // t)\n return (s * multiply_rate, t * multiply_rate)\n \n \n n = ii()\n L = [lmi() for _ in range(n)]\n a, b = 1, 1\n for s, t in L:\n a, b = calc_minimum_card_pair(a, b, s, t)\n # print(a, b)\n \n # print('')\n print(a + b)\n\n\nif __name__ == \"__main__\":\n main()", "import sys", "sys", "import math", "math", "def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n\n def calc_minimum_card_pair(a, b, s, t):\n \"\"\"\n ็พๅœจ a, b ๆžšใงใ‚ใ‚‹ใจใ™ใ‚‹\n ใ‚ซใƒผใƒ‰ใ‚’ๅข—ใ‚„ใ™ๆ“ไฝœใ‚’่กŒใ„ๆฏ”ใ‚’ s : t ใซใ™ใ‚‹ใจใใ€ๅค‰ๅŒ–ๅพŒใฎใ‚ซใƒผใƒ‰ๆžšๆ•ฐใ‚’่ฟ”ใ™\n \"\"\"\n # multiply_rate = max(math.ceil(a / s), math.ceil(b / t))\n multiply_rate = max((a + s - 1) // s, (b + t - 1) // t)\n return (s * multiply_rate, t * multiply_rate)\n \n \n n = ii()\n L = [lmi() for _ in range(n)]\n a, b = 1, 1\n for s, t in L:\n a, b = calc_minimum_card_pair(a, b, s, t)\n # print(a, b)\n \n # print('')\n print(a + b)", "main", "mod = 1000000007", "mod", "1000000007", "inf = float('inf')", "inf", "float('inf')", "float", "'inf'", "sys.setrecursionlimit(10**6)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**6", "10", "6", "def input(): return sys.stdin.readline().rstrip()\n ", "input", "def ii(): return int(input())\n ", "ii", "def mi(): return map(int, input().split())\n ", "mi", "def mi_0(): return map(lambda x: int(x)-1, input().split())\n ", "mi_0", "def lmi(): return list(map(int, input().split()))\n ", "lmi", "def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n ", "lmi_0", "def li(): return list(input())\n\n ", "li", "def calc_minimum_card_pair(a, b, s, t):\n \"\"\"\n ็พๅœจ a, b ๆžšใงใ‚ใ‚‹ใจใ™ใ‚‹\n ใ‚ซใƒผใƒ‰ใ‚’ๅข—ใ‚„ใ™ๆ“ไฝœใ‚’่กŒใ„ๆฏ”ใ‚’ s : t ใซใ™ใ‚‹ใจใใ€ๅค‰ๅŒ–ๅพŒใฎใ‚ซใƒผใƒ‰ๆžšๆ•ฐใ‚’่ฟ”ใ™\n \"\"\"\n # multiply_rate = max(math.ceil(a / s), math.ceil(b / t))\n multiply_rate = max((a + s - 1) // s, (b + t - 1) // t)\n return (s * multiply_rate, t * multiply_rate)\n \n \n ", "calc_minimum_card_pair", "\"\"\"\n ็พๅœจ a, b ๆžšใงใ‚ใ‚‹ใจใ™ใ‚‹\n ใ‚ซใƒผใƒ‰ใ‚’ๅข—ใ‚„ใ™ๆ“ไฝœใ‚’่กŒใ„ๆฏ”ใ‚’ s : t ใซใ™ใ‚‹ใจใใ€ๅค‰ๅŒ–ๅพŒใฎใ‚ซใƒผใƒ‰ๆžšๆ•ฐใ‚’่ฟ”ใ™\n \"\"\"", "multiply_rate = max((a + s - 1) // s, (b + t - 1) // t)", "multiply_rate", "max((a + s - 1) // s, (b + t - 1) // t)", "max", "(a + s - 1) // s", "a + s - 1", "a + s", "a", "s", "1", "s", "(b + t - 1) // t", "b + t - 1", "b + t", "b", "t", "1", "t", "return (s * multiply_rate, t * multiply_rate)", "(s * multiply_rate, t * multiply_rate)", "s * multiply_rate", "s", "multiply_rate", "t * multiply_rate", "t", "multiply_rate", "a", "a", "b", "b", "s", "s", "t", "t", "n = ii()", "n", "ii()", "ii", "lmi() for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "lmi()", "lmi", "L = [lmi() for _ in range(n)]", "L", "[lmi() for _ in range(n)]", "a, b = 1, 1", "a", "1", "b", "1", "for s, t in L:\n a, b = calc_minimum_card_pair(a, b, s, t)\n # print(a, b)\n \n # print('')\n ", "s", "t", "L", "a, b = calc_minimum_card_pair(a, b, s, t)", "a", "calc_minimum_card_pair(a, b, s, t)", "calc_minimum_card_pair", "a", "b", "s", "t", "b", "print(a + b)", "print", "a + b", "a", "b", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n\n def calc_minimum_card_pair(a, b, s, t):\n \"\"\"\n ็พๅœจ a, b ๆžšใงใ‚ใ‚‹ใจใ™ใ‚‹\n ใ‚ซใƒผใƒ‰ใ‚’ๅข—ใ‚„ใ™ๆ“ไฝœใ‚’่กŒใ„ๆฏ”ใ‚’ s : t ใซใ™ใ‚‹ใจใใ€ๅค‰ๅŒ–ๅพŒใฎใ‚ซใƒผใƒ‰ๆžšๆ•ฐใ‚’่ฟ”ใ™\n \"\"\"\n # multiply_rate = max(math.ceil(a / s), math.ceil(b / t))\n multiply_rate = max((a + s - 1) // s, (b + t - 1) // t)\n return (s * multiply_rate, t * multiply_rate)\n \n \n n = ii()\n L = [lmi() for _ in range(n)]\n a, b = 1, 1\n for s, t in L:\n a, b = calc_minimum_card_pair(a, b, s, t)\n # print(a, b)\n \n # print('')\n print(a + b)", "def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n\n def calc_minimum_card_pair(a, b, s, t):\n \"\"\"\n ็พๅœจ a, b ๆžšใงใ‚ใ‚‹ใจใ™ใ‚‹\n ใ‚ซใƒผใƒ‰ใ‚’ๅข—ใ‚„ใ™ๆ“ไฝœใ‚’่กŒใ„ๆฏ”ใ‚’ s : t ใซใ™ใ‚‹ใจใใ€ๅค‰ๅŒ–ๅพŒใฎใ‚ซใƒผใƒ‰ๆžšๆ•ฐใ‚’่ฟ”ใ™\n \"\"\"\n # multiply_rate = max(math.ceil(a / s), math.ceil(b / t))\n multiply_rate = max((a + s - 1) // s, (b + t - 1) // t)\n return (s * multiply_rate, t * multiply_rate)\n \n \n n = ii()\n L = [lmi() for _ in range(n)]\n a, b = 1, 1\n for s, t in L:\n a, b = calc_minimum_card_pair(a, b, s, t)\n # print(a, b)\n \n # print('')\n print(a + b)", "main" ]
#!/usr/bin/env python3 import sys # import time import math # import numpy as np # import scipy.sparse.csgraph as cs # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall # import random # random, uniform, randint, randrange, shuffle, sample # import string # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits # import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s) # from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]). # from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate() # from collections import defaultdict # subclass of dict. defaultdict(facroty) # from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter) # from datetime import date, datetime # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj # from datetime.datetime import strptime # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj # from datetime import timedelta # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available. # from copy import copy, deepcopy # use deepcopy to copy multi-dimentional matrix without reference # from functools import reduce # reduce(f, iter[, init]) # from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed) # from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn). # from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn). # from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n]) # from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])] # from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9] # from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r]) # from itertools import combinations, combinations_with_replacement # from itertools import accumulate # accumulate(iter[, f]) # from operator import itemgetter # itemgetter(1), itemgetter('key') # from fractions import gcd # for Python 3.4 (previous contest @AtCoder) def main(): mod = 1000000007 # 10^9+7 inf = float('inf') # sys.float_info.max = 1.79...e+308 # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19 sys.setrecursionlimit(10**6) # 1000 -> 1000000 def input(): return sys.stdin.readline().rstrip() def ii(): return int(input()) def mi(): return map(int, input().split()) def mi_0(): return map(lambda x: int(x)-1, input().split()) def lmi(): return list(map(int, input().split())) def lmi_0(): return list(map(lambda x: int(x)-1, input().split())) def li(): return list(input()) def calc_minimum_card_pair(a, b, s, t): """ ็พๅœจ a, b ๆžšใงใ‚ใ‚‹ใจใ™ใ‚‹ ใ‚ซใƒผใƒ‰ใ‚’ๅข—ใ‚„ใ™ๆ“ไฝœใ‚’่กŒใ„ๆฏ”ใ‚’ s : t ใซใ™ใ‚‹ใจใใ€ๅค‰ๅŒ–ๅพŒใฎใ‚ซใƒผใƒ‰ๆžšๆ•ฐใ‚’่ฟ”ใ™ """ # multiply_rate = max(math.ceil(a / s), math.ceil(b / t)) multiply_rate = max((a + s - 1) // s, (b + t - 1) // t) return (s * multiply_rate, t * multiply_rate) n = ii() L = [lmi() for _ in range(n)] a, b = 1, 1 for s, t in L: a, b = calc_minimum_card_pair(a, b, s, t) # print(a, b) # print('') print(a + b) if __name__ == "__main__": main()
[ 7, 15, 13, 13, 15, 15, 15, 15, 15, 15, 12, 13, 12, 13, 12, 13, 12, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 4, 13, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 0, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 100, 26 ], [ 97, 31 ], [ 118, 38 ], [ 110, 40 ], [ 44, 43 ], [ 119, 46 ], [ 107, 49 ], [ 115, 51 ], [ 124, 54 ], [ 121, 57 ], [ 133, 64 ], [ 125, 70 ], [ 128, 70 ], [ 122, 77 ], [ 131, 77 ], [ 127, 82 ], [ 134, 85 ], [ 130, 87 ], [ 134, 90 ], [ 131, 94 ], [ 122, 94 ], [ 128, 95 ], [ 125, 95 ], [ 97, 98 ], [ 100, 101 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ], [ 127, 128 ], [ 130, 131 ], [ 133, 134 ] ]
[ "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\nN = INT()\nTA = [LIST() for _ in range(N)]\nvote_T = 1\nvote_A = 1\nfor x, y in TA:\n\tn = max((vote_T+x-1)//x, (vote_A+y-1)//y)\n\tvote_T = x * n\n\tvote_A = y * n\nprint(vote_A + vote_T)", "import sys, re", "sys", "re", "from collections import deque, defaultdict, Counter", "from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians", "from itertools import permutations, combinations, product", "from operator import itemgetter, mul", "from copy import deepcopy", "from string import ascii_lowercase, ascii_uppercase, digits", "def input(): return sys.stdin.readline().strip()", "input", "def INT(): return int(input())", "INT", "def MAP(): return map(int, input().split())", "MAP", "def LIST(): return list(map(int, input().split()))", "LIST", "sys.setrecursionlimit(10 ** 9)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 9", "10", "9", "INF = float('inf')", "INF", "float('inf')", "float", "'inf'", "MOD = 10 ** 9 + 7", "MOD", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "N = INT()", "N", "INT()", "INT", "LIST() for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "LIST()", "LIST", "TA = [LIST() for _ in range(N)]", "TA", "[LIST() for _ in range(N)]", "vote_T = 1", "vote_T", "1", "vote_A = 1", "vote_A", "1", "for x, y in TA:\n\tn = max((vote_T+x-1)//x, (vote_A+y-1)//y)\n\tvote_T = x * n\n\tvote_A = y * n", "x", "y", "TA", "n = max((vote_T+x-1)//x, (vote_A+y-1)//y)", "n", "max((vote_T+x-1)//x, (vote_A+y-1)//y)", "max", "(vote_T+x-1)//x", "vote_T+x-1", "vote_T+x", "vote_T", "x", "1", "x", "(vote_A+y-1)//y", "vote_A+y-1", "vote_A+y", "vote_A", "y", "1", "y", "vote_T = x * n", "vote_T", "x * n", "x", "n", "vote_A = y * n", "vote_A", "y * n", "y", "n", "print(vote_A + vote_T)", "print", "vote_A + vote_T", "vote_A", "vote_T", "MOD = 10 ** 9 + 7", "10 ** 9 + 7", "MOD", "INF = float('inf')", "float('inf')", "INF", "def input(): return sys.stdin.readline().strip()", "def input(): return sys.stdin.readline().strip()", "input", "def LIST(): return list(map(int, input().split()))", "def LIST(): return list(map(int, input().split()))", "LIST", "def INT(): return int(input())", "def INT(): return int(input())", "INT", "def MAP(): return map(int, input().split())", "def MAP(): return map(int, input().split())", "MAP", "TA = [LIST() for _ in range(N)]", "[LIST() for _ in range(N)]", "TA", "N = INT()", "INT()", "N", "vote_A = 1", "1", "vote_A", "vote_T = 1", "1", "vote_T", "vote_T = x * n", "x * n", "vote_T", "vote_A = y * n", "y * n", "vote_A", "n = max((vote_T+x-1)//x, (vote_A+y-1)//y)", "max((vote_T+x-1)//x, (vote_A+y-1)//y)", "n" ]
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) sys.setrecursionlimit(10 ** 9) INF = float('inf') MOD = 10 ** 9 + 7 N = INT() TA = [LIST() for _ in range(N)] vote_T = 1 vote_A = 1 for x, y in TA: n = max((vote_T+x-1)//x, (vote_A+y-1)//y) vote_T = x * n vote_A = y * n print(vote_A + vote_T)
[ 7, 0, 13, 4, 13, 4, 13, 15, 13, 0, 13, 39, 28, 13, 4, 13, 13, 4, 18, 13, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 17, 12, 13, 14, 2, 40, 18, 13, 17, 18, 13, 17, 40, 18, 13, 17, 18, 13, 17, 29, 13, 14, 40, 2, 18, 13, 17, 18, 13, 17, 17, 0, 13, 2, 2, 18, 13, 17, 18, 13, 17, 17, 0, 13, 2, 18, 13, 17, 18, 13, 17, 14, 40, 2, 18, 13, 17, 18, 13, 17, 17, 0, 13, 2, 2, 18, 13, 17, 18, 13, 17, 17, 0, 13, 2, 18, 13, 17, 18, 13, 17, 0, 13, 4, 13, 13, 13, 29, 39, 2, 18, 13, 17, 13, 2, 18, 13, 17, 13, 23, 13, 23, 13, 0, 13, 18, 13, 17, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 18, 13, 13, 13, 4, 13, 4, 13, 13, 10, 4, 13, 10, 39, 13, 10, 12, 13, 10, 18, 13, 10, 4, 13 ]
[ [ 159, 2 ], [ 162, 10 ], [ 14, 13 ], [ 160, 16 ], [ 163, 19 ], [ 131, 38 ], [ 133, 41 ], [ 131, 45 ], [ 133, 48 ], [ 131, 51 ], [ 133, 56 ], [ 131, 59 ], [ 64, 63 ], [ 133, 67 ], [ 131, 70 ], [ 75, 74 ], [ 133, 77 ], [ 131, 80 ], [ 133, 86 ], [ 131, 89 ], [ 94, 93 ], [ 133, 97 ], [ 131, 100 ], [ 105, 104 ], [ 133, 107 ], [ 131, 110 ], [ 114, 113 ], [ 74, 116 ], [ 63, 116 ], [ 104, 117 ], [ 93, 117 ], [ 131, 122 ], [ 113, 124 ], [ 131, 127 ], [ 113, 129 ], [ 131, 131 ], [ 133, 133 ], [ 168, 135 ], [ 163, 137 ], [ 141, 140 ], [ 160, 144 ], [ 171, 146 ], [ 166, 148 ], [ 163, 150 ], [ 140, 151 ], [ 169, 152 ], [ 172, 152 ], [ 172, 157 ], [ 169, 157 ], [ 159, 160 ], [ 162, 163 ], [ 168, 169 ], [ 171, 172 ] ]
[ "N=int(input())\nimport copy\ninp=[]\nfor i in range(N):\n inp.append(list(map(int,input().split(\" \"))))\n\ndef compare(A,B):\n if A[0]>=B[0] and A[1]>=B[1]:\n return A\n else:\n if B[0]%A[0]!=0:\n i=B[0]//A[0]+1\n else:\n i=B[0]//A[0]\n if B[1]%A[1]!=0:\n j=B[1]//A[1]+1 \n else:\n j=B[1]//A[1]\n m=max(i,j)\n return [A[0]*m,A[1]*m]\nst=inp[0]\nfor i in range(1,N):\n st=compare(inp[i],st)\nprint(sum(st))", "N=int(input())", "N", "int(input())", "int", "input()", "input", "import copy", "copy", "inp=[]", "inp", "[]", "for i in range(N):\n inp.append(list(map(int,input().split(\" \"))))", "i", "range(N)", "range", "N", "inp.append(list(map(int,input().split(\" \"))))", "inp.append", "inp", "append", "list(map(int,input().split(\" \")))", "list", "map(int,input().split(\" \"))", "map", "int", "input().split(\" \")", "().split", "()", "input", "split", "\" \"", "def compare(A,B):\n if A[0]>=B[0] and A[1]>=B[1]:\n return A\n else:\n if B[0]%A[0]!=0:\n i=B[0]//A[0]+1\n else:\n i=B[0]//A[0]\n if B[1]%A[1]!=0:\n j=B[1]//A[1]+1 \n else:\n j=B[1]//A[1]\n m=max(i,j)\n return [A[0]*m,A[1]*m]", "compare", "if A[0]>=B[0] and A[1]>=B[1]:\n return A\n else:\n if B[0]%A[0]!=0:\n i=B[0]//A[0]+1\n else:\n i=B[0]//A[0]\n if B[1]%A[1]!=0:\n j=B[1]//A[1]+1 \n else:\n j=B[1]//A[1]\n m=max(i,j)\n return [A[0]*m,A[1]*m]", "A[0]>=B[0] and A[1]>=B[1]", "A[0]>=B[0]", "A[0]", "A", "0", "B[0]", "B", "0", "A[1]>=B[1]", "A[1]", "A", "1", "B[1]", "B", "1", "return A", "A", "if B[0]%A[0]!=0:\n i=B[0]//A[0]+1\n else:\n i=B[0]//A[0]\n ", "B[0]%A[0]!=0", "B[0]%A[0]", "B[0]", "B", "0", "A[0]", "A", "0", "0", "i=B[0]//A[0]+1", "i", "B[0]//A[0]+1", "B[0]//A[0]", "B[0]", "B", "0", "A[0]", "A", "0", "1", "i=B[0]//A[0]", "i", "B[0]//A[0]", "B[0]", "B", "0", "A[0]", "A", "0", "if B[1]%A[1]!=0:\n j=B[1]//A[1]+1 \n else:\n j=B[1]//A[1]\n ", "B[1]%A[1]!=0", "B[1]%A[1]", "B[1]", "B", "1", "A[1]", "A", "1", "0", "j=B[1]//A[1]+1", "j", "B[1]//A[1]+1", "B[1]//A[1]", "B[1]", "B", "1", "A[1]", "A", "1", "1", "j=B[1]//A[1]", "j", "B[1]//A[1]", "B[1]", "B", "1", "A[1]", "A", "1", "m=max(i,j)", "m", "max(i,j)", "max", "i", "j", "return [A[0]*m,A[1]*m]", "[A[0]*m,A[1]*m]", "A[0]*m", "A[0]", "A", "0", "m", "A[1]*m", "A[1]", "A", "1", "m", "A", "A", "B", "B", "st=inp[0]", "st", "inp[0]", "inp", "0", "for i in range(1,N):\n st=compare(inp[i],st)", "i", "range(1,N)", "range", "1", "N", "st=compare(inp[i],st)", "st", "compare(inp[i],st)", "compare", "inp[i]", "inp", "i", "st", "print(sum(st))", "print", "sum(st)", "sum", "st", "N=int(input())", "int(input())", "N", "inp=[]", "[]", "inp", "def compare(A,B):\n if A[0]>=B[0] and A[1]>=B[1]:\n return A\n else:\n if B[0]%A[0]!=0:\n i=B[0]//A[0]+1\n else:\n i=B[0]//A[0]\n if B[1]%A[1]!=0:\n j=B[1]//A[1]+1 \n else:\n j=B[1]//A[1]\n m=max(i,j)\n return [A[0]*m,A[1]*m]", "def compare(A,B):\n if A[0]>=B[0] and A[1]>=B[1]:\n return A\n else:\n if B[0]%A[0]!=0:\n i=B[0]//A[0]+1\n else:\n i=B[0]//A[0]\n if B[1]%A[1]!=0:\n j=B[1]//A[1]+1 \n else:\n j=B[1]//A[1]\n m=max(i,j)\n return [A[0]*m,A[1]*m]", "compare", "st=inp[0]", "inp[0]", "st", "st=compare(inp[i],st)", "compare(inp[i],st)", "st" ]
N=int(input()) import copy inp=[] for i in range(N): inp.append(list(map(int,input().split(" ")))) def compare(A,B): if A[0]>=B[0] and A[1]>=B[1]: return A else: if B[0]%A[0]!=0: i=B[0]//A[0]+1 else: i=B[0]//A[0] if B[1]%A[1]!=0: j=B[1]//A[1]+1 else: j=B[1]//A[1] m=max(i,j) return [A[0]*m,A[1]*m] st=inp[0] for i in range(1,N): st=compare(inp[i],st) print(sum(st))
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 72, 2 ], [ 75, 8 ], [ 78, 11 ], [ 15, 14 ], [ 73, 17 ], [ 66, 19 ], [ 66, 28 ], [ 81, 30 ], [ 76, 36 ], [ 85, 36 ], [ 67, 37 ], [ 67, 39 ], [ 79, 43 ], [ 70, 43 ], [ 64, 44 ], [ 64, 46 ], [ 84, 48 ], [ 82, 50 ], [ 67, 51 ], [ 69, 53 ], [ 82, 55 ], [ 64, 56 ], [ 85, 60 ], [ 76, 60 ], [ 70, 61 ], [ 79, 61 ], [ 66, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ] ]
[ "N = int(input())\ntakahashi = 1\naoki = 1\nfor i in range(N):\n T, A = map(int,input().split())\n n = max((takahashi + T - 1) // T, (aoki + A - 1) // A)\n takahashi = n*T\n aoki = n*A\nprint(takahashi+aoki)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "takahashi = 1", "takahashi", "1", "aoki = 1", "aoki", "1", "for i in range(N):\n T, A = map(int,input().split())\n n = max((takahashi + T - 1) // T, (aoki + A - 1) // A)\n takahashi = n*T\n aoki = n*A", "i", "range(N)", "range", "N", "T, A = map(int,input().split())", "T", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "n = max((takahashi + T - 1) // T, (aoki + A - 1) // A)", "n", "max((takahashi + T - 1) // T, (aoki + A - 1) // A)", "max", "(takahashi + T - 1) // T", "takahashi + T - 1", "takahashi + T", "takahashi", "T", "1", "T", "(aoki + A - 1) // A", "aoki + A - 1", "aoki + A", "aoki", "A", "1", "A", "takahashi = n*T", "takahashi", "n*T", "n", "T", "aoki = n*A", "aoki", "n*A", "n", "A", "print(takahashi+aoki)", "print", "takahashi+aoki", "takahashi", "aoki", "A = map(int,input().split())", "map(int,input().split())", "A", "T, A = map(int,input().split())", "map(int,input().split())", "T", "aoki = n*A", "n*A", "aoki", "N = int(input())", "int(input())", "N", "takahashi = 1", "1", "takahashi", "aoki = 1", "1", "aoki", "n = max((takahashi + T - 1) // T, (aoki + A - 1) // A)", "max((takahashi + T - 1) // T, (aoki + A - 1) // A)", "n", "takahashi = n*T", "n*T", "takahashi" ]
N = int(input()) takahashi = 1 aoki = 1 for i in range(N): T, A = map(int,input().split()) n = max((takahashi + T - 1) // T, (aoki + A - 1) // A) takahashi = n*T aoki = n*A print(takahashi+aoki)
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 0, 13, 39, 13, 39, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 4, 18, 13, 13, 13, 4, 18, 13, 13, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 18, 13, 13, 40, 2, 40, 13, 18, 13, 13, 0, 13, 2, 18, 13, 13, 13, 0, 13, 2, 18, 13, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 39, 13, 10, 4, 13, 10, 39, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 100, 4 ], [ 103, 10 ], [ 97, 12 ], [ 16, 15 ], [ 101, 18 ], [ 115, 20 ], [ 115, 29 ], [ 104, 32 ], [ 116, 34 ], [ 98, 37 ], [ 113, 39 ], [ 106, 41 ], [ 109, 43 ], [ 47, 46 ], [ 101, 49 ], [ 88, 51 ], [ 110, 57 ], [ 92, 57 ], [ 98, 59 ], [ 46, 60 ], [ 107, 64 ], [ 95, 64 ], [ 104, 66 ], [ 46, 67 ], [ 91, 69 ], [ 98, 72 ], [ 46, 73 ], [ 89, 74 ], [ 94, 76 ], [ 104, 79 ], [ 46, 80 ], [ 89, 81 ], [ 92, 85 ], [ 110, 85 ], [ 95, 86 ], [ 107, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ], [ 109, 110 ], [ 115, 113 ], [ 115, 116 ] ]
[ "import math\n\nN = int(input())\nt,a = [],[]\nfor _ in range(N):\n\tt_tmp, a_tmp = map(int, input().split())\n\tt.append(t_tmp)\n\ta.append(a_tmp)\n\nT,A=1,1\n\nfor i in range(N):\n\tn = max(-(-A//a[i]), -(-T//t[i]))\n\tA = a[i] * n\n\tT = t[i] * n\n\nprint(A+T)", "import math", "math", "N = int(input())", "N", "int(input())", "int", "input()", "input", "t,a = [],[]", "t", "[]", "a", "[]", "for _ in range(N):\n\tt_tmp, a_tmp = map(int, input().split())\n\tt.append(t_tmp)\n\ta.append(a_tmp)", "_", "range(N)", "range", "N", "t_tmp, a_tmp = map(int, input().split())", "t_tmp", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a_tmp", "t.append(t_tmp)", "t.append", "t", "append", "t_tmp", "a.append(a_tmp)", "a.append", "a", "append", "a_tmp", "T,A=1,1", "T", "1", "A", "1", "for i in range(N):\n\tn = max(-(-A//a[i]), -(-T//t[i]))\n\tA = a[i] * n\n\tT = t[i] * n", "i", "range(N)", "range", "N", "n = max(-(-A//a[i]), -(-T//t[i]))", "n", "max(-(-A//a[i]), -(-T//t[i]))", "max", "-(-A//a[i])", "-A//a[i]", "-A", "A", "a[i]", "a", "i", "-(-T//t[i])", "-T//t[i]", "-T", "T", "t[i]", "t", "i", "A = a[i] * n", "A", "a[i] * n", "a[i]", "a", "i", "n", "T = t[i] * n", "T", "t[i] * n", "t[i]", "t", "i", "n", "print(A+T)", "print", "A+T", "A", "T", "n = max(-(-A//a[i]), -(-T//t[i]))", "max(-(-A//a[i]), -(-T//t[i]))", "n", "A = a[i] * n", "a[i] * n", "A", "T = t[i] * n", "t[i] * n", "T", "a = [],[]", "[]", "a", "N = int(input())", "int(input())", "N", "t,a = [],[]", "[]", "t", "T,A=1,1", "1", "T", "A=1,1", "1", "A", "a_tmp = map(int, input().split())", "map(int, input().split())", "a_tmp", "t_tmp, a_tmp = map(int, input().split())", "map(int, input().split())", "t_tmp" ]
import math N = int(input()) t,a = [],[] for _ in range(N): t_tmp, a_tmp = map(int, input().split()) t.append(t_tmp) a.append(a_tmp) T,A=1,1 for i in range(N): n = max(-(-A//a[i]), -(-T//t[i])) A = a[i] * n T = t[i] * n print(A+T)
[ 7, 15, 13, 12, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 13, 14, 2, 2, 13, 17, 2, 13, 17, 0, 13, 13, 0, 13, 13, 0, 13, 40, 2, 40, 13, 13, 0, 13, 40, 2, 40, 13, 13, 0, 13, 4, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 29, 39, 13, 13, 23, 13, 14, 2, 13, 17, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 4, 13, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 13, 13, 10, 12, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 7, 6 ], [ 10, 9 ], [ 6, 18 ], [ 52, 18 ], [ 24, 18 ], [ 9, 21 ], [ 57, 21 ], [ 27, 21 ], [ 25, 24 ], [ 28, 27 ], [ 31, 30 ], [ 6, 34 ], [ 52, 34 ], [ 24, 34 ], [ 38, 37 ], [ 9, 41 ], [ 57, 41 ], [ 27, 41 ], [ 45, 44 ], [ 30, 49 ], [ 37, 50 ], [ 53, 52 ], [ 44, 54 ], [ 58, 57 ], [ 44, 59 ], [ 66, 66 ], [ 121, 72 ], [ 80, 79 ], [ 122, 82 ], [ 112, 95 ], [ 118, 98 ], [ 116, 100 ], [ 113, 101 ], [ 118, 102 ], [ 119, 106 ], [ 110, 107 ], [ 118, 110 ], [ 112, 113 ], [ 118, 119 ], [ 121, 122 ] ]
[ "import math\n\ndef solve(ratio_list):\n a = 0\n b = 0\n for p, q in ratio_list:\n if a == 0 and b == 0:\n a = p\n b = q\n else:\n fact1 = -(-a//p)\n fact2 = -(-b//q)\n factor = int(max(fact1, fact2))\n a = factor*p\n b = factor*q\n return a,b\n\n\nif __name__ == \"__main__\":\n n = int(input())\n ratio = [tuple(map(int, input().split())) for _ in range(n)]\n a,b = solve(ratio)\n print(a+b)", "import math", "math", "def solve(ratio_list):\n a = 0\n b = 0\n for p, q in ratio_list:\n if a == 0 and b == 0:\n a = p\n b = q\n else:\n fact1 = -(-a//p)\n fact2 = -(-b//q)\n factor = int(max(fact1, fact2))\n a = factor*p\n b = factor*q\n return a,b", "solve", "a = 0", "a", "0", "b = 0", "b", "0", "for p, q in ratio_list:\n if a == 0 and b == 0:\n a = p\n b = q\n else:\n fact1 = -(-a//p)\n fact2 = -(-b//q)\n factor = int(max(fact1, fact2))\n a = factor*p\n b = factor*q\n ", "p", "q", "ratio_list", "if a == 0 and b == 0:\n a = p\n b = q\n else:\n fact1 = -(-a//p)\n fact2 = -(-b//q)\n factor = int(max(fact1, fact2))\n a = factor*p\n b = factor*q\n ", "a == 0 and b == 0", "a == 0", "a", "0", "b == 0", "b", "0", "a = p", "a", "p", "b = q", "b", "q", "fact1 = -(-a//p)", "fact1", "-(-a//p)", "-a//p", "-a", "a", "p", "fact2 = -(-b//q)", "fact2", "-(-b//q)", "-b//q", "-b", "b", "q", "factor = int(max(fact1, fact2))", "factor", "int(max(fact1, fact2))", "int", "max(fact1, fact2)", "max", "fact1", "fact2", "a = factor*p", "a", "factor*p", "factor", "p", "b = factor*q", "b", "factor*q", "factor", "q", "return a,b", "return a,b", "a", "b", "ratio_list", "ratio_list", "if __name__ == \"__main__\":\n n = int(input())\n ratio = [tuple(map(int, input().split())) for _ in range(n)]\n a,b = solve(ratio)\n print(a+b)", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "n = int(input())", "n", "int(input())", "int", "input()", "input", "tuple(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "tuple(map(int, input().split()))", "tuple", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ratio = [tuple(map(int, input().split())) for _ in range(n)]", "ratio", "[tuple(map(int, input().split())) for _ in range(n)]", "a,b = solve(ratio)", "a", "solve(ratio)", "solve", "ratio", "b", "print(a+b)", "print", "a+b", "a", "b", "b = solve(ratio)", "solve(ratio)", "b", "ratio = [tuple(map(int, input().split())) for _ in range(n)]", "[tuple(map(int, input().split())) for _ in range(n)]", "ratio", "def solve(ratio_list):\n a = 0\n b = 0\n for p, q in ratio_list:\n if a == 0 and b == 0:\n a = p\n b = q\n else:\n fact1 = -(-a//p)\n fact2 = -(-b//q)\n factor = int(max(fact1, fact2))\n a = factor*p\n b = factor*q\n return a,b", "def solve(ratio_list):\n a = 0\n b = 0\n for p, q in ratio_list:\n if a == 0 and b == 0:\n a = p\n b = q\n else:\n fact1 = -(-a//p)\n fact2 = -(-b//q)\n factor = int(max(fact1, fact2))\n a = factor*p\n b = factor*q\n return a,b", "solve", "a,b = solve(ratio)", "solve(ratio)", "a", "n = int(input())", "int(input())", "n" ]
import math def solve(ratio_list): a = 0 b = 0 for p, q in ratio_list: if a == 0 and b == 0: a = p b = q else: fact1 = -(-a//p) fact2 = -(-b//q) factor = int(max(fact1, fact2)) a = factor*p b = factor*q return a,b if __name__ == "__main__": n = int(input()) ratio = [tuple(map(int, input().split())) for _ in range(n)] a,b = solve(ratio) print(a+b)
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 13, 0, 13, 13, 0, 13, 18, 18, 13, 17, 17, 0, 13, 18, 18, 13, 17, 17, 28, 13, 4, 13, 2, 13, 17, 0, 13, 39, 40, 2, 40, 13, 18, 18, 13, 2, 13, 17, 17, 40, 2, 40, 13, 18, 18, 13, 2, 13, 17, 17, 0, 13, 2, 4, 13, 13, 18, 18, 13, 2, 13, 17, 17, 0, 13, 2, 4, 13, 13, 18, 18, 13, 2, 13, 17, 17, 4, 13, 2, 13, 13, 10, 2, 13, 10, 2, 13, 10, 18, 13, 10, 39, 13, 10, 18, 13, 10, 4, 13, 10, 13, 13 ]
[ [ 111, 2 ], [ 10, 9 ], [ 112, 12 ], [ 114, 16 ], [ 108, 19 ], [ 115, 22 ], [ 102, 26 ], [ 115, 29 ], [ 34, 33 ], [ 112, 37 ], [ 105, 40 ], [ 109, 45 ], [ 100, 45 ], [ 115, 48 ], [ 33, 50 ], [ 103, 56 ], [ 97, 56 ], [ 115, 59 ], [ 33, 61 ], [ 99, 65 ], [ 106, 69 ], [ 115, 72 ], [ 33, 74 ], [ 96, 78 ], [ 106, 82 ], [ 115, 85 ], [ 33, 87 ], [ 100, 93 ], [ 109, 93 ], [ 97, 94 ], [ 103, 94 ], [ 96, 97 ], [ 99, 100 ], [ 102, 103 ], [ 105, 106 ], [ 108, 109 ], [ 111, 112 ], [ 114, 115 ] ]
[ "n = int(input())\ne = [[int(i) for i in input().split()] for i in range(n)] \na=e[0][0]\nb=e[0][1]\nfor i in range(n-1):\n k=[-(-a//(e[i+1][0])),-(-b//(e[i+1][1]))]\n a=max(k)*(e[i+1][0])\n b=max(k)*(e[i+1][1])\nprint(a+b)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "[int(i) for i in input().split()] for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "[int(i) for i in input().split()]", "e = [[int(i) for i in input().split()] for i in range(n)]", "e", "[[int(i) for i in input().split()] for i in range(n)]", "a=e[0][0]", "a", "e[0][0]", "[0]", "e", "0", "0", "b=e[0][1]", "b", "e[0][1]", "[0]", "e", "0", "1", "for i in range(n-1):\n k=[-(-a//(e[i+1][0])),-(-b//(e[i+1][1]))]\n a=max(k)*(e[i+1][0])\n b=max(k)*(e[i+1][1])", "i", "range(n-1)", "range", "n-1", "n", "1", "k=[-(-a//(e[i+1][0])),-(-b//(e[i+1][1]))]", "k", "[-(-a//(e[i+1][0])),-(-b//(e[i+1][1]))]", "-(-a//(e[i+1][0]))", "-a//(e[i+1][0])", "-a", "a", "e[i+1][0]", "[i+1]", "e", "i+1", "i", "1", "0", "-(-b//(e[i+1][1]))", "-b//(e[i+1][1])", "-b", "b", "e[i+1][1]", "[i+1]", "e", "i+1", "i", "1", "1", "a=max(k)*(e[i+1][0])", "a", "max(k)*(e[i+1][0])", "max(k)", "max", "k", "e[i+1][0]", "[i+1]", "e", "i+1", "i", "1", "0", "b=max(k)*(e[i+1][1])", "b", "max(k)*(e[i+1][1])", "max(k)", "max", "k", "e[i+1][1]", "[i+1]", "e", "i+1", "i", "1", "1", "print(a+b)", "print", "a+b", "a", "b", "b=max(k)*(e[i+1][1])", "max(k)*(e[i+1][1])", "b", "a=max(k)*(e[i+1][0])", "max(k)*(e[i+1][0])", "a", "b=e[0][1]", "e[0][1]", "b", "k=[-(-a//(e[i+1][0])),-(-b//(e[i+1][1]))]", "[-(-a//(e[i+1][0])),-(-b//(e[i+1][1]))]", "k", "a=e[0][0]", "e[0][0]", "a", "n = int(input())", "int(input())", "n", "e = [[int(i) for i in input().split()] for i in range(n)]", "[[int(i) for i in input().split()] for i in range(n)]", "e" ]
n = int(input()) e = [[int(i) for i in input().split()] for i in range(n)] a=e[0][0] b=e[0][1] for i in range(n-1): k=[-(-a//(e[i+1][0])),-(-b//(e[i+1][1]))] a=max(k)*(e[i+1][0]) b=max(k)*(e[i+1][1]) print(a+b)
[ 7, 15, 15, 13, 0, 13, 4, 13, 4, 18, 4, 18, 13, 13, 13, 41, 28, 13, 4, 18, 4, 18, 4, 18, 13, 13, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 41, 28, 13, 4, 18, 4, 18, 4, 18, 13, 13, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 13, 13 ]
[ [ 107, 5 ], [ 18, 17 ], [ 17, 31 ], [ 116, 33 ], [ 116, 35 ], [ 38, 37 ], [ 108, 41 ], [ 46, 45 ], [ 45, 59 ], [ 119, 61 ], [ 119, 63 ], [ 98, 65 ], [ 117, 71 ], [ 114, 71 ], [ 120, 72 ], [ 120, 74 ], [ 111, 78 ], [ 102, 78 ], [ 105, 79 ], [ 105, 81 ], [ 113, 83 ], [ 99, 85 ], [ 120, 86 ], [ 101, 88 ], [ 99, 90 ], [ 105, 91 ], [ 114, 95 ], [ 117, 95 ], [ 102, 96 ], [ 111, 96 ], [ 98, 99 ], [ 101, 102 ], [ 119, 105 ], [ 107, 108 ], [ 116, 111 ], [ 113, 114 ], [ 116, 117 ], [ 119, 120 ] ]
[ "from sys import stdin\nimport math\nN = int(stdin.readline().rstrip())\nt,a = [int(x) for x in stdin.readline().rstrip().split()]\n \nfor _ in range(N-1):\n T,A = [int(x) for x in stdin.readline().rstrip().split()]\n n = max((t + T - 1) // T,(a + A - 1) // A)\n t = n*T\n a = n*A\n \nprint(t+a)", "from sys import stdin", "import math", "math", "N = int(stdin.readline().rstrip())", "N", "int(stdin.readline().rstrip())", "int", "stdin.readline().rstrip()", "stdin.readline().rstrip", "stdin.readline()", "stdin.readline", "stdin", "readline", "rstrip", "int(x) for x in stdin.readline().rstrip().split()", "for x in stdin.readline().rstrip().split()", "x", "stdin.readline().rstrip().split()", "stdin.readline().rstrip().split", "stdin.readline().rstrip()", "stdin.readline().rstrip", "stdin.readline()", "stdin.readline", "stdin", "readline", "rstrip", "split", "for x in stdin.readline().rstrip().split()", "int(x)", "int", "x", "t,a = [int(x) for x in stdin.readline().rstrip().split()]", "t", "[int(x) for x in stdin.readline().rstrip().split()]", "a", "for _ in range(N-1):\n T,A = [int(x) for x in stdin.readline().rstrip().split()]\n n = max((t + T - 1) // T,(a + A - 1) // A)\n t = n*T\n a = n*A\n ", "_", "range(N-1)", "range", "N-1", "N", "1", "int(x) for x in stdin.readline().rstrip().split()", "for x in stdin.readline().rstrip().split()", "x", "stdin.readline().rstrip().split()", "stdin.readline().rstrip().split", "stdin.readline().rstrip()", "stdin.readline().rstrip", "stdin.readline()", "stdin.readline", "stdin", "readline", "rstrip", "split", "for x in stdin.readline().rstrip().split()", "int(x)", "int", "x", "T,A = [int(x) for x in stdin.readline().rstrip().split()]", "T", "[int(x) for x in stdin.readline().rstrip().split()]", "A", "n = max((t + T - 1) // T,(a + A - 1) // A)", "n", "max((t + T - 1) // T,(a + A - 1) // A)", "max", "(t + T - 1) // T", "t + T - 1", "t + T", "t", "T", "1", "T", "(a + A - 1) // A", "a + A - 1", "a + A", "a", "A", "1", "A", "t = n*T", "t", "n*T", "n", "T", "a = n*A", "a", "n*A", "n", "A", "print(t+a)", "print", "t+a", "t", "a", "n = max((t + T - 1) // T,(a + A - 1) // A)", "max((t + T - 1) // T,(a + A - 1) // A)", "n", "a = n*A", "n*A", "a", "A = [int(x) for x in stdin.readline().rstrip().split()]", "[int(x) for x in stdin.readline().rstrip().split()]", "A", "N = int(stdin.readline().rstrip())", "int(stdin.readline().rstrip())", "N", "a = [int(x) for x in stdin.readline().rstrip().split()]", "[int(x) for x in stdin.readline().rstrip().split()]", "a", "t = n*T", "n*T", "t", "t,a = [int(x) for x in stdin.readline().rstrip().split()]", "[int(x) for x in stdin.readline().rstrip().split()]", "t", "T,A = [int(x) for x in stdin.readline().rstrip().split()]", "[int(x) for x in stdin.readline().rstrip().split()]", "T" ]
from sys import stdin import math N = int(stdin.readline().rstrip()) t,a = [int(x) for x in stdin.readline().rstrip().split()] for _ in range(N-1): T,A = [int(x) for x in stdin.readline().rstrip().split()] n = max((t + T - 1) // T,(a + A - 1) // A) t = n*T a = n*A print(t+a)
[ 7, 15, 15, 0, 18, 4, 13, 13, 17, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 4, 13, 2, 4, 13, 4, 13, 13, 4, 13, 13, 4, 13, 2, 4, 13, 4, 13, 13, 4, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 8, 4 ], [ 90, 10 ], [ 84, 16 ], [ 87, 18 ], [ 22, 21 ], [ 91, 24 ], [ 93, 26 ], [ 93, 35 ], [ 96, 37 ], [ 85, 47 ], [ 82, 47 ], [ 94, 50 ], [ 88, 58 ], [ 100, 58 ], [ 79, 61 ], [ 81, 63 ], [ 97, 65 ], [ 94, 66 ], [ 99, 68 ], [ 97, 70 ], [ 79, 71 ], [ 82, 75 ], [ 85, 75 ], [ 100, 76 ], [ 88, 76 ], [ 93, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ], [ 90, 91 ], [ 93, 94 ], [ 96, 97 ], [ 99, 100 ] ]
[ "from decimal import Decimal,getcontext\nfrom math import ceil\ngetcontext().prec = 1000\nN = int(input())\n \ntakahashi,aoki = 1,1\n \nfor _ in range(N):\n a,b = map(int,input().split())\n c = max(ceil(Decimal(str(takahashi))/Decimal(a)),ceil(Decimal(str(aoki))/Decimal(b)))\n takahashi = c*a\n aoki = c*b\n \nprint(takahashi+aoki)", "from decimal import Decimal,getcontext", "from math import ceil", "getcontext().prec = 1000", "getcontext().prec", "()", "getcontext", "prec", "1000", "N = int(input())", "N", "int(input())", "int", "input()", "input", "takahashi,aoki = 1,1", "takahashi", "1", "aoki", "1", "for _ in range(N):\n a,b = map(int,input().split())\n c = max(ceil(Decimal(str(takahashi))/Decimal(a)),ceil(Decimal(str(aoki))/Decimal(b)))\n takahashi = c*a\n aoki = c*b\n ", "_", "range(N)", "range", "N", "a,b = map(int,input().split())", "a", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "c = max(ceil(Decimal(str(takahashi))/Decimal(a)),ceil(Decimal(str(aoki))/Decimal(b)))", "c", "max(ceil(Decimal(str(takahashi))/Decimal(a)),ceil(Decimal(str(aoki))/Decimal(b)))", "max", "ceil(Decimal(str(takahashi))/Decimal(a))", "ceil", "Decimal(str(takahashi))/Decimal(a)", "Decimal(str(takahashi))", "Decimal", "str(takahashi)", "str", "takahashi", "Decimal(a)", "Decimal", "a", "ceil(Decimal(str(aoki))/Decimal(b))", "ceil", "Decimal(str(aoki))/Decimal(b)", "Decimal(str(aoki))", "Decimal", "str(aoki)", "str", "aoki", "Decimal(b)", "Decimal", "b", "takahashi = c*a", "takahashi", "c*a", "c", "a", "aoki = c*b", "aoki", "c*b", "c", "b", "print(takahashi+aoki)", "print", "takahashi+aoki", "takahashi", "aoki", "b = map(int,input().split())", "map(int,input().split())", "b", "takahashi = c*a", "c*a", "takahashi", "takahashi,aoki = 1,1", "1", "takahashi", "aoki = 1,1", "1", "aoki", "N = int(input())", "int(input())", "N", "a,b = map(int,input().split())", "map(int,input().split())", "a", "c = max(ceil(Decimal(str(takahashi))/Decimal(a)),ceil(Decimal(str(aoki))/Decimal(b)))", "max(ceil(Decimal(str(takahashi))/Decimal(a)),ceil(Decimal(str(aoki))/Decimal(b)))", "c", "aoki = c*b", "c*b", "aoki" ]
from decimal import Decimal,getcontext from math import ceil getcontext().prec = 1000 N = int(input()) takahashi,aoki = 1,1 for _ in range(N): a,b = map(int,input().split()) c = max(ceil(Decimal(str(takahashi))/Decimal(a)),ceil(Decimal(str(aoki))/Decimal(b))) takahashi = c*a aoki = c*b print(takahashi+aoki)
[ 7, 15, 13, 15, 13, 0, 13, 4, 13, 4, 13, 0, 13, 39, 28, 13, 4, 13, 13, 41, 28, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 4, 18, 13, 13, 39, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 39, 28, 13, 13, 0, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 18, 13, 13, 13, 4, 13, 18, 13, 17, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13, 10, 13, 13, 10, 2, 13, 10, 17, 13, 10, 39, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 39, 13, 10, 2, 13 ]
[ [ 122, 6 ], [ 149, 12 ], [ 16, 15 ], [ 123, 18 ], [ 22, 21 ], [ 21, 34 ], [ 119, 36 ], [ 119, 38 ], [ 150, 41 ], [ 143, 47 ], [ 125, 50 ], [ 134, 53 ], [ 137, 56 ], [ 60, 59 ], [ 150, 59 ], [ 128, 62 ], [ 59, 63 ], [ 128, 64 ], [ 131, 66 ], [ 129, 68 ], [ 120, 68 ], [ 111, 69 ], [ 117, 69 ], [ 140, 71 ], [ 126, 77 ], [ 147, 77 ], [ 111, 78 ], [ 117, 78 ], [ 135, 82 ], [ 114, 82 ], [ 129, 83 ], [ 120, 83 ], [ 146, 85 ], [ 141, 87 ], [ 111, 88 ], [ 117, 88 ], [ 113, 90 ], [ 141, 92 ], [ 129, 93 ], [ 120, 93 ], [ 152, 95 ], [ 141, 97 ], [ 132, 98 ], [ 138, 101 ], [ 153, 103 ], [ 144, 103 ], [ 138, 107 ], [ 59, 110 ], [ 128, 111 ], [ 113, 114 ], [ 119, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ], [ 59, 128 ], [ 128, 129 ], [ 131, 132 ], [ 134, 135 ], [ 137, 138 ], [ 140, 141 ], [ 143, 144 ], [ 146, 147 ], [ 149, 150 ], [ 152, 153 ] ]
[ "import sys\nimport math\nn = int(input())\nls = []\nfor i in range(n):\n t, a = [int(i) for i in sys.stdin.readline().split()]\n ls.append((t, a))\n_min = 1e-10\n_min_a = 1\n_min_t = 1\nres = []\nfor l in ls:\n t, a = l\n _sum = t + a\n cnt = max(-(-_min_a//a), -(-_min_t//t))\n _min_a = cnt * a\n _min_t = cnt * t\n _min = cnt * _sum\n res.append(_min)\nprint(res[-1])", "import sys", "sys", "import math", "math", "n = int(input())", "n", "int(input())", "int", "input()", "input", "ls = []", "ls", "[]", "for i in range(n):\n t, a = [int(i) for i in sys.stdin.readline().split()]\n ls.append((t, a))", "i", "range(n)", "range", "n", "int(i) for i in sys.stdin.readline().split()", "for i in sys.stdin.readline().split()", "i", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "for i in sys.stdin.readline().split()", "int(i)", "int", "i", "t, a = [int(i) for i in sys.stdin.readline().split()]", "t", "[int(i) for i in sys.stdin.readline().split()]", "a", "ls.append((t, a))", "ls.append", "ls", "append", "(t, a)", "t", "a", "_min = 1e-10", "_min", "1e-10", "_min_a = 1", "_min_a", "1", "_min_t = 1", "_min_t", "1", "res = []", "res", "[]", "for l in ls:\n t, a = l\n _sum = t + a\n cnt = max(-(-_min_a//a), -(-_min_t//t))\n _min_a = cnt * a\n _min_t = cnt * t\n _min = cnt * _sum\n res.append(_min)", "l", "ls", "t, a = l", "t", "l", "a", "_sum = t + a", "_sum", "t + a", "t", "a", "cnt = max(-(-_min_a//a), -(-_min_t//t))", "cnt", "max(-(-_min_a//a), -(-_min_t//t))", "max", "-(-_min_a//a)", "-_min_a//a", "-_min_a", "_min_a", "a", "-(-_min_t//t)", "-_min_t//t", "-_min_t", "_min_t", "t", "_min_a = cnt * a", "_min_a", "cnt * a", "cnt", "a", "_min_t = cnt * t", "_min_t", "cnt * t", "cnt", "t", "_min = cnt * _sum", "_min", "cnt * _sum", "cnt", "_sum", "res.append(_min)", "res.append", "res", "append", "_min", "print(res[-1])", "print", "res[-1]", "res", "-1", "a = l", "l", "a", "_min_t = cnt * t", "cnt * t", "_min_t", "a = [int(i) for i in sys.stdin.readline().split()]", "[int(i) for i in sys.stdin.readline().split()]", "a", "t, a = [int(i) for i in sys.stdin.readline().split()]", "[int(i) for i in sys.stdin.readline().split()]", "t", "n = int(input())", "int(input())", "n", "_min_a = 1", "1", "_min_a", "t, a = l", "l", "t", "_sum = t + a", "t + a", "_sum", "_min_t = 1", "1", "_min_t", "res = []", "[]", "res", "cnt = max(-(-_min_a//a), -(-_min_t//t))", "max(-(-_min_a//a), -(-_min_t//t))", "cnt", "_min = 1e-10", "1e-10", "_min", "_min_a = cnt * a", "cnt * a", "_min_a", "ls = []", "[]", "ls", "_min = cnt * _sum", "cnt * _sum", "_min" ]
import sys import math n = int(input()) ls = [] for i in range(n): t, a = [int(i) for i in sys.stdin.readline().split()] ls.append((t, a)) _min = 1e-10 _min_a = 1 _min_t = 1 res = [] for l in ls: t, a = l _sum = t + a cnt = max(-(-_min_a//a), -(-_min_t//t)) _min_a = cnt * a _min_t = cnt * t _min = cnt * _sum res.append(_min) print(res[-1])
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 15, 13, 0, 13, 18, 13, 17, 28, 13, 4, 13, 17, 13, 0, 13, 18, 18, 13, 13, 17, 0, 13, 18, 18, 13, 13, 17, 0, 13, 2, 18, 13, 17, 13, 14, 40, 2, 13, 13, 18, 13, 17, 0, 13, 17, 0, 13, 2, 18, 13, 17, 13, 14, 40, 2, 13, 13, 18, 13, 17, 0, 13, 17, 0, 13, 4, 13, 13, 13, 0, 13, 39, 2, 13, 13, 2, 13, 13, 4, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 39, 13, 10, 2, 13, 10, 18, 13, 10, 17, 13, 10, 13, 13, 10, 18, 13, 10, 2, 13, 10, 17, 13, 10, 18, 13 ]
[ [ 111, 2 ], [ 10, 9 ], [ 112, 12 ], [ 129, 25 ], [ 141, 30 ], [ 130, 32 ], [ 36, 35 ], [ 112, 39 ], [ 132, 41 ], [ 130, 44 ], [ 35, 45 ], [ 123, 48 ], [ 130, 51 ], [ 35, 52 ], [ 135, 55 ], [ 142, 58 ], [ 118, 58 ], [ 133, 60 ], [ 136, 64 ], [ 139, 64 ], [ 133, 65 ], [ 142, 67 ], [ 118, 67 ], [ 138, 70 ], [ 120, 73 ], [ 142, 76 ], [ 118, 76 ], [ 124, 78 ], [ 121, 82 ], [ 127, 82 ], [ 124, 83 ], [ 142, 85 ], [ 118, 85 ], [ 126, 88 ], [ 114, 91 ], [ 139, 94 ], [ 136, 94 ], [ 127, 95 ], [ 121, 95 ], [ 117, 97 ], [ 115, 100 ], [ 133, 101 ], [ 115, 103 ], [ 124, 104 ], [ 118, 109 ], [ 142, 109 ], [ 111, 112 ], [ 114, 115 ], [ 117, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ], [ 129, 130 ], [ 132, 133 ], [ 135, 136 ], [ 138, 139 ], [ 141, 142 ] ]
[ "n = int(input())\nta = [list(map(int, input().split())) for _ in range(n)]\n\nimport math\ndp = ta[0]\nfor i in range(1, n):\n t = ta[i][0]\n a = ta[i][1]\n\n k1 = dp[0] // t\n if k1 * t != dp[0]:\n k1 += 1\n k2 = dp[1] // a\n if k2 * a != dp[1]:\n k2 += 1\n k = max(k1, k2)\n\n dp = [k * t, k * a]\nprint(sum(dp))", "n = int(input())", "n", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ta = [list(map(int, input().split())) for _ in range(n)]", "ta", "[list(map(int, input().split())) for _ in range(n)]", "import math", "math", "dp = ta[0]", "dp", "ta[0]", "ta", "0", "for i in range(1, n):\n t = ta[i][0]\n a = ta[i][1]\n\n k1 = dp[0] // t\n if k1 * t != dp[0]:\n k1 += 1\n k2 = dp[1] // a\n if k2 * a != dp[1]:\n k2 += 1\n k = max(k1, k2)\n\n dp = [k * t, k * a]", "i", "range(1, n)", "range", "1", "n", "t = ta[i][0]", "t", "ta[i][0]", "[i]", "ta", "i", "0", "a = ta[i][1]", "a", "ta[i][1]", "[i]", "ta", "i", "1", "k1 = dp[0] // t", "k1", "dp[0] // t", "dp[0]", "dp", "0", "t", "if k1 * t != dp[0]:\n k1 += 1\n ", "k1 * t != dp[0]", "k1 * t", "k1", "t", "dp[0]", "dp", "0", "k1 += 1", "k1", "1", "k2 = dp[1] // a", "k2", "dp[1] // a", "dp[1]", "dp", "1", "a", "if k2 * a != dp[1]:\n k2 += 1\n ", "k2 * a != dp[1]", "k2 * a", "k2", "a", "dp[1]", "dp", "1", "k2 += 1", "k2", "1", "k = max(k1, k2)", "k", "max(k1, k2)", "max", "k1", "k2", "dp = [k * t, k * a]", "dp", "[k * t, k * a]", "k * t", "k", "t", "k * a", "k", "a", "print(sum(dp))", "print", "sum(dp)", "sum", "dp", "n = int(input())", "int(input())", "n", "k = max(k1, k2)", "max(k1, k2)", "k", "dp = [k * t, k * a]", "[k * t, k * a]", "dp", "k2 = dp[1] // a", "dp[1] // a", "k2", "a = ta[i][1]", "ta[i][1]", "a", "k2 += 1", "1", "k2", "ta = [list(map(int, input().split())) for _ in range(n)]", "[list(map(int, input().split())) for _ in range(n)]", "ta", "t = ta[i][0]", "ta[i][0]", "t", "k1 = dp[0] // t", "dp[0] // t", "k1", "k1 += 1", "1", "k1", "dp = ta[0]", "ta[0]", "dp" ]
n = int(input()) ta = [list(map(int, input().split())) for _ in range(n)] import math dp = ta[0] for i in range(1, n): t = ta[i][0] a = ta[i][1] k1 = dp[0] // t if k1 * t != dp[0]: k1 += 1 k2 = dp[1] // a if k2 * a != dp[1]: k2 += 1 k = max(k1, k2) dp = [k * t, k * a] print(sum(dp))
[ 7, 17, 17, 17, 17, 17, 17, 12, 13, 29, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 12, 13, 15, 13, 15, 0, 13, 4, 13, 4, 13, 0, 13, 39, 17, 17, 28, 13, 4, 13, 13, 0, 13, 13, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 0, 13, 4, 18, 13, 13, 4, 13, 4, 13, 13, 13, 4, 13, 13, 13, 0, 13, 39, 2, 13, 13, 2, 13, 13, 4, 13, 4, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 27, 26 ], [ 33, 32 ], [ 38, 37 ], [ 26, 40 ], [ 43, 42 ], [ 32, 43 ], [ 78, 43 ], [ 43, 44 ], [ 48, 47 ], [ 47, 56 ], [ 59, 58 ], [ 59, 60 ], [ 63, 62 ], [ 42, 71 ], [ 58, 72 ], [ 44, 75 ], [ 60, 76 ], [ 79, 78 ], [ 62, 81 ], [ 58, 82 ], [ 62, 84 ], [ 60, 85 ], [ 78, 92 ], [ 32, 92 ], [ 104, 98 ] ]
[ "#\n# Written by NoKnowledgeGG @YlePhan\n# ('ฯ‰')\n#\n#import math\n#mod = 10**9+7\n#import itertools\n#import fractions\n#import numpy as np\n#mod = 10**4 + 7\n\"\"\"def kiri(n,m):\n r_ = n / m\n if (r_ - (n // m)) > 0:\n return (n//m) + 1\n else:\n return (n//m)\"\"\"\n\n\"\"\" n! mod m ้šŽไน—\nmod = 1e9 + 7\nN = 10000000\nfac = [0] * N\ndef ini():\n fac[0] = 1 % mod\n for i in range(1,N):\n fac[i] = fac[i-1] * i % mod\"\"\"\n\n\"\"\"mod = 1e9+7\nN = 10000000\npw = [0] * N\ndef ini(c):\n pw[0] = 1 % mod\n for i in range(1,N):\n pw[i] = pw[i-1] * c % mod\"\"\"\n\n\"\"\"\ndef YEILD():\n yield 'one'\n yield 'two'\n yield 'three'\ngenerator = YEILD()\nprint(next(generator))\nprint(next(generator))\nprint(next(generator))\n\"\"\"\n\"\"\"def gcd_(a,b):\n if b == 0:#็ตๅฑ€ใฏc,0ใฎๆœ€ๅคงๅ…ฌ็ด„ๆ•ฐใฏcใชใฎใซ\n return a\n return gcd_(a,a % b) # a = p * b + q\"\"\"\n\"\"\"def extgcd(a,b,x,y):\n d = a\n if b!=0:\n d = extgcd(b,a%b,y,x)\n y -= (a//b) * x\n print(x,y)\n else:\n x = 1\n y = 0\n return d\"\"\"\n\n\ndef readInts():\n return list(map(int,input().split()))\n\ndef main():\n import math\n from fractions import Fraction\n n = int(input())\n x = [1,1]\n for i in range(n):\n au,bu = x\n a,b = [int(i) for i in input().split()]\n \n nya = math.ceil(max(Fraction(au,a),Fraction(bu,b)))\n x = [nya*a, nya*b]\n print(int(sum(x)))\nif __name__ == '__main__':\n main()", "\"\"\"def kiri(n,m):\n r_ = n / m\n if (r_ - (n // m)) > 0:\n return (n//m) + 1\n else:\n return (n//m)\"\"\"", "\"\"\" n! mod m ้šŽไน—\nmod = 1e9 + 7\nN = 10000000\nfac = [0] * N\ndef ini():\n fac[0] = 1 % mod\n for i in range(1,N):\n fac[i] = fac[i-1] * i % mod\"\"\"", "\"\"\"mod = 1e9+7\nN = 10000000\npw = [0] * N\ndef ini(c):\n pw[0] = 1 % mod\n for i in range(1,N):\n pw[i] = pw[i-1] * c % mod\"\"\"", "\"\"\"\ndef YEILD():\n yield 'one'\n yield 'two'\n yield 'three'\ngenerator = YEILD()\nprint(next(generator))\nprint(next(generator))\nprint(next(generator))\n\"\"\"", "\"\"\"def gcd_(a,b):\n if b == 0:#็ตๅฑ€ใฏc,0ใฎๆœ€ๅคงๅ…ฌ็ด„ๆ•ฐใฏcใชใฎใซ\n return a\n return gcd_(a,a % b) # a = p * b + q\"\"\"", "\"\"\"def extgcd(a,b,x,y):\n d = a\n if b!=0:\n d = extgcd(b,a%b,y,x)\n y -= (a//b) * x\n print(x,y)\n else:\n x = 1\n y = 0\n return d\"\"\"", "def readInts():\n return list(map(int,input().split()))", "readInts", "return list(map(int,input().split()))", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "def main():\n import math\n from fractions import Fraction\n n = int(input())\n x = [1,1]\n for i in range(n):\n au,bu = x\n a,b = [int(i) for i in input().split()]\n \n nya = math.ceil(max(Fraction(au,a),Fraction(bu,b)))\n x = [nya*a, nya*b]\n print(int(sum(x)))", "main", "import math", "math", "from fractions import Fraction", "n = int(input())", "n", "int(input())", "int", "input()", "input", "x = [1,1]", "x", "[1,1]", "1", "1", "for i in range(n):\n au,bu = x\n a,b = [int(i) for i in input().split()]\n \n nya = math.ceil(max(Fraction(au,a),Fraction(bu,b)))\n x = [nya*a, nya*b]\n ", "i", "range(n)", "range", "n", "au,bu = x", "au", "x", "bu", "int(i) for i in input().split()", "for i in input().split()", "i", "input().split()", "().split", "()", "input", "split", "for i in input().split()", "int(i)", "int", "i", "a,b = [int(i) for i in input().split()]", "a", "[int(i) for i in input().split()]", "b", "nya = math.ceil(max(Fraction(au,a),Fraction(bu,b)))", "nya", "math.ceil(max(Fraction(au,a),Fraction(bu,b)))", "math.ceil", "math", "ceil", "max(Fraction(au,a),Fraction(bu,b))", "max", "Fraction(au,a)", "Fraction", "au", "a", "Fraction(bu,b)", "Fraction", "bu", "b", "x = [nya*a, nya*b]", "x", "[nya*a, nya*b]", "nya*a", "nya", "a", "nya*b", "nya", "b", "print(int(sum(x)))", "print", "int(sum(x))", "int", "sum(x)", "sum", "x", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def readInts():\n return list(map(int,input().split()))", "def readInts():\n return list(map(int,input().split()))", "readInts", "def main():\n import math\n from fractions import Fraction\n n = int(input())\n x = [1,1]\n for i in range(n):\n au,bu = x\n a,b = [int(i) for i in input().split()]\n \n nya = math.ceil(max(Fraction(au,a),Fraction(bu,b)))\n x = [nya*a, nya*b]\n print(int(sum(x)))", "def main():\n import math\n from fractions import Fraction\n n = int(input())\n x = [1,1]\n for i in range(n):\n au,bu = x\n a,b = [int(i) for i in input().split()]\n \n nya = math.ceil(max(Fraction(au,a),Fraction(bu,b)))\n x = [nya*a, nya*b]\n print(int(sum(x)))", "main" ]
# # Written by NoKnowledgeGG @YlePhan # ('ฯ‰') # #import math #mod = 10**9+7 #import itertools #import fractions #import numpy as np #mod = 10**4 + 7 """def kiri(n,m): r_ = n / m if (r_ - (n // m)) > 0: return (n//m) + 1 else: return (n//m)""" """ n! mod m ้šŽไน— mod = 1e9 + 7 N = 10000000 fac = [0] * N def ini(): fac[0] = 1 % mod for i in range(1,N): fac[i] = fac[i-1] * i % mod""" """mod = 1e9+7 N = 10000000 pw = [0] * N def ini(c): pw[0] = 1 % mod for i in range(1,N): pw[i] = pw[i-1] * c % mod""" """ def YEILD(): yield 'one' yield 'two' yield 'three' generator = YEILD() print(next(generator)) print(next(generator)) print(next(generator)) """ """def gcd_(a,b): if b == 0:#็ตๅฑ€ใฏc,0ใฎๆœ€ๅคงๅ…ฌ็ด„ๆ•ฐใฏcใชใฎใซ return a return gcd_(a,a % b) # a = p * b + q""" """def extgcd(a,b,x,y): d = a if b!=0: d = extgcd(b,a%b,y,x) y -= (a//b) * x print(x,y) else: x = 1 y = 0 return d""" def readInts(): return list(map(int,input().split())) def main(): import math from fractions import Fraction n = int(input()) x = [1,1] for i in range(n): au,bu = x a,b = [int(i) for i in input().split()] nya = math.ceil(max(Fraction(au,a),Fraction(bu,b))) x = [nya*a, nya*b] print(int(sum(x))) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 17, 13, 17, 28, 13, 13, 13, 0, 13, 13, 13, 13, 0, 13, 4, 13, 2, 13, 13, 2, 13, 13, 42, 2, 2, 13, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 17, 0, 13, 13, 13, 13, 4, 13, 2, 13, 13, 10, 13, 13, 10, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 13, 13, 10, 17, 13, 10, 13, 13, 10, 13, 13 ]
[ [ 104, 2 ], [ 10, 9 ], [ 105, 12 ], [ 86, 25 ], [ 89, 28 ], [ 110, 30 ], [ 107, 37 ], [ 116, 39 ], [ 95, 42 ], [ 90, 46 ], [ 84, 46 ], [ 111, 49 ], [ 114, 49 ], [ 108, 54 ], [ 99, 54 ], [ 90, 55 ], [ 84, 55 ], [ 117, 57 ], [ 102, 57 ], [ 111, 58 ], [ 114, 58 ], [ 98, 60 ], [ 96, 63 ], [ 93, 63 ], [ 101, 65 ], [ 96, 68 ], [ 93, 68 ], [ 92, 70 ], [ 83, 73 ], [ 99, 74 ], [ 108, 74 ], [ 113, 75 ], [ 102, 76 ], [ 117, 76 ], [ 84, 80 ], [ 90, 80 ], [ 114, 81 ], [ 111, 81 ], [ 99, 83 ], [ 108, 83 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ], [ 101, 102 ], [ 104, 105 ], [ 107, 108 ], [ 110, 111 ], [ 102, 113 ], [ 117, 113 ], [ 113, 114 ], [ 116, 117 ] ]
[ "n = int(input())\nvotes = [list(map(int, input().split())) for _ in range(n)]\n\ncurr_a, curr_b = 0, 0\n\nfor v1, v2 in votes:\n a, b = v1, v2\n i = max(curr_a // v1, curr_b // v2)\n\n while a < curr_a or b < curr_b:\n a = v1 * i\n b = v2 * i\n i += 1\n\n curr_a, curr_b = a, b\n\nprint(curr_a + curr_b)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "votes = [list(map(int, input().split())) for _ in range(n)]", "votes", "[list(map(int, input().split())) for _ in range(n)]", "curr_a, curr_b = 0, 0", "curr_a", "0", "curr_b", "0", "for v1, v2 in votes:\n a, b = v1, v2\n i = max(curr_a // v1, curr_b // v2)\n\n while a < curr_a or b < curr_b:\n a = v1 * i\n b = v2 * i\n i += 1\n\n curr_a, curr_b = a, b", "v1", "v2", "votes", "a, b = v1, v2", "a", "v1", "b", "v2", "i = max(curr_a // v1, curr_b // v2)", "i", "max(curr_a // v1, curr_b // v2)", "max", "curr_a // v1", "curr_a", "v1", "curr_b // v2", "curr_b", "v2", "while a < curr_a or b < curr_b:\n a = v1 * i\n b = v2 * i\n i += 1\n\n ", "a < curr_a or b < curr_b", "a < curr_a", "a", "curr_a", "b < curr_b", "b", "curr_b", "a = v1 * i", "a", "v1 * i", "v1", "i", "b = v2 * i", "b", "v2 * i", "v2", "i", "i += 1", "i", "1", "curr_a, curr_b = a, b", "curr_a", "a", "curr_b", "b", "print(curr_a + curr_b)", "print", "curr_a + curr_b", "curr_a", "curr_b", "curr_a, curr_b = a, b", "a", "curr_a", "votes = [list(map(int, input().split())) for _ in range(n)]", "[list(map(int, input().split())) for _ in range(n)]", "votes", "curr_a, curr_b = 0, 0", "0", "curr_a", "i += 1", "1", "i", "i = max(curr_a // v1, curr_b // v2)", "max(curr_a // v1, curr_b // v2)", "i", "a = v1 * i", "v1 * i", "a", "b = v2 * i", "v2 * i", "b", "n = int(input())", "int(input())", "n", "a, b = v1, v2", "v1", "a", "curr_b = 0, 0", "0", "curr_b", "curr_b = a, b", "b", "curr_b", "b = v1, v2", "v2", "b" ]
n = int(input()) votes = [list(map(int, input().split())) for _ in range(n)] curr_a, curr_b = 0, 0 for v1, v2 in votes: a, b = v1, v2 i = max(curr_a // v1, curr_b // v2) while a < curr_a or b < curr_b: a = v1 * i b = v2 * i i += 1 curr_a, curr_b = a, b print(curr_a + curr_b)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 17, 13, 13, 2, 2, 2, 13, 17, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 87, 2 ], [ 75, 8 ], [ 75, 17 ], [ 20, 19 ], [ 88, 23 ], [ 84, 25 ], [ 84, 34 ], [ 72, 36 ], [ 70, 42 ], [ 79, 42 ], [ 85, 44 ], [ 85, 45 ], [ 76, 49 ], [ 91, 49 ], [ 82, 51 ], [ 82, 52 ], [ 78, 54 ], [ 85, 56 ], [ 73, 57 ], [ 90, 59 ], [ 82, 61 ], [ 73, 62 ], [ 79, 66 ], [ 70, 66 ], [ 91, 67 ], [ 76, 67 ], [ 75, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 84, 82 ], [ 84, 85 ], [ 87, 88 ], [ 90, 91 ] ]
[ "N = int(input())\nTT,AA= map(int,input().split())\nfor k in range(1,N):\n T,A = map(int,input().split())\n j = max((TT-1+T)//T,(AA-1+A)//A)\n TT = T*j \n AA = A*j\n \nprint(TT + AA)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "TT,AA= map(int,input().split())", "TT", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "AA", "for k in range(1,N):\n T,A = map(int,input().split())\n j = max((TT-1+T)//T,(AA-1+A)//A)\n TT = T*j \n AA = A*j\n ", "k", "range(1,N)", "range", "1", "N", "T,A = map(int,input().split())", "T", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "j = max((TT-1+T)//T,(AA-1+A)//A)", "j", "max((TT-1+T)//T,(AA-1+A)//A)", "max", "(TT-1+T)//T", "TT-1+T", "TT-1", "TT", "1", "T", "T", "(AA-1+A)//A", "AA-1+A", "AA-1", "AA", "1", "A", "A", "TT = T*j", "TT", "T*j", "T", "j", "AA = A*j", "AA", "A*j", "A", "j", "print(TT + AA)", "print", "TT + AA", "TT", "AA", "TT,AA= map(int,input().split())", "map(int,input().split())", "TT", "j = max((TT-1+T)//T,(AA-1+A)//A)", "max((TT-1+T)//T,(AA-1+A)//A)", "j", "AA= map(int,input().split())", "map(int,input().split())", "AA", "TT = T*j", "T*j", "TT", "A = map(int,input().split())", "map(int,input().split())", "A", "T,A = map(int,input().split())", "map(int,input().split())", "T", "N = int(input())", "int(input())", "N", "AA = A*j", "A*j", "AA" ]
N = int(input()) TT,AA= map(int,input().split()) for k in range(1,N): T,A = map(int,input().split()) j = max((TT-1+T)//T,(AA-1+A)//A) TT = T*j AA = A*j print(TT + AA)
[ 7, 15, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 2, 13 ]
[ [ 70, 3 ], [ 76, 9 ], [ 79, 12 ], [ 16, 15 ], [ 71, 18 ], [ 67, 20 ], [ 67, 29 ], [ 73, 31 ], [ 77, 37 ], [ 83, 37 ], [ 68, 38 ], [ 68, 40 ], [ 80, 44 ], [ 86, 44 ], [ 65, 45 ], [ 65, 47 ], [ 82, 49 ], [ 74, 51 ], [ 68, 52 ], [ 85, 54 ], [ 74, 56 ], [ 65, 57 ], [ 83, 61 ], [ 77, 61 ], [ 86, 62 ], [ 80, 62 ], [ 67, 65 ], [ 67, 68 ], [ 70, 71 ], [ 73, 74 ], [ 76, 77 ], [ 79, 80 ], [ 82, 83 ], [ 85, 86 ] ]
[ "from math import ceil\n \nn = int(input())\na = 1\nb = 1\n \nfor i in range(n):\n s,t = map(int,input().split())\n #x = max([ceil(a/s), ceil(b/t)])\n x = max((a+s-1)//s, (b+t-1)//t)\n\n \n a = x*s\n b = x*t\n\nprint(a+b)", "from math import ceil", "n = int(input())", "n", "int(input())", "int", "input()", "input", "a = 1", "a", "1", "b = 1", "b", "1", "for i in range(n):\n s,t = map(int,input().split())\n #x = max([ceil(a/s), ceil(b/t)])\n x = max((a+s-1)//s, (b+t-1)//t)\n\n \n a = x*s\n b = x*t", "i", "range(n)", "range", "n", "s,t = map(int,input().split())", "s", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "t", "x = max((a+s-1)//s, (b+t-1)//t)", "x", "max((a+s-1)//s, (b+t-1)//t)", "max", "(a+s-1)//s", "a+s-1", "a+s", "a", "s", "1", "s", "(b+t-1)//t", "b+t-1", "b+t", "b", "t", "1", "t", "a = x*s", "a", "x*s", "x", "s", "b = x*t", "b", "x*t", "x", "t", "print(a+b)", "print", "a+b", "a", "b", "t = map(int,input().split())", "map(int,input().split())", "t", "s,t = map(int,input().split())", "map(int,input().split())", "s", "n = int(input())", "int(input())", "n", "x = max((a+s-1)//s, (b+t-1)//t)", "max((a+s-1)//s, (b+t-1)//t)", "x", "a = 1", "1", "a", "b = 1", "1", "b", "a = x*s", "x*s", "a", "b = x*t", "x*t", "b" ]
from math import ceil n = int(input()) a = 1 b = 1 for i in range(n): s,t = map(int,input().split()) #x = max([ceil(a/s), ceil(b/t)]) x = max((a+s-1)//s, (b+t-1)//t) a = x*s b = x*t print(a+b)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 83, 2 ], [ 71, 8 ], [ 86, 11 ], [ 15, 14 ], [ 84, 17 ], [ 80, 19 ], [ 80, 30 ], [ 65, 32 ], [ 72, 38 ], [ 75, 38 ], [ 81, 39 ], [ 81, 41 ], [ 87, 45 ], [ 69, 45 ], [ 78, 46 ], [ 78, 48 ], [ 74, 50 ], [ 66, 52 ], [ 84, 52 ], [ 81, 53 ], [ 68, 55 ], [ 66, 57 ], [ 84, 57 ], [ 78, 58 ], [ 75, 62 ], [ 72, 62 ], [ 69, 63 ], [ 87, 63 ], [ 65, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ], [ 80, 78 ], [ 80, 81 ], [ 83, 84 ], [ 86, 87 ] ]
[ "n = int(input())\nvote_t = 1\nvote_a = 1\n \nfor _ in range(n):\n t,a = list(map(int, input().split()))\n n = max((vote_t + t - 1) // t, (vote_a + a -1) // a)\n vote_t = n * t\n vote_a = n * a\n\nprint(vote_t + vote_a)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "vote_t = 1", "vote_t", "1", "vote_a = 1", "vote_a", "1", "for _ in range(n):\n t,a = list(map(int, input().split()))\n n = max((vote_t + t - 1) // t, (vote_a + a -1) // a)\n vote_t = n * t\n vote_a = n * a", "_", "range(n)", "range", "n", "t,a = list(map(int, input().split()))", "t", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "n = max((vote_t + t - 1) // t, (vote_a + a -1) // a)", "n", "max((vote_t + t - 1) // t, (vote_a + a -1) // a)", "max", "(vote_t + t - 1) // t", "vote_t + t - 1", "vote_t + t", "vote_t", "t", "1", "t", "(vote_a + a -1) // a", "vote_a + a -1", "vote_a + a", "vote_a", "a", "1", "a", "vote_t = n * t", "vote_t", "n * t", "n", "t", "vote_a = n * a", "vote_a", "n * a", "n", "a", "print(vote_t + vote_a)", "print", "vote_t + vote_a", "vote_t", "vote_a", "n = max((vote_t + t - 1) // t, (vote_a + a -1) // a)", "max((vote_t + t - 1) // t, (vote_a + a -1) // a)", "n", "vote_a = n * a", "n * a", "vote_a", "vote_t = 1", "1", "vote_t", "vote_t = n * t", "n * t", "vote_t", "a = list(map(int, input().split()))", "list(map(int, input().split()))", "a", "t,a = list(map(int, input().split()))", "list(map(int, input().split()))", "t", "n = int(input())", "int(input())", "n", "vote_a = 1", "1", "vote_a" ]
n = int(input()) vote_t = 1 vote_a = 1 for _ in range(n): t,a = list(map(int, input().split())) n = max((vote_t + t - 1) // t, (vote_a + a -1) // a) vote_t = n * t vote_a = n * a print(vote_t + vote_a)
[ 7, 15, 13, 12, 13, 29, 4, 13, 4, 18, 4, 13, 13, 12, 13, 29, 4, 13, 4, 13, 13, 4, 18, 4, 18, 4, 13, 13, 13, 17, 12, 13, 0, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 14, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 17, 14, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 17, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 29, 2, 13, 13, 14, 2, 13, 17, 4, 13, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 34, 33 ], [ 116, 35 ], [ 38, 37 ], [ 40, 39 ], [ 43, 42 ], [ 33, 45 ], [ 48, 47 ], [ 119, 49 ], [ 48, 50 ], [ 37, 54 ], [ 94, 54 ], [ 47, 55 ], [ 59, 58 ], [ 37, 60 ], [ 94, 60 ], [ 47, 61 ], [ 64, 63 ], [ 37, 66 ], [ 94, 66 ], [ 47, 67 ], [ 39, 72 ], [ 98, 72 ], [ 50, 73 ], [ 77, 76 ], [ 39, 78 ], [ 98, 78 ], [ 50, 79 ], [ 82, 81 ], [ 39, 84 ], [ 98, 84 ], [ 50, 85 ], [ 89, 88 ], [ 63, 91 ], [ 58, 91 ], [ 81, 92 ], [ 76, 92 ], [ 95, 94 ], [ 47, 96 ], [ 88, 97 ], [ 99, 98 ], [ 50, 100 ], [ 88, 101 ], [ 94, 104 ], [ 37, 104 ], [ 98, 105 ], [ 39, 105 ], [ 122, 113 ] ]
[ "import math\n\n\ndef read_int():\n return int(input().strip())\n\n\ndef read_ints():\n return list(map(int, input().strip().split(' ')))\n\n\ndef solve():\n N = read_int()\n T, A = 1, 1\n for _ in range(N):\n Ti, Ai = read_ints()\n # T A T A\n # Ti Ai Ti*x Ai*x\n #\n # Ti*x >= T, Ai*x >= A, min x?\n # x >= T/Ti\n # x >= A/Ai\n if T%Ti == 0:\n x0 = T//Ti\n else:\n x0 = T//Ti+1\n if A%Ai == 0:\n x1 = A//Ai\n else:\n x1 = A//Ai+1\n x = max(x0, x1)\n T, A = Ti*x, Ai*x\n return T+A\n\n\nif __name__ == '__main__':\n print(solve())", "import math", "math", "def read_int():\n return int(input().strip())", "read_int", "return int(input().strip())", "int(input().strip())", "int", "input().strip()", "().strip", "()", "input", "strip", "def read_ints():\n return list(map(int, input().strip().split(' ')))", "read_ints", "return list(map(int, input().strip().split(' ')))", "list(map(int, input().strip().split(' ')))", "list", "map(int, input().strip().split(' '))", "map", "int", "input().strip().split(' ')", "().strip().split", "().strip()", "().strip", "()", "input", "strip", "split", "' '", "def solve():\n N = read_int()\n T, A = 1, 1\n for _ in range(N):\n Ti, Ai = read_ints()\n # T A T A\n # Ti Ai Ti*x Ai*x\n #\n # Ti*x >= T, Ai*x >= A, min x?\n # x >= T/Ti\n # x >= A/Ai\n if T%Ti == 0:\n x0 = T//Ti\n else:\n x0 = T//Ti+1\n if A%Ai == 0:\n x1 = A//Ai\n else:\n x1 = A//Ai+1\n x = max(x0, x1)\n T, A = Ti*x, Ai*x\n return T+A", "solve", "N = read_int()", "N", "read_int()", "read_int", "T, A = 1, 1", "T", "1", "A", "1", "for _ in range(N):\n Ti, Ai = read_ints()\n # T A T A\n # Ti Ai Ti*x Ai*x\n #\n # Ti*x >= T, Ai*x >= A, min x?\n # x >= T/Ti\n # x >= A/Ai\n if T%Ti == 0:\n x0 = T//Ti\n else:\n x0 = T//Ti+1\n if A%Ai == 0:\n x1 = A//Ai\n else:\n x1 = A//Ai+1\n x = max(x0, x1)\n T, A = Ti*x, Ai*x\n ", "_", "range(N)", "range", "N", "Ti, Ai = read_ints()", "Ti", "read_ints()", "read_ints", "Ai", "if T%Ti == 0:\n x0 = T//Ti\n else:\n x0 = T//Ti+1\n ", "T%Ti == 0", "T%Ti", "T", "Ti", "0", "x0 = T//Ti", "x0", "T//Ti", "T", "Ti", "x0 = T//Ti+1", "x0", "T//Ti+1", "T//Ti", "T", "Ti", "1", "if A%Ai == 0:\n x1 = A//Ai\n else:\n x1 = A//Ai+1\n ", "A%Ai == 0", "A%Ai", "A", "Ai", "0", "x1 = A//Ai", "x1", "A//Ai", "A", "Ai", "x1 = A//Ai+1", "x1", "A//Ai+1", "A//Ai", "A", "Ai", "1", "x = max(x0, x1)", "x", "max(x0, x1)", "max", "x0", "x1", "T, A = Ti*x, Ai*x", "T", "Ti*x", "Ti", "x", "A", "Ai*x", "Ai", "x", "return T+A", "T+A", "T", "A", "if __name__ == '__main__':\n print(solve())", "__name__ == '__main__'", "__name__", "'__main__'", "print(solve())", "print", "solve()", "solve", "def read_int():\n return int(input().strip())", "def read_int():\n return int(input().strip())", "read_int", "def read_ints():\n return list(map(int, input().strip().split(' ')))", "def read_ints():\n return list(map(int, input().strip().split(' ')))", "read_ints", "def solve():\n N = read_int()\n T, A = 1, 1\n for _ in range(N):\n Ti, Ai = read_ints()\n # T A T A\n # Ti Ai Ti*x Ai*x\n #\n # Ti*x >= T, Ai*x >= A, min x?\n # x >= T/Ti\n # x >= A/Ai\n if T%Ti == 0:\n x0 = T//Ti\n else:\n x0 = T//Ti+1\n if A%Ai == 0:\n x1 = A//Ai\n else:\n x1 = A//Ai+1\n x = max(x0, x1)\n T, A = Ti*x, Ai*x\n return T+A", "def solve():\n N = read_int()\n T, A = 1, 1\n for _ in range(N):\n Ti, Ai = read_ints()\n # T A T A\n # Ti Ai Ti*x Ai*x\n #\n # Ti*x >= T, Ai*x >= A, min x?\n # x >= T/Ti\n # x >= A/Ai\n if T%Ti == 0:\n x0 = T//Ti\n else:\n x0 = T//Ti+1\n if A%Ai == 0:\n x1 = A//Ai\n else:\n x1 = A//Ai+1\n x = max(x0, x1)\n T, A = Ti*x, Ai*x\n return T+A", "solve" ]
import math def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(' '))) def solve(): N = read_int() T, A = 1, 1 for _ in range(N): Ti, Ai = read_ints() # T A T A # Ti Ai Ti*x Ai*x # # Ti*x >= T, Ai*x >= A, min x? # x >= T/Ti # x >= A/Ai if T%Ti == 0: x0 = T//Ti else: x0 = T//Ti+1 if A%Ai == 0: x1 = A//Ai else: x1 = A//Ai+1 x = max(x0, x1) T, A = Ti*x, Ai*x return T+A if __name__ == '__main__': print(solve())
[ 7, 12, 13, 29, 2, 2, 13, 13, 40, 40, 2, 13, 13, 23, 13, 23, 13, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 4, 13, 13, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 12, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 14, 6 ], [ 16, 7 ], [ 14, 11 ], [ 16, 12 ], [ 14, 14 ], [ 16, 16 ], [ 93, 18 ], [ 72, 24 ], [ 90, 26 ], [ 30, 29 ], [ 94, 32 ], [ 87, 34 ], [ 87, 43 ], [ 78, 45 ], [ 85, 49 ], [ 73, 50 ], [ 76, 50 ], [ 88, 51 ], [ 85, 53 ], [ 91, 54 ], [ 97, 54 ], [ 82, 55 ], [ 75, 57 ], [ 88, 59 ], [ 79, 60 ], [ 29, 60 ], [ 96, 62 ], [ 82, 64 ], [ 79, 65 ], [ 29, 65 ], [ 76, 69 ], [ 73, 69 ], [ 97, 70 ], [ 91, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 87, 82 ], [ 87, 88 ], [ 90, 91 ], [ 93, 94 ], [ 96, 97 ] ]
[ "def ceil(x,y):\n return x//y+(not( not x%y))\nn=int(input())\na,b=1,1\nfor i in range(n):\n t,s = map(int,input().split())\n i = max( ceil(a,t), ceil(b,s) )\n a=t*i;b=s*i\nprint(a+b)", "def ceil(x,y):\n return x//y+(not( not x%y))", "ceil", "return x//y+(not( not x%y))", "x//y+(not( not x%y))", "x//y", "x", "y", "not( not x%y)", "not x%y", "x%y", "x", "y", "x", "x", "y", "y", "n=int(input())", "n", "int(input())", "int", "input()", "input", "a,b=1,1", "a", "1", "b", "1", "for i in range(n):\n t,s = map(int,input().split())\n i = max( ceil(a,t), ceil(b,s) )\n a=t*i;b=s*i", "i", "range(n)", "range", "n", "t,s = map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "s", "i = max( ceil(a,t), ceil(b,s) )", "i", "max( ceil(a,t), ceil(b,s) )", "max", "ceil(a,t)", "ceil", "a", "t", "ceil(b,s)", "ceil", "b", "s", "a=t*i", "a", "t*i", "t", "i", "b=s*i", "b", "s*i", "s", "i", "print(a+b)", "print", "a+b", "a", "b", "a,b=1,1", "1", "a", "a=t*i", "t*i", "a", "i = max( ceil(a,t), ceil(b,s) )", "max( ceil(a,t), ceil(b,s) )", "i", "s = map(int,input().split())", "map(int,input().split())", "s", "def ceil(x,y):\n return x//y+(not( not x%y))", "def ceil(x,y):\n return x//y+(not( not x%y))", "ceil", "t,s = map(int,input().split())", "map(int,input().split())", "t", "b=1,1", "1", "b", "n=int(input())", "int(input())", "n", "b=s*i", "s*i", "b" ]
def ceil(x,y): return x//y+(not( not x%y)) n=int(input()) a,b=1,1 for i in range(n): t,s = map(int,input().split()) i = max( ceil(a,t), ceil(b,s) ) a=t*i;b=s*i print(a+b)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 14, 40, 2, 13, 13, 17, 0, 13, 17, 0, 13, 2, 13, 13, 14, 40, 2, 13, 13, 17, 0, 13, 17, 0, 13, 2, 13, 13, 14, 40, 2, 13, 13, 17, 0, 13, 17, 0, 13, 4, 13, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 153, 2 ], [ 126, 8 ], [ 120, 11 ], [ 150, 14 ], [ 18, 17 ], [ 154, 20 ], [ 141, 22 ], [ 141, 31 ], [ 105, 33 ], [ 139, 35 ], [ 142, 36 ], [ 147, 38 ], [ 127, 40 ], [ 124, 40 ], [ 106, 41 ], [ 127, 45 ], [ 124, 45 ], [ 106, 46 ], [ 144, 49 ], [ 111, 52 ], [ 121, 54 ], [ 133, 54 ], [ 139, 55 ], [ 121, 59 ], [ 133, 59 ], [ 139, 60 ], [ 129, 63 ], [ 114, 66 ], [ 151, 68 ], [ 136, 68 ], [ 142, 69 ], [ 151, 73 ], [ 136, 73 ], [ 142, 74 ], [ 117, 77 ], [ 108, 80 ], [ 145, 83 ], [ 148, 83 ], [ 130, 84 ], [ 112, 84 ], [ 118, 85 ], [ 115, 85 ], [ 123, 87 ], [ 106, 89 ], [ 109, 90 ], [ 132, 92 ], [ 139, 94 ], [ 109, 95 ], [ 135, 97 ], [ 142, 99 ], [ 109, 100 ], [ 124, 103 ], [ 127, 103 ], [ 105, 106 ], [ 108, 109 ], [ 111, 112 ], [ 114, 115 ], [ 117, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ], [ 129, 130 ], [ 132, 133 ], [ 135, 136 ], [ 141, 139 ], [ 141, 142 ], [ 144, 145 ], [ 147, 148 ], [ 150, 151 ], [ 153, 154 ] ]
[ "n=int(input())\nans=1\np=1\nq=1\nfor i in range(n):\n a,b=map(int,input().split())\n c=a+b\n k=ans//c\n if ans%c!=0:\n k+=1\n l=p//a\n if p%a!=0:\n l+=1\n m=q//b\n if q%b!=0:\n m+=1\n g=max(k,l,m)\n ans=c*g\n p=a*g\n q=b*g\nprint(ans)", "n=int(input())", "n", "int(input())", "int", "input()", "input", "ans=1", "ans", "1", "p=1", "p", "1", "q=1", "q", "1", "for i in range(n):\n a,b=map(int,input().split())\n c=a+b\n k=ans//c\n if ans%c!=0:\n k+=1\n l=p//a\n if p%a!=0:\n l+=1\n m=q//b\n if q%b!=0:\n m+=1\n g=max(k,l,m)\n ans=c*g\n p=a*g\n q=b*g", "i", "range(n)", "range", "n", "a,b=map(int,input().split())", "a", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "c=a+b", "c", "a+b", "a", "b", "k=ans//c", "k", "ans//c", "ans", "c", "if ans%c!=0:\n k+=1\n ", "ans%c!=0", "ans%c", "ans", "c", "0", "k+=1", "k", "1", "l=p//a", "l", "p//a", "p", "a", "if p%a!=0:\n l+=1\n ", "p%a!=0", "p%a", "p", "a", "0", "l+=1", "l", "1", "m=q//b", "m", "q//b", "q", "b", "if q%b!=0:\n m+=1\n ", "q%b!=0", "q%b", "q", "b", "0", "m+=1", "m", "1", "g=max(k,l,m)", "g", "max(k,l,m)", "max", "k", "l", "m", "ans=c*g", "ans", "c*g", "c", "g", "p=a*g", "p", "a*g", "a", "g", "q=b*g", "q", "b*g", "b", "g", "print(ans)", "print", "ans", "c=a+b", "a+b", "c", "g=max(k,l,m)", "max(k,l,m)", "g", "l=p//a", "p//a", "l", "m=q//b", "q//b", "m", "m+=1", "1", "m", "p=1", "1", "p", "ans=c*g", "c*g", "ans", "ans=1", "1", "ans", "l+=1", "1", "l", "p=a*g", "a*g", "p", "q=b*g", "b*g", "q", "a,b=map(int,input().split())", "map(int,input().split())", "a", "b=map(int,input().split())", "map(int,input().split())", "b", "k+=1", "1", "k", "k=ans//c", "ans//c", "k", "q=1", "1", "q", "n=int(input())", "int(input())", "n" ]
n=int(input()) ans=1 p=1 q=1 for i in range(n): a,b=map(int,input().split()) c=a+b k=ans//c if ans%c!=0: k+=1 l=p//a if p%a!=0: l+=1 m=q//b if q%b!=0: m+=1 g=max(k,l,m) ans=c*g p=a*g q=b*g print(ans)
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 18, 13, 17, 13, 28, 13, 4, 13, 17, 13, 0, 13, 18, 13, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 18, 13, 10, 13, 13, 10, 18, 13, 10, 2, 13, 10, 18, 13, 10, 4, 13, 10, 4, 13, 10, 18, 13 ]
[ [ 97, 4 ], [ 12, 11 ], [ 98, 14 ], [ 82, 27 ], [ 100, 30 ], [ 83, 32 ], [ 100, 34 ], [ 37, 36 ], [ 98, 40 ], [ 91, 42 ], [ 83, 44 ], [ 36, 45 ], [ 91, 46 ], [ 94, 48 ], [ 86, 54 ], [ 89, 54 ], [ 92, 55 ], [ 101, 59 ], [ 77, 59 ], [ 80, 60 ], [ 88, 62 ], [ 95, 64 ], [ 92, 65 ], [ 76, 66 ], [ 95, 68 ], [ 80, 69 ], [ 89, 73 ], [ 86, 73 ], [ 77, 74 ], [ 101, 74 ], [ 76, 77 ], [ 91, 80 ], [ 82, 83 ], [ 100, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ] ]
[ "import math\n\nn = int(input())\nta = [list(map(int, input().split())) for _ in range(n)]\n\nx, y = ta[0]\nfor i in range(1, n):\n t, a = ta[i]\n k = max(-(-x // t), -(-y // a))\n x, y = k * t, k * a\n\nprint(x + y)", "import math", "math", "n = int(input())", "n", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ta = [list(map(int, input().split())) for _ in range(n)]", "ta", "[list(map(int, input().split())) for _ in range(n)]", "x, y = ta[0]", "x", "ta[0]", "ta", "0", "y", "for i in range(1, n):\n t, a = ta[i]\n k = max(-(-x // t), -(-y // a))\n x, y = k * t, k * a", "i", "range(1, n)", "range", "1", "n", "t, a = ta[i]", "t", "ta[i]", "ta", "i", "a", "k = max(-(-x // t), -(-y // a))", "k", "max(-(-x // t), -(-y // a))", "max", "-(-x // t)", "-x // t", "-x", "x", "t", "-(-y // a)", "-y // a", "-y", "y", "a", "x, y = k * t, k * a", "x", "k * t", "k", "t", "y", "k * a", "k", "a", "print(x + y)", "print", "x + y", "x", "y", "y = k * t, k * a", "k * a", "y", "a = ta[i]", "ta[i]", "a", "ta = [list(map(int, input().split())) for _ in range(n)]", "[list(map(int, input().split())) for _ in range(n)]", "ta", "x, y = ta[0]", "ta[0]", "x", "x, y = k * t, k * a", "k * t", "x", "t, a = ta[i]", "ta[i]", "t", "k = max(-(-x // t), -(-y // a))", "max(-(-x // t), -(-y // a))", "k", "n = int(input())", "int(input())", "n", "y = ta[0]", "ta[0]", "y" ]
import math n = int(input()) ta = [list(map(int, input().split())) for _ in range(n)] x, y = ta[0] for i in range(1, n): t, a = ta[i] k = max(-(-x // t), -(-y // a)) x, y = k * t, k * a print(x + y)
[ 7, 15, 13, 15, 13, 15, 13, 15, 13, 15, 15, 13, 15, 13, 15, 13, 15, 15, 4, 18, 13, 13, 2, 17, 17, 0, 13, 2, 17, 17, 12, 13, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 13, 12, 13, 23, 13, 12, 13, 23, 13, 12, 13, 23, 13, 23, 13, 12, 13, 23, 13, 23, 13, 0, 13, 17, 12, 13, 0, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 17, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 2, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 235, 26 ], [ 41, 40 ], [ 215, 46 ], [ 50, 50 ], [ 54, 53 ], [ 242, 59 ], [ 63, 63 ], [ 67, 66 ], [ 197, 72 ], [ 76, 76 ], [ 80, 79 ], [ 203, 85 ], [ 89, 89 ], [ 93, 92 ], [ 197, 100 ], [ 104, 104 ], [ 108, 107 ], [ 116, 116 ], [ 120, 120 ], [ 124, 124 ], [ 126, 126 ], [ 130, 130 ], [ 132, 132 ], [ 223, 134 ], [ 140, 139 ], [ 215, 141 ], [ 144, 143 ], [ 146, 145 ], [ 149, 148 ], [ 139, 151 ], [ 154, 153 ], [ 242, 155 ], [ 154, 156 ], [ 159, 158 ], [ 143, 164 ], [ 176, 164 ], [ 153, 165 ], [ 153, 167 ], [ 145, 171 ], [ 180, 171 ], [ 156, 172 ], [ 156, 174 ], [ 177, 176 ], [ 158, 178 ], [ 153, 179 ], [ 181, 180 ], [ 158, 182 ], [ 156, 183 ], [ 176, 187 ], [ 143, 187 ], [ 180, 188 ], [ 145, 188 ], [ 209, 194 ], [ 223, 224 ], [ 235, 236 ] ]
[ "import sys\nimport numpy as np\nimport random\nimport math\nfrom decimal import Decimal\nimport itertools\nimport re\nimport bisect\nfrom collections import deque, Counter\nfrom functools import lru_cache\n\nsys.setrecursionlimit(10**9)\nINF = 10**13\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\ndef I(): return int(sys.stdin.buffer.readline())\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef LSR(n): return [LS() for i in range(n)]\ndef SRL(n): return [list(S()) for i in range(n)]\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\ndef SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')\ndef GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]\ndef GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]\nMOD = 1000000007\n\ndef main():\n\tn = I()\n\tx, y = 1, 1\n\tfor _ in range(n):\n\t\tt, a = LI()\n\t\tm = max((x+t-1)//t,(y+a-1)//a)\n\t\tx, y = m*t, m*a\n\tprint(x+y)\n\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "import numpy as np", "numpy", "import random", "random", "import math", "math", "from decimal import Decimal", "import itertools", "itertools", "import re", "re", "import bisect", "bisect", "from collections import deque, Counter", "from functools import lru_cache", "sys.setrecursionlimit(10**9)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**9", "10", "9", "INF = 10**13", "INF", "10**13", "10", "13", "def LI(): return list(map(int, sys.stdin.buffer.readline().split()))", "LI", "def I(): return int(sys.stdin.buffer.readline())", "I", "def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()", "LS", "def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')", "S", "I() for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "I()", "I", "def IR(n): return [I() for i in range(n)]", "IR", "n", "n", "LI() for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "LI()", "LI", "def LIR(n): return [LI() for i in range(n)]", "LIR", "n", "n", "S() for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "S()", "S", "def SR(n): return [S() for i in range(n)]", "SR", "n", "n", "LS() for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "LS()", "LS", "def LSR(n): return [LS() for i in range(n)]", "LSR", "n", "n", "list(S()) for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "list(S())", "list", "S()", "S", "def SRL(n): return [list(S()) for i in range(n)]", "SRL", "n", "n", "[int(j) for j in list(S())] for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "[int(j) for j in list(S())]", "def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]", "MSRL", "n", "n", "def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')", "SERIES", "n", "n", "def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]", "GRID", "h", "h", "w", "w", "def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]", "GRIDfromString", "h", "h", "w", "w", "MOD = 1000000007", "MOD", "1000000007", "def main():\n\tn = I()\n\tx, y = 1, 1\n\tfor _ in range(n):\n\t\tt, a = LI()\n\t\tm = max((x+t-1)//t,(y+a-1)//a)\n\t\tx, y = m*t, m*a\n\tprint(x+y)", "main", "n = I()", "n", "I()", "I", "x, y = 1, 1", "x", "1", "y", "1", "for _ in range(n):\n\t\tt, a = LI()\n\t\tm = max((x+t-1)//t,(y+a-1)//a)\n\t\tx, y = m*t, m*a\n\t", "_", "range(n)", "range", "n", "t, a = LI()", "t", "LI()", "LI", "a", "m = max((x+t-1)//t,(y+a-1)//a)", "m", "max((x+t-1)//t,(y+a-1)//a)", "max", "(x+t-1)//t", "x+t-1", "x+t", "x", "t", "1", "t", "(y+a-1)//a", "y+a-1", "y+a", "y", "a", "1", "a", "x, y = m*t, m*a", "x", "m*t", "m", "t", "y", "m*a", "m", "a", "print(x+y)", "print", "x+y", "x", "y", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')", "def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')", "S", "def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]", "def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]", "MSRL", "def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()", "def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()", "LS", "def SR(n): return [S() for i in range(n)]", "def SR(n): return [S() for i in range(n)]", "SR", "def main():\n\tn = I()\n\tx, y = 1, 1\n\tfor _ in range(n):\n\t\tt, a = LI()\n\t\tm = max((x+t-1)//t,(y+a-1)//a)\n\t\tx, y = m*t, m*a\n\tprint(x+y)", "def main():\n\tn = I()\n\tx, y = 1, 1\n\tfor _ in range(n):\n\t\tt, a = LI()\n\t\tm = max((x+t-1)//t,(y+a-1)//a)\n\t\tx, y = m*t, m*a\n\tprint(x+y)", "main", "def SRL(n): return [list(S()) for i in range(n)]", "def SRL(n): return [list(S()) for i in range(n)]", "SRL", "def I(): return int(sys.stdin.buffer.readline())", "def I(): return int(sys.stdin.buffer.readline())", "I", "def IR(n): return [I() for i in range(n)]", "def IR(n): return [I() for i in range(n)]", "IR", "def LSR(n): return [LS() for i in range(n)]", "def LSR(n): return [LS() for i in range(n)]", "LSR", "MOD = 1000000007", "1000000007", "MOD", "def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]", "def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]", "GRIDfromString", "def LIR(n): return [LI() for i in range(n)]", "def LIR(n): return [LI() for i in range(n)]", "LIR", "def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')", "def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')", "SERIES", "INF = 10**13", "10**13", "INF", "def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]", "def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]", "GRID", "def LI(): return list(map(int, sys.stdin.buffer.readline().split()))", "def LI(): return list(map(int, sys.stdin.buffer.readline().split()))", "LI" ]
import sys import numpy as np import random import math from decimal import Decimal import itertools import re import bisect from collections import deque, Counter from functools import lru_cache sys.setrecursionlimit(10**9) INF = 10**13 def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)] def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ') def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w] def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w] MOD = 1000000007 def main(): n = I() x, y = 1, 1 for _ in range(n): t, a = LI() m = max((x+t-1)//t,(y+a-1)//a) x, y = m*t, m*a print(x+y) if __name__ == '__main__': main()
[ 7, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 39, 39, 17, 17, 39, 17, 17, 39, 17, 17, 39, 17, 17, 0, 13, 39, 39, 17, 17, 39, 17, 17, 39, 17, 17, 39, 17, 17, 39, 17, 17, 39, 17, 17, 39, 17, 17, 39, 17, 17, 41, 28, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 4, 4, 13, 13, 12, 13, 41, 28, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 4, 2, 4, 13, 13, 17, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 41, 28, 13, 4, 13, 2, 13, 17, 4, 4, 13, 0, 13, 13, 28, 13, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 29, 2, 13, 13, 4, 13, 4, 13, 10, 39, 13, 10, 12, 13, 10, 39, 13, 10, 12, 13, 10, 2, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 2, 13, 10, 12, 13 ]
[ [ 207, 24 ], [ 195, 29 ], [ 183, 36 ], [ 189, 51 ], [ 80, 79 ], [ 79, 92 ], [ 98, 97 ], [ 97, 111 ], [ 125, 124 ], [ 187, 126 ], [ 129, 128 ], [ 193, 130 ], [ 129, 131 ], [ 135, 134 ], [ 124, 138 ], [ 193, 142 ], [ 145, 144 ], [ 152, 151 ], [ 128, 157 ], [ 165, 157 ], [ 131, 162 ], [ 170, 162 ], [ 166, 165 ], [ 151, 167 ], [ 171, 170 ], [ 151, 172 ], [ 165, 176 ], [ 128, 176 ], [ 170, 177 ], [ 131, 177 ], [ 205, 181 ], [ 183, 184 ], [ 189, 190 ], [ 195, 196 ], [ 207, 208 ] ]
[ "import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef I(): return int(sys.stdin.readline())\ndef LS(): return sys.stdin.readline().split()\ndef S(): return input()\n\ndef main():\n n=I()\n t,a=LI()\n l=[LI() for _ in range(n-1)]\n\n # t<=nt' and a<=na'\n # t/t'<=n and a/a'<=n\n for _t,_a in l:\n _n=max(-(-t//_t),-(-a//_a))\n t=_n*_t\n a=_n*_a\n\n return t+a\n\n# main()\nprint(main())", "import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy", "math", "string", "itertools", "fractions", "heapq", "collections", "re", "array", "bisect", "sys", "random", "time", "queue", "copy", "sys.setrecursionlimit(10**7)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**7", "10", "7", "inf=10**20", "inf", "10**20", "10", "20", "mod=10**9+7", "mod", "10**9+7", "10**9", "10", "9", "7", "dd=[(-1,0),(0,1),(1,0),(0,-1)]", "dd", "[(-1,0),(0,1),(1,0),(0,-1)]", "(-1,0)", "-1", "0", "(0,1)", "0", "1", "(1,0)", "1", "0", "(0,-1)", "0", "-1", "ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]", "ddn", "[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]", "(-1,0)", "-1", "0", "(-1,1)", "-1", "1", "(0,1)", "0", "1", "(1,1)", "1", "1", "(1,0)", "1", "0", "(1,-1)", "1", "-1", "(0,-1)", "0", "-1", "(-1,-1)", "-1", "-1", "int(x) for x in sys.stdin.readline().split()", "for x in sys.stdin.readline().split()", "x", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "for x in sys.stdin.readline().split()", "int(x)", "int", "x", "def LI(): return [int(x) for x in sys.stdin.readline().split()]", "LI", "int(x)-1 for x in sys.stdin.readline().split()", "for x in sys.stdin.readline().split()", "x", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "for x in sys.stdin.readline().split()", "int(x)-1", "int(x)", "int", "x", "1", "def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]", "LI_", "def I(): return int(sys.stdin.readline())", "I", "def LS(): return sys.stdin.readline().split()", "LS", "def S(): return input()", "S", "def main():\n n=I()\n t,a=LI()\n l=[LI() for _ in range(n-1)]\n\n # t<=nt' and a<=na'\n # t/t'<=n and a/a'<=n\n for _t,_a in l:\n _n=max(-(-t//_t),-(-a//_a))\n t=_n*_t\n a=_n*_a\n\n return t+a\n\n# main()", "main", "n=I()", "n", "I()", "I", "t,a=LI()", "t", "LI()", "LI", "a", "LI() for _ in range(n-1)", "for _ in range(n-1)", "_", "range(n-1)", "range", "n-1", "n", "1", "for _ in range(n-1)", "LI()", "LI", "l=[LI() for _ in range(n-1)]", "l", "[LI() for _ in range(n-1)]", "for _t,_a in l:\n _n=max(-(-t//_t),-(-a//_a))\n t=_n*_t\n a=_n*_a\n\n ", "_t", "_a", "l", "_n=max(-(-t//_t),-(-a//_a))", "_n", "max(-(-t//_t),-(-a//_a))", "max", "-(-t//_t)", "-t//_t", "-t", "t", "_t", "-(-a//_a)", "-a//_a", "-a", "a", "_a", "t=_n*_t", "t", "_n*_t", "_n", "_t", "a=_n*_a", "a", "_n*_a", "_n", "_a", "return t+a", "t+a", "t", "a", "print(main())", "print", "main()", "main", "dd=[(-1,0),(0,1),(1,0),(0,-1)]", "[(-1,0),(0,1),(1,0),(0,-1)]", "dd", "def I(): return int(sys.stdin.readline())", "def I(): return int(sys.stdin.readline())", "I", "ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]", "[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]", "ddn", "def LI(): return [int(x) for x in sys.stdin.readline().split()]", "def LI(): return [int(x) for x in sys.stdin.readline().split()]", "LI", "mod=10**9+7", "10**9+7", "mod", "def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]", "def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]", "LI_", "def LS(): return sys.stdin.readline().split()", "def LS(): return sys.stdin.readline().split()", "LS", "def main():\n n=I()\n t,a=LI()\n l=[LI() for _ in range(n-1)]\n\n # t<=nt' and a<=na'\n # t/t'<=n and a/a'<=n\n for _t,_a in l:\n _n=max(-(-t//_t),-(-a//_a))\n t=_n*_t\n a=_n*_a\n\n return t+a\n\n# main()", "def main():\n n=I()\n t,a=LI()\n l=[LI() for _ in range(n-1)]\n\n # t<=nt' and a<=na'\n # t/t'<=n and a/a'<=n\n for _t,_a in l:\n _n=max(-(-t//_t),-(-a//_a))\n t=_n*_t\n a=_n*_a\n\n return t+a\n\n# main()", "main", "inf=10**20", "10**20", "inf", "def S(): return input()", "def S(): return input()", "S" ]
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS(): return sys.stdin.readline().split() def S(): return input() def main(): n=I() t,a=LI() l=[LI() for _ in range(n-1)] # t<=nt' and a<=na' # t/t'<=n and a/a'<=n for _t,_a in l: _n=max(-(-t//_t),-(-a//_a)) t=_n*_t a=_n*_a return t+a # main() print(main())
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 39, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 4, 13, 2, 2, 2, 18, 13, 17, 13, 17, 13, 2, 2, 2, 18, 13, 17, 13, 17, 13, 0, 18, 13, 17, 2, 13, 13, 0, 18, 13, 17, 2, 13, 13, 4, 13, 4, 13, 13, 15, 13, 12, 13, 12, 13, 12, 13, 12, 13, 0, 13, 2, 2, 17, 17, 17, 0, 13, 4, 13, 17, 4, 13, 10, 2, 13, 10, 12, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 14, 13 ], [ 4, 16 ], [ 19, 18 ], [ 19, 21 ], [ 24, 23 ], [ 8, 30 ], [ 18, 32 ], [ 18, 34 ], [ 8, 39 ], [ 21, 41 ], [ 21, 43 ], [ 48, 45 ], [ 8, 46 ], [ 18, 49 ], [ 23, 50 ], [ 55, 52 ], [ 8, 53 ], [ 21, 56 ], [ 23, 57 ], [ 8, 62 ], [ 88, 74 ], [ 94, 81 ], [ 98, 86 ], [ 88, 89 ], [ 94, 95 ] ]
[ "def examC():\n N = I()\n cur = [1,1]\n for i in range(N):\n T, A = LI()\n k = max((cur[0]+T-1)//T,(cur[1]+A-1)//A)\n cur[0] = T * k\n cur[1] = A * k\n# print(cur)\n print(sum(cur))\n\n\n\nimport sys\ndef I(): return int(sys.stdin.readline())\ndef LI(): return list(map(int,sys.stdin.readline().split()))\ndef LS(): return sys.stdin.readline().split()\ndef S(): return sys.stdin.readline().strip()\nmod = 10**9 + 7\ninf = float('inf')\n\nexamC()", "def examC():\n N = I()\n cur = [1,1]\n for i in range(N):\n T, A = LI()\n k = max((cur[0]+T-1)//T,(cur[1]+A-1)//A)\n cur[0] = T * k\n cur[1] = A * k\n# print(cur)\n print(sum(cur))", "examC", "N = I()", "N", "I()", "I", "cur = [1,1]", "cur", "[1,1]", "1", "1", "for i in range(N):\n T, A = LI()\n k = max((cur[0]+T-1)//T,(cur[1]+A-1)//A)\n cur[0] = T * k\n cur[1] = A * k\n# print(cur)\n ", "i", "range(N)", "range", "N", "T, A = LI()", "T", "LI()", "LI", "A", "k = max((cur[0]+T-1)//T,(cur[1]+A-1)//A)", "k", "max((cur[0]+T-1)//T,(cur[1]+A-1)//A)", "max", "(cur[0]+T-1)//T", "cur[0]+T-1", "cur[0]+T", "cur[0]", "cur", "0", "T", "1", "T", "(cur[1]+A-1)//A", "cur[1]+A-1", "cur[1]+A", "cur[1]", "cur", "1", "A", "1", "A", "cur[0] = T * k", "cur[0]", "cur", "0", "T * k", "T", "k", "cur[1] = A * k", "cur[1]", "cur", "1", "A * k", "A", "k", "print(sum(cur))", "print", "sum(cur)", "sum", "cur", "import sys", "sys", "def I(): return int(sys.stdin.readline())", "I", "def LI(): return list(map(int,sys.stdin.readline().split()))", "LI", "def LS(): return sys.stdin.readline().split()", "LS", "def S(): return sys.stdin.readline().strip()", "S", "mod = 10**9 + 7", "mod", "10**9 + 7", "10**9", "10", "9", "7", "inf = float('inf')", "inf", "float('inf')", "float", "'inf'", "examC()", "examC", "mod = 10**9 + 7", "10**9 + 7", "mod", "def S(): return sys.stdin.readline().strip()", "def S(): return sys.stdin.readline().strip()", "S", "inf = float('inf')", "float('inf')", "inf", "def examC():\n N = I()\n cur = [1,1]\n for i in range(N):\n T, A = LI()\n k = max((cur[0]+T-1)//T,(cur[1]+A-1)//A)\n cur[0] = T * k\n cur[1] = A * k\n# print(cur)\n print(sum(cur))", "def examC():\n N = I()\n cur = [1,1]\n for i in range(N):\n T, A = LI()\n k = max((cur[0]+T-1)//T,(cur[1]+A-1)//A)\n cur[0] = T * k\n cur[1] = A * k\n# print(cur)\n print(sum(cur))", "examC", "def LS(): return sys.stdin.readline().split()", "def LS(): return sys.stdin.readline().split()", "LS", "def I(): return int(sys.stdin.readline())", "def I(): return int(sys.stdin.readline())", "I", "def LI(): return list(map(int,sys.stdin.readline().split()))", "def LI(): return list(map(int,sys.stdin.readline().split()))", "LI" ]
def examC(): N = I() cur = [1,1] for i in range(N): T, A = LI() k = max((cur[0]+T-1)//T,(cur[1]+A-1)//A) cur[0] = T * k cur[1] = A * k # print(cur) print(sum(cur)) import sys def I(): return int(sys.stdin.readline()) def LI(): return list(map(int,sys.stdin.readline().split())) def LS(): return sys.stdin.readline().split() def S(): return sys.stdin.readline().strip() mod = 10**9 + 7 inf = float('inf') examC()
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 40, 2, 40, 13, 13, 0, 13, 40, 2, 40, 13, 13, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 40, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 2, 13, 10, 40, 13, 10, 4, 13 ]
[ [ 68, 2 ], [ 83, 8 ], [ 83, 11 ], [ 15, 14 ], [ 69, 17 ], [ 77, 19 ], [ 77, 28 ], [ 89, 30 ], [ 66, 34 ], [ 81, 34 ], [ 72, 35 ], [ 74, 37 ], [ 84, 41 ], [ 87, 41 ], [ 78, 42 ], [ 92, 44 ], [ 90, 47 ], [ 75, 48 ], [ 80, 50 ], [ 93, 52 ], [ 72, 53 ], [ 86, 55 ], [ 93, 57 ], [ 78, 58 ], [ 81, 62 ], [ 66, 62 ], [ 87, 63 ], [ 84, 63 ], [ 83, 66 ], [ 68, 69 ], [ 77, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ] ]
[ "N=int(input())\n\nvt=va=1\nfor _ in range(N):\n T,A=map(int,input().split())\n kt=-(-vt//T)\n ka=-(-va//A)\n \n k=max(kt,ka)\n vt=k*T\n va=k*A \n #print(vt,va)\n \nprint(vt+va)", "N=int(input())", "N", "int(input())", "int", "input()", "input", "vt=va=1", "vt", "1", "=va=1", "va", "1", "for _ in range(N):\n T,A=map(int,input().split())\n kt=-(-vt//T)\n ka=-(-va//A)\n \n k=max(kt,ka)\n vt=k*T\n va=k*A \n #print(vt,va)\n ", "_", "range(N)", "range", "N", "T,A=map(int,input().split())", "T", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "kt=-(-vt//T)", "kt", "-(-vt//T)", "-vt//T", "-vt", "vt", "T", "ka=-(-va//A)", "ka", "-(-va//A)", "-va//A", "-va", "va", "A", "k=max(kt,ka)", "k", "max(kt,ka)", "max", "kt", "ka", "vt=k*T", "vt", "k*T", "k", "T", "va=k*A", "va", "k*A", "k", "A", "print(vt+va)", "print", "vt+va", "vt", "va", "vt=va=1", "1", "vt", "N=int(input())", "int(input())", "N", "T,A=map(int,input().split())", "map(int,input().split())", "T", "ka=-(-va//A)", "-(-va//A)", "ka", "A=map(int,input().split())", "map(int,input().split())", "A", "vt=k*T", "k*T", "vt", "va=1", "1", "va", "va=k*A", "k*A", "va", "kt=-(-vt//T)", "-(-vt//T)", "kt", "k=max(kt,ka)", "max(kt,ka)", "k" ]
N=int(input()) vt=va=1 for _ in range(N): T,A=map(int,input().split()) kt=-(-vt//T) ka=-(-va//A) k=max(kt,ka) vt=k*T va=k*A #print(vt,va) print(vt+va)
[ 7, 15, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 12, 2, 4, 13, 13, 17, 23, 0, 13, 12, 4, 13, 31, 13, 0, 13, 17, 23, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 12, 13, 12, 13, 42, 13, 29, 13, 23, 13, 23, 13, 12, 13, 23, 13, 23, 13, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 13, 14, 2, 13, 17, 0, 13, 13, 13, 13, 9, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 143, 11 ], [ 152, 20 ], [ 28, 27 ], [ 39, 38 ], [ 156, 44 ], [ 48, 48 ], [ 58, 56 ], [ 58, 58 ], [ 60, 60 ], [ 64, 64 ], [ 66, 66 ], [ 71, 70 ], [ 141, 72 ], [ 75, 74 ], [ 138, 76 ], [ 70, 77 ], [ 83, 79 ], [ 83, 82 ], [ 79, 90 ], [ 117, 90 ], [ 93, 90 ], [ 94, 93 ], [ 96, 95 ], [ 100, 99 ], [ 93, 106 ], [ 79, 106 ], [ 117, 106 ], [ 95, 113 ], [ 82, 113 ], [ 122, 113 ], [ 118, 117 ], [ 99, 119 ], [ 123, 122 ], [ 99, 124 ], [ 117, 129 ], [ 93, 129 ], [ 79, 129 ], [ 122, 130 ], [ 95, 130 ], [ 82, 130 ], [ 150, 132 ], [ 143, 144 ], [ 152, 153 ] ]
[ "import sys\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep=\"\\n\")\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef SI(): return sys.stdin.readline()[:-1]\n\ndef gcd(a,b):\n while b:a,b=b,a%b\n return a\n\ndef lcm(a,b):return a*b//gcd(a,b)\n\ndef main():\n n=II()\n ta=LLI(n)\n x=y=-1\n for t,a in ta:\n if x==-1:\n x,y=t,a\n continue\n c=max((t+x-1)//t,(a+y-1)//a)\n x=c*t\n y=c*a\n print(x+y)\n\nmain()", "import sys", "sys", "sys.setrecursionlimit(10 ** 6)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 6", "10", "6", "int1 = lambda x: int(x) - 1", "int1", "lambda x: int(x) - 1", "int(x) - 1", "int(x)", "int", "x", "1", "x", "p2D = lambda x: print(*x, sep=\"\\n\")", "p2D", "lambda x: print(*x, sep=\"\\n\")", "print(*x, sep=\"\\n\")", "print", "*x", "x", "sep=\"\\n\"", "sep", "\"\\n\"", "x", "def II(): return int(sys.stdin.readline())", "II", "def MI(): return map(int, sys.stdin.readline().split())", "MI", "def LI(): return list(map(int, sys.stdin.readline().split()))", "LI", "LI() for _ in range(rows_number)", "for _ in range(rows_number)", "_", "range(rows_number)", "range", "rows_number", "for _ in range(rows_number)", "LI()", "LI", "def LLI(rows_number): return [LI() for _ in range(rows_number)]", "LLI", "rows_number", "rows_number", "def SI(): return sys.stdin.readline()[:-1]", "SI", "def gcd(a,b):\n while b:a,b=b,a%b\n return a", "gcd", "while b:a,b=b,a%b\n ", "b", "return a", "a", "a", "a", "b", "b", "def lcm(a,b):return a*b//gcd(a,b)", "lcm", "a", "a", "b", "b", "def main():\n n=II()\n ta=LLI(n)\n x=y=-1\n for t,a in ta:\n if x==-1:\n x,y=t,a\n continue\n c=max((t+x-1)//t,(a+y-1)//a)\n x=c*t\n y=c*a\n print(x+y)", "main", "n=II()", "n", "II()", "II", "ta=LLI(n)", "ta", "LLI(n)", "LLI", "n", "x=y=-1", "x", "-1", "=y=-1", "y", "-1", "for t,a in ta:\n if x==-1:\n x,y=t,a\n continue\n c=max((t+x-1)//t,(a+y-1)//a)\n x=c*t\n y=c*a\n ", "t", "a", "ta", "if x==-1:\n x,y=t,a\n continue\n ", "x==-1", "x", "-1", "x,y=t,a", "x", "t", "y", "a", "continue", "c=max((t+x-1)//t,(a+y-1)//a)", "c", "max((t+x-1)//t,(a+y-1)//a)", "max", "(t+x-1)//t", "t+x-1", "t+x", "t", "x", "1", "t", "(a+y-1)//a", "a+y-1", "a+y", "a", "y", "1", "a", "x=c*t", "x", "c*t", "c", "t", "y=c*a", "y", "c*a", "c", "a", "print(x+y)", "print", "x+y", "x", "y", "main()", "main", "def SI(): return sys.stdin.readline()[:-1]", "def SI(): return sys.stdin.readline()[:-1]", "SI", "def LLI(rows_number): return [LI() for _ in range(rows_number)]", "def LLI(rows_number): return [LI() for _ in range(rows_number)]", "LLI", "def II(): return int(sys.stdin.readline())", "def II(): return int(sys.stdin.readline())", "II", "int1 = lambda x: int(x) - 1", "lambda x: int(x) - 1", "int1", "def gcd(a,b):\n while b:a,b=b,a%b\n return a", "def gcd(a,b):\n while b:a,b=b,a%b\n return a", "gcd", "def main():\n n=II()\n ta=LLI(n)\n x=y=-1\n for t,a in ta:\n if x==-1:\n x,y=t,a\n continue\n c=max((t+x-1)//t,(a+y-1)//a)\n x=c*t\n y=c*a\n print(x+y)", "def main():\n n=II()\n ta=LLI(n)\n x=y=-1\n for t,a in ta:\n if x==-1:\n x,y=t,a\n continue\n c=max((t+x-1)//t,(a+y-1)//a)\n x=c*t\n y=c*a\n print(x+y)", "main", "p2D = lambda x: print(*x, sep=\"\\n\")", "lambda x: print(*x, sep=\"\\n\")", "p2D", "def LI(): return list(map(int, sys.stdin.readline().split()))", "def LI(): return list(map(int, sys.stdin.readline().split()))", "LI", "def lcm(a,b):return a*b//gcd(a,b)", "def lcm(a,b):return a*b//gcd(a,b)", "lcm", "def MI(): return map(int, sys.stdin.readline().split())", "def MI(): return map(int, sys.stdin.readline().split())", "MI" ]
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] def gcd(a,b): while b:a,b=b,a%b return a def lcm(a,b):return a*b//gcd(a,b) def main(): n=II() ta=LLI(n) x=y=-1 for t,a in ta: if x==-1: x,y=t,a continue c=max((t+x-1)//t,(a+y-1)//a) x=c*t y=c*a print(x+y) main()
[ 7, 0, 13, 4, 13, 4, 13, 28, 13, 4, 13, 13, 14, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 80, 2 ], [ 9, 8 ], [ 81, 11 ], [ 8, 14 ], [ 101, 17 ], [ 101, 26 ], [ 92, 28 ], [ 92, 37 ], [ 95, 39 ], [ 99, 43 ], [ 102, 43 ], [ 78, 44 ], [ 78, 46 ], [ 83, 48 ], [ 105, 52 ], [ 87, 52 ], [ 93, 53 ], [ 93, 55 ], [ 89, 57 ], [ 96, 60 ], [ 84, 61 ], [ 98, 63 ], [ 78, 65 ], [ 90, 66 ], [ 104, 67 ], [ 93, 69 ], [ 90, 70 ], [ 99, 74 ], [ 102, 74 ], [ 105, 75 ], [ 87, 75 ], [ 92, 78 ], [ 80, 81 ], [ 83, 84 ], [ 101, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ], [ 101, 102 ], [ 104, 105 ] ]
[ "n=int(input())\nfor i in range(n):\n if i==0:\n t,a=map(int,input().split())\n else:\n x,y=map(int,input().split())\n p=(t+x-1)//x\n q=(a+y-1)//y\n r=max(p,q)\n t,a=x*r,y*r\nprint(t+a)", "n=int(input())", "n", "int(input())", "int", "input()", "input", "for i in range(n):\n if i==0:\n t,a=map(int,input().split())\n else:\n x,y=map(int,input().split())\n p=(t+x-1)//x\n q=(a+y-1)//y\n r=max(p,q)\n t,a=x*r,y*r", "i", "range(n)", "range", "n", "if i==0:\n t,a=map(int,input().split())\n else:\n x,y=map(int,input().split())\n p=(t+x-1)//x\n q=(a+y-1)//y\n r=max(p,q)\n t,a=x*r,y*r", "i==0", "i", "0", "t,a=map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "p=(t+x-1)//x", "p", "(t+x-1)//x", "t+x-1", "t+x", "t", "x", "1", "x", "q=(a+y-1)//y", "q", "(a+y-1)//y", "a+y-1", "a+y", "a", "y", "1", "y", "r=max(p,q)", "r", "max(p,q)", "max", "p", "q", "t,a=x*r,y*r", "t", "x*r", "x", "r", "a", "y*r", "y", "r", "print(t+a)", "print", "t+a", "t", "a", "x,y=map(int,input().split())", "map(int,input().split())", "x", "n=int(input())", "int(input())", "n", "q=(a+y-1)//y", "(a+y-1)//y", "q", "a=map(int,input().split())", "map(int,input().split())", "a", "r=max(p,q)", "max(p,q)", "r", "y=map(int,input().split())", "map(int,input().split())", "y", "p=(t+x-1)//x", "(t+x-1)//x", "p", "t,a=x*r,y*r", "x*r", "t", "t,a=map(int,input().split())", "map(int,input().split())", "t", "a=x*r,y*r", "y*r", "a" ]
n=int(input()) for i in range(n): if i==0: t,a=map(int,input().split()) else: x,y=map(int,input().split()) p=(t+x-1)//x q=(a+y-1)//y r=max(p,q) t,a=x*r,y*r print(t+a)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 39, 28, 13, 4, 13, 13, 0, 13, 2, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 39, 0, 13, 39, 28, 13, 4, 13, 2, 17, 13, 14, 2, 2, 13, 17, 17, 4, 18, 13, 13, 18, 13, 13, 4, 18, 13, 13, 18, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 2, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 2, 18, 13, 13, 18, 13, 2, 13, 17, 14, 40, 2, 18, 13, 13, 18, 13, 2, 13, 17, 17, 0, 13, 17, 14, 40, 2, 18, 13, 13, 18, 13, 2, 13, 17, 17, 0, 13, 17, 0, 13, 4, 13, 13, 13, 0, 18, 13, 2, 13, 17, 2, 18, 13, 2, 13, 17, 13, 0, 18, 13, 2, 13, 17, 2, 18, 13, 2, 13, 17, 13, 4, 13, 4, 13, 2, 18, 13, 2, 13, 17, 18, 13, 2, 13, 17, 10, 4, 13, 10, 39, 13, 10, 17, 13, 10, 2, 13, 10, 39, 13, 10, 39, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13 ]
[ [ 190, 2 ], [ 181, 8 ], [ 12, 11 ], [ 191, 14 ], [ 196, 16 ], [ 182, 18 ], [ 197, 18 ], [ 184, 30 ], [ 172, 33 ], [ 37, 36 ], [ 191, 41 ], [ 36, 45 ], [ 185, 50 ], [ 197, 53 ], [ 182, 53 ], [ 36, 54 ], [ 173, 57 ], [ 197, 60 ], [ 182, 60 ], [ 36, 61 ], [ 64, 63 ], [ 191, 67 ], [ 193, 70 ], [ 173, 73 ], [ 63, 74 ], [ 173, 76 ], [ 63, 78 ], [ 178, 81 ], [ 185, 84 ], [ 63, 85 ], [ 185, 87 ], [ 63, 89 ], [ 173, 95 ], [ 63, 96 ], [ 173, 98 ], [ 63, 100 ], [ 175, 104 ], [ 185, 110 ], [ 63, 111 ], [ 185, 113 ], [ 63, 115 ], [ 187, 119 ], [ 169, 122 ], [ 176, 125 ], [ 194, 125 ], [ 188, 126 ], [ 179, 126 ], [ 133, 128 ], [ 185, 129 ], [ 63, 131 ], [ 185, 135 ], [ 63, 137 ], [ 170, 139 ], [ 146, 141 ], [ 173, 142 ], [ 63, 144 ], [ 173, 148 ], [ 63, 150 ], [ 170, 152 ], [ 185, 159 ], [ 191, 161 ], [ 173, 164 ], [ 191, 166 ], [ 169, 170 ], [ 172, 173 ], [ 175, 176 ], [ 178, 179 ], [ 181, 182 ], [ 184, 185 ], [ 187, 188 ], [ 190, 191 ], [ 193, 194 ], [ 196, 197 ] ]
[ "n=int(input())\nsuji=[]\nfor i in range (n):\n\tsuji=suji+list(map(int,input().split()))\ntlist=[]\nalist=[]\nfor i in range(2*n):\n\tif i%2==0:\n\t\ttlist.append(suji[i])\n\telse:\n\t\talist.append(suji[i])\n\nfor i in range(n-1):\n\taaa=alist[i]//alist[i+1]\n\tttt=tlist[i]//tlist[i+1]\n\tif alist[i]%alist[i+1]!=0:\n\t\taaa+=1\n\tif tlist[i]%tlist[i+1]!=0:\n\t\tttt+=1\n\tk=max(aaa,ttt)\n\ttlist[i+1]=tlist[i+1]*k\n\talist[i+1]=alist[i+1]*k\n\nprint(int(tlist[n-1]+alist[n-1]))", "n=int(input())", "n", "int(input())", "int", "input()", "input", "suji=[]", "suji", "[]", "for i in range (n):\n\tsuji=suji+list(map(int,input().split()))", "i", "range (n)", "range", "n", "suji=suji+list(map(int,input().split()))", "suji", "suji+list(map(int,input().split()))", "suji", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "tlist=[]", "tlist", "[]", "alist=[]", "alist", "[]", "for i in range(2*n):\n\tif i%2==0:\n\t\ttlist.append(suji[i])\n\telse:\n\t\talist.append(suji[i])", "i", "range(2*n)", "range", "2*n", "2", "n", "if i%2==0:\n\t\ttlist.append(suji[i])\n\telse:\n\t\talist.append(suji[i])", "i%2==0", "i%2", "i", "2", "0", "tlist.append(suji[i])", "tlist.append", "tlist", "append", "suji[i]", "suji", "i", "alist.append(suji[i])", "alist.append", "alist", "append", "suji[i]", "suji", "i", "for i in range(n-1):\n\taaa=alist[i]//alist[i+1]\n\tttt=tlist[i]//tlist[i+1]\n\tif alist[i]%alist[i+1]!=0:\n\t\taaa+=1\n\tif tlist[i]%tlist[i+1]!=0:\n\t\tttt+=1\n\tk=max(aaa,ttt)\n\ttlist[i+1]=tlist[i+1]*k\n\talist[i+1]=alist[i+1]*k", "i", "range(n-1)", "range", "n-1", "n", "1", "aaa=alist[i]//alist[i+1]", "aaa", "alist[i]//alist[i+1]", "alist[i]", "alist", "i", "alist[i+1]", "alist", "i+1", "i", "1", "ttt=tlist[i]//tlist[i+1]", "ttt", "tlist[i]//tlist[i+1]", "tlist[i]", "tlist", "i", "tlist[i+1]", "tlist", "i+1", "i", "1", "if alist[i]%alist[i+1]!=0:\n\t\taaa+=1\n\t", "alist[i]%alist[i+1]!=0", "alist[i]%alist[i+1]", "alist[i]", "alist", "i", "alist[i+1]", "alist", "i+1", "i", "1", "0", "aaa+=1", "aaa", "1", "if tlist[i]%tlist[i+1]!=0:\n\t\tttt+=1\n\t", "tlist[i]%tlist[i+1]!=0", "tlist[i]%tlist[i+1]", "tlist[i]", "tlist", "i", "tlist[i+1]", "tlist", "i+1", "i", "1", "0", "ttt+=1", "ttt", "1", "k=max(aaa,ttt)", "k", "max(aaa,ttt)", "max", "aaa", "ttt", "tlist[i+1]=tlist[i+1]*k", "tlist[i+1]", "tlist", "i+1", "i", "1", "tlist[i+1]*k", "tlist[i+1]", "tlist", "i+1", "i", "1", "k", "alist[i+1]=alist[i+1]*k", "alist[i+1]", "alist", "i+1", "i", "1", "alist[i+1]*k", "alist[i+1]", "alist", "i+1", "i", "1", "k", "print(int(tlist[n-1]+alist[n-1]))", "print", "int(tlist[n-1]+alist[n-1])", "int", "tlist[n-1]+alist[n-1]", "tlist[n-1]", "tlist", "n-1", "n", "1", "alist[n-1]", "alist", "n-1", "n", "1", "k=max(aaa,ttt)", "max(aaa,ttt)", "k", "alist=[]", "[]", "alist", "aaa+=1", "1", "aaa", "ttt=tlist[i]//tlist[i+1]", "tlist[i]//tlist[i+1]", "ttt", "suji=[]", "[]", "suji", "tlist=[]", "[]", "tlist", "ttt+=1", "1", "ttt", "n=int(input())", "int(input())", "n", "aaa=alist[i]//alist[i+1]", "alist[i]//alist[i+1]", "aaa", "suji=suji+list(map(int,input().split()))", "suji+list(map(int,input().split()))", "suji" ]
n=int(input()) suji=[] for i in range (n): suji=suji+list(map(int,input().split())) tlist=[] alist=[] for i in range(2*n): if i%2==0: tlist.append(suji[i]) else: alist.append(suji[i]) for i in range(n-1): aaa=alist[i]//alist[i+1] ttt=tlist[i]//tlist[i+1] if alist[i]%alist[i+1]!=0: aaa+=1 if tlist[i]%tlist[i+1]!=0: ttt+=1 k=max(aaa,ttt) tlist[i+1]=tlist[i+1]*k alist[i+1]=alist[i+1]*k print(int(tlist[n-1]+alist[n-1]))
[ 7, 12, 13, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 17, 0, 13, 13, 14, 2, 13, 17, 4, 13, 4, 13, 18, 13, 17, 29, 0, 13, 18, 13, 17, 13, 28, 13, 13, 18, 13, 39, 17, 0, 13, 4, 13, 39, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 12, 11 ], [ 4, 14 ], [ 29, 28 ], [ 4, 32 ], [ 28, 39 ], [ 44, 43 ], [ 28, 45 ], [ 44, 47 ], [ 28, 52 ], [ 57, 56 ], [ 43, 63 ], [ 75, 63 ], [ 47, 70 ], [ 79, 70 ], [ 76, 75 ], [ 56, 77 ], [ 80, 79 ], [ 56, 81 ], [ 75, 86 ], [ 43, 86 ], [ 79, 87 ], [ 47, 87 ], [ 96, 93 ] ]
[ "def main():\n N = int(input())\n TA = [list(map(int, input().split(' '))) for _ in range(N)]\n if N == 1:\n print(sum(TA[0]))\n return\n cur_t, cur_a = TA[0]\n for t, a in TA[1:]:\n ratio = max([(cur_t + t - 1) // t, (cur_a + a - 1) // a])\n cur_t, cur_a = ratio * t, ratio * a\n print(cur_t + cur_a)\n\n\nif __name__ == '__main__':\n main()", "def main():\n N = int(input())\n TA = [list(map(int, input().split(' '))) for _ in range(N)]\n if N == 1:\n print(sum(TA[0]))\n return\n cur_t, cur_a = TA[0]\n for t, a in TA[1:]:\n ratio = max([(cur_t + t - 1) // t, (cur_a + a - 1) // a])\n cur_t, cur_a = ratio * t, ratio * a\n print(cur_t + cur_a)", "main", "N = int(input())", "N", "int(input())", "int", "input()", "input", "list(map(int, input().split(' '))) for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "list(map(int, input().split(' ')))", "list", "map(int, input().split(' '))", "map", "int", "input().split(' ')", "().split", "()", "input", "split", "' '", "TA = [list(map(int, input().split(' '))) for _ in range(N)]", "TA", "[list(map(int, input().split(' '))) for _ in range(N)]", "if N == 1:\n print(sum(TA[0]))\n return\n ", "N == 1", "N", "1", "print(sum(TA[0]))", "print", "sum(TA[0])", "sum", "TA[0]", "TA", "0", "return", "cur_t, cur_a = TA[0]", "cur_t", "TA[0]", "TA", "0", "cur_a", "for t, a in TA[1:]:\n ratio = max([(cur_t + t - 1) // t, (cur_a + a - 1) // a])\n cur_t, cur_a = ratio * t, ratio * a\n ", "t", "a", "TA[1:]", "TA", "1:", "1", "ratio = max([(cur_t + t - 1) // t, (cur_a + a - 1) // a])", "ratio", "max([(cur_t + t - 1) // t, (cur_a + a - 1) // a])", "max", "[(cur_t + t - 1) // t, (cur_a + a - 1) // a]", "(cur_t + t - 1) // t", "cur_t + t - 1", "cur_t + t", "cur_t", "t", "1", "t", "(cur_a + a - 1) // a", "cur_a + a - 1", "cur_a + a", "cur_a", "a", "1", "a", "cur_t, cur_a = ratio * t, ratio * a", "cur_t", "ratio * t", "ratio", "t", "cur_a", "ratio * a", "ratio", "a", "print(cur_t + cur_a)", "print", "cur_t + cur_a", "cur_t", "cur_a", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n N = int(input())\n TA = [list(map(int, input().split(' '))) for _ in range(N)]\n if N == 1:\n print(sum(TA[0]))\n return\n cur_t, cur_a = TA[0]\n for t, a in TA[1:]:\n ratio = max([(cur_t + t - 1) // t, (cur_a + a - 1) // a])\n cur_t, cur_a = ratio * t, ratio * a\n print(cur_t + cur_a)", "def main():\n N = int(input())\n TA = [list(map(int, input().split(' '))) for _ in range(N)]\n if N == 1:\n print(sum(TA[0]))\n return\n cur_t, cur_a = TA[0]\n for t, a in TA[1:]:\n ratio = max([(cur_t + t - 1) // t, (cur_a + a - 1) // a])\n cur_t, cur_a = ratio * t, ratio * a\n print(cur_t + cur_a)", "main" ]
def main(): N = int(input()) TA = [list(map(int, input().split(' '))) for _ in range(N)] if N == 1: print(sum(TA[0])) return cur_t, cur_a = TA[0] for t, a in TA[1:]: ratio = max([(cur_t + t - 1) // t, (cur_a + a - 1) // a]) cur_t, cur_a = ratio * t, ratio * a print(cur_t + cur_a) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 39, 0, 13, 39, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 4, 18, 13, 13, 13, 4, 18, 13, 13, 13, 0, 13, 18, 13, 17, 0, 13, 18, 13, 17, 28, 13, 4, 13, 13, 14, 2, 2, 13, 18, 13, 13, 2, 13, 18, 13, 13, 9, 14, 2, 2, 13, 18, 13, 13, 2, 13, 18, 13, 13, 0, 13, 2, 2, 2, 13, 18, 13, 13, 17, 18, 13, 13, 14, 2, 2, 13, 18, 13, 13, 2, 13, 18, 13, 13, 0, 13, 2, 2, 2, 13, 18, 13, 13, 17, 18, 13, 13, 0, 13, 2, 13, 18, 13, 13, 0, 13, 2, 13, 18, 13, 13, 0, 13, 2, 13, 13, 4, 13, 13, 10, 18, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 39, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 39, 13, 10, 18, 13 ]
[ [ 167, 2 ], [ 170, 8 ], [ 155, 11 ], [ 15, 14 ], [ 168, 17 ], [ 161, 19 ], [ 161, 28 ], [ 171, 31 ], [ 162, 33 ], [ 156, 36 ], [ 150, 38 ], [ 173, 40 ], [ 171, 42 ], [ 140, 45 ], [ 156, 47 ], [ 51, 50 ], [ 168, 53 ], [ 174, 57 ], [ 165, 57 ], [ 156, 59 ], [ 50, 60 ], [ 141, 62 ], [ 159, 62 ], [ 171, 64 ], [ 50, 65 ], [ 174, 70 ], [ 165, 70 ], [ 156, 72 ], [ 50, 73 ], [ 141, 75 ], [ 159, 75 ], [ 171, 77 ], [ 50, 78 ], [ 143, 80 ], [ 141, 84 ], [ 159, 84 ], [ 156, 86 ], [ 50, 87 ], [ 156, 90 ], [ 50, 91 ], [ 174, 95 ], [ 165, 95 ], [ 156, 97 ], [ 50, 98 ], [ 141, 100 ], [ 159, 100 ], [ 171, 102 ], [ 50, 103 ], [ 152, 105 ], [ 174, 109 ], [ 165, 109 ], [ 171, 111 ], [ 50, 112 ], [ 171, 115 ], [ 50, 116 ], [ 164, 118 ], [ 153, 120 ], [ 144, 120 ], [ 171, 122 ], [ 50, 123 ], [ 158, 125 ], [ 153, 127 ], [ 144, 127 ], [ 156, 129 ], [ 50, 130 ], [ 146, 132 ], [ 165, 134 ], [ 174, 134 ], [ 159, 135 ], [ 141, 135 ], [ 147, 138 ], [ 140, 141 ], [ 143, 144 ], [ 146, 147 ], [ 161, 150 ], [ 152, 153 ], [ 155, 156 ], [ 158, 159 ], [ 161, 162 ], [ 164, 165 ], [ 167, 168 ], [ 170, 171 ], [ 173, 174 ] ]
[ "n = int(input())\nt = []\na = []\nfor i in range(n):\n t_i, a_i = map(int, input().split())\n t.append(t_i)\n a.append(a_i)\n\nvt = t[0]\nva = a[0]\n\nfor i in range(n):\n if (vt * a[i] == va * t[i]):\n continue\n \n if(vt * a[i] < va * t[i]):\n x = (va + a[i] - 1)//a[i]\n elif (vt * a[i] > va * t[i]):\n x = (vt + t[i] - 1)//t[i]\n vt = x * t[i]\n va = x * a[i]\n\nans = vt + va\nprint(ans)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "t = []", "t", "[]", "a = []", "a", "[]", "for i in range(n):\n t_i, a_i = map(int, input().split())\n t.append(t_i)\n a.append(a_i)", "i", "range(n)", "range", "n", "t_i, a_i = map(int, input().split())", "t_i", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a_i", "t.append(t_i)", "t.append", "t", "append", "t_i", "a.append(a_i)", "a.append", "a", "append", "a_i", "vt = t[0]", "vt", "t[0]", "t", "0", "va = a[0]", "va", "a[0]", "a", "0", "for i in range(n):\n if (vt * a[i] == va * t[i]):\n continue\n \n if(vt * a[i] < va * t[i]):\n x = (va + a[i] - 1)//a[i]\n elif (vt * a[i] > va * t[i]):\n x = (vt + t[i] - 1)//t[i]\n vt = x * t[i]\n va = x * a[i]", "i", "range(n)", "range", "n", "if (vt * a[i] == va * t[i]):\n continue\n \n ", "vt * a[i] == va * t[i]", "vt * a[i]", "vt", "a[i]", "a", "i", "va * t[i]", "va", "t[i]", "t", "i", "continue", "if(vt * a[i] < va * t[i]):\n x = (va + a[i] - 1)//a[i]\n elif (vt * a[i] > va * t[i]):\n x = (vt + t[i] - 1)//t[i]\n ", "vt * a[i] < va * t[i]", "vt * a[i]", "vt", "a[i]", "a", "i", "va * t[i]", "va", "t[i]", "t", "i", "x = (va + a[i] - 1)//a[i]", "x", "(va + a[i] - 1)//a[i]", "va + a[i] - 1", "va + a[i]", "va", "a[i]", "a", "i", "1", "a[i]", "a", "i", "elif (vt * a[i] > va * t[i]):\n x = (vt + t[i] - 1)//t[i]\n ", "vt * a[i] > va * t[i]", "vt * a[i]", "vt", "a[i]", "a", "i", "va * t[i]", "va", "t[i]", "t", "i", "x = (vt + t[i] - 1)//t[i]", "x", "(vt + t[i] - 1)//t[i]", "vt + t[i] - 1", "vt + t[i]", "vt", "t[i]", "t", "i", "1", "t[i]", "t", "i", "vt = x * t[i]", "vt", "x * t[i]", "x", "t[i]", "t", "i", "va = x * a[i]", "va", "x * a[i]", "x", "a[i]", "a", "i", "ans = vt + va", "ans", "vt + va", "vt", "va", "print(ans)", "print", "ans", "va = a[0]", "a[0]", "va", "x = (va + a[i] - 1)//a[i]", "(va + a[i] - 1)//a[i]", "x", "ans = vt + va", "vt + va", "ans", "a_i = map(int, input().split())", "map(int, input().split())", "a_i", "x = (vt + t[i] - 1)//t[i]", "(vt + t[i] - 1)//t[i]", "x", "a = []", "[]", "a", "va = x * a[i]", "x * a[i]", "va", "t_i, a_i = map(int, input().split())", "map(int, input().split())", "t_i", "vt = x * t[i]", "x * t[i]", "vt", "n = int(input())", "int(input())", "n", "t = []", "[]", "t", "vt = t[0]", "t[0]", "vt" ]
n = int(input()) t = [] a = [] for i in range(n): t_i, a_i = map(int, input().split()) t.append(t_i) a.append(a_i) vt = t[0] va = a[0] for i in range(n): if (vt * a[i] == va * t[i]): continue if(vt * a[i] < va * t[i]): x = (va + a[i] - 1)//a[i] elif (vt * a[i] > va * t[i]): x = (vt + t[i] - 1)//t[i] vt = x * t[i] va = x * a[i] ans = vt + va print(ans)
[ 7, 12, 13, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 11, 10 ], [ 13, 12 ], [ 16, 15 ], [ 4, 18 ], [ 22, 21 ], [ 21, 30 ], [ 33, 32 ], [ 33, 34 ], [ 37, 36 ], [ 10, 42 ], [ 50, 42 ], [ 32, 43 ], [ 12, 47 ], [ 55, 47 ], [ 34, 48 ], [ 51, 50 ], [ 32, 52 ], [ 36, 53 ], [ 56, 55 ], [ 34, 57 ], [ 36, 58 ], [ 50, 62 ], [ 10, 62 ], [ 55, 63 ], [ 12, 63 ], [ 72, 69 ] ]
[ "def main():\n N = int(input())\n A, B = 1, 1\n for _ in range(N):\n t, a = (int(i) for i in input().split())\n mul = max(-(-A//t), -(-B//a))\n A = t*mul\n B = a*mul\n print(A+B)\n\n\nif __name__ == '__main__':\n main()", "def main():\n N = int(input())\n A, B = 1, 1\n for _ in range(N):\n t, a = (int(i) for i in input().split())\n mul = max(-(-A//t), -(-B//a))\n A = t*mul\n B = a*mul\n print(A+B)", "main", "N = int(input())", "N", "int(input())", "int", "input()", "input", "A, B = 1, 1", "A", "1", "B", "1", "for _ in range(N):\n t, a = (int(i) for i in input().split())\n mul = max(-(-A//t), -(-B//a))\n A = t*mul\n B = a*mul\n ", "_", "range(N)", "range", "N", "int(i) for i in input().split()", "for i in input().split()", "i", "input().split()", "().split", "()", "input", "split", "for i in input().split()", "int(i)", "int", "i", "t, a = (int(i) for i in input().split())", "t", "(int(i) for i in input().split())", "a", "mul = max(-(-A//t), -(-B//a))", "mul", "max(-(-A//t), -(-B//a))", "max", "-(-A//t)", "-A//t", "-A", "A", "t", "-(-B//a)", "-B//a", "-B", "B", "a", "A = t*mul", "A", "t*mul", "t", "mul", "B = a*mul", "B", "a*mul", "a", "mul", "print(A+B)", "print", "A+B", "A", "B", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n N = int(input())\n A, B = 1, 1\n for _ in range(N):\n t, a = (int(i) for i in input().split())\n mul = max(-(-A//t), -(-B//a))\n A = t*mul\n B = a*mul\n print(A+B)", "def main():\n N = int(input())\n A, B = 1, 1\n for _ in range(N):\n t, a = (int(i) for i in input().split())\n mul = max(-(-A//t), -(-B//a))\n A = t*mul\n B = a*mul\n print(A+B)", "main" ]
def main(): N = int(input()) A, B = 1, 1 for _ in range(N): t, a = (int(i) for i in input().split()) mul = max(-(-A//t), -(-B//a)) A = t*mul B = a*mul print(A+B) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 13, 13, 2, 13, 13, 17, 42, 2, 2, 13, 2, 13, 13, 2, 13, 2, 13, 13, 0, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13 ]
[ [ 80, 2 ], [ 92, 8 ], [ 89, 11 ], [ 15, 14 ], [ 81, 17 ], [ 74, 19 ], [ 74, 28 ], [ 83, 30 ], [ 93, 34 ], [ 96, 34 ], [ 72, 35 ], [ 90, 37 ], [ 87, 37 ], [ 75, 38 ], [ 93, 43 ], [ 96, 43 ], [ 84, 45 ], [ 78, 45 ], [ 72, 46 ], [ 90, 48 ], [ 87, 48 ], [ 84, 50 ], [ 78, 50 ], [ 75, 51 ], [ 77, 53 ], [ 95, 56 ], [ 78, 58 ], [ 84, 58 ], [ 72, 59 ], [ 86, 61 ], [ 78, 63 ], [ 84, 63 ], [ 75, 64 ], [ 96, 68 ], [ 93, 68 ], [ 87, 69 ], [ 90, 69 ], [ 74, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ] ]
[ "N = int(input())\nT = 0\nA = 0\nfor _ in range(N):\n t, a = map(int, input().split())\n i = max(T//t, A//a, 1)\n while T > i*t or A > i*a:\n i += 1\n T = i*t\n A = i*a\n \nprint(T+A)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "T = 0", "T", "0", "A = 0", "A", "0", "for _ in range(N):\n t, a = map(int, input().split())\n i = max(T//t, A//a, 1)\n while T > i*t or A > i*a:\n i += 1\n T = i*t\n A = i*a\n ", "_", "range(N)", "range", "N", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "i = max(T//t, A//a, 1)", "i", "max(T//t, A//a, 1)", "max", "T//t", "T", "t", "A//a", "A", "a", "1", "while T > i*t or A > i*a:\n i += 1\n ", "T > i*t or A > i*a", "T > i*t", "T", "i*t", "i", "t", "A > i*a", "A", "i*a", "i", "a", "i += 1", "i", "1", "T = i*t", "T", "i*t", "i", "t", "A = i*a", "A", "i*a", "i", "a", "print(T+A)", "print", "T+A", "T", "A", "t, a = map(int, input().split())", "map(int, input().split())", "t", "a = map(int, input().split())", "map(int, input().split())", "a", "i += 1", "1", "i", "N = int(input())", "int(input())", "N", "i = max(T//t, A//a, 1)", "max(T//t, A//a, 1)", "i", "A = i*a", "i*a", "A", "A = 0", "0", "A", "T = 0", "0", "T", "T = i*t", "i*t", "T" ]
N = int(input()) T = 0 A = 0 for _ in range(N): t, a = map(int, input().split()) i = max(T//t, A//a, 1) while T > i*t or A > i*a: i += 1 T = i*t A = i*a print(T+A)
[ 7, 12, 13, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 11, 10 ], [ 13, 12 ], [ 16, 15 ], [ 4, 18 ], [ 21, 20 ], [ 21, 29 ], [ 32, 31 ], [ 10, 37 ], [ 45, 37 ], [ 20, 38 ], [ 12, 42 ], [ 50, 42 ], [ 29, 43 ], [ 46, 45 ], [ 20, 47 ], [ 31, 48 ], [ 51, 50 ], [ 29, 52 ], [ 31, 53 ], [ 45, 57 ], [ 10, 57 ], [ 50, 58 ], [ 12, 58 ], [ 67, 64 ] ]
[ "def solve():\n N = int(input())\n\n now_t, now_a = 1,1\n for _ in range(N):\n t, a = map(int,input().split())\n n = max(-(-now_t//t), -(-now_a//a))\n now_t = t * n\n now_a = a * n\n \n print(now_t + now_a)\n \nif __name__ == '__main__':\n solve()", "def solve():\n N = int(input())\n\n now_t, now_a = 1,1\n for _ in range(N):\n t, a = map(int,input().split())\n n = max(-(-now_t//t), -(-now_a//a))\n now_t = t * n\n now_a = a * n\n \n print(now_t + now_a)\n ", "solve", "N = int(input())", "N", "int(input())", "int", "input()", "input", "now_t, now_a = 1,1", "now_t", "1", "now_a", "1", "for _ in range(N):\n t, a = map(int,input().split())\n n = max(-(-now_t//t), -(-now_a//a))\n now_t = t * n\n now_a = a * n\n \n ", "_", "range(N)", "range", "N", "t, a = map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "n = max(-(-now_t//t), -(-now_a//a))", "n", "max(-(-now_t//t), -(-now_a//a))", "max", "-(-now_t//t)", "-now_t//t", "-now_t", "now_t", "t", "-(-now_a//a)", "-now_a//a", "-now_a", "now_a", "a", "now_t = t * n", "now_t", "t * n", "t", "n", "now_a = a * n", "now_a", "a * n", "a", "n", "print(now_t + now_a)", "print", "now_t + now_a", "now_t", "now_a", "if __name__ == '__main__':\n solve()", "__name__ == '__main__'", "__name__", "'__main__'", "solve()", "solve", "def solve():\n N = int(input())\n\n now_t, now_a = 1,1\n for _ in range(N):\n t, a = map(int,input().split())\n n = max(-(-now_t//t), -(-now_a//a))\n now_t = t * n\n now_a = a * n\n \n print(now_t + now_a)\n ", "def solve():\n N = int(input())\n\n now_t, now_a = 1,1\n for _ in range(N):\n t, a = map(int,input().split())\n n = max(-(-now_t//t), -(-now_a//a))\n now_t = t * n\n now_a = a * n\n \n print(now_t + now_a)\n ", "solve" ]
def solve(): N = int(input()) now_t, now_a = 1,1 for _ in range(N): t, a = map(int,input().split()) n = max(-(-now_t//t), -(-now_a//a)) now_t = t * n now_a = a * n print(now_t + now_a) if __name__ == '__main__': solve()
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 40, 2, 40, 13, 13, 0, 13, 40, 2, 40, 13, 13, 0, 13, 2, 4, 13, 13, 13, 13, 13, 2, 4, 13, 13, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 40, 13, 10, 2, 13, 10, 40, 13 ]
[ [ 66, 2 ], [ 69, 8 ], [ 72, 10 ], [ 14, 13 ], [ 67, 16 ], [ 78, 18 ], [ 78, 27 ], [ 87, 29 ], [ 70, 33 ], [ 85, 33 ], [ 79, 34 ], [ 81, 36 ], [ 73, 40 ], [ 64, 40 ], [ 76, 41 ], [ 84, 43 ], [ 88, 47 ], [ 82, 48 ], [ 79, 49 ], [ 63, 50 ], [ 88, 54 ], [ 82, 55 ], [ 76, 56 ], [ 85, 60 ], [ 70, 60 ], [ 64, 61 ], [ 73, 61 ], [ 63, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ], [ 78, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ] ]
[ "n=int(input())\na,b=1,1\n\nfor i in range(n):\n x,y=map(int,input().split())\n s=-(-a//x)\n t=-(-b//y)\n a,b=max(s,t)*x,max(s,t)*y\n\nprint(a+b)", "n=int(input())", "n", "int(input())", "int", "input()", "input", "a,b=1,1", "a", "1", "b", "1", "for i in range(n):\n x,y=map(int,input().split())\n s=-(-a//x)\n t=-(-b//y)\n a,b=max(s,t)*x,max(s,t)*y", "i", "range(n)", "range", "n", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "s=-(-a//x)", "s", "-(-a//x)", "-a//x", "-a", "a", "x", "t=-(-b//y)", "t", "-(-b//y)", "-b//y", "-b", "b", "y", "a,b=max(s,t)*x,max(s,t)*y", "a", "max(s,t)*x", "max(s,t)", "max", "s", "t", "x", "b", "max(s,t)*y", "max(s,t)", "max", "s", "t", "y", "print(a+b)", "print", "a+b", "a", "b", "b=max(s,t)*x,max(s,t)*y", "max(s,t)*y", "b", "n=int(input())", "int(input())", "n", "a,b=1,1", "1", "a", "b=1,1", "1", "b", "y=map(int,input().split())", "map(int,input().split())", "y", "x,y=map(int,input().split())", "map(int,input().split())", "x", "t=-(-b//y)", "-(-b//y)", "t", "a,b=max(s,t)*x,max(s,t)*y", "max(s,t)*x", "a", "s=-(-a//x)", "-(-a//x)", "s" ]
n=int(input()) a,b=1,1 for i in range(n): x,y=map(int,input().split()) s=-(-a//x) t=-(-b//y) a,b=max(s,t)*x,max(s,t)*y print(a+b)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 17, 13, 17, 2, 2, 2, 13, 17, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 14, 2, 2, 13, 13, 17, 0, 13, 13, 0, 13, 13, 0, 13, 2, 13, 13, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 13, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 105, 2 ], [ 87, 8 ], [ 81, 11 ], [ 15, 14 ], [ 106, 17 ], [ 84, 19 ], [ 84, 28 ], [ 108, 30 ], [ 88, 36 ], [ 103, 36 ], [ 94, 36 ], [ 79, 38 ], [ 82, 43 ], [ 91, 43 ], [ 97, 43 ], [ 85, 45 ], [ 93, 48 ], [ 79, 50 ], [ 109, 51 ], [ 96, 53 ], [ 85, 55 ], [ 109, 56 ], [ 97, 60 ], [ 82, 60 ], [ 91, 60 ], [ 94, 61 ], [ 88, 61 ], [ 103, 61 ], [ 102, 64 ], [ 79, 65 ], [ 90, 67 ], [ 85, 68 ], [ 99, 70 ], [ 103, 72 ], [ 94, 72 ], [ 88, 72 ], [ 91, 73 ], [ 97, 73 ], [ 82, 73 ], [ 100, 76 ], [ 84, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ], [ 85, 90 ], [ 90, 91 ], [ 93, 94 ], [ 96, 97 ], [ 99, 100 ], [ 79, 102 ], [ 102, 103 ], [ 105, 106 ], [ 108, 109 ] ]
[ "N = int(input())\n\nt = 0\na = 0\nfor _ in range(N):\n rt,ra = map(int,input().split())\n c = max((t-1)//rt+1, (a-1)//ra+1)\n t = rt*c\n a = ra*c\n if a+t == 0:\n t += rt\n a += ra\n \nanswer = t+a\nprint(answer)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "t = 0", "t", "0", "a = 0", "a", "0", "for _ in range(N):\n rt,ra = map(int,input().split())\n c = max((t-1)//rt+1, (a-1)//ra+1)\n t = rt*c\n a = ra*c\n if a+t == 0:\n t += rt\n a += ra\n ", "_", "range(N)", "range", "N", "rt,ra = map(int,input().split())", "rt", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ra", "c = max((t-1)//rt+1, (a-1)//ra+1)", "c", "max((t-1)//rt+1, (a-1)//ra+1)", "max", "(t-1)//rt+1", "(t-1)//rt", "t-1", "t", "1", "rt", "1", "(a-1)//ra+1", "(a-1)//ra", "a-1", "a", "1", "ra", "1", "t = rt*c", "t", "rt*c", "rt", "c", "a = ra*c", "a", "ra*c", "ra", "c", "if a+t == 0:\n t += rt\n a += ra\n ", "a+t == 0", "a+t", "a", "t", "0", "t += rt", "t", "rt", "a += ra", "a", "ra", "answer = t+a", "answer", "t+a", "t", "a", "print(answer)", "print", "answer", "rt,ra = map(int,input().split())", "map(int,input().split())", "rt", "a = 0", "0", "a", "ra = map(int,input().split())", "map(int,input().split())", "ra", "t = 0", "0", "t", "a += ra", "ra", "a", "t = rt*c", "rt*c", "t", "a = ra*c", "ra*c", "a", "answer = t+a", "t+a", "answer", "t += rt", "rt", "t", "N = int(input())", "int(input())", "N", "c = max((t-1)//rt+1, (a-1)//ra+1)", "max((t-1)//rt+1, (a-1)//ra+1)", "c" ]
N = int(input()) t = 0 a = 0 for _ in range(N): rt,ra = map(int,input().split()) c = max((t-1)//rt+1, (a-1)//ra+1) t = rt*c a = ra*c if a+t == 0: t += rt a += ra answer = t+a print(answer)
[ 7, 15, 13, 12, 13, 12, 13, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 2, 13, 13, 2, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 9, 8 ], [ 90, 12 ], [ 15, 14 ], [ 90, 21 ], [ 15, 23 ], [ 26, 25 ], [ 8, 29 ], [ 33, 32 ], [ 90, 39 ], [ 33, 41 ], [ 14, 45 ], [ 69, 45 ], [ 41, 46 ], [ 23, 48 ], [ 73, 48 ], [ 32, 49 ], [ 52, 51 ], [ 14, 57 ], [ 69, 57 ], [ 32, 58 ], [ 32, 60 ], [ 23, 64 ], [ 73, 64 ], [ 41, 65 ], [ 41, 67 ], [ 70, 69 ], [ 32, 71 ], [ 51, 72 ], [ 74, 73 ], [ 41, 75 ], [ 51, 76 ], [ 69, 80 ], [ 14, 80 ], [ 73, 81 ], [ 23, 81 ], [ 93, 87 ] ]
[ "import sys\ndef input(): return sys.stdin.readline().strip()\n\ndef main():\n N = int(input())\n t, a = map(int, input().split())\n for _ in range(N - 1):\n nt, na = map(int, input().split())\n if t * na == a * nt: continue\n # ceilใงไธๅ‹•ๅฐๆ•ฐ็‚น่ชคๅทฎใŒๅ‡บใฆWAใซใชใ‚‹ใ‚ฑใƒผใ‚นใฏๅˆใ‚ใฆ๏ผ\n # C++ใจๅŒใ˜ๆตๅ„€ใง็นฐใ‚ŠไธŠใ’ใ—ใชใ„ใจใƒ€ใƒกใชใ‚“ใ ใ€‚ใ€‚ใ€‚\n k = max((t + nt - 1) // nt, (a + na - 1) // na)\n t, a = nt * k, na * k\n\n print(t + a)\n\n\n\n\nif __name__ == \"__main__\":\n main()", "import sys", "sys", "def input(): return sys.stdin.readline().strip()", "input", "def main():\n N = int(input())\n t, a = map(int, input().split())\n for _ in range(N - 1):\n nt, na = map(int, input().split())\n if t * na == a * nt: continue\n # ceilใงไธๅ‹•ๅฐๆ•ฐ็‚น่ชคๅทฎใŒๅ‡บใฆWAใซใชใ‚‹ใ‚ฑใƒผใ‚นใฏๅˆใ‚ใฆ๏ผ\n # C++ใจๅŒใ˜ๆตๅ„€ใง็นฐใ‚ŠไธŠใ’ใ—ใชใ„ใจใƒ€ใƒกใชใ‚“ใ ใ€‚ใ€‚ใ€‚\n k = max((t + nt - 1) // nt, (a + na - 1) // na)\n t, a = nt * k, na * k\n\n print(t + a)", "main", "N = int(input())", "N", "int(input())", "int", "input()", "input", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "for _ in range(N - 1):\n nt, na = map(int, input().split())\n if t * na == a * nt: continue\n # ceilใงไธๅ‹•ๅฐๆ•ฐ็‚น่ชคๅทฎใŒๅ‡บใฆWAใซใชใ‚‹ใ‚ฑใƒผใ‚นใฏๅˆใ‚ใฆ๏ผ\n # C++ใจๅŒใ˜ๆตๅ„€ใง็นฐใ‚ŠไธŠใ’ใ—ใชใ„ใจใƒ€ใƒกใชใ‚“ใ ใ€‚ใ€‚ใ€‚\n k = max((t + nt - 1) // nt, (a + na - 1) // na)\n t, a = nt * k, na * k\n\n ", "_", "range(N - 1)", "range", "N - 1", "N", "1", "nt, na = map(int, input().split())", "nt", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "na", "if t * na == a * nt: continue\n # ceilใงไธๅ‹•ๅฐๆ•ฐ็‚น่ชคๅทฎใŒๅ‡บใฆWAใซใชใ‚‹ใ‚ฑใƒผใ‚นใฏๅˆใ‚ใฆ๏ผ\n # C++ใจๅŒใ˜ๆตๅ„€ใง็นฐใ‚ŠไธŠใ’ใ—ใชใ„ใจใƒ€ใƒกใชใ‚“ใ ใ€‚ใ€‚ใ€‚\n ", "t * na == a * nt", "t * na", "t", "na", "a * nt", "a", "nt", "k = max((t + nt - 1) // nt, (a + na - 1) // na)", "k", "max((t + nt - 1) // nt, (a + na - 1) // na)", "max", "(t + nt - 1) // nt", "t + nt - 1", "t + nt", "t", "nt", "1", "nt", "(a + na - 1) // na", "a + na - 1", "a + na", "a", "na", "1", "na", "t, a = nt * k, na * k", "t", "nt * k", "nt", "k", "a", "na * k", "na", "k", "print(t + a)", "print", "t + a", "t", "a", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def input(): return sys.stdin.readline().strip()", "def input(): return sys.stdin.readline().strip()", "input", "def main():\n N = int(input())\n t, a = map(int, input().split())\n for _ in range(N - 1):\n nt, na = map(int, input().split())\n if t * na == a * nt: continue\n # ceilใงไธๅ‹•ๅฐๆ•ฐ็‚น่ชคๅทฎใŒๅ‡บใฆWAใซใชใ‚‹ใ‚ฑใƒผใ‚นใฏๅˆใ‚ใฆ๏ผ\n # C++ใจๅŒใ˜ๆตๅ„€ใง็นฐใ‚ŠไธŠใ’ใ—ใชใ„ใจใƒ€ใƒกใชใ‚“ใ ใ€‚ใ€‚ใ€‚\n k = max((t + nt - 1) // nt, (a + na - 1) // na)\n t, a = nt * k, na * k\n\n print(t + a)", "def main():\n N = int(input())\n t, a = map(int, input().split())\n for _ in range(N - 1):\n nt, na = map(int, input().split())\n if t * na == a * nt: continue\n # ceilใงไธๅ‹•ๅฐๆ•ฐ็‚น่ชคๅทฎใŒๅ‡บใฆWAใซใชใ‚‹ใ‚ฑใƒผใ‚นใฏๅˆใ‚ใฆ๏ผ\n # C++ใจๅŒใ˜ๆตๅ„€ใง็นฐใ‚ŠไธŠใ’ใ—ใชใ„ใจใƒ€ใƒกใชใ‚“ใ ใ€‚ใ€‚ใ€‚\n k = max((t + nt - 1) // nt, (a + na - 1) // na)\n t, a = nt * k, na * k\n\n print(t + a)", "main" ]
import sys def input(): return sys.stdin.readline().strip() def main(): N = int(input()) t, a = map(int, input().split()) for _ in range(N - 1): nt, na = map(int, input().split()) if t * na == a * nt: continue # ceilใงไธๅ‹•ๅฐๆ•ฐ็‚น่ชคๅทฎใŒๅ‡บใฆWAใซใชใ‚‹ใ‚ฑใƒผใ‚นใฏๅˆใ‚ใฆ๏ผ # C++ใจๅŒใ˜ๆตๅ„€ใง็นฐใ‚ŠไธŠใ’ใ—ใชใ„ใจใƒ€ใƒกใชใ‚“ใ ใ€‚ใ€‚ใ€‚ k = max((t + nt - 1) // nt, (a + na - 1) // na) t, a = nt * k, na * k print(t + a) if __name__ == "__main__": main()
[ 7, 15, 13, 0, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 15, 4, 18, 13, 13, 17, 12, 13, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 18, 13, 17, 13, 12, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 17, 28, 13, 4, 13, 2, 13, 17, 17, 17, 0, 13, 18, 13, 13, 13, 0, 13, 4, 13, 2, 13, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 14, 2, 13, 17, 0, 13, 17, 3, 29, 13, 23, 13, 0, 13, 2, 17, 17, 0, 13, 17, 42, 2, 2, 13, 13, 17, 0, 13, 2, 2, 13, 13, 17, 14, 4, 13, 13, 0, 13, 13, 0, 13, 13, 4, 13, 2, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 2, 13, 10, 2, 13 ]
[ [ 165, 4 ], [ 168, 9 ], [ 25, 24 ], [ 32, 31 ], [ 24, 34 ], [ 48, 47 ], [ 51, 50 ], [ 47, 52 ], [ 51, 54 ], [ 59, 58 ], [ 116, 60 ], [ 50, 61 ], [ 64, 63 ], [ 116, 65 ], [ 54, 66 ], [ 69, 68 ], [ 72, 71 ], [ 24, 75 ], [ 81, 80 ], [ 47, 82 ], [ 71, 83 ], [ 81, 84 ], [ 87, 86 ], [ 58, 90 ], [ 96, 90 ], [ 80, 91 ], [ 63, 93 ], [ 101, 93 ], [ 84, 94 ], [ 97, 96 ], [ 86, 98 ], [ 80, 99 ], [ 102, 101 ], [ 86, 103 ], [ 84, 104 ], [ 101, 107 ], [ 63, 107 ], [ 111, 110 ], [ 110, 114 ], [ 68, 114 ], [ 116, 116 ], [ 119, 118 ], [ 124, 123 ], [ 118, 128 ], [ 143, 128 ], [ 123, 129 ], [ 146, 129 ], [ 133, 132 ], [ 118, 135 ], [ 143, 135 ], [ 123, 136 ], [ 146, 136 ], [ 56, 140 ], [ 132, 141 ], [ 144, 143 ], [ 132, 144 ], [ 147, 146 ], [ 132, 147 ], [ 143, 151 ], [ 118, 151 ], [ 54, 153 ], [ 50, 154 ], [ 163, 160 ], [ 165, 166 ], [ 168, 169 ] ]
[ "import sys\nINF = 10 ** 9\nMOD = 10 ** 9 + 7\nfrom collections import deque\nsys.setrecursionlimit(100000000)\n\n\ndef main():\n n = int(input())\n senkyo = [tuple(map(int,input().split())) for _ in range(n)]\n \n last_t,last_a = senkyo[-1]\n \n def ok(x):\n t = x * last_t\n a = x * last_a\n flag = True\n for i in range(n - 2, -1, -1):\n ti,ai = senkyo[i]\n y = min(t//ti,a//ai)\n t = y * ti\n a = y * ai\n if a == 0 :\n flag = False\n break\n return flag\n \n r = 10 ** 18\n l = 0\n while r - l > 1:\n mid = (r + l)//2\n if ok(mid):\n r = mid\n else:\n l = mid\n \n print(r * (last_a + last_t))\n\nif __name__=='__main__':\n main()\n\n", "import sys", "sys", "INF = 10 ** 9", "INF", "10 ** 9", "10", "9", "MOD = 10 ** 9 + 7", "MOD", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "from collections import deque", "sys.setrecursionlimit(100000000)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "100000000", "def main():\n n = int(input())\n senkyo = [tuple(map(int,input().split())) for _ in range(n)]\n \n last_t,last_a = senkyo[-1]\n \n def ok(x):\n t = x * last_t\n a = x * last_a\n flag = True\n for i in range(n - 2, -1, -1):\n ti,ai = senkyo[i]\n y = min(t//ti,a//ai)\n t = y * ti\n a = y * ai\n if a == 0 :\n flag = False\n break\n return flag\n \n r = 10 ** 18\n l = 0\n while r - l > 1:\n mid = (r + l)//2\n if ok(mid):\n r = mid\n else:\n l = mid\n \n print(r * (last_a + last_t))", "main", "n = int(input())", "n", "int(input())", "int", "input()", "input", "tuple(map(int,input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "tuple(map(int,input().split()))", "tuple", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "senkyo = [tuple(map(int,input().split())) for _ in range(n)]", "senkyo", "[tuple(map(int,input().split())) for _ in range(n)]", "last_t,last_a = senkyo[-1]", "last_t", "senkyo[-1]", "senkyo", "-1", "last_a", "def ok(x):\n t = x * last_t\n a = x * last_a\n flag = True\n for i in range(n - 2, -1, -1):\n ti,ai = senkyo[i]\n y = min(t//ti,a//ai)\n t = y * ti\n a = y * ai\n if a == 0 :\n flag = False\n break\n return flag\n \n ", "ok", "t = x * last_t", "t", "x * last_t", "x", "last_t", "a = x * last_a", "a", "x * last_a", "x", "last_a", "flag = True", "flag", "True", "for i in range(n - 2, -1, -1):\n ti,ai = senkyo[i]\n y = min(t//ti,a//ai)\n t = y * ti\n a = y * ai\n if a == 0 :\n flag = False\n break\n ", "i", "range(n - 2, -1, -1)", "range", "n - 2", "n", "2", "-1", "-1", "ti,ai = senkyo[i]", "ti", "senkyo[i]", "senkyo", "i", "ai", "y = min(t//ti,a//ai)", "y", "min(t//ti,a//ai)", "min", "t//ti", "t", "ti", "a//ai", "a", "ai", "t = y * ti", "t", "y * ti", "y", "ti", "a = y * ai", "a", "y * ai", "y", "ai", "if a == 0 :\n flag = False\n break\n ", "a == 0", "a", "0", "flag = False", "flag", "False", "break", "return flag", "flag", "x", "x", "r = 10 ** 18", "r", "10 ** 18", "10", "18", "l = 0", "l", "0", "while r - l > 1:\n mid = (r + l)//2\n if ok(mid):\n r = mid\n else:\n l = mid\n \n ", "r - l > 1", "r - l", "r", "l", "1", "mid = (r + l)//2", "mid", "(r + l)//2", "r + l", "r", "l", "2", "if ok(mid):\n r = mid\n else:\n l = mid\n \n ", "ok(mid)", "ok", "mid", "r = mid", "r", "mid", "l = mid", "l", "mid", "print(r * (last_a + last_t))", "print", "r * (last_a + last_t)", "r", "last_a + last_t", "last_a", "last_t", "if __name__=='__main__':\n main()", "__name__=='__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n n = int(input())\n senkyo = [tuple(map(int,input().split())) for _ in range(n)]\n \n last_t,last_a = senkyo[-1]\n \n def ok(x):\n t = x * last_t\n a = x * last_a\n flag = True\n for i in range(n - 2, -1, -1):\n ti,ai = senkyo[i]\n y = min(t//ti,a//ai)\n t = y * ti\n a = y * ai\n if a == 0 :\n flag = False\n break\n return flag\n \n r = 10 ** 18\n l = 0\n while r - l > 1:\n mid = (r + l)//2\n if ok(mid):\n r = mid\n else:\n l = mid\n \n print(r * (last_a + last_t))", "def main():\n n = int(input())\n senkyo = [tuple(map(int,input().split())) for _ in range(n)]\n \n last_t,last_a = senkyo[-1]\n \n def ok(x):\n t = x * last_t\n a = x * last_a\n flag = True\n for i in range(n - 2, -1, -1):\n ti,ai = senkyo[i]\n y = min(t//ti,a//ai)\n t = y * ti\n a = y * ai\n if a == 0 :\n flag = False\n break\n return flag\n \n r = 10 ** 18\n l = 0\n while r - l > 1:\n mid = (r + l)//2\n if ok(mid):\n r = mid\n else:\n l = mid\n \n print(r * (last_a + last_t))", "main", "INF = 10 ** 9", "10 ** 9", "INF", "MOD = 10 ** 9 + 7", "10 ** 9 + 7", "MOD" ]
import sys INF = 10 ** 9 MOD = 10 ** 9 + 7 from collections import deque sys.setrecursionlimit(100000000) def main(): n = int(input()) senkyo = [tuple(map(int,input().split())) for _ in range(n)] last_t,last_a = senkyo[-1] def ok(x): t = x * last_t a = x * last_a flag = True for i in range(n - 2, -1, -1): ti,ai = senkyo[i] y = min(t//ti,a//ai) t = y * ti a = y * ai if a == 0 : flag = False break return flag r = 10 ** 18 l = 0 while r - l > 1: mid = (r + l)//2 if ok(mid): r = mid else: l = mid print(r * (last_a + last_t)) if __name__=='__main__': main()
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 4, 18, 13, 13, 2, 17, 17, 15, 15, 15, 15, 15, 15, 15, 15, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 39, 4, 13, 12, 13, 12, 13, 12, 13, 23, 13, 12, 13, 23, 13, 0, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 0, 13, 13, 12, 13, 41, 41, 28, 13, 4, 13, 4, 13, 2, 13, 13, 2, 13, 13, 2, 4, 13, 2, 13, 13, 2, 13, 13, 17, 0, 13, 2, 13, 13, 13, 2, 13, 13, 14, 2, 40, 13, 13, 40, 13, 13, 3, 29, 39, 13, 13, 23, 13, 23, 13, 23, 13, 23, 13, 0, 13, 18, 13, 17, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 13, 18, 18, 13, 2, 13, 17, 17, 18, 18, 13, 2, 13, 17, 17, 13, 4, 13, 2, 13, 13, 17, 10, 2, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 18, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 4, 13, 10, 2, 13, 10, 18, 13, 10, 13, 13, 10, 4, 13, 10, 12, 13, 10, 18, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 221, 4 ], [ 34, 33 ], [ 222, 41 ], [ 47, 46 ], [ 243, 53 ], [ 61, 61 ], [ 65, 65 ], [ 191, 67 ], [ 218, 72 ], [ 215, 79 ], [ 198, 81 ], [ 85, 84 ], [ 216, 87 ], [ 243, 90 ], [ 224, 92 ], [ 100, 99 ], [ 143, 105 ], [ 147, 106 ], [ 145, 108 ], [ 149, 109 ], [ 143, 114 ], [ 147, 115 ], [ 145, 117 ], [ 149, 118 ], [ 122, 121 ], [ 147, 123 ], [ 99, 124 ], [ 126, 125 ], [ 149, 127 ], [ 99, 128 ], [ 121, 132 ], [ 143, 133 ], [ 125, 135 ], [ 145, 136 ], [ 143, 143 ], [ 145, 145 ], [ 147, 147 ], [ 149, 149 ], [ 233, 151 ], [ 225, 153 ], [ 233, 155 ], [ 158, 157 ], [ 216, 161 ], [ 227, 164 ], [ 237, 166 ], [ 234, 167 ], [ 207, 167 ], [ 204, 168 ], [ 228, 168 ], [ 225, 171 ], [ 157, 173 ], [ 225, 178 ], [ 157, 180 ], [ 227, 183 ], [ 207, 187 ], [ 234, 187 ], [ 228, 188 ], [ 204, 188 ], [ 191, 192 ], [ 233, 204 ], [ 227, 207 ], [ 215, 216 ], [ 218, 219 ], [ 221, 222 ], [ 224, 225 ], [ 227, 228 ], [ 233, 234 ] ]
[ "# coding: utf-8\n# hello worldใจ่กจ็คบใ™ใ‚‹\nimport sys\n#import numpy\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nfrom collections import Counter, deque\nfrom collections import defaultdict\nfrom itertools import combinations, permutations, accumulate, groupby, product\nfrom bisect import bisect_left,bisect_right\nfrom heapq import heapify, heappop, heappush\nfrom math import floor, ceil,pi,factorial\nfrom operator import itemgetter\nfrom copy import deepcopy\ndef I(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(map(int, input().split()))\ndef LI2(): return [int(input()) for i in range(n)]\ndef MXI(): return [[LI()]for i in range(n)]\ndef SI(): return input().rstrip()\ndef printns(x): print('\\n'.join(x))\ndef printni(x): print('\\n'.join(list(map(str,x))))\ninf = 10**17\nmod = 10**9 + 7\n\nn=I()\npairs=[LI() for i in range(n)]\ndef pair_revise(x,y,a,b):\n global p\n global q\n #print(x,y,a,b)\n for i in range(max(x//a,y//b),max(x//a,y//b)+2):\n p,q=a*i,b*i\n if p>=x and q>=y:\n break\n return [p,q]\n #return [x*max(ceil(x/a),ceil(y/b)),y*max(ceil(x/a),ceil(y/b))]\n #for i in range(max(ceil(x/a),ceil(y/b)),):\nu,v=pairs[0]\nfor i in range(n-1):\n u,v=pair_revise(u,v,pairs[i+1][0],pairs[i+1][1])\nprint(u+v)\n \n \n \n\n\n\n\n\n\n\n\n\n'''def pair_revise(x,y,a,b):\n global p\n global q\n i=max(ceil(x/a),ceil(y/b))\n p,q=a*i,b*i\n return p,q\nu,v=1,1\nfor i in range(n):\n u,v=pair_revise(u,v,pairs[i][0],pairs[i][1])\n print(u,v)\nprint(u+v)'''\n\n \n \n \n\n\n", "import sys", "sys", "input = sys.stdin.readline", "input", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "sys.setrecursionlimit(10**7)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**7", "10", "7", "from collections import Counter, deque", "from collections import defaultdict", "from itertools import combinations, permutations, accumulate, groupby, product", "from bisect import bisect_left,bisect_right", "from heapq import heapify, heappop, heappush", "from math import floor, ceil,pi,factorial", "from operator import itemgetter", "from copy import deepcopy", "def I(): return int(input())", "I", "def MI(): return map(int, input().split())", "MI", "def LI(): return list(map(int, input().split()))", "LI", "int(input()) for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "int(input())", "int", "input()", "input", "def LI2(): return [int(input()) for i in range(n)]", "LI2", "[LI()]for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "[LI()]", "LI()", "LI", "def MXI(): return [[LI()]for i in range(n)]", "MXI", "def SI(): return input().rstrip()", "SI", "def printns(x): print('\\n'.join(x))", "printns", "x", "x", "def printni(x): print('\\n'.join(list(map(str,x))))", "printni", "x", "x", "inf = 10**17", "inf", "10**17", "10", "17", "mod = 10**9 + 7", "mod", "10**9 + 7", "10**9", "10", "9", "7", "n=I()", "n", "I()", "I", "LI() for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "LI()", "LI", "pairs=[LI() for i in range(n)]", "pairs", "[LI() for i in range(n)]", "def pair_revise(x,y,a,b):\n global p\n global q\n #print(x,y,a,b)\n for i in range(max(x//a,y//b),max(x//a,y//b)+2):\n p,q=a*i,b*i\n if p>=x and q>=y:\n break\n return [p,q]\n #return [x*max(ceil(x/a),ceil(y/b)),y*max(ceil(x/a),ceil(y/b))]\n #for i in range(max(ceil(x/a),ceil(y/b)),):", "pair_revise", "global p", "global q", "for i in range(max(x//a,y//b),max(x//a,y//b)+2):\n p,q=a*i,b*i\n if p>=x and q>=y:\n break\n ", "i", "range(max(x//a,y//b),max(x//a,y//b)+2)", "range", "max(x//a,y//b)", "max", "x//a", "x", "a", "y//b", "y", "b", "max(x//a,y//b)+2", "max(x//a,y//b)", "max", "x//a", "x", "a", "y//b", "y", "b", "2", "p,q=a*i,b*i", "p", "a*i", "a", "i", "q", "b*i", "b", "i", "if p>=x and q>=y:\n break\n ", "p>=x and q>=y", "p>=x", "p", "x", "q>=y", "q", "y", "break", "return [p,q]", "[p,q]", "p", "q", "x", "x", "y", "y", "a", "a", "b", "b", "u,v=pairs[0]", "u", "pairs[0]", "pairs", "0", "v", "for i in range(n-1):\n u,v=pair_revise(u,v,pairs[i+1][0],pairs[i+1][1])", "i", "range(n-1)", "range", "n-1", "n", "1", "u,v=pair_revise(u,v,pairs[i+1][0],pairs[i+1][1])", "u", "pair_revise(u,v,pairs[i+1][0],pairs[i+1][1])", "pair_revise", "u", "v", "pairs[i+1][0]", "[i+1]", "pairs", "i+1", "i", "1", "0", "pairs[i+1][1]", "[i+1]", "pairs", "i+1", "i", "1", "1", "v", "print(u+v)", "print", "u+v", "u", "v", "'''def pair_revise(x,y,a,b):\n global p\n global q\n i=max(ceil(x/a),ceil(y/b))\n p,q=a*i,b*i\n return p,q\nu,v=1,1\nfor i in range(n):\n u,v=pair_revise(u,v,pairs[i][0],pairs[i][1])\n print(u,v)\nprint(u+v)'''", "inf = 10**17", "10**17", "inf", "def LI2(): return [int(input()) for i in range(n)]", "def LI2(): return [int(input()) for i in range(n)]", "LI2", "def I(): return int(input())", "def I(): return int(input())", "I", "def printni(x): print('\\n'.join(list(map(str,x))))", "def printni(x): print('\\n'.join(list(map(str,x))))", "printni", "v=pairs[0]", "pairs[0]", "v", "u,v=pair_revise(u,v,pairs[i+1][0],pairs[i+1][1])", "pair_revise(u,v,pairs[i+1][0],pairs[i+1][1])", "u", "def SI(): return input().rstrip()", "def SI(): return input().rstrip()", "SI", "def MI(): return map(int, input().split())", "def MI(): return map(int, input().split())", "MI", "n=I()", "I()", "n", "mod = 10**9 + 7", "10**9 + 7", "mod", "input = sys.stdin.readline", "sys.stdin.readline", "input", "pairs=[LI() for i in range(n)]", "[LI() for i in range(n)]", "pairs", "v=pair_revise(u,v,pairs[i+1][0],pairs[i+1][1])", "pair_revise(u,v,pairs[i+1][0],pairs[i+1][1])", "v", "def MXI(): return [[LI()]for i in range(n)]", "def MXI(): return [[LI()]for i in range(n)]", "MXI", "u,v=pairs[0]", "pairs[0]", "u", "def pair_revise(x,y,a,b):\n global p\n global q\n #print(x,y,a,b)\n for i in range(max(x//a,y//b),max(x//a,y//b)+2):\n p,q=a*i,b*i\n if p>=x and q>=y:\n break\n return [p,q]\n #return [x*max(ceil(x/a),ceil(y/b)),y*max(ceil(x/a),ceil(y/b))]\n #for i in range(max(ceil(x/a),ceil(y/b)),):", "def pair_revise(x,y,a,b):\n global p\n global q\n #print(x,y,a,b)\n for i in range(max(x//a,y//b),max(x//a,y//b)+2):\n p,q=a*i,b*i\n if p>=x and q>=y:\n break\n return [p,q]\n #return [x*max(ceil(x/a),ceil(y/b)),y*max(ceil(x/a),ceil(y/b))]\n #for i in range(max(ceil(x/a),ceil(y/b)),):", "pair_revise", "def printns(x): print('\\n'.join(x))", "def printns(x): print('\\n'.join(x))", "printns", "def LI(): return list(map(int, input().split()))", "def LI(): return list(map(int, input().split()))", "LI" ]
# coding: utf-8 # hello worldใจ่กจ็คบใ™ใ‚‹ import sys #import numpy input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush from math import floor, ceil,pi,factorial from operator import itemgetter from copy import deepcopy def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def LI2(): return [int(input()) for i in range(n)] def MXI(): return [[LI()]for i in range(n)] def SI(): return input().rstrip() def printns(x): print('\n'.join(x)) def printni(x): print('\n'.join(list(map(str,x)))) inf = 10**17 mod = 10**9 + 7 n=I() pairs=[LI() for i in range(n)] def pair_revise(x,y,a,b): global p global q #print(x,y,a,b) for i in range(max(x//a,y//b),max(x//a,y//b)+2): p,q=a*i,b*i if p>=x and q>=y: break return [p,q] #return [x*max(ceil(x/a),ceil(y/b)),y*max(ceil(x/a),ceil(y/b))] #for i in range(max(ceil(x/a),ceil(y/b)),): u,v=pairs[0] for i in range(n-1): u,v=pair_revise(u,v,pairs[i+1][0],pairs[i+1][1]) print(u+v) '''def pair_revise(x,y,a,b): global p global q i=max(ceil(x/a),ceil(y/b)) p,q=a*i,b*i return p,q u,v=1,1 for i in range(n): u,v=pair_revise(u,v,pairs[i][0],pairs[i][1]) print(u,v) print(u+v)'''
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 2, 13, 13, 2, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 13, 0, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 106, 2 ], [ 94, 8 ], [ 94, 17 ], [ 20, 19 ], [ 107, 23 ], [ 103, 25 ], [ 103, 34 ], [ 86, 38 ], [ 101, 38 ], [ 98, 38 ], [ 80, 39 ], [ 95, 41 ], [ 92, 41 ], [ 89, 41 ], [ 104, 42 ], [ 82, 44 ], [ 86, 50 ], [ 101, 50 ], [ 98, 50 ], [ 80, 51 ], [ 95, 55 ], [ 92, 55 ], [ 89, 55 ], [ 104, 56 ], [ 97, 58 ], [ 83, 60 ], [ 80, 61 ], [ 88, 63 ], [ 83, 65 ], [ 104, 66 ], [ 100, 68 ], [ 80, 69 ], [ 91, 71 ], [ 104, 72 ], [ 101, 76 ], [ 98, 76 ], [ 86, 76 ], [ 92, 77 ], [ 89, 77 ], [ 95, 77 ], [ 103, 80 ], [ 82, 83 ], [ 94, 86 ], [ 88, 89 ], [ 104, 91 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 80, 100 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ] ]
[ "n=int(input())\nanst,ansa=map(int,input().split())\nfor _ in range(1,n):\n t,a=map(int,input().split())\n if anst>t or ansa>a:\n mul=max(-(-anst//t),-(-ansa//a))\n anst=mul*t\n ansa=mul*a\n else:\n anst=t\n ansa=a\nprint(anst+ansa)", "n=int(input())", "n", "int(input())", "int", "input()", "input", "anst,ansa=map(int,input().split())", "anst", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ansa", "for _ in range(1,n):\n t,a=map(int,input().split())\n if anst>t or ansa>a:\n mul=max(-(-anst//t),-(-ansa//a))\n anst=mul*t\n ansa=mul*a\n else:\n anst=t\n ansa=a", "_", "range(1,n)", "range", "1", "n", "t,a=map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "if anst>t or ansa>a:\n mul=max(-(-anst//t),-(-ansa//a))\n anst=mul*t\n ansa=mul*a\n else:\n anst=t\n ansa=a", "anst>t or ansa>a", "anst>t", "anst", "t", "ansa>a", "ansa", "a", "mul=max(-(-anst//t),-(-ansa//a))", "mul", "max(-(-anst//t),-(-ansa//a))", "max", "-(-anst//t)", "-anst//t", "-anst", "anst", "t", "-(-ansa//a)", "-ansa//a", "-ansa", "ansa", "a", "anst=mul*t", "anst", "mul*t", "mul", "t", "ansa=mul*a", "ansa", "mul*a", "mul", "a", "anst=t", "anst", "t", "ansa=a", "ansa", "a", "print(anst+ansa)", "print", "anst+ansa", "anst", "ansa", "t,a=map(int,input().split())", "map(int,input().split())", "t", "mul=max(-(-anst//t),-(-ansa//a))", "max(-(-anst//t),-(-ansa//a))", "mul", "anst,ansa=map(int,input().split())", "map(int,input().split())", "anst", "ansa=mul*a", "mul*a", "ansa", "ansa=a", "a", "ansa", "ansa=map(int,input().split())", "map(int,input().split())", "ansa", "anst=mul*t", "mul*t", "anst", "anst=t", "t", "anst", "a=map(int,input().split())", "map(int,input().split())", "a", "n=int(input())", "int(input())", "n" ]
n=int(input()) anst,ansa=map(int,input().split()) for _ in range(1,n): t,a=map(int,input().split()) if anst>t or ansa>a: mul=max(-(-anst//t),-(-ansa//a)) anst=mul*t ansa=mul*a else: anst=t ansa=a print(anst+ansa)
[ 7, 15, 13, 12, 13, 0, 13, 18, 18, 13, 13, 13, 0, 13, 2, 2, 17, 17, 17, 0, 13, 4, 13, 4, 18, 4, 13, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 18, 4, 13, 13, 17, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 7, 6 ], [ 14, 13 ], [ 21, 20 ], [ 6, 26 ], [ 31, 30 ], [ 34, 33 ], [ 37, 36 ], [ 20, 39 ], [ 42, 41 ], [ 6, 52 ], [ 42, 56 ], [ 59, 58 ], [ 30, 64 ], [ 76, 64 ], [ 41, 65 ], [ 41, 67 ], [ 33, 71 ], [ 81, 71 ], [ 56, 72 ], [ 56, 74 ], [ 77, 76 ], [ 58, 78 ], [ 41, 79 ], [ 82, 81 ], [ 58, 83 ], [ 56, 84 ], [ 76, 88 ], [ 30, 88 ], [ 81, 89 ], [ 33, 89 ], [ 98, 95 ] ]
[ "import sys\n\n\ndef slove():\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n n = int(input().rstrip('\\n'))\n na = 1\n nb = 1\n for i in range(n):\n t, a = list(map(int, input().rstrip('\\n').split()))\n r = max((na + t - 1) // t, (nb + a - 1) // a)\n na = r * t\n nb = r * a\n print(na + nb)\n\n\nif __name__ == '__main__':\n slove()", "import sys", "sys", "def slove():\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n n = int(input().rstrip('\\n'))\n na = 1\n nb = 1\n for i in range(n):\n t, a = list(map(int, input().rstrip('\\n').split()))\n r = max((na + t - 1) // t, (nb + a - 1) // a)\n na = r * t\n nb = r * a\n print(na + nb)", "slove", "input = sys.stdin.readline", "input", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "mod = 10 ** 9 + 7", "mod", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "n = int(input().rstrip('\\n'))", "n", "int(input().rstrip('\\n'))", "int", "input().rstrip('\\n')", "().rstrip", "()", "input", "rstrip", "'\\n'", "na = 1", "na", "1", "nb = 1", "nb", "1", "for i in range(n):\n t, a = list(map(int, input().rstrip('\\n').split()))\n r = max((na + t - 1) // t, (nb + a - 1) // a)\n na = r * t\n nb = r * a\n ", "i", "range(n)", "range", "n", "t, a = list(map(int, input().rstrip('\\n').split()))", "t", "list(map(int, input().rstrip('\\n').split()))", "list", "map(int, input().rstrip('\\n').split())", "map", "int", "input().rstrip('\\n').split()", "().rstrip('\\n').split", "().rstrip('\\n')", "().rstrip", "()", "input", "rstrip", "'\\n'", "split", "a", "r = max((na + t - 1) // t, (nb + a - 1) // a)", "r", "max((na + t - 1) // t, (nb + a - 1) // a)", "max", "(na + t - 1) // t", "na + t - 1", "na + t", "na", "t", "1", "t", "(nb + a - 1) // a", "nb + a - 1", "nb + a", "nb", "a", "1", "a", "na = r * t", "na", "r * t", "r", "t", "nb = r * a", "nb", "r * a", "r", "a", "print(na + nb)", "print", "na + nb", "na", "nb", "if __name__ == '__main__':\n slove()", "__name__ == '__main__'", "__name__", "'__main__'", "slove()", "slove", "def slove():\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n n = int(input().rstrip('\\n'))\n na = 1\n nb = 1\n for i in range(n):\n t, a = list(map(int, input().rstrip('\\n').split()))\n r = max((na + t - 1) // t, (nb + a - 1) // a)\n na = r * t\n nb = r * a\n print(na + nb)", "def slove():\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n n = int(input().rstrip('\\n'))\n na = 1\n nb = 1\n for i in range(n):\n t, a = list(map(int, input().rstrip('\\n').split()))\n r = max((na + t - 1) // t, (nb + a - 1) // a)\n na = r * t\n nb = r * a\n print(na + nb)", "slove" ]
import sys def slove(): input = sys.stdin.readline mod = 10 ** 9 + 7 n = int(input().rstrip('\n')) na = 1 nb = 1 for i in range(n): t, a = list(map(int, input().rstrip('\n').split())) r = max((na + t - 1) // t, (nb + a - 1) // a) na = r * t nb = r * a print(na + nb) if __name__ == '__main__': slove()
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 18, 13, 17, 12, 13, 14, 2, 2, 18, 13, 17, 18, 13, 17, 17, 0, 13, 17, 0, 13, 17, 14, 2, 2, 18, 13, 17, 18, 13, 17, 17, 0, 13, 17, 0, 13, 17, 0, 13, 4, 13, 2, 2, 18, 13, 17, 18, 13, 17, 13, 2, 2, 18, 13, 17, 18, 13, 17, 13, 29, 39, 2, 18, 13, 17, 13, 2, 18, 13, 17, 13, 23, 13, 23, 13, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 13, 18, 13, 13, 4, 13, 4, 13, 13, 10, 12, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 18, 13 ]
[ [ 133, 2 ], [ 10, 9 ], [ 134, 12 ], [ 130, 25 ], [ 136, 28 ], [ 131, 30 ], [ 101, 38 ], [ 103, 41 ], [ 46, 45 ], [ 49, 48 ], [ 101, 54 ], [ 103, 57 ], [ 62, 61 ], [ 65, 64 ], [ 68, 67 ], [ 101, 73 ], [ 103, 76 ], [ 48, 78 ], [ 45, 78 ], [ 101, 82 ], [ 103, 85 ], [ 64, 87 ], [ 61, 87 ], [ 103, 92 ], [ 67, 94 ], [ 103, 97 ], [ 67, 99 ], [ 101, 101 ], [ 103, 103 ], [ 106, 105 ], [ 134, 109 ], [ 127, 111 ], [ 125, 113 ], [ 137, 114 ], [ 128, 114 ], [ 131, 116 ], [ 105, 117 ], [ 128, 122 ], [ 137, 122 ], [ 127, 128 ], [ 130, 131 ], [ 133, 134 ], [ 136, 137 ] ]
[ "N=int(input())\nTA=[list(map(int, input().split())) for i in range(N)]\n\nnums=TA[0]\n\ndef f(points, rate):\n if points[0]%rate[0]>0:\n a=1\n else:\n a=0\n if points[1]%rate[1]>0:\n b=1\n else:\n b=0\n \n tmp=max(points[0]//rate[0]+a, points[1]//rate[1]+b)\n return [rate[0]*tmp, rate[1]*tmp]\n\nfor i in range(1, N):\n nums=f(nums, TA[i])\n \nprint(sum(nums))", "N=int(input())", "N", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for i in range(N)", "for i in range(N)", "i", "range(N)", "range", "N", "for i in range(N)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "TA=[list(map(int, input().split())) for i in range(N)]", "TA", "[list(map(int, input().split())) for i in range(N)]", "nums=TA[0]", "nums", "TA[0]", "TA", "0", "def f(points, rate):\n if points[0]%rate[0]>0:\n a=1\n else:\n a=0\n if points[1]%rate[1]>0:\n b=1\n else:\n b=0\n \n tmp=max(points[0]//rate[0]+a, points[1]//rate[1]+b)\n return [rate[0]*tmp, rate[1]*tmp]", "f", "if points[0]%rate[0]>0:\n a=1\n else:\n a=0\n ", "points[0]%rate[0]>0", "points[0]%rate[0]", "points[0]", "points", "0", "rate[0]", "rate", "0", "0", "a=1", "a", "1", "a=0", "a", "0", "if points[1]%rate[1]>0:\n b=1\n else:\n b=0\n \n ", "points[1]%rate[1]>0", "points[1]%rate[1]", "points[1]", "points", "1", "rate[1]", "rate", "1", "0", "b=1", "b", "1", "b=0", "b", "0", "tmp=max(points[0]//rate[0]+a, points[1]//rate[1]+b)", "tmp", "max(points[0]//rate[0]+a, points[1]//rate[1]+b)", "max", "points[0]//rate[0]+a", "points[0]//rate[0]", "points[0]", "points", "0", "rate[0]", "rate", "0", "a", "points[1]//rate[1]+b", "points[1]//rate[1]", "points[1]", "points", "1", "rate[1]", "rate", "1", "b", "return [rate[0]*tmp, rate[1]*tmp]", "[rate[0]*tmp, rate[1]*tmp]", "rate[0]*tmp", "rate[0]", "rate", "0", "tmp", "rate[1]*tmp", "rate[1]", "rate", "1", "tmp", "points", "points", "rate", "rate", "for i in range(1, N):\n nums=f(nums, TA[i])\n ", "i", "range(1, N)", "range", "1", "N", "nums=f(nums, TA[i])", "nums", "f(nums, TA[i])", "f", "nums", "TA[i]", "TA", "i", "print(sum(nums))", "print", "sum(nums)", "sum", "nums", "def f(points, rate):\n if points[0]%rate[0]>0:\n a=1\n else:\n a=0\n if points[1]%rate[1]>0:\n b=1\n else:\n b=0\n \n tmp=max(points[0]//rate[0]+a, points[1]//rate[1]+b)\n return [rate[0]*tmp, rate[1]*tmp]", "def f(points, rate):\n if points[0]%rate[0]>0:\n a=1\n else:\n a=0\n if points[1]%rate[1]>0:\n b=1\n else:\n b=0\n \n tmp=max(points[0]//rate[0]+a, points[1]//rate[1]+b)\n return [rate[0]*tmp, rate[1]*tmp]", "f", "nums=f(nums, TA[i])", "f(nums, TA[i])", "nums", "TA=[list(map(int, input().split())) for i in range(N)]", "[list(map(int, input().split())) for i in range(N)]", "TA", "N=int(input())", "int(input())", "N", "nums=TA[0]", "TA[0]", "nums" ]
N=int(input()) TA=[list(map(int, input().split())) for i in range(N)] nums=TA[0] def f(points, rate): if points[0]%rate[0]>0: a=1 else: a=0 if points[1]%rate[1]>0: b=1 else: b=0 tmp=max(points[0]//rate[0]+a, points[1]//rate[1]+b) return [rate[0]*tmp, rate[1]*tmp] for i in range(1, N): nums=f(nums, TA[i]) print(sum(nums))
[ 7, 15, 13, 12, 13, 0, 13, 4, 13, 4, 18, 18, 13, 13, 13, 0, 13, 39, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 13, 0, 13, 2, 13, 13, 28, 13, 2, 39, 17, 2, 13, 17, 0, 13, 4, 13, 4, 13, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 8, 2, 2, 13, 13, 17, 2, 13, 13, 2, 2, 13, 13, 17, 0, 13, 8, 2, 2, 13, 13, 17, 2, 13, 13, 2, 2, 13, 13, 17, 0, 13, 4, 13, 39, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 13, 14, 2, 13, 17, 10, 12, 13 ]
[ [ 7, 6 ], [ 17, 16 ], [ 20, 19 ], [ 20, 34 ], [ 37, 36 ], [ 19, 38 ], [ 34, 39 ], [ 42, 41 ], [ 6, 46 ], [ 50, 49 ], [ 50, 64 ], [ 67, 66 ], [ 49, 68 ], [ 64, 69 ], [ 72, 71 ], [ 19, 75 ], [ 110, 75 ], [ 49, 76 ], [ 19, 79 ], [ 110, 79 ], [ 49, 80 ], [ 19, 83 ], [ 110, 83 ], [ 49, 84 ], [ 88, 87 ], [ 34, 91 ], [ 114, 91 ], [ 64, 92 ], [ 34, 95 ], [ 114, 95 ], [ 64, 96 ], [ 34, 99 ], [ 114, 99 ], [ 64, 100 ], [ 104, 103 ], [ 111, 110 ], [ 103, 112 ], [ 49, 113 ], [ 115, 114 ], [ 103, 116 ], [ 64, 117 ], [ 120, 119 ], [ 110, 121 ], [ 19, 121 ], [ 114, 122 ], [ 34, 122 ], [ 119, 125 ], [ 36, 125 ] ]
[ "import sys\ndef v():\n N=int(sys.stdin.readline())\n P=[]\n pt,pa=tuple(map(int,sys.stdin.readline().split()))\n res=pt+pa\n for _ in [0]*(N-1):\n xt,xa=tuple(map(int,sys.stdin.readline().split()))\n xs=xt+xa\n kt=pt//xt if pt%xt ==0 else pt//xt+1\n ka=pa//xa if pa%xa ==0 else pa//xa+1\n k=max([kt,ka])\n pt,pa=k*xt,k*xa\n res=pt+pa\n print(res)\nif __name__=='__main__':v()", "import sys", "sys", "def v():\n N=int(sys.stdin.readline())\n P=[]\n pt,pa=tuple(map(int,sys.stdin.readline().split()))\n res=pt+pa\n for _ in [0]*(N-1):\n xt,xa=tuple(map(int,sys.stdin.readline().split()))\n xs=xt+xa\n kt=pt//xt if pt%xt ==0 else pt//xt+1\n ka=pa//xa if pa%xa ==0 else pa//xa+1\n k=max([kt,ka])\n pt,pa=k*xt,k*xa\n res=pt+pa\n print(res)", "v", "N=int(sys.stdin.readline())", "N", "int(sys.stdin.readline())", "int", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "P=[]", "P", "[]", "pt,pa=tuple(map(int,sys.stdin.readline().split()))", "pt", "tuple(map(int,sys.stdin.readline().split()))", "tuple", "map(int,sys.stdin.readline().split())", "map", "int", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "pa", "res=pt+pa", "res", "pt+pa", "pt", "pa", "for _ in [0]*(N-1):\n xt,xa=tuple(map(int,sys.stdin.readline().split()))\n xs=xt+xa\n kt=pt//xt if pt%xt ==0 else pt//xt+1\n ka=pa//xa if pa%xa ==0 else pa//xa+1\n k=max([kt,ka])\n pt,pa=k*xt,k*xa\n res=pt+pa\n ", "_", "[0]*(N-1)", "[0]", "0", "N-1", "N", "1", "xt,xa=tuple(map(int,sys.stdin.readline().split()))", "xt", "tuple(map(int,sys.stdin.readline().split()))", "tuple", "map(int,sys.stdin.readline().split())", "map", "int", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "xa", "xs=xt+xa", "xs", "xt+xa", "xt", "xa", "kt=pt//xt if pt%xt ==0 else pt//xt+1", "kt", "pt//xt if pt%xt ==0 else pt//xt+1", "pt%xt ==0", "pt%xt", "pt", "xt", "0", "pt//xt", "pt", "xt", "pt//xt+1", "pt//xt", "pt", "xt", "1", "ka=pa//xa if pa%xa ==0 else pa//xa+1", "ka", "pa//xa if pa%xa ==0 else pa//xa+1", "pa%xa ==0", "pa%xa", "pa", "xa", "0", "pa//xa", "pa", "xa", "pa//xa+1", "pa//xa", "pa", "xa", "1", "k=max([kt,ka])", "k", "max([kt,ka])", "max", "[kt,ka]", "kt", "ka", "pt,pa=k*xt,k*xa", "pt", "k*xt", "k", "xt", "pa", "k*xa", "k", "xa", "res=pt+pa", "res", "pt+pa", "pt", "pa", "print(res)", "print", "res", "if __name__=='__main__':v()", "__name__=='__main__'", "__name__", "'__main__'", "def v():\n N=int(sys.stdin.readline())\n P=[]\n pt,pa=tuple(map(int,sys.stdin.readline().split()))\n res=pt+pa\n for _ in [0]*(N-1):\n xt,xa=tuple(map(int,sys.stdin.readline().split()))\n xs=xt+xa\n kt=pt//xt if pt%xt ==0 else pt//xt+1\n ka=pa//xa if pa%xa ==0 else pa//xa+1\n k=max([kt,ka])\n pt,pa=k*xt,k*xa\n res=pt+pa\n print(res)", "def v():\n N=int(sys.stdin.readline())\n P=[]\n pt,pa=tuple(map(int,sys.stdin.readline().split()))\n res=pt+pa\n for _ in [0]*(N-1):\n xt,xa=tuple(map(int,sys.stdin.readline().split()))\n xs=xt+xa\n kt=pt//xt if pt%xt ==0 else pt//xt+1\n ka=pa//xa if pa%xa ==0 else pa//xa+1\n k=max([kt,ka])\n pt,pa=k*xt,k*xa\n res=pt+pa\n print(res)", "v" ]
import sys def v(): N=int(sys.stdin.readline()) P=[] pt,pa=tuple(map(int,sys.stdin.readline().split())) res=pt+pa for _ in [0]*(N-1): xt,xa=tuple(map(int,sys.stdin.readline().split())) xs=xt+xa kt=pt//xt if pt%xt ==0 else pt//xt+1 ka=pa//xa if pa%xa ==0 else pa//xa+1 k=max([kt,ka]) pt,pa=k*xt,k*xa res=pt+pa print(res) if __name__=='__main__':v()
[ 7, 15, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 17, 13, 17, 2, 2, 2, 13, 17, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 14, 2, 2, 13, 13, 17, 0, 13, 13, 0, 13, 13, 4, 13, 2, 13, 13, 10, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 18, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13 ]
[ [ 106, 4 ], [ 103, 13 ], [ 107, 17 ], [ 94, 19 ], [ 88, 21 ], [ 25, 24 ], [ 104, 27 ], [ 97, 29 ], [ 107, 36 ], [ 97, 38 ], [ 109, 40 ], [ 95, 46 ], [ 101, 46 ], [ 113, 46 ], [ 98, 48 ], [ 89, 53 ], [ 86, 53 ], [ 116, 53 ], [ 92, 55 ], [ 112, 58 ], [ 98, 60 ], [ 110, 61 ], [ 115, 63 ], [ 92, 65 ], [ 110, 66 ], [ 116, 70 ], [ 89, 70 ], [ 86, 70 ], [ 113, 71 ], [ 95, 71 ], [ 101, 71 ], [ 100, 74 ], [ 98, 75 ], [ 85, 77 ], [ 92, 78 ], [ 101, 82 ], [ 113, 82 ], [ 95, 82 ], [ 86, 83 ], [ 116, 83 ], [ 89, 83 ], [ 92, 85 ], [ 85, 86 ], [ 88, 89 ], [ 97, 92 ], [ 94, 95 ], [ 97, 98 ], [ 98, 100 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ], [ 109, 110 ], [ 112, 113 ], [ 115, 116 ] ]
[ "import sys\nreadline = sys.stdin.buffer.readline\n\nn = int(readline())\nt,a = 0,0\nfor i in range(n):\n rt,ra = map(int,readline().split())\n x = max((t-1)//rt+1,(a-1)//ra+1)\n t = rt*x\n a = ra*x\n if a+t == 0:\n t += rt\n a += ra\n\nprint(t+a)\n", "import sys", "sys", "readline = sys.stdin.buffer.readline", "readline", "sys.stdin.buffer.readline", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readline", "n = int(readline())", "n", "int(readline())", "int", "readline()", "readline", "t,a = 0,0", "t", "0", "a", "0", "for i in range(n):\n rt,ra = map(int,readline().split())\n x = max((t-1)//rt+1,(a-1)//ra+1)\n t = rt*x\n a = ra*x\n if a+t == 0:\n t += rt\n a += ra", "i", "range(n)", "range", "n", "rt,ra = map(int,readline().split())", "rt", "map(int,readline().split())", "map", "int", "readline().split()", "().split", "()", "readline", "split", "ra", "x = max((t-1)//rt+1,(a-1)//ra+1)", "x", "max((t-1)//rt+1,(a-1)//ra+1)", "max", "(t-1)//rt+1", "(t-1)//rt", "t-1", "t", "1", "rt", "1", "(a-1)//ra+1", "(a-1)//ra", "a-1", "a", "1", "ra", "1", "t = rt*x", "t", "rt*x", "rt", "x", "a = ra*x", "a", "ra*x", "ra", "x", "if a+t == 0:\n t += rt\n a += ra", "a+t == 0", "a+t", "a", "t", "0", "t += rt", "t", "rt", "a += ra", "a", "ra", "print(t+a)", "print", "t+a", "t", "a", "a += ra", "ra", "a", "a = 0,0", "0", "a", "ra = map(int,readline().split())", "map(int,readline().split())", "ra", "t,a = 0,0", "0", "t", "rt,ra = map(int,readline().split())", "map(int,readline().split())", "rt", "t += rt", "rt", "t", "n = int(readline())", "int(readline())", "n", "readline = sys.stdin.buffer.readline", "sys.stdin.buffer.readline", "readline", "x = max((t-1)//rt+1,(a-1)//ra+1)", "max((t-1)//rt+1,(a-1)//ra+1)", "x", "t = rt*x", "rt*x", "t", "a = ra*x", "ra*x", "a" ]
import sys readline = sys.stdin.buffer.readline n = int(readline()) t,a = 0,0 for i in range(n): rt,ra = map(int,readline().split()) x = max((t-1)//rt+1,(a-1)//ra+1) t = rt*x a = ra*x if a+t == 0: t += rt a += ra print(t+a)
[ 7, 0, 13, 17, 13, 17, 28, 13, 4, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 13, 2, 13, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 60, 2 ], [ 69, 4 ], [ 8, 7 ], [ 75, 15 ], [ 75, 24 ], [ 63, 26 ], [ 61, 32 ], [ 58, 32 ], [ 73, 33 ], [ 73, 35 ], [ 70, 39 ], [ 67, 39 ], [ 76, 40 ], [ 76, 42 ], [ 57, 44 ], [ 73, 46 ], [ 64, 47 ], [ 66, 48 ], [ 76, 50 ], [ 64, 51 ], [ 58, 54 ], [ 61, 54 ], [ 67, 55 ], [ 70, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ], [ 69, 70 ], [ 75, 73 ], [ 75, 76 ] ]
[ "a,b = 1,1\nfor i in range(int(raw_input())):\n\tn,d = map(int, raw_input().split())\n\tq = max((a+n-1)/n, (b+d-1)/d)\n\ta,b= n*q, d*q\nprint a+b", "a,b = 1,1", "a", "1", "b", "1", "for i in range(int(raw_input())):\n\tn,d = map(int, raw_input().split())\n\tq = max((a+n-1)/n, (b+d-1)/d)\n\ta,b= n*q, d*q", "i", "range(int(raw_input()))", "range", "int(raw_input())", "int", "raw_input()", "raw_input", "n,d = map(int, raw_input().split())", "n", "map(int, raw_input().split())", "map", "int", "raw_input().split()", "().split", "()", "raw_input", "split", "d", "q = max((a+n-1)/n, (b+d-1)/d)", "q", "max((a+n-1)/n, (b+d-1)/d)", "max", "(a+n-1)/n", "a+n-1", "a+n", "a", "n", "1", "n", "(b+d-1)/d", "b+d-1", "b+d", "b", "d", "1", "d", "a,b= n*q, d*q", "a", "n*q", "n", "q", "b", "d*q", "d", "q", "print", "a+b", "a", "b", "a,b= n*q, d*q", "n*q", "a", "a,b = 1,1", "1", "a", "q = max((a+n-1)/n, (b+d-1)/d)", "max((a+n-1)/n, (b+d-1)/d)", "q", "b= n*q, d*q", "d*q", "b", "b = 1,1", "1", "b", "n,d = map(int, raw_input().split())", "map(int, raw_input().split())", "n", "d = map(int, raw_input().split())", "map(int, raw_input().split())", "d" ]
a,b = 1,1 for i in range(int(raw_input())): n,d = map(int, raw_input().split()) q = max((a+n-1)/n, (b+d-1)/d) a,b= n*q, d*q print a+b
[ 7, 15, 13, 15, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 13, 0, 13, 13, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 18, 13, 13, 4, 13, 4, 13, 13, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 13, 13 ]
[ [ 91, 5 ], [ 100, 11 ], [ 100, 20 ], [ 103, 22 ], [ 101, 23 ], [ 97, 25 ], [ 95, 26 ], [ 29, 28 ], [ 92, 32 ], [ 82, 34 ], [ 82, 43 ], [ 88, 45 ], [ 104, 54 ], [ 77, 54 ], [ 80, 55 ], [ 101, 55 ], [ 98, 58 ], [ 86, 58 ], [ 83, 59 ], [ 95, 59 ], [ 76, 61 ], [ 80, 63 ], [ 101, 63 ], [ 89, 64 ], [ 85, 66 ], [ 83, 68 ], [ 95, 68 ], [ 89, 69 ], [ 77, 73 ], [ 104, 73 ], [ 86, 74 ], [ 98, 74 ], [ 76, 77 ], [ 82, 80 ], [ 82, 83 ], [ 85, 86 ], [ 88, 89 ], [ 91, 92 ], [ 100, 95 ], [ 95, 97 ], [ 97, 98 ], [ 100, 101 ], [ 101, 103 ], [ 103, 104 ] ]
[ "import math\nfrom fractions import Fraction\n\nN = int(input())\na, b = map(int, input().split())\nret_a = a\nret_b = b\nfor _ in range(1, N):\n a, b = map(int, input().split())\n x = math.ceil(max(Fraction(ret_a, a), Fraction(ret_b, b)))\n ret_a = a * x\n ret_b = b * x\nprint(ret_a + ret_b)", "import math", "math", "from fractions import Fraction", "N = int(input())", "N", "int(input())", "int", "input()", "input", "a, b = map(int, input().split())", "a", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "ret_a = a", "ret_a", "a", "ret_b = b", "ret_b", "b", "for _ in range(1, N):\n a, b = map(int, input().split())\n x = math.ceil(max(Fraction(ret_a, a), Fraction(ret_b, b)))\n ret_a = a * x\n ret_b = b * x", "_", "range(1, N)", "range", "1", "N", "a, b = map(int, input().split())", "a", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "x = math.ceil(max(Fraction(ret_a, a), Fraction(ret_b, b)))", "x", "math.ceil(max(Fraction(ret_a, a), Fraction(ret_b, b)))", "math.ceil", "math", "ceil", "max(Fraction(ret_a, a), Fraction(ret_b, b))", "max", "Fraction(ret_a, a)", "Fraction", "ret_a", "a", "Fraction(ret_b, b)", "Fraction", "ret_b", "b", "ret_a = a * x", "ret_a", "a * x", "a", "x", "ret_b = b * x", "ret_b", "b * x", "b", "x", "print(ret_a + ret_b)", "print", "ret_a + ret_b", "ret_a", "ret_b", "ret_a = a * x", "a * x", "ret_a", "a, b = map(int, input().split())", "map(int, input().split())", "a", "b = map(int, input().split())", "map(int, input().split())", "b", "ret_b = b * x", "b * x", "ret_b", "x = math.ceil(max(Fraction(ret_a, a), Fraction(ret_b, b)))", "math.ceil(max(Fraction(ret_a, a), Fraction(ret_b, b)))", "x", "N = int(input())", "int(input())", "N", "b = map(int, input().split())", "map(int, input().split())", "b", "ret_b = b", "b", "ret_b", "a, b = map(int, input().split())", "map(int, input().split())", "a", "ret_a = a", "a", "ret_a" ]
import math from fractions import Fraction N = int(input()) a, b = map(int, input().split()) ret_a = a ret_b = b for _ in range(1, N): a, b = map(int, input().split()) x = math.ceil(max(Fraction(ret_a, a), Fraction(ret_b, b))) ret_a = a * x ret_b = b * x print(ret_a + ret_b)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 13, 13, 4, 13, 17, 2, 13, 13, 2, 2, 13, 13, 4, 13, 17, 2, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 75, 2 ], [ 90, 8 ], [ 90, 17 ], [ 20, 19 ], [ 76, 23 ], [ 96, 26 ], [ 96, 35 ], [ 78, 37 ], [ 91, 42 ], [ 82, 42 ], [ 97, 43 ], [ 91, 48 ], [ 82, 48 ], [ 97, 49 ], [ 88, 52 ], [ 85, 52 ], [ 94, 53 ], [ 88, 58 ], [ 85, 58 ], [ 94, 59 ], [ 81, 61 ], [ 97, 63 ], [ 79, 64 ], [ 84, 65 ], [ 94, 67 ], [ 79, 68 ], [ 82, 72 ], [ 91, 72 ], [ 85, 73 ], [ 88, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 90, 88 ], [ 90, 91 ], [ 96, 94 ], [ 96, 97 ] ]
[ "n=int(input())\nt_prev,a_prev=map(int,input().split())\nfor i in range(n-1):\n t,a=map(int,input().split())\n k=max(t_prev//t+min(1,t_prev%t),a_prev//a+min(1,a_prev%a))\n t_prev,a_prev=t*k,a*k\n \nprint(t_prev+a_prev)", "n=int(input())", "n", "int(input())", "int", "input()", "input", "t_prev,a_prev=map(int,input().split())", "t_prev", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a_prev", "for i in range(n-1):\n t,a=map(int,input().split())\n k=max(t_prev//t+min(1,t_prev%t),a_prev//a+min(1,a_prev%a))\n t_prev,a_prev=t*k,a*k\n ", "i", "range(n-1)", "range", "n-1", "n", "1", "t,a=map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "k=max(t_prev//t+min(1,t_prev%t),a_prev//a+min(1,a_prev%a))", "k", "max(t_prev//t+min(1,t_prev%t),a_prev//a+min(1,a_prev%a))", "max", "t_prev//t+min(1,t_prev%t)", "t_prev//t", "t_prev", "t", "min(1,t_prev%t)", "min", "1", "t_prev%t", "t_prev", "t", "a_prev//a+min(1,a_prev%a)", "a_prev//a", "a_prev", "a", "min(1,a_prev%a)", "min", "1", "a_prev%a", "a_prev", "a", "t_prev,a_prev=t*k,a*k", "t_prev", "t*k", "t", "k", "a_prev", "a*k", "a", "k", "print(t_prev+a_prev)", "print", "t_prev+a_prev", "t_prev", "a_prev", "n=int(input())", "int(input())", "n", "k=max(t_prev//t+min(1,t_prev%t),a_prev//a+min(1,a_prev%a))", "max(t_prev//t+min(1,t_prev%t),a_prev//a+min(1,a_prev%a))", "k", "t_prev,a_prev=t*k,a*k", "t*k", "t_prev", "a_prev=t*k,a*k", "a*k", "a_prev", "a_prev=map(int,input().split())", "map(int,input().split())", "a_prev", "t_prev,a_prev=map(int,input().split())", "map(int,input().split())", "t_prev", "a=map(int,input().split())", "map(int,input().split())", "a", "t,a=map(int,input().split())", "map(int,input().split())", "t" ]
n=int(input()) t_prev,a_prev=map(int,input().split()) for i in range(n-1): t,a=map(int,input().split()) k=max(t_prev//t+min(1,t_prev%t),a_prev//a+min(1,a_prev%a)) t_prev,a_prev=t*k,a*k print(t_prev+a_prev)
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 18, 18, 13, 17, 17, 0, 13, 18, 18, 13, 17, 17, 28, 13, 4, 13, 17, 13, 0, 13, 18, 13, 13, 13, 14, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 17, 14, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 17, 0, 13, 2, 13, 4, 13, 13, 13, 0, 13, 2, 13, 4, 13, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 18, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 18, 13, 10, 18, 13, 10, 18, 13, 10, 13, 13 ]
[ [ 111, 2 ], [ 10, 9 ], [ 112, 12 ], [ 144, 25 ], [ 138, 28 ], [ 145, 31 ], [ 135, 35 ], [ 145, 38 ], [ 43, 42 ], [ 112, 46 ], [ 141, 48 ], [ 145, 50 ], [ 42, 51 ], [ 141, 52 ], [ 139, 56 ], [ 121, 56 ], [ 142, 57 ], [ 117, 60 ], [ 139, 62 ], [ 121, 62 ], [ 142, 63 ], [ 126, 65 ], [ 139, 68 ], [ 121, 68 ], [ 142, 69 ], [ 136, 74 ], [ 130, 74 ], [ 115, 75 ], [ 132, 78 ], [ 136, 80 ], [ 130, 80 ], [ 115, 81 ], [ 123, 83 ], [ 136, 86 ], [ 130, 86 ], [ 115, 87 ], [ 120, 90 ], [ 142, 92 ], [ 127, 95 ], [ 118, 95 ], [ 124, 96 ], [ 133, 96 ], [ 129, 98 ], [ 115, 100 ], [ 127, 103 ], [ 118, 103 ], [ 124, 104 ], [ 133, 104 ], [ 121, 108 ], [ 139, 108 ], [ 130, 109 ], [ 136, 109 ], [ 111, 112 ], [ 141, 115 ], [ 117, 118 ], [ 120, 121 ], [ 123, 124 ], [ 126, 127 ], [ 129, 130 ], [ 132, 133 ], [ 135, 136 ], [ 138, 139 ], [ 141, 142 ], [ 144, 145 ] ]
[ "n=int(input())\nta=[list(map(int,input().split())) for i in range(n)]\nT=ta[0][0]\nA=ta[0][1]\nfor i in range(1,n):\n t,a=ta[i]\n if T%t==0:\n s=T//t\n else:\n s=T//t+1\n if A%a==0:\n b=A//a\n else:\n b=A//a+1\n T=t*max(s,b)\n A=a*max(s,b)\nprint(T+A)", "n=int(input())", "n", "int(input())", "int", "input()", "input", "list(map(int,input().split())) for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ta=[list(map(int,input().split())) for i in range(n)]", "ta", "[list(map(int,input().split())) for i in range(n)]", "T=ta[0][0]", "T", "ta[0][0]", "[0]", "ta", "0", "0", "A=ta[0][1]", "A", "ta[0][1]", "[0]", "ta", "0", "1", "for i in range(1,n):\n t,a=ta[i]\n if T%t==0:\n s=T//t\n else:\n s=T//t+1\n if A%a==0:\n b=A//a\n else:\n b=A//a+1\n T=t*max(s,b)\n A=a*max(s,b)", "i", "range(1,n)", "range", "1", "n", "t,a=ta[i]", "t", "ta[i]", "ta", "i", "a", "if T%t==0:\n s=T//t\n else:\n s=T//t+1\n ", "T%t==0", "T%t", "T", "t", "0", "s=T//t", "s", "T//t", "T", "t", "s=T//t+1", "s", "T//t+1", "T//t", "T", "t", "1", "if A%a==0:\n b=A//a\n else:\n b=A//a+1\n ", "A%a==0", "A%a", "A", "a", "0", "b=A//a", "b", "A//a", "A", "a", "b=A//a+1", "b", "A//a+1", "A//a", "A", "a", "1", "T=t*max(s,b)", "T", "t*max(s,b)", "t", "max(s,b)", "max", "s", "b", "A=a*max(s,b)", "A", "a*max(s,b)", "a", "max(s,b)", "max", "s", "b", "print(T+A)", "print", "T+A", "T", "A", "n=int(input())", "int(input())", "n", "a=ta[i]", "ta[i]", "a", "s=T//t", "T//t", "s", "T=t*max(s,b)", "t*max(s,b)", "T", "b=A//a+1", "A//a+1", "b", "s=T//t+1", "T//t+1", "s", "A=a*max(s,b)", "a*max(s,b)", "A", "b=A//a", "A//a", "b", "A=ta[0][1]", "ta[0][1]", "A", "T=ta[0][0]", "ta[0][0]", "T", "t,a=ta[i]", "ta[i]", "t", "ta=[list(map(int,input().split())) for i in range(n)]", "[list(map(int,input().split())) for i in range(n)]", "ta" ]
n=int(input()) ta=[list(map(int,input().split())) for i in range(n)] T=ta[0][0] A=ta[0][1] for i in range(1,n): t,a=ta[i] if T%t==0: s=T//t else: s=T//t+1 if A%a==0: b=A//a else: b=A//a+1 T=t*max(s,b) A=a*max(s,b) print(T+A)
[ 7, 15, 12, 13, 0, 13, 4, 18, 13, 13, 0, 13, 4, 13, 18, 13, 17, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 18, 13, 13, 4, 13, 13, 4, 18, 18, 13, 2, 13, 17, 13, 18, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 4, 13, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 29, 4, 13, 10, 12, 13 ]
[ [ 6, 5 ], [ 12, 11 ], [ 5, 15 ], [ 19, 18 ], [ 11, 22 ], [ 25, 24 ], [ 11, 28 ], [ 31, 30 ], [ 11, 33 ], [ 38, 35 ], [ 18, 36 ], [ 30, 37 ], [ 5, 44 ], [ 30, 46 ], [ 38, 49 ], [ 24, 50 ], [ 30, 51 ], [ 54, 53 ], [ 57, 56 ], [ 18, 63 ], [ 24, 64 ], [ 67, 66 ], [ 53, 72 ], [ 80, 72 ], [ 56, 77 ], [ 85, 77 ], [ 81, 80 ], [ 66, 82 ], [ 86, 85 ], [ 66, 87 ], [ 80, 92 ], [ 53, 92 ], [ 85, 93 ], [ 56, 93 ], [ 99, 96 ] ]
[ "from sys import stdin\n\n\ndef main():\n lines = stdin.readlines()\n N = int(lines[0])\n Tn = [0] * N\n An = [0] * N\n for i in range(N):\n Tn[i], An[i] = map(int, lines[i + 1].split())\n T = 1\n A = 1\n for Ti, Ai in zip(Tn, An):\n n = max(-(-T // Ti), -(-A // Ai))\n T = n * Ti\n A = n * Ai\n print(T + A)\n return\n\n\nmain()", "from sys import stdin", "def main():\n lines = stdin.readlines()\n N = int(lines[0])\n Tn = [0] * N\n An = [0] * N\n for i in range(N):\n Tn[i], An[i] = map(int, lines[i + 1].split())\n T = 1\n A = 1\n for Ti, Ai in zip(Tn, An):\n n = max(-(-T // Ti), -(-A // Ai))\n T = n * Ti\n A = n * Ai\n print(T + A)\n return", "main", "lines = stdin.readlines()", "lines", "stdin.readlines()", "stdin.readlines", "stdin", "readlines", "N = int(lines[0])", "N", "int(lines[0])", "int", "lines[0]", "lines", "0", "Tn = [0] * N", "Tn", "[0] * N", "[0]", "0", "N", "An = [0] * N", "An", "[0] * N", "[0]", "0", "N", "for i in range(N):\n Tn[i], An[i] = map(int, lines[i + 1].split())\n ", "i", "range(N)", "range", "N", "Tn[i], An[i] = map(int, lines[i + 1].split())", "Tn[i]", "Tn", "i", "map(int, lines[i + 1].split())", "map", "int", "lines[i + 1].split()", "[i + 1].split", "[i + 1]", "lines", "i + 1", "i", "1", "split", "An[i]", "An", "i", "T = 1", "T", "1", "A = 1", "A", "1", "for Ti, Ai in zip(Tn, An):\n n = max(-(-T // Ti), -(-A // Ai))\n T = n * Ti\n A = n * Ai\n ", "Ti", "Ai", "zip(Tn, An)", "zip", "Tn", "An", "n = max(-(-T // Ti), -(-A // Ai))", "n", "max(-(-T // Ti), -(-A // Ai))", "max", "-(-T // Ti)", "-T // Ti", "-T", "T", "Ti", "-(-A // Ai)", "-A // Ai", "-A", "A", "Ai", "T = n * Ti", "T", "n * Ti", "n", "Ti", "A = n * Ai", "A", "n * Ai", "n", "Ai", "print(T + A)", "print", "T + A", "T", "A", "return", "main()", "main", "def main():\n lines = stdin.readlines()\n N = int(lines[0])\n Tn = [0] * N\n An = [0] * N\n for i in range(N):\n Tn[i], An[i] = map(int, lines[i + 1].split())\n T = 1\n A = 1\n for Ti, Ai in zip(Tn, An):\n n = max(-(-T // Ti), -(-A // Ai))\n T = n * Ti\n A = n * Ai\n print(T + A)\n return", "def main():\n lines = stdin.readlines()\n N = int(lines[0])\n Tn = [0] * N\n An = [0] * N\n for i in range(N):\n Tn[i], An[i] = map(int, lines[i + 1].split())\n T = 1\n A = 1\n for Ti, Ai in zip(Tn, An):\n n = max(-(-T // Ti), -(-A // Ai))\n T = n * Ti\n A = n * Ai\n print(T + A)\n return", "main" ]
from sys import stdin def main(): lines = stdin.readlines() N = int(lines[0]) Tn = [0] * N An = [0] * N for i in range(N): Tn[i], An[i] = map(int, lines[i + 1].split()) T = 1 A = 1 for Ti, Ai in zip(Tn, An): n = max(-(-T // Ti), -(-A // Ai)) T = n * Ti A = n * Ai print(T + A) return main()
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 13, 13, 2, 13, 13, 0, 13, 13, 13, 13, 42, 2, 2, 13, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 17, 0, 13, 13, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 17, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13 ]
[ [ 112, 2 ], [ 115, 8 ], [ 115, 17 ], [ 20, 19 ], [ 113, 23 ], [ 106, 25 ], [ 106, 34 ], [ 91, 36 ], [ 83, 40 ], [ 98, 40 ], [ 107, 41 ], [ 116, 43 ], [ 110, 43 ], [ 104, 44 ], [ 88, 46 ], [ 107, 47 ], [ 118, 48 ], [ 104, 49 ], [ 89, 53 ], [ 101, 53 ], [ 83, 54 ], [ 98, 54 ], [ 119, 56 ], [ 95, 56 ], [ 116, 57 ], [ 110, 57 ], [ 100, 59 ], [ 107, 61 ], [ 92, 62 ], [ 19, 62 ], [ 86, 62 ], [ 94, 64 ], [ 104, 66 ], [ 92, 67 ], [ 19, 67 ], [ 86, 67 ], [ 85, 69 ], [ 97, 72 ], [ 101, 73 ], [ 89, 73 ], [ 109, 74 ], [ 95, 75 ], [ 119, 75 ], [ 98, 79 ], [ 83, 79 ], [ 110, 80 ], [ 116, 80 ], [ 115, 83 ], [ 85, 86 ], [ 107, 88 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ], [ 101, 97 ], [ 89, 97 ], [ 97, 98 ], [ 100, 101 ], [ 106, 104 ], [ 106, 107 ], [ 95, 109 ], [ 119, 109 ], [ 109, 110 ], [ 112, 113 ], [ 115, 116 ], [ 104, 118 ], [ 118, 119 ] ]
[ "n = int(input())\nt, a = map(int, input().split())\nfor i in range(1, n):\n x, y = map(int, input().split())\n i = max(t // x, a // y)\n c, d = x, y\n while c < t or d< a:\n c = x * i\n d = y * i\n i += 1\n t, a = c, d\nprint(t + a)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "for i in range(1, n):\n x, y = map(int, input().split())\n i = max(t // x, a // y)\n c, d = x, y\n while c < t or d< a:\n c = x * i\n d = y * i\n i += 1\n t, a = c, d", "i", "range(1, n)", "range", "1", "n", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "i = max(t // x, a // y)", "i", "max(t // x, a // y)", "max", "t // x", "t", "x", "a // y", "a", "y", "c, d = x, y", "c", "x", "d", "y", "while c < t or d< a:\n c = x * i\n d = y * i\n i += 1\n ", "c < t or d< a", "c < t", "c", "t", "d< a", "d", "a", "c = x * i", "c", "x * i", "x", "i", "d = y * i", "d", "y * i", "y", "i", "i += 1", "i", "1", "t, a = c, d", "t", "c", "a", "d", "print(t + a)", "print", "t + a", "t", "a", "t, a = map(int, input().split())", "map(int, input().split())", "t", "i += 1", "1", "i", "c, d = x, y", "x", "c", "i = max(t // x, a // y)", "max(t // x, a // y)", "i", "d = y * i", "y * i", "d", "t, a = c, d", "c", "t", "c = x * i", "x * i", "c", "y = map(int, input().split())", "map(int, input().split())", "y", "x, y = map(int, input().split())", "map(int, input().split())", "x", "a = c, d", "d", "a", "n = int(input())", "int(input())", "n", "a = map(int, input().split())", "map(int, input().split())", "a", "d = x, y", "y", "d" ]
n = int(input()) t, a = map(int, input().split()) for i in range(1, n): x, y = map(int, input().split()) i = max(t // x, a // y) c, d = x, y while c < t or d< a: c = x * i d = y * i i += 1 t, a = c, d print(t + a)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 70, 2 ], [ 76, 8 ], [ 73, 10 ], [ 14, 13 ], [ 71, 16 ], [ 64, 18 ], [ 64, 27 ], [ 79, 29 ], [ 77, 35 ], [ 83, 35 ], [ 62, 36 ], [ 62, 38 ], [ 74, 42 ], [ 68, 42 ], [ 65, 43 ], [ 65, 45 ], [ 82, 47 ], [ 80, 49 ], [ 71, 49 ], [ 62, 50 ], [ 67, 51 ], [ 80, 53 ], [ 71, 53 ], [ 65, 54 ], [ 83, 58 ], [ 77, 58 ], [ 68, 59 ], [ 74, 59 ], [ 64, 62 ], [ 64, 65 ], [ 67, 68 ], [ 70, 71 ], [ 73, 74 ], [ 76, 77 ], [ 79, 80 ], [ 82, 83 ] ]
[ "n=int(input())\np,q=1,1\n\nfor _ in range(n):\n t,a=map(int,input().split())\n #n=1\n #hile p>n*t or q>n*a:\n # n+=1\n n=max((p+t-1)//t,(q+a-1)//a)\n p,q=n*t,n*a\n #print(n,p,q)\n\nprint(p+q)", "n=int(input())", "n", "int(input())", "int", "input()", "input", "p,q=1,1", "p", "1", "q", "1", "for _ in range(n):\n t,a=map(int,input().split())\n #n=1\n #hile p>n*t or q>n*a:\n # n+=1\n n=max((p+t-1)//t,(q+a-1)//a)\n p,q=n*t,n*a\n #print(n,p,q)", "_", "range(n)", "range", "n", "t,a=map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "n=max((p+t-1)//t,(q+a-1)//a)", "n", "max((p+t-1)//t,(q+a-1)//a)", "max", "(p+t-1)//t", "p+t-1", "p+t", "p", "t", "1", "t", "(q+a-1)//a", "q+a-1", "q+a", "q", "a", "1", "a", "p,q=n*t,n*a", "p", "n*t", "n", "t", "q", "n*a", "n", "a", "print(p+q)", "print", "p+q", "p", "q", "t,a=map(int,input().split())", "map(int,input().split())", "t", "a=map(int,input().split())", "map(int,input().split())", "a", "q=n*t,n*a", "n*a", "q", "n=int(input())", "int(input())", "n", "q=1,1", "1", "q", "p,q=1,1", "1", "p", "n=max((p+t-1)//t,(q+a-1)//a)", "max((p+t-1)//t,(q+a-1)//a)", "n", "p,q=n*t,n*a", "n*t", "p" ]
n=int(input()) p,q=1,1 for _ in range(n): t,a=map(int,input().split()) #n=1 #hile p>n*t or q>n*a: # n+=1 n=max((p+t-1)//t,(q+a-1)//a) p,q=n*t,n*a #print(n,p,q) print(p+q)
[ 7, 15, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 13, 13, 2, 13, 13, 14, 2, 2, 2, 13, 13, 13, 2, 2, 13, 13, 13, 0, 13, 17, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 93, 3 ], [ 69, 9 ], [ 84, 11 ], [ 15, 14 ], [ 94, 17 ], [ 87, 19 ], [ 87, 28 ], [ 90, 30 ], [ 70, 34 ], [ 82, 34 ], [ 88, 35 ], [ 85, 37 ], [ 76, 37 ], [ 79, 38 ], [ 88, 43 ], [ 91, 44 ], [ 73, 44 ], [ 70, 45 ], [ 82, 45 ], [ 79, 48 ], [ 91, 49 ], [ 73, 49 ], [ 85, 50 ], [ 76, 50 ], [ 72, 52 ], [ 81, 55 ], [ 88, 57 ], [ 73, 58 ], [ 91, 58 ], [ 75, 59 ], [ 79, 61 ], [ 73, 62 ], [ 91, 62 ], [ 82, 66 ], [ 70, 66 ], [ 76, 67 ], [ 85, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 87, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ], [ 90, 91 ], [ 93, 94 ] ]
[ "from math import ceil\nN = int(input())\nT, A = 1, 1\nfor k in range(N):\n t, a = map(int,input().split())\n b = max(T//t,A//a)\n if t*b < T or a*b < A:\n b += 1\n T, A = t*b, a*b\nprint(T+A)", "from math import ceil", "N = int(input())", "N", "int(input())", "int", "input()", "input", "T, A = 1, 1", "T", "1", "A", "1", "for k in range(N):\n t, a = map(int,input().split())\n b = max(T//t,A//a)\n if t*b < T or a*b < A:\n b += 1\n T, A = t*b, a*b", "k", "range(N)", "range", "N", "t, a = map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "b = max(T//t,A//a)", "b", "max(T//t,A//a)", "max", "T//t", "T", "t", "A//a", "A", "a", "if t*b < T or a*b < A:\n b += 1\n ", "t*b < T or a*b < A", "t*b < T", "t*b", "t", "b", "T", "a*b < A", "a*b", "a", "b", "A", "b += 1", "b", "1", "T, A = t*b, a*b", "T", "t*b", "t", "b", "A", "a*b", "a", "b", "print(T+A)", "print", "T+A", "T", "A", "T, A = 1, 1", "1", "T", "b += 1", "1", "b", "A = t*b, a*b", "a*b", "A", "a = map(int,input().split())", "map(int,input().split())", "a", "T, A = t*b, a*b", "t*b", "T", "A = 1, 1", "1", "A", "t, a = map(int,input().split())", "map(int,input().split())", "t", "b = max(T//t,A//a)", "max(T//t,A//a)", "b", "N = int(input())", "int(input())", "N" ]
from math import ceil N = int(input()) T, A = 1, 1 for k in range(N): t, a = map(int,input().split()) b = max(T//t,A//a) if t*b < T or a*b < A: b += 1 T, A = t*b, a*b print(T+A)
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 14, 40, 2, 13, 18, 18, 13, 13, 17, 17, 0, 13, 2, 2, 13, 18, 18, 13, 13, 17, 17, 0, 13, 2, 13, 18, 18, 13, 13, 17, 14, 40, 2, 13, 18, 18, 13, 13, 17, 17, 0, 13, 2, 2, 13, 18, 18, 13, 13, 17, 17, 0, 13, 2, 13, 18, 18, 13, 13, 17, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 18, 18, 13, 13, 17, 0, 13, 2, 13, 18, 18, 13, 13, 17, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 13, 13, 10, 17, 13, 10, 2, 13 ]
[ [ 143, 2 ], [ 10, 9 ], [ 144, 12 ], [ 152, 25 ], [ 146, 28 ], [ 155, 31 ], [ 35, 34 ], [ 144, 37 ], [ 147, 41 ], [ 159, 41 ], [ 153, 44 ], [ 34, 45 ], [ 149, 49 ], [ 147, 52 ], [ 159, 52 ], [ 153, 55 ], [ 34, 56 ], [ 134, 60 ], [ 147, 62 ], [ 159, 62 ], [ 153, 65 ], [ 34, 66 ], [ 156, 71 ], [ 141, 71 ], [ 153, 74 ], [ 34, 75 ], [ 137, 79 ], [ 156, 82 ], [ 141, 82 ], [ 153, 85 ], [ 34, 86 ], [ 131, 90 ], [ 156, 92 ], [ 141, 92 ], [ 153, 95 ], [ 34, 96 ], [ 128, 99 ], [ 135, 102 ], [ 150, 102 ], [ 132, 103 ], [ 138, 103 ], [ 158, 105 ], [ 129, 107 ], [ 153, 110 ], [ 34, 111 ], [ 140, 114 ], [ 129, 116 ], [ 153, 119 ], [ 34, 120 ], [ 159, 125 ], [ 147, 125 ], [ 141, 126 ], [ 156, 126 ], [ 128, 129 ], [ 131, 132 ], [ 134, 135 ], [ 137, 138 ], [ 140, 141 ], [ 143, 144 ], [ 146, 147 ], [ 149, 150 ], [ 152, 153 ], [ 155, 156 ], [ 158, 159 ] ]
[ "N = int(input())\nta = [list(map(int, input().split())) for _ in range(N)]\nt = 1\na = 1\nfor i in range(N):\n if t % ta[i][0] != 0:\n ttmp = t // ta[i][0] + 1\n else:\n ttmp = t // ta[i][0]\n\n if a % ta[i][1] != 0:\n atmp = a // ta[i][1] + 1\n else:\n atmp = a // ta[i][1]\n n = max(ttmp, atmp)\n t = (n * ta[i][0])\n a = (n * ta[i][1])\n\nprint(t + a)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ta = [list(map(int, input().split())) for _ in range(N)]", "ta", "[list(map(int, input().split())) for _ in range(N)]", "t = 1", "t", "1", "a = 1", "a", "1", "for i in range(N):\n if t % ta[i][0] != 0:\n ttmp = t // ta[i][0] + 1\n else:\n ttmp = t // ta[i][0]\n\n if a % ta[i][1] != 0:\n atmp = a // ta[i][1] + 1\n else:\n atmp = a // ta[i][1]\n n = max(ttmp, atmp)\n t = (n * ta[i][0])\n a = (n * ta[i][1])", "i", "range(N)", "range", "N", "if t % ta[i][0] != 0:\n ttmp = t // ta[i][0] + 1\n else:\n ttmp = t // ta[i][0]\n\n ", "t % ta[i][0] != 0", "t % ta[i][0]", "t", "ta[i][0]", "[i]", "ta", "i", "0", "0", "ttmp = t // ta[i][0] + 1", "ttmp", "t // ta[i][0] + 1", "t // ta[i][0]", "t", "ta[i][0]", "[i]", "ta", "i", "0", "1", "ttmp = t // ta[i][0]", "ttmp", "t // ta[i][0]", "t", "ta[i][0]", "[i]", "ta", "i", "0", "if a % ta[i][1] != 0:\n atmp = a // ta[i][1] + 1\n else:\n atmp = a // ta[i][1]\n ", "a % ta[i][1] != 0", "a % ta[i][1]", "a", "ta[i][1]", "[i]", "ta", "i", "1", "0", "atmp = a // ta[i][1] + 1", "atmp", "a // ta[i][1] + 1", "a // ta[i][1]", "a", "ta[i][1]", "[i]", "ta", "i", "1", "1", "atmp = a // ta[i][1]", "atmp", "a // ta[i][1]", "a", "ta[i][1]", "[i]", "ta", "i", "1", "n = max(ttmp, atmp)", "n", "max(ttmp, atmp)", "max", "ttmp", "atmp", "t = (n * ta[i][0])", "t", "n * ta[i][0]", "n", "ta[i][0]", "[i]", "ta", "i", "0", "a = (n * ta[i][1])", "a", "n * ta[i][1]", "n", "ta[i][1]", "[i]", "ta", "i", "1", "print(t + a)", "print", "t + a", "t", "a", "n = max(ttmp, atmp)", "max(ttmp, atmp)", "n", "atmp = a // ta[i][1]", "a // ta[i][1]", "atmp", "ttmp = t // ta[i][0]", "t // ta[i][0]", "ttmp", "atmp = a // ta[i][1] + 1", "a // ta[i][1] + 1", "atmp", "a = (n * ta[i][1])", "n * ta[i][1]", "a", "N = int(input())", "int(input())", "N", "t = 1", "1", "t", "ttmp = t // ta[i][0] + 1", "t // ta[i][0] + 1", "ttmp", "ta = [list(map(int, input().split())) for _ in range(N)]", "[list(map(int, input().split())) for _ in range(N)]", "ta", "a = 1", "1", "a", "t = (n * ta[i][0])", "n * ta[i][0]", "t" ]
N = int(input()) ta = [list(map(int, input().split())) for _ in range(N)] t = 1 a = 1 for i in range(N): if t % ta[i][0] != 0: ttmp = t // ta[i][0] + 1 else: ttmp = t // ta[i][0] if a % ta[i][1] != 0: atmp = a // ta[i][1] + 1 else: atmp = a // ta[i][1] n = max(ttmp, atmp) t = (n * ta[i][0]) a = (n * ta[i][1]) print(t + a)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 39, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 40, 13, 18, 13, 17, 40, 13, 18, 13, 17, 0, 13, 39, 13, 13, 0, 13, 4, 13, 2, 2, 2, 18, 13, 17, 17, 13, 17, 2, 2, 2, 18, 13, 17, 17, 13, 17, 0, 13, 39, 2, 13, 13, 2, 13, 13, 4, 13, 4, 13, 13, 10, 39, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 39, 13, 10, 39, 13 ]
[ [ 94, 2 ], [ 82, 8 ], [ 14, 13 ], [ 95, 16 ], [ 88, 18 ], [ 88, 27 ], [ 89, 31 ], [ 83, 33 ], [ 98, 33 ], [ 101, 33 ], [ 86, 36 ], [ 83, 38 ], [ 98, 38 ], [ 101, 38 ], [ 100, 41 ], [ 91, 46 ], [ 83, 53 ], [ 98, 53 ], [ 101, 53 ], [ 89, 56 ], [ 83, 62 ], [ 98, 62 ], [ 101, 62 ], [ 86, 65 ], [ 97, 68 ], [ 89, 71 ], [ 92, 72 ], [ 86, 74 ], [ 92, 75 ], [ 98, 80 ], [ 101, 80 ], [ 83, 80 ], [ 82, 83 ], [ 88, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ] ]
[ "N = int(input())\n\nl = [0, 0]\nfor _ in range(N):\n t, a = map(int, input().split())\n if t >= l[0] and a >= l[1]:\n l = [t, a]\n else:\n temp = max((l[0] - 1) // t + 1, (l[1] - 1) // a + 1)\n l = [t * temp, a * temp]\n \nprint(sum(l))", "N = int(input())", "N", "int(input())", "int", "input()", "input", "l = [0, 0]", "l", "[0, 0]", "0", "0", "for _ in range(N):\n t, a = map(int, input().split())\n if t >= l[0] and a >= l[1]:\n l = [t, a]\n else:\n temp = max((l[0] - 1) // t + 1, (l[1] - 1) // a + 1)\n l = [t * temp, a * temp]\n ", "_", "range(N)", "range", "N", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "if t >= l[0] and a >= l[1]:\n l = [t, a]\n else:\n temp = max((l[0] - 1) // t + 1, (l[1] - 1) // a + 1)\n l = [t * temp, a * temp]\n ", "t >= l[0] and a >= l[1]", "t >= l[0]", "t", "l[0]", "l", "0", "a >= l[1]", "a", "l[1]", "l", "1", "l = [t, a]", "l", "[t, a]", "t", "a", "temp = max((l[0] - 1) // t + 1, (l[1] - 1) // a + 1)", "temp", "max((l[0] - 1) // t + 1, (l[1] - 1) // a + 1)", "max", "(l[0] - 1) // t + 1", "(l[0] - 1) // t", "l[0] - 1", "l[0]", "l", "0", "1", "t", "1", "(l[1] - 1) // a + 1", "(l[1] - 1) // a", "l[1] - 1", "l[1]", "l", "1", "1", "a", "1", "l = [t * temp, a * temp]", "l", "[t * temp, a * temp]", "t * temp", "t", "temp", "a * temp", "a", "temp", "print(sum(l))", "print", "sum(l)", "sum", "l", "l = [0, 0]", "[0, 0]", "l", "a = map(int, input().split())", "map(int, input().split())", "a", "t, a = map(int, input().split())", "map(int, input().split())", "t", "temp = max((l[0] - 1) // t + 1, (l[1] - 1) // a + 1)", "max((l[0] - 1) // t + 1, (l[1] - 1) // a + 1)", "temp", "N = int(input())", "int(input())", "N", "l = [t * temp, a * temp]", "[t * temp, a * temp]", "l", "l = [t, a]", "[t, a]", "l" ]
N = int(input()) l = [0, 0] for _ in range(N): t, a = map(int, input().split()) if t >= l[0] and a >= l[1]: l = [t, a] else: temp = max((l[0] - 1) // t + 1, (l[1] - 1) // a + 1) l = [t * temp, a * temp] print(sum(l))
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 18, 13, 17, 13, 28, 13, 4, 13, 13, 0, 13, 18, 13, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 2, 13, 10, 18, 13, 10, 4, 13, 10, 18, 13, 10, 4, 13, 10, 18, 13, 10, 18, 13 ]
[ [ 100, 4 ], [ 12, 11 ], [ 101, 14 ], [ 82, 27 ], [ 97, 30 ], [ 83, 32 ], [ 97, 34 ], [ 37, 36 ], [ 101, 39 ], [ 106, 41 ], [ 83, 43 ], [ 36, 44 ], [ 106, 45 ], [ 94, 47 ], [ 98, 53 ], [ 80, 53 ], [ 104, 54 ], [ 92, 58 ], [ 86, 58 ], [ 107, 59 ], [ 79, 61 ], [ 104, 63 ], [ 95, 64 ], [ 85, 66 ], [ 107, 68 ], [ 95, 69 ], [ 88, 71 ], [ 80, 73 ], [ 98, 73 ], [ 86, 74 ], [ 92, 74 ], [ 89, 77 ], [ 79, 80 ], [ 82, 83 ], [ 85, 86 ], [ 88, 89 ], [ 97, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 106, 104 ], [ 106, 107 ] ]
[ "import math\n\nn = int(input())\nta = [tuple(map(int, input().split())) for _ in range(n)]\n\na, b = ta[0]\nfor i in range(n):\n x, y = ta[i]\n z = max(-(-a//x), -(-b//y))\n a = x * z\n b = y * z\n\nans = a + b\nprint(ans)", "import math", "math", "n = int(input())", "n", "int(input())", "int", "input()", "input", "tuple(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "tuple(map(int, input().split()))", "tuple", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ta = [tuple(map(int, input().split())) for _ in range(n)]", "ta", "[tuple(map(int, input().split())) for _ in range(n)]", "a, b = ta[0]", "a", "ta[0]", "ta", "0", "b", "for i in range(n):\n x, y = ta[i]\n z = max(-(-a//x), -(-b//y))\n a = x * z\n b = y * z", "i", "range(n)", "range", "n", "x, y = ta[i]", "x", "ta[i]", "ta", "i", "y", "z = max(-(-a//x), -(-b//y))", "z", "max(-(-a//x), -(-b//y))", "max", "-(-a//x)", "-a//x", "-a", "a", "x", "-(-b//y)", "-b//y", "-b", "b", "y", "a = x * z", "a", "x * z", "x", "z", "b = y * z", "b", "y * z", "y", "z", "ans = a + b", "ans", "a + b", "a", "b", "print(ans)", "print", "ans", "a = x * z", "x * z", "a", "ta = [tuple(map(int, input().split())) for _ in range(n)]", "[tuple(map(int, input().split())) for _ in range(n)]", "ta", "b = y * z", "y * z", "b", "ans = a + b", "a + b", "ans", "b = ta[0]", "ta[0]", "b", "z = max(-(-a//x), -(-b//y))", "max(-(-a//x), -(-b//y))", "z", "a, b = ta[0]", "ta[0]", "a", "n = int(input())", "int(input())", "n", "x, y = ta[i]", "ta[i]", "x", "y = ta[i]", "ta[i]", "y" ]
import math n = int(input()) ta = [tuple(map(int, input().split())) for _ in range(n)] a, b = ta[0] for i in range(n): x, y = ta[i] z = max(-(-a//x), -(-b//y)) a = x * z b = y * z ans = a + b print(ans)
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 0, 13, 39, 28, 13, 4, 13, 13, 4, 18, 13, 13, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 18, 18, 13, 13, 17, 40, 2, 40, 13, 18, 18, 13, 13, 17, 0, 13, 2, 13, 18, 18, 13, 13, 17, 0, 13, 2, 13, 18, 18, 13, 13, 17, 4, 13, 2, 13, 13, 10, 2, 13, 10, 39, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 103, 4 ], [ 91, 10 ], [ 14, 13 ], [ 104, 16 ], [ 92, 19 ], [ 97, 32 ], [ 106, 35 ], [ 39, 38 ], [ 104, 41 ], [ 100, 43 ], [ 98, 49 ], [ 95, 49 ], [ 92, 52 ], [ 38, 53 ], [ 107, 58 ], [ 89, 58 ], [ 92, 61 ], [ 38, 62 ], [ 94, 65 ], [ 101, 67 ], [ 92, 70 ], [ 38, 71 ], [ 88, 74 ], [ 101, 76 ], [ 92, 79 ], [ 38, 80 ], [ 95, 85 ], [ 98, 85 ], [ 89, 86 ], [ 107, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ] ]
[ "import math\nN = int(input())\nls = []\nfor i in range(N):\n ls.append(list(map(int,input().split())))\n\nT = 1\nA = 1\nfor i in range(N):\n bai = max(-(-T//ls[i][0]),-(-A//ls[i][1]))\n T = bai * ls[i][0]\n A = bai * ls[i][1]\nprint(T+A)", "import math", "math", "N = int(input())", "N", "int(input())", "int", "input()", "input", "ls = []", "ls", "[]", "for i in range(N):\n ls.append(list(map(int,input().split())))", "i", "range(N)", "range", "N", "ls.append(list(map(int,input().split())))", "ls.append", "ls", "append", "list(map(int,input().split()))", "list", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "T = 1", "T", "1", "A = 1", "A", "1", "for i in range(N):\n bai = max(-(-T//ls[i][0]),-(-A//ls[i][1]))\n T = bai * ls[i][0]\n A = bai * ls[i][1]", "i", "range(N)", "range", "N", "bai = max(-(-T//ls[i][0]),-(-A//ls[i][1]))", "bai", "max(-(-T//ls[i][0]),-(-A//ls[i][1]))", "max", "-(-T//ls[i][0])", "-T//ls[i][0]", "-T", "T", "ls[i][0]", "[i]", "ls", "i", "0", "-(-A//ls[i][1])", "-A//ls[i][1]", "-A", "A", "ls[i][1]", "[i]", "ls", "i", "1", "T = bai * ls[i][0]", "T", "bai * ls[i][0]", "bai", "ls[i][0]", "[i]", "ls", "i", "0", "A = bai * ls[i][1]", "A", "bai * ls[i][1]", "bai", "ls[i][1]", "[i]", "ls", "i", "1", "print(T+A)", "print", "T+A", "T", "A", "A = bai * ls[i][1]", "bai * ls[i][1]", "A", "ls = []", "[]", "ls", "T = bai * ls[i][0]", "bai * ls[i][0]", "T", "T = 1", "1", "T", "bai = max(-(-T//ls[i][0]),-(-A//ls[i][1]))", "max(-(-T//ls[i][0]),-(-A//ls[i][1]))", "bai", "N = int(input())", "int(input())", "N", "A = 1", "1", "A" ]
import math N = int(input()) ls = [] for i in range(N): ls.append(list(map(int,input().split()))) T = 1 A = 1 for i in range(N): bai = max(-(-T//ls[i][0]),-(-A//ls[i][1])) T = bai * ls[i][0] A = bai * ls[i][1] print(T+A)
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 17, 13, 17, 28, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13 ]
[ [ 69, 2 ], [ 10, 9 ], [ 70, 12 ], [ 72, 25 ], [ 75, 28 ], [ 78, 30 ], [ 81, 37 ], [ 76, 43 ], [ 85, 43 ], [ 79, 50 ], [ 88, 50 ], [ 84, 55 ], [ 82, 57 ], [ 87, 59 ], [ 82, 61 ], [ 85, 66 ], [ 76, 66 ], [ 88, 67 ], [ 79, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ] ]
[ "n = int(input())\nratio_array = [tuple(map(int, input().split())) for _ in range(n)]\n\nt, a = 1, 1\n\nfor x, y in ratio_array:\n m = max((t+x-1)//x, (a+y-1)//y)\n t, a = m*x, m*y\n\nprint(t + a)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "tuple(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "tuple(map(int, input().split()))", "tuple", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ratio_array = [tuple(map(int, input().split())) for _ in range(n)]", "ratio_array", "[tuple(map(int, input().split())) for _ in range(n)]", "t, a = 1, 1", "t", "1", "a", "1", "for x, y in ratio_array:\n m = max((t+x-1)//x, (a+y-1)//y)\n t, a = m*x, m*y", "x", "y", "ratio_array", "m = max((t+x-1)//x, (a+y-1)//y)", "m", "max((t+x-1)//x, (a+y-1)//y)", "max", "(t+x-1)//x", "t+x-1", "t+x", "t", "x", "1", "x", "(a+y-1)//y", "a+y-1", "a+y", "a", "y", "1", "y", "t, a = m*x, m*y", "t", "m*x", "m", "x", "a", "m*y", "m", "y", "print(t + a)", "print", "t + a", "t", "a", "n = int(input())", "int(input())", "n", "ratio_array = [tuple(map(int, input().split())) for _ in range(n)]", "[tuple(map(int, input().split())) for _ in range(n)]", "ratio_array", "t, a = 1, 1", "1", "t", "a = 1, 1", "1", "a", "m = max((t+x-1)//x, (a+y-1)//y)", "max((t+x-1)//x, (a+y-1)//y)", "m", "t, a = m*x, m*y", "m*x", "t", "a = m*x, m*y", "m*y", "a" ]
n = int(input()) ratio_array = [tuple(map(int, input().split())) for _ in range(n)] t, a = 1, 1 for x, y in ratio_array: m = max((t+x-1)//x, (a+y-1)//y) t, a = m*x, m*y print(t + a)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 39, 28, 13, 4, 13, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 4, 18, 13, 13, 13, 0, 13, 18, 18, 13, 17, 17, 0, 13, 18, 18, 13, 17, 17, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 40, 2, 40, 13, 18, 18, 13, 2, 13, 17, 17, 40, 2, 40, 13, 18, 18, 13, 2, 13, 17, 17, 0, 13, 2, 13, 18, 18, 13, 2, 13, 17, 17, 0, 13, 2, 13, 18, 18, 13, 2, 13, 17, 17, 4, 13, 2, 13, 13, 10, 2, 13, 10, 18, 13, 10, 2, 13, 10, 18, 13, 10, 4, 13, 10, 39, 13, 10, 4, 13 ]
[ [ 119, 2 ], [ 122, 8 ], [ 12, 11 ], [ 120, 14 ], [ 18, 17 ], [ 17, 26 ], [ 123, 29 ], [ 116, 33 ], [ 123, 36 ], [ 110, 40 ], [ 123, 43 ], [ 48, 47 ], [ 120, 51 ], [ 125, 54 ], [ 117, 60 ], [ 114, 60 ], [ 123, 63 ], [ 47, 65 ], [ 111, 71 ], [ 108, 71 ], [ 123, 74 ], [ 47, 76 ], [ 113, 80 ], [ 126, 82 ], [ 120, 82 ], [ 123, 85 ], [ 47, 87 ], [ 107, 91 ], [ 126, 93 ], [ 120, 93 ], [ 123, 96 ], [ 47, 98 ], [ 114, 104 ], [ 117, 104 ], [ 108, 105 ], [ 111, 105 ], [ 107, 108 ], [ 110, 111 ], [ 113, 114 ], [ 116, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ] ]
[ "n = int(input())\nL = []\nfor i in range(n):\n\tL.append([int(i) for i in input().split()])\n\nx = L[0][0]\ny = L[0][1]\n\nfor i in range(n-1):\n n = max(-(-x//L[i+1][0]), -(-y//L[i+1][1]))\n x = n*L[i+1][0]\n y = n*L[i+1][1]\n\nprint(x+y)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "L = []", "L", "[]", "for i in range(n):\n\tL.append([int(i) for i in input().split()])", "i", "range(n)", "range", "n", "int(i) for i in input().split()", "for i in input().split()", "i", "input().split()", "().split", "()", "input", "split", "for i in input().split()", "int(i)", "int", "i", "L.append([int(i) for i in input().split()])", "L.append", "L", "append", "[int(i) for i in input().split()]", "x = L[0][0]", "x", "L[0][0]", "[0]", "L", "0", "0", "y = L[0][1]", "y", "L[0][1]", "[0]", "L", "0", "1", "for i in range(n-1):\n n = max(-(-x//L[i+1][0]), -(-y//L[i+1][1]))\n x = n*L[i+1][0]\n y = n*L[i+1][1]", "i", "range(n-1)", "range", "n-1", "n", "1", "n = max(-(-x//L[i+1][0]), -(-y//L[i+1][1]))", "n", "max(-(-x//L[i+1][0]), -(-y//L[i+1][1]))", "max", "-(-x//L[i+1][0])", "-x//L[i+1][0]", "-x", "x", "L[i+1][0]", "[i+1]", "L", "i+1", "i", "1", "0", "-(-y//L[i+1][1])", "-y//L[i+1][1]", "-y", "y", "L[i+1][1]", "[i+1]", "L", "i+1", "i", "1", "1", "x = n*L[i+1][0]", "x", "n*L[i+1][0]", "n", "L[i+1][0]", "[i+1]", "L", "i+1", "i", "1", "0", "y = n*L[i+1][1]", "y", "n*L[i+1][1]", "n", "L[i+1][1]", "[i+1]", "L", "i+1", "i", "1", "1", "print(x+y)", "print", "x+y", "x", "y", "y = n*L[i+1][1]", "n*L[i+1][1]", "y", "y = L[0][1]", "L[0][1]", "y", "x = n*L[i+1][0]", "n*L[i+1][0]", "x", "x = L[0][0]", "L[0][0]", "x", "n = int(input())", "int(input())", "n", "L = []", "[]", "L", "n = max(-(-x//L[i+1][0]), -(-y//L[i+1][1]))", "max(-(-x//L[i+1][0]), -(-y//L[i+1][1]))", "n" ]
n = int(input()) L = [] for i in range(n): L.append([int(i) for i in input().split()]) x = L[0][0] y = L[0][1] for i in range(n-1): n = max(-(-x//L[i+1][0]), -(-y//L[i+1][1])) x = n*L[i+1][0] y = n*L[i+1][1] print(x+y)
[ 7, 15, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 8, 40, 2, 13, 13, 17, 2, 2, 13, 13, 17, 2, 13, 13, 0, 13, 8, 40, 2, 13, 13, 17, 2, 2, 13, 13, 17, 2, 13, 13, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 8, 13, 10, 8, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 130, 3 ], [ 142, 9 ], [ 142, 18 ], [ 136, 20 ], [ 140, 23 ], [ 143, 24 ], [ 106, 26 ], [ 140, 28 ], [ 137, 29 ], [ 121, 31 ], [ 143, 33 ], [ 137, 34 ], [ 37, 36 ], [ 131, 40 ], [ 133, 42 ], [ 133, 51 ], [ 118, 53 ], [ 107, 57 ], [ 113, 57 ], [ 128, 58 ], [ 140, 58 ], [ 107, 62 ], [ 113, 62 ], [ 128, 63 ], [ 140, 63 ], [ 107, 66 ], [ 113, 66 ], [ 128, 67 ], [ 140, 67 ], [ 115, 69 ], [ 122, 73 ], [ 110, 73 ], [ 134, 74 ], [ 143, 74 ], [ 122, 78 ], [ 110, 78 ], [ 134, 79 ], [ 143, 79 ], [ 122, 82 ], [ 110, 82 ], [ 134, 83 ], [ 143, 83 ], [ 124, 85 ], [ 119, 88 ], [ 116, 89 ], [ 112, 91 ], [ 128, 93 ], [ 140, 93 ], [ 125, 94 ], [ 109, 96 ], [ 134, 98 ], [ 143, 98 ], [ 125, 99 ], [ 113, 103 ], [ 107, 103 ], [ 110, 104 ], [ 122, 104 ], [ 106, 107 ], [ 109, 110 ], [ 112, 113 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ], [ 133, 128 ], [ 130, 131 ], [ 133, 134 ], [ 136, 137 ], [ 142, 140 ], [ 142, 143 ] ]
[ "from fractions import gcd\nN = int(input())\nt, a = map(int, input().split())\nx = gcd(t,a)\npT = t//x\npA = a//x\nfor i in range(1,N):\n t, a = map(int, input().split())\n mt = pT//t+1 if pT%t!=0 else pT//t\n ma = pA//a+1 if pA%a!=0 else pA//a\n m = max(mt,ma)\n pT = t*m\n pA = a*m\n\nprint(pT+pA)", "from fractions import gcd", "N = int(input())", "N", "int(input())", "int", "input()", "input", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "x = gcd(t,a)", "x", "gcd(t,a)", "gcd", "t", "a", "pT = t//x", "pT", "t//x", "t", "x", "pA = a//x", "pA", "a//x", "a", "x", "for i in range(1,N):\n t, a = map(int, input().split())\n mt = pT//t+1 if pT%t!=0 else pT//t\n ma = pA//a+1 if pA%a!=0 else pA//a\n m = max(mt,ma)\n pT = t*m\n pA = a*m", "i", "range(1,N)", "range", "1", "N", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "mt = pT//t+1 if pT%t!=0 else pT//t", "mt", "pT//t+1 if pT%t!=0 else pT//t", "pT%t!=0", "pT%t", "pT", "t", "0", "pT//t+1", "pT//t", "pT", "t", "1", "pT//t", "pT", "t", "ma = pA//a+1 if pA%a!=0 else pA//a", "ma", "pA//a+1 if pA%a!=0 else pA//a", "pA%a!=0", "pA%a", "pA", "a", "0", "pA//a+1", "pA//a", "pA", "a", "1", "pA//a", "pA", "a", "m = max(mt,ma)", "m", "max(mt,ma)", "max", "mt", "ma", "pT = t*m", "pT", "t*m", "t", "m", "pA = a*m", "pA", "a*m", "a", "m", "print(pT+pA)", "print", "pT+pA", "pT", "pA", "pT = t//x", "t//x", "pT", "pA = a*m", "a*m", "pA", "pT = t*m", "t*m", "pT", "ma = pA//a+1 if pA%a!=0 else pA//a", "pA//a+1 if pA%a!=0 else pA//a", "ma", "mt = pT//t+1 if pT%t!=0 else pT//t", "pT//t+1 if pT%t!=0 else pT//t", "mt", "pA = a//x", "a//x", "pA", "m = max(mt,ma)", "max(mt,ma)", "m", "t, a = map(int, input().split())", "map(int, input().split())", "t", "N = int(input())", "int(input())", "N", "a = map(int, input().split())", "map(int, input().split())", "a", "x = gcd(t,a)", "gcd(t,a)", "x", "t, a = map(int, input().split())", "map(int, input().split())", "t", "a = map(int, input().split())", "map(int, input().split())", "a" ]
from fractions import gcd N = int(input()) t, a = map(int, input().split()) x = gcd(t,a) pT = t//x pA = a//x for i in range(1,N): t, a = map(int, input().split()) mt = pT//t+1 if pT%t!=0 else pT//t ma = pA//a+1 if pA%a!=0 else pA//a m = max(mt,ma) pT = t*m pA = a*m print(pT+pA)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 2, 2, 13, 17, 13, 17, 0, 13, 2, 2, 2, 13, 17, 13, 17, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 88, 2 ], [ 91, 8 ], [ 91, 17 ], [ 20, 19 ], [ 89, 23 ], [ 100, 26 ], [ 100, 35 ], [ 97, 37 ], [ 86, 41 ], [ 80, 41 ], [ 101, 43 ], [ 76, 46 ], [ 92, 50 ], [ 83, 50 ], [ 95, 52 ], [ 103, 55 ], [ 98, 58 ], [ 77, 59 ], [ 79, 61 ], [ 104, 63 ], [ 101, 64 ], [ 82, 66 ], [ 104, 68 ], [ 95, 69 ], [ 80, 73 ], [ 86, 73 ], [ 83, 74 ], [ 92, 74 ], [ 76, 77 ], [ 79, 80 ], [ 82, 83 ], [ 91, 86 ], [ 88, 89 ], [ 91, 92 ], [ 100, 95 ], [ 97, 98 ], [ 100, 101 ], [ 103, 104 ] ]
[ "N = int(input())\nT, A = map(int, input().split())\nfor i in range(N-1):\n t, a = map(int, input().split())\n p = (T-1)//t + 1\n q = (A-1)//a + 1\n n = max(p, q)\n T = n*t\n A = n*a\nprint(T+A)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "T, A = map(int, input().split())", "T", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "for i in range(N-1):\n t, a = map(int, input().split())\n p = (T-1)//t + 1\n q = (A-1)//a + 1\n n = max(p, q)\n T = n*t\n A = n*a", "i", "range(N-1)", "range", "N-1", "N", "1", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "p = (T-1)//t + 1", "p", "(T-1)//t + 1", "(T-1)//t", "T-1", "T", "1", "t", "1", "q = (A-1)//a + 1", "q", "(A-1)//a + 1", "(A-1)//a", "A-1", "A", "1", "a", "1", "n = max(p, q)", "n", "max(p, q)", "max", "p", "q", "T = n*t", "T", "n*t", "n", "t", "A = n*a", "A", "n*a", "n", "a", "print(T+A)", "print", "T+A", "T", "A", "q = (A-1)//a + 1", "(A-1)//a + 1", "q", "T = n*t", "n*t", "T", "A = n*a", "n*a", "A", "T, A = map(int, input().split())", "map(int, input().split())", "T", "N = int(input())", "int(input())", "N", "A = map(int, input().split())", "map(int, input().split())", "A", "a = map(int, input().split())", "map(int, input().split())", "a", "p = (T-1)//t + 1", "(T-1)//t + 1", "p", "t, a = map(int, input().split())", "map(int, input().split())", "t", "n = max(p, q)", "max(p, q)", "n" ]
N = int(input()) T, A = map(int, input().split()) for i in range(N-1): t, a = map(int, input().split()) p = (T-1)//t + 1 q = (A-1)//a + 1 n = max(p, q) T = n*t A = n*a print(T+A)
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 18, 13, 17, 13, 0, 13, 13, 13, 13, 28, 13, 4, 13, 17, 13, 0, 13, 18, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 13, 0, 13, 13, 0, 13, 13, 13, 13, 4, 13, 2, 13, 13, 10, 13, 13, 10, 18, 13, 10, 18, 13, 10, 4, 13, 10, 13, 13, 10, 18, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13, 10, 13, 13, 10, 18, 13, 10, 13, 13, 10, 13, 13 ]
[ [ 96, 4 ], [ 12, 11 ], [ 97, 14 ], [ 114, 27 ], [ 93, 30 ], [ 115, 32 ], [ 93, 34 ], [ 108, 36 ], [ 94, 37 ], [ 99, 38 ], [ 91, 39 ], [ 42, 41 ], [ 97, 45 ], [ 117, 47 ], [ 115, 49 ], [ 41, 50 ], [ 117, 51 ], [ 111, 53 ], [ 94, 59 ], [ 88, 59 ], [ 118, 60 ], [ 109, 60 ], [ 106, 60 ], [ 118, 62 ], [ 109, 62 ], [ 106, 62 ], [ 91, 66 ], [ 124, 66 ], [ 103, 67 ], [ 100, 67 ], [ 121, 67 ], [ 103, 69 ], [ 100, 69 ], [ 121, 69 ], [ 105, 71 ], [ 112, 72 ], [ 120, 74 ], [ 112, 75 ], [ 87, 77 ], [ 106, 78 ], [ 118, 78 ], [ 109, 78 ], [ 123, 79 ], [ 121, 80 ], [ 103, 80 ], [ 100, 80 ], [ 106, 84 ], [ 118, 84 ], [ 109, 84 ], [ 121, 85 ], [ 103, 85 ], [ 100, 85 ], [ 106, 87 ], [ 118, 87 ], [ 109, 87 ], [ 87, 88 ], [ 93, 91 ], [ 93, 94 ], [ 96, 97 ], [ 91, 99 ], [ 99, 100 ], [ 117, 103 ], [ 112, 105 ], [ 105, 106 ], [ 94, 108 ], [ 108, 109 ], [ 111, 112 ], [ 114, 115 ], [ 117, 118 ], [ 112, 120 ], [ 120, 121 ], [ 121, 123 ], [ 103, 123 ], [ 100, 123 ], [ 123, 124 ] ]
[ "# C - AtCoDeerใใ‚“ใจ้ธๆŒ™้€Ÿๅ ฑ / AtCoDeer and Election Report\n\n# ๆฏ”ใŒa:bใจใชใ‚‹ๅˆ่จˆๆœ€ๅฐใฎ็ฅจๅˆ†ๅธƒใฏa,b\n# ๆฌกใซc:dใซใชใฃใŸใจใใ€a<=cใ‹ใคb<=dใจใชใ‚‹ใ‚ˆใ†ใซc,dใซๅŒใ˜ๆ•ฐใ‚’ใ‹ใ‘ใ‚‹\n\nimport math\n\nN = int(input())\nTA = [list(map(int, input().split())) for _ in range(N)]\n\na, b = TA[0]\nc, d = a, b\n\nfor idx in range(1,N):\n c, d = TA[idx]\n multi = max((a+c-1)//c, (b+d-1)//d)\n c *= multi\n d *= multi\n a,b = c,d\n \nprint(c+d)", "import math", "math", "N = int(input())", "N", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "TA = [list(map(int, input().split())) for _ in range(N)]", "TA", "[list(map(int, input().split())) for _ in range(N)]", "a, b = TA[0]", "a", "TA[0]", "TA", "0", "b", "c, d = a, b", "c", "a", "d", "b", "for idx in range(1,N):\n c, d = TA[idx]\n multi = max((a+c-1)//c, (b+d-1)//d)\n c *= multi\n d *= multi\n a,b = c,d\n ", "idx", "range(1,N)", "range", "1", "N", "c, d = TA[idx]", "c", "TA[idx]", "TA", "idx", "d", "multi = max((a+c-1)//c, (b+d-1)//d)", "multi", "max((a+c-1)//c, (b+d-1)//d)", "max", "(a+c-1)//c", "a+c-1", "a+c", "a", "c", "1", "c", "(b+d-1)//d", "b+d-1", "b+d", "b", "d", "1", "d", "c *= multi", "c", "multi", "d *= multi", "d", "multi", "a,b = c,d", "a", "c", "b", "d", "print(c+d)", "print", "c+d", "c", "d", "a,b = c,d", "c", "a", "b = TA[0]", "TA[0]", "b", "a, b = TA[0]", "TA[0]", "a", "N = int(input())", "int(input())", "N", "d = a, b", "b", "d", "d = TA[idx]", "TA[idx]", "d", "c *= multi", "multi", "c", "c, d = a, b", "a", "c", "multi = max((a+c-1)//c, (b+d-1)//d)", "max((a+c-1)//c, (b+d-1)//d)", "multi", "TA = [list(map(int, input().split())) for _ in range(N)]", "[list(map(int, input().split())) for _ in range(N)]", "TA", "c, d = TA[idx]", "TA[idx]", "c", "d *= multi", "multi", "d", "b = c,d", "d", "b" ]
# C - AtCoDeerใใ‚“ใจ้ธๆŒ™้€Ÿๅ ฑ / AtCoDeer and Election Report # ๆฏ”ใŒa:bใจใชใ‚‹ๅˆ่จˆๆœ€ๅฐใฎ็ฅจๅˆ†ๅธƒใฏa,b # ๆฌกใซc:dใซใชใฃใŸใจใใ€a<=cใ‹ใคb<=dใจใชใ‚‹ใ‚ˆใ†ใซc,dใซๅŒใ˜ๆ•ฐใ‚’ใ‹ใ‘ใ‚‹ import math N = int(input()) TA = [list(map(int, input().split())) for _ in range(N)] a, b = TA[0] c, d = a, b for idx in range(1,N): c, d = TA[idx] multi = max((a+c-1)//c, (b+d-1)//d) c *= multi d *= multi a,b = c,d print(c+d)
[ 7, 15, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 77, 3 ], [ 65, 9 ], [ 74, 11 ], [ 15, 14 ], [ 78, 17 ], [ 71, 19 ], [ 71, 28 ], [ 80, 30 ], [ 66, 36 ], [ 63, 36 ], [ 72, 37 ], [ 75, 41 ], [ 60, 41 ], [ 69, 42 ], [ 62, 44 ], [ 81, 46 ], [ 72, 47 ], [ 59, 49 ], [ 81, 51 ], [ 69, 52 ], [ 63, 56 ], [ 66, 56 ], [ 60, 57 ], [ 75, 57 ], [ 59, 60 ], [ 62, 63 ], [ 65, 66 ], [ 71, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ] ]
[ "# C - AtCoDeerใใ‚“ใจ้ธๆŒ™้€Ÿๅ ฑ\nfrom math import ceil\nn=int(input())\nt,a=1,1\nfor i in range(n):\n tt,aa=map(int,input().split())\n min_num=max(-(-t//tt),-(-a//aa))\n # min_num=max(ceil(t/tt),ceil(a/aa))\n t=min_num*tt\n a=min_num*aa\nprint(t+a)", "from math import ceil", "n=int(input())", "n", "int(input())", "int", "input()", "input", "t,a=1,1", "t", "1", "a", "1", "for i in range(n):\n tt,aa=map(int,input().split())\n min_num=max(-(-t//tt),-(-a//aa))\n # min_num=max(ceil(t/tt),ceil(a/aa))\n t=min_num*tt\n a=min_num*aa", "i", "range(n)", "range", "n", "tt,aa=map(int,input().split())", "tt", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "aa", "min_num=max(-(-t//tt),-(-a//aa))", "min_num", "max(-(-t//tt),-(-a//aa))", "max", "-(-t//tt)", "-t//tt", "-t", "t", "tt", "-(-a//aa)", "-a//aa", "-a", "a", "aa", "t=min_num*tt", "t", "min_num*tt", "min_num", "tt", "a=min_num*aa", "a", "min_num*aa", "min_num", "aa", "print(t+a)", "print", "t+a", "t", "a", "a=min_num*aa", "min_num*aa", "a", "t=min_num*tt", "min_num*tt", "t", "t,a=1,1", "1", "t", "aa=map(int,input().split())", "map(int,input().split())", "aa", "tt,aa=map(int,input().split())", "map(int,input().split())", "tt", "a=1,1", "1", "a", "n=int(input())", "int(input())", "n", "min_num=max(-(-t//tt),-(-a//aa))", "max(-(-t//tt),-(-a//aa))", "min_num" ]
# C - AtCoDeerใใ‚“ใจ้ธๆŒ™้€Ÿๅ ฑ from math import ceil n=int(input()) t,a=1,1 for i in range(n): tt,aa=map(int,input().split()) min_num=max(-(-t//tt),-(-a//aa)) # min_num=max(ceil(t/tt),ceil(a/aa)) t=min_num*tt a=min_num*aa print(t+a)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 40, 13, 13, 40, 13, 13, 0, 13, 17, 14, 2, 2, 13, 13, 40, 13, 13, 0, 13, 2, 2, 2, 13, 17, 13, 17, 14, 2, 40, 13, 13, 2, 13, 13, 0, 13, 2, 2, 2, 13, 17, 13, 17, 0, 13, 2, 4, 13, 2, 2, 13, 17, 13, 2, 2, 13, 17, 13, 17, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 121, 2 ], [ 139, 8 ], [ 139, 17 ], [ 20, 19 ], [ 122, 23 ], [ 127, 26 ], [ 127, 35 ], [ 128, 39 ], [ 140, 40 ], [ 134, 40 ], [ 125, 42 ], [ 113, 43 ], [ 137, 43 ], [ 130, 45 ], [ 128, 50 ], [ 140, 51 ], [ 134, 51 ], [ 125, 53 ], [ 113, 54 ], [ 137, 54 ], [ 118, 56 ], [ 140, 60 ], [ 134, 60 ], [ 128, 62 ], [ 128, 67 ], [ 140, 68 ], [ 134, 68 ], [ 125, 70 ], [ 113, 71 ], [ 137, 71 ], [ 142, 73 ], [ 113, 77 ], [ 137, 77 ], [ 125, 79 ], [ 115, 82 ], [ 140, 88 ], [ 134, 88 ], [ 128, 90 ], [ 113, 93 ], [ 137, 93 ], [ 125, 95 ], [ 133, 98 ], [ 128, 100 ], [ 116, 101 ], [ 143, 101 ], [ 119, 101 ], [ 131, 101 ], [ 136, 102 ], [ 125, 104 ], [ 116, 105 ], [ 143, 105 ], [ 119, 105 ], [ 131, 105 ], [ 134, 109 ], [ 140, 109 ], [ 137, 110 ], [ 113, 110 ], [ 139, 113 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ], [ 127, 125 ], [ 127, 128 ], [ 130, 131 ], [ 133, 134 ], [ 136, 137 ], [ 139, 140 ], [ 142, 143 ] ]
[ "n = int(input())\nt, a = map(int, input().split())\nfor i in range(n - 1):\n r1, r2 = map(int, input().split())\n if r1 >= t and r2 >= a:\n multiple = 1\n elif r1 < t and r2 >= a:\n multiple = (t-1) // r1 + 1\n elif r1 >= t and r2 < a:\n multiple = (a-1) // r2 + 1\n else:\n multiple = max((t-1) // r1, (a-1) // r2) + 1\n t, a = r1 * multiple, r2 * multiple\nprint(t+a)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "for i in range(n - 1):\n r1, r2 = map(int, input().split())\n if r1 >= t and r2 >= a:\n multiple = 1\n elif r1 < t and r2 >= a:\n multiple = (t-1) // r1 + 1\n elif r1 >= t and r2 < a:\n multiple = (a-1) // r2 + 1\n else:\n multiple = max((t-1) // r1, (a-1) // r2) + 1\n t, a = r1 * multiple, r2 * multiple", "i", "range(n - 1)", "range", "n - 1", "n", "1", "r1, r2 = map(int, input().split())", "r1", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "r2", "if r1 >= t and r2 >= a:\n multiple = 1\n elif r1 < t and r2 >= a:\n multiple = (t-1) // r1 + 1\n elif r1 >= t and r2 < a:\n multiple = (a-1) // r2 + 1\n else:\n multiple = max((t-1) // r1, (a-1) // r2) + 1\n ", "r1 >= t and r2 >= a", "r1 >= t", "r1", "t", "r2 >= a", "r2", "a", "multiple = 1", "multiple", "1", "elif r1 < t and r2 >= a:\n multiple = (t-1) // r1 + 1\n ", "r1 < t and r2 >= a", "r1 < t", "r1", "t", "r2 >= a", "r2", "a", "multiple = (t-1) // r1 + 1", "multiple", "(t-1) // r1 + 1", "(t-1) // r1", "t-1", "t", "1", "r1", "1", "elif r1 >= t and r2 < a:\n multiple = (a-1) // r2 + 1\n ", "r1 >= t and r2 < a", "r1 >= t", "r1", "t", "r2 < a", "r2", "a", "multiple = (a-1) // r2 + 1", "multiple", "(a-1) // r2 + 1", "(a-1) // r2", "a-1", "a", "1", "r2", "1", "multiple = max((t-1) // r1, (a-1) // r2) + 1", "multiple", "max((t-1) // r1, (a-1) // r2) + 1", "max((t-1) // r1, (a-1) // r2)", "max", "(t-1) // r1", "t-1", "t", "1", "r1", "(a-1) // r2", "a-1", "a", "1", "r2", "1", "t, a = r1 * multiple, r2 * multiple", "t", "r1 * multiple", "r1", "multiple", "a", "r2 * multiple", "r2", "multiple", "print(t+a)", "print", "t+a", "t", "a", "a = map(int, input().split())", "map(int, input().split())", "a", "multiple = max((t-1) // r1, (a-1) // r2) + 1", "max((t-1) // r1, (a-1) // r2) + 1", "multiple", "multiple = (t-1) // r1 + 1", "(t-1) // r1 + 1", "multiple", "n = int(input())", "int(input())", "n", "r2 = map(int, input().split())", "map(int, input().split())", "r2", "r1, r2 = map(int, input().split())", "map(int, input().split())", "r1", "multiple = 1", "1", "multiple", "t, a = r1 * multiple, r2 * multiple", "r1 * multiple", "t", "a = r1 * multiple, r2 * multiple", "r2 * multiple", "a", "t, a = map(int, input().split())", "map(int, input().split())", "t", "multiple = (a-1) // r2 + 1", "(a-1) // r2 + 1", "multiple" ]
n = int(input()) t, a = map(int, input().split()) for i in range(n - 1): r1, r2 = map(int, input().split()) if r1 >= t and r2 >= a: multiple = 1 elif r1 < t and r2 >= a: multiple = (t-1) // r1 + 1 elif r1 >= t and r2 < a: multiple = (a-1) // r2 + 1 else: multiple = max((t-1) // r1, (a-1) // r2) + 1 t, a = r1 * multiple, r2 * multiple print(t+a)
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 18, 13, 17, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 40, 2, 2, 18, 13, 17, 17, 18, 18, 13, 13, 17, 40, 2, 2, 18, 13, 17, 17, 18, 18, 13, 13, 17, 0, 18, 13, 17, 2, 18, 18, 13, 13, 17, 13, 0, 18, 13, 17, 2, 18, 18, 13, 13, 17, 13, 4, 13, 4, 13, 13, 10, 13, 13, 10, 18, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 103, 2 ], [ 10, 9 ], [ 104, 12 ], [ 94, 25 ], [ 97, 28 ], [ 95, 30 ], [ 34, 33 ], [ 104, 37 ], [ 100, 39 ], [ 98, 46 ], [ 95, 51 ], [ 33, 52 ], [ 98, 58 ], [ 95, 63 ], [ 33, 64 ], [ 70, 67 ], [ 98, 68 ], [ 95, 73 ], [ 33, 74 ], [ 101, 76 ], [ 81, 78 ], [ 98, 79 ], [ 95, 84 ], [ 33, 85 ], [ 101, 87 ], [ 98, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 103, 104 ] ]
[ "n = int(input())\nvotelist = [list(map(int, input().split())) for _ in range(n)]\n\nchlist = votelist[0]\nfor i in range(1, n):\n x = max(-(chlist[0]*-1 // votelist[i][0]), -(chlist[1]*-1 // votelist[i][1]))\n chlist[0] = votelist[i][0] * x\n chlist[1] = votelist[i][1] * x\n \nprint(sum(chlist))", "n = int(input())", "n", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "votelist = [list(map(int, input().split())) for _ in range(n)]", "votelist", "[list(map(int, input().split())) for _ in range(n)]", "chlist = votelist[0]", "chlist", "votelist[0]", "votelist", "0", "for i in range(1, n):\n x = max(-(chlist[0]*-1 // votelist[i][0]), -(chlist[1]*-1 // votelist[i][1]))\n chlist[0] = votelist[i][0] * x\n chlist[1] = votelist[i][1] * x\n ", "i", "range(1, n)", "range", "1", "n", "x = max(-(chlist[0]*-1 // votelist[i][0]), -(chlist[1]*-1 // votelist[i][1]))", "x", "max(-(chlist[0]*-1 // votelist[i][0]), -(chlist[1]*-1 // votelist[i][1]))", "max", "-(chlist[0]*-1 // votelist[i][0])", "chlist[0]*-1 // votelist[i][0]", "chlist[0]*-1", "chlist[0]", "chlist", "0", "-1", "votelist[i][0]", "[i]", "votelist", "i", "0", "-(chlist[1]*-1 // votelist[i][1])", "chlist[1]*-1 // votelist[i][1]", "chlist[1]*-1", "chlist[1]", "chlist", "1", "-1", "votelist[i][1]", "[i]", "votelist", "i", "1", "chlist[0] = votelist[i][0] * x", "chlist[0]", "chlist", "0", "votelist[i][0] * x", "votelist[i][0]", "[i]", "votelist", "i", "0", "x", "chlist[1] = votelist[i][1] * x", "chlist[1]", "chlist", "1", "votelist[i][1] * x", "votelist[i][1]", "[i]", "votelist", "i", "1", "x", "print(sum(chlist))", "print", "sum(chlist)", "sum", "chlist", "votelist = [list(map(int, input().split())) for _ in range(n)]", "[list(map(int, input().split())) for _ in range(n)]", "votelist", "chlist = votelist[0]", "votelist[0]", "chlist", "x = max(-(chlist[0]*-1 // votelist[i][0]), -(chlist[1]*-1 // votelist[i][1]))", "max(-(chlist[0]*-1 // votelist[i][0]), -(chlist[1]*-1 // votelist[i][1]))", "x", "n = int(input())", "int(input())", "n" ]
n = int(input()) votelist = [list(map(int, input().split())) for _ in range(n)] chlist = votelist[0] for i in range(1, n): x = max(-(chlist[0]*-1 // votelist[i][0]), -(chlist[1]*-1 // votelist[i][1])) chlist[0] = votelist[i][0] * x chlist[1] = votelist[i][1] * x print(sum(chlist))
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 39, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 2, 2, 18, 13, 17, 13, 17, 13, 0, 13, 2, 2, 2, 18, 13, 17, 13, 17, 13, 0, 18, 13, 17, 2, 4, 13, 13, 13, 13, 0, 18, 13, 17, 2, 4, 13, 13, 13, 13, 4, 13, 2, 18, 13, 17, 18, 13, 17, 10, 4, 13, 10, 39, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 95, 2 ], [ 83, 8 ], [ 14, 13 ], [ 96, 16 ], [ 92, 18 ], [ 92, 27 ], [ 86, 29 ], [ 84, 34 ], [ 81, 36 ], [ 81, 38 ], [ 89, 40 ], [ 84, 45 ], [ 93, 47 ], [ 93, 49 ], [ 54, 51 ], [ 84, 52 ], [ 87, 57 ], [ 90, 58 ], [ 81, 59 ], [ 64, 61 ], [ 84, 62 ], [ 87, 67 ], [ 90, 68 ], [ 93, 69 ], [ 84, 74 ], [ 84, 77 ], [ 92, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ] ]
[ "n=int(input())\nA=[1,1]\nfor i in range(n):\n t,a=map(int,input().split())\n tt=(A[0]+t-1)//t\n aa=(A[1]+a-1)//a\n A[0]=max(tt,aa)*t\n A[1]=max(tt,aa)*a\nprint(A[0]+A[1])", "n=int(input())", "n", "int(input())", "int", "input()", "input", "A=[1,1]", "A", "[1,1]", "1", "1", "for i in range(n):\n t,a=map(int,input().split())\n tt=(A[0]+t-1)//t\n aa=(A[1]+a-1)//a\n A[0]=max(tt,aa)*t\n A[1]=max(tt,aa)*a", "i", "range(n)", "range", "n", "t,a=map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "tt=(A[0]+t-1)//t", "tt", "(A[0]+t-1)//t", "A[0]+t-1", "A[0]+t", "A[0]", "A", "0", "t", "1", "t", "aa=(A[1]+a-1)//a", "aa", "(A[1]+a-1)//a", "A[1]+a-1", "A[1]+a", "A[1]", "A", "1", "a", "1", "a", "A[0]=max(tt,aa)*t", "A[0]", "A", "0", "max(tt,aa)*t", "max(tt,aa)", "max", "tt", "aa", "t", "A[1]=max(tt,aa)*a", "A[1]", "A", "1", "max(tt,aa)*a", "max(tt,aa)", "max", "tt", "aa", "a", "print(A[0]+A[1])", "print", "A[0]+A[1]", "A[0]", "A", "0", "A[1]", "A", "1", "t,a=map(int,input().split())", "map(int,input().split())", "t", "A=[1,1]", "[1,1]", "A", "tt=(A[0]+t-1)//t", "(A[0]+t-1)//t", "tt", "aa=(A[1]+a-1)//a", "(A[1]+a-1)//a", "aa", "a=map(int,input().split())", "map(int,input().split())", "a", "n=int(input())", "int(input())", "n" ]
n=int(input()) A=[1,1] for i in range(n): t,a=map(int,input().split()) tt=(A[0]+t-1)//t aa=(A[1]+a-1)//a A[0]=max(tt,aa)*t A[1]=max(tt,aa)*a print(A[0]+A[1])
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 18, 18, 13, 17, 17, 0, 13, 18, 18, 13, 17, 17, 0, 13, 2, 13, 13, 28, 13, 13, 18, 13, 39, 17, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 4, 13, 2, 13, 13, 10, 18, 13, 10, 2, 13, 10, 2, 13, 10, 18, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 112, 4 ], [ 12, 11 ], [ 113, 14 ], [ 118, 27 ], [ 97, 30 ], [ 119, 33 ], [ 106, 37 ], [ 119, 40 ], [ 100, 44 ], [ 98, 46 ], [ 107, 47 ], [ 119, 52 ], [ 115, 56 ], [ 98, 60 ], [ 110, 60 ], [ 103, 65 ], [ 107, 69 ], [ 125, 69 ], [ 121, 74 ], [ 116, 77 ], [ 104, 78 ], [ 124, 80 ], [ 122, 82 ], [ 109, 85 ], [ 122, 87 ], [ 125, 94 ], [ 107, 94 ], [ 110, 95 ], [ 98, 95 ], [ 97, 98 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ], [ 109, 110 ], [ 112, 113 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ] ]
[ "import math\nN = int(input())\nta = [tuple(map(int,input().split())) for _ in range(N)]\nleft = ta[0][0]\nright = ta[0][1]\nres = left+right\nfor t,a in ta[1:]:\n tmp1 = (left+t-1)//t\n tmp2 = (right+a-1)//a\n buff = max(tmp1,tmp2)\n right = buff*a\n left = buff*t\nprint(int(right+left))\n\n", "import math", "math", "N = int(input())", "N", "int(input())", "int", "input()", "input", "tuple(map(int,input().split())) for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "tuple(map(int,input().split()))", "tuple", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ta = [tuple(map(int,input().split())) for _ in range(N)]", "ta", "[tuple(map(int,input().split())) for _ in range(N)]", "left = ta[0][0]", "left", "ta[0][0]", "[0]", "ta", "0", "0", "right = ta[0][1]", "right", "ta[0][1]", "[0]", "ta", "0", "1", "res = left+right", "res", "left+right", "left", "right", "for t,a in ta[1:]:\n tmp1 = (left+t-1)//t\n tmp2 = (right+a-1)//a\n buff = max(tmp1,tmp2)\n right = buff*a\n left = buff*t", "t", "a", "ta[1:]", "ta", "1:", "1", "tmp1 = (left+t-1)//t", "tmp1", "(left+t-1)//t", "left+t-1", "left+t", "left", "t", "1", "t", "tmp2 = (right+a-1)//a", "tmp2", "(right+a-1)//a", "right+a-1", "right+a", "right", "a", "1", "a", "buff = max(tmp1,tmp2)", "buff", "max(tmp1,tmp2)", "max", "tmp1", "tmp2", "right = buff*a", "right", "buff*a", "buff", "a", "left = buff*t", "left", "buff*t", "buff", "t", "print(int(right+left))", "print", "int(right+left)", "int", "right+left", "right", "left", "left = ta[0][0]", "ta[0][0]", "left", "res = left+right", "left+right", "res", "tmp2 = (right+a-1)//a", "(right+a-1)//a", "tmp2", "right = ta[0][1]", "ta[0][1]", "right", "left = buff*t", "buff*t", "left", "N = int(input())", "int(input())", "N", "tmp1 = (left+t-1)//t", "(left+t-1)//t", "tmp1", "ta = [tuple(map(int,input().split())) for _ in range(N)]", "[tuple(map(int,input().split())) for _ in range(N)]", "ta", "buff = max(tmp1,tmp2)", "max(tmp1,tmp2)", "buff", "right = buff*a", "buff*a", "right" ]
import math N = int(input()) ta = [tuple(map(int,input().split())) for _ in range(N)] left = ta[0][0] right = ta[0][1] res = left+right for t,a in ta[1:]: tmp1 = (left+t-1)//t tmp2 = (right+a-1)//a buff = max(tmp1,tmp2) right = buff*a left = buff*t print(int(right+left))
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 18, 13, 13, 13, 14, 2, 40, 13, 13, 40, 13, 13, 0, 13, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 14, 40, 2, 13, 13, 17, 14, 40, 2, 13, 13, 17, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 13, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 18, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 13, 13, 10, 2, 13, 10, 18, 13, 10, 4, 13, 10, 13, 13 ]
[ [ 133, 2 ], [ 10, 9 ], [ 134, 12 ], [ 124, 25 ], [ 121, 28 ], [ 106, 31 ], [ 35, 34 ], [ 134, 37 ], [ 130, 39 ], [ 125, 41 ], [ 34, 42 ], [ 130, 43 ], [ 131, 47 ], [ 122, 48 ], [ 116, 48 ], [ 101, 48 ], [ 113, 50 ], [ 107, 51 ], [ 104, 51 ], [ 137, 51 ], [ 100, 53 ], [ 131, 54 ], [ 136, 55 ], [ 113, 56 ], [ 118, 58 ], [ 122, 60 ], [ 116, 60 ], [ 101, 60 ], [ 131, 61 ], [ 127, 63 ], [ 107, 65 ], [ 104, 65 ], [ 137, 65 ], [ 113, 66 ], [ 122, 70 ], [ 116, 70 ], [ 101, 70 ], [ 131, 71 ], [ 137, 76 ], [ 107, 76 ], [ 104, 76 ], [ 113, 77 ], [ 109, 80 ], [ 119, 83 ], [ 128, 84 ], [ 115, 86 ], [ 110, 88 ], [ 131, 89 ], [ 103, 90 ], [ 110, 92 ], [ 113, 93 ], [ 116, 97 ], [ 101, 97 ], [ 122, 97 ], [ 104, 98 ], [ 137, 98 ], [ 107, 98 ], [ 131, 100 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ], [ 109, 110 ], [ 130, 113 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ], [ 127, 128 ], [ 130, 131 ], [ 133, 134 ], [ 113, 136 ], [ 136, 137 ] ]
[ "n = int(input())\np = [list(map(int, input().split())) for _ in range(n)]\n\n#print()\nT = 0\nA = 0\nfor i in range(n):\n t, a = p[i]\n if t >= T and a >= A:\n T, A = t, a\n else:\n d1 = T // t\n d2 = A // a\n if T % t != 0: d1 += 1\n if A % a != 0: d2 += 1\n d = max(d1, d2)\n T, A = d * t, d * a\n #print(T, A)\n\nprint(T+A) ", "n = int(input())", "n", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "p = [list(map(int, input().split())) for _ in range(n)]", "p", "[list(map(int, input().split())) for _ in range(n)]", "T = 0", "T", "0", "A = 0", "A", "0", "for i in range(n):\n t, a = p[i]\n if t >= T and a >= A:\n T, A = t, a\n else:\n d1 = T // t\n d2 = A // a\n if T % t != 0: d1 += 1\n if A % a != 0: d2 += 1\n d = max(d1, d2)\n T, A = d * t, d * a\n #print(T, A)", "i", "range(n)", "range", "n", "t, a = p[i]", "t", "p[i]", "p", "i", "a", "if t >= T and a >= A:\n T, A = t, a\n else:\n d1 = T // t\n d2 = A // a\n if T % t != 0: d1 += 1\n if A % a != 0: d2 += 1\n d = max(d1, d2)\n T, A = d * t, d * a\n #print(T, A)", "t >= T and a >= A", "t >= T", "t", "T", "a >= A", "a", "A", "T, A = t, a", "T", "t", "A", "a", "d1 = T // t", "d1", "T // t", "T", "t", "d2 = A // a", "d2", "A // a", "A", "a", "if T % t != 0: d1 += 1\n ", "T % t != 0", "T % t", "T", "t", "0", "if A % a != 0: d2 += 1\n ", "A % a != 0", "A % a", "A", "a", "0", "d = max(d1, d2)", "d", "max(d1, d2)", "max", "d1", "d2", "T, A = d * t, d * a", "T", "d * t", "d", "t", "A", "d * a", "d", "a", "print(T+A)", "print", "T+A", "T", "A", "T, A = t, a", "t", "T", "A = d * t, d * a", "d * a", "A", "A = 0", "0", "A", "d = max(d1, d2)", "max(d1, d2)", "d", "a = p[i]", "p[i]", "a", "T, A = d * t, d * a", "d * t", "T", "d1 = T // t", "T // t", "d1", "T = 0", "0", "T", "p = [list(map(int, input().split())) for _ in range(n)]", "[list(map(int, input().split())) for _ in range(n)]", "p", "d2 = A // a", "A // a", "d2", "t, a = p[i]", "p[i]", "t", "n = int(input())", "int(input())", "n", "A = t, a", "a", "A" ]
n = int(input()) p = [list(map(int, input().split())) for _ in range(n)] #print() T = 0 A = 0 for i in range(n): t, a = p[i] if t >= T and a >= A: T, A = t, a else: d1 = T // t d2 = A // a if T % t != 0: d1 += 1 if A % a != 0: d2 += 1 d = max(d1, d2) T, A = d * t, d * a #print(T, A) print(T+A)
[ 7, 15, 15, 13, 0, 13, 4, 13, 4, 18, 4, 18, 13, 13, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 41, 28, 13, 4, 18, 4, 18, 4, 18, 13, 13, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 101, 5 ], [ 83, 16 ], [ 89, 18 ], [ 22, 21 ], [ 102, 24 ], [ 28, 27 ], [ 27, 41 ], [ 92, 43 ], [ 92, 45 ], [ 86, 47 ], [ 84, 53 ], [ 99, 53 ], [ 93, 54 ], [ 93, 56 ], [ 90, 60 ], [ 96, 60 ], [ 81, 61 ], [ 81, 63 ], [ 98, 65 ], [ 87, 67 ], [ 93, 68 ], [ 95, 70 ], [ 87, 72 ], [ 81, 73 ], [ 99, 77 ], [ 84, 77 ], [ 96, 78 ], [ 90, 78 ], [ 92, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ], [ 101, 102 ] ]
[ "from sys import stdin\nimport math\nN = int(stdin.readline().rstrip())\nt,a = 1,1\n \nfor _ in range(N):\n T,A = [int(x) for x in stdin.readline().rstrip().split()]\n n = max((t + T - 1) // T,(a + A - 1) // A)\n t = n*T\n a = n*A\n \nprint(t+a)", "from sys import stdin", "import math", "math", "N = int(stdin.readline().rstrip())", "N", "int(stdin.readline().rstrip())", "int", "stdin.readline().rstrip()", "stdin.readline().rstrip", "stdin.readline()", "stdin.readline", "stdin", "readline", "rstrip", "t,a = 1,1", "t", "1", "a", "1", "for _ in range(N):\n T,A = [int(x) for x in stdin.readline().rstrip().split()]\n n = max((t + T - 1) // T,(a + A - 1) // A)\n t = n*T\n a = n*A\n ", "_", "range(N)", "range", "N", "int(x) for x in stdin.readline().rstrip().split()", "for x in stdin.readline().rstrip().split()", "x", "stdin.readline().rstrip().split()", "stdin.readline().rstrip().split", "stdin.readline().rstrip()", "stdin.readline().rstrip", "stdin.readline()", "stdin.readline", "stdin", "readline", "rstrip", "split", "for x in stdin.readline().rstrip().split()", "int(x)", "int", "x", "T,A = [int(x) for x in stdin.readline().rstrip().split()]", "T", "[int(x) for x in stdin.readline().rstrip().split()]", "A", "n = max((t + T - 1) // T,(a + A - 1) // A)", "n", "max((t + T - 1) // T,(a + A - 1) // A)", "max", "(t + T - 1) // T", "t + T - 1", "t + T", "t", "T", "1", "T", "(a + A - 1) // A", "a + A - 1", "a + A", "a", "A", "1", "A", "t = n*T", "t", "n*T", "n", "T", "a = n*A", "a", "n*A", "n", "A", "print(t+a)", "print", "t+a", "t", "a", "A = [int(x) for x in stdin.readline().rstrip().split()]", "[int(x) for x in stdin.readline().rstrip().split()]", "A", "t,a = 1,1", "1", "t", "n = max((t + T - 1) // T,(a + A - 1) // A)", "max((t + T - 1) // T,(a + A - 1) // A)", "n", "a = 1,1", "1", "a", "T,A = [int(x) for x in stdin.readline().rstrip().split()]", "[int(x) for x in stdin.readline().rstrip().split()]", "T", "a = n*A", "n*A", "a", "t = n*T", "n*T", "t", "N = int(stdin.readline().rstrip())", "int(stdin.readline().rstrip())", "N" ]
from sys import stdin import math N = int(stdin.readline().rstrip()) t,a = 1,1 for _ in range(N): T,A = [int(x) for x in stdin.readline().rstrip().split()] n = max((t + T - 1) // T,(a + A - 1) // A) t = n*T a = n*A print(t+a)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 40, 13, 13, 40, 13, 13, 0, 13, 13, 0, 13, 13, 14, 2, 40, 13, 13, 2, 13, 13, 14, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 14, 2, 2, 13, 13, 40, 13, 13, 14, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 14, 2, 2, 13, 13, 2, 13, 13, 14, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 17, 14, 2, 2, 13, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 17, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13 ]
[ [ 225, 2 ], [ 234, 8 ], [ 243, 10 ], [ 14, 13 ], [ 226, 16 ], [ 189, 18 ], [ 189, 27 ], [ 235, 31 ], [ 223, 31 ], [ 232, 31 ], [ 220, 31 ], [ 196, 31 ], [ 187, 32 ], [ 244, 34 ], [ 241, 34 ], [ 229, 34 ], [ 193, 34 ], [ 202, 34 ], [ 190, 35 ], [ 195, 37 ], [ 187, 38 ], [ 201, 40 ], [ 190, 41 ], [ 235, 45 ], [ 223, 45 ], [ 232, 45 ], [ 220, 45 ], [ 196, 45 ], [ 187, 46 ], [ 244, 48 ], [ 241, 48 ], [ 229, 48 ], [ 193, 48 ], [ 202, 48 ], [ 190, 49 ], [ 244, 53 ], [ 241, 53 ], [ 229, 53 ], [ 193, 53 ], [ 202, 53 ], [ 190, 54 ], [ 216, 57 ], [ 244, 59 ], [ 241, 59 ], [ 229, 59 ], [ 193, 59 ], [ 202, 59 ], [ 190, 60 ], [ 183, 62 ], [ 244, 65 ], [ 241, 65 ], [ 229, 65 ], [ 193, 65 ], [ 202, 65 ], [ 190, 66 ], [ 192, 69 ], [ 184, 71 ], [ 217, 71 ], [ 211, 71 ], [ 181, 71 ], [ 190, 72 ], [ 219, 74 ], [ 184, 76 ], [ 217, 76 ], [ 211, 76 ], [ 181, 76 ], [ 187, 77 ], [ 235, 81 ], [ 223, 81 ], [ 232, 81 ], [ 220, 81 ], [ 196, 81 ], [ 187, 82 ], [ 244, 84 ], [ 241, 84 ], [ 229, 84 ], [ 193, 84 ], [ 202, 84 ], [ 190, 85 ], [ 235, 89 ], [ 223, 89 ], [ 232, 89 ], [ 220, 89 ], [ 196, 89 ], [ 187, 90 ], [ 180, 93 ], [ 235, 95 ], [ 223, 95 ], [ 232, 95 ], [ 220, 95 ], [ 196, 95 ], [ 187, 96 ], [ 210, 98 ], [ 235, 101 ], [ 223, 101 ], [ 232, 101 ], [ 220, 101 ], [ 196, 101 ], [ 187, 102 ], [ 231, 105 ], [ 211, 107 ], [ 181, 107 ], [ 184, 107 ], [ 217, 107 ], [ 187, 108 ], [ 228, 110 ], [ 211, 112 ], [ 181, 112 ], [ 184, 112 ], [ 217, 112 ], [ 190, 113 ], [ 235, 117 ], [ 223, 117 ], [ 232, 117 ], [ 220, 117 ], [ 196, 117 ], [ 187, 118 ], [ 244, 120 ], [ 241, 120 ], [ 229, 120 ], [ 193, 120 ], [ 202, 120 ], [ 190, 121 ], [ 235, 125 ], [ 223, 125 ], [ 232, 125 ], [ 220, 125 ], [ 196, 125 ], [ 187, 126 ], [ 237, 129 ], [ 235, 131 ], [ 223, 131 ], [ 232, 131 ], [ 220, 131 ], [ 196, 131 ], [ 187, 132 ], [ 207, 134 ], [ 235, 137 ], [ 223, 137 ], [ 232, 137 ], [ 220, 137 ], [ 196, 137 ], [ 187, 138 ], [ 229, 143 ], [ 193, 143 ], [ 202, 143 ], [ 244, 143 ], [ 241, 143 ], [ 190, 144 ], [ 213, 147 ], [ 229, 149 ], [ 193, 149 ], [ 202, 149 ], [ 244, 149 ], [ 241, 149 ], [ 190, 150 ], [ 204, 152 ], [ 229, 155 ], [ 193, 155 ], [ 202, 155 ], [ 244, 155 ], [ 241, 155 ], [ 190, 156 ], [ 198, 159 ], [ 208, 162 ], [ 238, 162 ], [ 205, 163 ], [ 214, 163 ], [ 222, 165 ], [ 199, 167 ], [ 187, 168 ], [ 240, 170 ], [ 199, 172 ], [ 190, 173 ], [ 223, 177 ], [ 232, 177 ], [ 220, 177 ], [ 196, 177 ], [ 235, 177 ], [ 241, 178 ], [ 229, 178 ], [ 193, 178 ], [ 202, 178 ], [ 244, 178 ], [ 180, 181 ], [ 183, 184 ], [ 189, 187 ], [ 189, 190 ], [ 192, 193 ], [ 187, 195 ], [ 195, 196 ], [ 198, 199 ], [ 190, 201 ], [ 201, 202 ], [ 204, 205 ], [ 207, 208 ], [ 210, 211 ], [ 213, 214 ], [ 216, 217 ], [ 219, 220 ], [ 222, 223 ], [ 225, 226 ], [ 228, 229 ], [ 231, 232 ], [ 234, 235 ], [ 237, 238 ], [ 240, 241 ], [ 243, 244 ] ]
[ "n = int(input())\nx, y = 1, 1\nfor _ in range(n):\n t, a = map(int, input().split())\n if x <= t and y <= a:\n x = t\n y = a\n elif x <= t and y > a:\n if y % a == 0:\n i = y // a\n else:\n i = y // a + 1\n y = i*a\n x = i*t\n elif x > t and y <= a:\n if x % t == 0:\n i = x // t\n else:\n i = x // t + 1\n x = i*t\n y = i*a\n elif x > t and y > a:\n if x % t == 0:\n i_x = x // t\n else:\n i_x = x // t + 1\n\n if y % a == 0:\n i_y = y // a\n else:\n i_y = y // a + 1\n bigger = max(i_x, i_y)\n x = bigger*t\n y = bigger*a\nprint(x+y)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "x, y = 1, 1", "x", "1", "y", "1", "for _ in range(n):\n t, a = map(int, input().split())\n if x <= t and y <= a:\n x = t\n y = a\n elif x <= t and y > a:\n if y % a == 0:\n i = y // a\n else:\n i = y // a + 1\n y = i*a\n x = i*t\n elif x > t and y <= a:\n if x % t == 0:\n i = x // t\n else:\n i = x // t + 1\n x = i*t\n y = i*a\n elif x > t and y > a:\n if x % t == 0:\n i_x = x // t\n else:\n i_x = x // t + 1\n\n if y % a == 0:\n i_y = y // a\n else:\n i_y = y // a + 1\n bigger = max(i_x, i_y)\n x = bigger*t\n y = bigger*a", "_", "range(n)", "range", "n", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "if x <= t and y <= a:\n x = t\n y = a\n elif x <= t and y > a:\n if y % a == 0:\n i = y // a\n else:\n i = y // a + 1\n y = i*a\n x = i*t\n elif x > t and y <= a:\n if x % t == 0:\n i = x // t\n else:\n i = x // t + 1\n x = i*t\n y = i*a\n elif x > t and y > a:\n if x % t == 0:\n i_x = x // t\n else:\n i_x = x // t + 1\n\n if y % a == 0:\n i_y = y // a\n else:\n i_y = y // a + 1\n bigger = max(i_x, i_y)\n x = bigger*t\n y = bigger*a", "x <= t and y <= a", "x <= t", "x", "t", "y <= a", "y", "a", "x = t", "x", "t", "y = a", "y", "a", "elif x <= t and y > a:\n if y % a == 0:\n i = y // a\n else:\n i = y // a + 1\n y = i*a\n x = i*t\n ", "x <= t and y > a", "x <= t", "x", "t", "y > a", "y", "a", "if y % a == 0:\n i = y // a\n else:\n i = y // a + 1\n ", "y % a == 0", "y % a", "y", "a", "0", "i = y // a", "i", "y // a", "y", "a", "i = y // a + 1", "i", "y // a + 1", "y // a", "y", "a", "1", "y = i*a", "y", "i*a", "i", "a", "x = i*t", "x", "i*t", "i", "t", "elif x > t and y <= a:\n if x % t == 0:\n i = x // t\n else:\n i = x // t + 1\n x = i*t\n y = i*a\n ", "x > t and y <= a", "x > t", "x", "t", "y <= a", "y", "a", "if x % t == 0:\n i = x // t\n else:\n i = x // t + 1\n ", "x % t == 0", "x % t", "x", "t", "0", "i = x // t", "i", "x // t", "x", "t", "i = x // t + 1", "i", "x // t + 1", "x // t", "x", "t", "1", "x = i*t", "x", "i*t", "i", "t", "y = i*a", "y", "i*a", "i", "a", "elif x > t and y > a:\n if x % t == 0:\n i_x = x // t\n else:\n i_x = x // t + 1\n\n if y % a == 0:\n i_y = y // a\n else:\n i_y = y // a + 1\n bigger = max(i_x, i_y)\n x = bigger*t\n y = bigger*a", "x > t and y > a", "x > t", "x", "t", "y > a", "y", "a", "if x % t == 0:\n i_x = x // t\n else:\n i_x = x // t + 1\n\n ", "x % t == 0", "x % t", "x", "t", "0", "i_x = x // t", "i_x", "x // t", "x", "t", "i_x = x // t + 1", "i_x", "x // t + 1", "x // t", "x", "t", "1", "if y % a == 0:\n i_y = y // a\n else:\n i_y = y // a + 1\n ", "y % a == 0", "y % a", "y", "a", "0", "i_y = y // a", "i_y", "y // a", "y", "a", "i_y = y // a + 1", "i_y", "y // a + 1", "y // a", "y", "a", "1", "bigger = max(i_x, i_y)", "bigger", "max(i_x, i_y)", "max", "i_x", "i_y", "x = bigger*t", "x", "bigger*t", "bigger", "t", "y = bigger*a", "y", "bigger*a", "bigger", "a", "print(x+y)", "print", "x+y", "x", "y", "i = x // t", "x // t", "i", "i = y // a + 1", "y // a + 1", "i", "t, a = map(int, input().split())", "map(int, input().split())", "t", "a = map(int, input().split())", "map(int, input().split())", "a", "y = i*a", "i*a", "y", "x = t", "t", "x", "bigger = max(i_x, i_y)", "max(i_x, i_y)", "bigger", "y = a", "a", "y", "i_y = y // a + 1", "y // a + 1", "i_y", "i_x = x // t + 1", "x // t + 1", "i_x", "i = x // t + 1", "x // t + 1", "i", "i_y = y // a", "y // a", "i_y", "i = y // a", "y // a", "i", "x = i*t", "i*t", "x", "x = bigger*t", "bigger*t", "x", "n = int(input())", "int(input())", "n", "y = i*a", "i*a", "y", "x = i*t", "i*t", "x", "x, y = 1, 1", "1", "x", "i_x = x // t", "x // t", "i_x", "y = bigger*a", "bigger*a", "y", "y = 1, 1", "1", "y" ]
n = int(input()) x, y = 1, 1 for _ in range(n): t, a = map(int, input().split()) if x <= t and y <= a: x = t y = a elif x <= t and y > a: if y % a == 0: i = y // a else: i = y // a + 1 y = i*a x = i*t elif x > t and y <= a: if x % t == 0: i = x // t else: i = x // t + 1 x = i*t y = i*a elif x > t and y > a: if x % t == 0: i_x = x // t else: i_x = x // t + 1 if y % a == 0: i_y = y // a else: i_y = y // a + 1 bigger = max(i_x, i_y) x = bigger*t y = bigger*a print(x+y)
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 13, 0, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 40, 4, 13, 2, 40, 13, 13, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 13, 13, 10, 4, 13, 10, 40, 13, 10, 13, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 91, 4 ], [ 88, 10 ], [ 103, 13 ], [ 103, 22 ], [ 76, 24 ], [ 98, 25 ], [ 85, 27 ], [ 104, 28 ], [ 31, 30 ], [ 92, 34 ], [ 106, 37 ], [ 106, 46 ], [ 82, 48 ], [ 77, 54 ], [ 101, 54 ], [ 107, 55 ], [ 86, 58 ], [ 95, 58 ], [ 80, 59 ], [ 100, 61 ], [ 83, 63 ], [ 107, 64 ], [ 94, 66 ], [ 83, 68 ], [ 80, 69 ], [ 101, 73 ], [ 77, 73 ], [ 95, 74 ], [ 86, 74 ], [ 98, 76 ], [ 76, 77 ], [ 106, 80 ], [ 82, 83 ], [ 104, 85 ], [ 85, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ], [ 103, 98 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ] ]
[ "import math\nn = int(input())\nans = 0\nt_1, a_1 = map(int, input().split())\npret = t_1\nprea = a_1\nfor x in range(n - 1):\n t, a = map(int, input().split())\n m = -min(-pret//t,-prea//a)\n pret = m * t\n prea = m * a\nprint(pret + prea)", "import math", "math", "n = int(input())", "n", "int(input())", "int", "input()", "input", "ans = 0", "ans", "0", "t_1, a_1 = map(int, input().split())", "t_1", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a_1", "pret = t_1", "pret", "t_1", "prea = a_1", "prea", "a_1", "for x in range(n - 1):\n t, a = map(int, input().split())\n m = -min(-pret//t,-prea//a)\n pret = m * t\n prea = m * a", "x", "range(n - 1)", "range", "n - 1", "n", "1", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "m = -min(-pret//t,-prea//a)", "m", "-min(-pret//t,-prea//a)", "min(-pret//t,-prea//a)", "min", "-pret//t", "-pret", "pret", "t", "-prea//a", "-prea", "prea", "a", "pret = m * t", "pret", "m * t", "m", "t", "prea = m * a", "prea", "m * a", "m", "a", "print(pret + prea)", "print", "pret + prea", "pret", "prea", "pret = t_1", "t_1", "pret", "a = map(int, input().split())", "map(int, input().split())", "a", "m = -min(-pret//t,-prea//a)", "-min(-pret//t,-prea//a)", "m", "prea = a_1", "a_1", "prea", "ans = 0", "0", "ans", "n = int(input())", "int(input())", "n", "prea = m * a", "m * a", "prea", "t_1, a_1 = map(int, input().split())", "map(int, input().split())", "t_1", "pret = m * t", "m * t", "pret", "a_1 = map(int, input().split())", "map(int, input().split())", "a_1", "t, a = map(int, input().split())", "map(int, input().split())", "t" ]
import math n = int(input()) ans = 0 t_1, a_1 = map(int, input().split()) pret = t_1 prea = a_1 for x in range(n - 1): t, a = map(int, input().split()) m = -min(-pret//t,-prea//a) pret = m * t prea = m * a print(pret + prea)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 13, 17, 14, 2, 13, 13, 0, 13, 2, 13, 13, 14, 40, 2, 13, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 2, 13, 13, 14, 40, 2, 13, 13, 17, 0, 13, 17, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 100, 2 ], [ 115, 8 ], [ 121, 10 ], [ 14, 13 ], [ 101, 16 ], [ 109, 18 ], [ 109, 27 ], [ 112, 29 ], [ 124, 31 ], [ 116, 35 ], [ 95, 35 ], [ 104, 36 ], [ 97, 38 ], [ 116, 40 ], [ 95, 40 ], [ 104, 41 ], [ 116, 45 ], [ 95, 45 ], [ 104, 46 ], [ 127, 49 ], [ 122, 53 ], [ 107, 53 ], [ 110, 54 ], [ 118, 56 ], [ 122, 58 ], [ 107, 58 ], [ 110, 59 ], [ 122, 63 ], [ 107, 63 ], [ 110, 64 ], [ 130, 67 ], [ 91, 70 ], [ 128, 73 ], [ 98, 73 ], [ 113, 73 ], [ 131, 74 ], [ 119, 74 ], [ 125, 74 ], [ 94, 76 ], [ 104, 78 ], [ 92, 79 ], [ 106, 81 ], [ 110, 83 ], [ 92, 84 ], [ 95, 88 ], [ 116, 88 ], [ 107, 89 ], [ 122, 89 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 109, 104 ], [ 106, 107 ], [ 109, 110 ], [ 112, 113 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ], [ 127, 128 ], [ 130, 131 ] ]
[ "n = int(input())\nA,B = 0,0\nfor i in range(n):\n x,y = map(int,input().split())\n t,a = 1,1\n if A > x:\n t = A // x\n if A % x != 0:\n t += 1\n if B > y:\n a = B // y\n if B % y != 0:\n a += 1\n m = max(t,a)\n A = x*m\n B = y*m\nprint(A+B)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "A,B = 0,0", "A", "0", "B", "0", "for i in range(n):\n x,y = map(int,input().split())\n t,a = 1,1\n if A > x:\n t = A // x\n if A % x != 0:\n t += 1\n if B > y:\n a = B // y\n if B % y != 0:\n a += 1\n m = max(t,a)\n A = x*m\n B = y*m", "i", "range(n)", "range", "n", "x,y = map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "t,a = 1,1", "t", "1", "a", "1", "if A > x:\n t = A // x\n if A % x != 0:\n t += 1\n ", "A > x", "A", "x", "t = A // x", "t", "A // x", "A", "x", "if A % x != 0:\n t += 1\n ", "A % x != 0", "A % x", "A", "x", "0", "t += 1", "t", "1", "if B > y:\n a = B // y\n if B % y != 0:\n a += 1\n ", "B > y", "B", "y", "a = B // y", "a", "B // y", "B", "y", "if B % y != 0:\n a += 1\n ", "B % y != 0", "B % y", "B", "y", "0", "a += 1", "a", "1", "m = max(t,a)", "m", "max(t,a)", "max", "t", "a", "A = x*m", "A", "x*m", "x", "m", "B = y*m", "B", "y*m", "y", "m", "print(A+B)", "print", "A+B", "A", "B", "m = max(t,a)", "max(t,a)", "m", "A = x*m", "x*m", "A", "t = A // x", "A // x", "t", "n = int(input())", "int(input())", "n", "x,y = map(int,input().split())", "map(int,input().split())", "x", "B = y*m", "y*m", "B", "y = map(int,input().split())", "map(int,input().split())", "y", "t,a = 1,1", "1", "t", "A,B = 0,0", "0", "A", "a = B // y", "B // y", "a", "B = 0,0", "0", "B", "a = 1,1", "1", "a", "t += 1", "1", "t", "a += 1", "1", "a" ]
n = int(input()) A,B = 0,0 for i in range(n): x,y = map(int,input().split()) t,a = 1,1 if A > x: t = A // x if A % x != 0: t += 1 if B > y: a = B // y if B % y != 0: a += 1 m = max(t,a) A = x*m B = y*m print(A+B)
[ 7, 15, 15, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 13, 0, 13, 4, 13, 4, 13, 2, 4, 13, 13, 4, 13, 13, 4, 13, 2, 4, 13, 13, 4, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 92, 4 ], [ 12, 11 ], [ 93, 14 ], [ 89, 27 ], [ 86, 30 ], [ 86, 33 ], [ 95, 40 ], [ 87, 48 ], [ 78, 48 ], [ 81, 57 ], [ 84, 57 ], [ 77, 62 ], [ 96, 65 ], [ 83, 67 ], [ 96, 70 ], [ 78, 74 ], [ 87, 74 ], [ 84, 75 ], [ 81, 75 ], [ 77, 78 ], [ 86, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ] ]
[ "from decimal import Decimal\nfrom math import ceil\n\nn = int(input())\nratio = [list(map(int, input().split())) for _ in range(n)]\n\nt_voted = a_voted = 1\nfor t, a in ratio:\n val = max(ceil(Decimal(t_voted) / Decimal(t)), ceil(Decimal(a_voted) / Decimal(a)))\n t_voted = t * val\n a_voted = a * val\n\nprint(t_voted + a_voted)", "from decimal import Decimal", "from math import ceil", "n = int(input())", "n", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ratio = [list(map(int, input().split())) for _ in range(n)]", "ratio", "[list(map(int, input().split())) for _ in range(n)]", "t_voted = a_voted = 1", "t_voted", "1", "= a_voted = 1", "a_voted", "1", "for t, a in ratio:\n val = max(ceil(Decimal(t_voted) / Decimal(t)), ceil(Decimal(a_voted) / Decimal(a)))\n t_voted = t * val\n a_voted = a * val", "t", "a", "ratio", "val = max(ceil(Decimal(t_voted) / Decimal(t)), ceil(Decimal(a_voted) / Decimal(a)))", "val", "max(ceil(Decimal(t_voted) / Decimal(t)), ceil(Decimal(a_voted) / Decimal(a)))", "max", "ceil(Decimal(t_voted) / Decimal(t))", "ceil", "Decimal(t_voted) / Decimal(t)", "Decimal(t_voted)", "Decimal", "t_voted", "Decimal(t)", "Decimal", "t", "ceil(Decimal(a_voted) / Decimal(a))", "ceil", "Decimal(a_voted) / Decimal(a)", "Decimal(a_voted)", "Decimal", "a_voted", "Decimal(a)", "Decimal", "a", "t_voted = t * val", "t_voted", "t * val", "t", "val", "a_voted = a * val", "a_voted", "a * val", "a", "val", "print(t_voted + a_voted)", "print", "t_voted + a_voted", "t_voted", "a_voted", "t_voted = t * val", "t * val", "t_voted", "a_voted = 1", "1", "a_voted", "a_voted = a * val", "a * val", "a_voted", "t_voted = a_voted = 1", "1", "t_voted", "ratio = [list(map(int, input().split())) for _ in range(n)]", "[list(map(int, input().split())) for _ in range(n)]", "ratio", "n = int(input())", "int(input())", "n", "val = max(ceil(Decimal(t_voted) / Decimal(t)), ceil(Decimal(a_voted) / Decimal(a)))", "max(ceil(Decimal(t_voted) / Decimal(t)), ceil(Decimal(a_voted) / Decimal(a)))", "val" ]
from decimal import Decimal from math import ceil n = int(input()) ratio = [list(map(int, input().split())) for _ in range(n)] t_voted = a_voted = 1 for t, a in ratio: val = max(ceil(Decimal(t_voted) / Decimal(t)), ceil(Decimal(a_voted) / Decimal(a))) t_voted = t * val a_voted = a * val print(t_voted + a_voted)
[ 7, 15, 13, 4, 18, 13, 13, 2, 2, 17, 17, 17, 12, 13, 12, 13, 0, 13, 4, 13, 4, 13, 0, 13, 2, 39, 17, 13, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 18, 13, 13, 4, 13, 13, 4, 18, 4, 13, 13, 18, 13, 13, 0, 13, 17, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 40, 2, 2, 40, 18, 13, 13, 13, 18, 13, 2, 13, 17, 40, 2, 2, 40, 18, 13, 13, 13, 18, 13, 2, 13, 17, 4, 13, 2, 13, 2, 18, 13, 2, 13, 17, 18, 13, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 18, 17 ], [ 112, 21 ], [ 24, 23 ], [ 17, 27 ], [ 29, 28 ], [ 17, 32 ], [ 35, 34 ], [ 17, 37 ], [ 42, 39 ], [ 23, 40 ], [ 34, 41 ], [ 112, 48 ], [ 42, 50 ], [ 28, 51 ], [ 34, 52 ], [ 55, 54 ], [ 58, 57 ], [ 17, 61 ], [ 65, 64 ], [ 39, 71 ], [ 23, 72 ], [ 57, 73 ], [ 54, 74 ], [ 64, 74 ], [ 23, 76 ], [ 57, 78 ], [ 50, 84 ], [ 28, 85 ], [ 57, 86 ], [ 54, 87 ], [ 64, 87 ], [ 28, 89 ], [ 57, 91 ], [ 64, 96 ], [ 54, 96 ], [ 23, 99 ], [ 17, 101 ], [ 28, 104 ], [ 17, 106 ], [ 115, 109 ] ]
[ "import sys\nsys.setrecursionlimit(10 ** 5 + 10)\n\n\ndef input(): return sys.stdin.readline().strip()\n\n\ndef resolve():\n\n N = int(input())\n A, B = [0] * N, [0] * N\n\n for i in range(N):\n A[i], B[i] = map(int, input().split())\n\n x = 1\n\n for i in range(N-1):\n x = max(-(-A[i]*x // A[i+1]), -(-B[i]*x // B[i+1]))\n\n print(x*(A[N-1]+B[N-1]))\n\n\nresolve()", "import sys", "sys", "sys.setrecursionlimit(10 ** 5 + 10)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 5 + 10", "10 ** 5", "10", "5", "10", "def input(): return sys.stdin.readline().strip()", "input", "def resolve():\n\n N = int(input())\n A, B = [0] * N, [0] * N\n\n for i in range(N):\n A[i], B[i] = map(int, input().split())\n\n x = 1\n\n for i in range(N-1):\n x = max(-(-A[i]*x // A[i+1]), -(-B[i]*x // B[i+1]))\n\n print(x*(A[N-1]+B[N-1]))", "resolve", "N = int(input())", "N", "int(input())", "int", "input()", "input", "A, B = [0] * N, [0] * N", "A", "[0] * N", "[0]", "0", "N", "B", "[0] * N", "[0]", "0", "N", "for i in range(N):\n A[i], B[i] = map(int, input().split())\n\n ", "i", "range(N)", "range", "N", "A[i], B[i] = map(int, input().split())", "A[i]", "A", "i", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "B[i]", "B", "i", "x = 1", "x", "1", "for i in range(N-1):\n x = max(-(-A[i]*x // A[i+1]), -(-B[i]*x // B[i+1]))\n\n ", "i", "range(N-1)", "range", "N-1", "N", "1", "x = max(-(-A[i]*x // A[i+1]), -(-B[i]*x // B[i+1]))", "x", "max(-(-A[i]*x // A[i+1]), -(-B[i]*x // B[i+1]))", "max", "-(-A[i]*x // A[i+1])", "-A[i]*x // A[i+1]", "-A[i]*x", "-A[i]", "A[i]", "A", "i", "x", "A[i+1]", "A", "i+1", "i", "1", "-(-B[i]*x // B[i+1])", "-B[i]*x // B[i+1]", "-B[i]*x", "-B[i]", "B[i]", "B", "i", "x", "B[i+1]", "B", "i+1", "i", "1", "print(x*(A[N-1]+B[N-1]))", "print", "x*(A[N-1]+B[N-1])", "x", "A[N-1]+B[N-1]", "A[N-1]", "A", "N-1", "N", "1", "B[N-1]", "B", "N-1", "N", "1", "resolve()", "resolve", "def input(): return sys.stdin.readline().strip()", "def input(): return sys.stdin.readline().strip()", "input", "def resolve():\n\n N = int(input())\n A, B = [0] * N, [0] * N\n\n for i in range(N):\n A[i], B[i] = map(int, input().split())\n\n x = 1\n\n for i in range(N-1):\n x = max(-(-A[i]*x // A[i+1]), -(-B[i]*x // B[i+1]))\n\n print(x*(A[N-1]+B[N-1]))", "def resolve():\n\n N = int(input())\n A, B = [0] * N, [0] * N\n\n for i in range(N):\n A[i], B[i] = map(int, input().split())\n\n x = 1\n\n for i in range(N-1):\n x = max(-(-A[i]*x // A[i+1]), -(-B[i]*x // B[i+1]))\n\n print(x*(A[N-1]+B[N-1]))", "resolve" ]
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N = int(input()) A, B = [0] * N, [0] * N for i in range(N): A[i], B[i] = map(int, input().split()) x = 1 for i in range(N-1): x = max(-(-A[i]*x // A[i+1]), -(-B[i]*x // B[i+1])) print(x*(A[N-1]+B[N-1])) resolve()
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 18, 13, 13, 4, 13, 13, 4, 18, 4, 13, 13, 18, 13, 13, 28, 13, 4, 13, 13, 14, 2, 13, 17, 0, 18, 13, 13, 18, 13, 13, 0, 18, 13, 13, 18, 13, 13, 17, 0, 13, 2, 4, 13, 4, 13, 2, 18, 13, 2, 13, 17, 40, 18, 13, 13, 2, 18, 13, 2, 13, 17, 40, 18, 13, 13, 17, 0, 18, 13, 13, 2, 13, 18, 13, 13, 0, 18, 13, 13, 2, 13, 18, 13, 13, 4, 13, 2, 18, 13, 2, 13, 17, 18, 13, 2, 13, 17, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13 ]
[ [ 146, 4 ], [ 137, 10 ], [ 147, 14 ], [ 143, 16 ], [ 147, 20 ], [ 149, 22 ], [ 147, 26 ], [ 140, 28 ], [ 147, 32 ], [ 35, 34 ], [ 147, 37 ], [ 42, 39 ], [ 138, 40 ], [ 34, 41 ], [ 42, 50 ], [ 144, 51 ], [ 34, 52 ], [ 55, 54 ], [ 147, 57 ], [ 54, 60 ], [ 66, 63 ], [ 150, 64 ], [ 54, 65 ], [ 138, 67 ], [ 54, 68 ], [ 73, 70 ], [ 141, 71 ], [ 54, 72 ], [ 144, 74 ], [ 54, 75 ], [ 152, 78 ], [ 150, 86 ], [ 54, 88 ], [ 138, 92 ], [ 54, 93 ], [ 141, 96 ], [ 54, 98 ], [ 144, 102 ], [ 54, 103 ], [ 109, 106 ], [ 150, 107 ], [ 54, 108 ], [ 153, 110 ], [ 138, 112 ], [ 54, 113 ], [ 118, 115 ], [ 141, 116 ], [ 54, 117 ], [ 153, 119 ], [ 144, 121 ], [ 54, 122 ], [ 150, 127 ], [ 147, 129 ], [ 141, 132 ], [ 147, 134 ], [ 137, 138 ], [ 140, 141 ], [ 143, 144 ], [ 146, 147 ], [ 149, 150 ], [ 152, 153 ] ]
[ "import math\nn = int(input())\nT = [0]*n\nA = [0]*n\nTvote = [0]*n\nAvote = [0]*n\n\nfor i in range(n):\n T[i], A[i] = map(int,input().split())\n\nfor k in range(n):\n if k == 0:\n Tvote[k] = T[k]\n Avote[k] = A[k]\n else:\n '''\n j = math.ceil(max(Tvote[k-1]/T[k],Avote[k-1]/A[k]))\n print(Tvote[k-1]/T[k])\n print(Avote[k-1]/A[k])\n print(max(Tvote[k-1]/T[k],Avote[k-1]/A[k]))\n print(j)\n print(Avote[k-1], A[k]*j)\n print(bool(Avote[k-1]<A[k]*j))\n print(bool(j>Avote[k-1]/A[k]))\n '''\n j = int(min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k])))*-1\n #ๆ™ฎ้€šใซๅ‰ฒใ‚Š็ฎ—ใ‚„ใ‚‹ใจ่ชคๅทฎใงๆญปใฌ๏ผˆfloatใŒใ‚€ใšใ„ใ€‚๏ผ‰\n # // ใฏๆ•ดๆ•ฐใฎ้™ค็ฎ—ใงๅธธใซ่ฒ ใฎ็„ก้™ๅคงๆ–นๅ‘ใซไธธใ‚ใ‚‰ใ‚Œใ‚‹\n #ไธ€ๅบฆใ‚‚ float ใซใชใ‚‹ใ“ใจใŒใชใ„ใฏใšใชใฎใงใ€ๆญฃใ—ใ„่จˆ็ฎ—็ตๆžœใŒๅ‡บใ‚‹\n #https://paiza.hatenablog.com/entry/2017/08/01/Python3%E3%81%A7%E5%B7%A8%E5%A4%A7%E3%81%AA%E6%B5%AE%E5%8B%95%E5%B0%8F%E6%95%B0%E8%A8%88%E7%AE%97%E3%81%AE%E7%B5%90%E6%9E%9C%E3%81%8C%E5%A4%89%E3%81%A0%E3%81%A3%E3%81%9F%E3%81%AE%E3%81%A7%E7%90%86\n #ๆญฃใฎ็„ก้™ๅคงๆ–นๅ‘ใซไธธใ‚ใŸใ„ใฎใง-1ใ‹ใ‘ใฆใ‹ใ‚‰่จˆ็ฎ—ใ—ใฆ๏ผˆไธธใ‚ใฆ๏ผ‰ใ‚ใจใง-1ใ‹ใ‘ใ‚‹ใ€‚ใใฎ้š›Av/AใจTv/Tใฎๆฏ”่ผƒใ‚‚้€†ใ‚’ใจใ‚‹ใฎใซๆณจๆ„\n# j = 1\n# while Tvote[k-1]>j*T[k] or Avote[k-1]>j*A[k]:\n# j += 1\n#ใ“ใ‚ŒใฏๆŠ•็ฅจๆ•ฐใŒๅคšใ™ใŽใ‚‹ใฎใงTLE\n Tvote[k] = j*T[k]\n Avote[k] = j*A[k]\n# print(\"---input:{}:{}--vote{}:{}--diff{}\".format(T[k],A[k],Tvote[k],Avote[k],bool(T[k]/A[k]==Tvote[k]/Avote[k]))) \n\n#print(\"---Tvote:{}\".format(Tvote))\n#print(\"---Avote:{}\".format(Avote))\n#print('hoge')\n#for i in range(n):\n# print(Tvote[i],Avote[i])\nprint(Tvote[n-1]+Avote[n-1])\n", "import math", "math", "n = int(input())", "n", "int(input())", "int", "input()", "input", "T = [0]*n", "T", "[0]*n", "[0]", "0", "n", "A = [0]*n", "A", "[0]*n", "[0]", "0", "n", "Tvote = [0]*n", "Tvote", "[0]*n", "[0]", "0", "n", "Avote = [0]*n", "Avote", "[0]*n", "[0]", "0", "n", "for i in range(n):\n T[i], A[i] = map(int,input().split())", "i", "range(n)", "range", "n", "T[i], A[i] = map(int,input().split())", "T[i]", "T", "i", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A[i]", "A", "i", "for k in range(n):\n if k == 0:\n Tvote[k] = T[k]\n Avote[k] = A[k]\n else:\n '''\n j = math.ceil(max(Tvote[k-1]/T[k],Avote[k-1]/A[k]))\n print(Tvote[k-1]/T[k])\n print(Avote[k-1]/A[k])\n print(max(Tvote[k-1]/T[k],Avote[k-1]/A[k]))\n print(j)\n print(Avote[k-1], A[k]*j)\n print(bool(Avote[k-1]<A[k]*j))\n print(bool(j>Avote[k-1]/A[k]))\n '''\n j = int(min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k])))*-1\n #ๆ™ฎ้€šใซๅ‰ฒใ‚Š็ฎ—ใ‚„ใ‚‹ใจ่ชคๅทฎใงๆญปใฌ๏ผˆfloatใŒใ‚€ใšใ„ใ€‚๏ผ‰\n # // ใฏๆ•ดๆ•ฐใฎ้™ค็ฎ—ใงๅธธใซ่ฒ ใฎ็„ก้™ๅคงๆ–นๅ‘ใซไธธใ‚ใ‚‰ใ‚Œใ‚‹\n #ไธ€ๅบฆใ‚‚ float ใซใชใ‚‹ใ“ใจใŒใชใ„ใฏใšใชใฎใงใ€ๆญฃใ—ใ„่จˆ็ฎ—็ตๆžœใŒๅ‡บใ‚‹\n #https://paiza.hatenablog.com/entry/2017/08/01/Python3%E3%81%A7%E5%B7%A8%E5%A4%A7%E3%81%AA%E6%B5%AE%E5%8B%95%E5%B0%8F%E6%95%B0%E8%A8%88%E7%AE%97%E3%81%AE%E7%B5%90%E6%9E%9C%E3%81%8C%E5%A4%89%E3%81%A0%E3%81%A3%E3%81%9F%E3%81%AE%E3%81%A7%E7%90%86\n #ๆญฃใฎ็„ก้™ๅคงๆ–นๅ‘ใซไธธใ‚ใŸใ„ใฎใง-1ใ‹ใ‘ใฆใ‹ใ‚‰่จˆ็ฎ—ใ—ใฆ๏ผˆไธธใ‚ใฆ๏ผ‰ใ‚ใจใง-1ใ‹ใ‘ใ‚‹ใ€‚ใใฎ้š›Av/AใจTv/Tใฎๆฏ”่ผƒใ‚‚้€†ใ‚’ใจใ‚‹ใฎใซๆณจๆ„\n# j = 1\n# while Tvote[k-1]>j*T[k] or Avote[k-1]>j*A[k]:\n# j += 1\n#ใ“ใ‚ŒใฏๆŠ•็ฅจๆ•ฐใŒๅคšใ™ใŽใ‚‹ใฎใงTLE\n Tvote[k] = j*T[k]\n Avote[k] = j*A[k]\n# print(\"---input:{}:{}--vote{}:{}--diff{}\".format(T[k],A[k],Tvote[k],Avote[k],bool(T[k]/A[k]==Tvote[k]/Avote[k]))) \n\n#print(\"---Tvote:{}\".format(Tvote))\n#print(\"---Avote:{}\".format(Avote))\n#print('hoge')\n#for i in range(n):\n# print(Tvote[i],Avote[i])", "k", "range(n)", "range", "n", "if k == 0:\n Tvote[k] = T[k]\n Avote[k] = A[k]\n else:\n '''\n j = math.ceil(max(Tvote[k-1]/T[k],Avote[k-1]/A[k]))\n print(Tvote[k-1]/T[k])\n print(Avote[k-1]/A[k])\n print(max(Tvote[k-1]/T[k],Avote[k-1]/A[k]))\n print(j)\n print(Avote[k-1], A[k]*j)\n print(bool(Avote[k-1]<A[k]*j))\n print(bool(j>Avote[k-1]/A[k]))\n '''\n j = int(min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k])))*-1\n #ๆ™ฎ้€šใซๅ‰ฒใ‚Š็ฎ—ใ‚„ใ‚‹ใจ่ชคๅทฎใงๆญปใฌ๏ผˆfloatใŒใ‚€ใšใ„ใ€‚๏ผ‰\n # // ใฏๆ•ดๆ•ฐใฎ้™ค็ฎ—ใงๅธธใซ่ฒ ใฎ็„ก้™ๅคงๆ–นๅ‘ใซไธธใ‚ใ‚‰ใ‚Œใ‚‹\n #ไธ€ๅบฆใ‚‚ float ใซใชใ‚‹ใ“ใจใŒใชใ„ใฏใšใชใฎใงใ€ๆญฃใ—ใ„่จˆ็ฎ—็ตๆžœใŒๅ‡บใ‚‹\n #https://paiza.hatenablog.com/entry/2017/08/01/Python3%E3%81%A7%E5%B7%A8%E5%A4%A7%E3%81%AA%E6%B5%AE%E5%8B%95%E5%B0%8F%E6%95%B0%E8%A8%88%E7%AE%97%E3%81%AE%E7%B5%90%E6%9E%9C%E3%81%8C%E5%A4%89%E3%81%A0%E3%81%A3%E3%81%9F%E3%81%AE%E3%81%A7%E7%90%86\n #ๆญฃใฎ็„ก้™ๅคงๆ–นๅ‘ใซไธธใ‚ใŸใ„ใฎใง-1ใ‹ใ‘ใฆใ‹ใ‚‰่จˆ็ฎ—ใ—ใฆ๏ผˆไธธใ‚ใฆ๏ผ‰ใ‚ใจใง-1ใ‹ใ‘ใ‚‹ใ€‚ใใฎ้š›Av/AใจTv/Tใฎๆฏ”่ผƒใ‚‚้€†ใ‚’ใจใ‚‹ใฎใซๆณจๆ„\n# j = 1\n# while Tvote[k-1]>j*T[k] or Avote[k-1]>j*A[k]:\n# j += 1\n#ใ“ใ‚ŒใฏๆŠ•็ฅจๆ•ฐใŒๅคšใ™ใŽใ‚‹ใฎใงTLE\n Tvote[k] = j*T[k]\n Avote[k] = j*A[k]\n# print(\"---input:{}:{}--vote{}:{}--diff{}\".format(T[k],A[k],Tvote[k],Avote[k],bool(T[k]/A[k]==Tvote[k]/Avote[k]))) \n\n#print(\"---Tvote:{}\".format(Tvote))\n#print(\"---Avote:{}\".format(Avote))\n#print('hoge')\n#for i in range(n):\n# print(Tvote[i],Avote[i])", "k == 0", "k", "0", "Tvote[k] = T[k]", "Tvote[k]", "Tvote", "k", "T[k]", "T", "k", "Avote[k] = A[k]", "Avote[k]", "Avote", "k", "A[k]", "A", "k", "'''\n j = math.ceil(max(Tvote[k-1]/T[k],Avote[k-1]/A[k]))\n print(Tvote[k-1]/T[k])\n print(Avote[k-1]/A[k])\n print(max(Tvote[k-1]/T[k],Avote[k-1]/A[k]))\n print(j)\n print(Avote[k-1], A[k]*j)\n print(bool(Avote[k-1]<A[k]*j))\n print(bool(j>Avote[k-1]/A[k]))\n '''", "j = int(min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k])))*-1", "j", "int(min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k])))*-1", "int(min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k])))", "int", "min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k]))", "min", "Tvote[k-1]//(-T[k])", "Tvote[k-1]", "Tvote", "k-1", "k", "1", "-T[k]", "T[k]", "T", "k", "Avote[k-1]//(-A[k])", "Avote[k-1]", "Avote", "k-1", "k", "1", "-A[k]", "A[k]", "A", "k", "-1", "Tvote[k] = j*T[k]", "Tvote[k]", "Tvote", "k", "j*T[k]", "j", "T[k]", "T", "k", "Avote[k] = j*A[k]", "Avote[k]", "Avote", "k", "j*A[k]", "j", "A[k]", "A", "k", "print(Tvote[n-1]+Avote[n-1])", "print", "Tvote[n-1]+Avote[n-1]", "Tvote[n-1]", "Tvote", "n-1", "n", "1", "Avote[n-1]", "Avote", "n-1", "n", "1", "T = [0]*n", "[0]*n", "T", "Avote = [0]*n", "[0]*n", "Avote", "A = [0]*n", "[0]*n", "A", "n = int(input())", "int(input())", "n", "Tvote = [0]*n", "[0]*n", "Tvote", "j = int(min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k])))*-1", "int(min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k])))*-1", "j" ]
import math n = int(input()) T = [0]*n A = [0]*n Tvote = [0]*n Avote = [0]*n for i in range(n): T[i], A[i] = map(int,input().split()) for k in range(n): if k == 0: Tvote[k] = T[k] Avote[k] = A[k] else: ''' j = math.ceil(max(Tvote[k-1]/T[k],Avote[k-1]/A[k])) print(Tvote[k-1]/T[k]) print(Avote[k-1]/A[k]) print(max(Tvote[k-1]/T[k],Avote[k-1]/A[k])) print(j) print(Avote[k-1], A[k]*j) print(bool(Avote[k-1]<A[k]*j)) print(bool(j>Avote[k-1]/A[k])) ''' j = int(min(Tvote[k-1]//(-T[k]),Avote[k-1]//(-A[k])))*-1 #ๆ™ฎ้€šใซๅ‰ฒใ‚Š็ฎ—ใ‚„ใ‚‹ใจ่ชคๅทฎใงๆญปใฌ๏ผˆfloatใŒใ‚€ใšใ„ใ€‚๏ผ‰ # // ใฏๆ•ดๆ•ฐใฎ้™ค็ฎ—ใงๅธธใซ่ฒ ใฎ็„ก้™ๅคงๆ–นๅ‘ใซไธธใ‚ใ‚‰ใ‚Œใ‚‹ #ไธ€ๅบฆใ‚‚ float ใซใชใ‚‹ใ“ใจใŒใชใ„ใฏใšใชใฎใงใ€ๆญฃใ—ใ„่จˆ็ฎ—็ตๆžœใŒๅ‡บใ‚‹ #https://paiza.hatenablog.com/entry/2017/08/01/Python3%E3%81%A7%E5%B7%A8%E5%A4%A7%E3%81%AA%E6%B5%AE%E5%8B%95%E5%B0%8F%E6%95%B0%E8%A8%88%E7%AE%97%E3%81%AE%E7%B5%90%E6%9E%9C%E3%81%8C%E5%A4%89%E3%81%A0%E3%81%A3%E3%81%9F%E3%81%AE%E3%81%A7%E7%90%86 #ๆญฃใฎ็„ก้™ๅคงๆ–นๅ‘ใซไธธใ‚ใŸใ„ใฎใง-1ใ‹ใ‘ใฆใ‹ใ‚‰่จˆ็ฎ—ใ—ใฆ๏ผˆไธธใ‚ใฆ๏ผ‰ใ‚ใจใง-1ใ‹ใ‘ใ‚‹ใ€‚ใใฎ้š›Av/AใจTv/Tใฎๆฏ”่ผƒใ‚‚้€†ใ‚’ใจใ‚‹ใฎใซๆณจๆ„ # j = 1 # while Tvote[k-1]>j*T[k] or Avote[k-1]>j*A[k]: # j += 1 #ใ“ใ‚ŒใฏๆŠ•็ฅจๆ•ฐใŒๅคšใ™ใŽใ‚‹ใฎใงTLE Tvote[k] = j*T[k] Avote[k] = j*A[k] # print("---input:{}:{}--vote{}:{}--diff{}".format(T[k],A[k],Tvote[k],Avote[k],bool(T[k]/A[k]==Tvote[k]/Avote[k]))) #print("---Tvote:{}".format(Tvote)) #print("---Avote:{}".format(Avote)) #print('hoge') #for i in range(n): # print(Tvote[i],Avote[i]) print(Tvote[n-1]+Avote[n-1])
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 12, 13, 29, 40, 2, 40, 13, 13, 23, 13, 23, 13, 12, 13, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 18, 4, 13, 13, 13, 0, 13, 13, 0, 13, 17, 13, 17, 28, 13, 13, 13, 14, 2, 40, 13, 13, 40, 13, 13, 0, 13, 13, 0, 13, 13, 14, 2, 2, 13, 13, 40, 13, 13, 0, 13, 2, 13, 4, 13, 13, 13, 0, 13, 2, 2, 13, 13, 13, 14, 2, 2, 13, 13, 40, 13, 13, 0, 13, 2, 13, 4, 13, 13, 13, 0, 13, 2, 2, 13, 13, 13, 14, 40, 2, 13, 13, 2, 13, 13, 0, 13, 2, 13, 4, 13, 13, 13, 0, 13, 2, 2, 13, 13, 13, 0, 13, 2, 13, 4, 13, 13, 13, 0, 13, 2, 2, 13, 13, 13, 4, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 18, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 172, 4 ], [ 19, 16 ], [ 21, 17 ], [ 19, 19 ], [ 21, 21 ], [ 26, 25 ], [ 173, 29 ], [ 33, 32 ], [ 25, 35 ], [ 173, 47 ], [ 52, 51 ], [ 55, 54 ], [ 57, 56 ], [ 54, 66 ], [ 146, 66 ], [ 139, 66 ], [ 116, 66 ], [ 85, 66 ], [ 71, 66 ], [ 56, 69 ], [ 154, 69 ], [ 131, 69 ], [ 108, 69 ], [ 93, 69 ], [ 74, 69 ], [ 72, 71 ], [ 75, 74 ], [ 54, 80 ], [ 146, 80 ], [ 139, 80 ], [ 116, 80 ], [ 85, 80 ], [ 71, 80 ], [ 56, 83 ], [ 154, 83 ], [ 131, 83 ], [ 108, 83 ], [ 93, 83 ], [ 74, 83 ], [ 86, 85 ], [ 176, 89 ], [ 54, 90 ], [ 146, 90 ], [ 139, 90 ], [ 116, 90 ], [ 85, 90 ], [ 71, 90 ], [ 94, 93 ], [ 85, 96 ], [ 54, 96 ], [ 146, 96 ], [ 139, 96 ], [ 116, 96 ], [ 71, 96 ], [ 56, 103 ], [ 154, 103 ], [ 131, 103 ], [ 108, 103 ], [ 93, 103 ], [ 74, 103 ], [ 54, 106 ], [ 146, 106 ], [ 139, 106 ], [ 116, 106 ], [ 85, 106 ], [ 71, 106 ], [ 109, 108 ], [ 176, 112 ], [ 56, 113 ], [ 154, 113 ], [ 131, 113 ], [ 108, 113 ], [ 93, 113 ], [ 74, 113 ], [ 117, 116 ], [ 108, 119 ], [ 56, 119 ], [ 154, 119 ], [ 131, 119 ], [ 93, 119 ], [ 74, 119 ], [ 54, 128 ], [ 146, 128 ], [ 139, 128 ], [ 116, 128 ], [ 85, 128 ], [ 71, 128 ], [ 56, 129 ], [ 154, 129 ], [ 131, 129 ], [ 108, 129 ], [ 93, 129 ], [ 74, 129 ], [ 132, 131 ], [ 176, 135 ], [ 56, 136 ], [ 154, 136 ], [ 131, 136 ], [ 108, 136 ], [ 93, 136 ], [ 74, 136 ], [ 140, 139 ], [ 131, 142 ], [ 56, 142 ], [ 154, 142 ], [ 108, 142 ], [ 93, 142 ], [ 74, 142 ], [ 147, 146 ], [ 176, 150 ], [ 54, 151 ], [ 146, 151 ], [ 139, 151 ], [ 116, 151 ], [ 85, 151 ], [ 71, 151 ], [ 155, 154 ], [ 146, 157 ], [ 54, 157 ], [ 139, 157 ], [ 116, 157 ], [ 85, 157 ], [ 71, 157 ], [ 146, 163 ], [ 139, 163 ], [ 116, 163 ], [ 85, 163 ], [ 71, 163 ], [ 54, 163 ], [ 154, 164 ], [ 131, 164 ], [ 108, 164 ], [ 93, 164 ], [ 74, 164 ], [ 56, 164 ], [ 179, 170 ], [ 172, 173 ] ]
[ "import sys\nreadline = sys.stdin.readline\ndef ceil(a, b):\n return -(-a//b)\n\ndef main():\n N = int(readline())\n inp = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]\n scr_t, scr_a = 0, 0\n for t, a in inp:\n if t >= scr_t and a >= scr_a:\n scr_t = t\n scr_a = a\n elif t < scr_t and a >= scr_a:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n elif a < scr_a and t >= scr_t:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n if t / a >= scr_t / scr_a:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n\n print(scr_t + scr_a)\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "readline = sys.stdin.readline", "readline", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "def ceil(a, b):\n return -(-a//b)", "ceil", "return -(-a//b)", "-(-a//b)", "-a//b", "-a", "a", "b", "a", "a", "b", "b", "def main():\n N = int(readline())\n inp = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]\n scr_t, scr_a = 0, 0\n for t, a in inp:\n if t >= scr_t and a >= scr_a:\n scr_t = t\n scr_a = a\n elif t < scr_t and a >= scr_a:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n elif a < scr_a and t >= scr_t:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n if t / a >= scr_t / scr_a:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n\n print(scr_t + scr_a)", "main", "N = int(readline())", "N", "int(readline())", "int", "readline()", "readline", "tuple(map(int, readline().rstrip().split())) for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "tuple(map(int, readline().rstrip().split()))", "tuple", "map(int, readline().rstrip().split())", "map", "int", "readline().rstrip().split()", "().rstrip().split", "().rstrip()", "().rstrip", "()", "readline", "rstrip", "split", "inp = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]", "inp", "[tuple(map(int, readline().rstrip().split())) for _ in range(N)]", "scr_t, scr_a = 0, 0", "scr_t", "0", "scr_a", "0", "for t, a in inp:\n if t >= scr_t and a >= scr_a:\n scr_t = t\n scr_a = a\n elif t < scr_t and a >= scr_a:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n elif a < scr_a and t >= scr_t:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n if t / a >= scr_t / scr_a:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n\n ", "t", "a", "inp", "if t >= scr_t and a >= scr_a:\n scr_t = t\n scr_a = a\n elif t < scr_t and a >= scr_a:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n elif a < scr_a and t >= scr_t:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n if t / a >= scr_t / scr_a:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n\n ", "t >= scr_t and a >= scr_a", "t >= scr_t", "t", "scr_t", "a >= scr_a", "a", "scr_a", "scr_t = t", "scr_t", "t", "scr_a = a", "scr_a", "a", "elif t < scr_t and a >= scr_a:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n ", "t < scr_t and a >= scr_a", "t < scr_t", "t", "scr_t", "a >= scr_a", "a", "scr_a", "scr_t = t * ceil(scr_t, t)", "scr_t", "t * ceil(scr_t, t)", "t", "ceil(scr_t, t)", "ceil", "scr_t", "t", "scr_a = scr_t * a // t", "scr_a", "scr_t * a // t", "scr_t * a", "scr_t", "a", "t", "elif a < scr_a and t >= scr_t:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n ", "a < scr_a and t >= scr_t", "a < scr_a", "a", "scr_a", "t >= scr_t", "t", "scr_t", "scr_a = a * ceil(scr_a, a)", "scr_a", "a * ceil(scr_a, a)", "a", "ceil(scr_a, a)", "ceil", "scr_a", "a", "scr_t = scr_a * t // a", "scr_t", "scr_a * t // a", "scr_a * t", "scr_a", "t", "a", "if t / a >= scr_t / scr_a:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n\n ", "t / a >= scr_t / scr_a", "t / a", "t", "a", "scr_t / scr_a", "scr_t", "scr_a", "scr_a = a * ceil(scr_a, a)", "scr_a", "a * ceil(scr_a, a)", "a", "ceil(scr_a, a)", "ceil", "scr_a", "a", "scr_t = scr_a * t // a", "scr_t", "scr_a * t // a", "scr_a * t", "scr_a", "t", "a", "scr_t = t * ceil(scr_t, t)", "scr_t", "t * ceil(scr_t, t)", "t", "ceil(scr_t, t)", "ceil", "scr_t", "t", "scr_a = scr_t * a // t", "scr_a", "scr_t * a // t", "scr_t * a", "scr_t", "a", "t", "print(scr_t + scr_a)", "print", "scr_t + scr_a", "scr_t", "scr_a", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "readline = sys.stdin.readline", "sys.stdin.readline", "readline", "def ceil(a, b):\n return -(-a//b)", "def ceil(a, b):\n return -(-a//b)", "ceil", "def main():\n N = int(readline())\n inp = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]\n scr_t, scr_a = 0, 0\n for t, a in inp:\n if t >= scr_t and a >= scr_a:\n scr_t = t\n scr_a = a\n elif t < scr_t and a >= scr_a:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n elif a < scr_a and t >= scr_t:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n if t / a >= scr_t / scr_a:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n\n print(scr_t + scr_a)", "def main():\n N = int(readline())\n inp = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]\n scr_t, scr_a = 0, 0\n for t, a in inp:\n if t >= scr_t and a >= scr_a:\n scr_t = t\n scr_a = a\n elif t < scr_t and a >= scr_a:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n elif a < scr_a and t >= scr_t:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n if t / a >= scr_t / scr_a:\n scr_a = a * ceil(scr_a, a)\n scr_t = scr_a * t // a\n else:\n scr_t = t * ceil(scr_t, t)\n scr_a = scr_t * a // t\n\n print(scr_t + scr_a)", "main" ]
import sys readline = sys.stdin.readline def ceil(a, b): return -(-a//b) def main(): N = int(readline()) inp = [tuple(map(int, readline().rstrip().split())) for _ in range(N)] scr_t, scr_a = 0, 0 for t, a in inp: if t >= scr_t and a >= scr_a: scr_t = t scr_a = a elif t < scr_t and a >= scr_a: scr_t = t * ceil(scr_t, t) scr_a = scr_t * a // t elif a < scr_a and t >= scr_t: scr_a = a * ceil(scr_a, a) scr_t = scr_a * t // a else: if t / a >= scr_t / scr_a: scr_a = a * ceil(scr_a, a) scr_t = scr_a * t // a else: scr_t = t * ceil(scr_t, t) scr_a = scr_t * a // t print(scr_t + scr_a) if __name__ == '__main__': main()
[ 7, 15, 13, 15, 0, 13, 4, 13, 17, 0, 13, 2, 2, 17, 17, 17, 15, 13, 4, 18, 13, 13, 2, 17, 17, 15, 13, 15, 13, 15, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 12, 13, 23, 13, 12, 13, 0, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 2, 13, 13, 14, 40, 2, 13, 13, 17, 0, 13, 17, 0, 13, 2, 13, 13, 14, 40, 2, 13, 13, 17, 0, 13, 17, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 2, 13, 10, 12, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 205, 5 ], [ 199, 10 ], [ 39, 38 ], [ 221, 44 ], [ 48, 48 ], [ 52, 51 ], [ 194, 57 ], [ 61, 61 ], [ 71, 70 ], [ 209, 75 ], [ 79, 79 ], [ 83, 82 ], [ 185, 88 ], [ 92, 92 ], [ 96, 95 ], [ 209, 103 ], [ 107, 107 ], [ 112, 111 ], [ 221, 113 ], [ 116, 115 ], [ 118, 117 ], [ 121, 120 ], [ 111, 123 ], [ 126, 125 ], [ 215, 127 ], [ 126, 128 ], [ 131, 130 ], [ 115, 132 ], [ 164, 132 ], [ 125, 133 ], [ 115, 137 ], [ 164, 137 ], [ 125, 138 ], [ 142, 141 ], [ 145, 144 ], [ 117, 146 ], [ 168, 146 ], [ 128, 147 ], [ 117, 151 ], [ 168, 151 ], [ 128, 152 ], [ 156, 155 ], [ 159, 158 ], [ 141, 161 ], [ 130, 161 ], [ 155, 162 ], [ 144, 162 ], [ 165, 164 ], [ 125, 166 ], [ 158, 167 ], [ 169, 168 ], [ 128, 170 ], [ 158, 171 ], [ 164, 175 ], [ 115, 175 ], [ 168, 176 ], [ 117, 176 ], [ 224, 182 ], [ 199, 200 ], [ 205, 206 ] ]
[ "import math\nfrom math import gcd,pi,sqrt\nINF = float(\"inf\")\nMOD = 10**9 + 7\n\nimport sys\nsys.setrecursionlimit(10**6)\nimport itertools\nimport bisect\nfrom collections import Counter,deque\ndef i_input(): return int(input())\ndef i_map(): return map(int, input().split())\ndef i_list(): return list(i_map())\ndef i_row(N): return [i_input() for _ in range(N)]\ndef i_row_list(N): return [i_list() for _ in range(N)]\ndef s_input(): return input()\ndef s_map(): return input().split()\ndef s_list(): return list(s_map())\ndef s_row(N): return [s_input for _ in range(N)]\ndef s_row_str(N): return [s_list() for _ in range(N)]\ndef s_row_list(N): return [list(s_input()) for _ in range(N)]\n\n\ndef main():\n N = i_input()\n t0,a0 = 1,1\n\n for i in range(N):\n t1,a1 = i_map()\n f0 = t0//t1\n if t0%t1 != 0:\n f0 += 1\n f1 = a0 // a1\n if a0%a1 != 0:\n f1 += 1\n f = max(f0, f1)\n t0, a0 = t1*f, a1*f\n print(t0+a0)\n\nif __name__==\"__main__\":\n main()", "import math", "math", "from math import gcd,pi,sqrt", "INF = float(\"inf\")", "INF", "float(\"inf\")", "float", "\"inf\"", "MOD = 10**9 + 7", "MOD", "10**9 + 7", "10**9", "10", "9", "7", "import sys", "sys", "sys.setrecursionlimit(10**6)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**6", "10", "6", "import itertools", "itertools", "import bisect", "bisect", "from collections import Counter,deque", "def i_input(): return int(input())", "i_input", "def i_map(): return map(int, input().split())", "i_map", "def i_list(): return list(i_map())", "i_list", "i_input() for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "i_input()", "i_input", "def i_row(N): return [i_input() for _ in range(N)]", "i_row", "N", "N", "i_list() for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "i_list()", "i_list", "def i_row_list(N): return [i_list() for _ in range(N)]", "i_row_list", "N", "N", "def s_input(): return input()", "s_input", "def s_map(): return input().split()", "s_map", "def s_list(): return list(s_map())", "s_list", "s_input for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "s_input", "def s_row(N): return [s_input for _ in range(N)]", "s_row", "N", "N", "s_list() for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "s_list()", "s_list", "def s_row_str(N): return [s_list() for _ in range(N)]", "s_row_str", "N", "N", "list(s_input()) for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "list(s_input())", "list", "s_input()", "s_input", "def s_row_list(N): return [list(s_input()) for _ in range(N)]", "s_row_list", "N", "N", "def main():\n N = i_input()\n t0,a0 = 1,1\n\n for i in range(N):\n t1,a1 = i_map()\n f0 = t0//t1\n if t0%t1 != 0:\n f0 += 1\n f1 = a0 // a1\n if a0%a1 != 0:\n f1 += 1\n f = max(f0, f1)\n t0, a0 = t1*f, a1*f\n print(t0+a0)", "main", "N = i_input()", "N", "i_input()", "i_input", "t0,a0 = 1,1", "t0", "1", "a0", "1", "for i in range(N):\n t1,a1 = i_map()\n f0 = t0//t1\n if t0%t1 != 0:\n f0 += 1\n f1 = a0 // a1\n if a0%a1 != 0:\n f1 += 1\n f = max(f0, f1)\n t0, a0 = t1*f, a1*f\n ", "i", "range(N)", "range", "N", "t1,a1 = i_map()", "t1", "i_map()", "i_map", "a1", "f0 = t0//t1", "f0", "t0//t1", "t0", "t1", "if t0%t1 != 0:\n f0 += 1\n ", "t0%t1 != 0", "t0%t1", "t0", "t1", "0", "f0 += 1", "f0", "1", "f1 = a0 // a1", "f1", "a0 // a1", "a0", "a1", "if a0%a1 != 0:\n f1 += 1\n ", "a0%a1 != 0", "a0%a1", "a0", "a1", "0", "f1 += 1", "f1", "1", "f = max(f0, f1)", "f", "max(f0, f1)", "max", "f0", "f1", "t0, a0 = t1*f, a1*f", "t0", "t1*f", "t1", "f", "a0", "a1*f", "a1", "f", "print(t0+a0)", "print", "t0+a0", "t0", "a0", "if __name__==\"__main__\":\n main()", "__name__==\"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def s_list(): return list(s_map())", "def s_list(): return list(s_map())", "s_list", "def s_map(): return input().split()", "def s_map(): return input().split()", "s_map", "def s_row_list(N): return [list(s_input()) for _ in range(N)]", "def s_row_list(N): return [list(s_input()) for _ in range(N)]", "s_row_list", "def i_list(): return list(i_map())", "def i_list(): return list(i_map())", "i_list", "def s_row(N): return [s_input for _ in range(N)]", "def s_row(N): return [s_input for _ in range(N)]", "s_row", "MOD = 10**9 + 7", "10**9 + 7", "MOD", "def i_row(N): return [i_input() for _ in range(N)]", "def i_row(N): return [i_input() for _ in range(N)]", "i_row", "INF = float(\"inf\")", "float(\"inf\")", "INF", "def s_input(): return input()", "def s_input(): return input()", "s_input", "def i_row_list(N): return [i_list() for _ in range(N)]", "def i_row_list(N): return [i_list() for _ in range(N)]", "i_row_list", "def i_map(): return map(int, input().split())", "def i_map(): return map(int, input().split())", "i_map", "def s_row_str(N): return [s_list() for _ in range(N)]", "def s_row_str(N): return [s_list() for _ in range(N)]", "s_row_str", "def i_input(): return int(input())", "def i_input(): return int(input())", "i_input", "def main():\n N = i_input()\n t0,a0 = 1,1\n\n for i in range(N):\n t1,a1 = i_map()\n f0 = t0//t1\n if t0%t1 != 0:\n f0 += 1\n f1 = a0 // a1\n if a0%a1 != 0:\n f1 += 1\n f = max(f0, f1)\n t0, a0 = t1*f, a1*f\n print(t0+a0)", "def main():\n N = i_input()\n t0,a0 = 1,1\n\n for i in range(N):\n t1,a1 = i_map()\n f0 = t0//t1\n if t0%t1 != 0:\n f0 += 1\n f1 = a0 // a1\n if a0%a1 != 0:\n f1 += 1\n f = max(f0, f1)\n t0, a0 = t1*f, a1*f\n print(t0+a0)", "main" ]
import math from math import gcd,pi,sqrt INF = float("inf") MOD = 10**9 + 7 import sys sys.setrecursionlimit(10**6) import itertools import bisect from collections import Counter,deque def i_input(): return int(input()) def i_map(): return map(int, input().split()) def i_list(): return list(i_map()) def i_row(N): return [i_input() for _ in range(N)] def i_row_list(N): return [i_list() for _ in range(N)] def s_input(): return input() def s_map(): return input().split() def s_list(): return list(s_map()) def s_row(N): return [s_input for _ in range(N)] def s_row_str(N): return [s_list() for _ in range(N)] def s_row_list(N): return [list(s_input()) for _ in range(N)] def main(): N = i_input() t0,a0 = 1,1 for i in range(N): t1,a1 = i_map() f0 = t0//t1 if t0%t1 != 0: f0 += 1 f1 = a0 // a1 if a0%a1 != 0: f1 += 1 f = max(f0, f1) t0, a0 = t1*f, a1*f print(t0+a0) if __name__=="__main__": main()
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 18, 13, 17, 28, 13, 18, 13, 39, 17, 0, 13, 4, 13, 2, 2, 2, 18, 13, 17, 18, 13, 17, 17, 18, 13, 17, 2, 2, 2, 18, 13, 17, 18, 13, 17, 17, 18, 13, 17, 0, 13, 39, 2, 13, 18, 13, 17, 2, 13, 18, 13, 17, 4, 13, 4, 13, 13, 10, 39, 13, 10, 4, 13, 10, 18, 13, 10, 13, 13, 10, 4, 13 ]
[ [ 90, 2 ], [ 10, 9 ], [ 91, 12 ], [ 96, 25 ], [ 93, 28 ], [ 97, 30 ], [ 34, 33 ], [ 97, 35 ], [ 99, 39 ], [ 94, 46 ], [ 88, 46 ], [ 33, 49 ], [ 33, 53 ], [ 94, 59 ], [ 88, 59 ], [ 33, 62 ], [ 33, 66 ], [ 87, 69 ], [ 100, 72 ], [ 33, 74 ], [ 100, 77 ], [ 33, 79 ], [ 88, 85 ], [ 94, 85 ], [ 87, 88 ], [ 90, 91 ], [ 93, 94 ], [ 96, 97 ], [ 99, 100 ] ]
[ "N = int(input())\nTA = [tuple(map(int, input().split()))for _ in range(N)]\nans = TA[0]\nfor ta in TA[1:]:\n x = max((ans[0] + ta[0] - 1) // ta[0], (ans[1] + ta[1] - 1) // ta[1])\n ans = (x * ta[0], x * ta[1])\nprint(sum(ans))", "N = int(input())", "N", "int(input())", "int", "input()", "input", "tuple(map(int, input().split()))for _ in range(N)", "for _ in range(N)", "_", "range(N)", "range", "N", "for _ in range(N)", "tuple(map(int, input().split()))", "tuple", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "TA = [tuple(map(int, input().split()))for _ in range(N)]", "TA", "[tuple(map(int, input().split()))for _ in range(N)]", "ans = TA[0]", "ans", "TA[0]", "TA", "0", "for ta in TA[1:]:\n x = max((ans[0] + ta[0] - 1) // ta[0], (ans[1] + ta[1] - 1) // ta[1])\n ans = (x * ta[0], x * ta[1])", "ta", "TA[1:]", "TA", "1:", "1", "x = max((ans[0] + ta[0] - 1) // ta[0], (ans[1] + ta[1] - 1) // ta[1])", "x", "max((ans[0] + ta[0] - 1) // ta[0], (ans[1] + ta[1] - 1) // ta[1])", "max", "(ans[0] + ta[0] - 1) // ta[0]", "ans[0] + ta[0] - 1", "ans[0] + ta[0]", "ans[0]", "ans", "0", "ta[0]", "ta", "0", "1", "ta[0]", "ta", "0", "(ans[1] + ta[1] - 1) // ta[1]", "ans[1] + ta[1] - 1", "ans[1] + ta[1]", "ans[1]", "ans", "1", "ta[1]", "ta", "1", "1", "ta[1]", "ta", "1", "ans = (x * ta[0], x * ta[1])", "ans", "(x * ta[0], x * ta[1])", "x * ta[0]", "x", "ta[0]", "ta", "0", "x * ta[1]", "x", "ta[1]", "ta", "1", "print(sum(ans))", "print", "sum(ans)", "sum", "ans", "ans = (x * ta[0], x * ta[1])", "(x * ta[0], x * ta[1])", "ans", "N = int(input())", "int(input())", "N", "ans = TA[0]", "TA[0]", "ans", "TA = [tuple(map(int, input().split()))for _ in range(N)]", "[tuple(map(int, input().split()))for _ in range(N)]", "TA", "x = max((ans[0] + ta[0] - 1) // ta[0], (ans[1] + ta[1] - 1) // ta[1])", "max((ans[0] + ta[0] - 1) // ta[0], (ans[1] + ta[1] - 1) // ta[1])", "x" ]
N = int(input()) TA = [tuple(map(int, input().split()))for _ in range(N)] ans = TA[0] for ta in TA[1:]: x = max((ans[0] + ta[0] - 1) // ta[0], (ans[1] + ta[1] - 1) // ta[1]) ans = (x * ta[0], x * ta[1]) print(sum(ans))
[ 7, 0, 13, 4, 13, 4, 13, 12, 13, 42, 13, 0, 13, 13, 13, 2, 13, 13, 29, 13, 23, 13, 23, 13, 12, 13, 29, 2, 2, 13, 13, 4, 13, 13, 13, 23, 13, 23, 13, 12, 13, 29, 2, 2, 13, 13, 2, 2, 13, 13, 17, 23, 13, 23, 13, 15, 13, 0, 13, 39, 17, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 4, 13, 18, 13, 17, 13, 4, 13, 18, 13, 17, 13, 0, 13, 39, 2, 13, 13, 2, 13, 13, 4, 13, 4, 13, 13, 10, 12, 13, 10, 4, 13, 10, 39, 13, 10, 4, 13, 10, 4, 13, 10, 39, 13, 10, 12, 13, 10, 12, 13, 10, 4, 13 ]
[ [ 112, 2 ], [ 13, 12 ], [ 23, 13 ], [ 14, 13 ], [ 15, 14 ], [ 12, 16 ], [ 21, 16 ], [ 23, 17 ], [ 14, 17 ], [ 12, 19 ], [ 21, 19 ], [ 21, 21 ], [ 23, 23 ], [ 36, 29 ], [ 38, 30 ], [ 128, 32 ], [ 36, 33 ], [ 38, 34 ], [ 36, 36 ], [ 38, 38 ], [ 52, 44 ], [ 54, 45 ], [ 52, 48 ], [ 54, 49 ], [ 52, 52 ], [ 54, 54 ], [ 115, 58 ], [ 64, 63 ], [ 113, 66 ], [ 121, 68 ], [ 121, 77 ], [ 133, 79 ], [ 110, 83 ], [ 116, 85 ], [ 125, 85 ], [ 122, 87 ], [ 110, 89 ], [ 116, 91 ], [ 125, 91 ], [ 119, 93 ], [ 124, 95 ], [ 134, 98 ], [ 122, 99 ], [ 134, 101 ], [ 119, 102 ], [ 125, 107 ], [ 116, 107 ], [ 112, 113 ], [ 115, 116 ], [ 121, 119 ], [ 121, 122 ], [ 124, 125 ], [ 133, 134 ] ]
[ "n = int(input())\n\n#a,bใฎๆœ€ๅคงๅ…ฌ็ด„ๆ•ฐ\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n#a,bใฎๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ\ndef lcm(a, b):\n return a * b // gcd (a, b)\n\ndef ceil(a, b):\n return a // b + (a % b > 0)\n\nimport math\nans = (1, 1)\nfor _ in range(n):\n t,a = map(int,input().split())\n b = max(ceil(ans[0],t), ceil(ans[1],a))\n ans = [b*t, b*a]\nprint(sum(ans))\n \n", "n = int(input())", "n", "int(input())", "int", "input()", "input", "def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n#a,bใฎๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ", "gcd", "while b:\n a, b = b, a % b\n ", "b", "a, b = b, a % b", "a", "b", "b", "a % b", "a", "b", "return a", "a", "a", "a", "b", "b", "def lcm(a, b):\n return a * b // gcd (a, b)", "lcm", "return a * b // gcd (a, b)", "a * b // gcd (a, b)", "a * b", "a", "b", "gcd (a, b)", "gcd", "a", "b", "a", "a", "b", "b", "def ceil(a, b):\n return a // b + (a % b > 0)", "ceil", "return a // b + (a % b > 0)", "a // b + (a % b > 0)", "a // b", "a", "b", "a % b > 0", "a % b", "a", "b", "0", "a", "a", "b", "b", "import math", "math", "ans = (1, 1)", "ans", "(1, 1)", "1", "1", "for _ in range(n):\n t,a = map(int,input().split())\n b = max(ceil(ans[0],t), ceil(ans[1],a))\n ans = [b*t, b*a]", "_", "range(n)", "range", "n", "t,a = map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "b = max(ceil(ans[0],t), ceil(ans[1],a))", "b", "max(ceil(ans[0],t), ceil(ans[1],a))", "max", "ceil(ans[0],t)", "ceil", "ans[0]", "ans", "0", "t", "ceil(ans[1],a)", "ceil", "ans[1]", "ans", "1", "a", "ans = [b*t, b*a]", "ans", "[b*t, b*a]", "b*t", "b", "t", "b*a", "b", "a", "print(sum(ans))", "print", "sum(ans)", "sum", "ans", "def ceil(a, b):\n return a // b + (a % b > 0)", "def ceil(a, b):\n return a // b + (a % b > 0)", "ceil", "n = int(input())", "int(input())", "n", "ans = (1, 1)", "(1, 1)", "ans", "a = map(int,input().split())", "map(int,input().split())", "a", "t,a = map(int,input().split())", "map(int,input().split())", "t", "ans = [b*t, b*a]", "[b*t, b*a]", "ans", "def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n#a,bใฎๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ", "def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n#a,bใฎๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ", "gcd", "def lcm(a, b):\n return a * b // gcd (a, b)", "def lcm(a, b):\n return a * b // gcd (a, b)", "lcm", "b = max(ceil(ans[0],t), ceil(ans[1],a))", "max(ceil(ans[0],t), ceil(ans[1],a))", "b" ]
n = int(input()) #a,bใฎๆœ€ๅคงๅ…ฌ็ด„ๆ•ฐ def gcd(a, b): while b: a, b = b, a % b return a #a,bใฎๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ def lcm(a, b): return a * b // gcd (a, b) def ceil(a, b): return a // b + (a % b > 0) import math ans = (1, 1) for _ in range(n): t,a = map(int,input().split()) b = max(ceil(ans[0],t), ceil(ans[1],a)) ans = [b*t, b*a] print(sum(ans))
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 75, 2 ], [ 90, 8 ], [ 90, 17 ], [ 20, 19 ], [ 76, 23 ], [ 72, 26 ], [ 72, 35 ], [ 84, 37 ], [ 88, 43 ], [ 79, 43 ], [ 73, 44 ], [ 73, 46 ], [ 91, 50 ], [ 82, 50 ], [ 70, 51 ], [ 70, 53 ], [ 78, 55 ], [ 85, 57 ], [ 73, 58 ], [ 81, 59 ], [ 85, 61 ], [ 70, 62 ], [ 79, 66 ], [ 88, 66 ], [ 82, 67 ], [ 91, 67 ], [ 72, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 90, 88 ], [ 90, 91 ] ]
[ "n = int(input())\nt, a = map(int, input().split())\nfor _ in range(n - 1):\n x, y = map(int, input().split())\n s = max((t + x - 1) // x, (a + y - 1) // y)\n t, a = s * x, s * y\nprint(t + a)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "for _ in range(n - 1):\n x, y = map(int, input().split())\n s = max((t + x - 1) // x, (a + y - 1) // y)\n t, a = s * x, s * y", "_", "range(n - 1)", "range", "n - 1", "n", "1", "x, y = map(int, input().split())", "x", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "s = max((t + x - 1) // x, (a + y - 1) // y)", "s", "max((t + x - 1) // x, (a + y - 1) // y)", "max", "(t + x - 1) // x", "t + x - 1", "t + x", "t", "x", "1", "x", "(a + y - 1) // y", "a + y - 1", "a + y", "a", "y", "1", "y", "t, a = s * x, s * y", "t", "s * x", "s", "x", "a", "s * y", "s", "y", "print(t + a)", "print", "t + a", "t", "a", "y = map(int, input().split())", "map(int, input().split())", "y", "x, y = map(int, input().split())", "map(int, input().split())", "x", "n = int(input())", "int(input())", "n", "t, a = s * x, s * y", "s * x", "t", "a = s * x, s * y", "s * y", "a", "s = max((t + x - 1) // x, (a + y - 1) // y)", "max((t + x - 1) // x, (a + y - 1) // y)", "s", "t, a = map(int, input().split())", "map(int, input().split())", "t", "a = map(int, input().split())", "map(int, input().split())", "a" ]
n = int(input()) t, a = map(int, input().split()) for _ in range(n - 1): x, y = map(int, input().split()) s = max((t + x - 1) // x, (a + y - 1) // y) t, a = s * x, s * y print(t + a)
[ 7, 15, 13, 0, 13, 39, 17, 17, 17, 0, 13, 17, 0, 13, 18, 13, 13, 0, 13, 12, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 17, 12, 13, 29, 2, 2, 2, 13, 13, 17, 13, 23, 13, 23, 13, 12, 13, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 0, 13, 4, 13, 13, 13, 0, 13, 4, 13, 13, 13, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 29, 2, 13, 13, 0, 13, 17, 12, 13, 14, 13, 4, 13, 13, 23, 13, 12, 13, 15, 13, 0, 13, 4, 18, 13, 13, 0, 13, 4, 18, 13, 13, 28, 13, 13, 27, 13, 14, 2, 13, 17, 14, 2, 18, 13, 13, 17, 14, 2, 13, 18, 13, 17, 0, 13, 4, 13, 0, 13, 12, 4, 18, 13, 13, 14, 2, 13, 18, 13, 17, 0, 18, 13, 13, 4, 13, 17, 0, 13, 17, 0, 13, 4, 13, 14, 40, 13, 17, 4, 13, 13, 10, 17, 13, 10, 18, 13, 10, 4, 13, 10, 12, 13, 10, 17, 13, 10, 17, 13, 10, 12, 13, 10, 17, 13, 10, 12, 13, 10, 12, 13, 10, 39, 13, 10, 12, 13, 10, 12, 13, 10, 4, 13 ]
[ [ 219, 4 ], [ 204, 10 ], [ 192, 13 ], [ 220, 15 ], [ 205, 16 ], [ 216, 18 ], [ 189, 29 ], [ 42, 37 ], [ 44, 38 ], [ 44, 40 ], [ 42, 42 ], [ 44, 44 ], [ 49, 48 ], [ 55, 54 ], [ 217, 56 ], [ 55, 57 ], [ 60, 59 ], [ 48, 63 ], [ 67, 66 ], [ 217, 68 ], [ 67, 69 ], [ 72, 71 ], [ 208, 73 ], [ 54, 74 ], [ 89, 74 ], [ 66, 75 ], [ 78, 77 ], [ 208, 79 ], [ 57, 80 ], [ 93, 80 ], [ 69, 81 ], [ 84, 83 ], [ 71, 86 ], [ 77, 87 ], [ 90, 89 ], [ 66, 91 ], [ 83, 92 ], [ 94, 93 ], [ 69, 95 ], [ 83, 96 ], [ 89, 99 ], [ 54, 99 ], [ 93, 100 ], [ 57, 100 ], [ 210, 102 ], [ 112, 110 ], [ 112, 112 ], [ 119, 118 ], [ 125, 124 ], [ 118, 127 ], [ 131, 130 ], [ 124, 130 ], [ 130, 133 ], [ 193, 146 ], [ 220, 148 ], [ 228, 151 ], [ 226, 153 ], [ 213, 155 ], [ 229, 159 ], [ 193, 163 ], [ 220, 165 ], [ 171, 168 ], [ 201, 175 ], [ 195, 178 ], [ 223, 180 ], [ 196, 183 ], [ 196, 187 ], [ 189, 190 ], [ 192, 193 ], [ 195, 196 ], [ 201, 202 ], [ 204, 205 ], [ 210, 211 ], [ 213, 214 ], [ 216, 217 ], [ 219, 220 ], [ 228, 229 ] ]
[ "import sys\n\ninput_methods=['clipboard','file','key']\nusing_method=0\ninput_method=input_methods[using_method]\n\nIN=lambda : map(int, input().split())\nmod=1000000007\n\n#+++++\n\ndef ww(a,b):\n\treturn (a+b-1)//b\n\ndef main():\n\tn = int(input())\n\ta, t = IN()\n\tfor _ in range(n-1):\n\t\tap, tp = IN()\n\t\taa=ww(a,ap)\n\t\tta=ww(t,tp)\n\t\trr=max(aa,ta)\n\t\ta,t=ap*rr, tp*rr\n\treturn a+t\n\t\n\t\n\t\n\t\n#+++++\nisTest=False\n\ndef pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t\ndef input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l\n\nif __name__ == \"__main__\":\n\tif sys.platform =='ios':\n\t\tif input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\telse:\n\t\t\tpass\n\t\tisTest=True\n\telse:\n\t\tpass\n\t\t#input = sys.stdin.readline\n\t\t\t\n\tret = main()\n\tif ret is not None:\n\t\tprint(ret)", "import sys", "sys", "input_methods=['clipboard','file','key']", "input_methods", "['clipboard','file','key']", "'clipboard'", "'file'", "'key'", "using_method=0", "using_method", "0", "input_method=input_methods[using_method]", "input_method", "input_methods[using_method]", "input_methods", "using_method", "IN=lambda : map(int, input().split())", "IN", "lambda : map(int, input().split())", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "mod=1000000007", "mod", "1000000007", "def ww(a,b):\n\treturn (a+b-1)//b", "ww", "return (a+b-1)//b", "(a+b-1)//b", "a+b-1", "a+b", "a", "b", "1", "b", "a", "a", "b", "b", "def main():\n\tn = int(input())\n\ta, t = IN()\n\tfor _ in range(n-1):\n\t\tap, tp = IN()\n\t\taa=ww(a,ap)\n\t\tta=ww(t,tp)\n\t\trr=max(aa,ta)\n\t\ta,t=ap*rr, tp*rr\n\treturn a+t\n\t\n\t\n\t\n\t\n#+++++", "main", "n = int(input())", "n", "int(input())", "int", "input()", "input", "a, t = IN()", "a", "IN()", "IN", "t", "for _ in range(n-1):\n\t\tap, tp = IN()\n\t\taa=ww(a,ap)\n\t\tta=ww(t,tp)\n\t\trr=max(aa,ta)\n\t\ta,t=ap*rr, tp*rr\n\t", "_", "range(n-1)", "range", "n-1", "n", "1", "ap, tp = IN()", "ap", "IN()", "IN", "tp", "aa=ww(a,ap)", "aa", "ww(a,ap)", "ww", "a", "ap", "ta=ww(t,tp)", "ta", "ww(t,tp)", "ww", "t", "tp", "rr=max(aa,ta)", "rr", "max(aa,ta)", "max", "aa", "ta", "a,t=ap*rr, tp*rr", "a", "ap*rr", "ap", "rr", "t", "tp*rr", "tp", "rr", "return a+t", "a+t", "a", "t", "isTest=False", "isTest", "False", "def pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t", "pa", "if isTest:\n\t\tprint(v)\n\t\t", "isTest", "print(v)", "print", "v", "v", "v", "def input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l", "input_clipboard", "import clipboard", "clipboard", "input_text=clipboard.get()", "input_text", "clipboard.get()", "clipboard.get", "clipboard", "get", "input_l=input_text.splitlines()", "input_l", "input_text.splitlines()", "input_text.splitlines", "input_text", "splitlines", "for l in input_l:\n\t\tyield l", "l", "input_l", "yield l", "l", "if __name__ == \"__main__\":\n\tif sys.platform =='ios':\n\t\tif input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\telse:\n\t\t\tpass\n\t\tisTest=True\n\telse:\n\t\tpass\n\t\t#input = sys.stdin.readline\n\t\t\t\n\tret = main()\n\tif ret is not None:\n\t\tprint(ret)", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "if sys.platform =='ios':\n\t\tif input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\telse:\n\t\t\tpass\n\t\tisTest=True\n\telse:\n\t\tpass\n\t\t#input = sys.stdin.readline\n\t\t\t\n\t", "sys.platform =='ios'", "sys.platform", "sys", "platform", "'ios'", "if input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\telse:\n\t\t\tpass\n\t\t", "input_method==input_methods[0]", "input_method", "input_methods[0]", "input_methods", "0", "ic=input_clipboard()", "ic", "input_clipboard()", "input_clipboard", "input = lambda : ic.__next__()", "input", "lambda : ic.__next__()", "ic.__next__()", "ic.__next__", "ic", "__next__", "elif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\t", "input_method==input_methods[1]", "input_method", "input_methods[1]", "input_methods", "1", "sys.stdin=open('inputFile.txt')", "sys.stdin", "sys", "stdin", "open('inputFile.txt')", "open", "'inputFile.txt'", "isTest=True", "isTest", "True", "ret = main()", "ret", "main()", "main", "if ret is not None:\n\t\tprint(ret)", "ret is not None", "ret", "None", "print(ret)", "print", "ret", "mod=1000000007", "1000000007", "mod", "input_method=input_methods[using_method]", "input_methods[using_method]", "input_method", "ret = main()", "main()", "ret", "def pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t", "def pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t", "pa", "isTest=True", "True", "isTest", "using_method=0", "0", "using_method", "def ww(a,b):\n\treturn (a+b-1)//b", "def ww(a,b):\n\treturn (a+b-1)//b", "ww", "isTest=False", "False", "isTest", "input = lambda : ic.__next__()", "lambda : ic.__next__()", "input", "IN=lambda : map(int, input().split())", "lambda : map(int, input().split())", "IN", "input_methods=['clipboard','file','key']", "['clipboard','file','key']", "input_methods", "def main():\n\tn = int(input())\n\ta, t = IN()\n\tfor _ in range(n-1):\n\t\tap, tp = IN()\n\t\taa=ww(a,ap)\n\t\tta=ww(t,tp)\n\t\trr=max(aa,ta)\n\t\ta,t=ap*rr, tp*rr\n\treturn a+t\n\t\n\t\n\t\n\t\n#+++++", "def main():\n\tn = int(input())\n\ta, t = IN()\n\tfor _ in range(n-1):\n\t\tap, tp = IN()\n\t\taa=ww(a,ap)\n\t\tta=ww(t,tp)\n\t\trr=max(aa,ta)\n\t\ta,t=ap*rr, tp*rr\n\treturn a+t\n\t\n\t\n\t\n\t\n#+++++", "main", "def input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l", "def input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l", "input_clipboard", "ic=input_clipboard()", "input_clipboard()", "ic" ]
import sys input_methods=['clipboard','file','key'] using_method=0 input_method=input_methods[using_method] IN=lambda : map(int, input().split()) mod=1000000007 #+++++ def ww(a,b): return (a+b-1)//b def main(): n = int(input()) a, t = IN() for _ in range(n-1): ap, tp = IN() aa=ww(a,ap) ta=ww(t,tp) rr=max(aa,ta) a,t=ap*rr, tp*rr return a+t #+++++ isTest=False def pa(v): if isTest: print(v) def input_clipboard(): import clipboard input_text=clipboard.get() input_l=input_text.splitlines() for l in input_l: yield l if __name__ == "__main__": if sys.platform =='ios': if input_method==input_methods[0]: ic=input_clipboard() input = lambda : ic.__next__() elif input_method==input_methods[1]: sys.stdin=open('inputFile.txt') else: pass isTest=True else: pass #input = sys.stdin.readline ret = main() if ret is not None: print(ret)
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 13, 17, 0, 13, 13, 0, 13, 13, 9, 14, 2, 40, 13, 13, 40, 13, 13, 0, 13, 13, 0, 13, 13, 9, 0, 13, 4, 13, 13, 13, 0, 13, 4, 18, 13, 13, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 14, 40, 39, 13, 13, 39, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 0, 13, 4, 13, 2, 2, 13, 13, 13, 2, 2, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 0, 13, 13, 0, 13, 13, 9, 4, 13, 2, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 191, 4 ], [ 134, 10 ], [ 137, 13 ], [ 17, 16 ], [ 192, 19 ], [ 170, 21 ], [ 170, 30 ], [ 16, 33 ], [ 161, 36 ], [ 141, 37 ], [ 176, 39 ], [ 171, 40 ], [ 141, 45 ], [ 162, 46 ], [ 135, 46 ], [ 159, 46 ], [ 153, 46 ], [ 171, 48 ], [ 177, 49 ], [ 138, 49 ], [ 147, 49 ], [ 144, 49 ], [ 152, 51 ], [ 141, 52 ], [ 143, 54 ], [ 171, 55 ], [ 164, 58 ], [ 153, 61 ], [ 162, 61 ], [ 135, 61 ], [ 159, 61 ], [ 144, 62 ], [ 177, 62 ], [ 138, 62 ], [ 147, 62 ], [ 185, 64 ], [ 153, 69 ], [ 162, 69 ], [ 135, 69 ], [ 159, 69 ], [ 144, 70 ], [ 177, 70 ], [ 138, 70 ], [ 147, 70 ], [ 188, 72 ], [ 153, 74 ], [ 162, 74 ], [ 135, 74 ], [ 159, 74 ], [ 186, 75 ], [ 167, 76 ], [ 144, 78 ], [ 177, 78 ], [ 138, 78 ], [ 147, 78 ], [ 186, 79 ], [ 179, 89 ], [ 141, 91 ], [ 165, 92 ], [ 155, 93 ], [ 171, 95 ], [ 165, 96 ], [ 149, 98 ], [ 180, 103 ], [ 183, 103 ], [ 153, 104 ], [ 162, 104 ], [ 135, 104 ], [ 159, 104 ], [ 141, 105 ], [ 156, 108 ], [ 174, 108 ], [ 144, 109 ], [ 177, 109 ], [ 138, 109 ], [ 147, 109 ], [ 171, 110 ], [ 182, 112 ], [ 141, 114 ], [ 150, 115 ], [ 173, 117 ], [ 171, 119 ], [ 150, 120 ], [ 158, 122 ], [ 183, 123 ], [ 180, 123 ], [ 146, 125 ], [ 174, 126 ], [ 156, 126 ], [ 159, 131 ], [ 153, 131 ], [ 162, 131 ], [ 135, 131 ], [ 147, 132 ], [ 144, 132 ], [ 177, 132 ], [ 138, 132 ], [ 134, 135 ], [ 137, 138 ], [ 170, 141 ], [ 171, 143 ], [ 143, 144 ], [ 174, 146 ], [ 156, 146 ], [ 146, 147 ], [ 149, 150 ], [ 141, 152 ], [ 152, 153 ], [ 155, 156 ], [ 183, 158 ], [ 180, 158 ], [ 158, 159 ], [ 141, 161 ], [ 161, 162 ], [ 164, 165 ], [ 167, 168 ], [ 170, 171 ], [ 173, 174 ], [ 171, 176 ], [ 176, 177 ], [ 179, 180 ], [ 182, 183 ], [ 185, 186 ], [ 188, 189 ], [ 191, 192 ] ]
[ "import math\nN = int(input())\n\nt = 0\na = 0\nfor i in range(N):\n T, A = map(int, input().split())\n if i == 0:\n t += T\n a += A\n continue\n if (T >= t and A >= a):\n t = T\n a = A\n continue\n\n max_ta = max(t, a)\n g = math.gcd(t, a)\n tg, ag = t // g, a // g\n if (T, A) != (tg, ag):\n sum_t, sum_a = T * max_ta, A * max_ta\n # print(sum_t, sum_a)\n\n cout_sn = min((sum_t - t) // T, (sum_a - a) // A)\n # while True:\n sum_t -= T * cout_sn\n sum_a -= A * cout_sn\n # if sum_t < t or sum_a < a:\n # sum_t += T\n # sum_a += A\n # break\n t = sum_t\n a = sum_a\n continue\n\nprint(t + a)", "import math", "math", "N = int(input())", "N", "int(input())", "int", "input()", "input", "t = 0", "t", "0", "a = 0", "a", "0", "for i in range(N):\n T, A = map(int, input().split())\n if i == 0:\n t += T\n a += A\n continue\n if (T >= t and A >= a):\n t = T\n a = A\n continue\n\n max_ta = max(t, a)\n g = math.gcd(t, a)\n tg, ag = t // g, a // g\n if (T, A) != (tg, ag):\n sum_t, sum_a = T * max_ta, A * max_ta\n # print(sum_t, sum_a)\n\n cout_sn = min((sum_t - t) // T, (sum_a - a) // A)\n # while True:\n sum_t -= T * cout_sn\n sum_a -= A * cout_sn\n # if sum_t < t or sum_a < a:\n # sum_t += T\n # sum_a += A\n # break\n t = sum_t\n a = sum_a\n continue", "i", "range(N)", "range", "N", "T, A = map(int, input().split())", "T", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "if i == 0:\n t += T\n a += A\n continue\n ", "i == 0", "i", "0", "t += T", "t", "T", "a += A", "a", "A", "continue", "if (T >= t and A >= a):\n t = T\n a = A\n continue\n\n ", "T >= t and A >= a", "T >= t", "T", "t", "A >= a", "A", "a", "t = T", "t", "T", "a = A", "a", "A", "continue", "max_ta = max(t, a)", "max_ta", "max(t, a)", "max", "t", "a", "g = math.gcd(t, a)", "g", "math.gcd(t, a)", "math.gcd", "math", "gcd", "t", "a", "tg, ag = t // g, a // g", "tg", "t // g", "t", "g", "ag", "a // g", "a", "g", "if (T, A) != (tg, ag):\n sum_t, sum_a = T * max_ta, A * max_ta\n # print(sum_t, sum_a)\n\n cout_sn = min((sum_t - t) // T, (sum_a - a) // A)\n # while True:\n sum_t -= T * cout_sn\n sum_a -= A * cout_sn\n # if sum_t < t or sum_a < a:\n # sum_t += T\n # sum_a += A\n # break\n t = sum_t\n a = sum_a\n continue", "(T, A) != (tg, ag)", "(T, A)", "T", "A", "(tg, ag)", "tg", "ag", "sum_t, sum_a = T * max_ta, A * max_ta", "sum_t", "T * max_ta", "T", "max_ta", "sum_a", "A * max_ta", "A", "max_ta", "cout_sn = min((sum_t - t) // T, (sum_a - a) // A)", "cout_sn", "min((sum_t - t) // T, (sum_a - a) // A)", "min", "(sum_t - t) // T", "sum_t - t", "sum_t", "t", "T", "(sum_a - a) // A", "sum_a - a", "sum_a", "a", "A", "sum_t -= T * cout_sn", "sum_t", "T * cout_sn", "T", "cout_sn", "sum_a -= A * cout_sn", "sum_a", "A * cout_sn", "A", "cout_sn", "t = sum_t", "t", "sum_t", "a = sum_a", "a", "sum_a", "continue", "print(t + a)", "print", "t + a", "t", "a", "t = 0", "0", "t", "a = 0", "0", "a", "T, A = map(int, input().split())", "map(int, input().split())", "T", "a = A", "A", "a", "a = sum_a", "sum_a", "a", "cout_sn = min((sum_t - t) // T, (sum_a - a) // A)", "min((sum_t - t) // T, (sum_a - a) // A)", "cout_sn", "t = T", "T", "t", "sum_a = T * max_ta, A * max_ta", "A * max_ta", "sum_a", "t = sum_t", "sum_t", "t", "t += T", "T", "t", "max_ta = max(t, a)", "max(t, a)", "max_ta", "ag = t // g, a // g", "a // g", "ag", "A = map(int, input().split())", "map(int, input().split())", "A", "sum_a -= A * cout_sn", "A * cout_sn", "sum_a", "a += A", "A", "a", "sum_t, sum_a = T * max_ta, A * max_ta", "T * max_ta", "sum_t", "sum_t -= T * cout_sn", "T * cout_sn", "sum_t", "g = math.gcd(t, a)", "math.gcd(t, a)", "g", "tg, ag = t // g, a // g", "t // g", "tg", "N = int(input())", "int(input())", "N" ]
import math N = int(input()) t = 0 a = 0 for i in range(N): T, A = map(int, input().split()) if i == 0: t += T a += A continue if (T >= t and A >= a): t = T a = A continue max_ta = max(t, a) g = math.gcd(t, a) tg, ag = t // g, a // g if (T, A) != (tg, ag): sum_t, sum_a = T * max_ta, A * max_ta # print(sum_t, sum_a) cout_sn = min((sum_t - t) // T, (sum_a - a) // A) # while True: sum_t -= T * cout_sn sum_a -= A * cout_sn # if sum_t < t or sum_a < a: # sum_t += T # sum_a += A # break t = sum_t a = sum_a continue print(t + a)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 2, 2, 2, 13, 13, 17, 13, 13, 0, 13, 2, 2, 2, 2, 13, 13, 17, 13, 13, 0, 13, 2, 2, 2, 2, 13, 13, 17, 13, 13, 0, 13, 2, 2, 2, 2, 13, 13, 17, 13, 13, 14, 2, 13, 13, 0, 13, 13, 13, 13, 0, 13, 13, 13, 13, 4, 13, 2, 13, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 13, 13 ]
[ [ 124, 2 ], [ 121, 8 ], [ 121, 17 ], [ 20, 19 ], [ 125, 23 ], [ 109, 26 ], [ 109, 35 ], [ 103, 37 ], [ 119, 42 ], [ 128, 42 ], [ 134, 42 ], [ 110, 43 ], [ 110, 45 ], [ 110, 46 ], [ 115, 48 ], [ 119, 53 ], [ 128, 53 ], [ 134, 53 ], [ 110, 54 ], [ 110, 56 ], [ 101, 57 ], [ 106, 59 ], [ 122, 64 ], [ 113, 64 ], [ 137, 64 ], [ 101, 65 ], [ 101, 67 ], [ 110, 68 ], [ 130, 70 ], [ 122, 75 ], [ 113, 75 ], [ 137, 75 ], [ 101, 76 ], [ 101, 78 ], [ 101, 79 ], [ 116, 82 ], [ 122, 83 ], [ 113, 83 ], [ 137, 83 ], [ 133, 85 ], [ 107, 86 ], [ 136, 87 ], [ 131, 88 ], [ 127, 90 ], [ 104, 91 ], [ 112, 92 ], [ 116, 93 ], [ 128, 97 ], [ 134, 97 ], [ 119, 97 ], [ 113, 98 ], [ 137, 98 ], [ 122, 98 ], [ 109, 101 ], [ 103, 104 ], [ 106, 107 ], [ 109, 110 ], [ 116, 112 ], [ 112, 113 ], [ 115, 116 ], [ 121, 119 ], [ 121, 122 ], [ 124, 125 ], [ 104, 127 ], [ 127, 128 ], [ 130, 131 ], [ 107, 133 ], [ 133, 134 ], [ 131, 136 ], [ 136, 137 ] ]
[ "N = int(input())\nT,A = map(int,input().split())\nfor i in range(N-1):\n t,a = map(int,input().split())\n T1 = (T+t-1)//t*t\n A1 = (T+t-1)//t*a\n T2 = (A+a-1)//a*t\n A2 = (A+a-1)//a*a\n if A1 < A:\n T,A = T2,A2\n else:\n T,A = T1,A1\nprint(T+A)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "T,A = map(int,input().split())", "T", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "for i in range(N-1):\n t,a = map(int,input().split())\n T1 = (T+t-1)//t*t\n A1 = (T+t-1)//t*a\n T2 = (A+a-1)//a*t\n A2 = (A+a-1)//a*a\n if A1 < A:\n T,A = T2,A2\n else:\n T,A = T1,A1", "i", "range(N-1)", "range", "N-1", "N", "1", "t,a = map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "T1 = (T+t-1)//t*t", "T1", "(T+t-1)//t*t", "(T+t-1)//t", "T+t-1", "T+t", "T", "t", "1", "t", "t", "A1 = (T+t-1)//t*a", "A1", "(T+t-1)//t*a", "(T+t-1)//t", "T+t-1", "T+t", "T", "t", "1", "t", "a", "T2 = (A+a-1)//a*t", "T2", "(A+a-1)//a*t", "(A+a-1)//a", "A+a-1", "A+a", "A", "a", "1", "a", "t", "A2 = (A+a-1)//a*a", "A2", "(A+a-1)//a*a", "(A+a-1)//a", "A+a-1", "A+a", "A", "a", "1", "a", "a", "if A1 < A:\n T,A = T2,A2\n else:\n T,A = T1,A1", "A1 < A", "A1", "A", "T,A = T2,A2", "T", "T2", "A", "A2", "T,A = T1,A1", "T", "T1", "A", "A1", "print(T+A)", "print", "T+A", "T", "A", "a = map(int,input().split())", "map(int,input().split())", "a", "T1 = (T+t-1)//t*t", "(T+t-1)//t*t", "T1", "T2 = (A+a-1)//a*t", "(A+a-1)//a*t", "T2", "t,a = map(int,input().split())", "map(int,input().split())", "t", "A = T1,A1", "A1", "A", "A1 = (T+t-1)//t*a", "(T+t-1)//t*a", "A1", "T,A = map(int,input().split())", "map(int,input().split())", "T", "A = map(int,input().split())", "map(int,input().split())", "A", "N = int(input())", "int(input())", "N", "T,A = T1,A1", "T1", "T", "A2 = (A+a-1)//a*a", "(A+a-1)//a*a", "A2", "T,A = T2,A2", "T2", "T", "A = T2,A2", "A2", "A" ]
N = int(input()) T,A = map(int,input().split()) for i in range(N-1): t,a = map(int,input().split()) T1 = (T+t-1)//t*t A1 = (T+t-1)//t*a T2 = (A+a-1)//a*t A2 = (A+a-1)//a*a if A1 < A: T,A = T2,A2 else: T,A = T1,A1 print(T+A)
[ 7, 15, 13, 15, 13, 15, 13, 15, 13, 15, 15, 13, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 17, 13, 17, 28, 13, 13, 13, 0, 13, 4, 13, 2, 17, 2, 40, 13, 13, 2, 17, 2, 40, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 13, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13 ]
[ [ 90, 13 ], [ 21, 20 ], [ 91, 23 ], [ 78, 36 ], [ 81, 39 ], [ 93, 41 ], [ 87, 48 ], [ 82, 55 ], [ 85, 55 ], [ 94, 61 ], [ 97, 61 ], [ 84, 64 ], [ 88, 66 ], [ 96, 68 ], [ 88, 70 ], [ 85, 75 ], [ 82, 75 ], [ 97, 76 ], [ 94, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ], [ 90, 91 ], [ 93, 94 ], [ 96, 97 ] ]
[ "#coding: utf-8\nimport math\nimport heapq\nimport bisect\nimport numpy as np\nfrom collections import Counter, deque\nimport itertools\n#from scipy.misc import comb\n\nN = int(input())\nL = [list(map(int, input().split())) for i in range(N)]\n\nA, B = 1, 1\nfor x,y in L:\n n = max(0-(-A//x), 0-(-B//y))\n A, B = n*x, n*y\n\nprint(A+B)", "import math", "math", "import heapq", "heapq", "import bisect", "bisect", "import numpy as np", "numpy", "from collections import Counter, deque", "import itertools", "itertools", "N = int(input())", "N", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for i in range(N)", "for i in range(N)", "i", "range(N)", "range", "N", "for i in range(N)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "L = [list(map(int, input().split())) for i in range(N)]", "L", "[list(map(int, input().split())) for i in range(N)]", "A, B = 1, 1", "A", "1", "B", "1", "for x,y in L:\n n = max(0-(-A//x), 0-(-B//y))\n A, B = n*x, n*y", "x", "y", "L", "n = max(0-(-A//x), 0-(-B//y))", "n", "max(0-(-A//x), 0-(-B//y))", "max", "0-(-A//x)", "0", "-A//x", "-A", "A", "x", "0-(-B//y)", "0", "-B//y", "-B", "B", "y", "A, B = n*x, n*y", "A", "n*x", "n", "x", "B", "n*y", "n", "y", "print(A+B)", "print", "A+B", "A", "B", "L = [list(map(int, input().split())) for i in range(N)]", "[list(map(int, input().split())) for i in range(N)]", "L", "A, B = 1, 1", "1", "A", "A, B = n*x, n*y", "n*x", "A", "n = max(0-(-A//x), 0-(-B//y))", "max(0-(-A//x), 0-(-B//y))", "n", "N = int(input())", "int(input())", "N", "B = 1, 1", "1", "B", "B = n*x, n*y", "n*y", "B" ]
#coding: utf-8 import math import heapq import bisect import numpy as np from collections import Counter, deque import itertools #from scipy.misc import comb N = int(input()) L = [list(map(int, input().split())) for i in range(N)] A, B = 1, 1 for x,y in L: n = max(0-(-A//x), 0-(-B//y)) A, B = n*x, n*y print(A+B)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 2, 2, 2, 13, 17, 13, 17, 14, 2, 13, 13, 0, 13, 2, 2, 2, 13, 17, 13, 17, 0, 13, 2, 4, 13, 13, 13, 13, 0, 13, 2, 4, 13, 13, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 95, 2 ], [ 98, 8 ], [ 113, 11 ], [ 15, 14 ], [ 96, 17 ], [ 92, 19 ], [ 92, 28 ], [ 104, 30 ], [ 110, 33 ], [ 99, 37 ], [ 102, 37 ], [ 87, 38 ], [ 107, 40 ], [ 99, 44 ], [ 102, 44 ], [ 87, 46 ], [ 114, 50 ], [ 90, 50 ], [ 93, 51 ], [ 83, 53 ], [ 114, 57 ], [ 90, 57 ], [ 93, 59 ], [ 101, 62 ], [ 108, 66 ], [ 105, 66 ], [ 84, 67 ], [ 111, 67 ], [ 87, 68 ], [ 89, 70 ], [ 108, 74 ], [ 105, 74 ], [ 84, 75 ], [ 111, 75 ], [ 93, 76 ], [ 102, 80 ], [ 99, 80 ], [ 90, 81 ], [ 114, 81 ], [ 83, 84 ], [ 92, 87 ], [ 89, 90 ], [ 92, 93 ], [ 95, 96 ], [ 98, 99 ], [ 101, 102 ], [ 104, 105 ], [ 107, 108 ], [ 110, 111 ], [ 113, 114 ] ]
[ "N=int(input())\nT=1\nA=1\nfor i in range(N):\n x,y=map(int,input().split())\n d1=1\n d2=1\n if T>x:\n d1=(T-1)//x+1\n if A>y:\n d2=(A-1)//y+1\n T=max(d1,d2)*x\n A=max(d1,d2)*y\n\nprint(T+A)", "N=int(input())", "N", "int(input())", "int", "input()", "input", "T=1", "T", "1", "A=1", "A", "1", "for i in range(N):\n x,y=map(int,input().split())\n d1=1\n d2=1\n if T>x:\n d1=(T-1)//x+1\n if A>y:\n d2=(A-1)//y+1\n T=max(d1,d2)*x\n A=max(d1,d2)*y", "i", "range(N)", "range", "N", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "d1=1", "d1", "1", "d2=1", "d2", "1", "if T>x:\n d1=(T-1)//x+1\n ", "T>x", "T", "x", "d1=(T-1)//x+1", "d1", "(T-1)//x+1", "(T-1)//x", "T-1", "T", "1", "x", "1", "if A>y:\n d2=(A-1)//y+1\n ", "A>y", "A", "y", "d2=(A-1)//y+1", "d2", "(A-1)//y+1", "(A-1)//y", "A-1", "A", "1", "y", "1", "T=max(d1,d2)*x", "T", "max(d1,d2)*x", "max(d1,d2)", "max", "d1", "d2", "x", "A=max(d1,d2)*y", "A", "max(d1,d2)*y", "max(d1,d2)", "max", "d1", "d2", "y", "print(T+A)", "print", "T+A", "T", "A", "d2=(A-1)//y+1", "(A-1)//y+1", "d2", "x,y=map(int,input().split())", "map(int,input().split())", "x", "A=max(d1,d2)*y", "max(d1,d2)*y", "A", "y=map(int,input().split())", "map(int,input().split())", "y", "N=int(input())", "int(input())", "N", "T=1", "1", "T", "T=max(d1,d2)*x", "max(d1,d2)*x", "T", "d1=1", "1", "d1", "d1=(T-1)//x+1", "(T-1)//x+1", "d1", "d2=1", "1", "d2", "A=1", "1", "A" ]
N=int(input()) T=1 A=1 for i in range(N): x,y=map(int,input().split()) d1=1 d2=1 if T>x: d1=(T-1)//x+1 if A>y: d2=(A-1)//y+1 T=max(d1,d2)*x A=max(d1,d2)*y print(T+A)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 85, 2 ], [ 91, 8 ], [ 91, 17 ], [ 20, 19 ], [ 86, 23 ], [ 76, 26 ], [ 76, 35 ], [ 88, 37 ], [ 83, 43 ], [ 80, 43 ], [ 77, 44 ], [ 77, 46 ], [ 92, 50 ], [ 71, 50 ], [ 74, 51 ], [ 74, 53 ], [ 79, 55 ], [ 77, 57 ], [ 89, 58 ], [ 70, 60 ], [ 74, 62 ], [ 89, 63 ], [ 80, 67 ], [ 83, 67 ], [ 71, 68 ], [ 92, 68 ], [ 70, 71 ], [ 76, 74 ], [ 76, 77 ], [ 79, 80 ], [ 91, 83 ], [ 85, 86 ], [ 88, 89 ], [ 91, 92 ] ]
[ "N = int(input())\nT,A = map(int,input().split())\nfor i in range(N-1):\n t,a = map(int,input().split())\n pro = max((T+t-1)//t,(A+a-1)//a)\n T = t*pro\n A = a*pro\nprint(T+A)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "T,A = map(int,input().split())", "T", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "for i in range(N-1):\n t,a = map(int,input().split())\n pro = max((T+t-1)//t,(A+a-1)//a)\n T = t*pro\n A = a*pro", "i", "range(N-1)", "range", "N-1", "N", "1", "t,a = map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "pro = max((T+t-1)//t,(A+a-1)//a)", "pro", "max((T+t-1)//t,(A+a-1)//a)", "max", "(T+t-1)//t", "T+t-1", "T+t", "T", "t", "1", "t", "(A+a-1)//a", "A+a-1", "A+a", "A", "a", "1", "a", "T = t*pro", "T", "t*pro", "t", "pro", "A = a*pro", "A", "a*pro", "a", "pro", "print(T+A)", "print", "T+A", "T", "A", "A = a*pro", "a*pro", "A", "a = map(int,input().split())", "map(int,input().split())", "a", "t,a = map(int,input().split())", "map(int,input().split())", "t", "T = t*pro", "t*pro", "T", "T,A = map(int,input().split())", "map(int,input().split())", "T", "N = int(input())", "int(input())", "N", "pro = max((T+t-1)//t,(A+a-1)//a)", "max((T+t-1)//t,(A+a-1)//a)", "pro", "A = map(int,input().split())", "map(int,input().split())", "A" ]
N = int(input()) T,A = map(int,input().split()) for i in range(N-1): t,a = map(int,input().split()) pro = max((T+t-1)//t,(A+a-1)//a) T = t*pro A = a*pro print(T+A)
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 17, 0, 13, 17, 14, 2, 18, 18, 13, 2, 13, 17, 17, 18, 18, 13, 13, 17, 0, 13, 40, 2, 40, 18, 18, 13, 13, 17, 18, 18, 13, 2, 13, 17, 17, 14, 2, 18, 18, 13, 2, 13, 17, 17, 18, 18, 13, 13, 17, 0, 13, 40, 2, 40, 18, 18, 13, 13, 17, 18, 18, 13, 2, 13, 17, 17, 0, 18, 18, 13, 2, 13, 17, 17, 4, 13, 13, 13, 0, 18, 18, 13, 2, 13, 17, 17, 4, 13, 13, 13, 4, 13, 4, 13, 18, 13, 17, 10, 40, 13, 10, 17, 13, 10, 4, 13, 10, 40, 13, 10, 13, 13, 10, 17, 13 ]
[ [ 140, 2 ], [ 10, 9 ], [ 141, 12 ], [ 146, 25 ], [ 29, 28 ], [ 141, 32 ], [ 137, 35 ], [ 149, 38 ], [ 147, 44 ], [ 28, 46 ], [ 147, 51 ], [ 28, 52 ], [ 134, 55 ], [ 147, 61 ], [ 28, 62 ], [ 147, 66 ], [ 28, 68 ], [ 147, 75 ], [ 28, 77 ], [ 147, 82 ], [ 28, 83 ], [ 143, 86 ], [ 147, 92 ], [ 28, 93 ], [ 147, 97 ], [ 28, 99 ], [ 110, 103 ], [ 147, 105 ], [ 28, 107 ], [ 135, 112 ], [ 138, 112 ], [ 144, 113 ], [ 150, 113 ], [ 122, 115 ], [ 147, 117 ], [ 28, 119 ], [ 135, 124 ], [ 138, 124 ], [ 144, 125 ], [ 150, 125 ], [ 147, 131 ], [ 134, 135 ], [ 137, 138 ], [ 140, 141 ], [ 143, 144 ], [ 146, 147 ], [ 149, 150 ] ]
[ "n=int(input())\nl=[list(map(int, input().split())) for i in range(n)]\nfor i in range(n-1):\n a=1\n b=1\n if l[i+1][0]<l[i][0]:\n a=-(-l[i][0]//l[i+1][0])\n if l[i+1][1]<l[i][1]:\n b=-(-l[i][1]//l[i+1][1])\n l[i+1][0]*=max(a,b)\n l[i+1][1]*=max(a,b)\nprint(sum(l[-1]))", "n=int(input())", "n", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "l=[list(map(int, input().split())) for i in range(n)]", "l", "[list(map(int, input().split())) for i in range(n)]", "for i in range(n-1):\n a=1\n b=1\n if l[i+1][0]<l[i][0]:\n a=-(-l[i][0]//l[i+1][0])\n if l[i+1][1]<l[i][1]:\n b=-(-l[i][1]//l[i+1][1])\n l[i+1][0]*=max(a,b)\n l[i+1][1]*=max(a,b)", "i", "range(n-1)", "range", "n-1", "n", "1", "a=1", "a", "1", "b=1", "b", "1", "if l[i+1][0]<l[i][0]:\n a=-(-l[i][0]//l[i+1][0])\n ", "l[i+1][0]<l[i][0]", "l[i+1][0]", "[i+1]", "l", "i+1", "i", "1", "0", "l[i][0]", "[i]", "l", "i", "0", "a=-(-l[i][0]//l[i+1][0])", "a", "-(-l[i][0]//l[i+1][0])", "-l[i][0]//l[i+1][0]", "-l[i][0]", "l[i][0]", "[i]", "l", "i", "0", "l[i+1][0]", "[i+1]", "l", "i+1", "i", "1", "0", "if l[i+1][1]<l[i][1]:\n b=-(-l[i][1]//l[i+1][1])\n ", "l[i+1][1]<l[i][1]", "l[i+1][1]", "[i+1]", "l", "i+1", "i", "1", "1", "l[i][1]", "[i]", "l", "i", "1", "b=-(-l[i][1]//l[i+1][1])", "b", "-(-l[i][1]//l[i+1][1])", "-l[i][1]//l[i+1][1]", "-l[i][1]", "l[i][1]", "[i]", "l", "i", "1", "l[i+1][1]", "[i+1]", "l", "i+1", "i", "1", "1", "l[i+1][0]*=max(a,b)", "l[i+1][0]", "[i+1]", "l", "i+1", "i", "1", "0", "max(a,b)", "max", "a", "b", "l[i+1][1]*=max(a,b)", "l[i+1][1]", "[i+1]", "l", "i+1", "i", "1", "1", "max(a,b)", "max", "a", "b", "print(sum(l[-1]))", "print", "sum(l[-1])", "sum", "l[-1]", "l", "-1", "a=-(-l[i][0]//l[i+1][0])", "-(-l[i][0]//l[i+1][0])", "a", "a=1", "1", "a", "n=int(input())", "int(input())", "n", "b=-(-l[i][1]//l[i+1][1])", "-(-l[i][1]//l[i+1][1])", "b", "l=[list(map(int, input().split())) for i in range(n)]", "[list(map(int, input().split())) for i in range(n)]", "l", "b=1", "1", "b" ]
n=int(input()) l=[list(map(int, input().split())) for i in range(n)] for i in range(n-1): a=1 b=1 if l[i+1][0]<l[i][0]: a=-(-l[i][0]//l[i+1][0]) if l[i+1][1]<l[i][1]: b=-(-l[i][1]//l[i+1][1]) l[i+1][0]*=max(a,b) l[i+1][1]*=max(a,b) print(sum(l[-1]))
[ 7, 15, 13, 12, 13, 0, 13, 18, 18, 13, 13, 13, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 18, 4, 13, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 18, 4, 13, 13, 13, 13, 0, 13, 4, 13, 2, 13, 13, 2, 13, 13, 28, 13, 4, 13, 13, 2, 13, 17, 14, 2, 40, 2, 13, 13, 13, 40, 2, 13, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 3, 4, 13, 2, 13, 13, 29, 14, 40, 17, 4, 13, 4, 13, 4, 18, 13, 13, 10, 12, 13 ]
[ [ 7, 6 ], [ 14, 13 ], [ 6, 17 ], [ 20, 19 ], [ 6, 28 ], [ 20, 31 ], [ 34, 33 ], [ 13, 37 ], [ 41, 40 ], [ 6, 49 ], [ 41, 52 ], [ 55, 54 ], [ 19, 58 ], [ 84, 58 ], [ 40, 59 ], [ 31, 61 ], [ 88, 61 ], [ 52, 62 ], [ 65, 64 ], [ 54, 67 ], [ 54, 69 ], [ 40, 75 ], [ 64, 76 ], [ 19, 77 ], [ 84, 77 ], [ 52, 80 ], [ 64, 81 ], [ 31, 82 ], [ 88, 82 ], [ 85, 84 ], [ 40, 86 ], [ 64, 87 ], [ 89, 88 ], [ 52, 90 ], [ 64, 91 ], [ 84, 96 ], [ 19, 96 ], [ 88, 97 ], [ 31, 97 ], [ 112, 105 ] ]
[ "import sys\n\ndef resolve():\n readline=sys.stdin.readline\n\n n=int(readline())\n a,b=map(int, readline().rstrip().split())\n for _ in range(n-1):\n x,y=map(int, readline().rstrip().split())\n start=max(a//x,b//y)\n for z in range(start,start+1000):\n if x*z>=a and y*z>=b:\n a,b=x*z,y*z\n break\n print(a+b)\n\n return\n\nif 'doTest' not in globals():\n resolve()\n sys.exit()", "import sys", "sys", "def resolve():\n readline=sys.stdin.readline\n\n n=int(readline())\n a,b=map(int, readline().rstrip().split())\n for _ in range(n-1):\n x,y=map(int, readline().rstrip().split())\n start=max(a//x,b//y)\n for z in range(start,start+1000):\n if x*z>=a and y*z>=b:\n a,b=x*z,y*z\n break\n print(a+b)\n\n return", "resolve", "readline=sys.stdin.readline", "readline", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "n=int(readline())", "n", "int(readline())", "int", "readline()", "readline", "a,b=map(int, readline().rstrip().split())", "a", "map(int, readline().rstrip().split())", "map", "int", "readline().rstrip().split()", "().rstrip().split", "().rstrip()", "().rstrip", "()", "readline", "rstrip", "split", "b", "for _ in range(n-1):\n x,y=map(int, readline().rstrip().split())\n start=max(a//x,b//y)\n for z in range(start,start+1000):\n if x*z>=a and y*z>=b:\n a,b=x*z,y*z\n break\n ", "_", "range(n-1)", "range", "n-1", "n", "1", "x,y=map(int, readline().rstrip().split())", "x", "map(int, readline().rstrip().split())", "map", "int", "readline().rstrip().split()", "().rstrip().split", "().rstrip()", "().rstrip", "()", "readline", "rstrip", "split", "y", "start=max(a//x,b//y)", "start", "max(a//x,b//y)", "max", "a//x", "a", "x", "b//y", "b", "y", "for z in range(start,start+1000):\n if x*z>=a and y*z>=b:\n a,b=x*z,y*z\n break\n ", "z", "range(start,start+1000)", "range", "start", "start+1000", "start", "1000", "if x*z>=a and y*z>=b:\n a,b=x*z,y*z\n break\n ", "x*z>=a and y*z>=b", "x*z>=a", "x*z", "x", "z", "a", "y*z>=b", "y*z", "y", "z", "b", "a,b=x*z,y*z", "a", "x*z", "x", "z", "b", "y*z", "y", "z", "break", "print(a+b)", "print", "a+b", "a", "b", "return", "if 'doTest' not in globals():\n resolve()\n sys.exit()", "'doTest' not in globals()", "'doTest'", "globals()", "globals", "resolve()", "resolve", "sys.exit()", "sys.exit", "sys", "exit", "def resolve():\n readline=sys.stdin.readline\n\n n=int(readline())\n a,b=map(int, readline().rstrip().split())\n for _ in range(n-1):\n x,y=map(int, readline().rstrip().split())\n start=max(a//x,b//y)\n for z in range(start,start+1000):\n if x*z>=a and y*z>=b:\n a,b=x*z,y*z\n break\n print(a+b)\n\n return", "def resolve():\n readline=sys.stdin.readline\n\n n=int(readline())\n a,b=map(int, readline().rstrip().split())\n for _ in range(n-1):\n x,y=map(int, readline().rstrip().split())\n start=max(a//x,b//y)\n for z in range(start,start+1000):\n if x*z>=a and y*z>=b:\n a,b=x*z,y*z\n break\n print(a+b)\n\n return", "resolve" ]
import sys def resolve(): readline=sys.stdin.readline n=int(readline()) a,b=map(int, readline().rstrip().split()) for _ in range(n-1): x,y=map(int, readline().rstrip().split()) start=max(a//x,b//y) for z in range(start,start+1000): if x*z>=a and y*z>=b: a,b=x*z,y*z break print(a+b) return if 'doTest' not in globals(): resolve() sys.exit()
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 94, 2 ], [ 103, 8 ], [ 103, 17 ], [ 20, 19 ], [ 95, 23 ], [ 97, 26 ], [ 97, 35 ], [ 79, 37 ], [ 104, 41 ], [ 89, 41 ], [ 86, 42 ], [ 86, 44 ], [ 100, 46 ], [ 83, 50 ], [ 77, 50 ], [ 98, 51 ], [ 98, 53 ], [ 91, 55 ], [ 80, 58 ], [ 101, 59 ], [ 88, 61 ], [ 86, 63 ], [ 92, 64 ], [ 76, 66 ], [ 98, 68 ], [ 92, 69 ], [ 89, 73 ], [ 104, 73 ], [ 77, 74 ], [ 83, 74 ], [ 76, 77 ], [ 79, 80 ], [ 103, 83 ], [ 97, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 103, 104 ] ]
[ "n=int(input())\n\nx,y=map(int,input().split())\nfor i in range(n-1):\n t,a=map(int,input().split())\n k=(x+t-1)//t\n m=(y+a-1)//a\n p=max(k,m)\n x=t*p\n y=a*p\nprint(x+y)", "n=int(input())", "n", "int(input())", "int", "input()", "input", "x,y=map(int,input().split())", "x", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "y", "for i in range(n-1):\n t,a=map(int,input().split())\n k=(x+t-1)//t\n m=(y+a-1)//a\n p=max(k,m)\n x=t*p\n y=a*p", "i", "range(n-1)", "range", "n-1", "n", "1", "t,a=map(int,input().split())", "t", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "k=(x+t-1)//t", "k", "(x+t-1)//t", "x+t-1", "x+t", "x", "t", "1", "t", "m=(y+a-1)//a", "m", "(y+a-1)//a", "y+a-1", "y+a", "y", "a", "1", "a", "p=max(k,m)", "p", "max(k,m)", "max", "k", "m", "x=t*p", "x", "t*p", "t", "p", "y=a*p", "y", "a*p", "a", "p", "print(x+y)", "print", "x+y", "x", "y", "y=a*p", "a*p", "y", "k=(x+t-1)//t", "(x+t-1)//t", "k", "y=map(int,input().split())", "map(int,input().split())", "y", "t,a=map(int,input().split())", "map(int,input().split())", "t", "x=t*p", "t*p", "x", "p=max(k,m)", "max(k,m)", "p", "n=int(input())", "int(input())", "n", "a=map(int,input().split())", "map(int,input().split())", "a", "m=(y+a-1)//a", "(y+a-1)//a", "m", "x,y=map(int,input().split())", "map(int,input().split())", "x" ]
n=int(input()) x,y=map(int,input().split()) for i in range(n-1): t,a=map(int,input().split()) k=(x+t-1)//t m=(y+a-1)//a p=max(k,m) x=t*p y=a*p print(x+y)
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 18, 13, 13, 13, 14, 2, 2, 13, 13, 2, 13, 13, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 4, 13, 13, 13, 0, 13, 13, 0, 13, 13, 0, 13, 13, 0, 13, 13, 4, 13, 2, 13, 13, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 17, 13, 10, 18, 13, 10, 13, 13, 10, 13, 13, 10, 17, 13, 10, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 18, 13 ]
[ [ 127, 2 ], [ 10, 9 ], [ 128, 12 ], [ 94, 25 ], [ 103, 28 ], [ 115, 31 ], [ 35, 34 ], [ 128, 37 ], [ 130, 39 ], [ 95, 41 ], [ 34, 42 ], [ 130, 43 ], [ 104, 47 ], [ 110, 47 ], [ 107, 48 ], [ 101, 48 ], [ 116, 50 ], [ 119, 50 ], [ 131, 51 ], [ 113, 51 ], [ 97, 53 ], [ 104, 57 ], [ 110, 57 ], [ 107, 58 ], [ 101, 58 ], [ 107, 60 ], [ 101, 60 ], [ 121, 62 ], [ 116, 66 ], [ 119, 66 ], [ 131, 67 ], [ 113, 67 ], [ 131, 69 ], [ 113, 69 ], [ 124, 71 ], [ 98, 74 ], [ 122, 75 ], [ 100, 77 ], [ 125, 78 ], [ 112, 80 ], [ 125, 81 ], [ 109, 83 ], [ 101, 84 ], [ 107, 84 ], [ 118, 86 ], [ 113, 87 ], [ 131, 87 ], [ 110, 91 ], [ 104, 91 ], [ 119, 92 ], [ 116, 92 ], [ 94, 95 ], [ 97, 98 ], [ 125, 100 ], [ 100, 101 ], [ 103, 104 ], [ 130, 107 ], [ 101, 109 ], [ 107, 109 ], [ 109, 110 ], [ 125, 112 ], [ 112, 113 ], [ 115, 116 ], [ 113, 118 ], [ 131, 118 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ], [ 127, 128 ], [ 130, 131 ] ]
[ "N = int(input())\nTA = [list(map(int, input().split())) for i in range(N)]\n\nt = 1\na = 1\n\nfor i in range(N):\n T, A = TA[i]\n if t > T or a > A:\n tmul = (t+T-1) // T\n amul = (a+A-1) // A\n mul = max(tmul, amul)\n T *= mul\n A *= mul\n t = T\n a = A\nprint(t+a)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "list(map(int, input().split())) for i in range(N)", "for i in range(N)", "i", "range(N)", "range", "N", "for i in range(N)", "list(map(int, input().split()))", "list", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "TA = [list(map(int, input().split())) for i in range(N)]", "TA", "[list(map(int, input().split())) for i in range(N)]", "t = 1", "t", "1", "a = 1", "a", "1", "for i in range(N):\n T, A = TA[i]\n if t > T or a > A:\n tmul = (t+T-1) // T\n amul = (a+A-1) // A\n mul = max(tmul, amul)\n T *= mul\n A *= mul\n t = T\n a = A", "i", "range(N)", "range", "N", "T, A = TA[i]", "T", "TA[i]", "TA", "i", "A", "if t > T or a > A:\n tmul = (t+T-1) // T\n amul = (a+A-1) // A\n mul = max(tmul, amul)\n T *= mul\n A *= mul\n ", "t > T or a > A", "t > T", "t", "T", "a > A", "a", "A", "tmul = (t+T-1) // T", "tmul", "(t+T-1) // T", "t+T-1", "t+T", "t", "T", "1", "T", "amul = (a+A-1) // A", "amul", "(a+A-1) // A", "a+A-1", "a+A", "a", "A", "1", "A", "mul = max(tmul, amul)", "mul", "max(tmul, amul)", "max", "tmul", "amul", "T *= mul", "T", "mul", "A *= mul", "A", "mul", "t = T", "t", "T", "a = A", "a", "A", "print(t+a)", "print", "t+a", "t", "a", "TA = [list(map(int, input().split())) for i in range(N)]", "[list(map(int, input().split())) for i in range(N)]", "TA", "tmul = (t+T-1) // T", "(t+T-1) // T", "tmul", "T *= mul", "mul", "T", "t = 1", "1", "t", "T, A = TA[i]", "TA[i]", "T", "t = T", "T", "t", "A *= mul", "mul", "A", "a = 1", "1", "a", "a = A", "A", "a", "amul = (a+A-1) // A", "(a+A-1) // A", "amul", "mul = max(tmul, amul)", "max(tmul, amul)", "mul", "N = int(input())", "int(input())", "N", "A = TA[i]", "TA[i]", "A" ]
N = int(input()) TA = [list(map(int, input().split())) for i in range(N)] t = 1 a = 1 for i in range(N): T, A = TA[i] if t > T or a > A: tmul = (t+T-1) // T amul = (a+A-1) // A mul = max(tmul, amul) T *= mul A *= mul t = T a = A print(t+a)
[ 7, 0, 13, 4, 13, 4, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 4, 13, 13, 4, 18, 4, 13, 13, 0, 13, 13, 0, 13, 4, 13, 18, 13, 17, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 40, 2, 2, 18, 13, 17, 17, 18, 18, 13, 13, 17, 40, 2, 2, 18, 13, 17, 17, 18, 18, 13, 13, 17, 0, 18, 13, 17, 2, 18, 18, 13, 13, 17, 13, 0, 18, 13, 17, 2, 18, 18, 13, 13, 17, 13, 4, 13, 4, 13, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 99, 2 ], [ 10, 9 ], [ 100, 12 ], [ 96, 25 ], [ 105, 28 ], [ 97, 32 ], [ 36, 35 ], [ 100, 39 ], [ 102, 41 ], [ 106, 48 ], [ 97, 53 ], [ 35, 54 ], [ 106, 60 ], [ 97, 65 ], [ 35, 66 ], [ 72, 69 ], [ 106, 70 ], [ 97, 75 ], [ 35, 76 ], [ 103, 78 ], [ 83, 80 ], [ 106, 81 ], [ 97, 86 ], [ 35, 87 ], [ 103, 89 ], [ 106, 94 ], [ 96, 97 ], [ 99, 100 ], [ 102, 103 ], [ 105, 106 ] ]
[ "n = int(input())\nta = [tuple(map(int, input().split())) for _ in range(n)] \n\nta_cur = list(ta[0])\nfor i in range(1, n):\n hi = max(-(ta_cur[0]*-1 // ta[i][0]), -(ta_cur[1]*-1 // ta[i][1]))\n ta_cur[0] = ta[i][0] * hi\n ta_cur[1] = ta[i][1] * hi\n\nprint(sum(ta_cur))", "n = int(input())", "n", "int(input())", "int", "input()", "input", "tuple(map(int, input().split())) for _ in range(n)", "for _ in range(n)", "_", "range(n)", "range", "n", "for _ in range(n)", "tuple(map(int, input().split()))", "tuple", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "ta = [tuple(map(int, input().split())) for _ in range(n)]", "ta", "[tuple(map(int, input().split())) for _ in range(n)]", "ta_cur = list(ta[0])", "ta_cur", "list(ta[0])", "list", "ta[0]", "ta", "0", "for i in range(1, n):\n hi = max(-(ta_cur[0]*-1 // ta[i][0]), -(ta_cur[1]*-1 // ta[i][1]))\n ta_cur[0] = ta[i][0] * hi\n ta_cur[1] = ta[i][1] * hi", "i", "range(1, n)", "range", "1", "n", "hi = max(-(ta_cur[0]*-1 // ta[i][0]), -(ta_cur[1]*-1 // ta[i][1]))", "hi", "max(-(ta_cur[0]*-1 // ta[i][0]), -(ta_cur[1]*-1 // ta[i][1]))", "max", "-(ta_cur[0]*-1 // ta[i][0])", "ta_cur[0]*-1 // ta[i][0]", "ta_cur[0]*-1", "ta_cur[0]", "ta_cur", "0", "-1", "ta[i][0]", "[i]", "ta", "i", "0", "-(ta_cur[1]*-1 // ta[i][1])", "ta_cur[1]*-1 // ta[i][1]", "ta_cur[1]*-1", "ta_cur[1]", "ta_cur", "1", "-1", "ta[i][1]", "[i]", "ta", "i", "1", "ta_cur[0] = ta[i][0] * hi", "ta_cur[0]", "ta_cur", "0", "ta[i][0] * hi", "ta[i][0]", "[i]", "ta", "i", "0", "hi", "ta_cur[1] = ta[i][1] * hi", "ta_cur[1]", "ta_cur", "1", "ta[i][1] * hi", "ta[i][1]", "[i]", "ta", "i", "1", "hi", "print(sum(ta_cur))", "print", "sum(ta_cur)", "sum", "ta_cur", "ta = [tuple(map(int, input().split())) for _ in range(n)]", "[tuple(map(int, input().split())) for _ in range(n)]", "ta", "n = int(input())", "int(input())", "n", "hi = max(-(ta_cur[0]*-1 // ta[i][0]), -(ta_cur[1]*-1 // ta[i][1]))", "max(-(ta_cur[0]*-1 // ta[i][0]), -(ta_cur[1]*-1 // ta[i][1]))", "hi", "ta_cur = list(ta[0])", "list(ta[0])", "ta_cur" ]
n = int(input()) ta = [tuple(map(int, input().split())) for _ in range(n)] ta_cur = list(ta[0]) for i in range(1, n): hi = max(-(ta_cur[0]*-1 // ta[i][0]), -(ta_cur[1]*-1 // ta[i][1])) ta_cur[0] = ta[i][0] * hi ta_cur[1] = ta[i][1] * hi print(sum(ta_cur))
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 2, 13, 13, 28, 13, 4, 13, 2, 13, 17, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 13, 13, 8, 2, 13, 13, 17, 17, 2, 2, 13, 13, 8, 2, 13, 13, 17, 17, 0, 13, 2, 2, 13, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 85, 2 ], [ 109, 8 ], [ 109, 17 ], [ 100, 19 ], [ 104, 21 ], [ 110, 22 ], [ 25, 24 ], [ 86, 28 ], [ 97, 31 ], [ 97, 40 ], [ 106, 42 ], [ 104, 47 ], [ 113, 47 ], [ 98, 48 ], [ 104, 51 ], [ 113, 51 ], [ 98, 52 ], [ 110, 57 ], [ 92, 57 ], [ 89, 58 ], [ 110, 61 ], [ 92, 61 ], [ 89, 62 ], [ 94, 66 ], [ 98, 69 ], [ 89, 70 ], [ 107, 71 ], [ 112, 73 ], [ 98, 75 ], [ 107, 76 ], [ 91, 77 ], [ 89, 79 ], [ 107, 80 ], [ 95, 83 ], [ 101, 83 ], [ 85, 86 ], [ 97, 89 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 109, 104 ], [ 106, 107 ], [ 109, 110 ], [ 112, 113 ] ]
[ "N = int(input())\nt, a = map(int, input().split())\n\nans = t + a\n\nfor _ in range(N - 1):\n T, A = map(int, input().split())\n\n n = max(t // T + (1 if t % T else 0), a // A + (1 if a % A else 0))\n\n ans = (T + A) * n\n\n t, a = T * n, A * n\n\nprint(ans)", "N = int(input())", "N", "int(input())", "int", "input()", "input", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "ans = t + a", "ans", "t + a", "t", "a", "for _ in range(N - 1):\n T, A = map(int, input().split())\n\n n = max(t // T + (1 if t % T else 0), a // A + (1 if a % A else 0))\n\n ans = (T + A) * n\n\n t, a = T * n, A * n", "_", "range(N - 1)", "range", "N - 1", "N", "1", "T, A = map(int, input().split())", "T", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "n = max(t // T + (1 if t % T else 0), a // A + (1 if a % A else 0))", "n", "max(t // T + (1 if t % T else 0), a // A + (1 if a % A else 0))", "max", "t // T + (1 if t % T else 0)", "t // T", "t", "T", "1 if t % T else 0", "t % T", "t", "T", "1", "0", "a // A + (1 if a % A else 0)", "a // A", "a", "A", "1 if a % A else 0", "a % A", "a", "A", "1", "0", "ans = (T + A) * n", "ans", "(T + A) * n", "T + A", "T", "A", "n", "t, a = T * n, A * n", "t", "T * n", "T", "n", "a", "A * n", "A", "n", "print(ans)", "print", "ans", "N = int(input())", "int(input())", "N", "A = map(int, input().split())", "map(int, input().split())", "A", "a = T * n, A * n", "A * n", "a", "ans = (T + A) * n", "(T + A) * n", "ans", "T, A = map(int, input().split())", "map(int, input().split())", "T", "ans = t + a", "t + a", "ans", "t, a = map(int, input().split())", "map(int, input().split())", "t", "n = max(t // T + (1 if t % T else 0), a // A + (1 if a % A else 0))", "max(t // T + (1 if t % T else 0), a // A + (1 if a % A else 0))", "n", "a = map(int, input().split())", "map(int, input().split())", "a", "t, a = T * n, A * n", "T * n", "t" ]
N = int(input()) t, a = map(int, input().split()) ans = t + a for _ in range(N - 1): T, A = map(int, input().split()) n = max(t // T + (1 if t % T else 0), a // A + (1 if a % A else 0)) ans = (T + A) * n t, a = T * n, A * n print(ans)
[ 7, 15, 15, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 13, 13, 0, 13, 4, 13, 4, 13, 4, 13, 13, 13, 4, 13, 4, 13, 13, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 17, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 58, 4 ], [ 55, 10 ], [ 49, 12 ], [ 61, 19 ], [ 56, 26 ], [ 53, 26 ], [ 50, 32 ], [ 65, 32 ], [ 52, 35 ], [ 62, 37 ], [ 64, 39 ], [ 62, 41 ], [ 53, 46 ], [ 56, 46 ], [ 65, 47 ], [ 50, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ], [ 61, 62 ], [ 64, 65 ] ]
[ "from math import ceil\nfrom fractions import Fraction\n\nN = int(input())\n\nt, a = 1, 1\nfor T, A in [tuple(map(int, input().split())) for _ in range(N)]:\n n = max(ceil(Fraction(t, T)), ceil(Fraction(a, A)))\n t, a = n * T, n * A\nprint(t + a)", "from math import ceil", "from fractions import Fraction", "N = int(input())", "N", "int(input())", "int", "input()", "input", "t, a = 1, 1", "t", "1", "a", "1", "for T, A in [tuple(map(int, input().split())) for _ in range(N)]:\n n = max(ceil(Fraction(t, T)), ceil(Fraction(a, A)))\n t, a = n * T, n * A", "T", "A", "[tuple(map(int, input().split())) for _ in range(N)]", "n = max(ceil(Fraction(t, T)), ceil(Fraction(a, A)))", "n", "max(ceil(Fraction(t, T)), ceil(Fraction(a, A)))", "max", "ceil(Fraction(t, T))", "ceil", "Fraction(t, T)", "Fraction", "t", "T", "ceil(Fraction(a, A))", "ceil", "Fraction(a, A)", "Fraction", "a", "A", "t, a = n * T, n * A", "t", "n * T", "n", "T", "a", "n * A", "n", "A", "print(t + a)", "print", "t + a", "t", "a", "a = 1, 1", "1", "a", "t, a = n * T, n * A", "n * T", "t", "t, a = 1, 1", "1", "t", "N = int(input())", "int(input())", "N", "n = max(ceil(Fraction(t, T)), ceil(Fraction(a, A)))", "max(ceil(Fraction(t, T)), ceil(Fraction(a, A)))", "n", "a = n * T, n * A", "n * A", "a" ]
from math import ceil from fractions import Fraction N = int(input()) t, a = 1, 1 for T, A in [tuple(map(int, input().split())) for _ in range(N)]: n = max(ceil(Fraction(t, T)), ceil(Fraction(a, A))) t, a = n * T, n * A print(t + a)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 2, 39, 17, 13, 0, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 18, 13, 13, 4, 13, 13, 4, 18, 4, 13, 13, 18, 13, 13, 0, 13, 18, 13, 17, 0, 13, 18, 13, 17, 28, 13, 4, 13, 17, 13, 14, 2, 40, 18, 13, 13, 13, 40, 18, 13, 13, 13, 0, 13, 18, 13, 13, 0, 13, 18, 13, 13, 0, 13, 2, 13, 18, 13, 13, 14, 2, 13, 18, 13, 13, 0, 13, 17, 0, 13, 2, 13, 18, 13, 13, 14, 2, 13, 18, 13, 13, 0, 13, 17, 0, 13, 4, 13, 13, 13, 0, 13, 2, 18, 13, 13, 13, 0, 13, 2, 18, 13, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 2, 13, 10, 17, 13, 10, 2, 13, 10, 4, 13, 10, 18, 13, 10, 4, 13, 10, 17, 13, 10, 18, 13, 10, 2, 13, 10, 18, 13, 10, 2, 13, 10, 2, 13, 10, 18, 13 ]
[ [ 153, 2 ], [ 162, 8 ], [ 154, 12 ], [ 168, 14 ], [ 154, 18 ], [ 21, 20 ], [ 154, 23 ], [ 28, 25 ], [ 163, 26 ], [ 20, 27 ], [ 28, 36 ], [ 169, 37 ], [ 20, 38 ], [ 165, 40 ], [ 163, 42 ], [ 174, 45 ], [ 169, 47 ], [ 51, 50 ], [ 154, 54 ], [ 25, 58 ], [ 163, 59 ], [ 50, 60 ], [ 166, 61 ], [ 172, 61 ], [ 151, 61 ], [ 36, 63 ], [ 169, 64 ], [ 50, 65 ], [ 175, 66 ], [ 136, 66 ], [ 160, 66 ], [ 150, 68 ], [ 25, 69 ], [ 163, 70 ], [ 50, 71 ], [ 159, 73 ], [ 36, 74 ], [ 169, 75 ], [ 50, 76 ], [ 144, 78 ], [ 166, 80 ], [ 172, 80 ], [ 151, 80 ], [ 25, 81 ], [ 163, 82 ], [ 50, 83 ], [ 166, 86 ], [ 172, 86 ], [ 151, 86 ], [ 25, 87 ], [ 163, 88 ], [ 50, 89 ], [ 156, 91 ], [ 138, 94 ], [ 160, 96 ], [ 175, 96 ], [ 136, 96 ], [ 36, 97 ], [ 169, 98 ], [ 50, 99 ], [ 160, 102 ], [ 175, 102 ], [ 136, 102 ], [ 36, 103 ], [ 169, 104 ], [ 50, 105 ], [ 141, 107 ], [ 147, 110 ], [ 157, 113 ], [ 145, 113 ], [ 142, 114 ], [ 139, 114 ], [ 171, 116 ], [ 25, 118 ], [ 163, 119 ], [ 50, 120 ], [ 148, 121 ], [ 135, 123 ], [ 36, 125 ], [ 169, 126 ], [ 50, 127 ], [ 148, 128 ], [ 172, 132 ], [ 151, 132 ], [ 166, 132 ], [ 136, 133 ], [ 160, 133 ], [ 175, 133 ], [ 135, 136 ], [ 138, 139 ], [ 141, 142 ], [ 144, 145 ], [ 147, 148 ], [ 25, 150 ], [ 150, 151 ], [ 153, 154 ], [ 156, 157 ], [ 36, 159 ], [ 159, 160 ], [ 162, 163 ], [ 165, 166 ], [ 168, 169 ], [ 171, 172 ], [ 174, 175 ] ]
[ "n=int(input())\nt=[0]*n\na=[0]*n\nfor i in range(n):\n t[i],a[i]=map(int,input().split())\ncurt=t[0]\ncura=a[0]\nfor i in range(1,n):\n if t[i]>=curt and a[i]>=cura:\n curt=t[i]\n cura=a[i]\n else:\n kt=curt//t[i]\n if curt%t[i]:\n kt+=1\n ka=cura//a[i]\n if cura%a[i]:\n ka+=1\n\n k=max(kt,ka)\n curt=t[i]*k\n cura=a[i]*k\nprint(curt+cura)\n", "n=int(input())", "n", "int(input())", "int", "input()", "input", "t=[0]*n", "t", "[0]*n", "[0]", "0", "n", "a=[0]*n", "a", "[0]*n", "[0]", "0", "n", "for i in range(n):\n t[i],a[i]=map(int,input().split())", "i", "range(n)", "range", "n", "t[i],a[i]=map(int,input().split())", "t[i]", "t", "i", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a[i]", "a", "i", "curt=t[0]", "curt", "t[0]", "t", "0", "cura=a[0]", "cura", "a[0]", "a", "0", "for i in range(1,n):\n if t[i]>=curt and a[i]>=cura:\n curt=t[i]\n cura=a[i]\n else:\n kt=curt//t[i]\n if curt%t[i]:\n kt+=1\n ka=cura//a[i]\n if cura%a[i]:\n ka+=1\n\n k=max(kt,ka)\n curt=t[i]*k\n cura=a[i]*k", "i", "range(1,n)", "range", "1", "n", "if t[i]>=curt and a[i]>=cura:\n curt=t[i]\n cura=a[i]\n else:\n kt=curt//t[i]\n if curt%t[i]:\n kt+=1\n ka=cura//a[i]\n if cura%a[i]:\n ka+=1\n\n k=max(kt,ka)\n curt=t[i]*k\n cura=a[i]*k", "t[i]>=curt and a[i]>=cura", "t[i]>=curt", "t[i]", "t", "i", "curt", "a[i]>=cura", "a[i]", "a", "i", "cura", "curt=t[i]", "curt", "t[i]", "t", "i", "cura=a[i]", "cura", "a[i]", "a", "i", "kt=curt//t[i]", "kt", "curt//t[i]", "curt", "t[i]", "t", "i", "if curt%t[i]:\n kt+=1\n ", "curt%t[i]", "curt", "t[i]", "t", "i", "kt+=1", "kt", "1", "ka=cura//a[i]", "ka", "cura//a[i]", "cura", "a[i]", "a", "i", "if cura%a[i]:\n ka+=1\n\n ", "cura%a[i]", "cura", "a[i]", "a", "i", "ka+=1", "ka", "1", "k=max(kt,ka)", "k", "max(kt,ka)", "max", "kt", "ka", "curt=t[i]*k", "curt", "t[i]*k", "t[i]", "t", "i", "k", "cura=a[i]*k", "cura", "a[i]*k", "a[i]", "a", "i", "k", "print(curt+cura)", "print", "curt+cura", "curt", "cura", "cura=a[i]*k", "a[i]*k", "cura", "ka=cura//a[i]", "cura//a[i]", "ka", "ka+=1", "1", "ka", "kt=curt//t[i]", "curt//t[i]", "kt", "k=max(kt,ka)", "max(kt,ka)", "k", "curt=t[i]", "t[i]", "curt", "n=int(input())", "int(input())", "n", "kt+=1", "1", "kt", "cura=a[i]", "a[i]", "cura", "t=[0]*n", "[0]*n", "t", "curt=t[0]", "t[0]", "curt", "a=[0]*n", "[0]*n", "a", "curt=t[i]*k", "t[i]*k", "curt", "cura=a[0]", "a[0]", "cura" ]
n=int(input()) t=[0]*n a=[0]*n for i in range(n): t[i],a[i]=map(int,input().split()) curt=t[0] cura=a[0] for i in range(1,n): if t[i]>=curt and a[i]>=cura: curt=t[i] cura=a[i] else: kt=curt//t[i] if curt%t[i]: kt+=1 ka=cura//a[i] if cura%a[i]: ka+=1 k=max(kt,ka) curt=t[i]*k cura=a[i]*k print(curt+cura)
[ 7, 0, 13, 4, 13, 4, 13, 15, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13 ]
[ [ 70, 2 ], [ 82, 9 ], [ 73, 12 ], [ 16, 15 ], [ 71, 18 ], [ 76, 20 ], [ 76, 29 ], [ 79, 31 ], [ 83, 37 ], [ 65, 37 ], [ 77, 38 ], [ 77, 40 ], [ 74, 44 ], [ 86, 44 ], [ 68, 45 ], [ 68, 47 ], [ 64, 49 ], [ 80, 51 ], [ 77, 52 ], [ 85, 54 ], [ 80, 56 ], [ 68, 57 ], [ 65, 61 ], [ 83, 61 ], [ 86, 62 ], [ 74, 62 ], [ 64, 65 ], [ 76, 68 ], [ 70, 71 ], [ 73, 74 ], [ 76, 77 ], [ 79, 80 ], [ 82, 83 ], [ 85, 86 ] ]
[ "n = int(input())\nfrom math import ceil\n\ntkhs = 1\naoki = 1\n\nfor _ in range(n):\n t, a = map(int, input().split())\n k = max((tkhs+t-1)//t, (aoki+a-1)//a)\n tkhs = k*t\n aoki = k*a\n\nprint(tkhs+aoki)\n", "n = int(input())", "n", "int(input())", "int", "input()", "input", "from math import ceil", "tkhs = 1", "tkhs", "1", "aoki = 1", "aoki", "1", "for _ in range(n):\n t, a = map(int, input().split())\n k = max((tkhs+t-1)//t, (aoki+a-1)//a)\n tkhs = k*t\n aoki = k*a", "_", "range(n)", "range", "n", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "k = max((tkhs+t-1)//t, (aoki+a-1)//a)", "k", "max((tkhs+t-1)//t, (aoki+a-1)//a)", "max", "(tkhs+t-1)//t", "tkhs+t-1", "tkhs+t", "tkhs", "t", "1", "t", "(aoki+a-1)//a", "aoki+a-1", "aoki+a", "aoki", "a", "1", "a", "tkhs = k*t", "tkhs", "k*t", "k", "t", "aoki = k*a", "aoki", "k*a", "k", "a", "print(tkhs+aoki)", "print", "tkhs+aoki", "tkhs", "aoki", "tkhs = k*t", "k*t", "tkhs", "a = map(int, input().split())", "map(int, input().split())", "a", "n = int(input())", "int(input())", "n", "aoki = 1", "1", "aoki", "t, a = map(int, input().split())", "map(int, input().split())", "t", "k = max((tkhs+t-1)//t, (aoki+a-1)//a)", "max((tkhs+t-1)//t, (aoki+a-1)//a)", "k", "tkhs = 1", "1", "tkhs", "aoki = k*a", "k*a", "aoki" ]
n = int(input()) from math import ceil tkhs = 1 aoki = 1 for _ in range(n): t, a = map(int, input().split()) k = max((tkhs+t-1)//t, (aoki+a-1)//a) tkhs = k*t aoki = k*a print(tkhs+aoki)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 2, 39, 17, 13, 13, 2, 39, 17, 13, 28, 13, 4, 13, 13, 0, 18, 13, 13, 4, 13, 13, 4, 18, 4, 13, 13, 18, 13, 13, 0, 13, 2, 18, 13, 17, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 13, 0, 13, 4, 13, 40, 2, 40, 2, 18, 13, 2, 13, 17, 13, 18, 13, 13, 40, 2, 40, 2, 18, 13, 2, 13, 17, 13, 18, 13, 13, 0, 13, 2, 2, 18, 13, 13, 18, 13, 13, 13, 0, 13, 13, 4, 13, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 116, 2 ], [ 104, 8 ], [ 117, 12 ], [ 122, 13 ], [ 117, 17 ], [ 20, 19 ], [ 117, 22 ], [ 27, 24 ], [ 105, 25 ], [ 19, 26 ], [ 27, 35 ], [ 123, 36 ], [ 19, 37 ], [ 119, 39 ], [ 123, 42 ], [ 105, 45 ], [ 113, 48 ], [ 52, 51 ], [ 117, 55 ], [ 125, 57 ], [ 105, 65 ], [ 51, 67 ], [ 114, 69 ], [ 108, 69 ], [ 24, 70 ], [ 105, 71 ], [ 51, 72 ], [ 123, 78 ], [ 51, 80 ], [ 114, 82 ], [ 108, 82 ], [ 35, 83 ], [ 123, 84 ], [ 51, 85 ], [ 110, 87 ], [ 24, 90 ], [ 105, 91 ], [ 51, 92 ], [ 35, 93 ], [ 123, 94 ], [ 51, 95 ], [ 126, 96 ], [ 107, 98 ], [ 126, 99 ], [ 111, 102 ], [ 120, 102 ], [ 104, 105 ], [ 126, 107 ], [ 107, 108 ], [ 110, 111 ], [ 113, 114 ], [ 116, 117 ], [ 119, 120 ], [ 122, 123 ], [ 125, 126 ] ]
[ "\nn = int(input())\nt, a = [0] * n, [0] * n\nfor i in range(n):\n t[i], a[i] = map(int, input().split())\nans = a[0] + t[0]\nj_pre = 1\nfor i in range(1, n):\n j = max(-(-(t[i - 1] * j_pre) // t[i]), -(-(a[i - 1] * j_pre) // a[i]) )\n ans = (t[i] + a[i]) * j\n j_pre = j\n #print(t[i] * j, a[i] * j)\n #print(ans)\n\nprint(ans)", "n = int(input())", "n", "int(input())", "int", "input()", "input", "t, a = [0] * n, [0] * n", "t", "[0] * n", "[0]", "0", "n", "a", "[0] * n", "[0]", "0", "n", "for i in range(n):\n t[i], a[i] = map(int, input().split())", "i", "range(n)", "range", "n", "t[i], a[i] = map(int, input().split())", "t[i]", "t", "i", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a[i]", "a", "i", "ans = a[0] + t[0]", "ans", "a[0] + t[0]", "a[0]", "a", "0", "t[0]", "t", "0", "j_pre = 1", "j_pre", "1", "for i in range(1, n):\n j = max(-(-(t[i - 1] * j_pre) // t[i]), -(-(a[i - 1] * j_pre) // a[i]) )\n ans = (t[i] + a[i]) * j\n j_pre = j\n #print(t[i] * j, a[i] * j)\n #print(ans)", "i", "range(1, n)", "range", "1", "n", "j = max(-(-(t[i - 1] * j_pre) // t[i]), -(-(a[i - 1] * j_pre) // a[i]) )", "j", "max(-(-(t[i - 1] * j_pre) // t[i]), -(-(a[i - 1] * j_pre) // a[i]) )", "max", "-(-(t[i - 1] * j_pre) // t[i])", "-(t[i - 1] * j_pre) // t[i]", "-(t[i - 1] * j_pre)", "t[i - 1] * j_pre", "t[i - 1]", "t", "i - 1", "i", "1", "j_pre", "t[i]", "t", "i", "-(-(a[i - 1] * j_pre) // a[i])", "-(a[i - 1] * j_pre) // a[i]", "-(a[i - 1] * j_pre)", "a[i - 1] * j_pre", "a[i - 1]", "a", "i - 1", "i", "1", "j_pre", "a[i]", "a", "i", "ans = (t[i] + a[i]) * j", "ans", "(t[i] + a[i]) * j", "t[i] + a[i]", "t[i]", "t", "i", "a[i]", "a", "i", "j", "j_pre = j", "j_pre", "j", "print(ans)", "print", "ans", "t, a = [0] * n, [0] * n", "[0] * n", "t", "j_pre = j", "j", "j_pre", "ans = (t[i] + a[i]) * j", "(t[i] + a[i]) * j", "ans", "j_pre = 1", "1", "j_pre", "n = int(input())", "int(input())", "n", "ans = a[0] + t[0]", "a[0] + t[0]", "ans", "a = [0] * n, [0] * n", "[0] * n", "a", "j = max(-(-(t[i - 1] * j_pre) // t[i]), -(-(a[i - 1] * j_pre) // a[i]) )", "max(-(-(t[i - 1] * j_pre) // t[i]), -(-(a[i - 1] * j_pre) // a[i]) )", "j" ]
n = int(input()) t, a = [0] * n, [0] * n for i in range(n): t[i], a[i] = map(int, input().split()) ans = a[0] + t[0] j_pre = 1 for i in range(1, n): j = max(-(-(t[i - 1] * j_pre) // t[i]), -(-(a[i - 1] * j_pre) // a[i]) ) ans = (t[i] + a[i]) * j j_pre = j #print(t[i] * j, a[i] * j) #print(ans) print(ans)
[ 7, 15, 15, 0, 13, 4, 13, 4, 18, 4, 18, 13, 13, 13, 0, 13, 39, 17, 17, 0, 13, 39, 17, 17, 28, 13, 4, 13, 13, 41, 28, 13, 4, 18, 4, 18, 4, 18, 13, 13, 13, 13, 4, 4, 13, 13, 0, 18, 13, 17, 13, 18, 13, 17, 14, 2, 40, 18, 13, 17, 18, 13, 17, 40, 18, 13, 17, 18, 13, 17, 0, 18, 13, 17, 18, 13, 17, 0, 18, 13, 17, 18, 13, 17, 14, 2, 2, 18, 13, 17, 18, 13, 17, 2, 18, 13, 17, 18, 13, 17, 14, 2, 2, 18, 13, 17, 18, 13, 17, 17, 0, 13, 2, 18, 13, 17, 18, 13, 17, 0, 13, 2, 2, 18, 13, 17, 18, 13, 17, 17, 14, 2, 2, 18, 13, 17, 18, 13, 17, 17, 0, 13, 2, 18, 13, 17, 18, 13, 17, 0, 13, 2, 2, 18, 13, 17, 18, 13, 17, 17, 14, 40, 13, 13, 0, 13, 13, 0, 13, 13, 0, 18, 13, 17, 2, 18, 13, 17, 13, 0, 18, 13, 17, 2, 18, 13, 17, 13, 14, 2, 18, 13, 17, 18, 13, 17, 0, 13, 2, 18, 13, 17, 18, 13, 17, 14, 2, 2, 18, 13, 17, 18, 13, 17, 17, 0, 18, 13, 17, 2, 18, 13, 17, 13, 0, 18, 13, 17, 2, 18, 13, 17, 13, 0, 18, 13, 17, 2, 18, 13, 17, 2, 13, 17, 0, 18, 13, 17, 2, 18, 13, 17, 2, 13, 17, 14, 2, 18, 13, 17, 18, 13, 17, 0, 13, 2, 18, 13, 17, 18, 13, 17, 14, 2, 2, 18, 13, 17, 18, 13, 17, 17, 0, 18, 13, 17, 2, 18, 13, 17, 13, 0, 18, 13, 17, 2, 18, 13, 17, 13, 0, 18, 13, 17, 2, 18, 13, 17, 2, 13, 17, 0, 18, 13, 17, 2, 18, 13, 17, 2, 13, 17, 4, 13, 2, 18, 13, 17, 18, 13, 17, 10, 2, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 2, 13, 10, 4, 13, 10, 39, 13, 10, 39, 13, 10, 2, 13, 10, 2, 13 ]
[ [ 350, 4 ], [ 353, 15 ], [ 356, 20 ], [ 26, 25 ], [ 351, 28 ], [ 32, 31 ], [ 31, 45 ], [ 50, 47 ], [ 354, 48 ], [ 50, 51 ], [ 354, 52 ], [ 357, 58 ], [ 354, 61 ], [ 357, 65 ], [ 354, 68 ], [ 74, 71 ], [ 357, 72 ], [ 354, 75 ], [ 81, 78 ], [ 357, 79 ], [ 354, 82 ], [ 357, 88 ], [ 354, 91 ], [ 357, 95 ], [ 354, 98 ], [ 357, 104 ], [ 354, 107 ], [ 359, 111 ], [ 357, 114 ], [ 354, 117 ], [ 335, 120 ], [ 357, 124 ], [ 354, 127 ], [ 357, 134 ], [ 354, 137 ], [ 347, 141 ], [ 357, 144 ], [ 354, 147 ], [ 341, 150 ], [ 357, 154 ], [ 354, 157 ], [ 336, 162 ], [ 360, 162 ], [ 342, 163 ], [ 348, 163 ], [ 344, 165 ], [ 336, 166 ], [ 360, 166 ], [ 338, 168 ], [ 342, 169 ], [ 348, 169 ], [ 174, 171 ], [ 357, 172 ], [ 354, 176 ], [ 339, 178 ], [ 345, 178 ], [ 183, 180 ], [ 357, 181 ], [ 354, 185 ], [ 339, 187 ], [ 345, 187 ], [ 357, 191 ], [ 354, 194 ], [ 332, 197 ], [ 357, 200 ], [ 354, 203 ], [ 357, 209 ], [ 354, 212 ], [ 219, 216 ], [ 357, 217 ], [ 354, 221 ], [ 333, 223 ], [ 228, 225 ], [ 357, 226 ], [ 354, 230 ], [ 333, 232 ], [ 237, 234 ], [ 357, 235 ], [ 354, 239 ], [ 333, 242 ], [ 248, 245 ], [ 357, 246 ], [ 354, 250 ], [ 333, 253 ], [ 357, 258 ], [ 354, 261 ], [ 362, 264 ], [ 357, 267 ], [ 354, 270 ], [ 357, 276 ], [ 354, 279 ], [ 286, 283 ], [ 357, 284 ], [ 354, 288 ], [ 363, 290 ], [ 295, 292 ], [ 357, 293 ], [ 354, 297 ], [ 363, 299 ], [ 304, 301 ], [ 357, 302 ], [ 354, 306 ], [ 363, 309 ], [ 315, 312 ], [ 357, 313 ], [ 354, 317 ], [ 363, 320 ], [ 357, 326 ], [ 357, 329 ], [ 332, 333 ], [ 335, 336 ], [ 342, 338 ], [ 348, 338 ], [ 338, 339 ], [ 341, 342 ], [ 336, 344 ], [ 360, 344 ], [ 344, 345 ], [ 347, 348 ], [ 350, 351 ], [ 353, 354 ], [ 356, 357 ], [ 359, 360 ], [ 362, 363 ] ]
[ "from sys import stdin\nfrom operator import itemgetter\n# stdin = open(\"sample.txt\")\n\nN = int(stdin.readline().rstrip())\nhyo = [0,0]\nans = [0,0]\n\nfor i in range(N):\n hyo[0],hyo[1] = [int(x) for x in stdin.readline().rstrip().split()]\n\n if ans[0]<=hyo[0] and ans[1]<=hyo[1]:\n ans[0] = hyo[0]\n ans[1] = hyo[1]\n elif ans[0]>hyo[0] and ans[1]>hyo[1]:\n if ans[0]%hyo[0] == 0:\n which1 = ans[0]//hyo[0]\n else:\n which1 = ans[0]//hyo[0]+1\n if ans[1]%hyo[1] == 0:\n which2 = ans[1]//hyo[1]\n else:\n which2 = ans[1]//hyo[1]+1\n if which1 >= which2:\n which = which1\n else:\n which = which2\n ans[0] = hyo[0] * which\n ans[1] = hyo[1] * which\n elif ans[0]>hyo[0]:\n left = ans[0]//hyo[0]\n if ans[0]%hyo[0] == 0:\n ans[0] = hyo[0]*left\n ans[1] = hyo[1]*left\n else:\n ans[0] = hyo[0]*(left+1)\n ans[1] = hyo[1]*(left+1)\n elif ans[1]>hyo[1]:\n right = ans[1]//hyo[1]\n if ans[1]%hyo[1] == 0:\n ans[0] = hyo[0]*right\n ans[1] = hyo[1]*right\n else:\n ans[0] = hyo[0]*(right+1)\n ans[1] = hyo[1]*(right+1)\n # print(ans)\n\nprint(ans[0]+ans[1])", "from sys import stdin", "from operator import itemgetter", "N = int(stdin.readline().rstrip())", "N", "int(stdin.readline().rstrip())", "int", "stdin.readline().rstrip()", "stdin.readline().rstrip", "stdin.readline()", "stdin.readline", "stdin", "readline", "rstrip", "hyo = [0,0]", "hyo", "[0,0]", "0", "0", "ans = [0,0]", "ans", "[0,0]", "0", "0", "for i in range(N):\n hyo[0],hyo[1] = [int(x) for x in stdin.readline().rstrip().split()]\n\n if ans[0]<=hyo[0] and ans[1]<=hyo[1]:\n ans[0] = hyo[0]\n ans[1] = hyo[1]\n elif ans[0]>hyo[0] and ans[1]>hyo[1]:\n if ans[0]%hyo[0] == 0:\n which1 = ans[0]//hyo[0]\n else:\n which1 = ans[0]//hyo[0]+1\n if ans[1]%hyo[1] == 0:\n which2 = ans[1]//hyo[1]\n else:\n which2 = ans[1]//hyo[1]+1\n if which1 >= which2:\n which = which1\n else:\n which = which2\n ans[0] = hyo[0] * which\n ans[1] = hyo[1] * which\n elif ans[0]>hyo[0]:\n left = ans[0]//hyo[0]\n if ans[0]%hyo[0] == 0:\n ans[0] = hyo[0]*left\n ans[1] = hyo[1]*left\n else:\n ans[0] = hyo[0]*(left+1)\n ans[1] = hyo[1]*(left+1)\n elif ans[1]>hyo[1]:\n right = ans[1]//hyo[1]\n if ans[1]%hyo[1] == 0:\n ans[0] = hyo[0]*right\n ans[1] = hyo[1]*right\n else:\n ans[0] = hyo[0]*(right+1)\n ans[1] = hyo[1]*(right+1)\n # print(ans)", "i", "range(N)", "range", "N", "int(x) for x in stdin.readline().rstrip().split()", "for x in stdin.readline().rstrip().split()", "x", "stdin.readline().rstrip().split()", "stdin.readline().rstrip().split", "stdin.readline().rstrip()", "stdin.readline().rstrip", "stdin.readline()", "stdin.readline", "stdin", "readline", "rstrip", "split", "for x in stdin.readline().rstrip().split()", "int(x)", "int", "x", "hyo[0],hyo[1] = [int(x) for x in stdin.readline().rstrip().split()]", "hyo[0]", "hyo", "0", "[int(x) for x in stdin.readline().rstrip().split()]", "hyo[1]", "hyo", "1", "if ans[0]<=hyo[0] and ans[1]<=hyo[1]:\n ans[0] = hyo[0]\n ans[1] = hyo[1]\n elif ans[0]>hyo[0] and ans[1]>hyo[1]:\n if ans[0]%hyo[0] == 0:\n which1 = ans[0]//hyo[0]\n else:\n which1 = ans[0]//hyo[0]+1\n if ans[1]%hyo[1] == 0:\n which2 = ans[1]//hyo[1]\n else:\n which2 = ans[1]//hyo[1]+1\n if which1 >= which2:\n which = which1\n else:\n which = which2\n ans[0] = hyo[0] * which\n ans[1] = hyo[1] * which\n elif ans[0]>hyo[0]:\n left = ans[0]//hyo[0]\n if ans[0]%hyo[0] == 0:\n ans[0] = hyo[0]*left\n ans[1] = hyo[1]*left\n else:\n ans[0] = hyo[0]*(left+1)\n ans[1] = hyo[1]*(left+1)\n elif ans[1]>hyo[1]:\n right = ans[1]//hyo[1]\n if ans[1]%hyo[1] == 0:\n ans[0] = hyo[0]*right\n ans[1] = hyo[1]*right\n else:\n ans[0] = hyo[0]*(right+1)\n ans[1] = hyo[1]*(right+1)\n # print(ans)", "ans[0]<=hyo[0] and ans[1]<=hyo[1]", "ans[0]<=hyo[0]", "ans[0]", "ans", "0", "hyo[0]", "hyo", "0", "ans[1]<=hyo[1]", "ans[1]", "ans", "1", "hyo[1]", "hyo", "1", "ans[0] = hyo[0]", "ans[0]", "ans", "0", "hyo[0]", "hyo", "0", "ans[1] = hyo[1]", "ans[1]", "ans", "1", "hyo[1]", "hyo", "1", "elif ans[0]>hyo[0] and ans[1]>hyo[1]:\n if ans[0]%hyo[0] == 0:\n which1 = ans[0]//hyo[0]\n else:\n which1 = ans[0]//hyo[0]+1\n if ans[1]%hyo[1] == 0:\n which2 = ans[1]//hyo[1]\n else:\n which2 = ans[1]//hyo[1]+1\n if which1 >= which2:\n which = which1\n else:\n which = which2\n ans[0] = hyo[0] * which\n ans[1] = hyo[1] * which\n ", "ans[0]>hyo[0] and ans[1]>hyo[1]", "ans[0]>hyo[0]", "ans[0]", "ans", "0", "hyo[0]", "hyo", "0", "ans[1]>hyo[1]", "ans[1]", "ans", "1", "hyo[1]", "hyo", "1", "if ans[0]%hyo[0] == 0:\n which1 = ans[0]//hyo[0]\n else:\n which1 = ans[0]//hyo[0]+1\n ", "ans[0]%hyo[0] == 0", "ans[0]%hyo[0]", "ans[0]", "ans", "0", "hyo[0]", "hyo", "0", "0", "which1 = ans[0]//hyo[0]", "which1", "ans[0]//hyo[0]", "ans[0]", "ans", "0", "hyo[0]", "hyo", "0", "which1 = ans[0]//hyo[0]+1", "which1", "ans[0]//hyo[0]+1", "ans[0]//hyo[0]", "ans[0]", "ans", "0", "hyo[0]", "hyo", "0", "1", "if ans[1]%hyo[1] == 0:\n which2 = ans[1]//hyo[1]\n else:\n which2 = ans[1]//hyo[1]+1\n ", "ans[1]%hyo[1] == 0", "ans[1]%hyo[1]", "ans[1]", "ans", "1", "hyo[1]", "hyo", "1", "0", "which2 = ans[1]//hyo[1]", "which2", "ans[1]//hyo[1]", "ans[1]", "ans", "1", "hyo[1]", "hyo", "1", "which2 = ans[1]//hyo[1]+1", "which2", "ans[1]//hyo[1]+1", "ans[1]//hyo[1]", "ans[1]", "ans", "1", "hyo[1]", "hyo", "1", "1", "if which1 >= which2:\n which = which1\n else:\n which = which2\n ", "which1 >= which2", "which1", "which2", "which = which1", "which", "which1", "which = which2", "which", "which2", "ans[0] = hyo[0] * which", "ans[0]", "ans", "0", "hyo[0] * which", "hyo[0]", "hyo", "0", "which", "ans[1] = hyo[1] * which", "ans[1]", "ans", "1", "hyo[1] * which", "hyo[1]", "hyo", "1", "which", "elif ans[0]>hyo[0]:\n left = ans[0]//hyo[0]\n if ans[0]%hyo[0] == 0:\n ans[0] = hyo[0]*left\n ans[1] = hyo[1]*left\n else:\n ans[0] = hyo[0]*(left+1)\n ans[1] = hyo[1]*(left+1)\n ", "ans[0]>hyo[0]", "ans[0]", "ans", "0", "hyo[0]", "hyo", "0", "left = ans[0]//hyo[0]", "left", "ans[0]//hyo[0]", "ans[0]", "ans", "0", "hyo[0]", "hyo", "0", "if ans[0]%hyo[0] == 0:\n ans[0] = hyo[0]*left\n ans[1] = hyo[1]*left\n else:\n ans[0] = hyo[0]*(left+1)\n ans[1] = hyo[1]*(left+1)\n ", "ans[0]%hyo[0] == 0", "ans[0]%hyo[0]", "ans[0]", "ans", "0", "hyo[0]", "hyo", "0", "0", "ans[0] = hyo[0]*left", "ans[0]", "ans", "0", "hyo[0]*left", "hyo[0]", "hyo", "0", "left", "ans[1] = hyo[1]*left", "ans[1]", "ans", "1", "hyo[1]*left", "hyo[1]", "hyo", "1", "left", "ans[0] = hyo[0]*(left+1)", "ans[0]", "ans", "0", "hyo[0]*(left+1)", "hyo[0]", "hyo", "0", "left+1", "left", "1", "ans[1] = hyo[1]*(left+1)", "ans[1]", "ans", "1", "hyo[1]*(left+1)", "hyo[1]", "hyo", "1", "left+1", "left", "1", "elif ans[1]>hyo[1]:\n right = ans[1]//hyo[1]\n if ans[1]%hyo[1] == 0:\n ans[0] = hyo[0]*right\n ans[1] = hyo[1]*right\n else:\n ans[0] = hyo[0]*(right+1)\n ans[1] = hyo[1]*(right+1)\n # print(ans)", "ans[1]>hyo[1]", "ans[1]", "ans", "1", "hyo[1]", "hyo", "1", "right = ans[1]//hyo[1]", "right", "ans[1]//hyo[1]", "ans[1]", "ans", "1", "hyo[1]", "hyo", "1", "if ans[1]%hyo[1] == 0:\n ans[0] = hyo[0]*right\n ans[1] = hyo[1]*right\n else:\n ans[0] = hyo[0]*(right+1)\n ans[1] = hyo[1]*(right+1)\n # print(ans)", "ans[1]%hyo[1] == 0", "ans[1]%hyo[1]", "ans[1]", "ans", "1", "hyo[1]", "hyo", "1", "0", "ans[0] = hyo[0]*right", "ans[0]", "ans", "0", "hyo[0]*right", "hyo[0]", "hyo", "0", "right", "ans[1] = hyo[1]*right", "ans[1]", "ans", "1", "hyo[1]*right", "hyo[1]", "hyo", "1", "right", "ans[0] = hyo[0]*(right+1)", "ans[0]", "ans", "0", "hyo[0]*(right+1)", "hyo[0]", "hyo", "0", "right+1", "right", "1", "ans[1] = hyo[1]*(right+1)", "ans[1]", "ans", "1", "hyo[1]*(right+1)", "hyo[1]", "hyo", "1", "right+1", "right", "1", "print(ans[0]+ans[1])", "print", "ans[0]+ans[1]", "ans[0]", "ans", "0", "ans[1]", "ans", "1", "left = ans[0]//hyo[0]", "ans[0]//hyo[0]", "left", "which1 = ans[0]//hyo[0]+1", "ans[0]//hyo[0]+1", "which1", "which = which2", "which2", "which", "which2 = ans[1]//hyo[1]+1", "ans[1]//hyo[1]+1", "which2", "which = which1", "which1", "which", "which2 = ans[1]//hyo[1]", "ans[1]//hyo[1]", "which2", "N = int(stdin.readline().rstrip())", "int(stdin.readline().rstrip())", "N", "hyo = [0,0]", "[0,0]", "hyo", "ans = [0,0]", "[0,0]", "ans", "which1 = ans[0]//hyo[0]", "ans[0]//hyo[0]", "which1", "right = ans[1]//hyo[1]", "ans[1]//hyo[1]", "right" ]
from sys import stdin from operator import itemgetter # stdin = open("sample.txt") N = int(stdin.readline().rstrip()) hyo = [0,0] ans = [0,0] for i in range(N): hyo[0],hyo[1] = [int(x) for x in stdin.readline().rstrip().split()] if ans[0]<=hyo[0] and ans[1]<=hyo[1]: ans[0] = hyo[0] ans[1] = hyo[1] elif ans[0]>hyo[0] and ans[1]>hyo[1]: if ans[0]%hyo[0] == 0: which1 = ans[0]//hyo[0] else: which1 = ans[0]//hyo[0]+1 if ans[1]%hyo[1] == 0: which2 = ans[1]//hyo[1] else: which2 = ans[1]//hyo[1]+1 if which1 >= which2: which = which1 else: which = which2 ans[0] = hyo[0] * which ans[1] = hyo[1] * which elif ans[0]>hyo[0]: left = ans[0]//hyo[0] if ans[0]%hyo[0] == 0: ans[0] = hyo[0]*left ans[1] = hyo[1]*left else: ans[0] = hyo[0]*(left+1) ans[1] = hyo[1]*(left+1) elif ans[1]>hyo[1]: right = ans[1]//hyo[1] if ans[1]%hyo[1] == 0: ans[0] = hyo[0]*right ans[1] = hyo[1]*right else: ans[0] = hyo[0]*(right+1) ans[1] = hyo[1]*(right+1) # print(ans) print(ans[0]+ans[1])
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 17, 13, 17, 2, 2, 2, 13, 17, 13, 17, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 14, 2, 2, 13, 13, 17, 0, 13, 13, 0, 13, 13, 4, 13, 4, 13, 2, 13, 13, 10, 17, 13, 10, 4, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 13, 13 ]
[ [ 91, 2 ], [ 76, 8 ], [ 85, 10 ], [ 14, 13 ], [ 92, 16 ], [ 88, 18 ], [ 88, 27 ], [ 97, 29 ], [ 77, 35 ], [ 104, 35 ], [ 83, 35 ], [ 89, 37 ], [ 86, 42 ], [ 95, 42 ], [ 101, 42 ], [ 80, 44 ], [ 82, 47 ], [ 89, 49 ], [ 98, 50 ], [ 100, 52 ], [ 80, 54 ], [ 98, 55 ], [ 83, 59 ], [ 77, 59 ], [ 104, 59 ], [ 101, 60 ], [ 86, 60 ], [ 95, 60 ], [ 103, 63 ], [ 89, 64 ], [ 94, 66 ], [ 80, 67 ], [ 104, 73 ], [ 83, 73 ], [ 77, 73 ], [ 95, 74 ], [ 101, 74 ], [ 86, 74 ], [ 76, 77 ], [ 88, 80 ], [ 82, 83 ], [ 85, 86 ], [ 88, 89 ], [ 91, 92 ], [ 80, 94 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 89, 103 ], [ 103, 104 ] ]
[ "N = int(input())\nt, a = 0, 0\nfor _ in range(N):\n T, A = map(int, input().split())\n c = max((t - 1) // T + 1, (a - 1) // A + 1)\n t = T * c\n a = A * c\n if t + a == 0:\n t += T\n a += A\n # for n in range(10 ** 18):\n # if t <= n * T and a <= n * A:\n # t = n * T\n # a = n * A\n # print('{0} {1} {2}'.format(n, t, a))\n # break\nprint(int(t + a))", "N = int(input())", "N", "int(input())", "int", "input()", "input", "t, a = 0, 0", "t", "0", "a", "0", "for _ in range(N):\n T, A = map(int, input().split())\n c = max((t - 1) // T + 1, (a - 1) // A + 1)\n t = T * c\n a = A * c\n if t + a == 0:\n t += T\n a += A\n # for n in range(10 ** 18):\n # if t <= n * T and a <= n * A:\n # t = n * T\n # a = n * A\n # print('{0} {1} {2}'.format(n, t, a))\n # break", "_", "range(N)", "range", "N", "T, A = map(int, input().split())", "T", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "c = max((t - 1) // T + 1, (a - 1) // A + 1)", "c", "max((t - 1) // T + 1, (a - 1) // A + 1)", "max", "(t - 1) // T + 1", "(t - 1) // T", "t - 1", "t", "1", "T", "1", "(a - 1) // A + 1", "(a - 1) // A", "a - 1", "a", "1", "A", "1", "t = T * c", "t", "T * c", "T", "c", "a = A * c", "a", "A * c", "A", "c", "if t + a == 0:\n t += T\n a += A\n # for n in range(10 ** 18):\n # if t <= n * T and a <= n * A:\n # t = n * T\n # a = n * A\n # print('{0} {1} {2}'.format(n, t, a))\n # break", "t + a == 0", "t + a", "t", "a", "0", "t += T", "t", "T", "a += A", "a", "A", "print(int(t + a))", "print", "int(t + a)", "int", "t + a", "t", "a", "t, a = 0, 0", "0", "t", "A = map(int, input().split())", "map(int, input().split())", "A", "t = T * c", "T * c", "t", "a = 0, 0", "0", "a", "T, A = map(int, input().split())", "map(int, input().split())", "T", "N = int(input())", "int(input())", "N", "a += A", "A", "a", "c = max((t - 1) // T + 1, (a - 1) // A + 1)", "max((t - 1) // T + 1, (a - 1) // A + 1)", "c", "a = A * c", "A * c", "a", "t += T", "T", "t" ]
N = int(input()) t, a = 0, 0 for _ in range(N): T, A = map(int, input().split()) c = max((t - 1) // T + 1, (a - 1) // A + 1) t = T * c a = A * c if t + a == 0: t += T a += A # for n in range(10 ** 18): # if t <= n * T and a <= n * A: # t = n * T # a = n * A # print('{0} {1} {2}'.format(n, t, a)) # break print(int(t + a))
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 0, 13, 4, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 0, 13, 4, 13, 2, 2, 2, 13, 13, 17, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 17, 13, 10, 4, 13, 10, 18, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 79, 4 ], [ 91, 11 ], [ 80, 15 ], [ 73, 17 ], [ 94, 19 ], [ 23, 22 ], [ 92, 25 ], [ 88, 27 ], [ 80, 34 ], [ 88, 36 ], [ 85, 38 ], [ 74, 44 ], [ 71, 44 ], [ 77, 45 ], [ 77, 47 ], [ 95, 51 ], [ 83, 51 ], [ 89, 52 ], [ 89, 54 ], [ 70, 56 ], [ 86, 58 ], [ 77, 59 ], [ 82, 60 ], [ 86, 62 ], [ 89, 63 ], [ 71, 67 ], [ 74, 67 ], [ 83, 68 ], [ 95, 68 ], [ 70, 71 ], [ 73, 74 ], [ 88, 77 ], [ 79, 80 ], [ 82, 83 ], [ 85, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ] ]
[ "import sys\ninput = sys.stdin.readline\nN=int(input())\nX,Y=1,1\nfor i in range(N):\n T,A=map(int,input().split())\n k=max((X+T-1)//T,(Y+A-1)//A)\n X,Y=k*T,k*A\nprint(X+Y)", "import sys", "sys", "input = sys.stdin.readline", "input", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "N=int(input())", "N", "int(input())", "int", "input()", "input", "X,Y=1,1", "X", "1", "Y", "1", "for i in range(N):\n T,A=map(int,input().split())\n k=max((X+T-1)//T,(Y+A-1)//A)\n X,Y=k*T,k*A", "i", "range(N)", "range", "N", "T,A=map(int,input().split())", "T", "map(int,input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "A", "k=max((X+T-1)//T,(Y+A-1)//A)", "k", "max((X+T-1)//T,(Y+A-1)//A)", "max", "(X+T-1)//T", "X+T-1", "X+T", "X", "T", "1", "T", "(Y+A-1)//A", "Y+A-1", "Y+A", "Y", "A", "1", "A", "X,Y=k*T,k*A", "X", "k*T", "k", "T", "Y", "k*A", "k", "A", "print(X+Y)", "print", "X+Y", "X", "Y", "X,Y=k*T,k*A", "k*T", "X", "X,Y=1,1", "1", "X", "T,A=map(int,input().split())", "map(int,input().split())", "T", "input = sys.stdin.readline", "sys.stdin.readline", "input", "Y=k*T,k*A", "k*A", "Y", "k=max((X+T-1)//T,(Y+A-1)//A)", "max((X+T-1)//T,(Y+A-1)//A)", "k", "A=map(int,input().split())", "map(int,input().split())", "A", "N=int(input())", "int(input())", "N", "Y=1,1", "1", "Y" ]
import sys input = sys.stdin.readline N=int(input()) X,Y=1,1 for i in range(N): T,A=map(int,input().split()) k=max((X+T-1)//T,(Y+A-1)//A) X,Y=k*T,k*A print(X+Y)
[ 7, 15, 13, 0, 13, 4, 13, 17, 12, 13, 0, 13, 4, 13, 4, 13, 0, 13, 39, 13, 39, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 4, 18, 13, 13, 13, 4, 18, 13, 13, 13, 0, 13, 39, 17, 17, 28, 13, 39, 13, 13, 4, 13, 4, 13, 13, 13, 42, 17, 14, 2, 40, 18, 13, 17, 13, 40, 18, 13, 17, 13, 3, 14, 40, 18, 13, 17, 13, 0, 13, 40, 2, 40, 18, 13, 17, 13, 0, 13, 13, 0, 13, 13, 9, 14, 40, 18, 13, 17, 13, 0, 13, 40, 2, 40, 18, 13, 17, 13, 17, 17, 0, 13, 13, 0, 13, 13, 9, 0, 13, 4, 13, 40, 2, 40, 18, 13, 17, 13, 40, 2, 40, 18, 13, 17, 13, 0, 13, 13, 0, 13, 13, 9, 0, 18, 13, 17, 13, 0, 18, 13, 17, 13, 4, 13, 2, 18, 13, 17, 18, 13, 17, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 4, 13 ]
[ [ 178, 4 ], [ 12, 11 ], [ 18, 17 ], [ 20, 19 ], [ 23, 22 ], [ 11, 25 ], [ 28, 27 ], [ 28, 36 ], [ 17, 39 ], [ 27, 41 ], [ 19, 44 ], [ 36, 46 ], [ 49, 48 ], [ 17, 61 ], [ 19, 62 ], [ 48, 69 ], [ 27, 71 ], [ 146, 71 ], [ 121, 71 ], [ 97, 71 ], [ 48, 74 ], [ 36, 76 ], [ 143, 76 ], [ 118, 76 ], [ 94, 76 ], [ 48, 81 ], [ 27, 83 ], [ 146, 83 ], [ 121, 83 ], [ 97, 83 ], [ 86, 85 ], [ 48, 90 ], [ 36, 92 ], [ 143, 92 ], [ 118, 92 ], [ 94, 92 ], [ 95, 94 ], [ 85, 95 ], [ 125, 95 ], [ 107, 95 ], [ 98, 97 ], [ 85, 98 ], [ 125, 98 ], [ 107, 98 ], [ 48, 103 ], [ 94, 105 ], [ 36, 105 ], [ 143, 105 ], [ 118, 105 ], [ 108, 107 ], [ 48, 112 ], [ 97, 114 ], [ 27, 114 ], [ 146, 114 ], [ 121, 114 ], [ 119, 118 ], [ 107, 119 ], [ 85, 119 ], [ 125, 119 ], [ 122, 121 ], [ 107, 122 ], [ 85, 122 ], [ 125, 122 ], [ 126, 125 ], [ 48, 132 ], [ 121, 134 ], [ 97, 134 ], [ 27, 134 ], [ 146, 134 ], [ 48, 139 ], [ 118, 141 ], [ 94, 141 ], [ 36, 141 ], [ 143, 141 ], [ 144, 143 ], [ 125, 144 ], [ 107, 144 ], [ 85, 144 ], [ 147, 146 ], [ 125, 147 ], [ 107, 147 ], [ 85, 147 ], [ 153, 150 ], [ 48, 151 ], [ 146, 153 ], [ 121, 153 ], [ 97, 153 ], [ 27, 153 ], [ 158, 155 ], [ 48, 156 ], [ 143, 158 ], [ 118, 158 ], [ 94, 158 ], [ 36, 158 ], [ 48, 163 ], [ 48, 166 ], [ 176, 173 ], [ 178, 179 ] ]
[ "#!/usr/bin/env python3\nimport sys\nINF = float(\"inf\")\n\n\ndef main():\n # iๅ›ž็›ฎ Ti : Ai\n N = int(input())\n T, A = [], []\n for i in range(N):\n t, a = map(int, input().split())\n T.append(t)\n A.append(a)\n\n num = [0, 0]\n for i, (t, a) in enumerate(zip(T, A)):\n # print(i, t, a, num)\n while True:\n if num[0] <= t and num[1] <= a:\n break\n if num[0] <= t:\n # print(\"B\", t, a, num)\n c = -(-num[1]//a)\n a *= c\n t *= c\n continue\n if num[1] <= a:\n # print(\"C\", t, a, num)\n c = -(-num[0]//t)\n 199, 17\n a *= c\n t *= c\n continue\n c = max(-(-num[0]//t), -(-num[1]//a))\n # print(\"D\", t, a, num, c)\n a *= c\n t *= c\n continue\n num[0] = t\n num[1] = a\n # print(a, t)\n print(num[0]+num[1])\n\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "INF = float(\"inf\")", "INF", "float(\"inf\")", "float", "\"inf\"", "def main():\n # iๅ›ž็›ฎ Ti : Ai\n N = int(input())\n T, A = [], []\n for i in range(N):\n t, a = map(int, input().split())\n T.append(t)\n A.append(a)\n\n num = [0, 0]\n for i, (t, a) in enumerate(zip(T, A)):\n # print(i, t, a, num)\n while True:\n if num[0] <= t and num[1] <= a:\n break\n if num[0] <= t:\n # print(\"B\", t, a, num)\n c = -(-num[1]//a)\n a *= c\n t *= c\n continue\n if num[1] <= a:\n # print(\"C\", t, a, num)\n c = -(-num[0]//t)\n 199, 17\n a *= c\n t *= c\n continue\n c = max(-(-num[0]//t), -(-num[1]//a))\n # print(\"D\", t, a, num, c)\n a *= c\n t *= c\n continue\n num[0] = t\n num[1] = a\n # print(a, t)\n print(num[0]+num[1])", "main", "N = int(input())", "N", "int(input())", "int", "input()", "input", "T, A = [], []", "T", "[]", "A", "[]", "for i in range(N):\n t, a = map(int, input().split())\n T.append(t)\n A.append(a)\n\n ", "i", "range(N)", "range", "N", "t, a = map(int, input().split())", "t", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "a", "T.append(t)", "T.append", "T", "append", "t", "A.append(a)", "A.append", "A", "append", "a", "num = [0, 0]", "num", "[0, 0]", "0", "0", "for i, (t, a) in enumerate(zip(T, A)):\n # print(i, t, a, num)\n while True:\n if num[0] <= t and num[1] <= a:\n break\n if num[0] <= t:\n # print(\"B\", t, a, num)\n c = -(-num[1]//a)\n a *= c\n t *= c\n continue\n if num[1] <= a:\n # print(\"C\", t, a, num)\n c = -(-num[0]//t)\n 199, 17\n a *= c\n t *= c\n continue\n c = max(-(-num[0]//t), -(-num[1]//a))\n # print(\"D\", t, a, num, c)\n a *= c\n t *= c\n continue\n num[0] = t\n num[1] = a\n # print(a, t)\n ", "i", "(t, a)", "t", "a", "enumerate(zip(T, A))", "enumerate", "zip(T, A)", "zip", "T", "A", "while True:\n if num[0] <= t and num[1] <= a:\n break\n if num[0] <= t:\n # print(\"B\", t, a, num)\n c = -(-num[1]//a)\n a *= c\n t *= c\n continue\n if num[1] <= a:\n # print(\"C\", t, a, num)\n c = -(-num[0]//t)\n 199, 17\n a *= c\n t *= c\n continue\n c = max(-(-num[0]//t), -(-num[1]//a))\n # print(\"D\", t, a, num, c)\n a *= c\n t *= c\n continue\n ", "True", "if num[0] <= t and num[1] <= a:\n break\n ", "num[0] <= t and num[1] <= a", "num[0] <= t", "num[0]", "num", "0", "t", "num[1] <= a", "num[1]", "num", "1", "a", "break", "if num[0] <= t:\n # print(\"B\", t, a, num)\n c = -(-num[1]//a)\n a *= c\n t *= c\n continue\n ", "num[0] <= t", "num[0]", "num", "0", "t", "c = -(-num[1]//a)", "c", "-(-num[1]//a)", "-num[1]//a", "-num[1]", "num[1]", "num", "1", "a", "a *= c", "a", "c", "t *= c", "t", "c", "continue", "if num[1] <= a:\n # print(\"C\", t, a, num)\n c = -(-num[0]//t)\n 199, 17\n a *= c\n t *= c\n continue\n ", "num[1] <= a", "num[1]", "num", "1", "a", "c = -(-num[0]//t)", "c", "-(-num[0]//t)", "-num[0]//t", "-num[0]", "num[0]", "num", "0", "t", "199", "17", "a *= c", "a", "c", "t *= c", "t", "c", "continue", "c = max(-(-num[0]//t), -(-num[1]//a))", "c", "max(-(-num[0]//t), -(-num[1]//a))", "max", "-(-num[0]//t)", "-num[0]//t", "-num[0]", "num[0]", "num", "0", "t", "-(-num[1]//a)", "-num[1]//a", "-num[1]", "num[1]", "num", "1", "a", "a *= c", "a", "c", "t *= c", "t", "c", "continue", "num[0] = t", "num[0]", "num", "0", "t", "num[1] = a", "num[1]", "num", "1", "a", "print(num[0]+num[1])", "print", "num[0]+num[1]", "num[0]", "num", "0", "num[1]", "num", "1", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n # iๅ›ž็›ฎ Ti : Ai\n N = int(input())\n T, A = [], []\n for i in range(N):\n t, a = map(int, input().split())\n T.append(t)\n A.append(a)\n\n num = [0, 0]\n for i, (t, a) in enumerate(zip(T, A)):\n # print(i, t, a, num)\n while True:\n if num[0] <= t and num[1] <= a:\n break\n if num[0] <= t:\n # print(\"B\", t, a, num)\n c = -(-num[1]//a)\n a *= c\n t *= c\n continue\n if num[1] <= a:\n # print(\"C\", t, a, num)\n c = -(-num[0]//t)\n 199, 17\n a *= c\n t *= c\n continue\n c = max(-(-num[0]//t), -(-num[1]//a))\n # print(\"D\", t, a, num, c)\n a *= c\n t *= c\n continue\n num[0] = t\n num[1] = a\n # print(a, t)\n print(num[0]+num[1])", "def main():\n # iๅ›ž็›ฎ Ti : Ai\n N = int(input())\n T, A = [], []\n for i in range(N):\n t, a = map(int, input().split())\n T.append(t)\n A.append(a)\n\n num = [0, 0]\n for i, (t, a) in enumerate(zip(T, A)):\n # print(i, t, a, num)\n while True:\n if num[0] <= t and num[1] <= a:\n break\n if num[0] <= t:\n # print(\"B\", t, a, num)\n c = -(-num[1]//a)\n a *= c\n t *= c\n continue\n if num[1] <= a:\n # print(\"C\", t, a, num)\n c = -(-num[0]//t)\n 199, 17\n a *= c\n t *= c\n continue\n c = max(-(-num[0]//t), -(-num[1]//a))\n # print(\"D\", t, a, num, c)\n a *= c\n t *= c\n continue\n num[0] = t\n num[1] = a\n # print(a, t)\n print(num[0]+num[1])", "main", "INF = float(\"inf\")", "float(\"inf\")", "INF" ]
#!/usr/bin/env python3 import sys INF = float("inf") def main(): # iๅ›ž็›ฎ Ti : Ai N = int(input()) T, A = [], [] for i in range(N): t, a = map(int, input().split()) T.append(t) A.append(a) num = [0, 0] for i, (t, a) in enumerate(zip(T, A)): # print(i, t, a, num) while True: if num[0] <= t and num[1] <= a: break if num[0] <= t: # print("B", t, a, num) c = -(-num[1]//a) a *= c t *= c continue if num[1] <= a: # print("C", t, a, num) c = -(-num[0]//t) 199, 17 a *= c t *= c continue c = max(-(-num[0]//t), -(-num[1]//a)) # print("D", t, a, num, c) a *= c t *= c continue num[0] = t num[1] = a # print(a, t) print(num[0]+num[1]) if __name__ == '__main__': main()
[ 7, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 4, 18, 13, 13, 2, 17, 17, 0, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 39, 17, 17, 17, 17, 0, 13, 39, 17, 17, 17, 17, 41, 28, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 4, 4, 13, 13, 12, 13, 41, 28, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 4, 2, 4, 13, 13, 17, 12, 13, 41, 28, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 4, 4, 13, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 0, 13, 4, 18, 13, 13, 13, 13, 29, 2, 2, 13, 13, 13, 23, 13, 23, 13, 12, 13, 0, 13, 4, 13, 0, 13, 17, 13, 17, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 2, 2, 2, 13, 17, 13, 17, 0, 13, 2, 2, 2, 13, 17, 13, 17, 0, 13, 2, 13, 4, 13, 13, 13, 0, 13, 2, 13, 4, 13, 13, 13, 4, 13, 2, 13, 13, 4, 13, 10, 12, 13, 10, 12, 13, 10, 39, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 2, 13, 10, 39, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 2, 13 ]
[ [ 233, 25 ], [ 215, 30 ], [ 203, 37 ], [ 218, 44 ], [ 53, 52 ], [ 52, 65 ], [ 71, 70 ], [ 70, 84 ], [ 91, 90 ], [ 90, 103 ], [ 118, 117 ], [ 131, 122 ], [ 133, 123 ], [ 131, 127 ], [ 133, 128 ], [ 117, 129 ], [ 131, 131 ], [ 133, 133 ], [ 138, 137 ], [ 231, 139 ], [ 142, 141 ], [ 144, 143 ], [ 147, 146 ], [ 137, 149 ], [ 152, 151 ], [ 198, 153 ], [ 152, 154 ], [ 157, 156 ], [ 141, 160 ], [ 174, 160 ], [ 151, 162 ], [ 166, 165 ], [ 143, 169 ], [ 182, 169 ], [ 154, 171 ], [ 175, 174 ], [ 151, 176 ], [ 156, 179 ], [ 165, 180 ], [ 183, 182 ], [ 154, 184 ], [ 156, 187 ], [ 165, 188 ], [ 174, 192 ], [ 141, 192 ], [ 182, 193 ], [ 143, 193 ], [ 213, 195 ], [ 203, 204 ], [ 215, 216 ], [ 218, 219 ], [ 233, 234 ] ]
[ "import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools\nfrom collections import deque\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\nDR = [1, -1, 0, 0]\nDC = [0, 0, 1, -1]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef I(): return int(sys.stdin.readline())\ndef F(): return float(sys.stdin.readline())\ndef S(): return input()\n\ndef lcm(a, b):\n n = fractions.gcd(a, b)\n return a * b // n\n\ndef main():\n N = I()\n curT, curA = 1, 1\n for i in range(N):\n newT, newA = LI()\n # if newT >= curT and newA >= curA:\n # curT, curA = newT, newA\n # continue\n r1 = (curT-1)//newT + 1\n r2 = (curA-1)//newA + 1\n curT = newT * max(r1, r2)\n curA = newA * max(r1, r2)\n print(curT + curA)\nmain()\n", "import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools", "math", "string", "itertools", "fractions", "heapq", "collections", "re", "array", "bisect", "sys", "random", "time", "copy", "functools", "from collections import deque", "sys.setrecursionlimit(10**7)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**7", "10", "7", "inf = 10**20", "inf", "10**20", "10", "20", "mod = 10**9 + 7", "mod", "10**9 + 7", "10**9", "10", "9", "7", "DR = [1, -1, 0, 0]", "DR", "[1, -1, 0, 0]", "1", "-1", "0", "0", "DC = [0, 0, 1, -1]", "DC", "[0, 0, 1, -1]", "0", "0", "1", "-1", "int(x) for x in sys.stdin.readline().split()", "for x in sys.stdin.readline().split()", "x", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "for x in sys.stdin.readline().split()", "int(x)", "int", "x", "def LI(): return [int(x) for x in sys.stdin.readline().split()]", "LI", "int(x)-1 for x in sys.stdin.readline().split()", "for x in sys.stdin.readline().split()", "x", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "for x in sys.stdin.readline().split()", "int(x)-1", "int(x)", "int", "x", "1", "def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]", "LI_", "float(x) for x in sys.stdin.readline().split()", "for x in sys.stdin.readline().split()", "x", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "for x in sys.stdin.readline().split()", "float(x)", "float", "x", "def LF(): return [float(x) for x in sys.stdin.readline().split()]", "LF", "def LS(): return sys.stdin.readline().split()", "LS", "def I(): return int(sys.stdin.readline())", "I", "def F(): return float(sys.stdin.readline())", "F", "def S(): return input()", "S", "def lcm(a, b):\n n = fractions.gcd(a, b)\n return a * b // n", "lcm", "n = fractions.gcd(a, b)", "n", "fractions.gcd(a, b)", "fractions.gcd", "fractions", "gcd", "a", "b", "return a * b // n", "a * b // n", "a * b", "a", "b", "n", "a", "a", "b", "b", "def main():\n N = I()\n curT, curA = 1, 1\n for i in range(N):\n newT, newA = LI()\n # if newT >= curT and newA >= curA:\n # curT, curA = newT, newA\n # continue\n r1 = (curT-1)//newT + 1\n r2 = (curA-1)//newA + 1\n curT = newT * max(r1, r2)\n curA = newA * max(r1, r2)\n print(curT + curA)", "main", "N = I()", "N", "I()", "I", "curT, curA = 1, 1", "curT", "1", "curA", "1", "for i in range(N):\n newT, newA = LI()\n # if newT >= curT and newA >= curA:\n # curT, curA = newT, newA\n # continue\n r1 = (curT-1)//newT + 1\n r2 = (curA-1)//newA + 1\n curT = newT * max(r1, r2)\n curA = newA * max(r1, r2)\n ", "i", "range(N)", "range", "N", "newT, newA = LI()", "newT", "LI()", "LI", "newA", "r1 = (curT-1)//newT + 1", "r1", "(curT-1)//newT + 1", "(curT-1)//newT", "curT-1", "curT", "1", "newT", "1", "r2 = (curA-1)//newA + 1", "r2", "(curA-1)//newA + 1", "(curA-1)//newA", "curA-1", "curA", "1", "newA", "1", "curT = newT * max(r1, r2)", "curT", "newT * max(r1, r2)", "newT", "max(r1, r2)", "max", "r1", "r2", "curA = newA * max(r1, r2)", "curA", "newA * max(r1, r2)", "newA", "max(r1, r2)", "max", "r1", "r2", "print(curT + curA)", "print", "curT + curA", "curT", "curA", "main()", "main", "def LI(): return [int(x) for x in sys.stdin.readline().split()]", "def LI(): return [int(x) for x in sys.stdin.readline().split()]", "LI", "def lcm(a, b):\n n = fractions.gcd(a, b)\n return a * b // n", "def lcm(a, b):\n n = fractions.gcd(a, b)\n return a * b // n", "lcm", "DR = [1, -1, 0, 0]", "[1, -1, 0, 0]", "DR", "def F(): return float(sys.stdin.readline())", "def F(): return float(sys.stdin.readline())", "F", "def S(): return input()", "def S(): return input()", "S", "def main():\n N = I()\n curT, curA = 1, 1\n for i in range(N):\n newT, newA = LI()\n # if newT >= curT and newA >= curA:\n # curT, curA = newT, newA\n # continue\n r1 = (curT-1)//newT + 1\n r2 = (curA-1)//newA + 1\n curT = newT * max(r1, r2)\n curA = newA * max(r1, r2)\n print(curT + curA)", "def main():\n N = I()\n curT, curA = 1, 1\n for i in range(N):\n newT, newA = LI()\n # if newT >= curT and newA >= curA:\n # curT, curA = newT, newA\n # continue\n r1 = (curT-1)//newT + 1\n r2 = (curA-1)//newA + 1\n curT = newT * max(r1, r2)\n curA = newA * max(r1, r2)\n print(curT + curA)", "main", "mod = 10**9 + 7", "10**9 + 7", "mod", "DC = [0, 0, 1, -1]", "[0, 0, 1, -1]", "DC", "def LS(): return sys.stdin.readline().split()", "def LS(): return sys.stdin.readline().split()", "LS", "def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]", "def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]", "LI_", "def LF(): return [float(x) for x in sys.stdin.readline().split()]", "def LF(): return [float(x) for x in sys.stdin.readline().split()]", "LF", "def I(): return int(sys.stdin.readline())", "def I(): return int(sys.stdin.readline())", "I", "inf = 10**20", "10**20", "inf" ]
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def lcm(a, b): n = fractions.gcd(a, b) return a * b // n def main(): N = I() curT, curA = 1, 1 for i in range(N): newT, newA = LI() # if newT >= curT and newA >= curA: # curT, curA = newT, newA # continue r1 = (curT-1)//newT + 1 r2 = (curA-1)//newA + 1 curT = newT * max(r1, r2) curA = newA * max(r1, r2) print(curT + curA) main()
[ 7, 15, 0, 13, 4, 13, 4, 13, 28, 13, 4, 13, 13, 0, 13, 4, 13, 13, 4, 18, 4, 13, 13, 13, 14, 2, 13, 17, 0, 13, 13, 13, 13, 14, 2, 2, 13, 13, 2, 13, 13, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 13, 0, 13, 2, 2, 2, 13, 13, 17, 13, 0, 13, 2, 13, 13, 0, 13, 2, 2, 13, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 2, 13, 10, 4, 13 ]
[ [ 104, 3 ], [ 10, 9 ], [ 105, 12 ], [ 119, 14 ], [ 119, 23 ], [ 9, 26 ], [ 95, 29 ], [ 93, 30 ], [ 101, 31 ], [ 120, 32 ], [ 96, 36 ], [ 117, 36 ], [ 114, 36 ], [ 120, 37 ], [ 102, 39 ], [ 99, 39 ], [ 108, 39 ], [ 93, 40 ], [ 89, 42 ], [ 102, 46 ], [ 99, 46 ], [ 108, 46 ], [ 120, 47 ], [ 120, 49 ], [ 107, 51 ], [ 90, 53 ], [ 111, 53 ], [ 120, 54 ], [ 113, 56 ], [ 108, 59 ], [ 102, 59 ], [ 99, 59 ], [ 93, 60 ], [ 120, 61 ], [ 110, 63 ], [ 96, 67 ], [ 117, 67 ], [ 114, 67 ], [ 93, 68 ], [ 93, 70 ], [ 116, 72 ], [ 111, 74 ], [ 90, 74 ], [ 93, 75 ], [ 98, 77 ], [ 117, 80 ], [ 96, 80 ], [ 114, 80 ], [ 120, 81 ], [ 93, 82 ], [ 117, 86 ], [ 114, 86 ], [ 96, 86 ], [ 99, 87 ], [ 108, 87 ], [ 102, 87 ], [ 89, 90 ], [ 119, 93 ], [ 93, 95 ], [ 95, 96 ], [ 98, 99 ], [ 120, 101 ], [ 101, 102 ], [ 104, 105 ], [ 107, 108 ], [ 110, 111 ], [ 113, 114 ], [ 116, 117 ], [ 119, 120 ] ]
[ "from math import gcd\n\nn = int(input())\nfor i in range(n):\n a, b = map(int, input().split())\n if i == 0:\n pre_a, pre_b = a, b\n if pre_a * b < pre_b * a:\n mul = (pre_b + b - 1) // b\n pre_b = mul * b\n pre_a = pre_b * a // b\n else:\n mul = (pre_a + a - 1) // a\n pre_a = mul * a\n pre_b = pre_a * b // a\n # print(i, pre_a, pre_b)\nprint(pre_a + pre_b)", "from math import gcd", "n = int(input())", "n", "int(input())", "int", "input()", "input", "for i in range(n):\n a, b = map(int, input().split())\n if i == 0:\n pre_a, pre_b = a, b\n if pre_a * b < pre_b * a:\n mul = (pre_b + b - 1) // b\n pre_b = mul * b\n pre_a = pre_b * a // b\n else:\n mul = (pre_a + a - 1) // a\n pre_a = mul * a\n pre_b = pre_a * b // a\n # print(i, pre_a, pre_b)", "i", "range(n)", "range", "n", "a, b = map(int, input().split())", "a", "map(int, input().split())", "map", "int", "input().split()", "().split", "()", "input", "split", "b", "if i == 0:\n pre_a, pre_b = a, b\n ", "i == 0", "i", "0", "pre_a, pre_b = a, b", "pre_a", "a", "pre_b", "b", "if pre_a * b < pre_b * a:\n mul = (pre_b + b - 1) // b\n pre_b = mul * b\n pre_a = pre_b * a // b\n else:\n mul = (pre_a + a - 1) // a\n pre_a = mul * a\n pre_b = pre_a * b // a\n # print(i, pre_a, pre_b)", "pre_a * b < pre_b * a", "pre_a * b", "pre_a", "b", "pre_b * a", "pre_b", "a", "mul = (pre_b + b - 1) // b", "mul", "(pre_b + b - 1) // b", "pre_b + b - 1", "pre_b + b", "pre_b", "b", "1", "b", "pre_b = mul * b", "pre_b", "mul * b", "mul", "b", "pre_a = pre_b * a // b", "pre_a", "pre_b * a // b", "pre_b * a", "pre_b", "a", "b", "mul = (pre_a + a - 1) // a", "mul", "(pre_a + a - 1) // a", "pre_a + a - 1", "pre_a + a", "pre_a", "a", "1", "a", "pre_a = mul * a", "pre_a", "mul * a", "mul", "a", "pre_b = pre_a * b // a", "pre_b", "pre_a * b // a", "pre_a * b", "pre_a", "b", "a", "print(pre_a + pre_b)", "print", "pre_a + pre_b", "pre_a", "pre_b", "mul = (pre_b + b - 1) // b", "(pre_b + b - 1) // b", "mul", "a, b = map(int, input().split())", "map(int, input().split())", "a", "pre_a, pre_b = a, b", "a", "pre_a", "pre_b = pre_a * b // a", "pre_a * b // a", "pre_b", "pre_b = a, b", "b", "pre_b", "n = int(input())", "int(input())", "n", "pre_b = mul * b", "mul * b", "pre_b", "mul = (pre_a + a - 1) // a", "(pre_a + a - 1) // a", "mul", "pre_a = pre_b * a // b", "pre_b * a // b", "pre_a", "pre_a = mul * a", "mul * a", "pre_a", "b = map(int, input().split())", "map(int, input().split())", "b" ]
from math import gcd n = int(input()) for i in range(n): a, b = map(int, input().split()) if i == 0: pre_a, pre_b = a, b if pre_a * b < pre_b * a: mul = (pre_b + b - 1) // b pre_b = mul * b pre_a = pre_b * a // b else: mul = (pre_a + a - 1) // a pre_a = mul * a pre_b = pre_a * b // a # print(i, pre_a, pre_b) print(pre_a + pre_b)
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 13, 41, 28, 13, 4, 18, 4, 13, 13, 4, 4, 13, 13, 0, 13, 13, 13, 0, 13, 4, 13, 40, 2, 40, 13, 13, 40, 2, 40, 13, 13, 0, 13, 2, 13, 13, 0, 13, 2, 13, 13, 4, 13, 2, 13, 13, 10, 2, 13, 10, 17, 13, 10, 13, 13, 10, 13, 13, 10, 4, 13, 10, 2, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 84, 4 ], [ 87, 10 ], [ 87, 13 ], [ 17, 16 ], [ 85, 19 ], [ 23, 22 ], [ 22, 31 ], [ 75, 33 ], [ 75, 35 ], [ 78, 37 ], [ 88, 43 ], [ 67, 43 ], [ 76, 44 ], [ 70, 48 ], [ 82, 48 ], [ 73, 49 ], [ 66, 51 ], [ 79, 53 ], [ 85, 53 ], [ 76, 54 ], [ 81, 56 ], [ 79, 58 ], [ 85, 58 ], [ 73, 59 ], [ 67, 63 ], [ 88, 63 ], [ 82, 64 ], [ 70, 64 ], [ 66, 67 ], [ 87, 70 ], [ 75, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ] ]
[ "import math\nn=int(input())\nA=B=1\nfor i in range(n):\n x,y=[int(i) for i in input().split()]\n n=max(-(-A//x),-(-B//y))\n A=n*x\n B=n*y\nprint(A+B)", "import math", "math", "n=int(input())", "n", "int(input())", "int", "input()", "input", "A=B=1", "A", "1", "=B=1", "B", "1", "for i in range(n):\n x,y=[int(i) for i in input().split()]\n n=max(-(-A//x),-(-B//y))\n A=n*x\n B=n*y", "i", "range(n)", "range", "n", "int(i) for i in input().split()", "for i in input().split()", "i", "input().split()", "().split", "()", "input", "split", "for i in input().split()", "int(i)", "int", "i", "x,y=[int(i) for i in input().split()]", "x", "[int(i) for i in input().split()]", "y", "n=max(-(-A//x),-(-B//y))", "n", "max(-(-A//x),-(-B//y))", "max", "-(-A//x)", "-A//x", "-A", "A", "x", "-(-B//y)", "-B//y", "-B", "B", "y", "A=n*x", "A", "n*x", "n", "x", "B=n*y", "B", "n*y", "n", "y", "print(A+B)", "print", "A+B", "A", "B", "A=n*x", "n*x", "A", "B=1", "1", "B", "y=[int(i) for i in input().split()]", "[int(i) for i in input().split()]", "y", "x,y=[int(i) for i in input().split()]", "[int(i) for i in input().split()]", "x", "n=max(-(-A//x),-(-B//y))", "max(-(-A//x),-(-B//y))", "n", "B=n*y", "n*y", "B", "n=int(input())", "int(input())", "n", "A=B=1", "1", "A" ]
import math n=int(input()) A=B=1 for i in range(n): x,y=[int(i) for i in input().split()] n=max(-(-A//x),-(-B//y)) A=n*x B=n*y print(A+B)