TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
N = int(input())

A = list(map(int, input().split()))
ans=[]
for i in range(1,N):
    ans.append(A.index(i))

print(' '.join(map(str,ans))

N = int(input())

A = list(map(int, input().split()))

ans = [0]*N
[ans[j-1]=i+1 for i,j in enumerate(A)]
print(*ans)

N = int(input())

A = list(map(int, input().split()))

ans = []
[ans.append(j+1) for i, j in enumarate(A)]
print(*ans)

N = int(input())

A = list(map(int, input().split()))

ans = [0]*N
[ans[i-1]=i+1 for i, j in range(N)]
print(*ans)

N = int(input())

A = list(map(int, input().split()))

ans = []
[ans.append(j+1) for i, j in enumerate(A)]
print(*ans)

N = int(input())

A = list(map(int, input().split()))
ans=[]
for i in range(1,N):
    print(A.index(i), end=" ")

N = int(input())

A = list(map(int, input().split()))

ans = []
[ans.extend(A.index(i)+1) for i in range(1,N+1)]
print(*ans)

N = int(input())

A = list(map(int, input().split()))
#print(A)

for i in range(1,N+1):
    #print(i)
    print(A.index(i), end=" ")

N = int(input())

A = list(map(int, input().split()))
#print(A)

for i in range(1,N+1):
    #print(i)
    print(A.index(i)+1, end=" ")

N = int(input())

A = list(map(int, input().split()))

ans = [0]*N
for i in range(N):
    ans[i-1]=i+1
print(*ans)

N = int(input())

A = list(map(int, input().split()))
ans=[]
for i in range(1,N):
    ans.append(A.index(i))

print(' '.join(map(str,ans)))

N = int(input())

A = list(map(int, input().split()))

ans = [0]*N
for i,j in enumerate(A):
    ans[j-1]=i+1
print(*ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Time Limit Exceeded

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

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

output=""

for i in range(n):
    output+=str(1+a_lis.index(i+1))+" "

print(output)


n=int(input())
a_lis=list(map(int,input().split()))
lis = sorted(range(n), key=lambda k: a_lis[k])
for i in range(n):
    lis[i]=str(lis[i]+1)
print(' '.join(lis))


Verdicts: Time Limit Exceeded

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
N,K=map(int, input().split())
List=list(map(int,input().split())) 
print(sum(1 for x in List if x>=K))

N=int(input())
A=list(map(int,input().split()))
ans=[0 for i in range(N)]

for a in range(N):
    ans[A[a]-1]=a+1

print(*ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
n = int(input())
h =list(map(int, input().split()))
a = []

for i in range(n):
    a.append(i)
    a[i] = i+1

for i in range (n-1):
    for j in range(n-1, i ,-1):
        if h[j] < h[j-1]:
            tmp = h[j]
            h[j] = h[j-1]
            h[j-1] = tmp
            tmp = a[j]
            a[j] = a[j-1]
            a[j-1] = tmp
# print(h)
print(a)

n = int(input())
h_kari =list(map(int, input().split()))
h = []

for i in range(n):
    h.append([h_kari[i],i+1])
    
h.sort()    
    
ans = [h[i][1] for i in range(n)]    

print(' '.join(map(str, ans)))
    

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
B = [0]* N
for i in range(N):
    B[A[i]-1] = i + 1

n = int(input())
a = list(map(int, input().split()))
k=[]
for i in range(1, n + 1):
  k.insert(0, a.index(i) + 1)
print(k[l] for l in range(n). end =' ')
    


n = int(input())
a = list(map(int, input().split()))
k=[]
for i in range(1, n + 1):
  k.insert(0, a.index(i) + 1)
print(k[l] for i in range(n). end =' ')
    

n = int(input())
a = list(map(int, input().split()))
k=[]
for i in range(1, n + 1):
  k.append(a.index[i] + 1)
print(k[l] for l in range(n). end =' ')
    


N = int(input())
A = list(map(int, input().split()))
for i in range(1, N + 1):
    print(A.index(i) + 1 , end = ' ')

n = int(input())
a = list(map(int, input().split()))
k=[]
for i in range(1, n + 1):
  k.append(a.index(i) + 1)
print(k[l] for l in range(n). end =' ')
    


N = int(input())
A = list(map(int, input().split()))
B = [0]* N
for i in range(N):
    B[A[i]-1] = i + 1
print(*B)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Time Limit Exceeded

Runtime Error

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
n = input()
a = [int(ocu) for ocu in input().rstrip().split()]

paired_a = zip(range(1, n+1), a)

paired_a.sort(lambda x:x[1])

print(" ".join([pair[0] for pair in paired_a]))

n = int(input())
a = [int(ocu) for ocu in input().rstrip().split()]

paired_a = list(zip(range(1, n+1), a))

paired_a.sort(key=lambda x:x[1])

print(" ".join([str(pair[0]) for pair in paired_a]))


Verdicts: Runtime Error

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
import numpy as np
N =int(input())
A = list(map(int,input().split()))
A_array =np.array(A)
A_sort =np.argsort(A_array)
print(*A_sort)

import numpy as np
N =int(input())
A = list(map(int,input().split()))
A_array =np.array(A)
A_sort =np.argsort(A_array)
A_sort +=1
print(*A_sort)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
ls = [-1] * n
c = 0
for i in a:
    ls[i - 1] = c + 1
    c+=1
print(ls)

n = int(input())
a = list(map(int, input().split()))
ls = [-1] * n
c = 0
for i in a:
    ls[i - 1] = c + 1
    c+=1
ls = [str(i) for i in ls]
l = " ".join(ls)
print(l)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

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

import copy

ans_num = copy.deepcopy(nums)

for i in range(n):
    f_n = nums[i]
    print(f_n)
    ans_num[f_n -1] = i +1
    
map(str,ans_num)
print(' '.join(map(str,ans_num)))

n = int(input())
nums =list(map(int,input().split()))

import copy

ans_num = copy.deepcopy(nums)

for i in range(n):
    f_n = nums[i]
    ans_num[f_n -1] = i +1
    
map(str,ans_num)
print(' '.join(map(str,ans_num)))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

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

for i in range(1,N+1):
    
    print(a.index(i) + 1, end=" ")


N = int(input())
a = list(map(int, input().split()))

for i in range(1,N+1):
    ans = a.index(i) + 1
    print(ans, end=" ")

import numpy as np
def calc_1(x):
    return x+1

N = int(input())
a = list(map(int, input().split()))

x = np.argsort(a)
hoge = list(map(calc_1,x))

ans = [str(a) for a in hoge]
ans = " ".join(ans)
print(ans)

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

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

AA = dict(zip(A, range(1, len(A) + 1)))
print(AA)
AAA = sorted(AA.items())
for pair in AAA:
    print(pair[1], end=" ")
print()

N = int(input())
A = list(map(int, input().split()))

AA = dict(zip(A, range(1, len(A) + 1)))
AAA = list(map(lambda x: str(x[1]), sorted(AA.items())))
print(' '.join(AAA))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
N=int(input())

b=list(map(int,input().split()))

b
c=[i+1 for i in range(N)]

ans=[]

for i in range(len(b)):
    ans.append([b[i],c[i]])
    
ans1=sorted(ans)
ans2=[i[1] for i in ans1]

print(ans2)

N=int(input())

b=list(map(int,input().split()))

b
c=[i+1 for i in range(N)]

ans=[]

for i in range(len(b)):
    ans.append([b[i],c[i]])
    
ans1=sorted(ans)
ans2=[i[1] for i in ans1]

print(*ans2)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
n=int(input())
A=list(map(int,input().split()))
B=[]
S=''
for i in range(1,n+1):
  B.append(i)
for i in range(1,n+1):
  S+=str(B[A.index(i)])+' '
print(S)

n=int(input())
A=list(map(int,input().split()))
B=[]
S=''
for i in range(1,n+1):
  B.append(A.index(i)+1)
for i in range(n):
  S+=str(B[i])+' '
print(S)

n=int(input())
A=list(map(int,input().split()))
S=''
for i in range(1,n+1):
  S+=str(A.index(i)+1)+' '
print(S)

n=int(input())
A=[]*n
A[:]=map(int,input().split())
S=[' ']*n
for i in range(n):
  S[A[i]-1]=str(i+1)
print(' '.join(S))

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
n = int(input())
A = [int(i) for i in input().split()]

for j in range(1, n+1):
  for i in range(n):
    if A[i] ==j:
      print(i+1, end=" ")

n = int(input())
A = [int(i) for i in input().split()]

L=[0]*n

for i in range(n):
  s = A[i]
  L[s-1] = i+1

print(*L)

Verdicts: Time Limit Exceeded

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
N, K = input().strip().split()
N = int(N)
K = int(K)

h = list(map(int, input().split()))

count = 0
for i in range(N):
    if h[i] >= K:
        count += 1
print(count)


N = int(input())
A = list(map(int, input().split()))

ans = [0]*N
for idx, a in enumerate(A):
    ans[a-1] = idx+1
print(*ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
import os

N = int(input())
alist = [int(i) for i in input().split()]

for i in range(1,N+1):
    print(alist.index(i)+1),


n = int(input())
a = [int(i) for i in input().split()]

i = 0
person = []
for j in range(n):
    person.append(0)
ans = []
for k in a:
    i += 1
    person[k-1] = i

a.sort()
for l in a:
    ans.append(str(person[l-1]))

order = ' '.join(ans)
print(order)


Verdicts: Time Limit Exceeded

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

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

for i in range(n):
    print(h.index(i+1)+1, end=" ")

n = int(input())
a = list(map(int, input().split()))
ans = [0]*n

for i in range(n):
    ans[a[i]-1]=i+1

print(" ".join(map(str,ans)))

Verdicts: Time Limit Exceeded

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

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

ans = []
for i in range(len(lst)):
    num = lst.index(i+1)
    ans.append(num+1)
print(ans)

n = int(input())
lst = list(map(int,input().split()))

ans = []
for i in range(len(lst)):
    num = lst.index(i+1)
    ans.append(num)
print(ans)

n = int(input())
a_lst = list(map(int,input().split()))

d = {}

for i in range(n):
    d[a_lst[i]] = i+1

d_sort = sorted(d.items(), key=lambda x : x[0])

ans_lst = []
for item in d_sort:
    ans_lst.append(item[1])

print(ans_lst)

n = int(input())
a_lst = list(map(int,input().split()))

d = {}

for i in range(n):
    d[a_lst[i]] = i+1

d_sort = sorted(d.items(), key=lambda x : x[0])

ans_lst = []
for item in d_sort:
    ans_lst.append(str(item[1]))

print(" ".join(ans_lst))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
nums = list(map(int,input().split(" ")))
res = [0 for _ in range(len(nums))]
for i in range(len(nums)):
    index = i+1
    cnt = nums[i]
    res[cnt-1] = index
print(res)


n = int(input())
nums = list(map(int,input().split(" ")))
res = [0 for _ in range(len(nums))]
for i in range(len(nums)):
    index = i+1
    cnt = nums[i]
    res[cnt-1] = index
print(*res,sep=" ")


Verdicts: Runtime Error

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n):
    l=a[i]
    ans[l-1]=i+1
print(ans)


n= int(input())
a= [int(x) for x in input().split()]
ans= [0 for _ in range(n)]
for i in range(n):
    ans[a[i]-1] = i+1
print(*ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi is a teacher responsible for a class of N students.  The students are given distinct student numbers from 1 to N.  Today, all the students entered the classroom at different times.  According to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).  From these records, reconstruct the order in which the students entered the classroom.

Submission attempts (in order):
N = int(input())
a = [int(i) for i in input().split()]
b = sorted(a)
c = []

dic = dict(zip(a , b))

print(dic)

for i in range(1,N+1):
    c.append(dic[i])

print(*c)

N = int(input())
a = [int(i) for i in input().split()]
b = sorted(a)
c = []

dic = dict(zip(a , b))

for i in range(1,N+1):
    c.append(dic[i])

print(*c)

Verdicts: Wrong Answer

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
#include <bits/stdc++.h>

//#include <algorithm>
// #include <iomanip>


using namespace std;

set<ll> prime_factor(ll num) {
  set<ll> result;
  for (ll i = 2; i <= num; i++) {
    int j = 0;
    while (num % i == 0) {
      if (j == 0) {
        result.insert(i);
      }
      num /= i;
      j++;
    }
    if (num <= i) {
      break;
    }
  }
  return result;
}

ll calc(ll num, set<ll> s) {
  ll count = 0;
  for (ll i = 2; i <= num; i++) {
    int j = 0;
    while (num % i == 0) {
      if (j == 0) {
        if (s.find(i) != s.end()) {
          count++;
        }
      }
      num /= i;
      j++;
    }
    if (num <= i) {
      break;
    }
  }
  return count;
}

int main() {
  ll n1, n2;
  cin >> n1 >> n2;
  auto a1 = prime_factor(n1);
  cout << calc(n2, a1) + 1 << endl;
}


def f(n):
    result = set()
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            result.add(i)

    if temp != 1:
        result.add(temp)

    return result

a, b = list(map(int, input().split()))

fa = f(a)
fb = f(b)

print(len(fa & fb)+1)


Verdicts: Runtime Error

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
A, B = [int(v) for v in input().split(' ')]

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

def cf(x1, x2):
    array = [1]
    for i in range(2, gcd(x1, x2) + 1):
        if x1 % i == 0 and x2 % i == 0:
            array.append(i)
    return array 

cf_array = cf(A, B)

count = 0
for i in range(0, len(cf_array)):
    v1 = cf_array[i]
    for j in range(i + 1, len(cf_array)):
        v2 = cf_array[j]
        if gcd(v1, v2) == 1:
            count += 1
            
       
print(count)

A, B = [int(v) for v in input().split(' ')]

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2

    i = 3
    while i * i <= n:
        if n % i == 0:
            a.append(i)
            n //= i
        else:
            i += 2

    if n != 1:
        a.append(n)
    return a

a_fact = prime_factorize(A)
b_fact = prime_factorize(B)

print(len(set(a_fact) & set(b_fact)) + 1)

Verdicts: Wrong Answer

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
a,b = map(int,input().split())
c = []
for i in range(2,min(a,b)+1):
    if a % i == 0 and b % i == 0:
       c.append(i)
for k in range(len(c)):
    for j in range(len(c)):
        if (c[k])%(c[j])==0:
           if c[k] != c[j]:
              c.pop(k)

c.append(1)
print(c)

a,b=map(int,input().split())
def prime_factorize(n):
  a=[]
  while n%2==0:
    a.append(2)
    n//=2
  f=3
  while f*f<=n:
    if n%f==0:
      a.append(f)
      n//=f
    else:
      f+=2
  if n!=1:
    a.append(n)
  return a
print(len(set(prime_factorize(a))&set(prime_factorize(b))))


a,b=map(int,input().split())
def prime_factorize(n):
  a=[]
  while n%2==0:
    a.append(2)
    n//=2
  f=3
  while f*f<=n:
    if n%f==0:
      a.append(f)
      n//=f
    else:
      f+=2
  if n!=1:
    a.append(n)
  return a
print(1+len(set(prime_factorize(a))&set(prime_factorize(b))))


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
# D - Disjoint Set of Common Divisors
from math import sqrt

def get_gcd(a, b):
    if b == 0:
        return a
    else:
        return get_gcd(b, a % b)
    
def get_primes(x):
    if x < 2: return []

    primes = [i for i in range(x + 1)]
    primes[1] = 0 

    
    for prime in primes:
        if prime > sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
    
N, K = map(int, input().split())
gcd = get_gcd(N, K)
primes = get_primes(gcd)

ans = 1
for p in primes:
    if gcd % p == 0:
        while gcd % p == 0:
            gcd /= p
        print(gcd)
        ans += 1
        
    if gcd == 1:
        break

print(ans)

# D - Disjoint Set of Common Divisors
from math import sqrt

def get_gcd(a, b):
    if b == 0:
        return a
    else:
        return get_gcd(b, a % b)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N, K = map(int, input().split())
gcd = get_gcd(N, K)
print(len(factorization(gcd)) + 1) if gcd > 1 else print(1)

Verdicts: Wrong Answer

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
def odd():
    n = 1
    while True:
        n = n + 2
        yield n


def divisible(n):
    return lambda x: x % n > 0


def primes():
    yield 2
    it = odd()
    while True:
        n = next(it)
        yield n
        it = filter(divisible(n), it)


count = 1
a, b = input().split(" ", 1)
a, b = int(a), int(b)
for x in primes():
    print(a)
    print(b)
    flag1 = 0
    flag2 = 0
    while a % x == 0:
        a /= x
        flag1 = 1
    while b % x == 0:
        b /= x
        flag2 = 1
    if flag1 == 1 and flag2 == 1:
        count += 1
    if x > a**0.5 or x > b**0.5:
        break
print(count)


def primes(n):
    i = 2
    factors = []
    while i**2<= n:
        if n % i==0:
            i += 1
        else:
            n =n//i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
a,b=map(int,input().split())
sa=set(primes(a))
sb=set(primes(b))
sans=sa.intersection(sb)
print(len(sans)+1)

def gcd(a, b): 
      
    # Everything divides 0  
    if (a == 0 or b == 0): 
            False
      
    # base case 
    if (a == b): 
        return a 
  
    # a is greater 
    if (a > b): 
        return gcd(a-b, b) 
          
    return gcd(a, b-a) 

a=int(input())
b=int(input())
l=[]
count=0
if a>b:
    for i in range(2,a):
        if a%i==0 and b%i==0:
            l.append(i)
for i in range(len(l)):
    for j in range(i,len(l)):
        if gcd(i,j)==1:
            count+=1
print(count)
 

def primes(n):
    i = 2
    prime = []
    while i**2<= n:
        if n % i:
            i += 1
        else:
            n =n//i
            prime.append(i)
    if n > 1:
        prime.append(n)
    return prime
a,b=map(int,input().split())
pa=set(primes(a))
pb=set(primes(b))
inte=pa.intersection(pb)
print(len(inte)+1)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
m, n = map(int, input().split())
while True:
  if m < n:
    m, n = n, m
  if m%n:
    m, n = n, m%n
  else:
    break

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

print(len(divisors(n)))

a, b = map(int, input().split())
def gcd(p, q):
    if p < q:
        p, q = q, p
    while q > 0:
        p, q = q, p%q
    return p
  
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(gcd(a, b))

def prime(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for j in range(4, n+1, 2):
        is_prime[j] = False
    for i in range(3, int(n**0.5) + 1, 2):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime = [1] + prime(divisors[-1])
print(divisors, prime)
ans = set(divisors) & set(prime)
print(ans)
print(len(ans))

m, n = map(int, input().split())
while True:
  if m < n:
    m, n = n, m
  if m%n:
    m, n = n, m%n
  else:
    break

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()
ans = [1]
notans = [False]*len(divisors)
for j in range(len(divisors)):
    if divisors[j] == 1 or notans[j] == True:
        continue
    ans.append(divisors[j])
    for i in range(j+1, len(divisors)):
        if divisors[i]%divisors[j] == 0:
            notans[i] = True

print(len(ans))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
import random

def gcd(a,b):
        if b == 0:
                return a
        else:
                return gcd(b , a%b)

def is_prime(q,k=50):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
 
a, b = map(int,input().split())
 
c = 1
m = gcd(a,b)
for i in range(1,int(m**0.5)+1):
	if a % i == 0 and b % i == 0:
		if is_prime(i):
			c+=1
print(c)

import random

def gcd(a,b):
        if b == 0:
                return a
        else:
                return gcd(b , a%b) 
def is_prime(q,k=50):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1

    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1:
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

a, b = map(int,input().split())

c = 1
m = gcd(a,b)

i = 1
while i * i <=m:
        if a%i == 0 and b%i == 0:
                if is_prime(i):
                        c+=1
                if is_prime(m//i):
                        c+=1
        i+=1
print(c)

Verdicts: Wrong Answer

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
a,b=map(int,input().split())
def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

ans = cf(a,b)
i = len(ans)
j = len(ans)
cnt = 0
while cnt != len(ans)-2:
  if ans[i-1] % ans[j-2] == 0:
    ans[i-1]=0
    i -= 1
    j = i-1
    cnt += 1
    continue
  j-=1
  if j < 0:
    i -= 1
    j = i - 1
    cnt += 1
    continue

print(len(ans)+1)

a,b=map(int,input().split())
def gcd(a, b):
  return a if b == 0 else gcd(b, a%b)

def factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n /= 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n /= f
    else:
      f += 2
  if n != 1: a.append(n)
  return a

print(len(set(factorize(gcd(a,b))))+1)

Verdicts: Runtime Error

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
A, B = map(int, input().split())
prime1 = get_prime(A)
prime2 = get_prime(B)
ans_prime = prime1 & prime2
print(len(ans_prime) + 1)

def get_prime(n):
    prime = []
    while n % 2 == 0:
        prime.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            prime.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        prime.append(n)
    return prime

def get_prime(n):
    prime = []
    while n % 2 == 0:
        prime.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            prime.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        prime.append(n)
    return prime

A, B = map(int, input().split())
prime1 = get_prime(A)
prime2 = get_prime(B)
print(prime1)
ans_prime = set(prime1) & set(prime2)
print(len(ans_prime) + 1)



def get_prime(n):
    prime = []
    while n % 2 == 0:
        prime.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            prime.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        prime.append(n)
    return prime

A, B = map(int, input().split())
prime1 = get_prime(A)
prime2 = get_prime(B)
ans_prime = set(prime1) & set(prime2)
print(len(ans_prime) + 1)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
from fractions import gcd
import math

a, b = [int(elem) for elem in input().split()]

cf = []
for i in range(1, min(a, b)+1):
    if a % i == 0 and b % i == 0:
       cf.append(i)
       

if len(cf) > 1:
    res = [cf[0], cf[1]]
    cf.pop(0)
    cf.pop(0)

    j = 0
    while True:
        if j >= len(cf):
            break
        flag = 0
        for elem in res[1:]:
            if cf == []:
                break
            if gcd(cf[j], elem) != 1:
                cf.pop(j)
                flag = 1
                break
        if flag == 0:
            res.append(cf[j])
            cf.pop(j)
else:
    res = [cf[0]]
print(len(res))

from fractions import gcd
import math

a, b = [int(elem) for elem in input().split()]

cf = []
for i in range(1, min(a, b)+1):
    if a % i == 0 and b % i == 0:
       cf.append(i)

dest = int(math.sqrt(min(a, b))) # cf[-1]
res = [cf[0]]
cf.pop(0)

while True:
    if cf == []:
        break
    num_min = min(cf)
    if num_min >= dest:
        res.extend(cf)
        break
    res.append(num_min)

    j = 0

    while True:
        if j >= len(cf):
            break
        elif cf[j] % num_min == 0:
            cf.pop(j)
        else:
            j += 1
print(len(res))

from fractions import gcd
import math

a, b = [int(elem) for elem in input().split()]

cf = []
for i in range(1, min(a, b)+1):
    if a % i == 0 and b % i == 0:
       cf.append(i)

res = [cf[0], cf[1]]
cf.pop(0)
cf.pop(0)

j = 0
while True:
    if j >= len(cf):
        break
    flag = 0
    for elem in res[1:]:
        if cf == []:
            break
        if gcd(cf[j], elem) != 1:
            cf.pop(j)
            flag = 1
            break
    if flag == 0:
        res.append(cf[j])
        cf.pop(j)
print(len(res))

a, b = [int(elem) for elem in input().split()]

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

a_lst = factorize(a)
b_lst = factorize(b)
res = list(set(a_lst) & set(b_lst))
print(len(res) + 1)

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Runtime Error

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
import sys
# import math
import fractions as math
input = sys.stdin.readline

_a, _b = map(int, input().split())


def chker(a, b):
    if math.gcd(a, b) == 1:
        print(1)
        return

    klist = [item for item in range(1, int(math.sqrt(min(_a, _b))) + 1) if _a % item == 0 and _b % item == 0]
    slist, klist = [klist[1]], klist[1:]
    for item1 in klist:
        tag = 0
        for item2 in slist:
            if item1 % item2 == 0:
                tag = 1
                break

        if tag == 0:
            slist.append(item1)

    print(len(slist) + 1)


chker(_a, _b)


import sys
input = sys.stdin.readline

_a, _b = map(int, input().split())


def gcd(a, b):
    while b:
        a, b = b, a % b

    return a


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

    return sorted(dvlist)


def chker(a, b):
    a, b = min(a, b), max(a, b)
    mindiv = get_divisor(a)
    shdvlist = [item for item in mindiv if b % item == 0]
    if len(shdvlist) < 3:
        print(len(shdvlist))
        return

    slist, shdvlist = [shdvlist[1]], shdvlist[1:]
    for item1 in shdvlist:
        flg = 0
        for item2 in slist:
            if item1 % item2 == 0:
                flg = 1
                break

        if flg == 0:
            slist.append(item1)

    print(len(slist) + 1)


chker(_a, _b)


Verdicts: Runtime Error

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
import math
A,B = map(int,input().split())

def factriz(N):
    upper = int(math.sqrt(N))
    k = N
    ans = []
    for i in range(2,upper+2):
        if(k%i == 0):
            ans.append(i)
            while(k%i == 0):
                k = k//i
    if(k != 1):
        ans.append(k)
    return ans

A_list = set(factriz(A))
B_list = set(factriz(B))
print(A_list,B_list)
print(len(A_list & B_list) + 1)

import math
A,B = map(int,input().split())

def factriz(N):
    upper = int(math.sqrt(N))
    k = N
    ans = []
    for i in range(2,upper+2):
        if(k%i == 0):
            ans.append(i)
            while(k%i == 0):
                k = k//i
    if(k != 1):
        ans.append(k)
    return ans

A_list = set(factriz(A))
B_list = set(factriz(B))
print(len(A_list & B_list) + 1)



Verdicts: Wrong Answer

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
import sys
def gcd(x, y):
  if y == 0:
     return x
  else:
     return gcd(y, x % y)

A, B = map(int, input().split())
gcd_AB = gcd(A, B)
if gcd_AB == 1:
  print(1)
  exit(0)
if gcd_AB == 2:
  print(2)
  exit(0)

import math
sqrt_gcd = int(math.sqrt(gcd_AB)) + 1
print(sqrt_gcd)
so_list = []
for i in range(3, sqrt_gcd+1, 2):
  if A%i !=0 or B%i !=0:
    continue
  flag=True
  for s in so_list:
    if i%s == 0:
      flag=False
      break
  if flag:
    so_list.append(i)

if A%2 ==0 or B%2 ==0:
  so_list.insert(0,2)
#print(so_list)
print(len(so_list) + 1)


import math
def gcd(x, y):
  if y == 0:
     return x
  else:
     return gcd(y, x % y)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
    
A, B = map(int, input().split())
gcd_AB = gcd(A, B)

p_list = prime_factorize(gcd_AB)
#print(p_list)
print(len(set(p_list))+1)


Verdicts: Wrong Answer

Accepted
Problem: Given are positive integers A and B.  Let us choose some number of positive common divisors of A and B.  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y.  Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.  Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

Submission attempts (in order):
a,b=map(int, input().split())  

al=factorization(a) 
bl=factorization(b)

a_s=set()
b_s=set()
for i in range(len(al)):
    a_s.add(al[i][0])
for j in range(len(bl)):
    b_s.add(bl[j][0])
    

s=a_s&b_s
    
print(len(s)+1)




def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a,b=map(int, input().split())  

al=factorization(a) 
bl=factorization(b)

a_s=set()
b_s=set()
for i in range(len(al)):
    a_s.add(al[i][0])
for j in range(len(bl)):
    b_s.add(bl[j][0])
    

s=a_s&b_s
s.add(1)    

print(len(s))

Verdicts: Runtime Error

Accepted