solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int q;
cin >> q;
while (q--) {
long long l, r, d;
cin >> l >> r >> d;
if (l <= d)
cout << (r / d + 1) * d << endl;
else
cout << d << endl;
}
}
| 7 | CPP |
T = int(input())
for t in range(T):
l, r, d = [int(i) for i in input().split()]
i=0
while d*(r//d + i) <= r:
i+=1
ans = d*(r//d+i)
ans2 = d
if ans2<l:
print(ans2)
else:
print(ans)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin >> t;
long long le, re, dis;
for (int i = 0; i < t; i++) {
cin >> le >> re >> dis;
long long le1 = le / dis;
long long le2 = re / dis;
if (le % dis == 0)
le1 = (le / dis - 1) * dis;
else
le1 = (le / dis) * dis;
le2 = (re / dis + 1) * dis;
if (le1 > 0)
cout << min(le1, dis) << endl;
else
cout << le2 << endl;
}
return 0;
}
| 7 | CPP |
for _ in range(int(input())):
l,r,d=map(int,input().split())
if d<l:
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--) {
long long l, r, d;
cin >> l >> r >> d;
if (d < l) {
cout << d << endl;
continue;
}
long long result = r + d - (r % d);
cout << result << endl;
}
return 0;
}
| 7 | CPP |
n=int(input())
for i in range(n):
l,r,m=map(int,input().split())
if l>m:
print(m)
else:print(((r//m)+1)*m) | 7 | PYTHON3 |
import math
import os
import random
import re
import sys
if __name__ == '__main__':
t=int(input())
for i in range(0,t):
a = list(map(int, input().rstrip().split()))
l,r,d=a[0],a[1],a[2]
if(d<l):
print(d)
else:
k=r//d
#print((k+1))
t=d*(k+1)
print(t)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q;
cin >> q;
long long a, b, c, s, m;
while (q--) {
cin >> a >> b >> c;
long long x;
if (c < a)
x = c;
else {
x = ((b / c) + 1) * c;
}
cout << x << '\n';
}
}
| 7 | CPP |
for _ in range(int(input())):
l,r,d=map(int,input().split()); k=r%d
if l>d:print(d)
elif k==0:print(d+r)
elif k>0:print(r-k+d)
| 7 | PYTHON3 |
q = int(input())
for i in range(q):
l, r, d = map(int,input().split())
u = d
if u < l:
print(u)
continue
u = r // d * d + d
print(u) | 7 | PYTHON3 |
import sys
import math
#from queue import *
#import random
#sys.setrecursionlimit(int(1e6))
input = sys.stdin.readline
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
return(int(input()))
def inara():
return(list(map(int,input().split())))
def insr():
s = input()
return(list(s[:len(s) - 1]))
def invr():
return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############
t=inp()
for _ in range(t):
l,r,x=invr()
a=x
b=(r//x)*x+x
if a<l:
print(a)
else:
print(b)
| 7 | PYTHON3 |
def MinimumInteger(l,r,d):
if d<l:
return d%l
else:
return r+(d-(r%d))
q = int(input())
result = ''
while q>0:
l,r,d = [int(x) for x in input().split()]
result+=str(MinimumInteger(l,r,d))
if q>1:
result+='\n'
q-=1
print(result) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
static int Q, L, R, X;
int main() {
scanf("%d", &Q);
while (Q--) {
scanf("%d%d%d", &L, &R, &X);
if (X < L)
printf("%d\n", X);
else
printf("%d\n", (R / X + 1) * X);
}
return 0;
}
| 7 | CPP |
q = int(input())
for i in range(0, q):
l, r, d = map(int, input().split())
if d < l or d > r:
print(d)
else:
d *= (r//d)+1
print(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 (d < l) {
cout << d << endl;
} else {
int div = r / d;
cout << d * (div + 1) << endl;
}
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
long long l, r, d, check, flag, res, div;
cin >> l >> r >> d;
if (d == 1) {
if (l > 1)
cout << "1" << endl;
else
cout << r + 1 << endl;
continue;
}
if (l > d) {
cout << d << endl;
} else {
check = r % d;
if (check == 0)
cout << r + d << endl;
else
cout << r + (d - check) << endl;
}
}
return 0;
}
| 7 | CPP |
def minint(n, a):
for i in range(n):
l=a[i][0]
r=a[i][1]
d=a[i][2]
if l<= d<=r:
print((r//d+1)*d)
else:
print(d)
n=int(input())
v=[]
for i in range(n):
a = input().strip().split()
a = list(map(int, a))
v.append(a)
minint(n, v) | 7 | PYTHON3 |
for _ in range(int(input())):
l,r,d=map(int,input().split())
if d<l:
print(d)
if d>=l and d<=r:
print(((r//d)+1)*d)
if d>r:
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:
a=int(r/d)
print(d*(a+1))
| 7 | PYTHON3 |
q=int(input())
for i in range(q):
l,r,d=[int(i) for i in input().split()]
if l>d:
print(d)
else:
print(r+d-(r%d))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long int expo_fast(long long int a, long long int b) {
a = a;
long long int result = 1;
while (b) {
if (b & 1) result = (result * a);
b >>= 1;
a = (a * a);
}
return (result);
}
void take_in(vector<long long int>* arr) {
for (int i = 0; i < arr->size(); i++) cin >> (*(arr))[i];
}
void disp_arr(vector<long long int>* arr) {
for (int i = 0; i < arr->size(); i++) cout << (*(arr))[i] << " ";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int q;
cin >> q;
while (q--) {
long long int l, r, d;
cin >> l >> r >> d;
if (l > d)
cout << d << "\n";
else {
cout << d * ((r / d) + 1) << "\n";
}
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long n, a, b, d;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a >> b >> d;
if (d < a)
cout << d << '\n';
else
cout << b + (d - b % d) << '\n';
}
}
| 7 | CPP |
from math import ceil
def compute_minimum_int(input_data):
for i in range(len(input_data)):
input_data[i] = int(input_data[i])
x = input_data[:-1]
d = input_data[2]
x.sort()
if not ((d >= x[0]) and (d <= x[1])):
return d
z = x[1]/d
y = ceil(x[1]/d)
if z == y:
y += 1
return d*y
inputs = []
inputs_num = int(input())
while inputs_num > 0:
input_data = input().split(' ')
inputs.append(input_data)
inputs_num -= 1
for i in inputs:
print(compute_minimum_int(i))
| 7 | PYTHON3 |
# -*- coding: utf-8 -*-
# @Time : 2019/1/11 22:37
# @Author : LunaFire
# @Email : [email protected]
# @File : A. Minimum Integer.py
def main():
query_num = int(input())
for _ in range(query_num):
l, r, d = map(int, input().split())
if l > d:
ret = d
else:
ret = r // d * d + d
print(ret)
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
for _ in range(int(input())):
a,b,c = map(int, input().split())
if a > c:
print(c)
else:
r = b % c
r = c - r
print(b + r) | 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)*d+d)
| 7 | PYTHON3 |
n = int(input())
for i in range(n):
[l, r, d] = list(map(int, input().split(" ")))
print(((r//d + 1)*d) if d >= l else d)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, l, r, d;
cin >> n;
while (n--) {
cin >> l >> r >> d;
cout << (d < l ? d : ((r / d) + 1) * d) << endl;
}
return 0;
}
| 7 | CPP |
n = int(input())
l, r, d = [], [], []
for i in range(n):
li, ri, di = map(int, input().split())
l.append(li)
r.append(ri)
d.append(di)
for i in range(n):
ans = 0
if l[i] / d[i] > 1:
ans = d[i]
else:
temp = r[i] // d[i] + 1
ans = temp * d[i]
print(ans)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q;
cin >> q;
for (int i = 0; i < q; i++) {
int l, r, d;
cin >> l >> r >> d;
if (d < l) {
cout << d;
} else {
int f = d - r % d + r;
cout << f;
}
if (i != q - 1) {
cout << endl;
}
}
}
| 7 | CPP |
# Codeforces
# #110A - Minimum Integer
# http://codeforces.com/problemset/problem/1101/A
# 11/01/2019
# Nilton G. M. Junior
if __name__ == '__main__':
num_queries = int(input())
for i in range(num_queries):
l, r, d = list(map(int, input().split()))
print(d if d < l else d * (1 + r // d))
| 7 | PYTHON3 |
if __name__ == "__main__":
for i in range(int(input())):
l, r, d = map(int, input().split())
if(l <= d):
print(int(d*(int(r/d)+1)))
else:
print(d) | 7 | PYTHON3 |
q=int(input())
search_number=0
for number_string in range (q):
string=input()
string_=string.split()
l=int(string_[0])
r=int(string_[1])
d=int(string_[2])
if l/d>1:
search_number=d
elif l//d<=1:
search_number=d*(r//d+1)
print(search_number) | 7 | PYTHON3 |
import math as ma
import sys
from sys import exit
from decimal import Decimal as dec
from itertools import permutations
def li ():
return list (map (int, input ().split ()))
def num ():
return map (int, input ().split ())
def nu ():
return int (input ())
mm = 1000000007
t = nu()
for it in range (t):
l,r,d=num()
a=(l-1)%d
b=(r)%d
z=l-1-a
v=(d-b)+r
if(d<l):
print(d)
else:
print(v) | 7 | PYTHON3 |
for _ in range(int(input())):
l, r, d = map(int, input().split())
l, r = min(l, r), max(l, r)
if d < l or d > r:
print(d)
else:
print(r + d - r % d) | 7 | PYTHON3 |
n = int(input())
for i in range(n):
l, r, d = map(int, input().split())
if l <= d:
print((r // d + 1) * d)
else:
print(d) | 7 | PYTHON3 |
import math
q = int(input())
for i in range(q):
l, r, d = map(int, input().split())
n = l / d
if n > 1:
print(d)
else:
n = r / d
print((math.floor(n) + 1) * d)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q;
cin >> q;
while (q--) {
long long int l, r, x, y, d;
cin >> l >> r >> d;
if (d < l || d > r)
cout << d << endl;
else {
x = (r + 1) / d;
y = x * d;
if (y <= r) y = (x + 1) * d;
cout << y << endl;
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int q;
cin >> q;
while (q--) {
long long int l, r, d;
cin >> l >> r >> d;
if (d < l) {
cout << d << endl;
continue;
}
int cnt = (r + d) / d;
cout << cnt * d << endl;
}
return 0;
}
| 7 | CPP |
Q = int(input())
for i in range(Q):
arr = input()
L,R,D = [int(x) for x in arr.split(' ')]
if D<L:
print(D)
else:
if R%D==0:
print(R+D)
else:
print((R//D)*D+D) | 7 | PYTHON3 |
t = int(input())
for i in range(t):
l, r, d = map(int, input().split())
if (d < l):
print(d)
else:
print(d * (r//d + 1))
| 7 | PYTHON3 |
q=int(input())
for _ in range(q):
l,r,d=map(int,input().split())
if(d!=1):
if(d<l):
print(d)
else:
x=d*(r//d+1)
y=d*(l//d)
if(y>0 and y!=l):
print(y)
else:
print(x)
elif(d==1):
if(l>=2):
print(1)
else:
print(r+1) | 7 | PYTHON3 |
N = int(input())
B = []
for i in range(0, N):
a, b, c = map(int, input().split())
if c < a or c > b:
B.append(c)
else:
B.append((b // c + 1) * c)
for i in B:
print(i)
| 7 | PYTHON3 |
a = int(input())
for i in range(a):
q,w,e = map(int, input().split())
if(e<q):
print(e)
else:
print((w//e+1)*e)
| 7 | PYTHON3 |
import math
for _ in range(int(input())):
l,r,x = map(int,input().split())
if l>x:
print(x)
else:
print(x * (math.floor(r / x)+1))
| 7 | PYTHON3 |
for _ in range(int(input())):
l, r, d = map(int, input().split())
print((r + d) // d * d if l <= d else d) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
bool Finish_read;
template <class T>
inline void read(T &x) {
Finish_read = 0;
x = 0;
int f = 1;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') f = -1;
if (ch == EOF) return;
ch = getchar();
}
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
x *= f;
Finish_read = 1;
}
template <class T>
inline void print(T x) {
if (x / 10 != 0) print(x / 10);
putchar(x % 10 + '0');
}
template <class T>
inline void writeln(T x) {
if (x < 0) putchar('-');
x = abs(x);
print(x);
putchar('\n');
}
template <class T>
inline void write(T x) {
if (x < 0) putchar('-');
x = abs(x);
print(x);
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) {
long long gg = gcd(a, b);
a /= gg;
if (a <= LLONG_MAX / b) return a * b;
return LLONG_MAX;
}
const int maxn = 1e5 + 7;
int n, m;
int main() {
long long x;
int n;
cin >> n;
while (n--) {
long long l, r, d;
cin >> l >> r >> d;
if (d < l)
cout << d << endl;
else
cout << (r / d + 1) * d << endl;
}
return 0;
}
| 7 | CPP |
q = int(input())
for c in range(q):
l, r, d = map(int, input().split())
if l > d:
print(d)
else:
print(r + (d - (r % d))) | 7 | PYTHON3 |
import math
q = int(input())
q1 = list(range(q))
for i in range(0,q):
temp = map(int,input().split(' '))
l, r, d = temp
k = d
if k >= l and k <= r:
for j in range(0,math.ceil(r/l)):
t1 = r % k
k = r + k - t1
if k > r:
break
q1[i] = k
for i in range(0,q):
print(q1[i]) | 7 | PYTHON3 |
q = int(input())
for i in range(q):
l,r,d = map(int,input().split())
if l<=d<=r:
m = r//d
print(d*(m+1))
elif d<l:
print(d)
elif d>r:
print(d)
| 7 | PYTHON3 |
for x1 in range(int(input())):
l,r,d=map(int,input().split())
if d<l or d>r:
print(d)
else:
print((int(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 (d < l)
cout << d << "\n";
else if (d > r)
cout << d << "\n";
else {
r /= d;
r++;
cout << r * d << "\n";
}
}
return 0;
}
| 7 | CPP |
# import sys
# sys.stdin=open("input.in",'r')
# sys.stdout=open("out.out",'w')
for i in range(int(input())):
l,r,d=map(int,input().split())
if d<l:
print(d)
else:
x=r//d
print((x+1)*d)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long q;
cin >> q;
while (q--) {
long long l, r, d;
cin >> l >> r >> d;
long long x = (r) / d;
if (d >= l)
cout << (x + 1) * d << endl;
else
cout << d << endl;
}
}
| 7 | CPP |
def Spider ():
a, b, c = map(int, input().split())
if c < a or c > b: print(c)
else: print((int(b / c) + 1) * c)
TIMES = 1
TIMES = int(input())
for TIME_TEMP in range(TIMES):
Spider() | 7 | PYTHON3 |
import math
n = int(input())
for i in range(n):
x = list(map(int,input().split()))
l = x[0]
r = x[1]
d = x[2]
if d < l:
print (d)
else:
print (r + d - (r % d)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int l, r, d;
int x;
int q;
scanf("%d", &q);
while (q--) {
scanf("%d %d %d", &l, &r, &d);
if (d < l)
printf("%d\n", d);
else {
printf("%d\n", ((r / d) * d + d));
}
}
}
| 7 | CPP |
q=int(input())
for j in range(q):
l,r,d=map(int,input().split())
ans=[]
if(d==1):
if(l-d>0):
ans.append(l-d)
ans.append(r+d)
if(l%d==0):
if(l-d>0):
ans.append(l-d)
if(r%d==0):
ans.append(r+d)
if(l%d):
if(l-l%d>0):
ans.append(l-l%d)
if(r%d):
ans.append(r+d-r%d)
if(d<l):
ans.append(d)
print(min(ans)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long n, l, m, c;
int main(void) {
cin >> n;
for (long long i = 1; i <= n; ++i) {
cin >> m >> c >> l;
if (m > l) {
cout << l << endl;
} else {
long long k = c / l;
k++;
cout << k * l << endl;
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
struct InputReader {
char buf[1000001];
int p;
inline InputReader() { p = 1000001; }
inline void Flush() {
p = 0;
fread(buf, 1, 1000001, stdin);
}
inline char C() {
if (p >= 1000001) Flush();
return buf[p++];
}
inline char Readnum() {
char ch = C();
while (!isdigit(ch) && ch != '-') ch = C();
return ch;
}
inline void Readalpha(char &c) {
c = C();
while (!isalpha(c)) c = C();
}
int operator()() {
int ans = 0, fu = 1;
char ch = Readnum();
if (ch == '-') fu = -1, ch = C();
while (ch >= '0' && ch <= '9') {
ans = ans * 10 + ch - '0';
ch = C();
}
return ans * fu;
}
long long Readll() {
long long ans = 0LL, fu = 1LL;
char ch = Readnum();
if (ch == '-') fu = -1LL, ch = C();
while (ch >= '0' && ch <= '9') {
ans = ans * 10LL + ch - '0';
ch = C();
}
return ans * fu;
}
inline void Readstring(string &x) {
x.clear();
char ch = C();
while (!isdigit(ch) && !isalpha(ch) && ch != '-' && ch != '.') ch = C();
while (isdigit(ch) || isalpha(ch) || ch == '-' || ch == '.') {
x += ch;
ch = C();
}
}
inline void Readchstring(char s[]) {
int len = 0;
char ch = C();
while (!isdigit(ch) && !isalpha(ch)) ch = C();
while (isdigit(ch) || isalpha(ch)) {
s[len++] = ch;
ch = C();
}
s[len] = '\0';
}
inline void Specialread(bool &x) {
char c = C();
while (c != '#' && c != '.' && c != '=' && c != 'B') c = C();
x = c == '#';
}
} In;
inline void Read(int &x) { x = In(); }
inline void Read(int &x, int &y) {
x = In();
y = In();
}
inline void Read(int &x1, int &x2, int &x3) {
x1 = In();
x2 = In();
x3 = In();
}
inline void Read(int &x1, int &x2, int &x3, int &x4) {
x1 = In();
x2 = In();
x3 = In();
x4 = In();
}
inline void Read(long long &x) { x = In.Readll(); }
inline void Read(long long &x, long long &y) {
x = In.Readll();
y = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3) {
x1 = In.Readll();
x2 = In.Readll();
x3 = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3, long long &x4) {
x1 = In.Readll();
x2 = In.Readll();
x3 = In.Readll();
x4 = In.Readll();
}
inline void FILEIO() {}
inline void FILEIO(string pname) {
freopen((pname + ".in").c_str(), "r", stdin);
freopen((pname + ".out").c_str(), "w", stdout);
}
void Printtime() {}
void END() {
Printtime();
exit(0);
}
template <typename T>
void END(T mes) {
cout << mes << endl;
END();
}
template <typename T>
void Print(T a[], int s, int t, char sp = ' ', char ed = '\n') {
for (int i = s; i <= t; i++) cout << a[i] << sp;
cout << ed;
cout.flush();
}
template <typename T>
void Print(T a, int s = 0, int t = -1, char sp = ' ', char ed = '\n') {
if (t == -1) t = a.size() - 1;
for (int i = s; i <= t; i++) cout << a[i] << sp;
cout << ed;
cout.flush();
}
int main() {
FILEIO();
int T;
Read(T);
;
for (register int(ti) = 1; (ti) <= (T); ++(ti)) {
long long l;
Read(l);
;
long long r;
Read(r);
;
;
long long d;
Read(d);
;
;
if (d < l)
cout << d << endl;
else {
cout << r / d * d + d << endl;
}
}
END();
}
| 7 | CPP |
# codeforces
def main():
a = []
for _ in range(int(input())):
a.append(list(map(int, input().split())))
for q in a:
l = q[0]
r = q[1]
d = q[2]
if d < l:
print(d)
else:
print(d*(int(r/d)+1))
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int l, r, n, t;
scanf("%d", &t);
while (t--) {
scanf("%d %d %d", &l, &r, &n);
if (l > n) {
printf("%d\n", n);
continue;
}
long long k = r / n;
printf("%lld\n", (k + 1) * n);
}
return 0;
}
| 7 | CPP |
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((d*(r//d))+d)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int a, b, c;
int t;
scanf("%d", &t);
while (t--) {
scanf("%d%d%d", &a, &b, &c);
if (a > c)
printf("%d\n", c);
else {
printf("%d\n", ((b / c) + 1) * c);
}
}
}
| 7 | CPP |
x = int(input())
def my_function(x, y, z):
returnable = z
if(z < x or z > y):
return returnable
else:
returnable = y - (y % z)
return returnable + z
while(x > 0):
x -= 1
querie = list(map(int, input().split()))
print(my_function(querie[0], querie[1], querie[2]))
| 7 | PYTHON3 |
for i in range(int(input())):
left, right, d = map(int, input().split())
print(d if left > d else (right // d + 1) * d)
| 7 | PYTHON3 |
for z in range(int(input())):
l, r, d = map(int, input().split())
if d < l:
print(d)
elif d > r:
print(d)
else:
if r // d == r / d:
print(((r//d)+1)*d)
else:
print((r//d)*d + d) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, q;
cin >> q;
for (int i = 0; i < q; i++) {
cin >> a >> b >> c;
if (c < a) {
cout << c << endl;
} else if (a <= c && c <= b) {
cout << ((b / c) + 1) * c << endl;
} else
cout << c << endl;
}
return 0;
}
| 7 | CPP |
import math
n=int(input())
for i in range(0,n):
x,y,z=map(int,input().split())
# print(x,y,z)
#print(x/z)
if z<x:
print(z)
else:
if y%z==0:
print(y+z)
else:
print((y//z)*z+z)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int q, l, r, d;
cin >> q;
for (int i = 0; i < q; ++i) {
cin >> l >> r >> d;
if (d >= l && d <= r) {
cout << d - (r % d) + r << endl;
} else {
cout << d << endl;
}
}
return 0;
}
| 7 | CPP |
for i in range(int(input())):
l,r,d = map(int,input().split())
if d < l or d > r:
print(d)
else:
print(((r // d) + 1) * d) | 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 |
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
int main() {
int q;
cin >> q;
while (q--) {
long long l, r, d;
cin >> l >> r >> d;
if (d < l) {
cout << d << endl;
} else {
cout << (r / d + 1) * d << endl;
}
}
return 0;
}
| 7 | CPP |
q=int(input())
for i in range(q):
l,r,d=map(int,input().split())
if l%d==0:
a=(l//d)-1
else:
a=l//d
b=(r//d)+1
if a==0:
print(b*d)
else:
print(d)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
bool isVowel(char c) {
if (c != 'a' && c != 'o' && c != 'u' && c != 'e' && c != 'i') {
return false;
} else {
return true;
}
}
bool isConst(char c) {
if (c != 'a' && c != 'o' && c != 'u' && c != 'e' && c != 'i') {
return true;
} else {
return false;
}
}
int main() {
int t;
cin >> t;
while (t--) {
long long a, b, c;
cin >> a >> b >> c;
if (a > c) {
cout << c << "\n";
continue;
}
if (c > b) {
cout << c << "\n";
continue;
}
if (c == 1) {
cout << b + 1 << "\n";
} else {
cout << (c * (b / c)) + c << "\n";
}
}
}
| 7 | CPP |
for i in range(int(input())):
l,r,d = list(map(int,input().split()))
print(d if d < l else (r // d + 1) * d) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
long long a, b, c;
cin >> a >> b >> c;
if (c < a) {
cout << c << "\n";
} else {
cout << (b / c + 1) * c << "\n";
}
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long l, r, x = 1, d;
int q;
cin >> q;
while (q--) {
long long i = l;
cin >> l >> r >> d;
if (l != d && l / d >= 1)
cout << d << endl;
else
cout << (r / d + 1) * d << endl;
}
return 0;
}
| 7 | CPP |
import math
t=int(input())
for i in range(t):
l,r,d = map(int, input().strip().split(' '))
k=d
while(True):
if k%d==0 and (k<l or k>r):
print(k)
break
else:
j=r-(k)
m=math.ceil(j/d)
k=(m+1)*d
if k==r:
print(k+d)
break
| 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 (d < l) {
cout << d << endl;
} else {
cout << (r / d + 1) * d << endl;
}
}
return 0;
}
| 7 | CPP |
r=[]
for _ in range(int(input())):
a,b,c=list(map(int,input().split()))
if c>=a:
r.append(b+c-(b)%c)
else:
r.append(c)
for i in r:
print(i)
| 7 | PYTHON3 |
for i in range(int(input())):
l,r,d=map(int,input().split())
if d<l:print(d)
else:print((r//d+1)*d) | 7 | PYTHON3 |
a=int(input())
res=0
j=[]
for i in range(0,a):
x,y,z=list(map(int,input().split()))
if z<x or z>y:
res=z
else:
res=(((y//z)+1)*z)
j.append(res)
print(*j,sep="\n") | 7 | PYTHON3 |
for i in [0] * int(input()):
l, r, d = map(int, input().split())
print(d if l > d else (r // d + 1) * d)
| 7 | PYTHON3 |
for i in range(int(input())):
l, r, d = map(int, input().split())
if l <= d <= r:
print((r // d + 1)*d)
else:
print(d)
| 7 | PYTHON3 |
# import sys
# sys.stdin = open("test.in","r")
# sys.stdout = open("test.out.py","w")
for _ in range(int(input())):
l,r,d=map(int,input().split())
if d<l:
print(d)
else:
x=r//d
print((x+1)*d) | 7 | PYTHON3 |
n = int(input())
for i in range(n):
l, r, d = map(int, input().split())
if r < 0:
print(d)
continue
elif l > d:
print(d)
continue
else:
if r % d == 0:
print(r + d)
continue
else:
print(r // d * d + d)
continue
| 7 | PYTHON3 |
T = int(input())
for cas in range(T):
l, r, d = map(int, input().split())
if l > d:
print(d)
else:
print(r // d * d + d)
| 7 | PYTHON3 |
"""
Author: Ove Bepari
_nnnn_
dGGGGMMb ,''''''''''''''''''''''.
@p~qp~~qMb | Promoting GNU/Linux |
M|@||@) M| _;......................'
@,----.JM| -'
JS^\__/ qKL
dZP qKRb
dZP qKKb
fZP SMMb
HZM MMMM
FqM MMMM
__| ". |\dS"qML
| `. | `' \Zq
_) \.___.,| .'
\____ )MMMMMM| .'
`-' `--' hjm
"""
for _ in range(int(input())):
l, r, d = map(int, input().split())
print((((r//d)+1)*d,d)[d<l])
| 7 | PYTHON3 |
t = int(input())
for i in range(t):
l,r,d = list(map(int, input().split()))
if d<l:
print(d)
elif d>r:
print(d)
else:
print(((r)//d+1)*d)
| 7 | PYTHON3 |
def number_list(): return list(map(int, input().split()))
def arr2d(rows, cols, v=0): return [
[v for i in range(cols)] for _ in range(rows)]
t = int(input())
for tt in range(t):
l, r, d = number_list()
ans = 0
if d < l or d > r:
ans = d
else:
res = max(r, d) % min(r, d)
# print("res = " + str(res))
if res == 0:
ans = d + r
else:
ans = r + ( d - r % d )
print(ans)
| 7 | PYTHON3 |
from sys import stdin, stdout
q=int(stdin.readline())
for i in range(q):
[l,r,d]=[int(x) for x in stdin.readline().split()]
cof=d
while True:
if (d>0 and d<l) or (d>r):
stdout.write(str(d)+'\n')
break
else:
stdout.write(str(d*((r//d)+1))+'\n')
break
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int n, li, ri, di;
int main() {
while (cin >> n) {
while (n--) {
scanf("%d %d %d", &li, &ri, &di);
int x = (li - 1) / di;
if (x > 0) {
cout << di << endl;
} else {
x = ceil((double)(ri + 1) / di);
cout << 1LL * di * x << endl;
}
}
}
return 0;
}
| 7 | CPP |
n = int(input())
for i in range(n):
a = list(map(int, input().split()))
count = 1
if a[2] < a[0] or a[2] > a[1]:
print( a[2])
else:
print( (int(a[1]/a[2]) + 1) *a[2]) | 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) {
int a = d - r % d;
cout << r + a << endl;
} else {
cout << d << endl;
}
}
}
| 7 | CPP |
def doit(d):
if(d<l):
return d
else:
if(r%d==0):
return r+d
else:
return r+d-r%d
q=int(input())
for t in range(q):
[l,r,d]=[int(i) for i in input().split()]
print(doit(d)) | 7 | PYTHON3 |
t=int(input())
for _ in range(t):
l,r,d=map(int,input().split())
if(l>d):
print(d)
else:
print(((r//d)+1)*d) | 7 | PYTHON3 |
x=int(input())
l=[]
for i in range(x):
l.append(list(map(int,input().split())))
for i in l:
if (i[0]-1)/i[2]>=1:
print(i[2])
elif (i[1]+1)/i[2]<=1:
print(i[2])
else:
print((i[1]//i[2]+1)*i[2])
| 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int l, r, d, x;
int i, n;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("\n%d %d %d", &l, &r, &d);
if (d < l)
printf("%d\n", d);
else {
x = r + 1;
if (x % d == 0)
printf("%d\n", x);
else
printf("%d\n", ((r / d) + 1) * d);
}
}
}
| 7 | CPP |
from math import ceil
q = int(input())
for i in range(q):
l, r, d = list(map(int, input().split()))
x = d
y = (r // d +1)* d
s = min(x,y)
if s >= l:
print(max(x,y))
else:
print(s) | 7 | PYTHON3 |