Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
q = int(input()) for _ in range(q): l, r, d = list(map(int, input().split())) if(d < l or d > r): print(d) else: div = r//d print(d*(div + 1))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; uint64_t minmul(uint64_t l, uint64_t r, uint64_t d) { if (d < l || d > r) return d; uint64_t mod = r % d; return r + (d - mod); } int main() { uint64_t q; cin >> q; uint64_t l, r, d; for (uint64_t i = 0; i < q; i++) { cin >> l >> r >> d; cout << minmul...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
q = int(input()) for i in range(q): l, r, d = map(int, input().split()) left = l//d*d if left == l: left -= d right = (r+d-1)//d*d if right == r: right += d if not l <= d <= r: print(d) elif left > 0: print(left) else: print(right)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Cf182 implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCha...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
numQuerys = int(input()) while (numQuerys != 0): query = input().split() num1, num2, num3 = int(query[0]), int(query[1]), int(query[2]) if num1 > num3: print (num3) else: mod = num2%num3 print(num2 - mod + num3) numQuerys -= 1
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; inline char gc() { return getchar(); } template <class T> int read(T &ans) { ans = 0; char ch = gc(); T f = 1; while (!isdigit(ch)) { if (ch == EOF) return -1; if (ch == '-') f = -1; ch = gc(); } while (isdigit(ch)) ans = ans * 10 + ch - '0', ch = gc...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for _ in range(int(input())): l, r, d = map(int, input().split()) if l > d: print(d) else: print(((r // d) + 1) * d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
def func(): temp=list(map(int,input().split())) l,r,d=temp[0],temp[1],temp[2] temp=d if d<l or d>r: print(d) return else: print((r//d+1)*d) q=int(input()) for i in range(q): func()
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int d, l, r, n; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> l >> r >> d; if (l > d) { cout << d << endl; continue; } cout << (r / d + 1) * d << endl; } return 0; }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
def minimum_integer(l,r,d): if(d > r or d < l): return d else: d *= ((r//d)+1) return d q = int(input()) for e in range(q): l, r, d = map(int, input().split()) print(minimum_integer(l,r,d))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; int i; for (i = 0; i < q; i++) { int l, r, d; cin >> l >> r >> d; long long int x; if (d < l) x = d; else { int a = r % d; x = (d - a) + r; } cout << x << endl; } }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int __ = 1e5 + 5; int a[__]; int main() { int q; for (scanf("%d", &q); q; --q) { int l, r, d; scanf("%d%d%d", &l, &r, &d); if (d < l || d > r) { printf("%d\n", d); continue; } printf("%d\n", (r / d + 1) * d); } return 0; }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q--) { int l, r, d; cin >> l >> r >> d; if (d < l) cout << d << endl; else { int w = r % d; cout << r + d - w << endl; } } }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
q = input() for _ in range(q): l, r, d = map(int, raw_input().split()) if d<l: print d else: print r+d-r%d
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for _ in range(int(input())): l,r,d = [int(i) for i in input().split()] if d < l: print(d) else: if r%d == 0: print(r+d) else: print((r//d + 1) * d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
entrada1 = int(input()) entrada2 = [] listaX = [] q = entrada1 for i in range(entrada1): entrada2.append(input().split()) def calcular_x(ele, r, d): x = 0 if d < ele: x = d else: x = int(r/d)*d + d return x for i in range(q): listaX.append(calcular_x(int(entrada2[i][0]), int(...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
def solution(entrada): x = entrada[2] jump = False while (x % entrada[2] != 0) or (x >= entrada[0] and x <= entrada[1]): if (x >= entrada[0] and x <= entrada[1]) and jump == False: x += int((entrada[1] - entrada[0]) / entrada[2]) * entrada[2] jump = True else: ...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
t=int(input()) while(t): t-=1 a,b,d=map(int,input().split()) if(a>d): print(d) else: print(b+d-b%d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
q = int(raw_input()) for _ in xrange(q): l, r, d = map(int, raw_input().split()) if d < l: print d else: print r // d * d + d
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for i in range(int(input())): l,r,d=map(int,input().split()) j=r+1 if d<l: print(d) else: c=r//d print(int(d*(c+1)))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.io.*; import java.util.*; public class MinimumInteger { public static void main(String[] args) { Scanner scan = new Scanner(System.in); PrintWriter pr=new PrintWriter(System.out); int q=scan.nextInt(); while(q--!=0){ long l=scan.nextLong(); long r=...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int l, r, d; cin >> l >> r >> d; if (d == 1) { if (l > 1) cout << 1; else cout << r + 1; cout << endl; continue; } int p = l / d; int q = r / d; if ((p == 1...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for _ in range(int(input())): l,r,c=[*map(int,input().split())] count=c if c<l: print(c) elif c>r: print(c) else: print(c*((r//c)+1))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for _ in range(int(input())): l, r, d = map(int, input().split()) if d < l: print(d) else: print(r//d * d + d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; /** * Created by nadya on 6/11/17. */ public class Educational { public static void main(String[] args) throws IOException { Educational c = new Educational(); c.start(); } pr...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
q = input() for _ in xrange(q): l, r, d = map(int, raw_input().strip().split()) k1 = (l + d - 1) // d - 1 if k1 >= 1: print d else: k = r // d + 1 print d * k
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { int l, r, a; cin >> l >> r >> a; if (l > a) cout << a << endl; else cout << ((r / a + 1) * a) << endl; } return 0; }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long inf = 1e16; const long long MAXN = 1e6; long long n, i, x, l, r; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (i = 0; i < n; i++) { cin >> l >> r >> x; if (x < l) cout << x << endl; else { cout << r / x...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n=int(input()) for i in range(n): l,r,d=map(int,input().split()) if d<l or d>r: print(d) # elif d==r and d==10**9: # print(10**9) else: print(((r//d)+1)*d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
q=int(input()) for i in range(q): l,r,d=map(int,input().split()) if(l>d): print(d) else: if(r/d==1): print(r+d) elif(r/d<1): print(d) elif(r/d>1): print((r//d+1)*d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
import math def get_min(l, r, d): cur = d if l <= cur <= r: cur = (r // d) * d + d return cur if __name__ == '__main__': n = int(input()) for i in range(n): l, r, d = list(map(int, input().split())) print(get_min(l, r, d))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n = int(input()) # n,k = map(int,input().split()) # s = input() # m = list(map(int,input().split())) m = [tuple(map(int,input().split())) for _ in range(n)] for i in m: a = i[0] - (i[0]%i[2]) if a > i[2] or a <= 0: a = i[2] b = (i[1]+i[2])-(i[1]%i[2]) if a < i[0]: print(a) contin...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
t=int(input()) q=[] for i in range(t): l,r,d=map(int,input().split()) if d<l or d>r: q.append(str(d)) else: q.append(str((r//d+1)*d)) print("\n".join(q))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
T = int(input()) for t in range(T): l,r,d = [int(x) for x in input().split()] if d<l or d>r : print(d) else: remainder = (r+1)%d addend = d - remainder if remainder!= 0 else 0 print(r+1+addend if remainder!= 0 else r+1)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.util.*; public class A { public static void main(String[]args){ Scanner sc=new Scanner(System.in); int q=sc.nextInt(); for(int i=0;i<q;i++){ double l=sc.nextInt(),r=sc.nextInt(),d=sc.nextInt(); System.out.println(d<l?(int)d:(int)((int)(r/d+1)*d)); } sc.close(); } }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class simple { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
def main(): q = int(input()) for t in range(q): l , r, d = input().split() l = int(l) r = int(r) d = int(d) if d > r or d < l: print(d) else: print(r + d - r%d) if __name__ == "__main__": main()
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int l, r, d, m, s; cin >> l >> r >> d; if (d < l) { cout << d << endl; } else { s = ((r / d) + 1) * d; cout << s << endl; } } }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n = int(input()) for i in range(n): l,r,d = [int(s) for s in input().split()] min_no = d if(min_no < l or min_no > r): print(min_no) else: t = r//d + 1 print(d*t)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q--) { int l, r, x; cin >> l >> r >> x; if (x < l or x > r) cout << x << endl; else cout << x - r % x + r << endl; } return 0; }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
a=int(input()) for i in range(a): l=list(map(int,input().split())) if(l[0]/l[2]>1): print(l[2]) else: n=l[1]//l[2] print((n+1)*l[2])
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n = int(input()) for i in range(n): l, r, d = map(int, input().split()) if (d < l or d > r): print(d) else: print((r // d + 1) * d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
q = int(input()) for i in range(q): l, r, d = map(int, input().split()) if d > 0 and d < l: print(d) else: print(((r+d)//d) * d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n = int(input()) def find(l, r, d): if d < l: return d return r + d - ((r + d) % d) for _ in range(n): l, r, d = map(int, input().split()) print(find(l, r, d))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
q=int(input()) l=[] for i in range(q): k=input().split() l.append(k) for j in l: l=int(j[0]) r=int(j[1]) d=int(j[2]) if d<r: if d>=l: a=d-(r%d) if a==0: print(r+d) else: print(r+a) elif l>d: print(d) ...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numCha...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n=int(input()) for i in range(n): m,n,k=[int(x) for x in input().split()] if k<m or k>n: print(k) else: print(k*(n//k+1))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
t = int(input()) for _ in range(t): l1 = [int(x) for x in input().split()] l,r,d = l1[0],l1[1],l1[2] if d<l: print(d) else: print(r+d-r%d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long l, d, r, temp = 0, temp2, i; int main() { int q; cin >> q; while (q--) { cin >> l >> r >> d; if (d < l || d > r) { cout << d << endl; continue; } temp = ((r + d) / d) * d; cout << temp << endl; } return 0; }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
q = int(raw_input()) for i in range(q): l, r, d= map(int, raw_input().split()) if (d >= l and d <= r): print(r - (r % d) + d) else: print(d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for _ in range(int(input())): n,m,d=map(int,input().split()) if n/d>1: print(d) else: print(d*((m//d)+1))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for _ in range(int(input())): a,b,c = map(int,input().split()) if c<a or c>b:print(c) else:z = b//c +1;print(c*z)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
q = int(input()) for i in range(q): a, b, d = map(int, input().split()) if d < a: print(d) else: print(b // d * d + d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void testcase() { int n; cin >> n; int l, r, d; while (n--) { cin >> l >> r >> d; if (d < l || d > r) { cout << d << "\n"; } else { int x = r / d; cout << (x + 1) * d << "\n"; } } } int main() { ios_base ::sync_with_stdio(false)...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
import sys import bisect input=sys.stdin.readline t=int(input()) #t=1 mod=10**9+7 for _ in range(t): #n=int(input()) l,r,d=map(int,input().split()) #s=input() #l=list(map(int,input().split())) if l>d: print(1*d) else: x=r//d print((x+1)*d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
'''input 5 2 4 2 5 10 4 3 10 1 1 2 3 4 6 5 ''' from sys import stdin # main starts q = int(stdin.readline().strip()) for _ in range(q): l, r, d = list(map(int, stdin.readline().split())) if l > d: print(d) else: temp = r // d print((temp + 1) * d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
import math def main(): q = int(input()) for i in range(q): l,r,d = map(int,input().split()) if l%d == 0: l -= 1 if l >= d: x = d else: if r%d == 0: r += 1 x = int(d*math.ceil(r/d)) print(x) main()
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for i in [0] * int(input()): a = list(int(x) for x in input().split()) print((a[2] >= a[0]) * (a[1] // a[2]) * a[2] + a[2])
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
record = [] query = int(input()) for i in range(query): record.append(input()) for values in record: li, ri, di = map(int, values.split()) contain = None if di < li or di > ri: contain = di else: multiplier = ri // di + 1 contain = di * multiplier print(contain)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
class Solution(object): def solve(self): n = int(input().strip()) rtr = [] for i in range(n): l, r, d = map(int, input().strip().split(' ')) if d > r or d < l: rtr.append(d) elif d >= l: _add = int(r // d + 1) ...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
t=input() while t: t=t-1 l,r,d=raw_input().split() l=int(l) r=int(r) d=int(d) if d<l: print d elif d>r: print d else: k=int(r/d) print d*(k+1)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long l, r, d; cin >> l >> r >> d; long long a, b; if (d < l) cout << d << endl; else { a = r / d; b = (a + 1) * d; cout << b << endl; } } return 0; }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
n = input() def solve(l, r, d): if d < l or d > r: return d if d >=l and d<=r: n = (r - d) x = n // d # print('x=',x, d) return (x + 2)*d for _ in range(n): l, r, d = map(int, raw_input().split()) print(solve(l, r, d))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.util.Scanner; public class cf { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int q=sc.nextInt(); while(q-->0) { int l = sc.nextInt(); int r = sc.nextInt(); int d = sc.nextInt(); if(l-d>0) { ...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.io.*; import java.util.*; /** * Road to div 3 */ public class Main { static class Task { PrintWriter out; MyScanner in; long l, r, d; public void solve(MyScanner in, PrintWriter out) { this.out = out; this.in = in; int q = in.next...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for _ in range(int(input())): l,r,d=map(int,input().split()) if d<l:print(d) else: k=r//d print(d*(k+1))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
/** * Author: Ridam Nagar * Date: 27 February 2019 * Time: 01:17:36 **/ /* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { ...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class Main { static final int mod = (int)1e9+7; public static void main(String[] args) throws Excepti...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for t in range(int(input())): l,r,d=map(int,input().split(' ')) x=l//d y=r//d if l%d==0: x=x-1 if x>0: print(d) else: print((y+1)*d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
t=int(input()) for z in range(t): l,r,n=map(int,input().split()) if n*1>=l and n*1<=r: c=r//n print(n*(c+1)) else: print(n*1)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n = int(input()) for i in range(n): l, r, d = list(map(int, input().split())) if d < l: print(d) else: print((r // d + 1) * d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.util.Scanner; public class Z1101A { public static void main(String[] args) { Scanner inScanner=new Scanner(System.in); int q=inScanner.nextInt(); for(int i=0;i<q;i++) { int l=inScanner.nextInt(); int r=inScanner.nextInt(); int d=inScanner.nextInt(); int pom=d; if(pom<l||pom>r)...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
n = input() for i in range(n): l = list(map(int, raw_input().strip().split())) if l[2] < l[0]: print l[2] else: r = l[1]%l[2] print l[1] + l[2] - r
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
import math n = int(raw_input()) for i in range(n): g = raw_input() g = g.split(" ") l, r, d = int(g[0]), int(g[1]), int(g[2]) f = True i = 1 m = d if l > r : l, r = r, l while f: if l <= m <= r: x = math.floor(r/m) m = int((x+1)*d) else: ...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
/* USER: caoash3 LANG: JAVA TASK: */ import java.io.*; import java.util.*; public class min { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); //Buffere...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; import java.util.Stack; public class ads { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int q=sc.nextInt(); for(int i=0;i<q;i++) { int l=sc.nextInt(); int r=sc.nextInt(); ...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
n = int(raw_input()) for i in range(n): l, r, d= map(int, raw_input().split()) if (d >= l and d <= r): print(r - (r % d) + d) else: print(d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
from sys import stdin, stdout from math import sin, tan, cos, pi, atan2, sqrt, acos, atan, factorial from random import randint q = int(stdin.readline()) for i in range(q): l, r, d = map(int, stdin.readline().split()) if d < l: stdout.write(str(d) + '\n') else: stdout.write(str((r // d...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 5; const long long mo = 1e9 + 7; long long sx, sy, ex, ey, dx[6] = {0, 1, 0, -1, 0, 0}, dy[6] = {1, 0, -1, 0, 0, 0}, m, n, k, dz[6]{0, 0, 0, 0, -1, 1}, sg, re; long long p, no, v, ans, w; int par[55];...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
x=int(input()) for i in range(x): a,b,c=map(int,input().split()) if a>c: print(c) else: print((b//c+1)*c)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q--) { long long int l, r, d; cin >> l >> r >> d; if (d < l) { cout << d << endl; continue; } int cnt = (r + d) / d; cout << cnt * d << endl; } return 0; }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.util.*; public class Minimum { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int q = scan.nextInt(); for(int e = 0;e < q;e++) { int l = scan.nextInt(),r = scan.nextInt(),d = scan.nextInt(); if(d > r || d < l) System.out.println(d); else if(l == 1 && d =...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
q = int(input()) answers = [] for i in range(q): l, r, d = input().split() l, r, d = int(l), int(r), int(d) if d<l: answers.append(d) continue else: s = (r//d)*d + d if s<=r: s+=d answers.append(s) for i in answers: print(i)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
a = int(input()) for i in range(a): l, r, d = map(int,input().split()) if l > d: print(d) else: print(d * ((r // d)+ 1))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
for C in range(int(input())): a,b,c = map(int,input().split()) # a = max(a,b) d = c*(b//c) if c < a: print(c) continue else: while d <= b: d+=c print(d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n; do{ n=sc.nextInt(); }while(n<1 || n>500); int[] arr=new int[n]; for(int i=0;i<n;i++){ int l,r,d; do{ l=sc.nextInt(); r=sc.nextInt(); d=sc.nextInt(); }while(...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
query = int(input()) for q in range(query): l, r, d = map(int, input().split()) ans = 1 if (d < l or d > r): print(d) else: print((r//d+1)*(d))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
original_length = int(input()) questions = [] for x in range(original_length): questions.append([int(y) for y in input().split()]) for i in questions: d = int(i[2]) if d >= i[0]: print((i[1] // d + 1) * d) else: print(d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long int l, r, i, t, d, p, k, x; double div; scanf("%lld", &(t)); while (t--) { scanf("%lld", &(l)); scanf("%lld", &(r)); scanf("%lld", &(d)); if (d < l) x = d; else { div = d; p = ceil((r + 1) / div); x ...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
nb = int(input()) liste = [] roger = True for loop in range(nb): l,r,d = map(int,input().split()) if d<l or d>r: print(d) else: print((r//d)*d + d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
def f(ll): l,r,d = ll if l>d: return d return (r//d+1)*d t = int(input()) for _ in range(t): l = list(map(int,input().split())) print(f(l))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python2
import sys for _ in xrange(int(raw_input())): l, r, d = map(int, raw_input().split()) if d < l: print d else: print r/d * d + d
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
import sys from collections import defaultdict as dd input=sys.stdin.readline n=int(input()) ##d=dd(int) for i in range(n): l,r,d=map(int,input().split()) if(d*1<l): print(d*1) else: print(((r//d)+1)*d) ##l=list(map(int,input().split()))
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
q=int(input()) for i in range(q): l,r,d=map(int,input().split()) if d >=l and d<=r: print(((r//d)+1)*d) else: print(d)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> int main(void) { int q; scanf("%d", &q); while (q--) { int l, r, d; scanf("%d %d %d", &l, &r, &d); if (d < l) { printf("%d\n", d); continue; } printf("%d\n", ((r / d) + 1) * d); } }
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n=int(input()) res=[] while n: l,r,d=map(int,input().split()) if d<l: res.append(d) elif d>r: res.append(d) elif l<=d<=r: m=r%d if m==0: res.append(r+d) else: res.append(d*(r//d+1)) n=n-1 for i in res: print(i)
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n_consultas = int(input()) if 1 <= n_consultas <= 500: for i in range(n_consultas): l,r,d = input().split(" ") l,r,d = int(l), int(r), int(d) if 1 <= l <= r <= 10**9 and 1 <= d <= 10**9: x = d if d < l: print (d) el...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
java
import java.io.InputStreamReader; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(new InputStreamReader(System.in)); int t = sc.nextInt(); while (t-- > 0) { int l = sc.nextInt(); int r = sc.nextInt(...
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
python3
n=int(input()) for i in range(n): ch=input() l=ch.split() a=int(l[0]) b=int(l[1]) c=int( l[2]) i=0 while True: i+=1 d=c*i if d not in range(a,b+1): print(d) break else: print((b//c)*c+c) break
1101_A. Minimum Integer
You are given q queries in the following form: Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i]. Can you answer all the queries? Recall that a number x belongs to segment [l, r] if l ≤ x ≤ r. Input The first l...
{ "input": [ "5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n" ], "output": [ "6\n4\n1\n3\n10\n" ] }
{ "input": [ "20\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 1000000000 2\n1 100000...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; vector<vector<int> > AdjList; vector<int> dfs_num, ts; const int UNVISITED = -1; const int VISITED = 1; int main() { int q; cin >> q; while (q--) { int l, r, d; cin >> l >> r >> d; if (d < l) { cout << d << endl; } else cout << d * (r / d +...