message
stringlengths
2
57.2k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
61
108k
cluster
float64
22
22
__index_level_0__
int64
122
217k
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In other words, for each k ≀ i ≀ n it's satisfied th...
instruction
0
54,520
22
109,040
Tags: math, number theory Correct Solution: ``` mod = 1000000009 def inv(x): return pow(x,mod - 2, mod) n, a, b, k = map(int, input().split()) s = input() q = pow(b, k, mod) * inv(pow(a, k, mod)) t = 0 for i in range(k): sgn = 1 if s[i] == '+' else -1 t += sgn * pow(a, n - i, mod) * pow(b, i, mod) t %=...
output
1
54,520
22
109,041
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In other words, for each k ≀ i ≀ n it's satisfied th...
instruction
0
54,521
22
109,042
Tags: math, number theory Correct Solution: ``` n, a, b, k = map(int, input().split() ) s = input() mod = (int)( 1e9 + 9 ) ans = 0 t = (int)( (n + 1) / k ) def modInverse(a): return pow(a, mod - 2, mod) i = 0 for ind in range( len(s) ): first = ( pow(a, n - i, mod ) * pow( b, i, mod ) ) % mod num ...
output
1
54,521
22
109,043
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In other words, for each k ≀ i ≀ n it's satisfied th...
instruction
0
54,522
22
109,044
Tags: math, number theory Correct Solution: ``` MOD = 1000000009 def inv(n): return pow(n, MOD - 2, MOD) n, a, b, k = map(int, input().split()) q = (n + 1) // k string = input() s = [] for char in string: if char == "+": s.append(1) else: s.append(-1) res = 0 # final answer for i in range(k): re...
output
1
54,522
22
109,045
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In other words, for each k ≀ i ≀ n it's satisfied th...
instruction
0
54,523
22
109,046
Tags: math, number theory Correct Solution: ``` def pow_mod(x, y, p): number = 1 while y: if y & 1: number = number * x % p y >>= 1 x = x * x % p return number % p def inv(x, p): if 1 < x: return p - inv(p % x, x) * p // x return 1 def v(p, a, b,...
output
1
54,523
22
109,047
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In other words, for each k ≀ i ≀ n it's satisfied th...
instruction
0
54,524
22
109,048
Tags: math, number theory Correct Solution: ``` MOD = int(1e9+9) n, a, b, k = map(int, input().split()) s = input() def solve(): res = 0 q = pow(b, k, MOD) * pow(pow(a, k, MOD), MOD-2, MOD) % MOD max_pow = pow(a, n, MOD) c = b * pow(a, MOD-2, MOD) % MOD for i in range(k): res += max_pow if ...
output
1
54,524
22
109,049
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In ot...
instruction
0
54,525
22
109,050
No
output
1
54,525
22
109,051
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In ot...
instruction
0
54,526
22
109,052
No
output
1
54,526
22
109,053
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In ot...
instruction
0
54,527
22
109,054
No
output
1
54,527
22
109,055
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In ot...
instruction
0
54,528
22
109,056
No
output
1
54,528
22
109,057
Provide tags and a correct Python 3 solution for this coding contest problem. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integers a, b and c such that l ≀ a,b,c ≀ r, and the...
instruction
0
54,941
22
109,882
Tags: binary search, brute force, math, number theory Correct Solution: ``` tests_number = int(input()) for _ in range(tests_number): l, r, m = list(map(int, input().split())) # m = n * a + b - c # m + c - b = n * a left_border = max(1, m + l - r) right_border = m + r - l result = (0, 0, 0) ...
output
1
54,941
22
109,883
Provide tags and a correct Python 3 solution for this coding contest problem. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integers a, b and c such that l ≀ a,b,c ≀ r, and the...
instruction
0
54,942
22
109,884
Tags: binary search, brute force, math, number theory Correct Solution: ``` import sys input = sys.stdin.readline for _ in range(int(input())): l, r, m = map(int, input().split()) low = l - r high = r - l for a in range(l, r+1): lo = 1 hi = (m+high)//a + 2 while lo < hi: mi = (lo + hi) // 2 diff = ...
output
1
54,942
22
109,885
Provide tags and a correct Python 3 solution for this coding contest problem. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integers a, b and c such that l ≀ a,b,c ≀ r, and the...
instruction
0
54,943
22
109,886
Tags: binary search, brute force, math, number theory Correct Solution: ``` for _ in range(int(input())): l,r,m = map(int,input().split()) rem = r - l for i in range(l,r+1): rem1 = m % i if rem1 <= rem and m >= i: print(i,l+rem1,l) break elif rem1 >= i - rem: ...
output
1
54,943
22
109,887
Provide tags and a correct Python 3 solution for this coding contest problem. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integers a, b and c such that l ≀ a,b,c ≀ r, and the...
instruction
0
54,944
22
109,888
Tags: binary search, brute force, math, number theory Correct Solution: ``` for t in range(int(input())): l, r, m = [int(x) for x in input().strip().split()] #print (l,l+m,l) d=r-l for i in range(l,r+1): #peint(i,l,m) v=m%i if v<=d and m>=i: print(i,l+v,l) ...
output
1
54,944
22
109,889
Provide tags and a correct Python 3 solution for this coding contest problem. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integers a, b and c such that l ≀ a,b,c ≀ r, and the...
instruction
0
54,945
22
109,890
Tags: binary search, brute force, math, number theory Correct Solution: ``` import random def find_bc(diff, l, r): if diff > 0: return (r, r - diff) elif diff == 0: return (l, l) else: return (l, l - diff) def solve(l, r, m): starter = [l, l + 1, l + 2, r - 2, r - 1, r...
output
1
54,945
22
109,891
Provide tags and a correct Python 3 solution for this coding contest problem. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integers a, b and c such that l ≀ a,b,c ≀ r, and the...
instruction
0
54,946
22
109,892
Tags: binary search, brute force, math, number theory Correct Solution: ``` # ------------------- fast io -------------------- import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer ...
output
1
54,946
22
109,893
Provide tags and a correct Python 3 solution for this coding contest problem. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integers a, b and c such that l ≀ a,b,c ≀ r, and the...
instruction
0
54,947
22
109,894
Tags: binary search, brute force, math, number theory Correct Solution: ``` for _ in range(int(input())): l, r, m = map(int, input().split()) if l == r == m: print(l, r, m) continue for a in range(l, r + 1): x = m % a y = a - x if m > a: if x <= r - l: ...
output
1
54,947
22
109,895
Provide tags and a correct Python 3 solution for this coding contest problem. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integers a, b and c such that l ≀ a,b,c ≀ r, and the...
instruction
0
54,948
22
109,896
Tags: binary search, brute force, math, number theory Correct Solution: ``` tq = int(input()) for _ in range(tq): l, r, m = map(int, input().split()) mn = l-r mx = r-l b, c = 0, 0 for a in range(l, r+1): d = m%a if d >= mn and d <= mx and m >= a: b = l c = b-...
output
1
54,948
22
109,897
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integ...
instruction
0
54,949
22
109,898
Yes
output
1
54,949
22
109,899
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integ...
instruction
0
54,950
22
109,900
Yes
output
1
54,950
22
109,901
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integ...
instruction
0
54,951
22
109,902
Yes
output
1
54,951
22
109,903
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integ...
instruction
0
54,952
22
109,904
Yes
output
1
54,952
22
109,905
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integ...
instruction
0
54,953
22
109,906
No
output
1
54,953
22
109,907
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integ...
instruction
0
54,954
22
109,908
No
output
1
54,954
22
109,909
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integ...
instruction
0
54,955
22
109,910
No
output
1
54,955
22
109,911
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer n, he encrypts it in the following way: he picks three integ...
instruction
0
54,956
22
109,912
No
output
1
54,956
22
109,913
Provide tags and a correct Python 3 solution for this coding contest problem. Jzzhu has picked n apples from his big apple tree. All the apples are numbered from 1 to n. Now he wants to sell them to an apple store. Jzzhu will pack his apples into groups and then sell them. Each group must contain two apples, and the...
instruction
0
55,161
22
110,322
Tags: constructive algorithms, number theory Correct Solution: ``` import math,sys,bisect,heapq from collections import defaultdict,Counter,deque from itertools import groupby,accumulate #sys.setrecursionlimit(200000000) input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ ilele = lambda: map(int,input(...
output
1
55,161
22
110,323
Provide tags and a correct Python 3 solution for this coding contest problem. Jzzhu has picked n apples from his big apple tree. All the apples are numbered from 1 to n. Now he wants to sell them to an apple store. Jzzhu will pack his apples into groups and then sell them. Each group must contain two apples, and the...
instruction
0
55,162
22
110,324
Tags: constructive algorithms, number theory Correct Solution: ``` import math apples=int(input()) if apples<=3: print(0) else: halfpr=int(apples/2) def primes(n): primeslistsa=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, ...
output
1
55,162
22
110,325
Provide tags and a correct Python 3 solution for this coding contest problem. Jzzhu has picked n apples from his big apple tree. All the apples are numbered from 1 to n. Now he wants to sell them to an apple store. Jzzhu will pack his apples into groups and then sell them. Each group must contain two apples, and the...
instruction
0
55,163
22
110,326
Tags: constructive algorithms, number theory Correct Solution: ``` apples=int(input()) if apples<=3: print(0) else: halfpr=int(apples/2) def primes(n): isPrime = [True for i in range(n + 1)] isPrime[0] = isPrime[1] = False idx = 2 while idx * idx <= n: if...
output
1
55,163
22
110,327
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Jzzhu has picked n apples from his big apple tree. All the apples are numbered from 1 to n. Now he wants to sell them to an apple store. Jzzhu will pack his apples into groups and then sell th...
instruction
0
55,164
22
110,328
No
output
1
55,164
22
110,329
Provide tags and a correct Python 3 solution for this coding contest problem. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive integers a1, a2, ..., an (not necessary distinct). Yo...
instruction
0
55,254
22
110,508
Tags: constructive algorithms, greedy, number theory Correct Solution: ``` def main(): n = int(input()) l = list(map(int, input().split())) seive = [False, True] * max(l) a = len(seive) for i in range(3, int(a ** .5) + 1, 2): if seive[i]: for j in range(i * i, a, i): ...
output
1
55,254
22
110,509
Provide tags and a correct Python 3 solution for this coding contest problem. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive integers a1, a2, ..., an (not necessary distinct). Yo...
instruction
0
55,255
22
110,510
Tags: constructive algorithms, greedy, number theory Correct Solution: ``` def primes_upto(limit): is_prime = [False] * 2 + [True] * (limit - 1) # remove odd numbers for n in range(int(limit**0.5 + 1.5)): # stop at ``sqrt(limit)`` if is_prime[n]: for i in range(n*n, limit+1, n): ...
output
1
55,255
22
110,511
Provide tags and a correct Python 3 solution for this coding contest problem. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive integers a1, a2, ..., an (not necessary distinct). Yo...
instruction
0
55,256
22
110,512
Tags: constructive algorithms, greedy, number theory Correct Solution: ``` def main(): input() l0, l1, ones = [], [], 0 for a in map(int, input().split()): if a == 1: ones += 1 else: (l1 if a & 1 else l0).append(a) seive = [False, True] * (((max(l0) if l0 else 0) ...
output
1
55,256
22
110,513
Provide tags and a correct Python 3 solution for this coding contest problem. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive integers a1, a2, ..., an (not necessary distinct). Yo...
instruction
0
55,257
22
110,514
Tags: constructive algorithms, greedy, number theory Correct Solution: ``` def isPrime(n): if n <= 1: return False if n <= 3: return True if n % 2 == 0 or n % 3 == 0: return False i = 5 while(i * i <= n) : if (n % i == 0 or n % (i + 2) == 0) : return ...
output
1
55,257
22
110,515
Provide tags and a correct Python 3 solution for this coding contest problem. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive integers a1, a2, ..., an (not necessary distinct). Yo...
instruction
0
55,258
22
110,516
Tags: constructive algorithms, greedy, number theory Correct Solution: ``` import sys #import random from bisect import bisect_right as rb from collections import deque #sys.setrecursionlimit(10**8) from queue import PriorityQueue from math import * input_ = lambda: sys.stdin.readline().strip("\r\n") ii = lambda : int(...
output
1
55,258
22
110,517
Provide tags and a correct Python 3 solution for this coding contest problem. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive integers a1, a2, ..., an (not necessary distinct). Yo...
instruction
0
55,259
22
110,518
Tags: constructive algorithms, greedy, number theory Correct Solution: ``` n = int(input()) L = list(map(int, input().split())) P = [-1 for _ in range(2000001)] def premier(n): if P[n] >= 0: return P[n] for i in range(2,int(n**0.5)+1): if n%i==0: P[n] = False return Fals...
output
1
55,259
22
110,519
Provide tags and a correct Python 3 solution for this coding contest problem. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive integers a1, a2, ..., an (not necessary distinct). Yo...
instruction
0
55,260
22
110,520
Tags: constructive algorithms, greedy, number theory Correct Solution: ``` import sys def get_primes(n: int): from itertools import chain from array import array primes = {2, 3} is_prime = (array('b', (0, 0, 1, 1, 0, 1, 0)) + array('b', (1, 0, 0, 0, 1, 0))*((n-1)//6)) for i in cha...
output
1
55,260
22
110,521
Provide tags and a correct Python 3 solution for this coding contest problem. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive integers a1, a2, ..., an (not necessary distinct). Yo...
instruction
0
55,261
22
110,522
Tags: constructive algorithms, greedy, number theory Correct Solution: ``` # =============================================================================================== # importing some useful libraries. from __future__ import division, print_function from fractions import Fraction import sys import os from io impo...
output
1
55,261
22
110,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive intege...
instruction
0
55,262
22
110,524
Yes
output
1
55,262
22
110,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive intege...
instruction
0
55,263
22
110,526
Yes
output
1
55,263
22
110,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive intege...
instruction
0
55,264
22
110,528
Yes
output
1
55,264
22
110,529
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive intege...
instruction
0
55,265
22
110,530
No
output
1
55,265
22
110,531
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive intege...
instruction
0
55,266
22
110,532
No
output
1
55,266
22
110,533
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive intege...
instruction
0
55,267
22
110,534
No
output
1
55,267
22
110,535
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i, j) (1 ≀ i < j ≀ k), xi + xj is a prime. You are given an array a with n positive intege...
instruction
0
55,268
22
110,536
No
output
1
55,268
22
110,537
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has a string S of length N consisting of digits from `0` through `9`. He loves the prime number P. He wants to know how many non-empty (contiguous) substrings of S - there are N \time...
instruction
0
55,398
22
110,796
Yes
output
1
55,398
22
110,797
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has a string S of length N consisting of digits from `0` through `9`. He loves the prime number P. He wants to know how many non-empty (contiguous) substrings of S - there are N \time...
instruction
0
55,404
22
110,808
No
output
1
55,404
22
110,809
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya likes to solve equations. Today he wants to solve (x~div~k) β‹… (x mod k) = n, where div and mod stand for integer division and modulo operations (refer to the Notes below for exact definition). In this equation, k and n are positive int...
instruction
0
55,631
22
111,262
Tags: math Correct Solution: ``` n, k = map(int, input().split()) a = [] for i in range(1, min(int(n ** 0.5) + 1, k)): if n % i == 0: a.append((i, n // i)) ans = int(1e10) for i in range(len(a)): if a[i][0] * k + a[i][1] < ans and a[i][1] < k: ans = a[i][0] * k + a[i][1] if a[i][1] * k + a[i...
output
1
55,631
22
111,263
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya likes to solve equations. Today he wants to solve (x~div~k) β‹… (x mod k) = n, where div and mod stand for integer division and modulo operations (refer to the Notes below for exact definition). In this equation, k and n are positive int...
instruction
0
55,632
22
111,264
Tags: math Correct Solution: ``` n,k = map(int,input().split()) mn = 10**9 for i in range(1,k): if n % i == 0: mn = min(mn, n//i*k + i) print(mn) ```
output
1
55,632
22
111,265
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya likes to solve equations. Today he wants to solve (x~div~k) β‹… (x mod k) = n, where div and mod stand for integer division and modulo operations (refer to the Notes below for exact definition). In this equation, k and n are positive int...
instruction
0
55,633
22
111,266
Tags: math Correct Solution: ``` import sys import math import itertools import functools import collections import operator import fileinput import copy ORDA = 97 def ii(): return int(input()) def mi(): return map(int, input().split()) def li(): return list(map(int, input().split())) def lcm(a, b): return abs(a * b)...
output
1
55,633
22
111,267
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya likes to solve equations. Today he wants to solve (x~div~k) β‹… (x mod k) = n, where div and mod stand for integer division and modulo operations (refer to the Notes below for exact definition). In this equation, k and n are positive int...
instruction
0
55,634
22
111,268
Tags: math Correct Solution: ``` a,k=map(int,input().split()) l=[] for i in range(1,round(a**0.5)+1): if a%i==0: if a//i<k: #print([i,a//i]) l.append([i,a//i]) if i<k: #print([a//i,i]) l.append([a//i,i]) #print() b=[] for i in l: b.append(i[0]*...
output
1
55,634
22
111,269