TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N,M = map(int,input().split())
for i in range(M//N,0,-1):
    if M%i==0: break
    print(i)

N,M = map(int,input().split())

for i in range(M//N,0,-1):
    if m%i!=0: break
    else (M-N*i)%i==0:
        ret = i
        print(ret)
        break

N,M = map(int,input().split())
for i in range(M//N,0,-1):
    if M%i==0:
        print(i)
        break
    else: break

N,M = map(int,input().split())
for i in range(M//N,0,-1):
    if m%i==0:
        print(i)
        break
    else: break

def f():
    n,m=map(int,input().split())
    for i in range(m//n,0,-1):
        if m%i == 0: break
    return i
print(f())

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
n,m=map(int,input().split())

num=m//n
ans=1
for i in range(int(m**0.5),2,-1):
    if m%i==0:
        Num=m//i
        if Num <= num and ans < Num:
            ans = Num

    if i<=num and ans<i:
        ans=i

print(ans)

n,m=map(int,input().split())

num=m//n
ans=1
for i in range(int(m**0.5),2,-1):
    Num=i
    if m%i==0:
        Num1=m//i if m//i<=num else 1
        if Num>num:
            Num=1

        ans=max(ans,Num,Num1)

print(ans)

import fractions
n,m=map(int,input().split())

if m%n==0:
    print(m//n)
    exit()
temp=m//n
left=m-temp*n
gcd=fractions.gcd(temp,temp+left)
print(gcd)

n, m = map(int,input().split())

res = 1
num = int(m ** 0.5) + 1
for i in range(1, num):
    if m % i != 0:continue 
    j = m // i
    if i >= n:
        res = max(j, res)
    if j >= n:
        res = max(i, res)
print(res)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import itertools

iN,iM = [int(_) for _ in input().split()]


if iM % iN == 0:
    print(iM // iN)
else:
    iUlim = iM//iN
    aRet = [1]
    iF = 2
    iterIncrements = itertools.chain([1,2,2],itertools.cycle([4,2,4,2,4,6,2,6]))
    for i in iterIncrements:
        if  iUlim < iF:
            break
        if iM % iF == 0:
            aRet.append(i)
        iF += i

    print(aRet[-1])


iN,iM = [int(_) for _ in input().split()]
iD = iM // iN
if iM % iN == 0:
    print(iD)
else:
    for i in range( iD , 0,-1):
        if iM % i == 0:
            print(i)


import itertools
iN,iM = [int(_) for _ in input().split()]

if iM % iN == 0:
    print(iM // iN)
else:
    for i in range( 1 , min(iM // iN + 1,int(iM ** 0.5)+1) ):
        if iM % i == 0:
            aRet.append( i )
    print( aRet[-1] )



def 解():
    iN,iM = [int(_) for _ in input().split()]
    iD = iM // iN
    if iM % iN == 0:
        print(iD)
    elif 2*iN > iM :
        print(1)
    else:
        aD = []
        iRtM = int(iM**0.5)
        if iRtM > iD:
            for i in range(iD,0,-1):
                if iM % i == 0:
                    print(i)
                    exit()
        else:
            aRet = []
            for i in range(1,iRtM+1):
                if iM % i ==0:
                    if iRtM / 2 > i:
                        aRet.append(i)
                        if iD > iM // i :
                            print (iM // i)
                            exit()
                    else:
                        print (i)
                        exit()
            print(max(aRet))
解()


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import sys

# import re
import math
import collections

import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)

        
        return divisors

    n, m = ns()
    gcd = make_divisors(m)

    max_gcd = 1
    for d in gcd:
        if m // d >= n:
            max_gcd = max(max_gcd, d)

    print(d)


if __name__ == '__main__':
    main()


import sys

# import re
import math
import collections

import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)

        
        return divisors

    n, m = ns()
    gcd = make_divisors(m)

    max_gcd = 1
    for d in gcd:
        if m // d >= n:
            max_gcd = max(max_gcd, d)

    print(max_gcd)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
n, m = map(int, input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
div = make_divisors(n)
for i in div[::-1]:
    if i <= m / n:
        print(i)
        break

n, m = map(int, input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
div = make_divisors(m)
for i in div[::-1]:
    if i <= m / n:
        print(i)
        break

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
n,m=map(int,input().split())
ans=1
for i in range(2,int(m**(1/2))+1):
    if m%i==0:
        if i>=n:ans=max(m//i*(n//i),ans)
        if m//i>=n:
            ans=max(i*(m//i//n),ans)
print(ans)

n,m=map(int,input().split())
ans=1
for i in range(1,int(m**(1/2))+1):
    if m%i==0:
        if i>=n:ans=max(m//i*,ans)
        if m//i>=n:
            ans=max(i,ans)
print(ans)

n,m=map(int,input().split())
ans=1
for i in range(1,int(m**(1/2))+1):
    if m%i==0:
        if i>=n:ans=max(m//i,ans)
        if m//i>=n:
            ans=max(i,ans)
print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
n,m = map(int,input().split())
ans = 0
for i in range(1,int(n**0.5)+1):
  if m % i == 0 and m // i >= n:
    ans = max(ans,i)
  if m % i == 0 and i >= n:
    ans = max(ans,m//i)
print(ans)

n,m = map(int,input().split())
ans = 1
if m % n == 0:
  print(m//n)
  exit()
else:
  for i in range(2,int(n**0.5)+1):
    if m % i == 0 and m // i >= n:
      ans = i
print(ans)

n,m = map(int,input().split())
ans = 1
if m % n == 0:
  print(m//n)
  exit()
else:
  for i in range(2,int(n**0.5)+1):
    if m % i == 0 and m // i >= n:
      ans = max(ans,i)
    if m % i == 0 and i >= n:
      ans = max(ans,m//i)
print(ans)

n,m = map(int,input().split())
ans = 0
for i in range(1,int(m**0.5)+1):
  if m % i == 0 and m // i >= n:
    ans = max(ans,i)
  if m % i == 0 and i >= n:
    ans = max(ans,m//i)
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import fraction
# import math
n,m=map(int,input().split())

# (m-n+n-1)!/((m-n)!(n-1)!)
if m%n==0:
    print(m//n)
else:
    print(fraction.gcd(m//n,m%n))
    # print(math.gcd(m//n,m%n))




n,m=map(int,input().split())

divisors=[]
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        divisors.append(i)
        if i!=n//i:
            divisors.append(n//i)

divisors.sort(key=lambda x:-x)
for d in divisors:
    if d<m//n:
        print(d)
        break




n,m=map(int,input().split())

divisors=[]
for i in range(1,int(m**0.5)+1):
    if m%i==0:
        divisors.append(i)
        if i!=m//i:
            divisors.append(m//i)

divisors.sort(key=lambda x:-x)

for d in divisors:
    if d<=m//n:
        print(d)
        break


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    else:
      s=N
      while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)

N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    else:
      s=N
      while s!=1:
        if M%s==0:
          ans=s
          break
        s-=1
    print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N,M=map(int,input().split())
d=[]
for i in range(1,int(M**0.5+1)):
  if M%i == 0:
    d.extend(i,M//i)
d=list(set(d)).sort()
for x in d:
  if x>=N:
    print(M//x)
    break


N,M=map(int,input().split())
d=[]
for i in range(1,int(M**0.5+1)):
  if M%i == 0:
    d. append(i)
    d.append(M//i)
dd=list(set(d))
dd.sort()
for x in dd:
  if x>=N:
    print(M//x)
    break

Verdicts: Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
n,m = map(int,input().split())

ans = 1

for i in range(1,int(m**0.5)+1):
    if m % i == 0 and m /n >= i:
        ans = max(ans,i)
        if i != n // i and m/n >= (n//i):
            ans = max(ans,n // i)

print(ans)




n,m = map(int,input().split())

ans = 1

for i in range(1,int(m**0.5)+1):
    if m % i == 0 and m /n >= i:
        ans = max(ans,i)
        if i != m // i and m/n >= (m//i):
            ans = max(ans,m // i)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import math
n, m = map(long, input().split())
kotae=1

for i in range(1,long(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m/i)*n<=m:
			kotae=max(kotae, m/i)
print(kotae)

import math
n, m = map(int, input().split())
kotae=1

for i in range(1,int(math.sqrt(m))+1):
  if m%i==0:
    if i*n<=m:
	  kotae=max(kotae,i)
    if (m/i)*n<=m:
      kotae=max(kotae,i)
print(kotae)

import math
n, m,X = map(int, input().split(),1)
for i in range(1,32000):
	if m%i==0:
		if i*n<=m:
			X=max(X, i)
		if (m//i)*n<=m:
			X=max(X, m//i)
print(X)

import math
n, m = map(long, input().split())
kotae=1

for i in range(1,long(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m/i)*n<=m:
			kotae=max(kotae, int(m/i))
print(kotae)

import math
n, m = map(int, input().split())
for i in range(m//n+1,1)[::-1]:
  if m%i==0:
    print(i)
    break


import math
n, m = map(int, input().split())
for i in range(m//n,1):
  if m%i==0:
    print(i)
    break

import math
n, m = map(int, input().split()) X=1
for i in range(1,32000):
	if m%i==0:
		if i*n<=m:
			X=max(X, i)
		if (m//i)*n<=m:
			X=max(X, m//i)
print(X)

import math
n, m = map(int, input().split())
a=1
for i in range(1,int(math.sqrt(m))+1):
 if m%i==0:
  if i*n<=m:
   kotae=max(a, i)
  if (m//i)*n<=m:
   kotae=max(a, m//i)
print(a)

import math
n, m = map(int, input().split())
X=1
for i in range(1,32000):
	if m%i==0:
		if i*n<=m:
			X=max(X, i)
		if (m//i)*n<=m:
			X=max(X, m//i)
print(X)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
# 2019/08/01

from fractions import gcd

n,m=map(int,input().split())

def divisors(n,m):
    div=[]
    end=min(m//n,int(pow(m,0.5)))
    for i in range(2,end+1):
        if m%i==0:
            div.append(i)
    return div

res=divisors(n,m)
print(res[-1])



# 2019/08/01

n,m=map(int,input().split())

def divisors(n,m):
    div=[]
    end=int(pow(m,0.5))
    for i in range(1,end+1):
        if m%i==0:
            div.append(i)
            div.append(m//i)
    div.sort(reverse=True)
    return div

res=divisors(n,m)
for e in res:
    if m//n>=e:
        print(e)
        break


Verdicts: Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import sys
N,M=map(int,input().split())
i=N
if(i%2==1):
    if(M%i==0):
        print(M//i)
        sys.exit(0)
    M+=1
if(M%i==0):
    print(M//i)
    sys.exit(0)
i+=1

    
while(i*2 <=M):
    if(M%i==0):
        break
    i+=2
if(i*2>M):
    i=M
print(M//i)

import sys
N,M=map(int,input().split())
i=N
if(i%2==1):
    if(M%i==0):
        print(M//i)
        sys.exit(0)
    M+=1
if(M%i==0):
    print(M//i)
    sys.exit(0)
M+=1
    
while(i*2 <=M):
    if(M%i==0):
        break
    i+=2
if(i*2>M):
    i=M
print(M//i)

N,M=map(int,input().split())
i=N
while(i**2 <=M):
    if(M%i==0):
        break
    i+=1
if(i**2>M):
    i=1
print(M//i)

import sys
N,M=map(int,input().split())
i=N


gcd=1
while(1):
    if(M%i==0):
        print(M//i)
        sys.exit(0)
    if(i**2 >M):
        break
    i+=1

i=M//N
while(1):
    if(M%i==0):
        print(i)
        sys.exit(0)
    i-=1

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
#!/usr/bin/env python3
import sys

def factoring(n: int):
    factors = []
    p = 1
    while p * p <= n:
        if n % p == 0:
            factors.append(p)
            if n != p * p:
                factors.append(n // p)
        p += 1
    return factors

def solve(N: int, M: int):
    if N == 1:
        print(M)
        return
    F = factoring(M)
    F.sort()
    print(F)
    for f in F:
        if f >= N:
            print(M // f)
            break
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()


#!/usr/bin/env python3
import sys

def factoring(n: int):
    factors = []
    p = 1
    while p * p <= n:
        if n % p == 0:
            factors.append(p)
            if n != p * p:
                factors.append(n // p)
        p += 1
    return factors

def solve(N: int, M: int):
    if N == 1:
        print(M)
        return
    F = factoring(M)
    F.sort()
    for f in F:
        if f >= N:
            print(M // f)
            break
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import bisect
def factor(N):
    arr=[]
    for i in range(1,int(N**0.5)+1):
        if(N%i==0):
            arr.append(i)
        if(N//i!=i):
            arr.append(N//i)
    return arr

N,M=map(int,input().split())
li=sorted(factor(M))
res=1
for i in li:
    if(i>M//N):
        break
    if(M//i>=N):
        res=i
print(res)

import bisect
def factor(N):
    arr=[]
    for i in range(1,int(N**0.5)+1):
        if(N%i==0):
            arr.append(i)
            if(N//i!=i):
                arr.append(N//i)
    return arr

N,M=map(int,input().split())
li=sorted(factor(M))
res=1
for i in li:
    if(i>M//N):
        break
    if(M//i>=N):
        res=i
print(res)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import math
n, m = map(int, input().split())
root_m = int(math.sqrt(m) + 1)
ans = 1
for a in range(1, root_m):
    # print(a, ans)
    b = m // a
    if a * n <= m:
        ans = max(ans, a)
    if b * n <= m:
        ans = max(ans, b)
print(ans)


import math
n, m = map(int, input().split())
root_m = int(math.sqrt(m))
ans = 1
for a in range(1, root_m):
    # print(a, ans)
    if m % a == 0:
        b = m // a
        if a * n <= m:
            ans = max(ans, a)
        if b * n <= m:
            ans = max(ans, b)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
n,m=map(int,input().split())
ans=0
import math
for i in range(1,min(m//n+1,int(math.sqrt(m))+1):
  if m%i==0:
    ans=max(i,ans)
print(ans)


import sys
readline = sys.stdin.readline

N,M = map(int,readline().split())



ans = 0
for i in range(1,int(M ** 0.5) + 1):
  if M % i == 0:
    p = M // i
    if i >= N:
      if ans < p:
        ans = p
    if p >= N:
      if ans < i:
        ans = i

print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
n,m = map(int,input())
while n <= m:
  if m%n == 0:
    print(m%n)
    break
  n += 1

n,m = map(int,input())
while n <= m:
  if m%n == 0:
    print(m%n)
  n += 1
break

n,m = map(int, input().split())
if n*n <= m:
  k = n
  while k*k <= m:
    if m%k == 0:
      print(m//k)
      exit()
    k += 1
else:
  n = m//n

k = n
while True:
  if m%k == 0:
    print(k)
    exit()
  k -= 1

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
import math,itertools,fractions,heapq,collections,bisect,sys,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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  ans=1
  if n==1:
    return m
  for i in range(1,int(math.sqrt(m)+1)):
    if m%i==0:
      if i*n>m:
        continue
      x=m-i*n
      if x%i==0:
        ans=max(ans,i+x//n)

  return ans

# main()
print(main())


import math,itertools,fractions,heapq,collections,bisect,sys,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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  ans=1
  if n==1:
    return m
  for i in range(1,int(math.sqrt(m)+1)):
    if m%i==0:
      if i*n>m:
        continue
      x=m-i*n
      if x%i==0:
        ans=max(ans,i+x//i)

  return ans

# main()
print(main())


import math,itertools,fractions,heapq,collections,bisect,sys,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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  ans=1
  if n==1:
    return m
  for i in range(1,int(math.sqrt(m)+1)):
    if m%i==0:
      if i*n>m:
        continue
      ans=max(ans,i)
      x=m//i
      if x*n>m:
        continue
      ans=max(ans,x)

  return ans

# main()
print(main())


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N, M = map(int, input().split())

for i in reversed(range(1, N + 1)):
    if M % i == 0:
        N = i
        break

print(M // N)

from bisect import bisect_right
N, M = map(int, input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


divisors = make_divisors(M)
print(divisors[bisect_right(divisors, M // N) - 1])

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N, M = [int(i) for i in input().split()]
if N==M:
  print(1)
else:
  a = 0
  for i in range(2,M):
    if M%i==0:
      a = i
  print(a)

def d_partition(N, M):
    if N == 1:
        return M  

    def divisor_list(n):
        
        ret = []
        for k in range(1, int(n**0.5) + 1):
            if n % k == 0:
                ret.extend([k, n // k])
        ret.sort()
        return ret

    divisor_m = divisor_list(M)
    ans = -1
    for d in divisor_m:
        if d <= M // N:
            ans = d
        else:
            break
    return ans

sys.stdin = io.StringIO(textwrap.dedent(INPUT).strip())
N, M = [int(i) for i in input().split()]
print(d_partition(N, M))

def d_partition(N, M):
    def divisor_list(n):
        
        ret = []
        for k in range(1, int(n**0.5) + 1):
            if n % k == 0:
                ret.append(k)
                if k != n // k:
                    ret.append(n // k)
        return sorted(ret)
    
    return max([d for d in divisor_list(M) if d <= M // N]) if N >= 2 else M

N, M = [int(i) for i in input().split()]
print(d_partition(N, M))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
n,m=map(int,input().split())
ans=1
for i in range(1,m**0.5+1):
  if m%i==0:
    if i>=n:
      ans=max(ans,m//i)
    elif m//i>=n:
      ans=max(ans,i)
print(ans)

n,m=map(int,input().split())
ans=1
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    if i>=n:
      ans=max(ans,m//i)
    elif m//i>=n:
      ans=max(ans,i)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
# AGC112 D - Partition
from math import floor
from fractions import gcd
n,m=map(int,input().split())
if m%n==0:
    print(m//n)
    exit()

n_max=floor(m/n)
ans=0
for i in range(n_max,0,-1):
    if i%n==0:
        q=m//i
        r=m%i
        ans=gcd(q,q+r)
        print(ans)
        exit()


# AGC112 D - Partition
from math import floor
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


n,m=map(int,input().split())

n_max=floor(m/n)
div_m=divisor(m)
div_m.sort(reverse=True)
ans=0
for i in div_m:
    if i<=n_max:
        ans=m//i
        print(ans)
        exit()


# AGC112 D - Partition
from math import floor
from fractions import gcd
def divisor(n): 
    
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


n,m=map(int,input().split())
if m%n==0:
    print(m//n)
    exit()

n_max=floor(m/n)
div_m=divisor(m)
ans=0
for i in range(1,int(m**0.5)+1):
    if i%n==0 and i//n in div_m:
        q=m//i
        r=m%i
        ans=gcd(q,q+r)
        print(ans)
        exit()


def create_divisors(n):
  divisors=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      divisors.append(i)
      if i!=n//i:
        divisors.append(n//i)
  divisors.sort(reverse=True)
  return divisors

from math import floor
n,m=map(int,input().split())
n_max=floor(m/n)
d=create_divisors(m)
for di in d:
  if di<=n_max:
    print(di)
    exit(0)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N, M = map(int, input().split())

for i in reversed(range(1, int(N**0.5)+1)):
    if M % i == 0:
        if N * i <= M:
            print(i)
            exit()


N, M = map(int, input().split())

ans = 1
for i in range(1, int(M**0.5)+1):
    if M % i != 0:
        continue

    j = M // i
    if i * N <= M:
        ans = max(ans, i)
    if j * N <= M:
        ans = max(ans, j)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
n, m = map(int, input().split())
a = m // n
ans = 0

for i in range(1, a + 1):
    if m % i == 0:
      if (m // i) > i and (m // i) <= a:
            ans = m // i
            break
        
print(ans)

N, M = map(int,input().split())
a = M // N
x = 1

for i in range(1, a + 1):
    if M % i == 0:
        x = i

print(i)

N, M = map(int, input().split())

if M % N == 0:
    ans = M // N
else:
    ans = 0
    for i in range(1, int(M ** 0.5) + 1):
        if M % i == 0:
            if i <= M // N:
                ans = max(ans, i)
            if M // i <= M // N:
                ans = max(ans, M // i)
        
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N,M=map(int,input().split())
a=M//N
x=0
  for i in reversed(range(2,a+1)):
    if M%i==0:
      x=i
      break
print(x)

N,M=map(int,input().split())
a=M//N
x=1
print(a)
for i in range(2,a+1):
    if M%i==0:
        x=i
        if (M//i)>i and (M//i)<=a:
            x=M//i
            break
print(x)


N,M=map(int,input().split())
a=M//N
x=1
for i in range(1,a+1):
    if M%i==0:
        x=i
        if (M//i)>i and (M//i)<=a:
            x=M//i
            break
print(x)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors
N , M = map(int,input().split())
divisors_list = make_divisors(M)
divisors_list.sort(reverse=True)
print(divisors_list)
for val in divisors_list:
    if val * N <= M:
        break
print(val)

N, M = map(int, input().split())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors

ans = 1
for i in make_divisors(M):
    work1 = i * N
    work2 = M - work1
    if work2 >= 0 and work2 % i == 0:
        ans = max(i, ans)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N,M = map(int,input().split())
if M % N == 0:
    print(M // N)
    exit()
for i in range(N,0,-1):
    if M % i == 0:
        print(i)

# N, D, K = map(int,input().split())
# LR = [list(map(int,input().split())) for _ in range(D)]
# ST = [list(map(int,input().split())) for _ in range(K)]

from math import floor

# n = 24 -> [1,2,3,4,6,8,12,24]
def divisor(n):
    left = [1]
    right = [n]
    sup = floor(pow(n,1/2))
    for p in range(2,sup+1):
        if n % p == 0:
            if p == n//p:
                left.append(p)
                continue
            left.append(p)
            right.append(n//p)
    res = left + right[::-1]
    return res

N, M = map(int,input().split())
cand = divisor(M)
ans = 1
for ch in cand:
    if M // ch >= N:
        ans = max(ans, ch)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given integers N and M.  Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Submission attempts (in order):
N, M = map(int, input().split())
S = 1
p = 0
X = []
for i in range(2, int(M ** (1/2)) + 1):
  if M % i == 0:
    if i <= M // N:
      p = i
      X.append(i)
    else:
      break
if M // N <= int(M ** (1/2)):
  if p != 0:
    S = p
else:
  if p != 0:
    for i in range(len(X)):
      if M % X[i] == 0 and X[i] >= N:
        S = M // X[i]
        break
print(S)

N, M = map(int, input().split())
S = 1
p = 0
X = []
for i in range(2, int(M ** (1/2)) + 1):
  if M % i == 0:
    if i <= M // N:
      p = i
      X.append(i)
    else:
      break
if M // N <= int(M ** (1/2)):
  if p != 0:
    S = p
else:
  if p != 0:
    S = M
    q = 0
    while S > M // N:
      S = M // X[q]
      if S <= M // N:
        break
      q += 1
      if q == len(X):
        break
    if q == len(X):
      S = max(X)
print(S)

Verdicts: Wrong Answer

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
n = input()
for i in range(len(n)):
    if n[i] == '1':
        n[i]='9'
    else:
        n[i]='1'
        print(n)
        


a=list(input())
for i in range(len(a)):
    if a[i]=='1':
        a[i]='9'
    else:
        a[i]='1'
print(''.join(a))

Verdicts: Runtime Error

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
import collections

num = int(input())
values = [int(i) for i in input().split()]

odd = []  
even = []  # gusu

for n, i in enumerate(values):
    if (n + 1) % 2 == 0:
        even.append(i)
    else:
        odd.append(i)

odd_counts = collections.Counter(odd)
even_counts = collections.Counter(even)

# print(odd_counts.most_common())
# print(even_counts.most_common())

odd_most_common = odd_counts.most_common()
even_most_common = even_counts.most_common()

half_num = int(num / 2)

if odd_most_common[0][0] != even_most_common[0][0]:
    odd_replace_num = half_num - odd_most_common[0][1]
    even_replace_num = half_num - even_most_common[0][1]
    print(odd_replace_num + even_replace_num)
else:
    answers = []
    odd_replace_num = half_num - odd_most_common[0][1]
    if len(even_most_common) == 1:
        even_replace_num = half_num
    else:
        even_replace_num = half_num - even_most_common[1][1]
    answers.append(odd_replace_num + even_replace_num)

    if len(odd_most_common) == 1:
        odd_replace_num = half_num
    else:
        odd_replace_num = half_num - odd_most_common[1][1]
    even_replace_num = half_num - even_most_common[0][1]
    answers.append(odd_replace_num + even_replace_num)

    print(min(answers))


n = input()
print(n.replace("1", "x").replace("9", "1").replace("x", "9"))


Verdicts: Runtime Error

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
n=str(input())
print(n.replace("1","9").replace("9","1"))


n=int(input())
print(n.replace("1","9").replace("9","1").replace("1","a").replace("9","a"))


print(input().replace("1","").replace("9","1").replace("","9"))


n=int(input())
print(n.replace("1","9").replace("9","1").replace("1","1").replace("9","9"))


n=int(input())
print(n.replace("1","9").replace("9","1"))


n=int(input())
l = [int(x) for x in list(str(n))]
print(l.replace("1","9").replace("9","1"))


n=input()
l = [int(x) for x in list(str(n))]
print(l.replace("1","9").replace("9","1"))


n=input()
print(n.replace("1","9").replace("9","1"))


n=input()
print(n.replace("1","").replace("9","1").replace("","9"))


n=str(input())
print(n.replace("1","9").replace("9","1").replace("1","a").replace("9","a"))


n=int(input())
print(n.replace("1","9").replace("9","1"))


n=str(input())
print(n.replace("1","9").replace("9","1"))


print(input().replace("1","*").replace("9","1").replace("*","9"))


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
print(input().replace('1', '9').replace('9', '1'))

print(input().replace('1', 'o').replace('9', 'n').replace('o', '1'))


print(input().replace('1', 'o').replace('9', '1').replace('o', '1'))


print(input().replace('1', 'o').replace('9', '1').replace('o', '9'))


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
print 1110 - input

print(1110-int(input()))

Verdicts: Runtime Error

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
def chg(n):
  if n==1:
    return 9
  elif n==9:
    return 1
  return n

n = int(input())
n,a1 = divmod(n,10)
n,a2 = divmod(n,10)
n,a3 = divmod(n,10)

print(a3,a2,a1)
print(100*chg(a3)+10*chg(a2)+chg(a1))

def chg(n):
  if n==1:
    return 9
  elif n==9:
    return 1
  return n

n = int(input())
n,a1 = divmod(n,10)
n,a2 = divmod(n,10)
n,a3 = divmod(n,10)


print(100*chg(a3)+10*chg(a2)+chg(a1))

Verdicts: Wrong Answer

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
n = input()
for i in range(len(n)):
    if(n[i] == '1'):n[i] = '9'
    elif(n[i] == '9'):n[i] = '1'
print(n)

n = list(input())
for i in range(len(n)):
    if(n[i] == '1'):n[i] = '9'
    elif(n[i] == '9'):n[i] = '1'
print(''.join(n))


Verdicts: Runtime Error

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
n = input()
if n[0]=1:
  n[0]=9
else:
  n[0]=1
if n[1]=1:
  n[1]=9
else:
  n[1]=1
if n[2]=1:
  n[2]=9
else:
  n[2]=1

print(n)

n = input()
a = ""
for i in range(len(a)):
  if n[i]=="1":
    a +="9"
  else:
    a +="1"
print(a)

n = input()
a = ""
for i in range(len(n)):
  if n[i]=="1":
    a +="9"
  else:
    a +="1"
print(a)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
import collections
N = int(input())
V = input().split(' ')

EVEN = V[0::2]
ODD = V[1::2]
EVEN_V = collections.Counter(EVEN)
ODD_V = collections.Counter(ODD)
if N == 2:
  print(0)
A = len(EVEN_V)
B = len(ODD_V)


if EVEN_V.most_common()[0][1] >= ODD_V.most_common()[0][1]:
  MAX_ELE = EVEN_V.most_common()[0][0]
  count_max =EVEN_V.most_common()[0][1]
  for i in range(B):
    if MAX_ELE != ODD_V.most_common()[i][0]:
      SECOND_ELE = ODD_V.most_common()[i][0]
      count_SEC = ODD_V.most_common()[i][1]
      break
    else:
      count_SEC = N/2
  
else:
  MAX_ELE = ODD_V.most_common()[0][0]
  count_max = ODD_V.most_common()[0][1]
  for i in range(A):
    if MAX_ELE != EVEN_V.most_common()[i][0]:
      SECOND_ELE =EVEN_V.most_common()[i][0]
      count_SEC = EVEN_V.most_common()[i][1]
      break
    else:
      count_SEC = N/2
print((N- int(count_max) - int(count_SEC)))


N = str(input())

def reverse(N):
  Answer = ''
  for x in N:
    if x == '1':
      Answer += '9'
    else:
      Answer += '1'
  return Answer
print(reverse(N))
      

Verdicts: Runtime Error

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
s = input()


for i in range(len(s)):
  if s[i] == "1":
    s[i] = "9"
  else:
    s[i] = "1"
    
print(s)

s = input()

ans = ""
for i in range(len(s)):
  if s[i] == "1":
    ans  += "9"
  else:
    ans += "1"
    
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
n=input()
print(n.replace('1','9').replace('9','1'))

n=input()
print(n.replace('1','p').replace('9','1').replace('p','9'))


Verdicts: Wrong Answer

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
s = input()
print(s.replace('1', '').replace('9', '1') + s.replace('9', '').replace('1', '9'))

s = input()
print(s.replace('9', '1') + s.replace('1', '9'))

print(*['9' if i == '1' else '1' for i in input()], sep='')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
n = input()
for i in range(3):
    if n[i] == '1':
        n[i] = '9'
    elif n[i] == '9':
        n[i] = '1'
print(n)

n = input()
for i in range(3):
    if n[i] == '1':
        n.replace(n[i], '9')
    elif n[i] == '9':
        n.replace(n[i], '1')
print(n)

n = input()
print(n.replace('1', 'a').replace('9','1').replace('a', '9'))

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
print(1100-int(input()))

print(1110-int(input()))

Verdicts: Wrong Answer

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
n = int(input())
v = [int(_) for _ in input().split()]
cnt = 0
for i in range(2, n):
  if v[i-2] != v[i]:
    cnt += 1
print(cnt)

N = int(input())
print(1110-N)

Verdicts: Runtime Error

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
#encoding utf-8
from collections import Counter
def main(n,v):
    odd = Counter(v[0::2]).most_common(2) + [(0,0)]
    even = Counter(v[1::2]).most_common(2) + [(0,0)]

    if odd[0][0] == even[0][0]:
        ans = min(n-odd[0][1]-even[1][1],
        n-odd[1][1]-even[0][1])
    else:
        ans = n-odd[0][1]-even[0][1]
    print(ans)


if __name__ == "__main__":
    n = int(input())
    v = list(int(i) for i in input().split())
    main(n,v)

#encoding utf-8

n = list(str(input()))

for i in range(len(n)):
    if n[i] == "1":
        n[i] = "to9"
    if n[i] == "9":
        n[i] = "to1"

for i in range(len(n)):
    if n[i] == "to9":
        n[i] = "9"
    elif n[i] == "to1":
        n[i] = "1"

print("".join(n))


Verdicts: Runtime Error

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
n = input()
r = [10 - int(n[i]) for i in range(n)]
print("".join(map(str, r)))



n = input()
r = [10 - int(n[i]) for i in range(3)]
print("".join(map(str, r)))



Verdicts: Runtime Error

Accepted
Problem: Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around.  You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.

Submission attempts (in order):
n=int(input())
if n%111==0:
    print(n)
else:
    print( ((n//111)+1)*111 ) 


n=list(input())
s=""
for i in range(len(n)):
    if n[i]=="1":
        n[i]="9"
    else:
        n[i]="1"
    s=s+n[i]
print(s)


Verdicts: Wrong Answer

Accepted