message stringlengths 2 39.6k | message_type stringclasses 2 values | message_id int64 0 1 | conversation_id int64 219 108k | cluster float64 11 11 | __index_level_0__ int64 438 217k |
|---|---|---|---|---|---|
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")
``` | instruction | 0 | 60,457 | 11 | 120,914 |
Yes | output | 1 | 60,457 | 11 | 120,915 |
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")
``` | instruction | 0 | 60,458 | 11 | 120,916 |
Yes | output | 1 | 60,458 | 11 | 120,917 |
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')
``` | instruction | 0 | 60,459 | 11 | 120,918 |
No | output | 1 | 60,459 | 11 | 120,919 |
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")
``` | instruction | 0 | 60,460 | 11 | 120,920 |
No | output | 1 | 60,460 | 11 | 120,921 |
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')
``` | instruction | 0 | 60,461 | 11 | 120,922 |
No | output | 1 | 60,461 | 11 | 120,923 |
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
``` | instruction | 0 | 60,462 | 11 | 120,924 |
No | output | 1 | 60,462 | 11 | 120,925 |
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 | instruction | 0 | 61,360 | 11 | 122,720 |
"Correct Solution:
```
X = int(input())
if X < 1200:
print('ABC')
else:
print('ARC')
``` | output | 1 | 61,360 | 11 | 122,721 |
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 | instruction | 0 | 61,361 | 11 | 122,722 |
"Correct Solution:
```
N=int(input())
if N<1200:
s="ABC"
else:
s="ARC"
print(s)
``` | output | 1 | 61,361 | 11 | 122,723 |
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 | instruction | 0 | 61,362 | 11 | 122,724 |
"Correct Solution:
```
N = int(input())
if N < 1200:
print('ABC')
else:
print('ARC')
``` | output | 1 | 61,362 | 11 | 122,725 |
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 | instruction | 0 | 61,363 | 11 | 122,726 |
"Correct Solution:
```
rate = int(input())
print("ABC") if rate < 1200 else print("ARC")
``` | output | 1 | 61,363 | 11 | 122,727 |
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 | instruction | 0 | 61,364 | 11 | 122,728 |
"Correct Solution:
```
m=int(input())
if m<1200:print("ABC")
else:print("ARC")
``` | output | 1 | 61,364 | 11 | 122,729 |
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 | instruction | 0 | 61,365 | 11 | 122,730 |
"Correct Solution:
```
r = int(input())
if r >= 1200:
print("ARC")
else:
print("ABC")
``` | output | 1 | 61,365 | 11 | 122,731 |
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 | instruction | 0 | 61,366 | 11 | 122,732 |
"Correct Solution:
```
print(('ARC','ABC')[int(input())<1200])
``` | output | 1 | 61,366 | 11 | 122,733 |
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 | instruction | 0 | 61,367 | 11 | 122,734 |
"Correct Solution:
```
print('ABC' if int(input().strip()) < 1200 else 'ARC')
``` | output | 1 | 61,367 | 11 | 122,735 |
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])
``` | instruction | 0 | 61,368 | 11 | 122,736 |
Yes | output | 1 | 61,368 | 11 | 122,737 |
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)
``` | instruction | 0 | 61,369 | 11 | 122,738 |
Yes | output | 1 | 61,369 | 11 | 122,739 |
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")
``` | instruction | 0 | 61,370 | 11 | 122,740 |
Yes | output | 1 | 61,370 | 11 | 122,741 |
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")
``` | instruction | 0 | 61,371 | 11 | 122,742 |
Yes | output | 1 | 61,371 | 11 | 122,743 |
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)
``` | instruction | 0 | 61,372 | 11 | 122,744 |
No | output | 1 | 61,372 | 11 | 122,745 |
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")
``` | instruction | 0 | 61,373 | 11 | 122,746 |
No | output | 1 | 61,373 | 11 | 122,747 |
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”))
``` | instruction | 0 | 61,374 | 11 | 122,748 |
No | output | 1 | 61,374 | 11 | 122,749 |
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')
``` | instruction | 0 | 61,375 | 11 | 122,750 |
No | output | 1 | 61,375 | 11 | 122,751 |
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. | instruction | 0 | 61,721 | 11 | 123,442 |
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)
``` | output | 1 | 61,721 | 11 | 123,443 |
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. | instruction | 0 | 61,722 | 11 | 123,444 |
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)
``` | output | 1 | 61,722 | 11 | 123,445 |
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. | instruction | 0 | 61,723 | 11 | 123,446 |
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)
``` | output | 1 | 61,723 | 11 | 123,447 |
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. | instruction | 0 | 61,724 | 11 | 123,448 |
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)
``` | output | 1 | 61,724 | 11 | 123,449 |
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. | instruction | 0 | 61,725 | 11 | 123,450 |
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)
``` | output | 1 | 61,725 | 11 | 123,451 |
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. | instruction | 0 | 61,726 | 11 | 123,452 |
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)
``` | output | 1 | 61,726 | 11 | 123,453 |
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. | instruction | 0 | 61,727 | 11 | 123,454 |
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)
``` | output | 1 | 61,727 | 11 | 123,455 |
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. | instruction | 0 | 61,728 | 11 | 123,456 |
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)
``` | output | 1 | 61,728 | 11 | 123,457 |
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)
``` | instruction | 0 | 61,729 | 11 | 123,458 |
Yes | output | 1 | 61,729 | 11 | 123,459 |
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)
``` | instruction | 0 | 61,730 | 11 | 123,460 |
Yes | output | 1 | 61,730 | 11 | 123,461 |
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)
``` | instruction | 0 | 61,731 | 11 | 123,462 |
Yes | output | 1 | 61,731 | 11 | 123,463 |
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)
``` | instruction | 0 | 61,732 | 11 | 123,464 |
Yes | output | 1 | 61,732 | 11 | 123,465 |
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))
``` | instruction | 0 | 61,733 | 11 | 123,466 |
No | output | 1 | 61,733 | 11 | 123,467 |
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)
``` | instruction | 0 | 61,734 | 11 | 123,468 |
No | output | 1 | 61,734 | 11 | 123,469 |
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)
``` | instruction | 0 | 61,735 | 11 | 123,470 |
No | output | 1 | 61,735 | 11 | 123,471 |
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)
``` | instruction | 0 | 61,736 | 11 | 123,472 |
No | output | 1 | 61,736 | 11 | 123,473 |
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])
``` | instruction | 0 | 61,944 | 11 | 123,888 |
No | output | 1 | 61,944 | 11 | 123,889 |
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
``` | instruction | 0 | 61,945 | 11 | 123,890 |
No | output | 1 | 61,945 | 11 | 123,891 |
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]])
``` | instruction | 0 | 61,946 | 11 | 123,892 |
No | output | 1 | 61,946 | 11 | 123,893 |
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)
``` | instruction | 0 | 61,947 | 11 | 123,894 |
No | output | 1 | 61,947 | 11 | 123,895 |
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 | instruction | 0 | 62,061 | 11 | 124,122 |
"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)
``` | output | 1 | 62,061 | 11 | 124,123 |
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 | instruction | 0 | 62,063 | 11 | 124,126 |
"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)
``` | output | 1 | 62,063 | 11 | 124,127 |
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 | instruction | 0 | 62,064 | 11 | 124,128 |
"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)
``` | output | 1 | 62,064 | 11 | 124,129 |
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 | instruction | 0 | 62,065 | 11 | 124,130 |
"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)
``` | output | 1 | 62,065 | 11 | 124,131 |
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 | instruction | 0 | 62,066 | 11 | 124,132 |
"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)
``` | output | 1 | 62,066 | 11 | 124,133 |
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)
``` | instruction | 0 | 62,069 | 11 | 124,138 |
Yes | output | 1 | 62,069 | 11 | 124,139 |
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)
``` | instruction | 0 | 62,070 | 11 | 124,140 |
Yes | output | 1 | 62,070 | 11 | 124,141 |
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)
``` | instruction | 0 | 62,071 | 11 | 124,142 |
Yes | output | 1 | 62,071 | 11 | 124,143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.