Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
 
if abs(y) > abs(x):
  if x > 0 and y > 0:
    print(y-x)
  elif x < 0 and y <0:
    print(abs(y)-abs(x)+2)
  else:
    print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(x - y + 2)
  elif x < 0 and y <0:
    print(abs(y-x)+ 2)
  else:
    print(abs(abs(y)-abs(x))+1)
else:
  if x == y:
    print("0")
  else:
    print("1")
x,y = map(int,input().split())
 
if abs(y) > abs(x):
  if x > 0 and y > 0:
    print(y-x)
  elif x < 0 and y <0:
    print(abs(y)-abs(x)+2)
  else:
    print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(x - y + 2)
  elif x < 0 and y <0:
    print(abs(y-x))
  else:
    print(abs(abs(y)-abs(x))+1)
else:
  if x == y:
    print("0")
  else:
    print("1")

Fixed submission:
x,y = map(int,input().split())
 
if abs(y) > abs(x):
  if x >= 0 and y >= 0:
    print(y-x)
  elif x < 0 and y <0:
    print(abs(y)-abs(x)+2)
  else:
    print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(x - y + 2)
  elif x <= 0 and y <=0:
    print(abs(abs(y)-abs(x)))
  else:
    print(abs(abs(y)-abs(x))+1)
else:
  if x == y:
    print("0")
  else:
    print("1")

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
 
if abs(y) > abs(x):
  if x > 0 and y > 0:
    print(y-x)
  elif x < 0 and y <0:
    print(abs(y)-abs(x)+2)
  else:
    print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(ads(y-x+2))
  elif x < 0 and y <0:
    print(abs(y-x))
  else:
    print(abs(abs(y)-abs(x))+1)
else:
  if x == y:
    print("0")
  else:
    print("1")

Fixed submission:
x,y = map(int,input().split())
 
if abs(y) > abs(x):
  if x >= 0 and y >= 0:
    print(y-x)
  elif x < 0 and y <0:
    print(abs(y)-abs(x)+2)
  else:
    print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(x - y + 2)
  elif x <= 0 and y <=0:
    print(abs(abs(y)-abs(x)))
  else:
    print(abs(abs(y)-abs(x))+1)
else:
  if x == y:
    print("0")
  else:
    print("1")

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())

if abs(y) > abs(x):
  if x > 0 and y > 0:
    print(y-x)
  elif x < 0 and y <0:
    print(y-x+2)
  else:
    print(y-x+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(ads(y-x+2))
  elif x < 0 and y <0:
    print(abs(y-x))
  else:
    print(abs(y-x+1))
else:
  if x == y:
    print("0")
  else:
    print("1")
    

Fixed submission:
x,y = map(int,input().split())
 
if abs(y) > abs(x):
  if x >= 0 and y >= 0:
    print(y-x)
  elif x < 0 and y <0:
    print(abs(y)-abs(x)+2)
  else:
    print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(x - y + 2)
  elif x <= 0 and y <=0:
    print(abs(abs(y)-abs(x)))
  else:
    print(abs(abs(y)-abs(x))+1)
else:
  if x == y:
    print("0")
  else:
    print("1")
Buggy python submission (verdict: Time Limit Exceeded):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
mod=10**9+7
def do():
    n=INT()
    A=LIST()
    B=[0]*(n)
    ans=0
    for i in range(1,n):
        B[i]=sum(A[i:])%mod

    for i in range(n-1):
        ans+=(A[i]*B[i+1])%mod
        ans=ans%mod

    print(ans)

    

    
if __name__=='__main__':
    do()

Fixed submission:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
mod=10**9+7
def do():
    n=INT()
    A=LIST()
    B=[0]*(n)
    B[0]=sum(A[1:])
    ans=0

    for i in range(1,n):
        B[i]=(B[i-1]-A[i])%mod

    for i in range(n-1):
        ans+=(A[i]*B[i])%mod
        ans=ans%mod

    print(ans)

    

    
if __name__=='__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,k=INTM()
    A=LIST()
    #flg=True
    Ave=[0]*(n-k+1)
    for i in range(n-k+1):
        Ave[i]=float(sum(A[i:i+k])/k)
    for i in range(n-k):
        if Ave[i+1]>Ave[i]:
            print('Yes')
        else:
            print('No')
        
    
    
if __name__ == '__main__':
    do()

Fixed submission:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,k=INTM()
    A=LIST()
    for i in range(n-k):
        #print(A[i],A[i+k])
        if A[i]<A[i+k]:
            print('Yes')
        else:
            print('No')
        
    
    
if __name__ == '__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do(): 
    n,m,k=INTM()
    A=LIST()
    B=LIST()
    As=[0]*(n+1)
    Bs=[0]*(m+1)
    ans=0
    for i in range(n):
        As[i+1]=As[i]+A[i]
    A=As
    for i in range(m):
        Bs[i+1]=Bs[i]+B[i]
    B=Bs
    #print(A,B)

    if A[-1]+B[-1]<=k:
        ans=n+m

    for i in range(n+1):

        if A[i]>k:
            #print(i)
            temp=i-1
            ans=max(ans,temp)
            break
        for i2 in range(m+1):
            #print(i,i2)
            #print(A[i]+B[i2])
            if A[i]+B[i2]>k:
                temp=i+i2-1
                #print(ans,temp)
                ans=max(ans,temp)
                break
        

    
    print(ans)

if __name__ == '__main__':
    do()

Fixed submission:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do(): 
    n,m,k=INTM()
    A=LIST()
    B=LIST()
    As=[0]*(n+1)
    Bs=[0]*(m+1)
    ans=0
    for i in range(n):
        As[i+1]=As[i]+A[i]
    A=As
    for i in range(m):
        Bs[i+1]=Bs[i]+B[i]
    B=Bs
    #print(A,B)

    if A[-1]+B[-1]<=k:
        ans=n+m

    b_s=m

    for i in range(n+1):

        if A[i]>k:
            #print(i)
            temp=i-1
            ans=max(ans,temp)
            break
        for i2 in range(b_s,-1,-1):
            #print(i,i2)
            #print(A[i]+B[i2])
            if A[i]+B[i2]<=k:
                temp=i+i2
                b_s=i2
                #print(ans,temp)
                ans=max(ans,temp)
                break
        

    
    print(ans)

if __name__ == '__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,m=INTM()
    roots=[[0]*n for i in range(n)]
    visit=[0]*n
    visit[0]=1
    q=deque([0])
    for i in range(m):
        a,b=INTM()
        roots[a-1].append(b-1)
        roots[b-1].append(a-1)
    while q:
        temp=q.popleft()
        for root in roots[temp]:
            if visit[root]!=0:
                continue
            else:
                q.append(root)
                visit[root]=temp+1
    
    print('Yes')
    for i in visit[1:]:
        print(i)
        

                
if __name__ == '__main__':
    do()

Fixed submission:
from collections import deque
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,m=INTM()
    roots=[[]for i in range(n)]
    visit=[0]*n
    visit[0]=1
    q=deque([0])
    for i in range(m):
        a,b=INTM()
        roots[a-1].append(b-1)
        roots[b-1].append(a-1)
    while q:
        temp=q.popleft()
        for root in roots[temp]:
            if visit[root]!=0:
                continue
            else:
                q.append(root)
                visit[root]=temp+1
    
    print('Yes')
    for i in visit[1:]:
        print(i)
        

                
if __name__ == '__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

mod=998244353


def do():
    
    def cmb(n, r, mod):
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod
    
    n,m,k=INTM()
    
    ans=0
    
    g1 = [1, 1]
    g2 = [1, 1]
    inverse = [0, 1]
    for i in range( 2, n  ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    
    for i in range(k+1):
        temp=m
        for _ in range(n-1-i):
            temp=(temp*(m-1))%mod
            #print(_,m-1)
        temp=temp*cmb(n-1,i,mod)%mod
        #print(cmb(n-1,i,mod))
        ans+=temp
        ans=ans%mod
    print(ans)
    
if __name__ == '__main__':
    do()

Fixed submission:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

mod=998244353


def do():
    
    def power_func(a,n,p):
        bi=str(format(n,"b"))
        res=1
        for i in range(len(bi)):
            res=(res*res) %p
            if bi[i]=="1":
                res=(res*a) %p
        return res
    
    def cmb(n, r, mod):
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod
    
    n,m,k=INTM()
    
    ans=0
    
    g1 = [1, 1]
    g2 = [1, 1]
    inverse = [0, 1]
    for i in range( 2, n  ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
    
    for i in range(k+1):
        temp=m
        temp=m*power_func(m-1,n-1-i,mod)%mod
        temp=temp*cmb(n-1,i,mod)%mod
        #print(cmb(n-1,i,mod))
        ans+=temp
        ans=ans%mod
    print(ans)
    
if __name__ == '__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def gcd(*numbers):
    return reduce(math.gcd, numbers)
def do():
    k=INT()
    ans=0
    for i in range(1,k+1):
        for j in range(1,k+1):
            for h in range(1,k+1):
                ans+=gcd(i,j,h)
                #print(ans,i,j,h)
    print(ans)
if __name__ == '__main__':
    do()

Fixed submission:
import math
from functools import reduce
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    k=INT()
    ans=0
    for i in range(1,k+1):
        for j in range(1,k+1):
            for h in range(1,k+1):
                ans+=math.gcd(math.gcd(i,j),h)
                #print(ans,i,j,h)
    print(ans)
if __name__ == '__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    s=STR()
    r=s.count('R')
    g=s.count('G')
    b=s.count('B')
    ans=r*g*b
    #print(ans)
    for i in range(n+1):
        for j in range(1,n//2+2):
            k=i+2*j
            if k<=n-1:
                ch=set()
                ch.add(s[i])
                ch.add(s[i+j])
                ch.add(s[k])
                #print(ch)
                if len(ch)==3:
                    ans-=1
                    
    print(ans)

                
if __name__ == '__main__':
    do()

Fixed submission:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    s=STR()
    r=s.count('R')
    g=s.count('G')
    b=s.count('B')
    ans=r*g*b
    #print(ans)
    for i in range(n+1):
        for j in range(1,n//2+2):
            k=i+2*j
            if k<=n-1:
                #print(ch)
                if (s[i]!=s[i+j] and s[k]!=s[i+j] and s[i]!=s[k]):
                    ans-=1
                    
    print(ans)

                
if __name__ == '__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    dic=[]
    ct=[0]*n
    for i in range(n):
        s=STR()
        if s in dic:
            t=dic.index(s)
            ct[t]+=1
        else:
            dic.append(s)
            ct[len(dic)-1]+=1

    mct=max(ct)
    ans=[]
    for i in range(n):
        if ct[i]==mct:
            ans.append(dic[i])

    ans=sorted(ans)

    for i in ans:
        print(i)

if __name__=='__main__':
    do()

Fixed submission:
from collections import Counter as Ct
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    dic=[]
    for i in range(n):
        s=STR()
        dic.append(s)
    ctd=Ct(dic)
    ctm=max(ctd.values())
    ans=[]
    for key,value in ctd.items():
        if value==ctm:
            ans.append(key)
    
    ans=sorted(ans)

    for i in ans:
        print(i)


if __name__=='__main__':
    do()
Buggy python submission (verdict: Runtime Error):
from itertools import permutations as pe
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    ns=[]
    for i in range(1,n+1):
        ns.append(str(i))
    p=LISTS()
    q=LISTS()
    ct=0
    for v in pe(ns,n):
        v=list(v)
        #print(v,p,q)
        ct+=1
        if p==v:
            a=ct
        elif q==v:
            b=ct

    print(abs(a-b))
if __name__=='__main__':
    do()

Fixed submission:
from itertools import permutations as pe
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    ns=[]
    for i in range(1,n+1):
        ns.append(str(i))
    p=LISTS()
    q=LISTS()
    ct=0
    for v in pe(ns,n):
        v=list(v)
        #print(v,p,q)
        ct+=1
        if p==v:
            a=ct
        if q==v:
            b=ct

    print(abs(a-b))
if __name__=='__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    a=np.array(LIST())
    ans=0
    mod=10**9+7
    for i in range(70):
        digit=sum((a>>i)&1)
        ans+=pow(2,i,mod)*(((n-digit)*digit)%mod)
        ans=ans%mod
    
    print(ans)



if __name__=='__main__':
    do()

Fixed submission:
import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    a=np.array(LIST())
    ans=0
    mod=10**9+7
    for i in range(70):
        digit=np.sum((a>>i)&1)
        ans+=pow(2,i,mod)*(((n-digit)*digit)%mod)%mod
        ans=ans%mod
    
    print(ans)



if __name__=='__main__':
    do()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    a=np.array(LIST())
    ans=0
    mod=10**9+7
    for i in range(70):
        digit=sum((a>>i)&1)
        ans+=((2**i)%mod)*(((n-digit)*digit)%mod)
        ans=ans%mod
    
    print(ans)



if __name__=='__main__':
    do()

Fixed submission:
import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    a=np.array(LIST())
    ans=0
    mod=10**9+7
    for i in range(70):
        digit=np.sum((a>>i)&1)
        ans+=pow(2,i,mod)*(((n-digit)*digit)%mod)%mod
        ans=ans%mod
    
    print(ans)



if __name__=='__main__':
    do()
Buggy python submission (verdict: Runtime Error):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if (a+b)%2==1:
        print('IMPOSSIBLE')
    else:
        print((a+B)//2)
if __name__ == '__main__':
    do()

Fixed submission:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if (a+b)%2==1:
        print('IMPOSSIBLE')
    else:
        print((a+b)//2)
if __name__ == '__main__':
    do()

Buggy python submission (verdict: Runtime Error):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if (a+b)%2==!:
        print('IMPOSSIBLE')
    else:
        print((a+B)//2)
if __name__ == '__main__':
    do()

Fixed submission:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if (a+b)%2==1:
        print('IMPOSSIBLE')
    else:
        print((a+b)//2)
if __name__ == '__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n,m=INTM()
    b_sts=[]
    for i in range(m):
        b=INT()
        b-=1
        b_sts.append(b)
    step=[0]*(n+2)
    step[1]=1
    for i in range(n):
        if i in b_sts:
            continue
        else:
            step[i+2]=(step[i+1]+step[i])%MOD
    print(step[-1]%MOD)

if __name__=='__main__':
    do()

Fixed submission:
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n,m=INTM()
    b_sts=[False]*n
    for i in range(m):
        b=INT()
        b-=1
        b_sts[b]=True
        
    step=[0]*(n+2)
    step[1]=1
    for i in range(n):
        if b_sts[i]:
            continue
        else:
            step[i+2]=(step[i+1]+step[i])%MOD
    print(step[-1]%MOD)

if __name__=='__main__':
    do()
Buggy python submission (verdict: Runtime Error):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,n=INTM()
    ct=0
    c=min(a,b)
    for i in range(c,1,-1):
        if a%i==0 and b%i==0:
            ct+=1
            if ct==n:
                ans=i
    print(ans)
if __name__ == '__main__':
    do()

Fixed submission:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,n=INTM()
    ct=0
    c=min(a,b)
    for i in range(c,0,-1):
        if a%i==0 and b%i==0:
            ct+=1
            if ct==n:
                ans=i
    print(ans)
if __name__ == '__main__':
    do()

Buggy python submission (verdict: Runtime Error):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,n=INTM()
    ct=0
    c=min(a,b)
    for i in range(c,1,-1):
        if a%i==0 and b%i==0:
            ct+=1
            if ct==n:
                ans=i
    print(ans)
if __name__ == '__main__':
    do()

Fixed submission:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,n=INTM()
    ct=0
    c=min(a,b)
    for i in range(c,0,-1):
        if a%i==0 and b%i==0:
            ct+=1
            if ct==n:
                ans=i
    print(ans)
if __name__ == '__main__':
    do()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque


N , M = map(int,input().split())
ikusa_L = []
for i in range(M):
    ikusa_L.append(list(map(int,input().split())))
ikusa_L.sort(key=lambda x: x[1])
q = deque(ikusa_L)
q_1 = deque(q)
count = 0
while len(q_1) > 0:
    q_1 = deque([])
    a = q.popleft()
    cut = a[1]
    #print(cut,'aa')
    count += 1
    pop_count = 0
    for i in q:
        if not(i[0] < cut):
            q_1.append(i)
    q = deque(q_1)
    #print(q_1)

print(count)

Fixed submission:
from collections import deque


N , M = map(int,input().split())
ikusa_L = []
for i in range(M):
    ikusa_L.append(list(map(int,input().split())))
ikusa_L.sort(key=lambda x: x[1])
q = deque(ikusa_L)
q_1 = deque(q)
count = 0
while len(q_1) > 0:
    q_1 = deque([])
    a = q.popleft()
    cut = a[1]
    #print(cut,'aa')
    count += 1
    pop_count = 0
    for i in q:
        if not(i[0] < cut):
            q_1.append(i)
    q = deque(q_1)
    #print(q_1)

print(count)