solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
q = int(input())
for _ in range(q):
l, r, d = list(map(int, input().split()))
if l > d:
print(d)
else:
print((r // d + 1) * d)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int q, l, r, d, n;
cin >> q;
while (q-- > 0) {
cin >> l >> r >> d;
if (d < l)
cout << d << "\n";
else
cout << r - (r % d) + d << "\n";
}
}
| 7 | CPP |
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def main():
n = I()
aa = [LI() for _ in range(n)]
rr = []
for l,r,d in aa:
if d < l:
rr.append(d)
else:
rr.append(r - r%d + d)
return '\n'.join(map(str, rr))
print(main())
| 7 | PYTHON3 |
for i in range(int(input())):
l , r , d = map(int,input().split())
if d<l:
print(d)
else:
a = r//d
print((a+1)*d)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q;
cin >> q;
int l[501], r[501], d[501], ans[501];
for (int i = 0; i < q; i++) {
cin >> l[i] >> r[i] >> d[i];
if (l[i] > d[i] || r[i] < d[i])
ans[i] = d[i];
else
ans[i] = (r[i] / d[i] + 1) * d[i];
}
for (int i = 0; i < q; i++) cout << ans[i] << endl;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
for (int t1 = 0; t1 < t; t1++) {
int l, r, d;
int min = 1000000000;
cin >> l >> r >> d;
min = (d < l) ? d : r / d * d + d;
cout << min << endl;
}
}
| 7 | CPP |
#include <bits/stdc++.h>
int main() {
long int a, b, c, d, ans;
int T, i;
scanf("%d", &T);
for (i = 1; i <= T; i++) {
scanf("%ld %ld %ld", &a, &b, &c);
if (a > c) {
printf("%ld\n", c);
} else {
d = b / c;
d = d + 1;
ans = c * d;
printf("%ld\n", ans);
}
}
}
| 7 | CPP |
n = int(input())
for _ in range(n):
l,r,d = map(int,input().split())
if(d<l):
print(d)
else:
k = (r%d==0) and d or d-r%d
print(r+k) | 7 | PYTHON3 |
#codeforces_1101A
gi = lambda : list(map(int,input().split()))
for k in range(gi()[0]):
l,r,d = gi()
if l <= d <= r:
ans = (r//d)*d
if r%d or (r//d)*d == r: ans += d
else:
ans = d
print(ans) | 7 | PYTHON3 |
q=int(input())
while q>0:
l,r,d=input().split(" ")
l=int(l)
r=int(r)
d=int(d)
if d<l:
print(d)
else:
print((int(r/d)+1)*d)
q-=1 | 7 | PYTHON3 |
z=input
mod = 10**9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
def lcd(xnum1,xnum2):
return (xnum1*xnum2//gcd(xnum1,xnum2))
################################################################################
"""
n=int(z())
for _ in range(int(z())):
x=int(z())
l=list(map(int,z().split()))
n=int(z())
l=sorted(list(map(int,z().split())))[::-1]
a,b=map(int,z().split())
l=set(map(int,z().split()))
led=(6,2,5,5,4,5,6,3,7,6)
vowel={'a':0,'e':0,'i':0,'o':0,'u':0}
color-4=["G", "GB", "YGB", "YGBI", "OYGBI" ,"OYGBIV",'ROYGBIV' ]
"""
###########################---START-CODING---###############################################
for _ in range(int(z())):
a,b,c=map(int,z().split())
if c<a or c>b:
print(c)
continue
print(b+(c-(b%c)))
| 7 | PYTHON3 |
n=int(input())
for q in range(n):
j,k,l=list(map(int,input().split()))
if j>l:
print(l)
else:
d=k//l
s=l*d
while s<k:
s+=l
if s==k:
s+=l
print(s)
| 7 | PYTHON3 |
n=int(input())
for i in range(n):
a,b,c=map(int,input().split())
if a>c:
print(c)
else:
print(b-b%c+c)
| 7 | PYTHON3 |
from math import ceil
n=int(input())
for _ in range(n):
l,r,d=map(int,input().split())
if d<l or d>r:
print(d)
else:
print(d*int(ceil((r+1)/d)))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q;
cin >> q;
for (; q > 0; q--) {
int l, r, d;
cin >> l >> r >> d;
if (d < l)
cout << d << endl;
else {
l = r - (r % d) + d;
cout << l << endl;
}
}
}
| 7 | CPP |
n=int(input())
for i in range(n):
(l,r,d)=input().split(" ")
(l,r,d)=(int(l),int(r),int(d))
checker=True
fac=1
if(r>=d>=l):
print(d*(int(r/d)+1))
else:
print(d)
| 7 | PYTHON3 |
#JMD
#Nagendra Jha-4096
import sys
import math
#import fractions
#import numpy
###File Operations###
fileoperation=0
if(fileoperation):
orig_stdout = sys.stdout
orig_stdin = sys.stdin
inputfile = open('W:/Competitive Programming/input.txt', 'r')
outputfile = open('W:/Competitive Programming/output.txt', 'w')
sys.stdin = inputfile
sys.stdout = outputfile
###Defines...###
mod=1000000007
###FUF's...###
def nospace(l):
ans=''.join(str(i) for i in l)
return ans
##### Main ####
t=int(input())
for tt in range(t):
l,r,d= map(int, sys.stdin.readline().split(' '))
v2=(r//d)
v2+=1
if(d<l or d>r):
print(d)
else:
print(v2*d)
#a=list(map(int,sys.stdin.readline().split(' ')))
#####File Operations#####
if(fileoperation):
sys.stdout = orig_stdout
sys.stdin = orig_stdin
inputfile.close()
outputfile.close() | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q, i, l, r, d;
cin >> q;
for (i = 0; i < q; i++) {
cin >> l >> r >> d;
int x = r / d;
if ((d * 1) < l)
cout << d * 1 << endl;
else if ((x * d) <= r)
cout << ((x + 1) * d) << endl;
}
return 0;
}
| 7 | CPP |
for i in range(int(input())):
a = [int(a) for a in input().split()]
j = 1
if a[2] < a[0] or a[2] > a[1]:
print(a[2])
else:
print((a[1] // a[2]) * a[2] + a[2]) | 7 | PYTHON3 |
import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
import threading
def main():
for _ in range(int(input())):
l,r,d=map(int,input().split())
if d < l: print(d)
else:print((r//d+1)*d)
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion
if __name__ == "__main__":
"""sys.setrecursionlimit(400000)
threading.stack_size(40960000)
thread = threading.Thread(target=main)
thread.start()"""
main() | 7 | PYTHON3 |
q=int(input())
for i in range(q):
l,r,d=map(int,input().split())
if d<l:
print(d)
else:
print(r//d*d+d)
| 7 | PYTHON3 |
import math
n = int(input())
while n:
l,r,d = list(map(int, input().split(" ")))
k1 = math.floor(r/d) + 1
k2 = math.ceil(l/d) - 1
if( d == 1 and l == 1):
print(1 + r)
else:
if(d < l):
print(d)
else:
if(k2 != 0):
print(k2*d)
else:
print(k1*d)
n = n - 1
| 7 | PYTHON3 |
import math
q=int(input())
for tt in range(q):
l,r,d=map(int,input().split())
if d==1:
if l>1:
print(1)
else:
print(r+1)
continue
if d>r:
print(d)
continue
if d<l:
print(d)
continue
if l>d:
xx=(r//d)
print(xx*d)
continue
yy=math.floor(l/d)
xx=math.ceil(r/d)
lx=yy*d
rx=xx*d
if lx==l:
lx=(yy-1)*d
if rx==r:
rx=(xx+1)*d
if lx<=0:
lx=1000000000000
print(min(lx,rx)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int a;
scanf("%d", &a);
for (int rr = 1; rr <= a; rr++) {
int r1, r2, dig, res;
scanf("%d%d%d", &r1, &r2, &dig);
if (r1 > dig)
printf("%d\n", dig);
else {
res = ((r2 / dig) + 1) * dig;
printf("%d\n", res);
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
scanf("%d", &t);
while (t--) {
int a, b, d;
scanf("%d%d%d", &a, &b, &d);
if (d < a)
printf("%d\n", d);
else {
printf("%d\n", b + d - b % d);
}
}
return 0;
}
| 7 | CPP |
q=int(input())
while q>0:
l,r,d=map(int,input().split())
a=l/d
b=r/d
min=0
if a>1:
min=d
else:
min=(int(b)+1)*d
print(min)
q-=1
| 7 | PYTHON3 |
n = int(input())
for i in range(n):
s = input().split(' ')
if int(s[2]) < int(s[0]):
print(int(s[2]))
else:
print(int(s[2]) * (int(s[1])//int(s[2]) + 1)) | 7 | PYTHON3 |
n = int(input())
for _ in range(n):
l, r, d = map(int, input().split())
if d < l:
print(d)
else:
i = max(r // d, 1)
while l <= i * d <= r:
i += 1
print(i * d) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
l,r,d = map(int,input().split())
if d>=l and d<=r:
print(((r//d)+1)*d)
else :
print(d) | 7 | PYTHON3 |
import sys
input = sys.stdin.readline
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
if a[i][0] <= a[i][2] and a[i][2] <= a[i][1]:
print((a[i][1]//a[i][2]+1)*a[i][2])
else:
print(a[i][2]) | 7 | PYTHON3 |
def ans(arr):
l, r, d = arr[0], arr[1], arr[2]
x1 = l / d
x2 = r / d
if(x1 > 1):
return(d)
return(d * (int(x2) + 1))
if __name__ == '__main__':
t = int(input())
for _ in range(t):
n = list(map(int, input().strip().split()))
print(ans(n)) | 7 | PYTHON3 |
n=int(input())
for i in range(0,n):
a=(list(map(int, input().split())))
if a[0]/a[2]>1:
d=a[0]%a[2]
if a[0]/a[2]>=2:
print(a[2])
elif d>0:
print(a[2])
else:
print(((a[1] // a[2]) + 1) * a[2])
else:
print(((a[1]//a[2])+1)*a[2])
| 7 | PYTHON3 |
for _ in range(int(input())):
l,r,d = tuple(map(int,input().split()))
if l%d == 0:
if l//d > 1:
print(d)
continue
else:
pass
elif l//d > 0:
print(d)
continue
if r%d==0:
print( r+d )
else:
print( d*(r//d) + d ) | 7 | PYTHON3 |
q = int(input())
for i in range(q):
li, ri, di = input().split()
li = int(li)
ri = int(ri)
di = int(di)
minimun = li // di
maximun = ri // di
if ri % di == 0 or di < ri:
maximun = (ri // di) + 1
if di < li or di > ri:
print(di)
else:
print(di * (maximun)) | 7 | PYTHON3 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
q = int(input())
for i in range(q):
l, r, d = map(int, input().split())
if d < l or d > r:
print(d)
else:
print((r//d)*d+d)
| 7 | PYTHON3 |
t = int(input())
for i in range(t):
l, r, d = map(int, input().split())
bottom = l / d
if bottom > 1:
print(d)
else:
top = r // d * d + d
print(top) | 7 | PYTHON3 |
def main():
q = int(input())
for i in range(q):
l, r, d = map(int, input().split())
print(d if d < l else (r // d + 1) * d)
if __name__ == "__main__":
main() | 7 | PYTHON3 |
t = int(input())
for i in range(t):
l, r, d = map(int, input().split())
if(d<l or d>r):
print(d)
else:
print((r//d)*d+d) | 7 | PYTHON3 |
q=int(input())
for i in range(q):
l,r,d=map(int,input().split())
if d<l or d>r:
print(d)
else:
print((r//d+1)*d)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int i;
int fun(int l, int r, int d) {
if (d > r) {
return d;
}
if (r == d) {
return d * 2;
}
if (d < r) {
for (i = d; i <= l; i++) {
if (i % d == 0) {
if (i == l) break;
return i;
}
}
}
if (d > l) {
int p = ceil(((double)(r + 1) / (double(d)))) * d;
return p;
}
if (d < l) {
return d;
}
if (d == l) {
return (ceil((double)(r + 1) / (double)d)) * d;
}
}
int main() {
int l, r, d, i, j[500];
int q;
cin >> q;
for (i = 0; i < q; i++) {
cin >> l >> r >> d;
j[i] = fun(l, r, d);
}
for (i = 0; i < q; i++) {
cout << j[i] << endl;
}
}
| 7 | CPP |
from math import ceil, log
q = int(input().strip())
while q > 0:
l, r, d = map(int , input().strip().split())
if(d < l):
print(d)
else:
if(d == 1):
print(r+1)
else:
print((r//d)*d + d)
q-=1
| 7 | PYTHON3 |
for _ in range(int(input())):
l,r,d = map(int,input().split())
if(l <= d and d <= r):
x = r-(r%d)
print(x+d)
else:
print(d)
| 7 | PYTHON3 |
for i in range(int(input())):
l,r,d=map(int,input().split())
if d>r or d<l:
print(d)
else:print((r//d)*d+d) | 7 | PYTHON3 |
n=int(input())
for i in range(n) :
a,b,c=map(int,input().split())
if c>=a :
print(b+c-b%c)
else :
print(c)
| 7 | PYTHON3 |
t = int(input())
while t>0:
l,r,d = map(int, input().split())
x = d
if x<l or x>r:
print(x)
else:
if r%d==0:
print(((r//d) + 1)*d)
else:
a = r%d
b = ((r//d) + 1)*d
print(b)
t = t - 1 | 7 | PYTHON3 |
for k in range(int(input())):
l, r, d = map(int, input().split())
if d < l:
print(d)
else:
i = r // d
ans = d
while r >= ans:
ans = d * i
i += 1
print(ans)
| 7 | PYTHON3 |
import math
n = int(input());
for i in range (n):
s = input()
l,r,d = [int (x) for x in s.split()]
if l/d > 1:
print(d)
else:
print (d*(math.floor(r/d)+1)) | 7 | PYTHON3 |
q=int(input())
for i in range(q):
a,r,m=map(int,input().split())
k=2
d=m
if d<a:
print(d)
elif d>r:
print(d)
else:
print(d*((r//d)+1))
| 7 | PYTHON3 |
for i in range(int(input())):
l , r , d = map(int, input().split())
if d<l:
print(d)
else:
temp = (r+d)%d
temp = (r+d)-temp
print(temp) | 7 | PYTHON3 |
for _ in range(int(input())):
l, r, d = map(int, input().split())
d2 = d
if(d >= l and d <= r):
d = (d + r) - (d + r) % d
print(d)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
long int l, r, d;
cin >> l >> r >> d;
if (d < l)
arr[i] = d;
else if (d >= l && d <= r) {
if (r % d != 0)
arr[i] = (r / d) * d + d;
else
arr[i] = r + d;
} else
arr[i] = d;
}
for (int i = 0; i < n; i++) cout << arr[i] << endl;
return 0;
}
| 7 | CPP |
n = int(input())
for i in range(n):
l, r, d = map(int, input().split())
if d < l:
print(d)
else:
if (r + 1) % d == 0:
print(r + 1)
else:
print(r + 1 + d - (r + 1) % d) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int l, r, d;
int n, q;
int main() {
scanf("%d", &q);
while (q--) {
scanf("%d%d%d", &l, &r, &d);
if (d < l)
printf("%d\n", d);
else {
bool flag = false;
for (int i = r + 1; i <= r + 10000; ++i) {
if (i % d == 0) {
printf("%d\n", i);
flag = true;
break;
}
}
if (!flag) {
for (int i = d;; i += d) {
if (i > r && i % d == 0) {
printf("%d\n", i);
break;
}
}
}
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
template <typename P, typename Q>
ostream& operator<<(ostream& os, pair<P, Q> p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <typename P, typename Q>
istream& operator>>(istream& is, pair<P, Q>& p) {
is >> p.first >> p.second;
return is;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
os << "(";
for (auto& i : v) os << i << ",";
os << ")";
return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
for (auto& i : v) is >> i;
return is;
}
template <typename T>
inline T setmax(T& a, T b) {
return a = std::max(a, b);
}
template <typename T>
inline T setmin(T& a, T b) {
return a = std::min(a, b);
}
int main(int argc, char* argv[]) {
ios_base::sync_with_stdio(0);
cin.tie(0);
int q;
while (cin >> q) {
while (q--) {
long long int a, b, c;
cin >> a >> b >> c;
if (c < a) {
cout << c << endl;
} else {
cout << (b + c) / c * c << endl;
}
}
}
return 0;
}
| 7 | CPP |
n = int(input())
while(n):
a,b,c=map(int,input().split())
if(c*1<a):print(c*1)
else:print(((b//c)+1)*c)
n-=1 | 7 | PYTHON3 |
q = int(input())
for i in range(q):
x = list(map(int, input().split()))
if x[2] < x[0]:
print(x[2])
else:
print(x[1] + x[2] - x[1] % x[2])
| 7 | PYTHON3 |
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM =
chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
int main(int argc, char** argv) {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long q;
cin >> q;
while (q--) {
long long l, r, d;
cin >> l >> r >> d;
if (d < l)
cout << d << "\n";
else
cout << ((r / d) + 1) * d << "\n";
}
return 0;
}
| 7 | CPP |
q = int(input())
for _ in range(q):
l,r,d = map(int,input().split())
m = l/d
z = r//d
if(m>1):
print(d)
else:
print(d*(z+1))
| 7 | PYTHON3 |
def spdvd(a,b):
if a%b==0:
return a/b-1
return a/b
q= int(input())
for i in range(q):
l,r,x= list(map(int,(input().split())))
a= x* int(spdvd(l,x)); b= x* (int(r/x)+1)
if a>x:
print(x)
elif min(a,b)>0:
print(min(a,b))
else: print(max(a,b))
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
l, r, d = [int(p) for p in input().split()]
if d < l or d > r:
print(d)
else:
print(d*(r//d + 1))
| 7 | PYTHON3 |
n = int(input())
for _ in range(n):
numbers = [int(i) for i in input().split()]
l = numbers[0]
r = numbers[1]
d = numbers[2]
if d < l or d > r:
print(d)
else:
print((r // d + 1) * d) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int l, r, d;
cin >> l >> r >> d;
if (l - d <= 0)
cout << r + d - r % d << endl;
else {
cout << d << endl;
}
}
}
| 7 | CPP |
for _ in range(int(input())):
l,r,d=[int(x) for x in input().split()]
if l%d==0:
num1=l//d
num1-=1
else:
num1=l//d
num2=r//d
num2+=1
if num1>=1:
print(d)
continue
else:
print(num2*d)
continue
| 7 | PYTHON3 |
for _ in range(int(input())):
l,r,d=map(int,input().split())
l,r=min(l,r),max(l,r)
temp1=l//d
temp2=r//d
#print(temp1,temp2)
if(d*temp1==l):
temp1-=1
if(d*temp2<=r):
temp2+=1
flag=0
#print(temp1,temp2)
for q in range(1,temp1+1):
print(d*q)
flag=1
break
if(flag):
continue
print(d*temp2) | 7 | PYTHON3 |
q = int(input())
for _ in range(q):
l,r,d = map(int,input().split())
if d==1:
if l!=1:
print(1)
else:
print(r+1)
else:
if l%d ==0:
check = (l//d) - 1
else:
check = l//d
check2 = r//d + 1
if check>0:
print(d)
else:
print(check2*d) | 7 | PYTHON3 |
t=int(input())
while t>0:
l,r,d=map(int,input().split())
if d<l:
print(d)
else:
c=r//d
print(d*(c+1))
t=t-1
| 7 | PYTHON3 |
def solve(l, r, d):
if d < l:
return d
return d * ((r)//d+1)
q = int(input())
for i in range(q):
l, r, d = map(int, input().split())
print(solve(l, r, d)) | 7 | PYTHON3 |
for _ in range(int(input())):
l,r,d=map(int,input().split())
if l<=d:
#print(d,r)
if r%d==0:print(r+d)
else:print(r+(d-r%d))
else:
print(d)
| 7 | PYTHON3 |
q = int(input())
for i in range(q):
l, r, d = map(int, input().split())
x1 = d
x2 = ((r) // d + 1) * d
if x1 < l:
print(x1)
else:
print(x2) | 7 | PYTHON3 |
q=int(input())
while q:
l,r,d=map(int,input().split())
if(d<l):
print(d)
elif(d>r):
print(d)
else:
a=r//d
print((a+1)*d)
q-=1 | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n;
cin >> t;
while (t--) {
int r, l, d, x;
cin >> r >> l >> d;
if (d < r || d > l)
cout << d << endl;
else {
if (d >= r && d <= l) cout << (l / d + 1) * d << endl;
}
}
return 0;
}
| 7 | CPP |
t = int(input())
while t:
a, b, c = map(int, input().split())
if c < a:
print(c)
else:
print(b + (c - (b % c)))
t -= 1
| 7 | PYTHON3 |
q = int(input())
for _ in range(q):
l, r, d = map(int, input().split())
q1 = l//d
if q1>0:
if l%d==0:
if q1>1:
print(d)
else:
q2= r//d
print((q2+1)*d)
else:
print(d)
else:
q2 = r//d
print((q2+1)*d)
| 7 | PYTHON3 |
for i in int(input())*[0]:
l=list(map(int,input().split()))
if l[2]>=l[0]:
z=l[2]*(0--l[1]//l[2])
if z>l[1]:
print(z)
else:
print(z+l[2])
else:
print(l[2]) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int q;
int main() {
cin >> q;
long long l, r, d;
while (q--) {
cin >> l >> r >> d;
if (l > d)
cout << d << endl;
else
cout << ((r + d) / d) * d << endl;
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q;
scanf("%d", &q);
for (int i = 1; i <= q; i++) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if (c < a || c > b)
printf("%d\n", c);
else
printf("%d\n", (b / c + 1) * c);
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int q;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> q;
int l, r, d;
for (int _ = 0; _ < (signed)(q); _++) {
cin >> l >> r >> d;
if (l > d)
cout << d;
else
cout << ((r + d) / d) * d;
cout << "\n";
}
return 0;
}
| 7 | CPP |
for i in range(int(input())):
left, right, d = map(int, input().split())
ans = (d if left > d else 0) or (right // d + 1) * d
print(ans if ans > 0 else -1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
long long int l, r, d;
while (t--) {
cin >> l >> r >> d;
if (d < l) {
cout << d << endl;
} else {
long long int a = r / d + 1;
cout << d * a << endl;
}
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long t, l, r, c;
signed main() {
cin >> t;
while (t--) {
cin >> l >> r >> c;
if (c < l)
cout << c << endl;
else {
if (r % c == 0)
cout << r + c << endl;
else
cout << ((r / c) + 1) * c << endl;
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
int main() {
int q;
scanf("%d", &q);
while (q--) {
int l, r, d;
scanf("%d %d %d", &l, &r, &d);
int rem2 = r % d;
if (d < l) {
printf("%d\n", d);
} else {
int r1 = r + (d - rem2);
printf("%d\n", r1);
}
}
return 0;
}
| 7 | CPP |
t=int(input())
while t>0:
t-=1
s=input()
s=s.split()
l=int(s[0])
r=int(s[1])
d=int(s[2])
if l>d:
print(d)
else:
x=(r//d)+1
print(x*d) | 7 | PYTHON3 |
#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 l, r, d;
cin >> l >> r >> d;
if (d < l)
cout << d << "\n";
else {
cout << ((r / d) + 1) * d << "\n";
}
}
return 0;
}
| 7 | CPP |
n=int(input())
for i in range(0,n):
p=input().rstrip().split(' ')
l=int(p[0])
r=int(p[1])
d=int(p[2])
t=d*1;
j=1;
U=0;
while(t<l):
if t<l and t<r:
U=1;
break;
if t>l and t>r:
U=1;
break;
j+=1;
t=d*j;
if U==1:
print(t)
else:
g=(r//d)+1;
t=d*g;
while(t>r):
if t<l and t<r:
U=1;
break;
if t>l and t>r:
U=1;
break;
g+=1;
t=d*g;
print(t)
| 7 | PYTHON3 |
def funcao(l, r, d):
if d < l or d > r:
return d
else:
m = int(r / d)
return (m + 1) * d
q = int(input())
lista = []
for e in range(q):
lista.append(input().split())
for e in lista:
l = int(e[0])
r = int(e[1])
d = int(e[2])
print(funcao(l, r, d))
| 7 | PYTHON3 |
def rI():
return [int(i) for i in input().split()]
q = rI()[0]
for i in range(q):
l,r,d = rI()
if(d < l or d > r):
print(d)
continue
oo = r // d
print((oo+1)*d) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int k, t, l, r, d, j = 0;
cin >> t;
do {
cin >> l >> r >> d;
if (d < l) {
cout << d << endl;
} else {
k = r % d;
k = r + d - k;
cout << k << endl;
}
j++;
} while (j < t);
}
| 7 | CPP |
for i in range(int(input())):
l, r, d = map(int, input().split())
ans = d;
if ans < l :
print(d)
else :
print((r // d + 1) * d) | 7 | PYTHON3 |
import math
import sys
import itertools
def sa(Type= int):
return [Type(x) for x in input().split()]
def solve(t):
l, r, d = sa()
x = d
if l <= d <= r:
p = (r//d)+1
print(p*d)
else:
print(d)
if __name__ == '__main__':
# sys.stdin = open('input.txt', 'r')
t = int(input())
for i in range(t):
solve(i+1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)2e5 + 5;
long long T, l, r, d;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> T;
while (T-- && cin >> l >> r >> d) {
if (l > d)
cout << d << endl;
else
cout << (r / d + 1) * d << endl;
}
}
| 7 | CPP |
n = int(input())
for _ in range(n):
l,r,d = map(int,input().split())
if d<l:
print(d)
else:
a = r//d
print((a+1)*d)
| 7 | PYTHON3 |
q = int(input())
result = []
for i in range(q):
l, r, d = map(int, input().split())
if d < l:
result.append(d)
elif d > r:
result.append(d)
else:
c = (r//d)*d
while c <= r:
c += d
result.append(c)
for i in result:
print (i)
| 7 | PYTHON3 |
def main():
q = int(input())
for _ in range(q):
[l, r, d] = [int(x) for x in input().split()]
if l <= d <= r:
print((r // d + 1) * d)
else:
print(d)
if __name__ == '__main__':
main() | 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int l, r, d, t;
scanf("%d", &t);
while (t--) {
scanf("%d %d %d", &l, &r, &d);
if (l != d && l / d >= 1)
printf("%d\n", d);
else
printf("%d\n", ((r / d) + 1) * d);
}
}
| 7 | CPP |
t=int(input())
for _ in range(t):
l,r,d=(map(int,input().strip().split()))
if(l>d):
print(d)
else:
k=r//d
k=(k+1)*d;
print(k)
| 7 | PYTHON3 |
for _ in range(int(input())):
l,r,d = [int(_) for _ in input().strip().split()]
if d < l:
print(d)
else:
print(r+d - (r+d)%d) | 7 | PYTHON3 |
n = int(input())
for x in range(n):
l,r,d = map(int,input().split())
if l <= d:
x = (r//d +1)*d
else:
x = d
print(x)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long q;
cin >> q;
while (q--) {
long long l, r, d, c;
cin >> l >> r >> d;
if (l > d) {
cout << d << " \n";
} else {
c = floor(r / d);
c += 1;
cout << c * d << "\n";
}
}
}
| 7 | CPP |
import math
t = int(input())
for i in range(t):
l, r ,d = [int(i) for i in input().split()]
if d < l:
print(d)
elif r < d:
print(d)
else:
k = math.floor(r / d) + 1
print(int(d * k)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q;
scanf("%d", &q);
while (q--) {
int l, r, d;
scanf("%d %d %d", &l, &r, &d);
if (d < l)
printf("%d\n", d);
else {
int acima = r + (d - (r % d));
printf("%d\n", acima);
}
}
return 0;
}
| 7 | CPP |