message
stringlengths
2
39.6k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
450
109k
cluster
float64
2
2
__index_level_0__
int64
900
217k
Provide tags and a correct Python 3 solution for this coding contest problem. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-paste spell as follows: 1. He chooses two p...
instruction
0
103,072
2
206,144
Tags: greedy, math Correct Solution: ``` for _ in range(int(input())): n,k=map(int,input().split()) a=sorted(list(map(int,input().split()))) x=a[0] a.pop(0) ans=0 for i in range(n-1): x1=k-a[i] ans+=(x1//x) print(ans) ```
output
1
103,072
2
206,145
Provide tags and a correct Python 3 solution for this coding contest problem. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-paste spell as follows: 1. He chooses two p...
instruction
0
103,073
2
206,146
Tags: greedy, math Correct Solution: ``` # 1417A.py for _ in range(int(input())): n,k = map(int,input().split()) a = list(map(int,input().split())) a.sort() spell = 0 for i in range(1,n): a[i] = a[i]-k if a[i]<0: a[i]=-1*a[i] spell += (a[i]//a[0]) else...
output
1
103,073
2
206,147
Provide tags and a correct Python 3 solution for this coding contest problem. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-paste spell as follows: 1. He chooses two p...
instruction
0
103,074
2
206,148
Tags: greedy, math Correct Solution: ``` for _ in range(int(input())): n, k = map(int,input().split()) l = list(map(int,input().split())) l.sort() ans = 0 ref = l[0] for i in range(1,n): if l[i]>=k: continue dif = k - l[i] ans += dif//ref print(ans) ```
output
1
103,074
2
206,149
Provide tags and a correct Python 3 solution for this coding contest problem. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-paste spell as follows: 1. He chooses two p...
instruction
0
103,075
2
206,150
Tags: greedy, math Correct Solution: ``` for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) ma = min(a) ind = a.index(ma) ans = 0 for i in range(n): if i == ind: continue m = (k - a[i]) // ma a[i] += m * ma ...
output
1
103,075
2
206,151
Provide tags and a correct Python 3 solution for this coding contest problem. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-paste spell as follows: 1. He chooses two p...
instruction
0
103,076
2
206,152
Tags: greedy, math Correct Solution: ``` for _ in range(int(input())): n,k=[int(i) for i in input().split()] l=[int(i) for i in input().split()] l.sort() mn=l[0] ans=0 for i in range(n-1, 0,-1): if(l[i]<k): d=k-l[i] ans+=int(d/mn) print(ans) ```
output
1
103,076
2
206,153
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-...
instruction
0
103,077
2
206,154
Yes
output
1
103,077
2
206,155
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-...
instruction
0
103,078
2
206,156
Yes
output
1
103,078
2
206,157
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-...
instruction
0
103,079
2
206,158
Yes
output
1
103,079
2
206,159
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-...
instruction
0
103,080
2
206,160
Yes
output
1
103,080
2
206,161
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-...
instruction
0
103,081
2
206,162
No
output
1
103,081
2
206,163
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-...
instruction
0
103,082
2
206,164
No
output
1
103,082
2
206,165
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-...
instruction
0
103,083
2
206,166
No
output
1
103,083
2
206,167
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. β€” Hey folks, how do you like this problem? β€” That'll do it. BThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-...
instruction
0
103,084
2
206,168
No
output
1
103,084
2
206,169
Provide tags and a correct Python 3 solution for this coding contest problem. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is interested in sets, He has a set of n integers. D...
instruction
0
103,384
2
206,768
Tags: greedy, implementation Correct Solution: ``` n,x=map(int,input().split()) a=set(map(int,input().split())) s=int(x in a) for i in range(x): if not i in a:s+=1 print(s) ```
output
1
103,384
2
206,769
Provide tags and a correct Python 3 solution for this coding contest problem. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is interested in sets, He has a set of n integers. D...
instruction
0
103,385
2
206,770
Tags: greedy, implementation Correct Solution: ``` import sys str1 = sys.stdin.readline() num1, num2 = int(str1.split(" ")[0]), int(str1.split(" ")[1]) str2 = sys.stdin.readline() lst = [] for i in range(num1): lst.append(int(str2.split(" ")[i])) result = 0 com = list(range(num2)) for i in range(num2): if ...
output
1
103,385
2
206,771
Provide tags and a correct Python 3 solution for this coding contest problem. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is interested in sets, He has a set of n integers. D...
instruction
0
103,387
2
206,774
Tags: greedy, implementation Correct Solution: ``` n,m = map(int,input().split()) l = list(map(int,input().split())) c = 0 for i in range(m): if i not in l: c+=1 if m in l: c+=1 print(c) ```
output
1
103,387
2
206,775
Provide tags and a correct Python 3 solution for this coding contest problem. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is interested in sets, He has a set of n integers. D...
instruction
0
103,388
2
206,776
Tags: greedy, implementation Correct Solution: ``` n,x = [int(i) for i in input().split(" ")] l = [int(i) for i in input().split(" ")] result = 0 for i in range(x): if i not in l: result += 1 if x in l: result += 1 print(result) ```
output
1
103,388
2
206,777
Provide tags and a correct Python 3 solution for this coding contest problem. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is interested in sets, He has a set of n integers. D...
instruction
0
103,389
2
206,778
Tags: greedy, implementation Correct Solution: ``` n, x = map(int, input().split()) s = list(map(int, input().split())) s.sort() i = 0 while i < n and s[i] < x: i += 1 if (i < n and s[i] == x) or (i - 1 >= 0 and s[i - 1] == x): print(x - i + 1) else: print(x - i) ```
output
1
103,389
2
206,779
Provide tags and a correct Python 3 solution for this coding contest problem. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is interested in sets, He has a set of n integers. D...
instruction
0
103,390
2
206,780
Tags: greedy, implementation Correct Solution: ``` n,x=map(int,input().split()) L=list(map(int,input().split())) o=0 if x in L: L.remove(x) o+=1 for i in range(x): if i not in L: L.append(i) o+=1 print(o) ```
output
1
103,390
2
206,781
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is in...
instruction
0
103,391
2
206,782
Yes
output
1
103,391
2
206,783
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is in...
instruction
0
103,393
2
206,786
Yes
output
1
103,393
2
206,787
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is in...
instruction
0
103,394
2
206,788
Yes
output
1
103,394
2
206,789
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is in...
instruction
0
103,395
2
206,790
No
output
1
103,395
2
206,791
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is in...
instruction
0
103,396
2
206,792
No
output
1
103,396
2
206,793
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is in...
instruction
0
103,397
2
206,794
No
output
1
103,397
2
206,795
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is in...
instruction
0
103,398
2
206,796
No
output
1
103,398
2
206,797
Provide a correct Python 3 solution for this coding contest problem. There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with everyone in this game, but sadly t...
instruction
0
103,594
2
207,188
"Correct Solution: ``` from collections import deque while True: n = int(input()) if n == 0:break q1 = deque(sorted(map(int, input().split()))) q2 = deque(sorted(map(int, input().split()))) cnt = 0 for k in range(1, n): top1 = q1.pop() top2 = q2.pop() if top1 > top2: ...
output
1
103,594
2
207,189
Provide a correct Python 3 solution for this coding contest problem. There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with everyone in this game, but sadly t...
instruction
0
103,595
2
207,190
"Correct Solution: ``` # AOJ 0272: The Lonely Girl's Lie # Python3 2018.6.26 bal4u while True: n = int(input()) if n == 0: break a = list(map(int, input().split())) b = list(map(int, input().split())) a.sort(reverse=True) b.sort(reverse=True) ans, i = n, -1 for k in range(0, n, 2): i += 1 if a[k] > b[i]: ...
output
1
103,595
2
207,191
Provide a correct Python 3 solution for this coding contest problem. There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with everyone in this game, but sadly t...
instruction
0
103,596
2
207,192
"Correct Solution: ``` while 1: if input()=='0':break a=sorted(list(map(int,input().split())))[::-1] b=sorted(list(map(int,input().split())))[::-1] p=0;c=0; for i,x in enumerate(a): if i/2<c:print(i);break if x<=b[p]:p+=1 else:c+=1 else:print('NA') ```
output
1
103,596
2
207,193
Provide a correct Python 3 solution for this coding contest problem. There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with everyone in this game, but sadly t...
instruction
0
103,597
2
207,194
"Correct Solution: ``` # AOJ 0272: The Lonely Girl's Lie # Python3 2018.6.26 bal4u def counting_sort(nmax, la): # nmax:ζœ€ε€§ε€€, n:len(la), a:データγƒͺγ‚Ήγƒˆ f = [0]*(nmax+1) nmax = 0 for a in la: f[a] += 1 if a > nmax: nmax = a k, i = len(la), nmax la = [] while k: if f[i]: la += [i]*f[i] k -= f[i] i -= 1 ret...
output
1
103,597
2
207,195
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so...
instruction
0
103,598
2
207,196
No
output
1
103,598
2
207,197
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In 2012, human beings have been exposed to fierce onslaught of unidentified mysterious extra-terrestrial creatures. We have exhaused because of the long war and can't regist against them any lon...
instruction
0
103,611
2
207,222
No
output
1
103,611
2
207,223
Provide tags and a correct Python 3 solution for this coding contest problem. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya even e...
instruction
0
104,091
2
208,182
Tags: implementation Correct Solution: ``` k, n, m, q = [int(i) for i in input().split()] basic = [input() for i in range(n)] composite = {} for i in range(m): name, items = input().split(":") composite[name] = {} for item in items.split(","): component, cnt = item.split() composite[name][component] = int(cnt) ...
output
1
104,091
2
208,183
Provide tags and a correct Python 3 solution for this coding contest problem. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya even e...
instruction
0
104,092
2
208,184
Tags: implementation Correct Solution: ``` # Not really fair, since I already solved this one previously. ;) k, n, m, q = [int(i) for i in input().split()] basic = [input() for i in range(n)] composite = {} for i in range(m): name, items = input().split(":") composite[name] = {} for item in items.split(","): com...
output
1
104,092
2
208,185
Provide tags and a correct Python 3 solution for this coding contest problem. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya even e...
instruction
0
104,093
2
208,186
Tags: implementation Correct Solution: ``` k,m,n,q = map(int, input().split()) basic = [input() for _ in range(m)] from collections import Counter, defaultdict recipes, accounts = defaultdict(Counter), defaultdict(Counter) for _ in range(n): composite, components = input().split(': ') for unit in components.spl...
output
1
104,093
2
208,187
Provide tags and a correct Python 3 solution for this coding contest problem. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya even e...
instruction
0
104,094
2
208,188
Tags: implementation Correct Solution: ``` lists, maps, ints, ranges, strs, sets, sorteds = list, map, int, range, str, set, sorted alliesNum, basicNum, compositeNum, purchasesNum = lists(maps(ints, input().split())) allies = {} basics = [] composites = {} present= False for i in ranges(basicNum): basics += input(...
output
1
104,094
2
208,189
Provide tags and a correct Python 3 solution for this coding contest problem. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya even e...
instruction
0
104,095
2
208,190
Tags: implementation Correct Solution: ``` from collections import defaultdict k,n,m,q = [int(x) for x in input().split()] single = [input() for i in range(n)] comp1 = [input().split(': ') for i in range(m)] comp2 = {x:y.split(', ') for x,y in comp1} def make_tup(ls): ans=[] for s in ls: x,y=s.split...
output
1
104,095
2
208,191
Provide tags and a correct Python 3 solution for this coding contest problem. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya even e...
instruction
0
104,096
2
208,192
Tags: implementation Correct Solution: ``` import sys def solve(): kallies, nbasic, mcomp, qpurch, = rv() res = [dict() for _ in range(kallies)] mem = [dict() for _ in range(kallies)] basicnames = [input() for _ in range(nbasic)] for friend in range(kallies): for item in basicnames: ...
output
1
104,096
2
208,193
Provide tags and a correct Python 3 solution for this coding contest problem. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya even e...
instruction
0
104,097
2
208,194
Tags: implementation Correct Solution: ``` import sys def solve(): kallies, nbasic, mcomp, qpurch, = rv() res = [dict() for _ in range(kallies)] mem = [dict() for _ in range(kallies)] basicnames = [input() for _ in range(nbasic)] for friend in range(kallies): for item in basicnames: ...
output
1
104,097
2
208,195
Provide tags and a correct Python 3 solution for this coding contest problem. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya even e...
instruction
0
104,098
2
208,196
Tags: implementation Correct Solution: ``` import sys from array import array # noqa: F401 from collections import defaultdict def input(): return sys.stdin.buffer.readline().decode('utf-8') k, n, m, q = map(int, input().split()) basic = [input().rstrip() for _ in range(n)] composite = defaultdict(list) for _ ...
output
1
104,098
2
208,197
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and s...
instruction
0
104,099
2
208,198
No
output
1
104,099
2
208,199
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and s...
instruction
0
104,100
2
208,200
No
output
1
104,100
2
208,201
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and s...
instruction
0
104,101
2
208,202
No
output
1
104,101
2
208,203
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and s...
instruction
0
104,102
2
208,204
No
output
1
104,102
2
208,205
Provide tags and a correct Python 3 solution for this coding contest problem. For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all. Anvils come in different sizes and shapes. Quite o...
instruction
0
104,971
2
209,942
Tags: math, probabilities Correct Solution: ``` t = int( input() ) for i in range( t ): a, b = list( map( int, input().split() ) ) if a == 0 and b == 0: print( 1 ) elif a == 0: print( 0.5 ) elif b == 0: print( 1 ) else: if a < 4*b: ans = (b*a + a*a / 8) ...
output
1
104,971
2
209,943
Provide tags and a correct Python 3 solution for this coding contest problem. For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all. Anvils come in different sizes and shapes. Quite o...
instruction
0
104,972
2
209,944
Tags: math, probabilities Correct Solution: ``` t = int(input()) for i in range(t): a,b = [int(i) for i in input().split()] b *= 4 if(a == 0 and b == 0): print(1) elif(a == 0): print(0.5) else: ans = 0.5 if(a > b): ans += (a-b)/a/2 + b/a/4 else: ...
output
1
104,972
2
209,945
Provide tags and a correct Python 3 solution for this coding contest problem. For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all. Anvils come in different sizes and shapes. Quite o...
instruction
0
104,973
2
209,946
Tags: math, probabilities Correct Solution: ``` #!/usr/bin/env python3 def solve(a,b): answer = 0 if ((a>0) and (b>0)): height = a / 4 if (height <= b): answer = ((a*b)+0.5*a*height)/(2*b*a) else: base = b*4 answer = ((2*a*b)-0.5*base*b)/(2*b*a) elif (b == 0): answer = 1.0 el...
output
1
104,973
2
209,947
Provide tags and a correct Python 3 solution for this coding contest problem. For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all. Anvils come in different sizes and shapes. Quite o...
instruction
0
104,974
2
209,948
Tags: math, probabilities Correct Solution: ``` t = int(input()) for _ in range(t): a, b = map(int, input().split()) if a == 0 and b == 0: print(1) elif a == 0: print(0.5) elif b == 0: print(1) elif a > 4 * b: print('%.10f' % ((a - b) / a)) else: print('%.10f' % (a / 16 / b + 0.5)) ```
output
1
104,974
2
209,949
Provide tags and a correct Python 3 solution for this coding contest problem. For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all. Anvils come in different sizes and shapes. Quite o...
instruction
0
104,975
2
209,950
Tags: math, probabilities Correct Solution: ``` import sys from array import array # noqa: F401 def input(): return sys.stdin.buffer.readline().decode('utf-8') t = int(input()) ans = [0.0] * t for i in range(t): a, b = map(int, input().split()) if b == 0: ans[i] = 1.0 elif a == 0: a...
output
1
104,975
2
209,951
Provide tags and a correct Python 3 solution for this coding contest problem. For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all. Anvils come in different sizes and shapes. Quite o...
instruction
0
104,976
2
209,952
Tags: math, probabilities Correct Solution: ``` import sys lines = int(sys.stdin.readline()) for _ in range(lines): a, b = map(float, sys.stdin.readline().split(' ')) if b == 0.0: print(1) elif a <= 4*b: print((0.125*a + b) / (2.0*b)) else: print((a - b) / a) ```
output
1
104,976
2
209,953