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
java
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner input = new Scanner(System.in); //inputs int t = input.nextInt(); for(int i = 0 ; i < t ; i++){ int l = input.nextInt(); int r = input.nextInt(); int d = input.nextInt(); if(d < l || d > r) Sys...
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 = [int(x) for x in input().split()] if d < l: print(d) elif d >= l: aux = ((r // d) + 1) * d print(aux)
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,m=map(int,input().split(" ")) t=int(input()) from math import * for _ in range(t): l,r,k=map(int,input().split(" ")) ans=0 a=int(floor(l/k)) if(l%k==0): a-=1 ans=a*k if(ans==0): a=int(ceil(r/k)) if(r%k==0): a+=1 print(a*k) else: print(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
python3
n=int(input()) for _ in range(n): l,r,d=map(int,input().split()) if d<l: print(d) else: ans=r%d print(r+abs(d-ans))
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.*; import java.io.*; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t,a,b,c,ans; t = sc.nextInt(); while(t!=0) { a = sc.nextInt(); b= sc.nextInt(); c = 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
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int l, r, d; cin >> l >> r >> d; if (l > d) cout << d << endl; else cout << (r + d) - (r % 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
import math def minInt(l, r, d): if d < l: return d elif r%d == 0: return r+d else: return math.ceil(r/d)*d def main(): n = int(input()) res = [] for _ in range(n): res.append(minInt(*list(map(int, input().split())))) for out in res: print(out) if ...
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 _ in range(n): l,r,d = map(int, input().split()) print(d if d < l else 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; int main() { int t, m, n, i, j, k, l, r, d; cin >> t; while (t--) { cin >> l >> r >> d; if (l > d) cout << d << endl; else { m = r / d; if (d * m > r) cout << d * m << endl; else cout << d * (m + 1) << 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 INF = (1 << 30) + 7; const int N = 1e5 + 7; int main() { ios::sync_with_stdio(false); int q, l, r, d, ans; cin >> q; while (q--) { cin >> l >> r >> d; ans = (r / d + 1) * d; if (d < l) ans = d; else ans = (r / d + 1) * d; co...
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(l, r, d): if d>r: return d for i in range(d,l,d): if i%d ==0: return i return (int(r/d)+1)*d n = int(input()) for i in range(n): row = input().split(' ') l = int(row[0]) r = int(row[1]) d = int(row[2]) print(str(int(f(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
import math class Triple: def __init__(self, l, r, d): self.l = l self.r = r self.d = d def find_integer(self): if self.d < self.l or self.d > self.r: return self.d if self.r % self.d == 0: return self.d * (int(math.ceil(self.r / self.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
a=int(input()) i=0 while i in range(a): b,c,d=map(int,input().split()) s=c%d if s==0 and (b<d or b==d) : print(c+d) elif s!=0 and (b<d or b==d): print(c+d-s) elif s==0 and b>d : print(d) elif s!=0 and b>d: print(d) i+=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
def main(): buf = input() q = int(buf) l = [] r = [] d = [] for i in range(q): buf = input() buflist = buf.split() l.append(int(buflist[0])) r.append(int(buflist[1])) d.append(int(buflist[2])) for i in range(q): if d[i] < l[i]: pri...
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
function calc(l, r, d) { if (d < l || d > r) { return d; } return d * Math.ceil(r / d) === r ? r + d : d * Math.ceil(r / d); } var q = parseInt(readline()); var lrd,l,r,d; for (var i = 0; i< q; i++) { lrd = readline().split(" "); // print(lrd); l = parseInt(lrd[0]); r = parseInt(lrd[1]); d = parseIn...
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.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.PrintWriter; public class A { public void solve(JS in, PrintWriter out) { int q = in.nextInt(); while(q-->0) { int l = in.nextInt(); int r = in.nextInt(); int 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()) def solve(l,r,d): if l > d: return d else: if r%d == 0: return r+d else: return d*(r//d+1) for _ in range(q): [l,r,d] = list(map(int, 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
cpp
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t; cin >> t; while (t--) { long long int l, r, d; cin >> l >> r >> d; if (l / d != 0 && l != d) cout << d << "\n"; else cout << (r / d + 1) * d << "\n"; } ...
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 q in range(N): l, r, d = map(int, input().split()) if d<l: answer = d else: answer = (r//d + 1)*d print(answer)
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 from decimal import * import random for _ in range(int(input())): left, right, d = map(int, input().split()) if(d==1 and left>1): print(1) elif(d==1 and left==1): print(right+1) elif(left<=d*1): print(math.ceil((right+1)/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
java
import java.util.*; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; public class Sample { public static void main(String[] args) throws Exception { FastScanner f = new FastScanner(); int T = f.nextInt(); while (T-- > 0) { // int N = f.ne...
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: l,r,d=map(int,input().split()) if(d<l): print(d) elif(d>=l): a=int(r/d)+1 print(a*d) t-=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
a=int(input()) for i in range(a): b,c,d=map(int,input().split()) if d>=min(b,c): print(max(b,c)+(d-max(b,c)%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; void print(vector<int> v) { for (auto x : v) cout << x << " "; puts(""); } int main() { int t; cin >> t; while (t--) { int l, r, d; cin >> l >> r >> d; if (d < l or d > r) cout << d << endl; else cout << d * ((r / d) + 1) << 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
java
import java.util.*; /* Name of the class has to be "Main" only if the class is public. */ public class Test { public static void main(String[] args){ Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0){ int l=s.nextInt(); int r=s.nextInt(); int d=s.nextInt(); if(d<l || r<d) System.out.println(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=map(int,input().split()) if(d<l): print(d) else: k=d-(r%d) print(k+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
python3
q = int(input()) while q>0: l,r,d = map(int,input().split()) if l > d: print(d) elif d >= l and d <= r: print(r + d - r%d) else: print(d) q = q - 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
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): l,r,d = map(int,input().split()) if l <= d <= r: print(r//d*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
n = int(input()) for i in range(n): l = list(map(int, input().split())) if(l[2] < l[0]): print(l[2]) else: print((l[1]//l[2] + 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
python2
from sys import stdin import math def minInt(x): if len(x) < 3: return -1 li = int(x[0]) ri = int(x[1]) di = int(x[2]) if di < li: return di elif di >= li and di <= ri: return int(math.ceil(ri/di+1)*di) else: return int(math.ceil((ri-1)/di+1)*di) queries = int(raw_input()) result = [] while queries > 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
for _ in range(int(input())): L, R, D = map(int, input().split()) print(D + (0, R-R%D)[L<=D<=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
q=input() while q: l,r,d=map(int,raw_input().split()) if l/float(d) > 1: print d else: temp=r/d print d*(temp+1) q-=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
def main(): t = int(input()) for __ in range(t): l,r,d = map(int,input().split()) if l//d >= 1 and l != d: print(d) else: print(((r//d)+1)*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; while (t--) { int l, r, k; cin >> l >> r >> k; if (k < l) { cout << k << endl; } else { cout << (r / k + 1) * k << 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
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(2 * d + (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
Q = int(input()) for i in range(Q): l, r, d = map(int, input().split()) ans = d; if ans >= l: ans = (r // d + 1) * d print(ans)
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
#!/usr/bin/env python """ This file is part of https://github.com/Cheran-Senthil/PyRival. Copyright 2018 Cheran Senthilkumar all rights reserved, Cheran Senthilkumar <hello@cheran.io> Permission to use, modify, and distribute this software is given under the terms of the MIT License. """ from __future__ import divisi...
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.*; import java.io.*; public class code{ public static void main(String[] args)throws IOException{ Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for(int i=0;i<q;i++){ long l = sc.nextLong(); long r = sc.nextLong(); long 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 _ in range(q): l,r,d=map(int,input().split()) left=0 right=0 if d==1: if l==1: print(r+1) else: print(1) else: if l%d==0: left+=1 if r%d==0: right+=1 if l//d -left>0: print...
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.lang.*; import java.math.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long T = sc.nextInt(); for (long i = 0; i < T; i++) { long l = sc.nextInt(); long r = sc.nextInt(); long d = sc...
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=input().split() a[0]=int(a[0]) a[1]=int(a[1]) a[2]=int(a[2]) if a[2] < a[0] or a[2] > a[1]: print(a[2]) else: print((a[2]-(a[1]%a[2]))+a[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 n, q, l, m, g, i; int main() { cin >> n; for (i = 1; i <= n; i++) { cin >> q >> l >> m; if (q > m) { cout << m << "\n"; } else { cout << (l / m) * m + m << "\n"; } } }
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 n, a[200005]; int main() { int q, l, r, d; cin >> q; while (q--) { cin >> l >> r >> d; if (d < l) cout << d; else cout << r + d - r % d; cout << 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 find(l,r,d): if d<l: return d elif d>r: return d else: return ((r//d)+1)*d t=int(input()) lst=[] for i in range(0,t): l,r,d=input().split() ele=find(int(l),int(r),int(d)) lst.append(ele) for i in range(0,t): print(lst[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
r = range(int(input())) for _ in r: l, r, d = list(map(int, input().split())) result = None for i in range(d, l, d): if i%d == 0: result = i break if not result: rr = r%d result = r + (d - rr) if result == r: result += d print(resul...
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
// package def; import java.util.*; //import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here FastReader sc=new FastReader(); // constructST(...
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=[int(x) for x in input().split()] c=0 if d<l: print(d) continue i=(r//d)*d+d 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
t=int(input()) while(t>0): t=t-1 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
q = int(input()) for i in range(q): l, r, d = map(int, input().split()) if d <= l: if d < l: k1 = d else: k1 = l - d else: k1 = 0 if r % d != 0: if r > d: r1 = r + (d - r % d) else: r1 = d else: r1 = r + d if k1 <= 0: print(r1) elif k1 < r1: print(k1) else: print(r1)
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 = 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 CF1101A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for(int i = 0; i < q; i++){ long l = sc.nextLong(); long r = sc.nextLong(); long d = sc.nextLong(); ...
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 < min(l,r): print(d) else: print((max(l,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())): a, b, d = map(int, input().split()) if a/d > 1: print(d) else: print(d*((b//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
q = int(input()) for i in range (q): l,r,d=map(int, input().split()) x = d if x < l or x > r: print(x) continue t = r//d + 1 x = d * t print (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
tests = int(input()) ans = [None] * tests for i in range(tests): x, y, z = map(int, input().split()) if (z < x or z > y): ans[i] = z else: ans[i] = (y // z) * z+z for sol in ans: print(sol)
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
# AC import sys class Main: def __init__(self): self.buff = None self.index = 0 def next(self): if self.buff is None or self.index == len(self.buff): self.buff = sys.stdin.readline().split() self.index = 0 val = self.buff[self.index] self.index ...
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()) g=r//d+1 if d<l: print(d) else: print(g*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()) L = [] R = [] D = [] for i in range(t): l, r, d = map(int, input().split()) L.append(l) R.append(r) D.append(d) for i in range(t): small = (L[i]/D[i]) large = (R[i]/D[i]) if small > 1.0: print(D[i]) else: print((int(large) + 1)*D[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 = int(input()) for i in range(n): a = list(map(int, input().split())) count = 1 if a[2] < a[0]: print( a[2]) else: print( (int(a[1]/a[2]) + 1) *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
java
import java.io.*; import java.util.*; import java.text.*; import java.lang.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.regex.*; public class Main{ public static ArrayList a[]=new ArrayList[300001]; static boolean visited[]=new boolean [300001]; public stati...
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 kk in range(t): l, r, d = map(int, input().split()) if l > d or r < d: print(d) else: print(int((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 solve(l, r, d): if d < l: return d else: return (r//d + 1) * d x = int(input()) while x > 0: [l, r, d] = list(map(int, input().split())) print(solve(l, r, d)) x -= 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 = [int(u) for u in input().split()] if(l*1.0/d>1): print(d) else: print(d*(r//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()) for i in range(n): s = list(map(int,input().split())) if s[0]>s[2]: print(s[2]) elif s[2]>=s[0] and s[0]<=s[1]: q=s[2] b=s[1] q=(b//q)*q+q print(q) else: print(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
n = int(input()) m = 0 for i in range(n): f = True x = list(map(int, input().split())) m = x[2] if m < x[0] or m > x[1]: print(m) else: print((x[1] - (x[1] % m) + m))
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.*; import java.io.*; public class Main { public static void solve(InputReader in ) { int a = in.readInt(), b = in.readInt() , c = in.readInt(); if(c < a) { System.out.println(c); return; } System.out.println(c * ((b/c) + 1)); } public static void main(St...
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 int a, b, c, d, e, i, j, k, l, n, m; cin >> n; for (i = 0; i < n; i++) { cin >> a >> b >> c; if (c < a) cout << c << endl; else cout << ((b / c) + 1) * c << 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
for _ in range(int(input())): l,r,d = map(int,input().split()) if d<l: print(d) else: m = r%d if r<d: print(d) else: x = r//d print(d*(x+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.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.*; public class A_GENERAL { // for fast output printing : use printwriter or str...
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; int x1, x2, y; int ats[N]; for (int i = 0; i < N; i++) { cin >> x1 >> x2 >> y; if (y < x1) { ats[i] = y; } else { ats[i] = y * ((x2 / y) + 1); } } for (int i = 0; i < N; i++) { cout << ats[i] << end...
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
k=1 n=int(input()) for i in range(1,n+1): l,r,d=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
python3
#!/usr/bin/env python import os import sys from io import BytesIO, IOBase # Bootstrap https://github.com/cheran-senthil/PyRival/blob/master/tests/misc/test_bootstrap.py from types import GeneratorType def bootstrap(f, stack=[]): def wrappedfunc(*args, **kwargs): if stack: return f(*args, **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
python3
q = int(input()) for i in range(0,q): inp = input() l,r,d = map(int, inp.split()) if(d<l): print (d) continue 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
//package codeforces; import java.util.Scanner; import java.util.HashMap; import java.util.HashSet; import java.util.TreeMap; import java.util.TreeSet; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Stack; import java.util.Set; public 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
python3
def solve(l,r,d): if l//d > 1: return d elif(l//d== 1 and l!=d): return d else: return ((r//d) + 1)*d t = int(input()) for _ in range(t): l,r,d = map(int,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
python3
q=int(input()) for i in range(0,q): l,r,d=map(int,input().split()) if l<=d<=r: a=r//d print((a+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
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int i = 0; i < t; i++) { System.out.println(solve(scanner.nextInt(), scanner.nextInt(), scanner.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
cpp
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("sse4") using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigne...
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 _ in range(n): l,r,d = input().split() l,r,d = int(l),int(r),int(d) if(d<l): print(d) elif(d>r): print(d) else: k = int(r/d) k = k + 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
python3
q=int(input()) for i in range(q): l, r, d=map(int, input().rstrip().split()) if l<=d: x=r//d*(d)+d print(x) 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
python2
t=int(raw_input()) for _ in range(t): [l,r,d]=map(int,raw_input().split()) if d>r or 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())): 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
def minInteger(l, r, d): if l > d or r < d: print(d) else : print((r//d + 1)*d) def listMinInteger(q, N): for i in N: minInteger(i[0],i[1],i[2]) q = int(input()) N = [list(map(int , input().split())) for _ in range(q)] listMinInteger(q,N)
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()) if d<l or d>r: 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
java
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static final long MOD = 1_000_000_007, INF = 1_000_000_000_000_000_000L; static final int INf = 1_000_000_000; static FastReader reader; static PrintWriter writer; public static void main(String[] args) { ...
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): l, r, d = map(int, input().split()) s = d * (l // d) e = d * (r // d) + d f = 0 for i in range(d,s+1,d): if i < l and i % d == 0: print(i) f = 1 break if f == 0: print(e)
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==1 and l==1: print(r+1) elif d==1 and l!=1: print(1) elif d!=1 and d>=l and d<=r: t=r//d print(d*(t+1)) elif d!=1 and d>r: print(d) elif d!=1 and d<l: 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
n = int(input()) for i in range(n): l, r, d = map(int, input().split()) flag = False if not l <= 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
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long q; cin >> q; while (q--) { long long a, b, d; cin >> a >> b >> d; long long temp = a / d; long long temp2 = b / d; if (d < a || d > b) { cout << d << endl; } else { long long num1 = (temp2 + 1) * d; cout...
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()) result=[] for i in range(q): l,r,d=map(int,input().split()) if l//d>1 and l%d==0: result.append(str(d)) elif l//d>=1 and l%d!=0: result.append(str(d)) else: result.append(str((r//d+1)*d)) print('\n'.join(result))
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()) result = [] def smallestInteger(t, m): x = t[2] * m if (x >= t[0] and x <= t[1]): m = int((t[1] / t[2]) + 1) x = t[2] * m result.append(x) else: result.append(x) for i in xrange(q): entrada = raw_input().split() tupla = (int(entrada[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
n = int(input()) for i in range(n): l, r, d = map(int, input().split()) ld = (l + d - 1) // d rd = r // d if ld > 1: print(d) else: print((rd + 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
for _ in range(int(input())): l,r,d = map(int,input().split()) i = d if l<=i<=r: mul = r//i i = i*(mul+1) while i%d!=0: if l<=i<=r: mul = i//r i = i*mul i+=d 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
java
/*package whatever //do not write package name here */ import java.io.*; import java.lang.*; import java.util.*; public class GFG { public static void main (String[] args) { //System.out.println("GfG!"); Scanner sc=new Scanner(System.in); int q=sc.nextInt(); for(int j=0;j<q;j++) { 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
python2
q = input() for i in range(q): l,r,d = map(int,raw_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
python3
q = int(input()) for _ in range(q): l, r, d = map(int, input().split()) if l / d > 1: 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
t = int(input()) while t>0: t = t-1 l,r,d = map(int,input().split()) intial = (l-1)//d if intial>=1: print(d) else: if (r+1) % d != 0: final = (r+1)//d print(d*(final+1)) else: print(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
cpp
#include <bits/stdc++.h> int main() { int t, l, r, d, m, n, i; scanf("%d", &t); for (i = 0; i < t; i++) { scanf("%d %d %d", &l, &r, &d); if (l > d || r < d) { printf("%d\n", d); } else { m = (r / d) + 1; n = d * m; printf("%d\n", n); } } 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
for _ in range(int(input())): a,b,d=map(int,input().split()) if a>d: print(d) elif b<d: print(d) else: x=b//d print(d*(x+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.Scanner; public class CF1101_D2_A { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for (int i = 0; i < n; i++) { solve(scanner); } } private static void solve(Scanner scanner) { ...