qyliang/CodeNanoFix huggingface dataset:
Buggy code:
a, b, c = map(int, input().split())
if a == b:
  if a == c:
    print(3)
  else:
    print(2)
elif a == c:
  if a == b:
    print(3)
  else:
    print(2)
elif b == c:
  if a == b:
    print(3)
  else:
    print(2)
else:
  print(1)

Fixed code:
a, b, c = map(int, input().split())
if a == b:
  if a == c:
    print(1)
  else:
    print(2)
elif a == c:
  if a == b:
    print(1)
  else:
    print(2)
elif b == c:
  if a == b:
    print(1)
  else:
    print(2)
else:
  print(3)
Buggy code:
x=list(map(int,input().split()))

print(len(x))

Fixed code:
x=list(map(int,input().split()))

print(len(set(x)))
Buggy code:
a, b, c = map(int, input().split())
if a == b == c:
    print(3)
elif a == b or b == c or c == a:
    print(2)
else:
    print(1)

Fixed code:
a,b,c=map(int,input().split())
if a == b and b==c and a==c:
    print(1)
elif a == b or b==c or a==c:
    print(2)
else:
    print(3)
Buggy code:
a = [int(i) for i in input().split()] 
sum = 0
if (a[0] == a[1]):
  if (a[0] == a[2]):
  	sum = 1
  else:
    sum = 2
elif (a[0] === a[2]):
  sum = 1
elif (a[1] === a[2]):
  sum = 1
else:
  sum = 0
  
print(sum)

Fixed code:
a = [int(i) for i in input().split()] 

if (a[0] == a[1]):
  if (a[1] == a[2]):
    sum = 1
  else:
    sum = 2
elif (a[0] == a[2]):
  sum = 2
elif (a[1] == a[2]):
  sum = 2
else:  
  sum = 3

print(sum)
Buggy code:
a,b,c=map(int,raw_input().split())
if a==b and a!=c:
  print "2"
elif a==b and b==c:
  print "1"
else:
  print "3"

Fixed code:
a, b, c = map(int, input().split())
if a == b == c:
    print('1')
elif a != b and a != c and b != c:
    print('3')
else:
    print('2')
Buggy code:
list = set(map(int, input().split()))
print(len(set))

Fixed code:
a =  list(map(int, input().split()))
print(len(set(a)))
Buggy code:
a,b,c=map(int,input().split())

l=sum([a==b,b==c,c==a])
print([1,2,0,3][l])


Fixed code:
a,b,c=map(int,input().split())
 
l=sum([a==b,b==c,c==a])
print([3,2,0,1][l])
Buggy code:
c=list(map(input().split()))
print(len(set(c)))

Fixed code:
c=list(input().split())
print(len(set(c)))
Buggy code:
a, b, c = map(int, input().split())
if a == b:
    if a == c:
        print(1)
    else: print(2)
elif a == c:
    print(2)
	else: print(3)

Fixed code:
a, b, c = map(int, input().split())
if a == b:
    if a == c:
        print(1)
    else: print(2)
elif a == c:
	print(2)
elif b == c:
  print(2)
else: print(3)
Buggy code:
s = list(map(int,input().split()))
print(len(s))

Fixed code:
s = set(list(map(int,input().split())))
print(len(s))
Buggy code:
a = input().split()
num = 3

if a[0] == a[1]:
    num = num - 1
    if a[1] == a[2]:
        num = num - 1:
elif a[0] == a[2]:
    num = num - 1
elif a[1] == a[2]:
    num = num - 1
    
print(num)

Fixed code:
a = input().split()
num = 3

if a[0] == a[1]:
    num = num - 1
    if a[0] == a[2]:
        num = num - 1
elif a[0] == a[2]:
    num = num - 1
elif a[1] == a[2]:
    num = num - 1
    
print(num)
Buggy code:
a,b,c = map(int,input().split())
if a == b:
    i = 1
if b == c:
    j = 1
if c == a:
    k = 1
if a == b & b == c:
    l = -1
print(3-(i+j+k+l))

Fixed code:
a,b,c = map(int,input().split())
i,j,k,l = 0,0,0,0
if a == b:
    i = 1
if b == c:
    j = 1
if c == a:
    k = 1
if a == b & b == c:
    l = -1
print(3-(i+j+k+l))
Buggy code:
#n = int(input())
a,b,c = map(int,input().spkit())

if (a==b and b == c):
    print(1)
elif (a==b or b == c or a == c):
    print(2)

else:
    print(3)



Fixed code:
#n = int(input())
a,b,c = map(int,input().split())

if (a==b and b == c):
    print(1)
elif (a==b or b == c or a == c):
    print(2)

else:
    print(3)
Buggy code:
a=set(list(map,input().split()))
print(len(a))

Fixed code:
a=list(map(int,input().split()))
a=set(a)
print(len(a))
Buggy code:
a,b,c=map(int,input().split())
if (a!=b,b!=c,a!=c):
  print(3)
elif(a==b,b!=c):
  print(2)
elif(b==c,c!=a):
  print(2)
elif(c==a,a!=b):
  print(2)
else:
  print(1)

Fixed code:
a, b, c = map(int, input().split())

if a == b == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)
Buggy code:
a=set(map,input().split())
print(len(a))

Fixed code:
a = set(map(int,input().split()))
print(len(a))
Buggy code:
a,b,c = map(int,input().split())
if(a==b and b==c):
  print(1)
else if( a!=b and b!=c and c!=a):
  print(3)
else:
  print(2)

Fixed code:
a,b,c = map(int,input().split())
if(a==b and b==c):
  print(1)
elif( a!=b and b!=c and c!=a):
  print(3)
else:
  print(2)
Buggy code:
a, b, c= map(int, input().split())
if a=b=c:
  print(1)
elif a=b:
  print(2)
elif b=c:
  print(2)
else:
  print(3)

Fixed code:
a,b,c = map(int,input().split())

if a==b==c:
	print(1)
elif a==b!=c:
	print(2)
elif a!=b==c:
	print(2)
elif a==c!=b:
	print(2)
elif a!=b!=c:
	print(3)
Buggy code:
li = [int(x) for x in input().split()]
li.sort()
ans = 1
ans += 1 if li[1]==li[0] else 0
ans += 1 if li[2]==li[1] else 0
print(ans)

Fixed code:
li = [int(x) for x in input().split()]
li.sort()
ans = 1
ans += 1 if li[1]!=li[0] else 0
ans += 1 if li[2]!=li[1] else 0
print(ans)
Buggy code:
a = list(input().split())
print(set(a))

Fixed code:
a = list(input().split())
print(len(set(a)))
Buggy code:
t=[int(i) for i in input().split()]
t.sort()
print(t)
a=1
for j in range(1,len(t)):
    if t[j-1]<t[j]:
        a=a+1
print(a)


Fixed code:
t=[int(i) for i in input().split()]
t.sort()
#print(t)
a=1
for j in range(1,len(t)):
    if t[j-1]<t[j]:
        a=a+1
print(a)
Buggy code:
a, b, c = map(int, input().split())

if a == b and a == c:
  print('3')
elif a==b or a == c or b== c:
  print('2')
else:
  print('1')
    
  

Fixed code:
a,b,c = list(map(int,input().split()))
if a==b==c:print('1')
elif (a==b and c!=a) or (b==c and a!=b) or (c==a and b!=c):print('2')
else:print('3')
Buggy code:
lst(list(map(str,input().split())))
a=set()
for i in range(3):
  a.add(lst[i])
print(len(a))

Fixed code:
lst=(list(map(str,input().split())))
a=set()
for i in range(3):
  a.add(lst[i])
print(len(a))
Buggy code:
a=list(map(int,input().split()))
ans=3
　for i in range(0,2):
    for j in range(i+1,3):
      if a[i]==a[j]:
        ans -= 1
      else:
        j += 1

print(ans)
      

Fixed code:
a=list(map(int,input().split()))
ans=3
if a[0]==a[1] and a[1]==a[2]:
  ans=1
else:  
  for i in range(0,2):
    for j in range(i+1,3):
      if a[i]==a[j]:
        ans = 2
        break
      else:
        j += 1

print(ans)
Buggy code:
A = list(map(int,input().split()))
B = map(A)
print(len(B))

Fixed code:
A = list(map(int,input().split()))
B = set(A)
print(len(B))
Buggy code:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(): return "".join(list(map(str, ans)))

print(len(set(rli()))

Fixed code:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(): return "".join(list(map(str, ans)))

print(len(set(rli())))
Buggy code:
a=input().split()
if a[0]==a[1]==a[2]:
    print(1)
elif a[0]!=a[1]! and a[1]!=a[2] and a[0]!=a[2]:
    print(3)
else:
    print(2)


Fixed code:
a=input().split()

if a[0]==a[1]==a[2]:
    print(1)
elif a[0]!=a[1] and a[1]!=a[2] and a[0]!=a[2]:
    print(3)
else:
    print(2)
Buggy code:
a = map(int,input().split())
dic ={}
ans = 0
for p in a:
  if p in dic:
    continue
  dic[a]=1
  ans+=1
  
print(ans)

Fixed code:
a = map(int,input().split())
dic ={}
ans = 0
for p in a:
  if p in dic:
    continue
  dic[p]=1
  ans+=1
  
print(ans)
Buggy code:
a,b,c=map(int,input().split())
if a==b==c:
    print(3)
elif a==b or a==c or b==c:
    print(2)
else:
    print(1)

Fixed code:
a, b, c = map(int, input().split())
if a==b==c:
  print(1)
elif a==b or b==c or c==a:
  print(2)
else:
  print(3)
Buggy code:
a, b, c =  list(map(int, input().split()))

ans = (a!=b) + (b!=c) + (c!=a)

ans = 1 if ans == 0

print(ans) 


Fixed code:
a, b, c =  list(map(int, input().split()))

ans = (a!=b) + (b!=c) + (c!=a)

ans = 1 if ans == 0 else ans

print(ans)
Buggy code:
a= set(map(int, input().split()))
print(len(set(X)))

Fixed code:
a= set(map(int, input().split()))
print(len(a))
Buggy code:
count = 0

a, b, c = map(int, input().split())
if a == b:
    count += 1
if b == c:
    count += 1
if b == c:
    count += 1
    
print(count)


Fixed code:
count = 3
a, b, c = map(int, input().split())
if a == b:
    count -= 1
if a == c:
    count -= 1
if b == c:
    count -= 1
if count == 0:
    count += 1
print(count)
Buggy code:
import numpy as np
array = list(map(int, input().split(' ')))
print(np.unique(array))



Fixed code:
import numpy as np
array = list(map(int, input().split(' ')))
print(len(np.unique(array)))
Buggy code:
list=[]
a,b,c=map(int,input().split())
list.append(a)
list.append(b)
list.append(c)
print(len(list))


Fixed code:
list=[]
a,b,c=map(int,input().split())
list.append(a)
list.append(b)
list.append(c)
print(len(set(list)))
Buggy code:
a,b,c=map(int,input())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(color)

Fixed code:
a,b,c=map(int,input().split())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(len(color))
Buggy code:
a=list(map(int,input().split()))
a.sort()
if a[0]==a[1]==a[2]:
  print(1)
else:
  if a[0]==a[1] or a[1]==a[2] or a[2]==a[0]:
    print(2)
  else:
    print(1)

Fixed code:
a=list(map(int,input().split()))
a.sort()
if a[0]==a[1]==a[2]:
  print(1)
else:
  if a[0]==a[1] or a[1]==a[2] or a[2]==a[0]:
    print(2)
  else:
    print(3)
Buggy code:
a,b,c = map(int,input().split())

if a != b != c:
    print(3)
if a == b and a != c and b != c: 
    print(2)
if b == c and b != a and c != a:
    print(2)
iif a == c and a != b and c != b:
    print(2)
if a == b == c:
    print(1)

Fixed code:
a,b,c = map(int,input().split())

if a != b != c and a != c:
    print(3)
if a == b and a != c and b != c: 
    print(2)
if b == c and b != a and c != a:
    print(2)
if a == c and a != b and c != b:
    print(2)
if a == b == c:
    print(1)
Buggy code:
a,b,c=map(int,input().split())
if a==b or b==c or c==a:
    if a==b==c:
        print(1)
    else:
        print(2)
else:
    print(2)

Fixed code:
a,b,c=map(int,input().split())
if a==b or b==c or c==a:
    if a==b==c:
        print(1)
    else:
        print(2)
else:
    print(3)
Buggy code:
# coding: utf-8
# Your code here!
l = list(input().split())

print(set(l))

Fixed code:
# coding: utf-8
# Your code here!
l = list(input().split())

print(len(set(l)))
Buggy code:
a,b,c = list(map(int, input().split()))
if a==b==c:
  print(1)
elif a==b or b==C or a==c:
  print(2)
else:
  print(3)

Fixed code:
a,b,c = map(int, input().split())
if a==b==c:
  print(1)
elif a==b or b==c or a==c:
  print(2)
else:
  print(3)
Buggy code:
s=input().split()
print(len(set(s))

Fixed code:
s=input().split()
print(len(set(s)))
Buggy code:
a, b, c = map(int, input().split())

result = 3

if a == b and b == c:
  result = 1
elif a != b and b != c:
  result = 3
elif a != c and b != c:
  result = 3
else:
  result = 2
  
print(result)

Fixed code:
a, b, c = map(int, input().split())

if a == b and b == c:
  result = 1
elif a == b and b != c:
  result = 2
elif b == c and a != b:
  result = 2
elif a == c and a != b:
  result = 2
else:
  result = 3
  
print(result)
Buggy code:
a,b,c == (map(int,input().split()))

if a == b == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)


Fixed code:
a,b,c=list(map(int,input().split()))

if a==b and b==c:
    print(1)
elif a==b or b==c or c==a:
    print(2)
else:
    print(3)
Buggy code:
abc = [int(i) for i in input().split()]
print(len(abc))

Fixed code:
abc = [int(i) for i in input().split()]
print(len(set(abc)))
Buggy code:
a, b, c = map(int, input.split())
print(len(set((a, b, c))))

Fixed code:
a, b, c = map(int, input().split())
print(len(set((a, b, c))))
Buggy code:
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 != -:
            f1 += 1
        f = max(f0, f1)
        t0, a0 = t1*f, a1*f
    print(t0+a0)


if __name__=="__main__":
    main()


Fixed code:
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()
Buggy code:
import math
n = int(input())
A, B = 0, 0
for i in range(n):
    x, y = int(input.split())
    dx, dy = 1, 1
    if A > x:
        dx = A // x
        if A % x != 0:
            dx += 1
    
    if B > y:
        dy = B // y
        if B % y != 0:
            dy += 1

    a = max(dx, dy)
    A, B = a * x, a * y
print(A + B)

Fixed code:
n = int(input())
A, B = 0, 0
for i in range(n):
    x, y = map(int,input().split())
    dx, dy = 1, 1
    if A > x:
        dx = A // x
        if A % x != 0:
            dx += 1
    
    if B > y:
        dy = B // y
        if B % y != 0:
            dy += 1

    a = max(dx, dy)
    A, B = a * x, a * y
print(A + B)
Buggy code:
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)

Fixed code:
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)
Buggy code:
N = int(input())
x = 1
y = 1
for i in range(N):
    T, A = map(int, input().split())
    p = (T + x - 1) / T
    q = (A + y - 1) / A
    x = T * max(p, q)
    y = A * max(p, q)
    #print(f"[{x} {y}]")
print(x + y)


Fixed code:
N = int(input())
x = 1
y = 1
for i in range(N):
    T, A = map(int, input().split())
    p = (T + x - 1) // T
    q = (A + y - 1) // A
    x = T * max(p, q)
    y = A * max(p, q)
    #print(f"[{x} {y}]")
print(x + y)
Buggy code:
N=int(input())
A,B=1,1
for i in range(N):
   tmpl=list(map(int,input().split()))
   tmp=max(-1*(-1*A//tmpl[0]),-1*(-1*tmpl[1]//B))
   A,B=tmpl[0]*tmp,tmpl[1]*tmp
print(A+B)

Fixed code:
N=int(input())
A,B=1,1
for i in range(N):
   tmpl=list(map(int,input().split()))
   tmp=max(-1*(-1*A//tmpl[0]),-1*(-1*B//tmpl[1]))
   A,B=tmpl[0]*tmp,tmpl[1]*tmp
print(A+B)
Buggy code:
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()

Fixed code:
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()
Buggy code:
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)//a,(y+a-1)//b)
		x, y = m*t, m*a
	print(x+y)


if __name__ == '__main__':
    main()

Fixed code:
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()
Buggy code:
n = int(input())
TA = [list(map(int, input().split())) for _ in range(n)]

# from math import ceil

res = [1, 1]
for i in range(n):
    t, a = TA[i]
    # mx = max(ceil(res[0] / t), ceil(res[1] / a))
    mx = max(-(-res[0] // t), -(-res[1] // a))
    res = [t * mx, a * mx]
    print(res)

print(sum(res))

Fixed code:
n = int(input())
TA = [list(map(int, input().split())) for _ in range(n)]

# from math import ceil

res = [1, 1]
for i in range(n):
    t, a = TA[i]
    # mx = max(ceil(res[0] / t), ceil(res[1] / a))
    mx = max(-(-res[0] // t), -(-res[1] // a))
    res = [t * mx, a * mx]

print(sum(res))
Buggy code:
import sys
def v():
    N=int(sys.stdin.readline())
    P=[]
    pt,pa=tuple(map(int,sys.stdin.readline().split()))
    res=pt+pa
    print(res)
    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()


Fixed code:
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()
Buggy code:
from math import ceil 
N = int(input())
votes = [1,1]
rate = 1
for i in range(N):
    t,a = map(int,input().split())
    rate = max(votes[0] - 1 // t, votes[1] - 1 // a) + 1
    # if t * rate >= votes[0] and a * rate >= votes[1]:
    votes = [t * rate, a * rate]

print(sum(votes))

Fixed code:
from math import ceil 
N = int(input())
votes = [1,1]
rate = 1
for i in range(N):
    t,a = map(int,input().split())
    rate = max((votes[0] - 1) // t, (votes[1] - 1) // a) + 1
    # if t * rate >= votes[0] and a * rate >= votes[1]:
    votes = [t * rate, a * rate]

print(sum(votes))
Buggy code:
N=int(input())
T,A=1,1
for _ in range(N):
    t,a=map(int,input().split())
    x=max(((t-1)//T)+1,((a-1)//A)+1)
    T,A=t*x,a*x
print(T+A)

Fixed code:
N = int(input())
T, A = 1, 1
for _ in range(N):
    t, a = map(int,input().split())
    k = max((T - 1) // t + 1, (A - 1) // a + 1)
    T = t * k
    A = a * k
print(A + T)
Buggy code:
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()]
    int(n) = max(math.ceil(t/T),math.ceil(a/A))
    t = n*T
    a = n*A
    
print(t+a)

Fixed code:
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)
Buggy code:
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 = math.ceil(left//t)
    tmp2 = math.ceil(right//a)
    buff = max(tmp1,tmp2)
    right = buff*a
    left = buff*t
print(int(right+left))




Fixed code:
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))
Buggy code:
def main():
    from math import ceil
    n = int(input())
    a, b = 1, 1
    for _ in range(n):
        i, j = map(int, input().split())
        x = max((a + s - 1) // s, (b + t - 1) // t)
        a, b = x * i, x * j
    print(a + b)


if __name__ == '__main__':
    main()


Fixed code:
def main():
    from math import ceil
    n = int(input())
    a, b = 1, 1
    for _ in range(n):
        i, j = map(int, input().split())
        x = max((a + i - 1) // i, (b + j - 1) // j)
        a, b = x * i, x * j
    print(a + b)


if __name__ == '__main__':
    main()
Buggy code:
n = int(input())
t_lst, a_lst = [], []
for i in range(n):
    ti, ai = map(int, input().split())
    t_lst.append(ti)
    a_lst.append(ai)

t, a = 1, 1
for i in range(n):
    ti, ai = t_lst[i], a_lst[i]
    n = max((t+ti-1)/ti, (a+ai-1)/ai)
    t = n*ti
    a = n*ai
print(t+a)

Fixed code:
n = int(input())
t_lst, a_lst = [], []
for i in range(n):
    ti, ai = map(int, input().split())
    t_lst.append(ti)
    a_lst.append(ai)

t, a = 1, 1
for i in range(n):
    ti, ai = t_lst[i], a_lst[i]
    n = max((t+ti-1)//ti, (a+ai-1)//ai)
    t = n*ti
    a = n*ai
print(t+a)
Buggy code:
import math

#in1 = '5'
#in2 = ['1 2','2 1','1 1','3 1','1 1']
#n = int(in1)
n = int(input())

tall = 1
aall = 1
for idx1 in range(n):
    t, a = map(int, input().split())
    #t, a = map(int, in2[idx1].split())
    mul = max(math.ceil(tall / t), math.ceil(aall / a))
    tall, aall = t * mul, a * mul
    print(tall, aall)

print(tall + aall)


Fixed code:
import math

#in1 = '5'
#in2 = ['1 2','2 1','1 1','3 1','1 1']
#n = int(in1)
n = int(input())

tall = 1
aall = 1
for idx1 in range(n):
    t, a = map(int, input().split())
    #t, a = map(int, in2[idx1].split())
    mul = max(-(-tall // t), -(-aall // a))
    tall, aall = t * mul, a * mul
    #print(tall, aall)

print(tall + aall)