text
stringlengths
216
39.6k
conversation_id
int64
219
108k
embedding
list
cluster
int64
11
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. Constraints * 1 \leq N \leq 100 * |s| = N * s_i is `R` or `B`. Input Input is given from Standard Input in the following format: N s Output If there are more people wearing a red hat than there are people wearing a blue hat, print `Yes`; otherwise, print `No`. Examples Input 4 RRBR Output Yes Input 4 BRBR Output No Submitted Solution: ``` N=int(input()) if len(input().replace("B",""))>N/2: print("Yes") else: print("No") ``` Yes
60,457
[ 0.483642578125, -0.208984375, -0.2479248046875, 0.041900634765625, -0.1815185546875, -0.380126953125, -0.056396484375, 0.06805419921875, 0.197509765625, 0.84375, 0.72216796875, -0.1243896484375, 0.43701171875, -0.64208984375, -0.26513671875, -0.258544921875, -0.59130859375, -0.4289...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. Constraints * 1 \leq N \leq 100 * |s| = N * s_i is `R` or `B`. Input Input is given from Standard Input in the following format: N s Output If there are more people wearing a red hat than there are people wearing a blue hat, print `Yes`; otherwise, print `No`. Examples Input 4 RRBR Output Yes Input 4 BRBR Output No Submitted Solution: ``` a = int(input()) b = input() if b.count("R") > a / 2 : print("Yes") else : print("No") ``` Yes
60,458
[ 0.4892578125, -0.183837890625, -0.27685546875, 0.051849365234375, -0.1737060546875, -0.35498046875, -0.060638427734375, 0.0693359375, 0.177490234375, 0.86572265625, 0.67578125, -0.09735107421875, 0.442626953125, -0.640625, -0.266845703125, -0.239013671875, -0.59521484375, -0.398193...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. Constraints * 1 \leq N \leq 100 * |s| = N * s_i is `R` or `B`. Input Input is given from Standard Input in the following format: N s Output If there are more people wearing a red hat than there are people wearing a blue hat, print `Yes`; otherwise, print `No`. Examples Input 4 RRBR Output Yes Input 4 BRBR Output No Submitted Solution: ``` N = input() s = input() N1 = int(N)/2 import math math.ceil(N1) N1= int(N1) list_s = list(s) list_s.sort() X = list_s[N1] if X=='R': print('Yes') else: print('No') ``` No
60,459
[ 0.404296875, -0.20556640625, -0.271484375, 0.03692626953125, -0.202392578125, -0.2347412109375, -0.046417236328125, 0.1937255859375, 0.2325439453125, 0.857421875, 0.646484375, -0.1363525390625, 0.4296875, -0.6201171875, -0.298095703125, -0.278076171875, -0.5830078125, -0.4592285156...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. Constraints * 1 \leq N \leq 100 * |s| = N * s_i is `R` or `B`. Input Input is given from Standard Input in the following format: N s Output If there are more people wearing a red hat than there are people wearing a blue hat, print `Yes`; otherwise, print `No`. Examples Input 4 RRBR Output Yes Input 4 BRBR Output No Submitted Solution: ``` n=int(input()) s = input().split() #print(s) r = 0 b = 0 for i in s: if i == "R": r += 1 if i == "B": b += 1 if r <= b: print("No") else: print("Yes") ``` No
60,460
[ 0.459228515625, -0.1402587890625, -0.2335205078125, 0.04669189453125, -0.1558837890625, -0.360595703125, -0.0144805908203125, 0.07183837890625, 0.1868896484375, 0.87109375, 0.7021484375, -0.1094970703125, 0.4658203125, -0.681640625, -0.25634765625, -0.26318359375, -0.59814453125, -...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. Constraints * 1 \leq N \leq 100 * |s| = N * s_i is `R` or `B`. Input Input is given from Standard Input in the following format: N s Output If there are more people wearing a red hat than there are people wearing a blue hat, print `Yes`; otherwise, print `No`. Examples Input 4 RRBR Output Yes Input 4 BRBR Output No Submitted Solution: ``` N = int(input()) S = input() red = 0 blue = 0 for s in S: if s == 'R': red++ else: blue++ if red > blue: print('Yes') else print('No') ``` No
60,461
[ 0.46337890625, -0.1552734375, -0.22509765625, 0.0718994140625, -0.15478515625, -0.37109375, -0.029205322265625, 0.066162109375, 0.15576171875, 0.833984375, 0.7158203125, -0.126220703125, 0.439453125, -0.63427734375, -0.275634765625, -0.264892578125, -0.62109375, -0.41650390625, 0...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. Constraints * 1 \leq N \leq 100 * |s| = N * s_i is `R` or `B`. Input Input is given from Standard Input in the following format: N s Output If there are more people wearing a red hat than there are people wearing a blue hat, print `Yes`; otherwise, print `No`. Examples Input 4 RRBR Output Yes Input 4 BRBR Output No Submitted Solution: ``` 4 RRBR ``` No
60,462
[ 0.51708984375, -0.1663818359375, -0.246337890625, 0.063720703125, -0.129150390625, -0.359619140625, -0.0838623046875, 0.023193359375, 0.1494140625, 0.83837890625, 0.78857421875, -0.1474609375, 0.427978515625, -0.6005859375, -0.257080078125, -0.2188720703125, -0.62841796875, -0.3474...
11
Provide a correct Python 3 solution for this coding contest problem. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC "Correct Solution: ``` X = int(input()) if X < 1200: print('ABC') else: print('ARC') ```
61,360
[ 0.63427734375, 0.11065673828125, -0.6650390625, -0.0679931640625, -0.63232421875, -0.317626953125, -0.18212890625, -0.01141357421875, -0.1431884765625, 0.7216796875, 0.68505859375, -0.26953125, -0.065185546875, -1.076171875, -0.2188720703125, -0.021759033203125, -0.53662109375, -0....
11
Provide a correct Python 3 solution for this coding contest problem. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC "Correct Solution: ``` N=int(input()) if N<1200: s="ABC" else: s="ARC" print(s) ```
61,361
[ 0.65478515625, 0.10479736328125, -0.6357421875, -0.047271728515625, -0.59912109375, -0.298583984375, -0.131591796875, -0.07537841796875, -0.11297607421875, 0.73291015625, 0.69921875, -0.314453125, -0.0231475830078125, -1.0634765625, -0.25830078125, -0.042938232421875, -0.55224609375,...
11
Provide a correct Python 3 solution for this coding contest problem. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC "Correct Solution: ``` N = int(input()) if N < 1200: print('ABC') else: print('ARC') ```
61,362
[ 0.64892578125, 0.10015869140625, -0.6572265625, -0.0335693359375, -0.56689453125, -0.329345703125, -0.1317138671875, -0.07958984375, -0.099365234375, 0.796875, 0.7197265625, -0.324951171875, -0.04583740234375, -1.0673828125, -0.222412109375, -0.022552490234375, -0.568359375, -0.992...
11
Provide a correct Python 3 solution for this coding contest problem. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC "Correct Solution: ``` rate = int(input()) print("ABC") if rate < 1200 else print("ARC") ```
61,363
[ 0.5849609375, 0.2054443359375, -0.73046875, -0.023712158203125, -0.630859375, -0.3076171875, -0.1209716796875, -0.04022216796875, -0.04669189453125, 0.609375, 0.63818359375, -0.24462890625, 0.049346923828125, -1.099609375, -0.243408203125, -0.060211181640625, -0.51953125, -1.008789...
11
Provide a correct Python 3 solution for this coding contest problem. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC "Correct Solution: ``` m=int(input()) if m<1200:print("ABC") else:print("ARC") ```
61,364
[ 0.62939453125, 0.10986328125, -0.708984375, -0.09979248046875, -0.63330078125, -0.2900390625, -0.143798828125, -0.047088623046875, -0.1279296875, 0.6904296875, 0.67236328125, -0.295654296875, -0.05810546875, -1.099609375, -0.26611328125, -0.008087158203125, -0.5234375, -0.956542968...
11
Provide a correct Python 3 solution for this coding contest problem. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC "Correct Solution: ``` r = int(input()) if r >= 1200: print("ARC") else: print("ABC") ```
61,365
[ 0.6201171875, 0.08270263671875, -0.6962890625, -0.0892333984375, -0.60791015625, -0.33154296875, -0.10272216796875, -0.0226898193359375, -0.1778564453125, 0.685546875, 0.6689453125, -0.29296875, -0.052154541015625, -1.0595703125, -0.234619140625, -0.06463623046875, -0.5146484375, -...
11
Provide a correct Python 3 solution for this coding contest problem. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC "Correct Solution: ``` print(('ARC','ABC')[int(input())<1200]) ```
61,366
[ 0.65478515625, 0.11163330078125, -0.64453125, -0.0706787109375, -0.6337890625, -0.302978515625, -0.1571044921875, -0.061279296875, -0.1126708984375, 0.728515625, 0.671875, -0.296875, -0.03900146484375, -1.046875, -0.28955078125, -0.052581787109375, -0.4580078125, -0.9658203125, -...
11
Provide a correct Python 3 solution for this coding contest problem. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC "Correct Solution: ``` print('ABC' if int(input().strip()) < 1200 else 'ARC') ```
61,367
[ 0.63525390625, 0.1126708984375, -0.630859375, -0.098876953125, -0.65673828125, -0.34033203125, -0.1275634765625, -0.054962158203125, -0.129150390625, 0.72412109375, 0.6806640625, -0.296142578125, -0.040191650390625, -1.06640625, -0.2841796875, -0.04833984375, -0.51904296875, -0.974...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC Submitted Solution: ``` #coding: utf-8 print(["ARC", "ABC"][int(input()) < 1200]) ``` Yes
61,368
[ 0.6455078125, -0.005550384521484375, -0.61279296875, -0.08148193359375, -0.6513671875, -0.32958984375, -0.11138916015625, -0.04852294921875, -0.08197021484375, 0.73828125, 0.537109375, -0.25439453125, -0.066162109375, -0.87451171875, -0.35107421875, -0.173583984375, -0.3837890625, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC Submitted Solution: ``` x = int(input()) if x < 1200: r = 'ABC' else: r = 'ARC' print(r) ``` Yes
61,369
[ 0.65966796875, 0.023651123046875, -0.60693359375, -0.08074951171875, -0.64013671875, -0.290771484375, -0.210205078125, -0.0025787353515625, -0.09100341796875, 0.7529296875, 0.60791015625, -0.211181640625, -0.083740234375, -0.9404296875, -0.284423828125, -0.08514404296875, -0.45117187...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC Submitted Solution: ``` X = int(input()) print("ABC" if X<1200 else "ARC") ``` Yes
61,370
[ 0.66162109375, 0.03289794921875, -0.62646484375, -0.08905029296875, -0.63916015625, -0.304931640625, -0.22021484375, -0.0188751220703125, -0.06488037109375, 0.7470703125, 0.6328125, -0.225830078125, -0.075927734375, -0.962890625, -0.296630859375, -0.09765625, -0.427734375, -0.95898...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC Submitted Solution: ``` n = int(input()) print("ABC") if n < 1200 else print("ARC") ``` Yes
61,371
[ 0.66943359375, -0.0015621185302734375, -0.6181640625, -0.0709228515625, -0.5966796875, -0.31103515625, -0.19140625, -0.036895751953125, -0.0467529296875, 0.802734375, 0.62841796875, -0.26123046875, -0.051116943359375, -0.9306640625, -0.29736328125, -0.095947265625, -0.47021484375, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC Submitted Solution: ``` x = input() if int(x) >= 1200: print(ARC) else: print(ABC) ``` No
61,372
[ 0.63720703125, 0.033966064453125, -0.625, -0.08282470703125, -0.64111328125, -0.326904296875, -0.18505859375, 0.0120086669921875, -0.09442138671875, 0.755859375, 0.63330078125, -0.2125244140625, -0.080078125, -0.96923828125, -0.286865234375, -0.08660888671875, -0.42724609375, -0.96...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC Submitted Solution: ``` print(f"A{'RB'['12'>input()]}C") ``` No
61,373
[ 0.65283203125, 0.00914764404296875, -0.58642578125, -0.093994140625, -0.654296875, -0.26806640625, -0.203857421875, -0.027130126953125, -0.0716552734375, 0.7021484375, 0.6513671875, -0.2607421875, -0.0237884521484375, -0.90966796875, -0.3662109375, -0.0828857421875, -0.3994140625, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC Submitted Solution: ``` print(β€œABC” if int(input())<1200 else(β€œARC”)) ``` No
61,374
[ 0.62646484375, 0.0419921875, -0.634765625, -0.0975341796875, -0.63818359375, -0.320556640625, -0.1983642578125, -0.044281005859375, -0.07891845703125, 0.74853515625, 0.62939453125, -0.24462890625, -0.070556640625, -0.95068359375, -0.34130859375, -0.13427734375, -0.417236328125, -0....
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. Constraints * 1 ≦ x ≦ 3{,}000 * x is an integer. Input The input is given from Standard Input in the following format: x Output Print the answer. Examples Input 1000 Output ABC Input 2000 Output ARC Submitted Solution: ``` n = int(input()) if x < 1200: print('ABC') else: print('ARC') ``` No
61,375
[ 0.6494140625, 0.043853759765625, -0.6279296875, -0.0753173828125, -0.63427734375, -0.2978515625, -0.2222900390625, -0.0064239501953125, -0.07769775390625, 0.78271484375, 0.59423828125, -0.23193359375, -0.058563232421875, -0.94384765625, -0.264892578125, -0.0828857421875, -0.469970703...
11
Provide tags and a correct Python 3 solution for this coding contest problem. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Tags: brute force, greedy Correct Solution: ``` x = int(input()) count = 0 for i in range(x): n1, n2, n3 = map(int, input().split()) if n1+n2+n3 > 1: count +=1 print(count) ```
61,721
[ 0.4736328125, -0.1002197265625, 0.07843017578125, 0.239013671875, -0.55224609375, -0.6455078125, -0.07733154296875, 0.1912841796875, 0.1558837890625, 0.712890625, 0.30419921875, -0.140869140625, 0.29833984375, -0.48681640625, -0.33935546875, 0.0694580078125, -0.5849609375, -0.93164...
11
Provide tags and a correct Python 3 solution for this coding contest problem. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Tags: brute force, greedy Correct Solution: ``` inp = input(str()) times = int(inp) list_one = list() while times>0: enter = input(str()) exp = enter.split(' ') list_one.append(exp) times-=1 count = 0 for element in list_one: if int(element[0]) + int(element[1]) + int(element[2]) >= 2: count += 1 else: continue print(count) ```
61,722
[ 0.43115234375, -0.09112548828125, 0.062042236328125, 0.2119140625, -0.59912109375, -0.623046875, -0.08477783203125, 0.1671142578125, 0.11590576171875, 0.6611328125, 0.28271484375, -0.201904296875, 0.3134765625, -0.6181640625, -0.435546875, -0.01219940185546875, -0.59765625, -0.8901...
11
Provide tags and a correct Python 3 solution for this coding contest problem. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Tags: brute force, greedy Correct Solution: ``` number=int(input()) arr=[] for i in range(number): s=input().split(' ') arr.append(s) count=0 for i in arr: tmp=sum([int(x) for x in i]) if tmp>1: count+=1 print(count) ```
61,723
[ 0.45947265625, -0.0679931640625, 0.09173583984375, 0.26220703125, -0.54150390625, -0.6533203125, -0.05181884765625, 0.1881103515625, 0.1634521484375, 0.6796875, 0.362548828125, -0.191162109375, 0.25341796875, -0.53662109375, -0.465087890625, 0.009796142578125, -0.5712890625, -0.895...
11
Provide tags and a correct Python 3 solution for this coding contest problem. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Tags: brute force, greedy Correct Solution: ``` n = int(input()) count = 0 if 1 <= n <= 1000: for i in range (1,n+1): a,b,c = map(int,input().split()) if a+b+c == 2 or a+b+c == 3: count+=1 print(count) ```
61,724
[ 0.48681640625, -0.1185302734375, 0.076171875, 0.265380859375, -0.533203125, -0.63623046875, -0.047943115234375, 0.1976318359375, 0.150146484375, 0.70947265625, 0.30712890625, -0.1673583984375, 0.277099609375, -0.501953125, -0.3671875, 0.03350830078125, -0.6103515625, -0.92724609375...
11
Provide tags and a correct Python 3 solution for this coding contest problem. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Tags: brute force, greedy Correct Solution: ``` n= int(input()) s = [] for _ in range(n): petya,vasya,tonya= map(int,input().split(" ")) s.append([petya,vasya,tonya]) l=0 for i in range(n): if((s[i][0]==1 and s[i][1]== 1) or (s[i][0]==1 and s[i][2]==1) or(s[i][1]==1 and s[i][2]==1)): l+=1 print(l) ```
61,725
[ 0.39013671875, -0.090576171875, 0.1146240234375, 0.291748046875, -0.5068359375, -0.63330078125, -0.052947998046875, 0.1884765625, 0.07550048828125, 0.69287109375, 0.344482421875, -0.156982421875, 0.2685546875, -0.52685546875, -0.32470703125, 0.10943603515625, -0.60595703125, -0.904...
11
Provide tags and a correct Python 3 solution for this coding contest problem. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Tags: brute force, greedy Correct Solution: ``` n=int(input()) count=0 while n: l=input() p=l.split(" ") count1=0 for x in p: if x=='1': count1+=1 if count1>=2: count+=1 n-=1 print(count) ```
61,726
[ 0.5126953125, -0.11846923828125, 0.1319580078125, 0.248779296875, -0.54052734375, -0.65283203125, -0.0147552490234375, 0.184814453125, 0.1951904296875, 0.72607421875, 0.3427734375, -0.1435546875, 0.3212890625, -0.498779296875, -0.392578125, 0.09454345703125, -0.57861328125, -0.9287...
11
Provide tags and a correct Python 3 solution for this coding contest problem. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Tags: brute force, greedy Correct Solution: ``` def moreThanTwo(arr): counter = 0 for num in arr: if num == 1: counter += 1 return counter >= 2 if __name__ == '__main__': n = int(input()) arr = [] for _ in range(n): str_arr = input().split(' ') a, b, c = int(str_arr[0]), int(str_arr[1]), int(str_arr[2]) arr.append([a, b, c]) ans = 0 for problem in arr: if moreThanTwo(problem): ans += 1 print(ans) ```
61,727
[ 0.423095703125, -0.0877685546875, 0.1202392578125, 0.265380859375, -0.55419921875, -0.67138671875, -0.03863525390625, 0.1776123046875, 0.10992431640625, 0.705078125, 0.349609375, -0.25439453125, 0.2392578125, -0.54638671875, -0.44921875, 0.0125732421875, -0.62109375, -0.90966796875...
11
Provide tags and a correct Python 3 solution for this coding contest problem. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Tags: brute force, greedy Correct Solution: ``` g=int(input()) c=0 for i in range(g): p,v,t=[int(x) for x in input().split()] if p+v+t>=2: c+=1 print(c) ```
61,728
[ 0.47119140625, -0.10369873046875, 0.150634765625, 0.272216796875, -0.5634765625, -0.6259765625, -0.052398681640625, 0.1832275390625, 0.1407470703125, 0.68212890625, 0.29736328125, -0.150634765625, 0.28369140625, -0.5029296875, -0.363037109375, 0.050933837890625, -0.57568359375, -0....
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Submitted Solution: ``` a = int(input()) s = 0 p = 0 for i in range(a): a , b, c = map(int, input().split()) if a == 1: p+=1 if b == 1: p+=1 if c == 1: p+=1 if p >= 2: s+=1 p = 0 print(s) ``` Yes
61,729
[ 0.5263671875, -0.06927490234375, -0.0256500244140625, 0.1883544921875, -0.580078125, -0.6396484375, -0.05706787109375, 0.40869140625, 0.00030303001403808594, 0.7529296875, 0.28564453125, -0.15673828125, 0.327880859375, -0.489990234375, -0.470947265625, -0.01546478271484375, -0.742187...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Submitted Solution: ``` n = int(input()) schetchik = 0 for i in range(n): r = map(int, input().split()) if sum(r) >= 2: schetchik += 1 print(schetchik) ``` Yes
61,730
[ 0.57666015625, -0.1129150390625, -0.122314453125, 0.2171630859375, -0.61572265625, -0.6435546875, -0.1551513671875, 0.36767578125, 0.008209228515625, 0.71240234375, 0.33544921875, -0.05267333984375, 0.364990234375, -0.49560546875, -0.3896484375, 0.042816162109375, -0.75439453125, -...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Submitted Solution: ``` n = int(input()) no = 0 for i in range(n): a, b, c = map(int, input().split()) if (a == 1 and b == 1) or (a == 1 and c == 1) or (b == 1 and c == 1): no += 1 print(no) ``` Yes
61,731
[ 0.53125, -0.05560302734375, -0.037200927734375, 0.1693115234375, -0.55810546875, -0.619140625, -0.06829833984375, 0.4013671875, 0.025787353515625, 0.76416015625, 0.261474609375, -0.1309814453125, 0.328857421875, -0.482666015625, -0.43359375, -0.043792724609375, -0.7421875, -0.93603...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Submitted Solution: ``` # cook your dish here n=int(input()) c=0 for i in range(0,n,1): a=[] a=list(map(int,input().split())) if(a.count(1)>=2): c=c+1 print(c) ``` Yes
61,732
[ 0.492919921875, -0.07281494140625, -0.0755615234375, 0.1455078125, -0.59814453125, -0.51416015625, -0.07501220703125, 0.424072265625, 0.09747314453125, 0.81201171875, 0.2607421875, -0.12548828125, 0.35205078125, -0.5087890625, -0.49755859375, 0.01416778564453125, -0.724609375, -0.9...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Submitted Solution: ``` for i in range(int(input())): s=list(map(int,input().rstrip().split())) print(s.count(1)) ``` No
61,733
[ 0.52490234375, -0.07568359375, -0.06414794921875, 0.164306640625, -0.59765625, -0.5908203125, -0.10943603515625, 0.40380859375, 0.05316162109375, 0.77734375, 0.29345703125, -0.15771484375, 0.3515625, -0.437744140625, -0.42724609375, -0.0325927734375, -0.734375, -0.9306640625, -0....
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Submitted Solution: ``` import math num_of_lines = input("Enter The Number Of Problems To Filter It ") i = 0 count = 0 while i < int(num_of_lines): a = input("Enter Value Of a, b, and c Respectivley ") i = i + 1 if a.count('1') >= 2: count += 1 print(count) ``` No
61,734
[ 0.50732421875, -0.07568359375, -0.039581298828125, 0.2166748046875, -0.572265625, -0.59033203125, -0.04644775390625, 0.406982421875, 0.061798095703125, 0.76953125, 0.2325439453125, -0.1365966796875, 0.343505859375, -0.45751953125, -0.5322265625, 0.006267547607421875, -0.77392578125, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Submitted Solution: ``` t = int(input()) cnt = 0 temp = [] length = 0 while t: n = list(map(int, input().split())) length = len(n) for x in n: cnt += x #print(cnt) if cnt == 2 or cnt == 3: temp.append(1) cnt=0 t -= 1 print(sum(temp)//2) ``` No
61,735
[ 0.52001953125, -0.051666259765625, 0.00572967529296875, 0.1937255859375, -0.425537109375, -0.5546875, -0.067626953125, 0.322509765625, 0.0139617919921875, 0.79150390625, 0.246826171875, -0.11407470703125, 0.3388671875, -0.587890625, -0.46142578125, -0.0132598876953125, -0.67236328125...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer n (1 ≀ n ≀ 1000) β€” the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces. Output Print a single integer β€” the number of problems the friends will implement on the contest. Examples Input 3 1 1 0 1 1 1 1 0 0 Output 2 Input 2 1 0 0 0 1 1 Output 1 Note In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution. Submitted Solution: ``` n = int(input()) n2 = [(input()) for i in range(n)] print(n2) solved = 0 for i in n2: if i.count("0") >= 2 : pass else: solved += 1 print(solved) ``` No
61,736
[ 0.53515625, -0.095703125, -0.08770751953125, 0.16943359375, -0.56884765625, -0.6005859375, -0.0487060546875, 0.426025390625, 0.06683349609375, 0.73681640625, 0.294189453125, -0.15283203125, 0.34130859375, -0.498291015625, -0.505859375, 0.0104522705078125, -0.7626953125, -0.93798828...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all. Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bid and bi is its size. Bids are given in chronological order, meaning bi < bi + 1 for all i < n. Moreover, participant never makes two bids in a row (no one updates his own bid), i.e. ai β‰  ai + 1 for all i < n. Now you are curious with the following question: who (and which bid) will win the auction if some participants were absent? Consider that if someone was absent, all his bids are just removed and no new bids are added. Note, that if during this imaginary exclusion of some participants it happens that some of the remaining participants makes a bid twice (or more times) in a row, only first of these bids is counted. For better understanding take a look at the samples. You have several questions in your mind, compute the answer for each of them. Input The first line of the input contains an integer n (1 ≀ n ≀ 200 000) β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi < bi + 1) β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q (1 ≀ q ≀ 200 000) β€” the number of question you have in mind. Each of next q lines contains an integer k (1 ≀ k ≀ n), followed by k integers lj (1 ≀ lj ≀ n) β€” the number of people who are not coming in this question and their indices. It is guarenteed that lj values are different for a single question. It's guaranteed that the sum of k over all question won't exceed 200 000. Output For each question print two integer β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes. Examples Input 6 1 10 2 100 3 1000 1 10000 2 100000 3 1000000 3 1 3 2 2 3 2 1 2 Output 2 100000 1 10 3 1000 Input 3 1 10 2 100 1 1000 2 2 1 2 2 2 3 Output 0 0 1 10 Note Consider the first sample: * In the first question participant number 3 is absent so the sequence of bids looks as follows: 1. 1 10 2. 2 100 3. 1 10 000 4. 2 100 000 Participant number 2 wins with the bid 100 000. * In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1. 1 10 2. 1 10 000 The winner is, of course, participant number 1 but the winning bid is 10 instead of 10 000 as no one will ever increase his own bid (in this problem). * In the third question participants 1 and 2 are absent and the sequence is: 1. 3 1 000 2. 3 1 000 000 The winner is participant 3 with the bid 1 000. Submitted Solution: ``` from collections import defaultdict import sys input = sys.stdin.readline import bisect n=int(input()) s=set() d=defaultdict(list) d[0].append(0) for i in range(n): x,y=map(int,input().split()) s.add(x) d[x].append(y) q=int(input()) for i in range(q): l=list(map(int,input().split())) s1=s.difference(set(l[1:])) if len(s1)==0: print(0,0) else: m1,m2=0,0 for i in s1: if d[i][-1]>d[m1][-1]: m2=m1 m1=i j=bisect.bisect_right(d[m1],d[m2][-1]) print(m1,d[m1][j]) ``` No
61,944
[ 0.026947021484375, 0.20654296875, -0.5126953125, 0.1898193359375, -0.349853515625, -0.54541015625, -0.253173828125, 0.1658935546875, 0.2236328125, 0.859375, 0.6728515625, 0.068603515625, -0.45263671875, -0.50927734375, -0.90478515625, -0.1644287109375, -0.541015625, -0.6064453125, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all. Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bid and bi is its size. Bids are given in chronological order, meaning bi < bi + 1 for all i < n. Moreover, participant never makes two bids in a row (no one updates his own bid), i.e. ai β‰  ai + 1 for all i < n. Now you are curious with the following question: who (and which bid) will win the auction if some participants were absent? Consider that if someone was absent, all his bids are just removed and no new bids are added. Note, that if during this imaginary exclusion of some participants it happens that some of the remaining participants makes a bid twice (or more times) in a row, only first of these bids is counted. For better understanding take a look at the samples. You have several questions in your mind, compute the answer for each of them. Input The first line of the input contains an integer n (1 ≀ n ≀ 200 000) β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi < bi + 1) β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q (1 ≀ q ≀ 200 000) β€” the number of question you have in mind. Each of next q lines contains an integer k (1 ≀ k ≀ n), followed by k integers lj (1 ≀ lj ≀ n) β€” the number of people who are not coming in this question and their indices. It is guarenteed that lj values are different for a single question. It's guaranteed that the sum of k over all question won't exceed 200 000. Output For each question print two integer β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes. Examples Input 6 1 10 2 100 3 1000 1 10000 2 100000 3 1000000 3 1 3 2 2 3 2 1 2 Output 2 100000 1 10 3 1000 Input 3 1 10 2 100 1 1000 2 2 1 2 2 2 3 Output 0 0 1 10 Note Consider the first sample: * In the first question participant number 3 is absent so the sequence of bids looks as follows: 1. 1 10 2. 2 100 3. 1 10 000 4. 2 100 000 Participant number 2 wins with the bid 100 000. * In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1. 1 10 2. 1 10 000 The winner is, of course, participant number 1 but the winning bid is 10 instead of 10 000 as no one will ever increase his own bid (in this problem). * In the third question participants 1 and 2 are absent and the sequence is: 1. 3 1 000 2. 3 1 000 000 The winner is participant 3 with the bid 1 000. Submitted Solution: ``` def upper_bound(l, v): lo = 0 hi = len(l) while lo <= hi: mi = (lo + hi) // 2 if v <= l[mi]: hi = mi - 1 else: lo = mi + 1 return l[lo] q = int(input()) price = {} state = {} for i in range(q): test = list(str(input()).split(' ')) index = int(test[0]) pri = int(test[1]) if index in price: price[index].append(pri) else: price[index] = [pri] state[index] = True quer = int(input()) for i in range(quer): k = list(str(input()).split(' ')) ss = [] for x in k: if x == 0: continue t = int(x) ss.append(t) state[t] = False index1 = 0 index2 = 0 price[0] = [0] for x in price: if x == 0: continue if state[x]: if price[x][-1] > price[index1][-1]: index2 = index1 index1 = x elif price[x][-1] > price[index2][-1]: index2 = x ans = upper_bound(price[index1], price[index2][-1]) print(index1, ans) for x in ss: state[x] = True ``` No
61,945
[ 0.026947021484375, 0.20654296875, -0.5126953125, 0.1898193359375, -0.349853515625, -0.54541015625, -0.253173828125, 0.1658935546875, 0.2236328125, 0.859375, 0.6728515625, 0.068603515625, -0.45263671875, -0.50927734375, -0.90478515625, -0.1644287109375, -0.541015625, -0.6064453125, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all. Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bid and bi is its size. Bids are given in chronological order, meaning bi < bi + 1 for all i < n. Moreover, participant never makes two bids in a row (no one updates his own bid), i.e. ai β‰  ai + 1 for all i < n. Now you are curious with the following question: who (and which bid) will win the auction if some participants were absent? Consider that if someone was absent, all his bids are just removed and no new bids are added. Note, that if during this imaginary exclusion of some participants it happens that some of the remaining participants makes a bid twice (or more times) in a row, only first of these bids is counted. For better understanding take a look at the samples. You have several questions in your mind, compute the answer for each of them. Input The first line of the input contains an integer n (1 ≀ n ≀ 200 000) β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi < bi + 1) β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q (1 ≀ q ≀ 200 000) β€” the number of question you have in mind. Each of next q lines contains an integer k (1 ≀ k ≀ n), followed by k integers lj (1 ≀ lj ≀ n) β€” the number of people who are not coming in this question and their indices. It is guarenteed that lj values are different for a single question. It's guaranteed that the sum of k over all question won't exceed 200 000. Output For each question print two integer β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes. Examples Input 6 1 10 2 100 3 1000 1 10000 2 100000 3 1000000 3 1 3 2 2 3 2 1 2 Output 2 100000 1 10 3 1000 Input 3 1 10 2 100 1 1000 2 2 1 2 2 2 3 Output 0 0 1 10 Note Consider the first sample: * In the first question participant number 3 is absent so the sequence of bids looks as follows: 1. 1 10 2. 2 100 3. 1 10 000 4. 2 100 000 Participant number 2 wins with the bid 100 000. * In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1. 1 10 2. 1 10 000 The winner is, of course, participant number 1 but the winning bid is 10 instead of 10 000 as no one will ever increase his own bid (in this problem). * In the third question participants 1 and 2 are absent and the sequence is: 1. 3 1 000 2. 3 1 000 000 The winner is participant 3 with the bid 1 000. Submitted Solution: ``` # ---------------------------iye ha aam zindegi--------------------------------------------- import math import random import heapq, bisect import sys from collections import deque, defaultdict from fractions import Fraction import sys import threading from collections import defaultdict threading.stack_size(10**8) mod = 10 ** 9 + 7 mod1 = 998244353 # ------------------------------warmup---------------------------- import os import sys from io import BytesIO, IOBase sys.setrecursionlimit(300000) BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writable else None def read(self): while True: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) if not b: break ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines = 0 return self.buffer.read() def readline(self): while self.newlines == 0: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) self.newlines = b.count(b"\n") + (not b) ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines -= 1 return self.buffer.readline() def flush(self): if self.writable: os.write(self._fd, self.buffer.getvalue()) self.buffer.truncate(0), self.buffer.seek(0) class IOWrapper(IOBase): def __init__(self, file): self.buffer = FastIO(file) self.flush = self.buffer.flush self.writable = self.buffer.writable self.write = lambda s: self.buffer.write(s.encode("ascii")) self.read = lambda: self.buffer.read().decode("ascii") self.readline = lambda: self.buffer.readline().decode("ascii") sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) input = lambda: sys.stdin.readline().rstrip("\r\n") # -------------------game starts now----------------------------------------------------import math class TreeNode: def __init__(self, k, v): self.key = k self.value = v self.left = None self.right = None self.parent = None self.height = 1 self.num_left = 1 self.num_total = 1 class AvlTree: def __init__(self): self._tree = None def add(self, k, v): if not self._tree: self._tree = TreeNode(k, v) return node = self._add(k, v) if node: self._rebalance(node) def _add(self, k, v): node = self._tree while node: if k < node.key: if node.left: node = node.left else: node.left = TreeNode(k, v) node.left.parent = node return node.left elif node.key < k: if node.right: node = node.right else: node.right = TreeNode(k, v) node.right.parent = node return node.right else: node.value = v return @staticmethod def get_height(x): return x.height if x else 0 @staticmethod def get_num_total(x): return x.num_total if x else 0 def _rebalance(self, node): n = node while n: lh = self.get_height(n.left) rh = self.get_height(n.right) n.height = max(lh, rh) + 1 balance_factor = lh - rh n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right) n.num_left = 1 + self.get_num_total(n.left) if balance_factor > 1: if self.get_height(n.left.left) < self.get_height(n.left.right): self._rotate_left(n.left) self._rotate_right(n) elif balance_factor < -1: if self.get_height(n.right.right) < self.get_height(n.right.left): self._rotate_right(n.right) self._rotate_left(n) else: n = n.parent def _remove_one(self, node): """ Side effect!!! Changes node. Node should have exactly one child """ replacement = node.left or node.right if node.parent: if AvlTree._is_left(node): node.parent.left = replacement else: node.parent.right = replacement replacement.parent = node.parent node.parent = None else: self._tree = replacement replacement.parent = None node.left = None node.right = None node.parent = None self._rebalance(replacement) def _remove_leaf(self, node): if node.parent: if AvlTree._is_left(node): node.parent.left = None else: node.parent.right = None self._rebalance(node.parent) else: self._tree = None node.parent = None node.left = None node.right = None def remove(self, k): node = self._get_node(k) if not node: return if AvlTree._is_leaf(node): self._remove_leaf(node) return if node.left and node.right: nxt = AvlTree._get_next(node) node.key = nxt.key node.value = nxt.value if self._is_leaf(nxt): self._remove_leaf(nxt) else: self._remove_one(nxt) self._rebalance(node) else: self._remove_one(node) def get(self, k): node = self._get_node(k) return node.value if node else -1 def _get_node(self, k): if not self._tree: return None node = self._tree while node: if k < node.key: node = node.left elif node.key < k: node = node.right else: return node return None def get_at(self, pos): x = pos + 1 node = self._tree while node: if x < node.num_left: node = node.left elif node.num_left < x: x -= node.num_left node = node.right else: return (node.key, node.value) raise IndexError("Out of ranges") @staticmethod def _is_left(node): return node.parent.left and node.parent.left == node @staticmethod def _is_leaf(node): return node.left is None and node.right is None def _rotate_right(self, node): if not node.parent: self._tree = node.left node.left.parent = None elif AvlTree._is_left(node): node.parent.left = node.left node.left.parent = node.parent else: node.parent.right = node.left node.left.parent = node.parent bk = node.left.right node.left.right = node node.parent = node.left node.left = bk if bk: bk.parent = node node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1 node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right) node.num_left = 1 + self.get_num_total(node.left) def _rotate_left(self, node): if not node.parent: self._tree = node.right node.right.parent = None elif AvlTree._is_left(node): node.parent.left = node.right node.right.parent = node.parent else: node.parent.right = node.right node.right.parent = node.parent bk = node.right.left node.right.left = node node.parent = node.right node.right = bk if bk: bk.parent = node node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1 node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right) node.num_left = 1 + self.get_num_total(node.left) @staticmethod def _get_next(node): if not node.right: return node.parent n = node.right while n.left: n = n.left return n # -----------------------------------------------binary seacrh tree--------------------------------------- class SegmentTree1: def __init__(self, data, default=2**51, func=lambda a, b: a & b): """initialize the segment tree with data""" self._default = default self._func = func self._len = len(data) self._size = _size = 1 << (self._len - 1).bit_length() self.data = [default] * (2 * _size) self.data[_size:_size + self._len] = data for i in reversed(range(_size)): self.data[i] = func(self.data[i + i], self.data[i + i + 1]) def __delitem__(self, idx): self[idx] = self._default def __getitem__(self, idx): return self.data[idx + self._size] def __setitem__(self, idx, value): idx += self._size self.data[idx] = value idx >>= 1 while idx: self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1]) idx >>= 1 def __len__(self): return self._len def query(self, start, stop): if start == stop: return self.__getitem__(start) stop += 1 start += self._size stop += self._size res = self._default while start < stop: if start & 1: res = self._func(res, self.data[start]) start += 1 if stop & 1: stop -= 1 res = self._func(res, self.data[stop]) start >>= 1 stop >>= 1 return res def __repr__(self): return "SegmentTree({0})".format(self.data) # -------------------game starts now----------------------------------------------------import math class SegmentTree: def __init__(self, data, default=-1, func=lambda a, b: max(a , b)): """initialize the segment tree with data""" self._default = default self._func = func self._len = len(data) self._size = _size = 1 << (self._len - 1).bit_length() self.data = [default] * (2 * _size) self.data[_size:_size + self._len] = data for i in reversed(range(_size)): self.data[i] = func(self.data[i + i], self.data[i + i + 1]) def __delitem__(self, idx): self[idx] = self._default def __getitem__(self, idx): return self.data[idx + self._size] def __setitem__(self, idx, value): idx += self._size self.data[idx] = value idx >>= 1 while idx: self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1]) idx >>= 1 def __len__(self): return self._len def query(self, start, stop): if start == stop: return self.__getitem__(start) stop += 1 start += self._size stop += self._size res = self._default while start < stop: if start & 1: res = self._func(res, self.data[start]) start += 1 if stop & 1: stop -= 1 res = self._func(res, self.data[stop]) start >>= 1 stop >>= 1 return res def __repr__(self): return "SegmentTree({0})".format(self.data) # -------------------------------iye ha chutiya zindegi------------------------------------- class Factorial: def __init__(self, MOD): self.MOD = MOD self.factorials = [1, 1] self.invModulos = [0, 1] self.invFactorial_ = [1, 1] def calc(self, n): if n <= -1: print("Invalid argument to calculate n!") print("n must be non-negative value. But the argument was " + str(n)) exit() if n < len(self.factorials): return self.factorials[n] nextArr = [0] * (n + 1 - len(self.factorials)) initialI = len(self.factorials) prev = self.factorials[-1] m = self.MOD for i in range(initialI, n + 1): prev = nextArr[i - initialI] = prev * i % m self.factorials += nextArr return self.factorials[n] def inv(self, n): if n <= -1: print("Invalid argument to calculate n^(-1)") print("n must be non-negative value. But the argument was " + str(n)) exit() p = self.MOD pi = n % p if pi < len(self.invModulos): return self.invModulos[pi] nextArr = [0] * (n + 1 - len(self.invModulos)) initialI = len(self.invModulos) for i in range(initialI, min(p, n + 1)): next = -self.invModulos[p % i] * (p // i) % p self.invModulos.append(next) return self.invModulos[pi] def invFactorial(self, n): if n <= -1: print("Invalid argument to calculate (n^(-1))!") print("n must be non-negative value. But the argument was " + str(n)) exit() if n < len(self.invFactorial_): return self.invFactorial_[n] self.inv(n) # To make sure already calculated n^-1 nextArr = [0] * (n + 1 - len(self.invFactorial_)) initialI = len(self.invFactorial_) prev = self.invFactorial_[-1] p = self.MOD for i in range(initialI, n + 1): prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p self.invFactorial_ += nextArr return self.invFactorial_[n] class Combination: def __init__(self, MOD): self.MOD = MOD self.factorial = Factorial(MOD) def ncr(self, n, k): if k < 0 or n < k: return 0 k = min(k, n - k) f = self.factorial return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD # --------------------------------------iye ha combinations ka zindegi--------------------------------- def powm(a, n, m): if a == 1 or n == 0: return 1 if n % 2 == 0: s = powm(a, n // 2, m) return s * s % m else: return a * powm(a, n - 1, m) % m # --------------------------------------iye ha power ka zindegi--------------------------------- def sort_list(list1, list2): zipped_pairs = zip(list2, list1) z = [x for _, x in sorted(zipped_pairs)] return z # --------------------------------------------------product---------------------------------------- def product(l): por = 1 for i in range(len(l)): por *= l[i] return por # --------------------------------------------------binary---------------------------------------- def binarySearchCount(arr, n, key): left = 0 right = n - 1 count = 0 while (left <= right): mid = int((right + left) / 2) # Check if middle element is # less than or equal to key if (arr[mid] < key): count = mid + 1 left = mid + 1 # If key is smaller, ignore right half else: right = mid - 1 return count # --------------------------------------------------binary---------------------------------------- def countdig(n): c = 0 while (n > 0): n //= 10 c += 1 return c def binary(x, length): y = bin(x)[2:] return y if len(y) >= length else "0" * (length - len(y)) + y def countGreater(arr, n, k): l = 0 r = n - 1 # Stores the index of the left most element # from the array which is greater than k leftGreater = n # Finds number of elements greater than k while (l <= r): m = int(l + (r - l) / 2) if (arr[m] >= k): leftGreater = m r = m - 1 # If mid element is less than # or equal to k update l else: l = m + 1 # Return the count of elements # greater than k return (n - leftGreater) # --------------------------------------------------binary------------------------------------ n=int(input()) w=defaultdict(int) d=defaultdict(list) cost=[0]*n ma=[-1]*(n+1) for i in range(n): a,b=map(int,input().split()) d[a].append(i) w[i]=a cost[i]=b for i in d: ma[i]=d[i][-1] s=SegmentTree(ma) q=int(input()) for i in range(q): l=list(map(int,input().split())) k=l[0] l=l[1:] l.append(n) l.sort() m=-1 last=0 for j in range(k+1): m=max(m,s.query(last,l[j]-1)) last=l[j]+1 if m==-1: print(0,0) continue ind=w[m] l.append(ind) l.sort() m1=-1 last=0 for j in range(k+2): m1 = max(m1, s.query(last, l[j] - 1)) last = l[j] + 1 x=binarySearchCount(d[ind],len(d[ind]),m1) print(ind,cost[d[ind][x]]) ``` No
61,946
[ 0.026947021484375, 0.20654296875, -0.5126953125, 0.1898193359375, -0.349853515625, -0.54541015625, -0.253173828125, 0.1658935546875, 0.2236328125, 0.859375, 0.6728515625, 0.068603515625, -0.45263671875, -0.50927734375, -0.90478515625, -0.1644287109375, -0.541015625, -0.6064453125, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all. Each bid is define by two integers (ai, bi), where ai is the index of the person, who made this bid and bi is its size. Bids are given in chronological order, meaning bi < bi + 1 for all i < n. Moreover, participant never makes two bids in a row (no one updates his own bid), i.e. ai β‰  ai + 1 for all i < n. Now you are curious with the following question: who (and which bid) will win the auction if some participants were absent? Consider that if someone was absent, all his bids are just removed and no new bids are added. Note, that if during this imaginary exclusion of some participants it happens that some of the remaining participants makes a bid twice (or more times) in a row, only first of these bids is counted. For better understanding take a look at the samples. You have several questions in your mind, compute the answer for each of them. Input The first line of the input contains an integer n (1 ≀ n ≀ 200 000) β€” the number of participants and bids. Each of the following n lines contains two integers ai and bi (1 ≀ ai ≀ n, 1 ≀ bi ≀ 109, bi < bi + 1) β€” the number of participant who made the i-th bid and the size of this bid. Next line contains an integer q (1 ≀ q ≀ 200 000) β€” the number of question you have in mind. Each of next q lines contains an integer k (1 ≀ k ≀ n), followed by k integers lj (1 ≀ lj ≀ n) β€” the number of people who are not coming in this question and their indices. It is guarenteed that lj values are different for a single question. It's guaranteed that the sum of k over all question won't exceed 200 000. Output For each question print two integer β€” the index of the winner and the size of the winning bid. If there is no winner (there are no remaining bids at all), print two zeroes. Examples Input 6 1 10 2 100 3 1000 1 10000 2 100000 3 1000000 3 1 3 2 2 3 2 1 2 Output 2 100000 1 10 3 1000 Input 3 1 10 2 100 1 1000 2 2 1 2 2 2 3 Output 0 0 1 10 Note Consider the first sample: * In the first question participant number 3 is absent so the sequence of bids looks as follows: 1. 1 10 2. 2 100 3. 1 10 000 4. 2 100 000 Participant number 2 wins with the bid 100 000. * In the second question participants 2 and 3 are absent, so the sequence of bids looks: 1. 1 10 2. 1 10 000 The winner is, of course, participant number 1 but the winning bid is 10 instead of 10 000 as no one will ever increase his own bid (in this problem). * In the third question participants 1 and 2 are absent and the sequence is: 1. 3 1 000 2. 3 1 000 000 The winner is participant 3 with the bid 1 000. Submitted Solution: ``` n = int(input()) data = list(reversed([list(map(int, input().split())) for i in range(n)])) k = int(input()) for i in range(k): q = list(map(int, input().split())) q.pop(0) q = set(q) xx = 0 yy = 0 for x, y in filter(lambda v: v[0] not in q, data): if not xx: xx = x yy = y elif x == xx: yy = y else: break print(xx, yy) ``` No
61,947
[ 0.026947021484375, 0.20654296875, -0.5126953125, 0.1898193359375, -0.349853515625, -0.54541015625, -0.253173828125, 0.1658935546875, 0.2236328125, 0.859375, 0.6728515625, 0.068603515625, -0.45263671875, -0.50927734375, -0.90478515625, -0.1644287109375, -0.541015625, -0.6064453125, ...
11
Provide a correct Python 3 solution for this coding contest problem. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 "Correct Solution: ``` x,y = map(int,input().split()) k = [0,3,2,1] + [0]*1000 ans = k[x]+k[y] if x == y == 1: ans += 4 print(ans*100000) ```
62,061
[ 0.4462890625, 0.20361328125, -0.471435546875, 0.215087890625, -0.60400390625, -0.344970703125, 0.033966064453125, 0.2939453125, 0.2340087890625, 0.94482421875, 0.71337890625, 0.02362060546875, 0.031829833984375, -0.58349609375, -0.355224609375, -0.041961669921875, -0.489501953125, ...
11
Provide a correct Python 3 solution for this coding contest problem. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 "Correct Solution: ``` x, y = map(int, input().split()) ans = max(-x + 4, 0) + max(-y + 4, 0) print(ans * 10**5 if ans != 6 else 10**6) ```
62,063
[ 0.43017578125, 0.200927734375, -0.439697265625, 0.239990234375, -0.6142578125, -0.33447265625, 0.078369140625, 0.334228515625, 0.218505859375, 0.94140625, 0.6826171875, 0.049285888671875, 0.036468505859375, -0.58642578125, -0.3642578125, -0.0699462890625, -0.51220703125, -0.7910156...
11
Provide a correct Python 3 solution for this coding contest problem. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 "Correct Solution: ``` x,y=map(int,input().split()) if(x==y==1): print(1000000) else: ans=max(4-x,0)*100000+max(4-y,0)*100000 print(ans) ```
62,064
[ 0.44580078125, 0.1834716796875, -0.45068359375, 0.27197265625, -0.6005859375, -0.342041015625, 0.07891845703125, 0.316162109375, 0.2337646484375, 0.92724609375, 0.70703125, 0.06134033203125, 0.056396484375, -0.5908203125, -0.3798828125, -0.08892822265625, -0.49072265625, -0.7910156...
11
Provide a correct Python 3 solution for this coding contest problem. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 "Correct Solution: ``` x,y=map(int,input().split()) ans=max(0,4-x)+max(0,4-y) if ans==6: ans+=4 print(ans*100000) ```
62,065
[ 0.4404296875, 0.1912841796875, -0.43603515625, 0.2308349609375, -0.59423828125, -0.341552734375, 0.095703125, 0.33935546875, 0.2469482421875, 0.96337890625, 0.71337890625, 0.039306640625, 0.04095458984375, -0.5576171875, -0.358154296875, -0.059906005859375, -0.51806640625, -0.78369...
11
Provide a correct Python 3 solution for this coding contest problem. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 "Correct Solution: ``` X, Y = map(int, input().split()) ans = 0 if X <= 3: ans += 4 - X if Y <= 3: ans += 4 - Y if X == 1 and Y == 1: ans += 4 ans *= 100000 print(ans) ```
62,066
[ 0.432861328125, 0.18310546875, -0.464111328125, 0.21630859375, -0.603515625, -0.319580078125, 0.0804443359375, 0.313720703125, 0.253173828125, 0.94384765625, 0.72509765625, 0.005680084228515625, 0.041717529296875, -0.5537109375, -0.375244140625, -0.07391357421875, -0.491455078125, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 Submitted Solution: ``` X, Y = map(int, input().split()) ans = max(4 - X, 0) + max(4 - Y, 0) + max(12 - (X + Y) * 4, 0) print(ans * 100000) ``` Yes
62,069
[ 0.54150390625, 0.229736328125, -0.4140625, 0.265625, -0.55810546875, -0.31396484375, 0.01508331298828125, 0.331787109375, 0.1949462890625, 0.8974609375, 0.60400390625, 0.10955810546875, 0.01110076904296875, -0.53857421875, -0.3408203125, -0.099609375, -0.419189453125, -0.7866210937...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 Submitted Solution: ``` x, y = map(int, input().split()) ans = 0 ans += max((4-x)*100000, 0) ans += max((4-y)*100000, 0) print(ans+400000 if x == 1 and y == 1 else ans) ``` Yes
62,070
[ 0.5224609375, 0.23046875, -0.40673828125, 0.267822265625, -0.55517578125, -0.309814453125, 0.034912109375, 0.320556640625, 0.210205078125, 0.9189453125, 0.61181640625, 0.09405517578125, 0.01407623291015625, -0.5322265625, -0.360595703125, -0.11181640625, -0.41064453125, -0.77441406...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 Submitted Solution: ``` x,y=map(int,input().split()) ans=0 ans+=max(4-x,0)*100000 ans+=max(4-y,0)*100000 if x==1 and y==1: ans+=400000 print(ans) ``` Yes
62,071
[ 0.5224609375, 0.2342529296875, -0.41748046875, 0.263427734375, -0.55419921875, -0.313232421875, 0.031280517578125, 0.3154296875, 0.21044921875, 0.92333984375, 0.6220703125, 0.09930419921875, 0.004627227783203125, -0.52001953125, -0.359130859375, -0.10443115234375, -0.397705078125, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 Submitted Solution: ``` x, y = map(int, input().split()) sum = 0 if x < 4: sum += (4-x) * 100000 if y < 4: sum += (4-y) * 100000 if x == 1 and y == 1: sum += 4 * 100000 print(sum) ``` Yes
62,072
[ 0.51708984375, 0.2469482421875, -0.423583984375, 0.2626953125, -0.525390625, -0.307373046875, 0.026824951171875, 0.330078125, 0.1978759765625, 0.90771484375, 0.630859375, 0.09716796875, -0.00838470458984375, -0.54248046875, -0.38525390625, -0.11279296875, -0.406005859375, -0.791015...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 Submitted Solution: ``` a,b = map(int,input().split()) if a+b==2: print(1000000) else: ans =0 if a<=3: ans+= (4-a)*100000 if b<=3: ans+= (4-a)*100000 print(ans) ``` No
62,073
[ 0.513671875, 0.2144775390625, -0.4375, 0.2459716796875, -0.5400390625, -0.31787109375, 0.055206298828125, 0.330810546875, 0.1710205078125, 0.939453125, 0.66015625, 0.06744384765625, -0.0242156982421875, -0.544921875, -0.380615234375, -0.1182861328125, -0.397705078125, -0.7763671875...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 Submitted Solution: ``` from sys import stdin X,Y = [int(x) for x in stdin.readline().rstrip().split()] if X == 1 and Y == 1: print(300000*2 + 400000) elif X == 1 or Y == 1: print(300000) elif X == 2 or Y == 2: print(200000) elif X == 3 or Y == 3: print(100000) else: print(0) ``` No
62,074
[ 0.488525390625, 0.187744140625, -0.3330078125, 0.254150390625, -0.6044921875, -0.299072265625, 0.017059326171875, 0.300048828125, 0.18115234375, 0.943359375, 0.6171875, 0.054168701171875, -0.08428955078125, -0.52734375, -0.371826171875, -0.131591796875, -0.408935546875, -0.81982421...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 Submitted Solution: ``` X, Y = map(int, input().split()) prices = {1: 300000, 2: 200000, 3: 1000000} ans = 0 if X < 4: ans += prices[X] if Y < 4: ans += prices[Y] if Y == 1 and X == 1: ans += 400000 print(ans) ``` No
62,075
[ 0.4677734375, 0.248291015625, -0.40869140625, 0.222900390625, -0.5166015625, -0.33154296875, 0.0399169921875, 0.33740234375, 0.1690673828125, 0.91748046875, 0.65966796875, 0.1068115234375, -0.0279388427734375, -0.548828125, -0.364501953125, -0.1038818359375, -0.419677734375, -0.772...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. Constraints * 1 \leq X \leq 205 * 1 \leq Y \leq 205 * X and Y are integers. Input Input is given from Standard Input in the following format: X Y Output Print the amount of money DISCO-Kun earned, as an integer. Examples Input 1 1 Output 1000000 Input 3 101 Output 100000 Input 4 4 Output 0 Submitted Solution: ``` x,y = map(int,input().split()) if x + y == 2: print(1000000) elif x + y == 3: print(500000) elif x + y == 5: print(300000) elif x + y == 4: print(400000) elif x + y == 6: print(200000) elif x + y >=5 and min(x,y) == 1: print(300000) elif x + y >=5 and min(x,y) == 2: print(200000) elif x + y >=5 and min(x,y) == 3: print(1000000000) else: print(0) ``` No
62,076
[ 0.546875, 0.2176513671875, -0.421875, 0.26220703125, -0.59033203125, -0.341064453125, 0.06939697265625, 0.36279296875, 0.197998046875, 0.890625, 0.60302734375, 0.07586669921875, -0.00807952880859375, -0.5478515625, -0.403076171875, -0.173583984375, -0.41845703125, -0.794921875, -...
11
Provide a correct Python 3 solution for this coding contest problem. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 "Correct Solution: ``` n=int(input()) li=list(map(int,input().split())) li.sort() print(li[n//2]-li[n//2-1]) ```
62,077
[ 0.54296875, 0.125244140625, -0.12744140625, -0.212646484375, -0.830078125, -0.364990234375, 0.044158935546875, 0.234375, -0.0155487060546875, 1.1416015625, 0.630859375, -0.03973388671875, 0.33740234375, -0.60986328125, -0.50732421875, 0.0654296875, -0.7841796875, -0.900390625, -0...
11
Provide a correct Python 3 solution for this coding contest problem. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 "Correct Solution: ``` n=int(input()) ds=list(map(int,input().split())) ds.sort() print(ds[n//2]-ds[n//2-1]) ```
62,078
[ 0.53271484375, 0.1248779296875, -0.12548828125, -0.2318115234375, -0.83203125, -0.35498046875, 0.0153045654296875, 0.21337890625, -0.036834716796875, 1.1689453125, 0.625, -0.06793212890625, 0.3203125, -0.61083984375, -0.499267578125, 0.029998779296875, -0.78662109375, -0.9125976562...
11
Provide a correct Python 3 solution for this coding contest problem. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 "Correct Solution: ``` n = int(input()) t = sorted(list(map(int, input().split()))) print(t[n//2] - t[n//2 - 1]) ```
62,079
[ 0.5576171875, 0.10009765625, -0.1241455078125, -0.2144775390625, -0.80224609375, -0.373779296875, 0.052825927734375, 0.203857421875, -0.04742431640625, 1.1533203125, 0.59619140625, -0.066162109375, 0.302734375, -0.64892578125, -0.5166015625, 0.045501708984375, -0.76025390625, -0.93...
11
Provide a correct Python 3 solution for this coding contest problem. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 "Correct Solution: ``` n=int(input()) d=sorted(list(map(int,input().split()))) ans=d[n//2]-d[n//2-1] print(ans) ```
62,080
[ 0.54736328125, 0.09490966796875, -0.10601806640625, -0.2098388671875, -0.81005859375, -0.3681640625, 0.05706787109375, 0.199951171875, -0.04498291015625, 1.150390625, 0.63330078125, -0.087890625, 0.293212890625, -0.64404296875, -0.5185546875, 0.0643310546875, -0.77685546875, -0.921...
11
Provide a correct Python 3 solution for this coding contest problem. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 "Correct Solution: ``` n=int(input()) L=sorted(list(map(int,input().split()))) print(L[n//2]-L[n//2-1]) ```
62,081
[ 0.560546875, 0.098876953125, -0.11724853515625, -0.210693359375, -0.798828125, -0.37255859375, 0.0601806640625, 0.2056884765625, -0.039703369140625, 1.15625, 0.61376953125, -0.058685302734375, 0.3046875, -0.64697265625, -0.52392578125, 0.07196044921875, -0.78076171875, -0.947265625...
11
Provide a correct Python 3 solution for this coding contest problem. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 "Correct Solution: ``` N = int(input()) d = list(sorted(map(int, input().split()))) print(d[N//2] - d[(N//2)-1]) ```
62,082
[ 0.54736328125, 0.11248779296875, -0.1080322265625, -0.2044677734375, -0.8154296875, -0.386474609375, 0.05767822265625, 0.2010498046875, -0.03912353515625, 1.1484375, 0.62939453125, -0.056427001953125, 0.30615234375, -0.623046875, -0.517578125, 0.059417724609375, -0.78759765625, -0....
11
Provide a correct Python 3 solution for this coding contest problem. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 "Correct Solution: ``` N=int(input()) d=list(map(int,input().split())) d.sort() ans=d[N//2]-d[N//2-1] print(ans) ```
62,083
[ 0.5322265625, 0.101318359375, -0.1217041015625, -0.2381591796875, -0.81787109375, -0.364501953125, 0.0479736328125, 0.198974609375, -0.033294677734375, 1.1474609375, 0.62158203125, -0.08038330078125, 0.31884765625, -0.62109375, -0.50732421875, 0.04949951171875, -0.767578125, -0.910...
11
Provide a correct Python 3 solution for this coding contest problem. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 "Correct Solution: ``` N=int(input()) d=list(map(int,input().split())) d.sort() l=d[N//2-1] r=d[N//2] print(r-l) ```
62,084
[ 0.5361328125, 0.0931396484375, -0.12158203125, -0.2366943359375, -0.8046875, -0.361328125, 0.06085205078125, 0.1920166015625, -0.05584716796875, 1.1513671875, 0.611328125, -0.0596923828125, 0.308349609375, -0.6142578125, -0.489013671875, 0.050018310546875, -0.77880859375, -0.926757...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 Submitted Solution: ``` n=int(input()) *a,=sorted(map(int,input().split())) m=len(a)//2 print(a[m]-a[m-1]) ``` Yes
62,085
[ 0.58935546875, 0.17626953125, -0.137451171875, -0.10540771484375, -0.771484375, -0.294189453125, -0.00272369384765625, 0.118408203125, -0.029510498046875, 1.1416015625, 0.58447265625, -0.03619384765625, 0.135009765625, -0.64013671875, -0.50634765625, -0.00673675537109375, -0.64208984...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 Submitted Solution: ``` n=int(input()) d=list(map(int,input().split())) d.sort() print(d[(n//2)]-d[(n//2)-1]) ``` Yes
62,086
[ 0.541015625, 0.1507568359375, -0.1317138671875, -0.1053466796875, -0.79833984375, -0.288818359375, -0.0114593505859375, 0.1580810546875, -0.01129150390625, 1.140625, 0.556640625, -0.052886962890625, 0.15478515625, -0.61181640625, -0.492919921875, -0.04425048828125, -0.65625, -0.866...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 Submitted Solution: ``` N, *A = map(int, open(0).read().split()) A.sort() ans = A[N//2] - A[N//2-1] print(ans) ``` Yes
62,087
[ 0.5673828125, 0.161376953125, -0.1297607421875, -0.10614013671875, -0.7607421875, -0.2880859375, -0.0259857177734375, 0.125732421875, -0.02642822265625, 1.1552734375, 0.57177734375, -0.060333251953125, 0.1727294921875, -0.6025390625, -0.4912109375, -0.040252685546875, -0.64892578125,...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 Submitted Solution: ``` n=int(input()) d=list(map(int,input().split())) d=sorted(d) m=n//2 print(d[m]-d[m-1]) ``` Yes
62,088
[ 0.56591796875, 0.17529296875, -0.129150390625, -0.09307861328125, -0.78515625, -0.292724609375, -0.01018524169921875, 0.1365966796875, -0.01505279541015625, 1.1357421875, 0.58203125, -0.03631591796875, 0.1591796875, -0.6318359375, -0.51123046875, -0.00876617431640625, -0.642578125, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 Submitted Solution: ``` num = int(input()) seq = input().split() sequence = [int(i) for i in seq] count = 0 max_dif = max(sequence) for i in range(max_dif): a, b = 0, 0 for item in sequence: if item>=i: a+=1 else: b+=1 if a==b: count+=1 print(count) ``` No
62,089
[ 0.48681640625, 0.1573486328125, -0.03839111328125, -0.0196533203125, -0.7158203125, -0.332275390625, -0.12347412109375, 0.073486328125, 0.037384033203125, 1.1748046875, 0.457275390625, -0.01971435546875, 0.158935546875, -0.63818359375, -0.51123046875, -0.03619384765625, -0.6821289062...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 Submitted Solution: ``` N = int(input()) value = list(map(int,input().split())) value.sort() print(value) print(value[(int(N/2))]-value[(int(N/2))-1]) ``` No
62,090
[ 0.54296875, 0.1485595703125, -0.140380859375, -0.08447265625, -0.791015625, -0.314453125, 0.014312744140625, 0.1583251953125, -0.018218994140625, 1.1162109375, 0.56103515625, -0.0404052734375, 0.1904296875, -0.5966796875, -0.489013671875, -0.0362548828125, -0.6591796875, -0.8784179...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 Submitted Solution: ``` import numpy as np n = int(input()) d = [int(i) for i in input().split(" ")] uni = np.unique(d) co = [d.count(i) for i in uni] tm = 0 for i in range(n): tm += co[i] if tm == n//2: print(uni[i+1]-uni[i]) break if tm > n//2: print(0) break ``` No
62,091
[ 0.53662109375, 0.11944580078125, -0.1689453125, -0.12371826171875, -0.79150390625, -0.293212890625, 0.031707763671875, 0.09295654296875, 0.0537109375, 1.115234375, 0.5849609375, 0.00455474853515625, 0.22607421875, -0.638671875, -0.5498046875, 0.01171875, -0.6201171875, -0.926269531...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be for ARCs. * A problem with difficulty lower than K will be for ABCs. How many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same? * 2 \leq N \leq 10^5 * N is an even number. * 1 \leq d_i \leq 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: N d_1 d_2 ... d_N Output Print the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same. Examples Input 6 9 1 4 4 6 7 Output 2 Input 8 9 1 14 5 5 4 4 14 Output 0 Input 14 99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 Output 42685 Submitted Solution: ``` n = int(input()) a = tuple(map(int,input().split())) a = sorted(a) print(a[n//2+1]-a[n//2]) ``` No
62,092
[ 0.611328125, 0.161376953125, -0.1473388671875, -0.08074951171875, -0.828125, -0.379638671875, 0.0094146728515625, 0.1162109375, -0.03363037109375, 1.14453125, 0.59033203125, -0.048248291015625, 0.171142578125, -0.61328125, -0.509765625, -0.005645751953125, -0.65576171875, -0.897949...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. Constraints * 1 \leq N \leq 10^5 * 1 \leq A_i \leq 10^9(1\leq i\leq N) * 0 \leq B_i \leq 10^9(1\leq i\leq N) * If i β‰  j, A_i β‰  A_j. * There exists a possible outcome of the game that are consistent with the facts. * All input values are integers. Inputs Input is given from Standard Input in the following format: N A_1 B_1 : A_N B_N Outputs Print the maximum possible number of players in the game. Examples Input 3 4 7 2 9 6 2 Output 8 Input 5 1 10 3 6 5 2 4 4 2 8 Output 7 Input 2 1 1000000000 1000000000 1 Output 1000000001 Submitted Solution: ``` _,*A=map(int,open(0).read().split());print(min(A[1::2])+max(A[::2])) ``` Yes
62,149
[ 0.64453125, 0.309326171875, -0.24365234375, 0.48388671875, -0.3974609375, -0.55126953125, -0.31005859375, 0.0278472900390625, 0.134521484375, 0.96630859375, 0.481689453125, 0.0212860107421875, 0.337646484375, -0.671875, -0.488525390625, -0.0306854248046875, -0.716796875, -0.7680664...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. Constraints * 1 \leq N \leq 10^5 * 1 \leq A_i \leq 10^9(1\leq i\leq N) * 0 \leq B_i \leq 10^9(1\leq i\leq N) * If i β‰  j, A_i β‰  A_j. * There exists a possible outcome of the game that are consistent with the facts. * All input values are integers. Inputs Input is given from Standard Input in the following format: N A_1 B_1 : A_N B_N Outputs Print the maximum possible number of players in the game. Examples Input 3 4 7 2 9 6 2 Output 8 Input 5 1 10 3 6 5 2 4 4 2 8 Output 7 Input 2 1 1000000000 1000000000 1 Output 1000000001 Submitted Solution: ``` N=int(input()) AB=[] for i in range(N): a,b=map(int,input().split()) AB.append([a,b]) AB.sort() print(AB[-1][0]+AB[-1][1]) ``` Yes
62,150
[ 0.63232421875, 0.2366943359375, -0.2294921875, 0.450439453125, -0.439208984375, -0.5048828125, -0.324462890625, 0.076171875, 0.20068359375, 0.9892578125, 0.47998046875, -0.045135498046875, 0.3447265625, -0.69970703125, -0.434326171875, -0.04119873046875, -0.71875, -0.7880859375, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. Constraints * 1 \leq N \leq 10^5 * 1 \leq A_i \leq 10^9(1\leq i\leq N) * 0 \leq B_i \leq 10^9(1\leq i\leq N) * If i β‰  j, A_i β‰  A_j. * There exists a possible outcome of the game that are consistent with the facts. * All input values are integers. Inputs Input is given from Standard Input in the following format: N A_1 B_1 : A_N B_N Outputs Print the maximum possible number of players in the game. Examples Input 3 4 7 2 9 6 2 Output 8 Input 5 1 10 3 6 5 2 4 4 2 8 Output 7 Input 2 1 1000000000 1000000000 1 Output 1000000001 Submitted Solution: ``` N = int(input()) AB = [[int(i) for i in input().split()] for _ in range(N)] AB.sort() print(sum(AB[-1])) ``` Yes
62,151
[ 0.65087890625, 0.2279052734375, -0.2364501953125, 0.45361328125, -0.4111328125, -0.47802734375, -0.28125, 0.09967041015625, 0.25146484375, 0.94677734375, 0.477783203125, -0.044677734375, 0.341552734375, -0.720703125, -0.50048828125, -0.039886474609375, -0.73974609375, -0.7666015625...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. Constraints * 1 \leq N \leq 10^5 * 1 \leq A_i \leq 10^9(1\leq i\leq N) * 0 \leq B_i \leq 10^9(1\leq i\leq N) * If i β‰  j, A_i β‰  A_j. * There exists a possible outcome of the game that are consistent with the facts. * All input values are integers. Inputs Input is given from Standard Input in the following format: N A_1 B_1 : A_N B_N Outputs Print the maximum possible number of players in the game. Examples Input 3 4 7 2 9 6 2 Output 8 Input 5 1 10 3 6 5 2 4 4 2 8 Output 7 Input 2 1 1000000000 1000000000 1 Output 1000000001 Submitted Solution: ``` n = int(input()) ab = list(list(map(int,input().split())) for _ in range(n)) ab.sort() print(ab[-1][0]+ab[-1][1]) ``` Yes
62,152
[ 0.650390625, 0.239990234375, -0.216064453125, 0.4443359375, -0.43115234375, -0.48486328125, -0.304931640625, 0.1024169921875, 0.225341796875, 0.9873046875, 0.4853515625, -0.037841796875, 0.3828125, -0.71240234375, -0.453857421875, -0.0286102294921875, -0.72119140625, -0.76171875, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. Constraints * 1 \leq N \leq 10^5 * 1 \leq A_i \leq 10^9(1\leq i\leq N) * 0 \leq B_i \leq 10^9(1\leq i\leq N) * If i β‰  j, A_i β‰  A_j. * There exists a possible outcome of the game that are consistent with the facts. * All input values are integers. Inputs Input is given from Standard Input in the following format: N A_1 B_1 : A_N B_N Outputs Print the maximum possible number of players in the game. Examples Input 3 4 7 2 9 6 2 Output 8 Input 5 1 10 3 6 5 2 4 4 2 8 Output 7 Input 2 1 1000000000 1000000000 1 Output 1000000001 Submitted Solution: ``` N = int(input()) ab = [] for i in range(N): ab.append(tuple(map(int,input().split()))) ans = N mx = max(ab,key=lambda x:x[1])[0] ans += mx - 1 mn = min(ab,key=lambda x:x[1])[1] ans += mn print(ans) ``` No
62,153
[ 0.64892578125, 0.27294921875, -0.1669921875, 0.457275390625, -0.50341796875, -0.5830078125, -0.321533203125, -0.00832366943359375, 0.1636962890625, 1.0517578125, 0.5322265625, 0.03948974609375, 0.31494140625, -0.63720703125, -0.44775390625, 0.050048828125, -0.6904296875, -0.8037109...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. Constraints * 1 \leq N \leq 10^5 * 1 \leq A_i \leq 10^9(1\leq i\leq N) * 0 \leq B_i \leq 10^9(1\leq i\leq N) * If i β‰  j, A_i β‰  A_j. * There exists a possible outcome of the game that are consistent with the facts. * All input values are integers. Inputs Input is given from Standard Input in the following format: N A_1 B_1 : A_N B_N Outputs Print the maximum possible number of players in the game. Examples Input 3 4 7 2 9 6 2 Output 8 Input 5 1 10 3 6 5 2 4 4 2 8 Output 7 Input 2 1 1000000000 1000000000 1 Output 1000000001 Submitted Solution: ``` #!user/bin/env python # coding:utf-8 n = int(input()) info = [] for i in range(n): ai = int(input()) bi = int(input()) info.append([ai, bi]) info = sorted(info, key=lambda inf: inf[1]) imp = info[0][0] + info[0][1] print(imp) ``` No
62,154
[ 0.5791015625, 0.26708984375, -0.319091796875, 0.389404296875, -0.434814453125, -0.64453125, -0.278564453125, 0.003955841064453125, 0.1710205078125, 1.0029296875, 0.447998046875, 0.01507568359375, 0.1612548828125, -0.62060546875, -0.46142578125, -0.032623291015625, -0.7060546875, -0...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This problem was deleted from the contest, because it was used previously at another competition. Input Output Examples Input 1 1 1 2 100 Output 6 Submitted Solution: ``` n, m = map(int, input().split()) l, r, p = map(int, input().split()) def gcd(x,y): if x == 0 or y == 0: return max(x, y) elif x > y: return gcd(y, x % y) elif x < y: return gcd(x, y % x) else: return x # опрСдСляСм Π²ΠΎΠ·ΠΌΠΎΠΆΠ½Ρ‹Π΅ Π²Π΅ΠΊΡ‚ΠΎΡ€Π° наблюдСния basis_vectors = set() vectors = [] for i in range(1, r + 1): for j in range(r + 1): k = gcd(i, j) x = i // k y = j // k if (x, y) not in basis_vectors: basis_vectors.add((x,y)) if l ** 2 <= i ** 2 + j ** 2 <= r ** 2: vectors.append((i,j)) # считаСм ΠΏΠΎΠ»Π½ΠΎΠ΅ число ΠΏΠ°Ρ€ pairs = 0 for x, y in vectors: a = n + 1 - x a = 0 if a < 0 else a b = m + 1 - y b = 0 if b < 0 else b c = n + 1 - y c = 0 if c < 0 else c d = m + 1 - x d = 0 if d < 0 else d print(x,y) print(a,b,c,d) pairs += (a * b + c * d) % p pairs = pairs % p print(pairs) ``` No
62,670
[ 0.331787109375, -0.153564453125, 0.1746826171875, -0.009185791015625, -0.496826171875, -0.308837890625, -0.2408447265625, -0.08294677734375, 0.04541015625, 0.84228515625, 0.55224609375, -0.318603515625, 0.1483154296875, -0.7548828125, -0.281494140625, -0.1763916015625, -0.79833984375...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied: For every n consecutive numbers on the circle write their sum on the blackboard. Then any two of written on the blackboard 2n numbers differ not more than by 1. For example, choose n = 3. On the left you can see an example of a valid arrangement: 1 + 4 + 5 = 10, 4 + 5 + 2 = 11, 5 + 2 + 3 = 10, 2 + 3 + 6 = 11, 3 + 6 + 1 = 10, 6 + 1 + 4 = 11, any two numbers differ by at most 1. On the right you can see an invalid arrangement: for example, 5 + 1 + 6 = 12, and 3 + 2 + 4 = 9, 9 and 12 differ more than by 1. <image> Input The first and the only line contain one integer n (1 ≀ n ≀ 10^5). Output If there is no solution, output "NO" in the first line. If there is a solution, output "YES" in the first line. In the second line output 2n numbers β€” numbers from 1 to 2n in the order they will stay in the circle. Each number should appear only once. If there are several solutions, you can output any of them. Examples Input 3 Output YES 1 4 5 2 3 6 Input 4 Output NO Note Example from the statement is shown for the first example. It can be proved that there is no solution in the second example. Submitted Solution: ``` n=int(input()) if n%2!=0: print('YES');lst=[1];mst=[]; for x in range(2,2*n+1,2): if x%4==0: lst.append(x);lst.append(x+1) else: mst.append(x);mst.append(x+1) print(*lst,*mst[:n]) else: print('NO') ``` Yes
63,229
[ 0.442138671875, 0.01509857177734375, -0.005947113037109375, -0.1925048828125, -0.457275390625, -0.34375, -0.1510009765625, 0.1282958984375, 0.21533203125, 1.0302734375, 0.68310546875, 0.0321044921875, 0.159423828125, -0.53271484375, -0.58642578125, 0.1353759765625, -0.96240234375, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied: For every n consecutive numbers on the circle write their sum on the blackboard. Then any two of written on the blackboard 2n numbers differ not more than by 1. For example, choose n = 3. On the left you can see an example of a valid arrangement: 1 + 4 + 5 = 10, 4 + 5 + 2 = 11, 5 + 2 + 3 = 10, 2 + 3 + 6 = 11, 3 + 6 + 1 = 10, 6 + 1 + 4 = 11, any two numbers differ by at most 1. On the right you can see an invalid arrangement: for example, 5 + 1 + 6 = 12, and 3 + 2 + 4 = 9, 9 and 12 differ more than by 1. <image> Input The first and the only line contain one integer n (1 ≀ n ≀ 10^5). Output If there is no solution, output "NO" in the first line. If there is a solution, output "YES" in the first line. In the second line output 2n numbers β€” numbers from 1 to 2n in the order they will stay in the circle. Each number should appear only once. If there are several solutions, you can output any of them. Examples Input 3 Output YES 1 4 5 2 3 6 Input 4 Output NO Note Example from the statement is shown for the first example. It can be proved that there is no solution in the second example. Submitted Solution: ``` n=int(input()) if n%2==0: print("NO") exit() print("YES") t=1 dt=[3,1] for i in range(n): print(t,end=' ') t+=dt[i%2] t=2 dt=[1,3] for i in range(n): print(t,end=' ') t+=dt[i%2] exit() import sys n=1 a=list(range(1,2*n+1)) from itertools import permutations for x in permutations(a): x=x+x b=[sum(x[i:i+n]) for i in range(2*n)] if max(b)-min(b)<=1: print(x) ``` Yes
63,230
[ 0.4228515625, -0.018798828125, -0.10687255859375, -0.1708984375, -0.60888671875, -0.404541015625, -0.18994140625, 0.11474609375, 0.22216796875, 1.001953125, 0.7109375, 0.01105499267578125, 0.1710205078125, -0.480224609375, -0.640625, 0.030364990234375, -0.94970703125, -0.87890625, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied: For every n consecutive numbers on the circle write their sum on the blackboard. Then any two of written on the blackboard 2n numbers differ not more than by 1. For example, choose n = 3. On the left you can see an example of a valid arrangement: 1 + 4 + 5 = 10, 4 + 5 + 2 = 11, 5 + 2 + 3 = 10, 2 + 3 + 6 = 11, 3 + 6 + 1 = 10, 6 + 1 + 4 = 11, any two numbers differ by at most 1. On the right you can see an invalid arrangement: for example, 5 + 1 + 6 = 12, and 3 + 2 + 4 = 9, 9 and 12 differ more than by 1. <image> Input The first and the only line contain one integer n (1 ≀ n ≀ 10^5). Output If there is no solution, output "NO" in the first line. If there is a solution, output "YES" in the first line. In the second line output 2n numbers β€” numbers from 1 to 2n in the order they will stay in the circle. Each number should appear only once. If there are several solutions, you can output any of them. Examples Input 3 Output YES 1 4 5 2 3 6 Input 4 Output NO Note Example from the statement is shown for the first example. It can be proved that there is no solution in the second example. Submitted Solution: ``` n = int(input()) if n % 2 == 0: print("NO") exit() else: arr = [0] * (2 * n) k = 1 for i in range(1, n + 1): if (i - 1) % 2 == 0: arr[i - 1] = k arr[i + n - 1] = k + 1 k += 1 else: arr[i - 1] = k + 2 arr[i + n - 1] = k + 1 k += 3 print("YES") print(*arr) ``` Yes
63,231
[ 0.4580078125, 0.086669921875, -0.1104736328125, -0.1524658203125, -0.515625, -0.39111328125, -0.121337890625, 0.1087646484375, 0.1864013671875, 1.021484375, 0.7353515625, -0.017425537109375, 0.097900390625, -0.556640625, -0.6328125, 0.057891845703125, -0.95556640625, -0.84375, -0...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied: For every n consecutive numbers on the circle write their sum on the blackboard. Then any two of written on the blackboard 2n numbers differ not more than by 1. For example, choose n = 3. On the left you can see an example of a valid arrangement: 1 + 4 + 5 = 10, 4 + 5 + 2 = 11, 5 + 2 + 3 = 10, 2 + 3 + 6 = 11, 3 + 6 + 1 = 10, 6 + 1 + 4 = 11, any two numbers differ by at most 1. On the right you can see an invalid arrangement: for example, 5 + 1 + 6 = 12, and 3 + 2 + 4 = 9, 9 and 12 differ more than by 1. <image> Input The first and the only line contain one integer n (1 ≀ n ≀ 10^5). Output If there is no solution, output "NO" in the first line. If there is a solution, output "YES" in the first line. In the second line output 2n numbers β€” numbers from 1 to 2n in the order they will stay in the circle. Each number should appear only once. If there are several solutions, you can output any of them. Examples Input 3 Output YES 1 4 5 2 3 6 Input 4 Output NO Note Example from the statement is shown for the first example. It can be proved that there is no solution in the second example. Submitted Solution: ``` N = int(input()) if N % 2 == 1: print('YES') saida = "1" k = 3 ant = 1 for i in range(1, N): saida += str(' ') + str(ant+k) ant += k if i % 2 == 1: k = 1 else: k = 3 saida += str(' 2') k = 1 ant = 2 for i in range(1, N): saida += str(' ') + str(ant+k) ant += k if i % 2 == 0: k = 1 else: k = 3 print(saida) else: print('NO') ``` Yes
63,232
[ 0.341064453125, -0.028594970703125, -0.1707763671875, -0.21142578125, -0.52587890625, -0.38623046875, -0.1168212890625, 0.10675048828125, 0.2008056640625, 0.91162109375, 0.63427734375, 0.07623291015625, 0.06719970703125, -0.63232421875, -0.5947265625, 0.10498046875, -0.93359375, -0...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied: For every n consecutive numbers on the circle write their sum on the blackboard. Then any two of written on the blackboard 2n numbers differ not more than by 1. For example, choose n = 3. On the left you can see an example of a valid arrangement: 1 + 4 + 5 = 10, 4 + 5 + 2 = 11, 5 + 2 + 3 = 10, 2 + 3 + 6 = 11, 3 + 6 + 1 = 10, 6 + 1 + 4 = 11, any two numbers differ by at most 1. On the right you can see an invalid arrangement: for example, 5 + 1 + 6 = 12, and 3 + 2 + 4 = 9, 9 and 12 differ more than by 1. <image> Input The first and the only line contain one integer n (1 ≀ n ≀ 10^5). Output If there is no solution, output "NO" in the first line. If there is a solution, output "YES" in the first line. In the second line output 2n numbers β€” numbers from 1 to 2n in the order they will stay in the circle. Each number should appear only once. If there are several solutions, you can output any of them. Examples Input 3 Output YES 1 4 5 2 3 6 Input 4 Output NO Note Example from the statement is shown for the first example. It can be proved that there is no solution in the second example. Submitted Solution: ``` import math import sys input = sys.stdin.readline def inp(): return(int(input())) def inlt(): return(list(map(int,input().split()))) def insr(): s = input().strip() return(list(s[:len(s)])) def invr(): return(map(int,input().split())) n=inp() if n%2==0: print('NO') else: l=[0 for i in range(2*n)] v=1 for i in range(0,len(l),2): l[i]=(1+(n-1)*(i//2))%(2*n) cnt=0 for i in range(n,n+len(l),2): l[i%(2*n)]=(2+(n-1)*cnt)%(2*n) if (2+(n-1)*cnt)%(2*n)==0: l[i%(2*n)]=2*n cnt+=1 print(*l) ``` No
63,233
[ 0.458740234375, 0.0103759765625, -0.059814453125, -0.255615234375, -0.51416015625, -0.280517578125, -0.10906982421875, 0.1241455078125, 0.2119140625, 0.98681640625, 0.74658203125, 0.033782958984375, 0.1640625, -0.50927734375, -0.51171875, 0.06732177734375, -0.85546875, -0.863769531...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied: For every n consecutive numbers on the circle write their sum on the blackboard. Then any two of written on the blackboard 2n numbers differ not more than by 1. For example, choose n = 3. On the left you can see an example of a valid arrangement: 1 + 4 + 5 = 10, 4 + 5 + 2 = 11, 5 + 2 + 3 = 10, 2 + 3 + 6 = 11, 3 + 6 + 1 = 10, 6 + 1 + 4 = 11, any two numbers differ by at most 1. On the right you can see an invalid arrangement: for example, 5 + 1 + 6 = 12, and 3 + 2 + 4 = 9, 9 and 12 differ more than by 1. <image> Input The first and the only line contain one integer n (1 ≀ n ≀ 10^5). Output If there is no solution, output "NO" in the first line. If there is a solution, output "YES" in the first line. In the second line output 2n numbers β€” numbers from 1 to 2n in the order they will stay in the circle. Each number should appear only once. If there are several solutions, you can output any of them. Examples Input 3 Output YES 1 4 5 2 3 6 Input 4 Output NO Note Example from the statement is shown for the first example. It can be proved that there is no solution in the second example. Submitted Solution: ``` n = int(input()) if(n%2==0): print("NO") else: print("YES") i = 1 while(i<2*n): print(i,end=" ") if(i%2==0): i+=1 else: i+=n i = 2 while(i<=2*n): print(i,end=" ") if(i%2==0): i+=1 else: i+=n ``` No
63,234
[ 0.416259765625, 0.05029296875, -0.04083251953125, -0.2115478515625, -0.52880859375, -0.341064453125, -0.074462890625, 0.1185302734375, 0.21484375, 1.0185546875, 0.7060546875, 0.0289764404296875, 0.1461181640625, -0.488525390625, -0.58251953125, 0.035552978515625, -0.92919921875, -0...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied: For every n consecutive numbers on the circle write their sum on the blackboard. Then any two of written on the blackboard 2n numbers differ not more than by 1. For example, choose n = 3. On the left you can see an example of a valid arrangement: 1 + 4 + 5 = 10, 4 + 5 + 2 = 11, 5 + 2 + 3 = 10, 2 + 3 + 6 = 11, 3 + 6 + 1 = 10, 6 + 1 + 4 = 11, any two numbers differ by at most 1. On the right you can see an invalid arrangement: for example, 5 + 1 + 6 = 12, and 3 + 2 + 4 = 9, 9 and 12 differ more than by 1. <image> Input The first and the only line contain one integer n (1 ≀ n ≀ 10^5). Output If there is no solution, output "NO" in the first line. If there is a solution, output "YES" in the first line. In the second line output 2n numbers β€” numbers from 1 to 2n in the order they will stay in the circle. Each number should appear only once. If there are several solutions, you can output any of them. Examples Input 3 Output YES 1 4 5 2 3 6 Input 4 Output NO Note Example from the statement is shown for the first example. It can be proved that there is no solution in the second example. Submitted Solution: ``` n=int(input()) a=[] t=1 if(n%2==0): print("NO") else: i=1 while(i<=2*n): if(t==1): a.append(i) t=0 else: a.append(i+1) t=1 i+=2 n=len(a) t=1 for i in range(n): if(t==1): a.append(a[i]+1) t=0 else: a.append(a[i]-1) t=1 print(*a) ``` No
63,235
[ 0.42578125, 0.050567626953125, -0.02215576171875, -0.1856689453125, -0.54345703125, -0.343505859375, -0.06988525390625, 0.1134033203125, 0.2198486328125, 1.0029296875, 0.712890625, 0.0122222900390625, 0.1322021484375, -0.4755859375, -0.5869140625, 0.05615234375, -0.92919921875, -0....
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied: For every n consecutive numbers on the circle write their sum on the blackboard. Then any two of written on the blackboard 2n numbers differ not more than by 1. For example, choose n = 3. On the left you can see an example of a valid arrangement: 1 + 4 + 5 = 10, 4 + 5 + 2 = 11, 5 + 2 + 3 = 10, 2 + 3 + 6 = 11, 3 + 6 + 1 = 10, 6 + 1 + 4 = 11, any two numbers differ by at most 1. On the right you can see an invalid arrangement: for example, 5 + 1 + 6 = 12, and 3 + 2 + 4 = 9, 9 and 12 differ more than by 1. <image> Input The first and the only line contain one integer n (1 ≀ n ≀ 10^5). Output If there is no solution, output "NO" in the first line. If there is a solution, output "YES" in the first line. In the second line output 2n numbers β€” numbers from 1 to 2n in the order they will stay in the circle. Each number should appear only once. If there are several solutions, you can output any of them. Examples Input 3 Output YES 1 4 5 2 3 6 Input 4 Output NO Note Example from the statement is shown for the first example. It can be proved that there is no solution in the second example. Submitted Solution: ``` #Bhargey Mehta (Junior) #DA-IICT, Gandhinagar import sys, math, queue #sys.stdin = open('input.txt', 'r') MOD = 998244353 sys.setrecursionlimit(1000000) n = int(input()) i = 2 while i*i <= n: if n%i == 0: print('NO') exit() i += 1 x, y = [], [] s, p = 1, 2*n for i in range(n): if i%2 == 0: x.append(s) y.append(s+1) s += 2 else: x.append(p) y.append(p-1) p -= 2 ans = x+y print('YES') print(*ans) ``` No
63,236
[ 0.4404296875, 0.0162353515625, -0.00917816162109375, -0.10150146484375, -0.492431640625, -0.297607421875, -0.10797119140625, 0.08917236328125, 0.197265625, 1.0234375, 0.720703125, -0.011505126953125, 0.09716796875, -0.478759765625, -0.572265625, 0.1090087890625, -0.89013671875, -0....
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people participating in some contest, they start participating in x minutes intervals. That means the first participant starts at time 0, the second participant starts at time x, the third β€” at time 2 β‹… x, and so on. Duration of contest is t minutes for each participant, so the first participant finishes the contest at time t, the second β€” at time t + x, and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it. Determine the sum of dissatisfaction of all participants. Input The first line contains a single integer k (1 ≀ k ≀ 1000) β€” the number of test cases. Each of the next k lines contains three integers n, x, t (1 ≀ n, x, t ≀ 2 β‹… 10^9) β€” the number of participants, the start interval and the contest duration. Output Print k lines, in the i-th line print the total dissatisfaction of participants in the i-th test case. Example Input 4 4 2 5 3 1 2 3 3 10 2000000000 1 2000000000 Output 5 3 3 1999999999000000000 Note In the first example the first participant starts at 0 and finishes at time 5. By that time the second and the third participants start, so the dissatisfaction of the first participant is 2. The second participant starts at time 2 and finishes at time 7. By that time the third the fourth participants start, so the dissatisfaction of the second participant is 2. The third participant starts at 4 and finishes at 9. By that time the fourth participant starts, so the dissatisfaction of the third participant is 1. The fourth participant starts at 6 and finishes at 11. By time 11 everyone finishes the contest, so the dissatisfaction of the fourth participant is 0. In the second example the first participant starts at 0 and finishes at time 2. By that time the second participants starts, and the third starts at exactly time 2. So the dissatisfaction of the first participant is 2. The second participant starts at time 1 and finishes at time 3. At that time the third participant is solving the contest. Submitted Solution: ``` for i in range(int(input())): n,x,t=map(int,input().split()) if t//x+1>=n: print(n*(n-1)//2) else: a=t//x sum=(n-a)*(a)+(a*(a-1))//2 print(sum) ``` Yes
63,394
[ 0.37109375, -0.080078125, -0.1759033203125, 0.28955078125, -0.289306640625, -0.55810546875, -0.433837890625, 0.0416259765625, 0.231201171875, 0.82080078125, 0.447265625, -0.32177734375, 0.25537109375, -0.9365234375, -0.29638671875, -0.2071533203125, -0.5, -0.8759765625, -0.586914...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people participating in some contest, they start participating in x minutes intervals. That means the first participant starts at time 0, the second participant starts at time x, the third β€” at time 2 β‹… x, and so on. Duration of contest is t minutes for each participant, so the first participant finishes the contest at time t, the second β€” at time t + x, and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it. Determine the sum of dissatisfaction of all participants. Input The first line contains a single integer k (1 ≀ k ≀ 1000) β€” the number of test cases. Each of the next k lines contains three integers n, x, t (1 ≀ n, x, t ≀ 2 β‹… 10^9) β€” the number of participants, the start interval and the contest duration. Output Print k lines, in the i-th line print the total dissatisfaction of participants in the i-th test case. Example Input 4 4 2 5 3 1 2 3 3 10 2000000000 1 2000000000 Output 5 3 3 1999999999000000000 Note In the first example the first participant starts at 0 and finishes at time 5. By that time the second and the third participants start, so the dissatisfaction of the first participant is 2. The second participant starts at time 2 and finishes at time 7. By that time the third the fourth participants start, so the dissatisfaction of the second participant is 2. The third participant starts at 4 and finishes at 9. By that time the fourth participant starts, so the dissatisfaction of the third participant is 1. The fourth participant starts at 6 and finishes at 11. By time 11 everyone finishes the contest, so the dissatisfaction of the fourth participant is 0. In the second example the first participant starts at 0 and finishes at time 2. By that time the second participants starts, and the third starts at exactly time 2. So the dissatisfaction of the first participant is 2. The second participant starts at time 1 and finishes at time 3. At that time the third participant is solving the contest. Submitted Solution: ``` for _ in range(int(input())): n,x,t=map(int,input().split()) each=min(n-1,t//x) ans=(each-1)*(each)//2 print((each)*(n-each)+ans) ``` Yes
63,395
[ 0.367431640625, -0.08868408203125, -0.1666259765625, 0.29150390625, -0.283935546875, -0.56005859375, -0.422119140625, 0.033782958984375, 0.2286376953125, 0.82470703125, 0.450439453125, -0.329345703125, 0.252685546875, -0.93896484375, -0.30029296875, -0.2030029296875, -0.50244140625, ...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people participating in some contest, they start participating in x minutes intervals. That means the first participant starts at time 0, the second participant starts at time x, the third β€” at time 2 β‹… x, and so on. Duration of contest is t minutes for each participant, so the first participant finishes the contest at time t, the second β€” at time t + x, and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it. Determine the sum of dissatisfaction of all participants. Input The first line contains a single integer k (1 ≀ k ≀ 1000) β€” the number of test cases. Each of the next k lines contains three integers n, x, t (1 ≀ n, x, t ≀ 2 β‹… 10^9) β€” the number of participants, the start interval and the contest duration. Output Print k lines, in the i-th line print the total dissatisfaction of participants in the i-th test case. Example Input 4 4 2 5 3 1 2 3 3 10 2000000000 1 2000000000 Output 5 3 3 1999999999000000000 Note In the first example the first participant starts at 0 and finishes at time 5. By that time the second and the third participants start, so the dissatisfaction of the first participant is 2. The second participant starts at time 2 and finishes at time 7. By that time the third the fourth participants start, so the dissatisfaction of the second participant is 2. The third participant starts at 4 and finishes at 9. By that time the fourth participant starts, so the dissatisfaction of the third participant is 1. The fourth participant starts at 6 and finishes at 11. By time 11 everyone finishes the contest, so the dissatisfaction of the fourth participant is 0. In the second example the first participant starts at 0 and finishes at time 2. By that time the second participants starts, and the third starts at exactly time 2. So the dissatisfaction of the first participant is 2. The second participant starts at time 1 and finishes at time 3. At that time the third participant is solving the contest. Submitted Solution: ``` from timeit import timeit import os,sys from datetime import datetime from math import floor,sqrt,gcd,factorial from collections import Counter,defaultdict import bisect from itertools import chain from collections import deque from sys import maxsize as INT_MAX #import threading '''Dont use setrecursionlimit in pypy''' #sys.setrecursionlimit(int(1e9)+500) #threading.stack_size(0x2000000) INF=float('inf') mod=int(1e9)+7 def readint(): return int(sys.stdin.readline()) def readstr(): return sys.stdin.readline() def readlst(): return list(map(int, sys.stdin.readline().strip().split())) def readmul(): return map(int, sys.stdin.readline().strip().split()) def mulfloat(): return map(float, sys.stdin.readline().strip().split()) def flush(): return sys.stdout.flush() def power_two(x): return (1<<x) def lcm(a,b): return a*b//gcd(a,b) def ceil(a,b): return(int((a+b-1)/b)) def countGreater(arr,n, k): l = 0 r = n - 1 leftGreater = n while (l <= r): m = int(l + (r - l) / 2) if (arr[m] >= k): leftGreater = m r = m - 1 else: l = m + 1 return (n - leftGreater) def two_pointer(n,val,*arr): l,r,cnt=0,n-1,0 while l<r: if arr[l]+arr[r]>val: r-=1 else: cnt+=r-l l+=1 return cnt def lower(arr,n,val): l,r=-1,n while r>l+1: m=int((l+r)>>1) if arr[m]<val: l=m else: r=m return r def upper(arr,n,val): l,r=-1,n while r>l+1: m=int((l+r)>>1) if arr[m]<=val: l=m else: r=m return l def BFS(adj, src, dist, paths, n): visited = [False] * n dist[src] = 0 paths[src] = 1 q = deque() q.append(src) visited[src] = True while q: curr = q[0] #print('q at start',q) q.popleft() for x in adj[curr]: #print('x',x) if not visited[x]: q.append(x) #print('q after append',q) visited[x] = True if dist[x] > dist[curr] + 1: dist[x] = dist[curr] + 1 paths[x] = (paths[curr])%mod elif dist[x] == dist[curr] + 1: paths[x] =(paths[x]%mod+paths[curr]%mod)%mod def binpow(a,n,mod): res=1 while n: if n&1: res=(res*a)%mod n-=1 a=(a*a)%mod n=n>>1 return res ''' c-space = to copy o-space= to open file ,-space=to run prog :noh= to get rid of text highlight ''' def is_perfect_square(num): #print(num) temp = num**(0.5) #print(temp) return (temp//1)==temp def printmat(l): for i in range(0,len(l)): print(*l[i],sep="") print() ''' 1. Implement after understanding properly don't do in vain 2. Check corner cases ''' def omkar(): n,x,t=readmul() print(max(0,n-t//x)*(t//x)+min(n-1,(t//x)-1)*min(n,(t//x))//2) return def main(): tc=readint() #test=1 while tc: omkar() tc-=1 main() ``` Yes
63,396
[ 0.415771484375, -0.09326171875, -0.1265869140625, 0.263427734375, -0.263427734375, -0.5400390625, -0.44091796875, 0.0401611328125, 0.322509765625, 0.89501953125, 0.380859375, -0.41650390625, 0.2041015625, -0.92236328125, -0.262939453125, -0.11981201171875, -0.489013671875, -0.83398...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people participating in some contest, they start participating in x minutes intervals. That means the first participant starts at time 0, the second participant starts at time x, the third β€” at time 2 β‹… x, and so on. Duration of contest is t minutes for each participant, so the first participant finishes the contest at time t, the second β€” at time t + x, and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it. Determine the sum of dissatisfaction of all participants. Input The first line contains a single integer k (1 ≀ k ≀ 1000) β€” the number of test cases. Each of the next k lines contains three integers n, x, t (1 ≀ n, x, t ≀ 2 β‹… 10^9) β€” the number of participants, the start interval and the contest duration. Output Print k lines, in the i-th line print the total dissatisfaction of participants in the i-th test case. Example Input 4 4 2 5 3 1 2 3 3 10 2000000000 1 2000000000 Output 5 3 3 1999999999000000000 Note In the first example the first participant starts at 0 and finishes at time 5. By that time the second and the third participants start, so the dissatisfaction of the first participant is 2. The second participant starts at time 2 and finishes at time 7. By that time the third the fourth participants start, so the dissatisfaction of the second participant is 2. The third participant starts at 4 and finishes at 9. By that time the fourth participant starts, so the dissatisfaction of the third participant is 1. The fourth participant starts at 6 and finishes at 11. By time 11 everyone finishes the contest, so the dissatisfaction of the fourth participant is 0. In the second example the first participant starts at 0 and finishes at time 2. By that time the second participants starts, and the third starts at exactly time 2. So the dissatisfaction of the first participant is 2. The second participant starts at time 1 and finishes at time 3. At that time the third participant is solving the contest. Submitted Solution: ``` for _ in range(int(input())): f,q,j=map(int,input().split()) ans=min(f-1,j//q) if ans==0 : print(0) else: finalsol=max(0,ans*(ans-1)//2)+ans*(f-ans) print(finalsol) ``` Yes
63,397
[ 0.360595703125, -0.0772705078125, -0.1785888671875, 0.305419921875, -0.322021484375, -0.5712890625, -0.413330078125, 0.0631103515625, 0.2393798828125, 0.8369140625, 0.43017578125, -0.32861328125, 0.2135009765625, -0.92919921875, -0.3193359375, -0.17431640625, -0.5380859375, -0.8872...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people participating in some contest, they start participating in x minutes intervals. That means the first participant starts at time 0, the second participant starts at time x, the third β€” at time 2 β‹… x, and so on. Duration of contest is t minutes for each participant, so the first participant finishes the contest at time t, the second β€” at time t + x, and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it. Determine the sum of dissatisfaction of all participants. Input The first line contains a single integer k (1 ≀ k ≀ 1000) β€” the number of test cases. Each of the next k lines contains three integers n, x, t (1 ≀ n, x, t ≀ 2 β‹… 10^9) β€” the number of participants, the start interval and the contest duration. Output Print k lines, in the i-th line print the total dissatisfaction of participants in the i-th test case. Example Input 4 4 2 5 3 1 2 3 3 10 2000000000 1 2000000000 Output 5 3 3 1999999999000000000 Note In the first example the first participant starts at 0 and finishes at time 5. By that time the second and the third participants start, so the dissatisfaction of the first participant is 2. The second participant starts at time 2 and finishes at time 7. By that time the third the fourth participants start, so the dissatisfaction of the second participant is 2. The third participant starts at 4 and finishes at 9. By that time the fourth participant starts, so the dissatisfaction of the third participant is 1. The fourth participant starts at 6 and finishes at 11. By time 11 everyone finishes the contest, so the dissatisfaction of the fourth participant is 0. In the second example the first participant starts at 0 and finishes at time 2. By that time the second participants starts, and the third starts at exactly time 2. So the dissatisfaction of the first participant is 2. The second participant starts at time 1 and finishes at time 3. At that time the third participant is solving the contest. Submitted Solution: ``` for _ in range(int(input())): n,x,t = [int(x) for x in input().split()] c = t//x ans = c*(n-c) + (((c-1)*c)//2) print(ans) ``` No
63,398
[ 0.364990234375, -0.11669921875, -0.1268310546875, 0.311767578125, -0.27392578125, -0.56005859375, -0.4111328125, 0.01294708251953125, 0.26171875, 0.81396484375, 0.4853515625, -0.328857421875, 0.1995849609375, -0.94482421875, -0.333251953125, -0.198486328125, -0.515625, -0.89453125,...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people participating in some contest, they start participating in x minutes intervals. That means the first participant starts at time 0, the second participant starts at time x, the third β€” at time 2 β‹… x, and so on. Duration of contest is t minutes for each participant, so the first participant finishes the contest at time t, the second β€” at time t + x, and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it. Determine the sum of dissatisfaction of all participants. Input The first line contains a single integer k (1 ≀ k ≀ 1000) β€” the number of test cases. Each of the next k lines contains three integers n, x, t (1 ≀ n, x, t ≀ 2 β‹… 10^9) β€” the number of participants, the start interval and the contest duration. Output Print k lines, in the i-th line print the total dissatisfaction of participants in the i-th test case. Example Input 4 4 2 5 3 1 2 3 3 10 2000000000 1 2000000000 Output 5 3 3 1999999999000000000 Note In the first example the first participant starts at 0 and finishes at time 5. By that time the second and the third participants start, so the dissatisfaction of the first participant is 2. The second participant starts at time 2 and finishes at time 7. By that time the third the fourth participants start, so the dissatisfaction of the second participant is 2. The third participant starts at 4 and finishes at 9. By that time the fourth participant starts, so the dissatisfaction of the third participant is 1. The fourth participant starts at 6 and finishes at 11. By time 11 everyone finishes the contest, so the dissatisfaction of the fourth participant is 0. In the second example the first participant starts at 0 and finishes at time 2. By that time the second participants starts, and the third starts at exactly time 2. So the dissatisfaction of the first participant is 2. The second participant starts at time 1 and finishes at time 3. At that time the third participant is solving the contest. Submitted Solution: ``` t=int(input()) for i in range(t): n,x,t=map(int,input().split()) if n==1: print(0) elif t<x: print(0) elif t==x: print(n-1) else: ans=0 a=t//x ans+=(n-a)*a f=a f-=1 ans+=(f*(f+1))//2 print(ans) ``` No
63,399
[ 0.35595703125, -0.07708740234375, -0.1805419921875, 0.297607421875, -0.30078125, -0.552734375, -0.43115234375, 0.040618896484375, 0.2301025390625, 0.80859375, 0.436279296875, -0.317138671875, 0.265380859375, -0.94677734375, -0.306640625, -0.209228515625, -0.494384765625, -0.8735351...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people participating in some contest, they start participating in x minutes intervals. That means the first participant starts at time 0, the second participant starts at time x, the third β€” at time 2 β‹… x, and so on. Duration of contest is t minutes for each participant, so the first participant finishes the contest at time t, the second β€” at time t + x, and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it. Determine the sum of dissatisfaction of all participants. Input The first line contains a single integer k (1 ≀ k ≀ 1000) β€” the number of test cases. Each of the next k lines contains three integers n, x, t (1 ≀ n, x, t ≀ 2 β‹… 10^9) β€” the number of participants, the start interval and the contest duration. Output Print k lines, in the i-th line print the total dissatisfaction of participants in the i-th test case. Example Input 4 4 2 5 3 1 2 3 3 10 2000000000 1 2000000000 Output 5 3 3 1999999999000000000 Note In the first example the first participant starts at 0 and finishes at time 5. By that time the second and the third participants start, so the dissatisfaction of the first participant is 2. The second participant starts at time 2 and finishes at time 7. By that time the third the fourth participants start, so the dissatisfaction of the second participant is 2. The third participant starts at 4 and finishes at 9. By that time the fourth participant starts, so the dissatisfaction of the third participant is 1. The fourth participant starts at 6 and finishes at 11. By time 11 everyone finishes the contest, so the dissatisfaction of the fourth participant is 0. In the second example the first participant starts at 0 and finishes at time 2. By that time the second participants starts, and the third starts at exactly time 2. So the dissatisfaction of the first participant is 2. The second participant starts at time 1 and finishes at time 3. At that time the third participant is solving the contest. Submitted Solution: ``` import sys import math import random from collections import deque, defaultdict #print = sys.stdout.write from string import ascii_letters letters = ascii_letters[:26].upper() ONLINE_JUDGE = 0 from functools import lru_cache if any(['--local' in i for i in sys.argv]) and not ONLINE_JUDGE: sys.stdin = open('input.txt', 'r', encoding='utf-8') #sys.stdin = open('27887.txt', 'r') sys.stdout = open('output.txt', 'w', encoding='utf-8') for _ in range(int(input())): n, x, t = map(int, input().split()) v = t // x res = 0 res += v * (n - v) res += (0 + min(n, v) - 1) * min(n, v) // 2 print(res) ``` No
63,400
[ 0.31298828125, -0.04840087890625, -0.133544921875, 0.227783203125, -0.3310546875, -0.5244140625, -0.46533203125, 0.057098388671875, 0.322021484375, 0.8251953125, 0.44970703125, -0.390380859375, 0.2269287109375, -0.8330078125, -0.33837890625, -0.1630859375, -0.51220703125, -0.942382...
11
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n people participating in some contest, they start participating in x minutes intervals. That means the first participant starts at time 0, the second participant starts at time x, the third β€” at time 2 β‹… x, and so on. Duration of contest is t minutes for each participant, so the first participant finishes the contest at time t, the second β€” at time t + x, and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it. Determine the sum of dissatisfaction of all participants. Input The first line contains a single integer k (1 ≀ k ≀ 1000) β€” the number of test cases. Each of the next k lines contains three integers n, x, t (1 ≀ n, x, t ≀ 2 β‹… 10^9) β€” the number of participants, the start interval and the contest duration. Output Print k lines, in the i-th line print the total dissatisfaction of participants in the i-th test case. Example Input 4 4 2 5 3 1 2 3 3 10 2000000000 1 2000000000 Output 5 3 3 1999999999000000000 Note In the first example the first participant starts at 0 and finishes at time 5. By that time the second and the third participants start, so the dissatisfaction of the first participant is 2. The second participant starts at time 2 and finishes at time 7. By that time the third the fourth participants start, so the dissatisfaction of the second participant is 2. The third participant starts at 4 and finishes at 9. By that time the fourth participant starts, so the dissatisfaction of the third participant is 1. The fourth participant starts at 6 and finishes at 11. By time 11 everyone finishes the contest, so the dissatisfaction of the fourth participant is 0. In the second example the first participant starts at 0 and finishes at time 2. By that time the second participants starts, and the third starts at exactly time 2. So the dissatisfaction of the first participant is 2. The second participant starts at time 1 and finishes at time 3. At that time the third participant is solving the contest. Submitted Solution: ``` for t in range(int(input())): n,x, k = map(int, input().split()) v = k//x if(n>=v): c = (v)*(n-v) + (v)*(v -1)/2 else: c = n*(n-1)//2 print(c) ``` No
63,401
[ 0.376953125, -0.0843505859375, -0.172119140625, 0.296875, -0.295654296875, -0.57080078125, -0.429443359375, 0.033966064453125, 0.21923828125, 0.81982421875, 0.451904296875, -0.3330078125, 0.241943359375, -0.9453125, -0.296875, -0.18310546875, -0.515625, -0.88916015625, -0.578125,...
11
Provide tags and a correct Python 3 solution for this coding contest problem. Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating changes by some value, possibly negative or zero. Limak competed in n contests in the year 2016. He remembers that in the i-th contest he competed in the division di (i.e. he belonged to this division just before the start of this contest) and his rating changed by ci just after the contest. Note that negative ci denotes the loss of rating. What is the maximum possible rating Limak can have right now, after all n contests? If his rating may be arbitrarily big, print "Infinity". If there is no scenario matching the given information, print "Impossible". Input The first line of the input contains a single integer n (1 ≀ n ≀ 200 000). The i-th of next n lines contains two integers ci and di ( - 100 ≀ ci ≀ 100, 1 ≀ di ≀ 2), describing Limak's rating change after the i-th contest and his division during the i-th contest contest. Output If Limak's current rating can be arbitrarily big, print "Infinity" (without quotes). If the situation is impossible, print "Impossible" (without quotes). Otherwise print one integer, denoting the maximum possible value of Limak's current rating, i.e. rating after the n contests. Examples Input 3 -7 1 5 2 8 2 Output 1907 Input 2 57 1 22 2 Output Impossible Input 1 -5 1 Output Infinity Input 4 27 2 13 1 -50 1 8 2 Output 1897 Note In the first sample, the following scenario matches all information Limak remembers and has maximum possible final rating: * Limak has rating 1901 and belongs to the division 1 in the first contest. His rating decreases by 7. * With rating 1894 Limak is in the division 2. His rating increases by 5. * Limak has rating 1899 and is still in the division 2. In the last contest of the year he gets + 8 and ends the year with rating 1907. In the second sample, it's impossible that Limak is in the division 1, his rating increases by 57 and after that Limak is in the division 2 in the second contest. Tags: binary search, greedy, math Correct Solution: ``` n = int(input()) c, d = [], [] for i in range(n) : ci, di = map(int, input().split()) c.append(ci), d.append(di) s = [0] * (n + 1) geq, leq = 0, 0 for i in reversed(range(n)) : s[i] = s[i + 1] + c[i] if d[i] == 1 : if geq == 0 : g = s[i] + 1900 else : g = max(g, s[i] + 1900) geq += 1 elif d[i] == 2 : if leq == 0 : l = s[i] + 1899 else : l = min(s[i] + 1899, l) leq += 1 if leq == 0 : print("Infinity") elif geq == 0 or g <= l : print(l) else : print("Impossible") ```
63,577
[ 0.274658203125, -0.108642578125, -0.333740234375, 0.146728515625, -0.271728515625, -0.79638671875, -0.06378173828125, 0.1441650390625, 0.060516357421875, 0.79736328125, 0.56591796875, -0.3125, 0.2186279296875, -0.77783203125, -0.254638671875, -0.01445770263671875, -0.51953125, -0.6...
11
Provide tags and a correct Python 3 solution for this coding contest problem. Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating changes by some value, possibly negative or zero. Limak competed in n contests in the year 2016. He remembers that in the i-th contest he competed in the division di (i.e. he belonged to this division just before the start of this contest) and his rating changed by ci just after the contest. Note that negative ci denotes the loss of rating. What is the maximum possible rating Limak can have right now, after all n contests? If his rating may be arbitrarily big, print "Infinity". If there is no scenario matching the given information, print "Impossible". Input The first line of the input contains a single integer n (1 ≀ n ≀ 200 000). The i-th of next n lines contains two integers ci and di ( - 100 ≀ ci ≀ 100, 1 ≀ di ≀ 2), describing Limak's rating change after the i-th contest and his division during the i-th contest contest. Output If Limak's current rating can be arbitrarily big, print "Infinity" (without quotes). If the situation is impossible, print "Impossible" (without quotes). Otherwise print one integer, denoting the maximum possible value of Limak's current rating, i.e. rating after the n contests. Examples Input 3 -7 1 5 2 8 2 Output 1907 Input 2 57 1 22 2 Output Impossible Input 1 -5 1 Output Infinity Input 4 27 2 13 1 -50 1 8 2 Output 1897 Note In the first sample, the following scenario matches all information Limak remembers and has maximum possible final rating: * Limak has rating 1901 and belongs to the division 1 in the first contest. His rating decreases by 7. * With rating 1894 Limak is in the division 2. His rating increases by 5. * Limak has rating 1899 and is still in the division 2. In the last contest of the year he gets + 8 and ends the year with rating 1907. In the second sample, it's impossible that Limak is in the division 1, his rating increases by 57 and after that Limak is in the division 2 in the second contest. Tags: binary search, greedy, math Correct Solution: ``` n = int(input()) INF = 2 ** 60 lo, hi = -INF, INF for i in range(n): x, y = (int(_) for _ in input().split()) if y == 2: hi = min(hi, 1899) else: lo = max(lo, 1900) hi += x lo += x if lo > hi: print('Impossible') elif hi > 2 ** 31: print('Infinity') else: print(hi) ```
63,578
[ 0.274658203125, -0.108642578125, -0.333740234375, 0.146728515625, -0.271728515625, -0.79638671875, -0.06378173828125, 0.1441650390625, 0.060516357421875, 0.79736328125, 0.56591796875, -0.3125, 0.2186279296875, -0.77783203125, -0.254638671875, -0.01445770263671875, -0.51953125, -0.6...
11
Provide tags and a correct Python 3 solution for this coding contest problem. Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating changes by some value, possibly negative or zero. Limak competed in n contests in the year 2016. He remembers that in the i-th contest he competed in the division di (i.e. he belonged to this division just before the start of this contest) and his rating changed by ci just after the contest. Note that negative ci denotes the loss of rating. What is the maximum possible rating Limak can have right now, after all n contests? If his rating may be arbitrarily big, print "Infinity". If there is no scenario matching the given information, print "Impossible". Input The first line of the input contains a single integer n (1 ≀ n ≀ 200 000). The i-th of next n lines contains two integers ci and di ( - 100 ≀ ci ≀ 100, 1 ≀ di ≀ 2), describing Limak's rating change after the i-th contest and his division during the i-th contest contest. Output If Limak's current rating can be arbitrarily big, print "Infinity" (without quotes). If the situation is impossible, print "Impossible" (without quotes). Otherwise print one integer, denoting the maximum possible value of Limak's current rating, i.e. rating after the n contests. Examples Input 3 -7 1 5 2 8 2 Output 1907 Input 2 57 1 22 2 Output Impossible Input 1 -5 1 Output Infinity Input 4 27 2 13 1 -50 1 8 2 Output 1897 Note In the first sample, the following scenario matches all information Limak remembers and has maximum possible final rating: * Limak has rating 1901 and belongs to the division 1 in the first contest. His rating decreases by 7. * With rating 1894 Limak is in the division 2. His rating increases by 5. * Limak has rating 1899 and is still in the division 2. In the last contest of the year he gets + 8 and ends the year with rating 1907. In the second sample, it's impossible that Limak is in the division 1, his rating increases by 57 and after that Limak is in the division 2 in the second contest. Tags: binary search, greedy, math Correct Solution: ``` import os import sys from io import BytesIO, IOBase import math import itertools import bisect import heapq #sys.setrecursionlimit(300000) def main(): pass BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writable else None def read(self): while True: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) if not b: break ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines = 0 return self.buffer.read() def readline(self): while self.newlines == 0: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) self.newlines = b.count(b"\n") + (not b) ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines -= 1 return self.buffer.readline() def flush(self): if self.writable: os.write(self._fd, self.buffer.getvalue()) self.buffer.truncate(0), self.buffer.seek(0) class IOWrapper(IOBase): def __init__(self, file): self.buffer = FastIO(file) self.flush = self.buffer.flush self.writable = self.buffer.writable self.write = lambda s: self.buffer.write(s.encode("ascii")) self.read = lambda: self.buffer.read().decode("ascii") self.readline = lambda: self.buffer.readline().decode("ascii") sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) input = lambda: sys.stdin.readline().rstrip("\r\n") def binary(n): return (bin(n).replace("0b", "")) def decimal(s): return (int(s, 2)) def pow2(n): p = 0 while (n > 1): n //= 2 p += 1 return (p) def primeFactors(n): l = [] while n % 2 == 0: l.append(2) n = n / 2 for i in range(3, int(math.sqrt(n)) + 1, 2): while n % i == 0: l.append(i) n = n / i if n > 2: l.append(int(n)) return (l) def isPrime(n): if (n == 1): return (False) else: root = int(n ** 0.5) root += 1 for i in range(2, root): if (n % i == 0): return (False) return (True) def maxPrimeFactors(n): maxPrime = -1 while n % 2 == 0: maxPrime = 2 n >>= 1 for i in range(3, int(math.sqrt(n)) + 1, 2): while n % i == 0: maxPrime = i n = n / i if n > 2: maxPrime = n return int(maxPrime) def countcon(s, i): c = 0 ch = s[i] for i in range(i, len(s)): if (s[i] == ch): c += 1 else: break return (c) def lis(arr): n = len(arr) lis = [1] * n for i in range(1, n): for j in range(0, i): if arr[i] > arr[j] and lis[i] < lis[j] + 1: lis[i] = lis[j] + 1 maximum = 0 for i in range(n): maximum = max(maximum, lis[i]) return maximum def isSubSequence(str1, str2): m = len(str1) n = len(str2) j = 0 i = 0 while j < m and i < n: if str1[j] == str2[i]: j = j + 1 i = i + 1 return j == m def maxfac(n): root = int(n ** 0.5) for i in range(2, root + 1): if (n % i == 0): return (n // i) return (n) def p2(n): c=0 while(n%2==0): n//=2 c+=1 return c def seive(n): primes=[True]*(n+1) primes[1]=primes[0]=False for i in range(2,n+1): if(primes[i]): for j in range(i+i,n+1,i): primes[j]=False p=[] for i in range(0,n+1): if(primes[i]): p.append(i) return(p) def ncr(n, r, p): num = den = 1 for i in range(r): num = (num * (n - i)) % p den = (den * (i + 1)) % p return (num * pow(den, p - 2, p)) % p def denofactinverse(n,m): fac=1 for i in range(1,n+1): fac=(fac*i)%m return (pow(fac,m-2,m)) def numofact(n,m): fac=1 for i in range(1,n+1): fac=(fac*i)%m return(fac) n=int(input()) div1,div2=-10**18,10**18 for i in range(0,n): c,d=map(int,input().split()) if(d==2): div2=min(div2,1899) else: div1=max(div1,1900) div1+=c div2+=c if(div2>=div1): if(div2>10**10): print("Infinity") else: print(div2) else: print("Impossible") ```
63,579
[ 0.274658203125, -0.108642578125, -0.333740234375, 0.146728515625, -0.271728515625, -0.79638671875, -0.06378173828125, 0.1441650390625, 0.060516357421875, 0.79736328125, 0.56591796875, -0.3125, 0.2186279296875, -0.77783203125, -0.254638671875, -0.01445770263671875, -0.51953125, -0.6...
11
Provide tags and a correct Python 3 solution for this coding contest problem. Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating changes by some value, possibly negative or zero. Limak competed in n contests in the year 2016. He remembers that in the i-th contest he competed in the division di (i.e. he belonged to this division just before the start of this contest) and his rating changed by ci just after the contest. Note that negative ci denotes the loss of rating. What is the maximum possible rating Limak can have right now, after all n contests? If his rating may be arbitrarily big, print "Infinity". If there is no scenario matching the given information, print "Impossible". Input The first line of the input contains a single integer n (1 ≀ n ≀ 200 000). The i-th of next n lines contains two integers ci and di ( - 100 ≀ ci ≀ 100, 1 ≀ di ≀ 2), describing Limak's rating change after the i-th contest and his division during the i-th contest contest. Output If Limak's current rating can be arbitrarily big, print "Infinity" (without quotes). If the situation is impossible, print "Impossible" (without quotes). Otherwise print one integer, denoting the maximum possible value of Limak's current rating, i.e. rating after the n contests. Examples Input 3 -7 1 5 2 8 2 Output 1907 Input 2 57 1 22 2 Output Impossible Input 1 -5 1 Output Infinity Input 4 27 2 13 1 -50 1 8 2 Output 1897 Note In the first sample, the following scenario matches all information Limak remembers and has maximum possible final rating: * Limak has rating 1901 and belongs to the division 1 in the first contest. His rating decreases by 7. * With rating 1894 Limak is in the division 2. His rating increases by 5. * Limak has rating 1899 and is still in the division 2. In the last contest of the year he gets + 8 and ends the year with rating 1907. In the second sample, it's impossible that Limak is in the division 1, his rating increases by 57 and after that Limak is in the division 2 in the second contest. Tags: binary search, greedy, math Correct Solution: ``` s, t = -10 ** 8, 10 ** 8 for i in range(int(input())): c, d = map(int, input().split()) if d == 1: s = max(s, 1900) else: t = min(t, 1899) # print(s,t) if s > t: print('Impossible') exit() s, t = s + c, t + c print('Infinity' if t > 5 * 10 ** 7 else t) ```
63,580
[ 0.274658203125, -0.108642578125, -0.333740234375, 0.146728515625, -0.271728515625, -0.79638671875, -0.06378173828125, 0.1441650390625, 0.060516357421875, 0.79736328125, 0.56591796875, -0.3125, 0.2186279296875, -0.77783203125, -0.254638671875, -0.01445770263671875, -0.51953125, -0.6...
11
Provide tags and a correct Python 3 solution for this coding contest problem. Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating changes by some value, possibly negative or zero. Limak competed in n contests in the year 2016. He remembers that in the i-th contest he competed in the division di (i.e. he belonged to this division just before the start of this contest) and his rating changed by ci just after the contest. Note that negative ci denotes the loss of rating. What is the maximum possible rating Limak can have right now, after all n contests? If his rating may be arbitrarily big, print "Infinity". If there is no scenario matching the given information, print "Impossible". Input The first line of the input contains a single integer n (1 ≀ n ≀ 200 000). The i-th of next n lines contains two integers ci and di ( - 100 ≀ ci ≀ 100, 1 ≀ di ≀ 2), describing Limak's rating change after the i-th contest and his division during the i-th contest contest. Output If Limak's current rating can be arbitrarily big, print "Infinity" (without quotes). If the situation is impossible, print "Impossible" (without quotes). Otherwise print one integer, denoting the maximum possible value of Limak's current rating, i.e. rating after the n contests. Examples Input 3 -7 1 5 2 8 2 Output 1907 Input 2 57 1 22 2 Output Impossible Input 1 -5 1 Output Infinity Input 4 27 2 13 1 -50 1 8 2 Output 1897 Note In the first sample, the following scenario matches all information Limak remembers and has maximum possible final rating: * Limak has rating 1901 and belongs to the division 1 in the first contest. His rating decreases by 7. * With rating 1894 Limak is in the division 2. His rating increases by 5. * Limak has rating 1899 and is still in the division 2. In the last contest of the year he gets + 8 and ends the year with rating 1907. In the second sample, it's impossible that Limak is in the division 1, his rating increases by 57 and after that Limak is in the division 2 in the second contest. Tags: binary search, greedy, math Correct Solution: ``` #!/usr/local/bin/python3.4 import pdb def A1B2(LIST): flag = False for (a,b) in LIST: if b == 1: flag = True if flag and b==2: return False return True def A2B2(LIST): a,b = LIST[0] for i in range(1,len(LIST)): c,d = LIST[i] if ( b== 2 and d ==1): return a a,b =c,d def calc(N): curent_value=0 first, second =map (int, input().split() ) cont=list() cont.append( ( 0 , second )) old_change = first current_value = 0 last_value= first for _ in range(N - 1 ): change, division = map( int, input().split() ) current_value += old_change cont.append( (current_value, division) ) old_change = change last_value = current_value + change # pbd.set_trace() # print (last_value) sort_cont = (sorted(cont)) a, b = sort_cont[-1] if (all( b == 1 for (a,b) in sort_cont)): return "Infinity" if (all ( b == 2 for (a,b) in sort_cont)): a, b = sort_cont[-1] # pdb.set_trace() return (1899 - a + last_value ) if not A1B2(sort_cont): return "Impossible" if len(sort_cont) == 0 : return (1899 - first) else: return ( 1899 - A2B2(sort_cont) + last_value ) N = int(input()) print (calc(N)) ```
63,581
[ 0.274658203125, -0.108642578125, -0.333740234375, 0.146728515625, -0.271728515625, -0.79638671875, -0.06378173828125, 0.1441650390625, 0.060516357421875, 0.79736328125, 0.56591796875, -0.3125, 0.2186279296875, -0.77783203125, -0.254638671875, -0.01445770263671875, -0.51953125, -0.6...
11
Provide tags and a correct Python 3 solution for this coding contest problem. Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating changes by some value, possibly negative or zero. Limak competed in n contests in the year 2016. He remembers that in the i-th contest he competed in the division di (i.e. he belonged to this division just before the start of this contest) and his rating changed by ci just after the contest. Note that negative ci denotes the loss of rating. What is the maximum possible rating Limak can have right now, after all n contests? If his rating may be arbitrarily big, print "Infinity". If there is no scenario matching the given information, print "Impossible". Input The first line of the input contains a single integer n (1 ≀ n ≀ 200 000). The i-th of next n lines contains two integers ci and di ( - 100 ≀ ci ≀ 100, 1 ≀ di ≀ 2), describing Limak's rating change after the i-th contest and his division during the i-th contest contest. Output If Limak's current rating can be arbitrarily big, print "Infinity" (without quotes). If the situation is impossible, print "Impossible" (without quotes). Otherwise print one integer, denoting the maximum possible value of Limak's current rating, i.e. rating after the n contests. Examples Input 3 -7 1 5 2 8 2 Output 1907 Input 2 57 1 22 2 Output Impossible Input 1 -5 1 Output Infinity Input 4 27 2 13 1 -50 1 8 2 Output 1897 Note In the first sample, the following scenario matches all information Limak remembers and has maximum possible final rating: * Limak has rating 1901 and belongs to the division 1 in the first contest. His rating decreases by 7. * With rating 1894 Limak is in the division 2. His rating increases by 5. * Limak has rating 1899 and is still in the division 2. In the last contest of the year he gets + 8 and ends the year with rating 1907. In the second sample, it's impossible that Limak is in the division 1, his rating increases by 57 and after that Limak is in the division 2 in the second contest. Tags: binary search, greedy, math Correct Solution: ``` n=int(input()) mx=10**9 mn=-10**9 r=0 for i in range(n): c,d=[int(j) for j in input().split()] if d==1: mn=max(mn,1900-r) else: mx=min(mx,1899-r) r+=c if mx==10**9: print("Infinity") elif mn>mx: print("Impossible") else: print(mx+r) ```
63,582
[ 0.274658203125, -0.108642578125, -0.333740234375, 0.146728515625, -0.271728515625, -0.79638671875, -0.06378173828125, 0.1441650390625, 0.060516357421875, 0.79736328125, 0.56591796875, -0.3125, 0.2186279296875, -0.77783203125, -0.254638671875, -0.01445770263671875, -0.51953125, -0.6...
11