message
stringlengths
2
67k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
463
109k
cluster
float64
19
19
__index_level_0__
int64
926
217k
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of them. Each word consists of 2·n binary characte...
instruction
0
95,592
19
191,184
Tags: games, greedy Correct Solution: ``` import io, os # input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline ii=lambda:int(input()) kk=lambda:map(int,input().split()) ll=lambda:list(kk()) n,a1,a2=ii(),input(),input() locs = [0]*4 for i in ...
output
1
95,592
19
191,185
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of them. Each word consists of 2·n binary characte...
instruction
0
95,593
19
191,186
Tags: games, greedy Correct Solution: ``` import sys import math n = int(input()) st1 = input() st2 = input() k = 0 res = 0 for i in range(2 * n): if(st1[i] == '1' and st2[i] == '1'): k += 1 elif(st1[i] == '1'): res -= 1 elif(st2[i] == '1'): res += 1 res1 = int(k / 2) ...
output
1
95,593
19
191,187
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of them. Each word consists of 2·n binary characte...
instruction
0
95,594
19
191,188
Tags: games, greedy Correct Solution: ``` from sys import stdin from math import ceil, floor n = int(input()) s = stdin.readline() t = stdin.readline() first = 0 second = 0 draw = 0 for i in range(2*n): if( s[i] == '1' and t[i] == '1' ): draw += 1 elif( s[i] == '1' ): first += 1 elif( t[i] == '1' ): second += 1 #pr...
output
1
95,594
19
191,189
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of ...
instruction
0
95,595
19
191,190
Yes
output
1
95,595
19
191,191
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of ...
instruction
0
95,596
19
191,192
Yes
output
1
95,596
19
191,193
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of ...
instruction
0
95,597
19
191,194
Yes
output
1
95,597
19
191,195
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of ...
instruction
0
95,598
19
191,196
Yes
output
1
95,598
19
191,197
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of ...
instruction
0
95,599
19
191,198
No
output
1
95,599
19
191,199
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of ...
instruction
0
95,600
19
191,200
No
output
1
95,600
19
191,201
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of ...
instruction
0
95,601
19
191,202
No
output
1
95,601
19
191,203
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of ...
instruction
0
95,602
19
191,204
No
output
1
95,602
19
191,205
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. George is a cat, so he loves playing very much. Vitaly put n cards in a row in front of George. Each card has one integer written on it. All cards had distinct numbers written on them. Let's nu...
instruction
0
95,636
19
191,272
No
output
1
95,636
19
191,273
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is un...
instruction
0
95,722
19
191,444
Tags: combinatorics, dp, implementation, math, matrices Correct Solution: ``` m = 1000000007 input() n, d = 2, 1 for q in map(int, input().split()): d, n = q & d, pow(n, q, m) n = n * pow(2, m - 2, m) % m k = (n + 1 - 2 * d) * pow(3, m - 2, m) % m print(str(k) + '/' + str(n)) ```
output
1
95,722
19
191,445
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is un...
instruction
0
95,723
19
191,446
Tags: combinatorics, dp, implementation, math, matrices Correct Solution: ``` k = int(input()) MOD = 10 ** 9 + 7 antithree = pow(3, MOD - 2, MOD) antitwo = pow(2, MOD - 2, MOD) power = 1 parity = False for t in map(int, input().split()): power *= t power %= MOD - 1 if t % 2 == 0: parity = True q = p...
output
1
95,723
19
191,447
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is un...
instruction
0
95,724
19
191,448
Tags: combinatorics, dp, implementation, math, matrices Correct Solution: ``` #!/usr/bin/python3 class Matrix: def __init__(self, n, m, arr=None): self.n = n self.m = m self.arr = [[0] * m for i in range(n)] if arr is not None: for i in range(n): for j in...
output
1
95,724
19
191,449
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is un...
instruction
0
95,725
19
191,450
Tags: combinatorics, dp, implementation, math, matrices Correct Solution: ``` MOD = 10 ** 9 + 7 MOD1 = 2 * (10 ** 9 + 6) pow2 = [0] * 32 #pow2[i] = 2 ** (2 ** i) % MOD pow2[0] = 2 for i in range(1, 32): pow2[i] = (pow2[i - 1] ** 2) % MOD def exp2mod(exp): ans = 1 the_pow = 1 the_log = 0 while the_...
output
1
95,725
19
191,451
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is un...
instruction
0
95,726
19
191,452
Tags: combinatorics, dp, implementation, math, matrices Correct Solution: ``` from functools import reduce mod = 1000000007 n = input() numbers = list(map(int,input().split())) flag = 1 if len(list(filter(lambda x: x%2 == 0,numbers))) else -1 b = reduce(lambda x,y:pow(x,y,mod),numbers,2) b = b*pow(2,mod-2,mod)%mod # b ...
output
1
95,726
19
191,453
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is un...
instruction
0
95,727
19
191,454
Tags: combinatorics, dp, implementation, math, matrices Correct Solution: ``` k = int(input()) MOD = 10 ** 9 + 7 antithree = pow(3, MOD - 2, MOD) antitwo = pow(2, MOD - 2, MOD) power = 1 parity = False for t in map(int, input().split()): power *= t power %= MOD - 1 if t % 2 == 0: parity = ...
output
1
95,727
19
191,455
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is un...
instruction
0
95,728
19
191,456
Tags: combinatorics, dp, implementation, math, matrices Correct Solution: ``` k = int(input()) n = list(map(int, input().split())) for i in range(k): n[i] = bin(n[i]) n[i] = n[i][2:] magic = 1000000007 def par(s): if s[-1] == '0': return True else: return False def mod_pow(x, s, ...
output
1
95,728
19
191,457
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is un...
instruction
0
95,729
19
191,458
Tags: combinatorics, dp, implementation, math, matrices Correct Solution: ``` n = int(input()) ls = [int(x) for x in input().split(' ')] t = 1 mod = 1000000007 def qpow(n: int, m: int): m %= mod - 1 ans = 1 while m: if m & 1: ans = ans * n % mod n = n * n % mod m >>= 1 return a...
output
1
95,729
19
191,459
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left ...
instruction
0
95,730
19
191,460
Yes
output
1
95,730
19
191,461
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left ...
instruction
0
95,731
19
191,462
Yes
output
1
95,731
19
191,463
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left ...
instruction
0
95,732
19
191,464
Yes
output
1
95,732
19
191,465
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left ...
instruction
0
95,733
19
191,466
Yes
output
1
95,733
19
191,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left ...
instruction
0
95,734
19
191,468
No
output
1
95,734
19
191,469
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left ...
instruction
0
95,735
19
191,470
No
output
1
95,735
19
191,471
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left ...
instruction
0
95,736
19
191,472
No
output
1
95,736
19
191,473
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left ...
instruction
0
95,737
19
191,474
No
output
1
95,737
19
191,475
Provide a correct Python 3 solution for this coding contest problem. Problem There are coins with front and back sides and dice with rolls from $ 1 $ to $ N $. Gacho decided to play the following games using these. The game starts with a score of $ 0 $ and proceeds as follows. 1. Roll the dice $ 1 $ and add the nu...
instruction
0
96,059
19
192,118
"Correct Solution: ``` N, K, A = map(int, input().split()) dp = [0] * (K+1) + [1] * N # 残りが i 点のときの勝率 dp[0] = 1 c = 1 mod = 998244353 p_coin = A * pow(100, mod-2, mod) % mod p_dice = pow(N, mod-2, mod) for i in range(1, K+1): dp[i] = c * p_coin % mod c += (dp[i] - dp[i-N]) * p_dice % mod print(dp[K] * pow(p_co...
output
1
96,059
19
192,119
Provide a correct Python 3 solution for this coding contest problem. Problem There are coins with front and back sides and dice with rolls from $ 1 $ to $ N $. Gacho decided to play the following games using these. The game starts with a score of $ 0 $ and proceeds as follows. 1. Roll the dice $ 1 $ and add the nu...
instruction
0
96,060
19
192,120
"Correct Solution: ``` #!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.st...
output
1
96,060
19
192,121
Provide a correct Python 3 solution for this coding contest problem. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arranges n dominoes in a line, placing each piece vertically up...
instruction
0
96,481
19
192,962
"Correct Solution: ``` n = input() falling_dir = input() n = int(n, 10) f = 0 start_pos = 0 fall_dir = "." i = 0 for dir in falling_dir: if dir == "R": fall_dir = dir start_pos = i elif dir == "L": k = i - start_pos if fall_dir == ".": f += k+1 else: if k%2 == 0: f += k else: f += k+1 ...
output
1
96,481
19
192,963
Provide a correct Python 3 solution for this coding contest problem. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arranges n dominoes in a line, placing each piece vertically up...
instruction
0
96,482
19
192,964
"Correct Solution: ``` n=int(input()) x=input() i=0 c=0 while i<n: if x[i]=="L" or x[i]=="R": if x[i]=="R": c+=i break i+=1 if i==n: for i in range(n): if x[i]=="R": break print(i+1) else: j=i+1 while j<n: if x[j]==".": j+=1 ...
output
1
96,482
19
192,965
Provide a correct Python 3 solution for this coding contest problem. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arranges n dominoes in a line, placing each piece vertically up...
instruction
0
96,483
19
192,966
"Correct Solution: ``` n = int(input()) s = input().split('L') ans = 0 if 'R' not in s[0]: if len(s) != 1: s = s[1:] if 'R' in s[-1]: s[-1] = s[-1][:s[-1].index('R')] for sub in s: if 'R' not in sub: ans += len(sub) else: idx = sub.index('R') ans += idx ans += (len(sub) - idx - 1) % 2 print(ans) ```
output
1
96,483
19
192,967
Provide a correct Python 3 solution for this coding contest problem. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arranges n dominoes in a line, placing each piece vertically up...
instruction
0
96,484
19
192,968
"Correct Solution: ``` n = int(input()) string = input() result = 0 if set(string) == {'.', }: print(n) else: i = 0 met_1 = False met_2 = False start = 0 end = n-1 on = True while i < n and not (met_1 and met_2): # print("came in while") # print(f"string[i] = {string[i...
output
1
96,484
19
192,969
Provide a correct Python 3 solution for this coding contest problem. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arranges n dominoes in a line, placing each piece vertically up...
instruction
0
96,485
19
192,970
"Correct Solution: ``` N = int(input()) S = input() A = [1 for i in range(N)] mode = -1 ans = 0 for i in range(N): c = S[i] if(c=="L"): if(mode==-1): for k in range(i+1): A[k]=0 else: if(i-mode+1)%2==1: ans+=1 for k in range(mode,i+1): A[k]=0 mode = -1 elif(c=="R"): mode = i if(mode!=-1...
output
1
96,485
19
192,971
Provide a correct Python 3 solution for this coding contest problem. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arranges n dominoes in a line, placing each piece vertically up...
instruction
0
96,486
19
192,972
"Correct Solution: ``` import sys # sys.stdin = open('input.txt', 'r') # sys.stdout = open('output.txt', 'w') input = sys.stdin.readline n = int(input()) s = input().strip() st = [] up = n for i in range(n): if s[i] == "L": if not st: up -= (i+1) else: length = i - st.po...
output
1
96,486
19
192,973
Provide a correct Python 3 solution for this coding contest problem. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arranges n dominoes in a line, placing each piece vertically up...
instruction
0
96,487
19
192,974
"Correct Solution: ``` n = int(input()) s = input() s = list(s) v = 0 while(True): lExits = False rExits = False if ('L' in s): l = s.index('L') lExits = True if ('R' in s): r = s.index('R') rExits = True if (lExits == False and rExits == False): break if ...
output
1
96,487
19
192,975
Provide a correct Python 3 solution for this coding contest problem. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arranges n dominoes in a line, placing each piece vertically up...
instruction
0
96,488
19
192,976
"Correct Solution: ``` n = int(input()) st = list(input()) ans = 0 i = 0 while st and i < len(st): if st[i] == 'L': n -= i + 1 st = st[i + 1:] i = -1 elif st[i] == 'R': n -= 1 j = i + 1 while j < len(st): if st[j] == 'L': n -= j - i ...
output
1
96,488
19
192,977
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arrange...
instruction
0
96,489
19
192,978
Yes
output
1
96,489
19
192,979
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arrange...
instruction
0
96,490
19
192,980
Yes
output
1
96,490
19
192,981
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arrange...
instruction
0
96,491
19
192,982
Yes
output
1
96,491
19
192,983
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arrange...
instruction
0
96,492
19
192,984
Yes
output
1
96,492
19
192,985
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arrange...
instruction
0
96,493
19
192,986
No
output
1
96,493
19
192,987
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arrange...
instruction
0
96,494
19
192,988
No
output
1
96,494
19
192,989
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arrange...
instruction
0
96,495
19
192,990
No
output
1
96,495
19
192,991
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a "domino show". Chris arrange...
instruction
0
96,496
19
192,992
No
output
1
96,496
19
192,993
Provide tags and a correct Python 3 solution for this coding contest problem. After all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of n bullet slots able to contain exactly k bullets,...
instruction
0
96,969
19
193,938
Tags: constructive algorithms, greedy Correct Solution: ``` n, k, p = map(int, input().split()) for i in range(p): pos = int(input()) if n % 2: if pos == n: print('X' if k > 0 else '.', end='') else: if k * 2 > n + 1: print('X' if (pos & 1) == 0 or (n - p...
output
1
96,969
19
193,939
Provide tags and a correct Python 3 solution for this coding contest problem. After all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of n bullet slots able to contain exactly k bullets,...
instruction
0
96,970
19
193,940
Tags: constructive algorithms, greedy Correct Solution: ``` n, k, p = map(int, input().split()) for i in range(p): pos = int(input()) if n % 2: if pos == n: print('X' if k > 0 else '.', end='') else: if k * 2 > n + 1: print('X' if (pos & 1) == 0 or (n - p...
output
1
96,970
19
193,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of n ...
instruction
0
96,971
19
193,942
No
output
1
96,971
19
193,943
Provide tags and a correct Python 3 solution for this coding contest problem. Vova is playing a computer game. There are in total n turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is k. During each turn Vova can choos...
instruction
0
97,020
19
194,040
Tags: binary search, math Correct Solution: ``` for n in range(int(input())): lvl,tot,a,b=map(int,input().split()) if tot*b>=lvl: print(-1) continue hi=tot lo=0 res=0 while hi>=lo: justpl=(hi+lo)//2 u=justpl*a+(tot-justpl)*b if justpl*a+(tot-justpl)*b<lvl...
output
1
97,020
19
194,041