solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
#include <bits/stdc++.h> using namespace std; int main() { int num, l, r, d, x; x = 0; cin >> num; for (int i = 0; i < num; i++) { cin >> l >> r >> d; x = d; while (true) { if (x <= r && x >= l) { x = ceil((double)r / d) * d; if (x == r) x += d; break; } else ...
7
CPP
for t in range(int(input())): l,r,d=map(int,input().split()) if d<l: print(d) else: print(((r//d)+1)*d)
7
PYTHON3
import sys input = sys.stdin.readline q = int(input()) for _ 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 as mt import sys, string from collections import Counter, defaultdict input = sys.stdin.readline # input functions I = lambda : int(input()) M = lambda : map(int, input().split()) ARR = lambda: list(map(int, input().split())) def printARR(arr): for e in arr: print(e, end=" ") print() def ...
7
PYTHON3
t=int(input()) for i in range(t): s=list(map(int,input().split(" "))) l=s[0] r=s[1] d=s[2] if(d<l): print(d) else: k=(r+1)//d rm=(r+1)%d #print(k) if(rm==0): print(r+1) else: print((k+1)*d)
7
PYTHON3
t=int(input()) for i in range(t): a,b,c=map(int,input().split()) if c<a or c>b: print(c) else: d=b//c print(c*(d+1))
7
PYTHON3
def read(): return int(input()) def reads(): return [int(x) for x in input().split()] N=int(input()) table=[] for i in range(N): l,r,d=reads() table.append((l,r,d)) for l,r,d in table: if d<l: print(d) else: print((r//d + 1)*d)
7
PYTHON3
for i in range(int(input())): l, r, d = [int(x) for x in input().split()] print(d if d < l else r - (r % d) + d)
7
PYTHON3
for i in range(int(input())) : l,r,d = map(int,input().split()) if l > d: print(d) else : j=r-r%d+d print(j)
7
PYTHON3
q = int(input()) for k in range(q): l, r, d = map(int, input().split()) if d < l: print(d) else: print(r + d - r%d)
7
PYTHON3
q = int(input()) result = [] for _ in range(q): l, r, d = map(int, input().strip().split()) # between l and r if d < l or d > r: result.append(d) continue m = r // d res = d * (m + 1) result.append(res) for i in result: print(i)
7
PYTHON3
#include <bits/stdc++.h> int q, l, r, d; int main() { scanf("%d", &q); while (q--) { scanf("%d%d%d", &l, &r, &d); if (l > d) printf("%d\n", d); else printf("%d\n", r / d * d + d); } }
7
CPP
def mi(): return map(int, input().split()) ''' 5 2 4 2 5 10 4 3 10 1 1 2 3 4 6 5 ''' for _ in range(int(input())): l,r,d = mi() nl=d nr=r-r%d nr+=d if nl<l: print (nl) else: print (nr)
7
PYTHON3
q=int(input()) for _ in range(0,q): l,r,n=map(int,input().split()) if(n<l): div=l//n rem=l%n; if(rem==0): ans=l-n*(div-1) else: ans=l-rem rem=ans%n div=ans//n l=ans if(rem==0): ans=l-n*(div-1...
7
PYTHON3
n=int(input()) for i in range(n): l,r,d=map(int, input().split()) if (l//d)>=2 or ((l//d)==1 and (l%d)!=0): print(d) else: print((r//d+1)*d)
7
PYTHON3
#include <bits/stdc++.h> int main() { int a1, b, c, d, n, k = 4; std::cin >> n; int a[n]; int i, i1, j; for (i = 1; i <= n; i++) { std::cin >> a1 >> b >> c; if (a1 > c) { std::cout << c << '\n'; } else { std::cout << c * (b / c + 1) << '\n'; } } }
7
CPP
import sys import math def read_int(): return int(input().strip()) def read_int_list(): return list(map(int,input().strip().split())) def read_string(): return input().strip() def read_string_list(delim=" "): return input().strip().split(delim) ###### Author : Samir Vyas ####### ###### Write Code Below ####...
7
PYTHON3
# Lets goto the next level # AIM Specialist at CF *__* asap # template taken from chaudhary_19 # Remember you were also a novice when you started, # hence never be rude to anyone who wants to learn something # Never open a ranklist untill and unless you are done with solving problems, wastes 3/4 minuts # Donot tr...
7
PYTHON3
q = int(input()) s = 0 for i in range(0,q): e = list(map(int,input().split())) s = e[2] if (s>=e[0]) and (s<=e[1]): print(s + e[1] - e[1] % s) else: print(s)
7
PYTHON3
import math q = int(input()) for i in range(q): l, r, d = map(int, input().split()) if d < l or d > r: print(d) elif (r+1) % d == 0: print(r+1) else: print(r+1 - ((r+1) % d) + d)
7
PYTHON3
n = int(input()) for _ in range(n): a = list(map(int,input().split())) l = a[0] r = a[1] d = a[2] if l<=d and d<=r: print((r//d+1)*d) else: print(d)
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 - r % d + d)
7
PYTHON3
n = int(input()) for i in range(n) : a,b,c = map(int,input().split()) if(a / c > 1) : print(c) else : print(((b//c)+1) *c )
7
PYTHON3
for _ in[0]*int(input()):p,q,r=map(int,input().split());print((r>=p)*q//r*r+r)
7
PYTHON3
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
q = int(input()) for i in range(q): firstlastnum = list(map(int, input().split())) first = firstlastnum[0] last = firstlastnum[1] num = firstlastnum[2] div2 = last // num if num < first: print(num) else: print(div2*num + num)
7
PYTHON3
n = int(input()) a = [] for i in range(n): l, r, d = map(int, input().split()) a.append([l, r, d]) for i in a: l, r, d = list(i) if d < l: print(d) else: c = r // d print((c + 1) * d)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int solve(int l, int r, int d) { if (d >= l) { return (r / d + 1) * d; } else { return d; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int q; cin >> q; for (int i = 0; i < q; i++) { int l, r, d; cin >> l >> r >> d...
7
CPP
n = int(input()) for i in range(n): a, b, c = [int(i) for i in input().split()] if a<=c <=b: print((b//c+1)*c) else: print(c)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; using ll = long long; template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { for (T e : v) { os << e << ' '; } return os; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int q; cin >> q; while (q--) { ...
7
CPP
# @author Nayara Souza # UFCG - Universidade Federal de Campina Grande # AA - Basico q = int(input()) for i in range(q): x = list(map(int,input().split())) if x[2] < x[0]: print(x[2]) else: y = (x[1] // x[2]) + 1 print(y*x[2])
7
PYTHON3
q = int(input()) for x 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
ansarr=[] q=int(input()) for l in range(q): l,r,d=map(int,input().split()) if(l>d): ansarr.append(d) else: if(r%d==0): ansarr.append(r+d) else: val=r//d ansarr.append((val+1)*d) print(*ansarr)
7
PYTHON3
for _ in range(int(input())): l,r,d=map(int,input().split()) if(d<l): print(d) continue else: x=(r+1)%d if(x==0): d=0 print(r+1+(d-x))
7
PYTHON3
from math import ceil def slve(l,r,d): if (l-1)//d>=1:return d return ceil((r+1)/d)*d for _ in range(int(input())): l,r,d=map(int,input().split());print(slve(l,r,d))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, x, l, r, d, i, f = 0, j; cin >> x; int* Arr = (int*)malloc(3 * x * sizeof(int)); int z; for (z = 0; z < 3 * x; z++) { cin >> Arr[z]; } int mod; for (i = 0; i < x; i++) { l = Arr[i * 3]; r = Arr[3 * i + 1]; d = Arr[3 * i + ...
7
CPP
from sys import stdin n=int(stdin.readline().strip()) for i in range(n): s=list(map(int,stdin.readline().strip().split())) if s[0]>s[2]: print(s[2]) continue x=s[1]//s[2] x+=1 print(x*s[2])
7
PYTHON3
#include <bits/stdc++.h> using namespace std; long long q, a, b, d; int main() { cin >> q; while (q--) { cin >> a >> b >> d; if (d < a) cout << d << endl; else cout << ((b / d) + 1) * d << endl; } }
7
CPP
import sys tc = int(sys.stdin.readline()) for _ in range(tc): l, r, d = map(int, sys.stdin.readline().split()) left = (l // d) * d if l % d == 0 else ((l // d) + 1) * d right = (r // d) * d if d < l or d > r: print(d) else: temp = [] if l <= left <= r and left - d > 0: ...
7
PYTHON3
#include <bits/stdc++.h> const double pi = 4.0 * atan(1.0); const double e = exp(1.0); using namespace std; const int N = 3e6 + 5; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; while (n--) { long long a, b, c; cin >> a >> b >> c; if (a > c) { cou...
7
CPP
# =================================== # (c) MidAndFeed aka ASilentVoice # =================================== # import math # import collections # import string # =================================== n = int(input()) for _ in range(n): l, r, d = [int(x) for x in input().split()] ans = d if l <= ans <= r: ...
7
PYTHON3
n = int(input()) for i in range(0,n): a = list(map(int,input().split())) if(a[0] == a[2] or a[0] == 1): num = a[1] +1 if(a[1] == a[2] and a[0] == a[1]): print(2*a[1]) elif(a[1] == 1): print(a[2]) elif(a[2] % a[1] == 0): print(a[1]+a[2]) ...
7
PYTHON3
n = int(input()) for i in range(n): l, r, d = map(int, input().split()) if(d < l or d > r): print(d) else: print((r // d) * d + d)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); long long int t; cin >> t; while (t--) { long long int l, r, d, i, x, y, z; cin >> l >> r >> d; if (l > d) { cout << d << endl; } else if (r % d == d) { cout << d << endl; }...
7
CPP
for t in range(int(input())): l, r, d = map(int,input().split()) if d < l: print(d) else: print(r+d-r%d)
7
PYTHON3
# cook your dish here n=int(input()) for h in range(0,n): a,b,c=map(int,input().split(" ")) if a<=c and c<=b: u=(b-(b%c))+c print(u) else: print(c)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; long long modexpo(long long x, long long p) { long long res = 1; x = x % 1000000007; while (p) { if (p % 2) res = res * x; p >>= 1; x = x * x % 1000000007; res %= 1000000007; } return res; } long long max(long long a, long long b) { return (a > b ?...
7
CPP
for _ in range(int(input())): l, r, d = map(int, input().split()) print(d if d < l else r + d - r % d)
7
PYTHON3
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: print(d*((r//d)+1))
7
PYTHON3
num = int(input()) queries = [] for i in range(0, num): queries.append(list(map(int, input().split(' ')))) for i in range(0, num): d = queries[i][2] l = queries[i][0] r = queries[i][1] n = d while(True): if n % d == 0: if n < l or n > r: print(n) ...
7
PYTHON3
for _ in range(int(input())): l,r,d=list(map(int,input().strip().split())) x=d if d<l: print(x) continue print(((r//d)+1)*d)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long INF = 1e18; const long long MAXN = 25; long long l, r, d, n; long long myceil(long long x, long long y) { if ((x % y) == 0) { return x / y + 1; } else { return x / y + 1; } } int main() { { scanf("%lld", &n)...
7
CPP
q = int(input()) for i in range(q): l, r, d = map(int, input().split()) rd = r//d if d<l: print(d) else: print((rd+1)*d)
7
PYTHON3
q = int(input()) for i in range(0, q): s = input() left = int(s.split(" ")[0]) right = int(s.split(" ")[1]) d = int(s.split(" ")[2]) div = 1 if d * div in range(left, right + 1): div = int(right / d) + 1 print(d * div)
7
PYTHON3
q = int(input()) for _ in range(q): l, r, d = map(int, input().split()) if (d<l or d>r): print(d) else: Q = r//d R = r%d print(d*(Q+1))
7
PYTHON3
for i in range(int(input())): l,r,d = map(int,input().split()) if l<=d: print((d-(r%d))+r) else: print(d)
7
PYTHON3
def ii(): return int(input()) def mi(): return map(int, input().split()) def li(): return list(mi()) for _ in range(ii()): l, r, d = mi() ans = d if l <= d <= r: ans = d * (r // d + 1) print(ans)
7
PYTHON3
q = int(input()) ans = [] for i in range(q): l, r, d = map(int, input().split()) if d < l or d > r: ans.append(d) else: ans.append(r - r % d + d) for i in ans: print(i)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int a[1000100]; int c[1000010]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { int l, r, d; scanf("%d%d%d", &l, &r, &d); if (d < l) { printf("%d\n", d); } else { long long x2 = r / d; while (x2 * d <= r) { ...
7
CPP
""" β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•β•β• __ __ _ ...
7
PYTHON3
I=lambda:map(int,input().split()) for i in range(int(input())): l,r,d=I() if d<l or d>r : print(d) else: print((r//d)*d+d)
7
PYTHON3
import sys import math from collections import defaultdict,deque input = sys.stdin.readline def inar(): return [int(el) for el in input().split()] def main(): t=int(input()) for _ in range(t): l,r,d=inar() if l <= d <= r: print(d*(r//d+1)) else: print(d) if...
7
PYTHON3
q=int(input()) while(q>0): l,r,d=map(int ,input().split()) i=0 if (d<l): print(d) elif(d>r):print(d) else:print(d*((r//d)+1)) q-=1
7
PYTHON3
import time #input n = int(input("")) l = [] r = [] d = [] for i in range(n): a,b,c = input("").split() l.append(int(a)) r.append(int(b)) d.append(int(c)) #process #output for i in range(n): if(l[i]/d[i]>1): print(d[i]) else: print((r[i]//d[i]+1)*d[i])
7
PYTHON3
import math n = int(input()) for _ in range(n): a,b,c = input().split() c = int(c) x = int(a)/c y = int(b)/c x = math.ceil(x-1) y = math.floor(y+1) if(x*c <= 0): print(y*c) else: if(x>=1): print(1*c)
7
PYTHON3
q = int(input()) for i in range(q): l, r, d = map(int, input().split()) if l / d <= 1: n = 0 else: n = 1 m = r // d + 1 if n == 0: x = d * m else: x = d * n print(x)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { long long int q, i, j, ans, l, r, d; cin >> q; while (q--) { cin >> l >> r >> d; if (d < l || d > r) cout << d << endl; else { ans = 1 + r / d; cout << ans * d << endl; } } return 0; }
7
CPP
from sys import stdin, stdout from math import * from heapq import * from collections import * def main(): q=int(stdin.readline()) for _ in range(q): l,r,d=[int(x) for x in stdin.readline().split()] res=0 if (d<l): res=d else: res=(trunc(r/d)+1)*d ...
7
PYTHON3
def main(): q = int(input()) ans = [] for i in range(q): inp = input().split() li = int(inp[0]) r = int(inp[1]) d = int(inp[2]) ii = 1 global s s = True if d < li: ans.append(d) elif d > r: ans.append(d) ...
7
PYTHON3
t=int(input()) for i in range(t): l,r,d=list(map(int,input().strip().split())) if l>d: print(d) else: print(d*(r//d+1))
7
PYTHON3
q = int(input()) res = '' for _ in range(q): mult = 1 l,r,d = [int(i) for i in input().split()] if d < l: new = d res += str(new) + '\n' else: res += str(d * (r//d + 1)) + '\n' print(res)
7
PYTHON3
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 19 15:46:43 2019 @author: umang """ t = int(input()) while t > 0: t -= 1 l, r, d = map(int, input().split()) i = 1 low = l // d high = r // d if low == 0 or low*d == l == 1*d: print((high+1)*d) else: pri...
7
PYTHON3
n=int(input()) for i in range(n): l=[int(i) for i in input().split()] if (l[2]<l[0])or(l[2]>l[1]): print(l[2]) else : print((int((l[1])//(l[2]))+1)*l[2])
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q--) { long long int l, r, d; cin >> l >> r >> d; if (l > d) cout << d << "\n"; else if (r % d == 0) cout << d + r << "\n"; else cout << (r / d) * d + d << "\n"; } }
7
CPP
import math n = int(input()) for i in range(n): l, r, d = map(int,input().split()) if d<l: print(d) else: b = math.ceil(r/d) if r % d == 0: b += 1 print(int(b*d))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; void fastIO() { ios_base::sync_with_stdio(false); cin.tie(NULL); } void solve() { long long int l, r, d; cin >> l >> r >> d; if (d < l) { cout << d << "\n"; return; } else { long long int rem = r % d; rem = d - rem; cout << r + rem << "\n"; ...
7
CPP
from math import * #s=['toc','c++','c','cse',"lol",'c','c++'] #s.append("hi") #s.insert(2,"ki") #s.remove("toc") #s.sort() #s.reverse() #s.pop() #s2=s.copy() #k=s.index('c') #k=s.count('cse') #k=list(range(1,n)) #print(n[2]) #print(s2) n=int(input()) p=0 while p<n: a,b,c=input().split() a=int(a) b=int(b) c=int(c) ...
7
PYTHON3
q = int(input()) M = [list(map(int, input().split())) for i in range(q)] S =[] #x = 1 l = len(S) for i in range(q): x = 1 while True: if x < M[i][0] or x > M[i][1]: if x % M[i][2] == 0: S.append(x) break else: if x < M[i][2]: ...
7
PYTHON3
n = int(input()) l = [[int(i) for i in input().split()] for i in range(n)] for i in range(n): if l[i][2] < l[i][0]: print(l[i][2]) else: print(l[i][1]//l[i][2]*l[i][2] + l[i][2])
7
PYTHON3
q = int(input()) for i in range(q): a = 0 l,r,d=map(int, input().split()) while True: a += d if d < l: a = d break if l <= a <= r: a = (r // d + 1) * d if a % d == 0: break print(a)
7
PYTHON3
q = int(input()) for i in range(q): l,r,d = map(int,input().split()) if l > d: print(d) else: print(((r//d)+1)*d)
7
PYTHON3
import math q=int(input()) l=[None]*q r=[None]*q d=[None]*q for x in range(q): l[x],r[x],d[x]=[int(y) for y in input().split()] for x in range(q): if d[x]<l[x]: print(d[x]) else: res=int(r[x]/d[x]) +1 print(res*d[x])
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; long long q = r / d; long long ans = d * (q + 1); if (d * 1 < l) { ans = d; } cout << ans << endl; } return 0; }
7
CPP
def readInput(): Q = int(input()) lista = list() for i in range(Q): l, r, d = map(int, input().split()) lista.append([l, r, d]) return Q, lista def solve(l, r, d): upValue = r // d + 1 downValue = (l + d - 1) // d - 1 if (downValue <= 0): return upValue * d else: return d def solveProblem(): Q, qu...
7
PYTHON3
import math import os import random import re import sys from collections import Counter a=[] l=[] n=int(input()) for i in range(n): l+=[list(map(int,input().split()))] for i in range(n): if l[i][2]<=l[i][1] and l[i][2]>=l[i][0]: print(l[i][2]*((l[i][1]//l[i][2])+1)) else: print(l[i][2])
7
PYTHON3
def ii(): return int(input()) def mi(): return map(int,input().split()) def li(): return list(mi()) for _ in range(ii()): a,b,d=mi() if (d>b or d<a): print(d) else: print((b//d+1)*d)
7
PYTHON3
def answer(l, r, d): if d < l: out = d else: amari = d - (r % d) out = r + amari return out q = int(input()) for i in range(q): l, r, d = list(map(int, input().split(" "))) print(answer(l, r, d))
7
PYTHON3
def min_int(inp): l = int(inp[0]) r = int(inp[1]) d = int(inp[2]) out = -1 i = 1 while out == -1 : mult = i * d if mult not in range(l,r+1): out = mult break if mult in range(l,r+1): mult = r i = mult // d i = i+1 return out #flow of the program q = int(input()) for i in range(0, q): inp...
7
PYTHON3
from math import floor q = int(input()) while q!=0: q-=1 a,b,c = map(int,input().split()) if c<a: print(c) else: print(c*floor(b/c)+c)
7
PYTHON3
def task(): p=input().split() l=int(p[0]) u=int(p[1]) d=int(p[2]) if(d<l or d>u): print(d) else: print (d*(1+u//d)) t=int(input()) i=0 while i<t: task() i+=1
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { long long l, r, d, q; cin >> q; for (long long i = 0; i < q; i++) { cin >> l >> r >> d; if (l > d) cout << d << "\n"; else cout << (r / d + 1) * d << "\n"; } }
7
CPP
T = int(input()) for _ in range(T): l, r, d = (int(i) for i in input().split()) if d < l: print(d) else: print(d*((r//d)+1))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; for (int i = 0; i < q; i++) { int d, l, r; cin >> l; cin >> r; cin >> d; bool a = false; bool b = false; if (int(ceil(float(l) / float(d))) == l / d) a = true; if (int(ceil(float(r) / float(d))) == r / d) b...
7
CPP
t = int(input()) for i in range(t): a, b, c = map(int, input().split()) if(c < a): print(c) elif c > b: print(c) else: print(c + ((b - c) // c + 1) * c)
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
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; const int N = 200005; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int q; cin >> q; for (int i = 0; i < q; i++) { int l, r, d; cin >> l >> r >> d; if (d < l) cout << d << "\n"; el...
7
CPP
#coding: UTF-8 def verificar(l,r,d): x = d n = int(r/d) while( (l<= x <=r) == True): n += 1 x = d * n return (x) n = int(input()) valores = [] while(n != 0): entrada = input() valores.append(entrada) n = n-1 for i in valores: ...
7
PYTHON3
q=int(input()) for _ in range(q): l,r,d=map(int,input().split()) if l>d: print(d) else: print(d*(r//d+1))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long MAXN = 1e5 + 3; const long long inf = 2e9; long long max(long long a, long long b) { if (a > b) return a; else return b; } long long min(long long a, long long b) { if (a < b) return a; else return b; } ...
7
CPP
q = int(input()) for i in range(q): l,r,d = map(int,input().split()) if (l > d or d > r): print(d) else: print((r//d)*d+d)
7
PYTHON3