message
stringlengths
2
59.7k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
37
108k
cluster
float64
20
20
__index_level_0__
int64
74
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A number is called 2050-number if it is 2050, 20500, ..., (2050 ⋅ 10^k for integer k ≥ 0). Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numb...
instruction
0
73,585
20
147,170
Yes
output
1
73,585
20
147,171
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A number is called 2050-number if it is 2050, 20500, ..., (2050 ⋅ 10^k for integer k ≥ 0). Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numb...
instruction
0
73,586
20
147,172
Yes
output
1
73,586
20
147,173
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A number is called 2050-number if it is 2050, 20500, ..., (2050 ⋅ 10^k for integer k ≥ 0). Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numb...
instruction
0
73,589
20
147,178
No
output
1
73,589
20
147,179
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A number is called 2050-number if it is 2050, 20500, ..., (2050 ⋅ 10^k for integer k ≥ 0). Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numb...
instruction
0
73,590
20
147,180
No
output
1
73,590
20
147,181
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A number is called 2050-number if it is 2050, 20500, ..., (2050 ⋅ 10^k for integer k ≥ 0). Given a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numb...
instruction
0
73,591
20
147,182
No
output
1
73,591
20
147,183
Provide tags and a correct Python 3 solution for this coding contest problem. Input The only line of input contains three integers a1, a2, a3 (1 ≤ a1, a2, a3 ≤ 20), separated by spaces. Output Output a single integer. Examples Input 2 3 2 Output 5 Input 13 14 1 Output 14 Input 14 5 9 Output 464 ...
instruction
0
73,597
20
147,194
Tags: *special Correct Solution: ``` #!/usr/bin/env python from __future__ import division, print_function import math import os import sys from fractions import * from sys import * from io import BytesIO, IOBase from itertools import * from collections import * # sys.setrecursionlimit(10**5) if sys.version_info[0] ...
output
1
73,597
20
147,195
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum. For example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 and 4 are 20, 21 and 22 r...
instruction
0
73,742
20
147,484
Tags: math Correct Solution: ``` def imprime(n): b = format(n, 'b') m = len(b) #última potência de 2 cheia #soma PA1 - somaPG1 - somaPG2 print(int((1+n)*n//2 - (2**m - 1)*2)) t = int(input()) n = [0]*t for i in range(t): n[i] = int(input()) for i in range(t): imprime(n[i]) ```
output
1
73,742
20
147,485
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum. For example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 and 4 are 20, 21 and 22 r...
instruction
0
73,743
20
147,486
Tags: math Correct Solution: ``` n = int(input()) result = '' for i in range(n): t = int(input()) s = (t + 1) * t // 2 cur2 = 1 #curstepen2 = 1 while cur2<=t: s -= cur2 * 2 cur2*=2 result+=str(s)+'\n' print(result) ```
output
1
73,743
20
147,487
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum. For example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 and 4 are 20, 21 and 22 r...
instruction
0
73,745
20
147,490
Tags: math Correct Solution: ``` n = int(input()) for i in range(n): t = int(input()) bint = str(bin(t))[2:] pows = len(bint) - 1 print((1 + t) * t // 2 - (-1 + 2 ** (pows + 1)) * 2) ```
output
1
73,745
20
147,491
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum. For example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 and 4 are 20, 21 and 22 r...
instruction
0
73,747
20
147,494
Tags: math Correct Solution: ``` import math t = int(input()) for _ in range(t): num=int(input()) gpn=math.floor((math.log(num)/math.log(2))+1) #print(num,gpn) nsum=(num*(num+1))//2 gpsum=(pow(2,gpn)-1) print(int(nsum-2*(gpsum))) #print(nsum,gpsum) ```
output
1
73,747
20
147,495
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum. For example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 and 4 are 20, 21 and 22 r...
instruction
0
73,748
20
147,496
Tags: math Correct Solution: ``` t = int(input()) while t: f = int(input()) n = 1 t_total = 0 n_total = (((1 + f)*(f))//2) while n < f+1: t_total += n n = n * 2 t_total = t_total print(n_total - 2* t_total ) t-=1 ```
output
1
73,748
20
147,497
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum. For example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 and 4 are 20, 21 and 22 r...
instruction
0
73,749
20
147,498
Tags: math Correct Solution: ``` p=int(input()) for q in range(p): n=int(input()) sum=n*(n+1)//2 b=bin(n)[2:] l=len(b) t=0 for i in range(l): t+=int(('1'+"0"*i),2) print(sum-2*t) ```
output
1
73,749
20
147,499
Provide tags and a correct Python 3 solution for this coding contest problem. The marmots have prepared a very easy problem for this year's HC2 – this one. It involves numbers n, k and a sequence of n positive integers a1, a2, ..., an. They also came up with a beautiful and riveting story for the problem statement. It...
instruction
0
73,829
20
147,658
Tags: greedy, sortings Correct Solution: ``` a = input() n, k = map(int, a.split()) b = input() numbers = list(map(int, b.split())) print(sum(sorted(numbers)[0:k])) ```
output
1
73,829
20
147,659
Provide tags and a correct Python 3 solution for this coding contest problem. The marmots have prepared a very easy problem for this year's HC2 – this one. It involves numbers n, k and a sequence of n positive integers a1, a2, ..., an. They also came up with a beautiful and riveting story for the problem statement. It...
instruction
0
73,831
20
147,662
Tags: greedy, sortings Correct Solution: ``` f = lambda: map(int, input().split()) n, k = f() print(sum(sorted(f())[:k])) ```
output
1
73,831
20
147,663
Provide tags and a correct Python 3 solution for this coding contest problem. The marmots have prepared a very easy problem for this year's HC2 – this one. It involves numbers n, k and a sequence of n positive integers a1, a2, ..., an. They also came up with a beautiful and riveting story for the problem statement. It...
instruction
0
73,832
20
147,664
Tags: greedy, sortings Correct Solution: ``` n,k=map(int,input().split()) print(sum(sorted(list(map(int,input().split())))[:k])) ```
output
1
73,832
20
147,665
Provide tags and a correct Python 3 solution for this coding contest problem. The marmots have prepared a very easy problem for this year's HC2 – this one. It involves numbers n, k and a sequence of n positive integers a1, a2, ..., an. They also came up with a beautiful and riveting story for the problem statement. It...
instruction
0
73,833
20
147,666
Tags: greedy, sortings Correct Solution: ``` n, k = map(int, input().split()) a = sorted(list(map(int, input().split()))) print (sum(a[:k])) ```
output
1
73,833
20
147,667
Provide tags and a correct Python 3 solution for this coding contest problem. The marmots have prepared a very easy problem for this year's HC2 – this one. It involves numbers n, k and a sequence of n positive integers a1, a2, ..., an. They also came up with a beautiful and riveting story for the problem statement. It...
instruction
0
73,835
20
147,670
Tags: greedy, sortings Correct Solution: ``` n, k = [int(i) for i in input().split()] a = [int(i) for i in input().split()] a.sort() s = 0 for i in range(k): s += a[i] print(s) ```
output
1
73,835
20
147,671
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Lucky number is super l...
instruction
0
73,912
20
147,824
Tags: binary search, bitmasks, brute force Correct Solution: ``` lucky=[] def func(number,fours,sevens): if(number>1e10): return elif(fours==sevens): lucky.append(number) func(10*number+7,fours,sevens+1) func(10*number+4,fours+1,sevens) func(4,1,0) func(7,0,1) n=int(input()) lucky.sort(...
output
1
73,912
20
147,825
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Lucky number is super l...
instruction
0
73,913
20
147,826
Tags: binary search, bitmasks, brute force Correct Solution: ``` n = int(input()) Q = [0] i = 0 while True: t = Q[i] if t>=n: if str(t).count('4') == str(t).count('7'): print(t) break Q+=[t*10+4,t*10+7] i+=1 ```
output
1
73,913
20
147,827
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Lucky number is super l...
instruction
0
73,914
20
147,828
Tags: binary search, bitmasks, brute force Correct Solution: ``` from itertools import permutations def solve(x): for d in range(1, 6): for p in permutations([4]*d + [7]*d): y = 0 for e in p: y = 10 * y + e if y >= x: return y print(sol...
output
1
73,914
20
147,829
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Lucky number is super l...
instruction
0
73,915
20
147,830
Tags: binary search, bitmasks, brute force Correct Solution: ``` n=int(input()) l=[] def lucky(x): if x>=n and str(x).count('4')==str(x).count('7'): l.append(x) if x<10**12: lucky(x*10+4) lucky(x*10+7) lucky(0) l.sort() print(l[0]) ```
output
1
73,915
20
147,831
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Lucky number is super l...
instruction
0
73,916
20
147,832
Tags: binary search, bitmasks, brute force Correct Solution: ``` import math, re, sys, string, operator, functools, fractions, collections sys.setrecursionlimit(10**7) RI=lambda x=' ': list(map(int,input().split(x))) RS=lambda x=' ': input().rstrip().split(x) dX= [-1, 1, 0, 0,-1, 1,-1, 1] dY= [ 0, 0,-1, 1, 1,-1,-1, 1] ...
output
1
73,916
20
147,833
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Lucky number is super l...
instruction
0
73,917
20
147,834
Tags: binary search, bitmasks, brute force Correct Solution: ``` n=int(input()) l=[0] i=0 while True: t=l[i] if t>=n: if str(t).count('7')==str(t).count('4'): print(t);break l+=[t*10+4,t*10+7] i+=1 ```
output
1
73,917
20
147,835
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Lucky number is super l...
instruction
0
73,918
20
147,836
Tags: binary search, bitmasks, brute force Correct Solution: ``` def check(m): if (m>=n) and str(m).count('4') == str(m).count('7'): a.append(m) if (m<10**12): check(m*10+4) check(m*10+7) n = int(input()) a=[] check(0) a.sort() print(a[0]) ```
output
1
73,918
20
147,837
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Lucky number is super l...
instruction
0
73,919
20
147,838
Tags: binary search, bitmasks, brute force Correct Solution: ``` z=[] for i in range(1,11): for j in range(1<<i): s=bin(j) s=s[2:] if s.count("1")==s.count("0"):z+=[int(s.replace("1","4").replace("0","7"))]+[int(s.replace("1","7").replace("0","4"))] z.sort() a=int(input()) for i in z: if...
output
1
73,919
20
147,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky a...
instruction
0
73,920
20
147,840
Yes
output
1
73,920
20
147,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky a...
instruction
0
73,921
20
147,842
Yes
output
1
73,921
20
147,843
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky a...
instruction
0
73,922
20
147,844
Yes
output
1
73,922
20
147,845
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky a...
instruction
0
73,923
20
147,846
Yes
output
1
73,923
20
147,847
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky a...
instruction
0
73,924
20
147,848
No
output
1
73,924
20
147,849
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky a...
instruction
0
73,925
20
147,850
No
output
1
73,925
20
147,851
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky a...
instruction
0
73,926
20
147,852
No
output
1
73,926
20
147,853
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky a...
instruction
0
73,927
20
147,854
No
output
1
73,927
20
147,855
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Vasya are competing with each other in a new interesting game as they always do. At the beginning of the game Petya has to come up with an array of N positive integers. Sum of all elements in his array should be equal to S. Then P...
instruction
0
74,312
20
148,624
Tags: constructive algorithms, math Correct Solution: ``` # -*- coding: utf-8 -*- """ Created on Mon Aug 24 07:01:34 2020 @author: Dark Soul """ [n,s]=list(map(int, input().split())) if 2*n>s: print('NO') else: print('YES') sol=[1]*(n-1) sol.append(s-n+1) print(*sol) print(n) ```
output
1
74,312
20
148,625
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal. The input size is very large so don't use the reading of symbols one by one. Instead of...
instruction
0
74,572
20
149,144
Tags: implementation, strings Correct Solution: ``` # your code goes here a = (input()) b = (input()) j = 0 for i in range(len(a)): if a[i] == '0': j+=1 else: break a = a[j:] j = 0 for i in range(len(b)): if b[i] == '0': j+=1 else: break b = b[j:] flag = 0 if len(a)> len(b): print (">") elif len(a)<len(b...
output
1
74,572
20
149,145
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal. The input size is very large so don't use the reading of symbols one by one. Instead of...
instruction
0
74,573
20
149,146
Tags: implementation, strings Correct Solution: ``` aa = input() bb = input() cta = 0 ctb = 0 start = False for let in aa: if let == "0": cta += 1 if let != "0": break for let in bb: if let == "0": ctb += 1 if let != "0": break start = False a = aa[cta:] b = bb[ctb:] ...
output
1
74,573
20
149,147
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal. The input size is very large so don't use the reading of symbols one by one. Instead of...
instruction
0
74,574
20
149,148
Tags: implementation, strings Correct Solution: ``` first_integer = input() second_integer = input() len_first = len(first_integer) len_second = len(second_integer) max_len = max(len_first, len_second) if len_first < len_second: first_integer = '0' * (len_second - len_first) + first_integer elif len_first > len_sec...
output
1
74,574
20
149,149
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal. The input size is very large so don't use the reading of symbols one by one. Instead of...
instruction
0
74,575
20
149,150
Tags: implementation, strings Correct Solution: ``` a = input().lstrip('0') b = input().lstrip('0') ans = '=' if len(a) > len(b): ans = '>' elif len(a) < len(b): ans = '<' else: for i in range(len(a)): if int(a[i]) > int(b[i]): ans = '>' break elif int(a[i]) < int(b[i...
output
1
74,575
20
149,151
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal. The input size is very large so don't use the reading of symbols one by one. Instead of...
instruction
0
74,576
20
149,152
Tags: implementation, strings Correct Solution: ``` import sys inst=lambda: sys.stdin.readline().rstrip('\n\r') inin=lambda: int(sys.stdin.buffer.readline()) inar=lambda: list(map(int,sys.stdin.buffer.readline().split())) a=input().lstrip('0') b=input().lstrip('0') if len(a)<len(b): print('<') elif len(a)>len(b): ...
output
1
74,576
20
149,153
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal. The input size is very large so don't use the reading of symbols one by one. Instead of...
instruction
0
74,577
20
149,154
Tags: implementation, strings Correct Solution: ``` from sys import stdin, stdout, exit a = stdin.readline() b = stdin.readline() i1 = len(a) i2 = len(b) for i in range(len(a)): if a[i] != '0': i1 = i break for i in range(len(b)): if b[i] != '0': i2 = i break if len(a) - i1 < len...
output
1
74,577
20
149,155
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal. The input size is very large so don't use the reading of symbols one by one. Instead of...
instruction
0
74,578
20
149,156
Tags: implementation, strings Correct Solution: ``` a=input() b=input() if a.count('0')==len(a) and b.count('0')==len(b): print('=') exit() a=a.lstrip('0') b=b.lstrip('0') if len(a)>len(b): print('>') elif len(b)>len(a): print('<') else: for i in range(len(a)): if int(a[i])>int(b...
output
1
74,578
20
149,157
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal. The input size is very large so don't use the reading of symbols one by one. Instead of...
instruction
0
74,579
20
149,158
Tags: implementation, strings Correct Solution: ``` a = input().lstrip('0') b = input().lstrip('0') if len(a) == len(b): if a == b: print("=") elif a < b: print("<") else: print(">") else: if len(a) < len(b): print("<") else: print(">") ```
output
1
74,579
20
149,159
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem AOR Ika-chan, who loves feasts, defined "the number of feasts". A feast number is a natural number that includes "$ 51-3 $" in $ 10 $ decimal notation. $? $ Can be any number from $ 0 $...
instruction
0
74,918
20
149,836
No
output
1
74,918
20
149,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem AOR Ika-chan, who loves feasts, defined "the number of feasts". A feast number is a natural number that includes "$ 51-3 $" in $ 10 $ decimal notation. $? $ Can be any number from $ 0 $...
instruction
0
74,919
20
149,838
No
output
1
74,919
20
149,839
Provide a correct Python 3 solution for this coding contest problem. Problem Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary. Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $. Example of calculating the function $ f (5) $: W...
instruction
0
74,924
20
149,848
"Correct Solution: ``` from math import * print(floor(log2(1+int(input())))) ```
output
1
74,924
20
149,849
Provide a correct Python 3 solution for this coding contest problem. Problem Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary. Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $. Example of calculating the function $ f (5) $: W...
instruction
0
74,926
20
149,852
"Correct Solution: ``` import math print((int)(math.log2(int(input())+1))) ```
output
1
74,926
20
149,853
Provide tags and a correct Python 3 solution for this coding contest problem. A triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example, three dots can be arranged in a triangle; thus three is a triangular number. The n-th triangular number is the number of dots in a ...
instruction
0
75,419
20
150,838
Tags: brute force, math Correct Solution: ``` # A. Triangular numbers n = int(input()) s = 0 for i in range(1, n+1): s += i if s == n: print('YES') break elif s > n: print('NO') break ```
output
1
75,419
20
150,839
Provide tags and a correct Python 3 solution for this coding contest problem. A triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example, three dots can be arranged in a triangle; thus three is a triangular number. The n-th triangular number is the number of dots in a ...
instruction
0
75,420
20
150,840
Tags: brute force, math Correct Solution: ``` n = int(input()) check = int(-0.5 + ((8*n+1)/4)**0.5) if check * (check+1) // 2 == n: print('YES') else: print('NO') ```
output
1
75,420
20
150,841
Provide tags and a correct Python 3 solution for this coding contest problem. A triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example, three dots can be arranged in a triangle; thus three is a triangular number. The n-th triangular number is the number of dots in a ...
instruction
0
75,421
20
150,842
Tags: brute force, math Correct Solution: ``` n=int(input()) c=0 for i in range(1,n+1): if(n==(i*(i+1))//2): c=1 break if(c): print("YES") else: print("NO") ```
output
1
75,421
20
150,843
Provide tags and a correct Python 3 solution for this coding contest problem. A triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example, three dots can be arranged in a triangle; thus three is a triangular number. The n-th triangular number is the number of dots in a ...
instruction
0
75,422
20
150,844
Tags: brute force, math Correct Solution: ``` x = int(input()) Check = False for i in range (x+1): if (i*(i+1))/2 == x : print("YES") exit() print("NO") ```
output
1
75,422
20
150,845