message stringlengths 2 20.1k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 1.95k 109k | cluster float64 17 17 | __index_level_0__ int64 3.91k 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently personal training sessions have finished in the Berland State University Olympiad Programmer Training Centre. By the results of these training sessions teams are composed for the oncomi... | instruction | 0 | 32,978 | 17 | 65,956 |
No | output | 1 | 32,978 | 17 | 65,957 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently personal training sessions have finished in the Berland State University Olympiad Programmer Training Centre. By the results of these training sessions teams are composed for the oncomi... | instruction | 0 | 32,979 | 17 | 65,958 |
No | output | 1 | 32,979 | 17 | 65,959 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently personal training sessions have finished in the Berland State University Olympiad Programmer Training Centre. By the results of these training sessions teams are composed for the oncomi... | instruction | 0 | 32,980 | 17 | 65,960 |
No | output | 1 | 32,980 | 17 | 65,961 |
Provide a correct Python 3 solution for this coding contest problem.
N people run a marathon. There are M resting places on the way. For each resting place, the i-th runner takes a break with probability P_i percent. When the i-th runner takes a break, he gets rest for T_i time.
The i-th runner runs at constant speed... | instruction | 0 | 33,283 | 17 | 66,566 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int... | output | 1 | 33,283 | 17 | 66,567 |
Provide a correct Python 3 solution for this coding contest problem.
N people run a marathon. There are M resting places on the way. For each resting place, the i-th runner takes a break with probability P_i percent. When the i-th runner takes a break, he gets rest for T_i time.
The i-th runner runs at constant speed... | instruction | 0 | 33,284 | 17 | 66,568 |
"Correct Solution:
```
import bisect
def nCr(n, r):
r = min(r, n-r)
numerator = 1
for i in range(n, n-r, -1):
numerator *= i
denominator = 1
for i in range(r, 1, -1):
denominator *= i
return numerator // denominator
n,m,l=map(int,input().split())
data = [[0 for i in range(m+1)]... | output | 1 | 33,284 | 17 | 66,569 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N people run a marathon. There are M resting places on the way. For each resting place, the i-th runner takes a break with probability P_i percent. When the i-th runner takes a break, he gets re... | instruction | 0 | 33,285 | 17 | 66,570 |
No | output | 1 | 33,285 | 17 | 66,571 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
N people run a marathon. There are M resting places on the way. For each resting place, the i-th runner takes a break with probability P_i percent. When the i-th runner takes a break, he gets re... | instruction | 0 | 33,286 | 17 | 66,572 |
No | output | 1 | 33,286 | 17 | 66,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course of students at the univ... | instruction | 0 | 34,798 | 17 | 69,596 |
Tags: *special, implementation, sortings
Correct Solution:
```
n = int(input())
group = list(map(int, input().split()))
if n == 1:
print(group[0])
else:
group.sort()
if n == 3:
print(group[1])
else:
print(group[2])
``` | output | 1 | 34,798 | 17 | 69,597 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course of students at the univ... | instruction | 0 | 34,799 | 17 | 69,598 |
Tags: *special, implementation, sortings
Correct Solution:
```
n=int(input())
l=[int(i) for i in input().split()]
l=sorted(l)
print(l[n//2])
``` | output | 1 | 34,799 | 17 | 69,599 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course of students at the univ... | instruction | 0 | 34,800 | 17 | 69,600 |
Tags: *special, implementation, sortings
Correct Solution:
```
n = int(input())
A = list(map(int,input().split()))
A.sort()
i = 0
i = n//2
print(A[i])
``` | output | 1 | 34,800 | 17 | 69,601 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course of students at the univ... | instruction | 0 | 34,801 | 17 | 69,602 |
Tags: *special, implementation, sortings
Correct Solution:
```
n = int(input())
a=2010
b=2100
c=list(map(int,input().split()))
print((min(c)+max(c))//2)
``` | output | 1 | 34,801 | 17 | 69,603 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course of students at the univ... | instruction | 0 | 34,802 | 17 | 69,604 |
Tags: *special, implementation, sortings
Correct Solution:
```
n=int(input())
l=list(sorted(map(int,input().split())))
print(l[n//2])
``` | output | 1 | 34,802 | 17 | 69,605 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course of students at the univ... | instruction | 0 | 34,803 | 17 | 69,606 |
Tags: *special, implementation, sortings
Correct Solution:
```
n = int(input())
print(sorted(list(map(int, input().split())))[int(n / 2)])
``` | output | 1 | 34,803 | 17 | 69,607 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course of students at the univ... | instruction | 0 | 34,804 | 17 | 69,608 |
Tags: *special, implementation, sortings
Correct Solution:
```
n = int(input())
lst = list(map(int, input().split()))
print (int((max(lst) + min(lst)) / 2))
``` | output | 1 | 34,804 | 17 | 69,609 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course of students at the univ... | instruction | 0 | 34,805 | 17 | 69,610 |
Tags: *special, implementation, sortings
Correct Solution:
```
n=int(input())
a=list(map(int,input().split()))
a.sort()
if n%2==1:
ind=(n-1)//2
result=a[ind]
elif 2010 in a:
ind=(n//2)-1
result=a[ind]
elif 2100 in a:
ind=n//2
result=a[ind]
print(result)
#print(' '.join(map(str,a)))
``` | output | 1 | 34,805 | 17 | 69,611 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance ... | instruction | 0 | 34,806 | 17 | 69,612 |
Yes | output | 1 | 34,806 | 17 | 69,613 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance ... | instruction | 0 | 34,807 | 17 | 69,614 |
Yes | output | 1 | 34,807 | 17 | 69,615 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance ... | instruction | 0 | 34,808 | 17 | 69,616 |
Yes | output | 1 | 34,808 | 17 | 69,617 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance ... | instruction | 0 | 34,811 | 17 | 69,622 |
No | output | 1 | 34,811 | 17 | 69,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by usin... | instruction | 0 | 35,737 | 17 | 71,474 |
Yes | output | 1 | 35,737 | 17 | 71,475 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by usin... | instruction | 0 | 35,738 | 17 | 71,476 |
Yes | output | 1 | 35,738 | 17 | 71,477 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by usin... | instruction | 0 | 35,739 | 17 | 71,478 |
Yes | output | 1 | 35,739 | 17 | 71,479 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by usin... | instruction | 0 | 35,740 | 17 | 71,480 |
Yes | output | 1 | 35,740 | 17 | 71,481 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by usin... | instruction | 0 | 35,741 | 17 | 71,482 |
No | output | 1 | 35,741 | 17 | 71,483 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by usin... | instruction | 0 | 35,742 | 17 | 71,484 |
No | output | 1 | 35,742 | 17 | 71,485 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by usin... | instruction | 0 | 35,743 | 17 | 71,486 |
No | output | 1 | 35,743 | 17 | 71,487 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by usin... | instruction | 0 | 35,744 | 17 | 71,488 |
No | output | 1 | 35,744 | 17 | 71,489 |
Provide a correct Python 3 solution for this coding contest problem.
White Tiger University holds a programming contest every year. The contest starts with a score of 0 for all teams, and points are added according to the answer status. In this contest, rankings will be made in descending order of score. When the tota... | instruction | 0 | 35,915 | 17 | 71,830 |
"Correct Solution:
```
def solve():
from sys import stdin
f_i = stdin
N, C = map(int, f_i.readline().split())
# ranking: [(score, team number), ...]
ranking = [(0, i) for i in range(1, N + 1)]
ranking.insert(0, (-1000000000 * C, 0))
score = [0] * (N + 1)
from bisect import... | output | 1 | 35,915 | 17 | 71,831 |
Provide a correct Python 3 solution for this coding contest problem.
White Tiger University holds a programming contest every year. The contest starts with a score of 0 for all teams, and points are added according to the answer status. In this contest, rankings will be made in descending order of score. When the tota... | instruction | 0 | 35,916 | 17 | 71,832 |
"Correct Solution:
```
from bisect import bisect_left as bl
def main():
n, c = map(int, input().split())
ranking = [(0, i) for i in range(n)]
points = [0 for _ in range(n)]
for _ in range(c):
com = input().split()
if com[0] == "1":
m = int(com[1]) - 1
print(ranking[m][-1] + 1, -ranking[m][0... | output | 1 | 35,916 | 17 | 71,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
White Tiger University holds a programming contest every year. The contest starts with a score of 0 for all teams, and points are added according to the answer status. In this contest, rankings ... | instruction | 0 | 35,917 | 17 | 71,834 |
No | output | 1 | 35,917 | 17 | 71,835 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
White Tiger University holds a programming contest every year. The contest starts with a score of 0 for all teams, and points are added according to the answer status. In this contest, rankings ... | instruction | 0 | 35,918 | 17 | 71,836 |
No | output | 1 | 35,918 | 17 | 71,837 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
White Tiger University holds a programming contest every year. The contest starts with a score of 0 for all teams, and points are added according to the answer status. In this contest, rankings ... | instruction | 0 | 35,919 | 17 | 71,838 |
No | output | 1 | 35,919 | 17 | 71,839 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
White Tiger University holds a programming contest every year. The contest starts with a score of 0 for all teams, and points are added according to the answer status. In this contest, rankings ... | instruction | 0 | 35,920 | 17 | 71,840 |
No | output | 1 | 35,920 | 17 | 71,841 |
Provide a correct Python 3 solution for this coding contest problem.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is dis... | instruction | 0 | 35,940 | 17 | 71,880 |
"Correct Solution:
```
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
MOD = 10**9 + 7
N = int(readline())
S = []
for i in range(N):
s = readline().strip()
if s == "-":
N -= 1
continue
S.append(s == "D")
memo = {}
def... | output | 1 | 35,940 | 17 | 71,881 |
Provide a correct Python 3 solution for this coding contest problem.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is dis... | instruction | 0 | 35,941 | 17 | 71,882 |
"Correct Solution:
```
n = int(input())
s = [input() for i in range(n)]
s = "".join(s).replace("-","")
n = len(s)
mod = 10**9+7
dp = [[0 for i in range(n+1)] for j in range(n+1)]
dp[0][0] = 1
for i in range(n):
si = s[i]
if si == "D":
for j in range(1,n+1):
dp[i+1][j] = (dp[i+1][j]+dp[i][j]*j)%mod
d... | output | 1 | 35,941 | 17 | 71,883 |
Provide a correct Python 3 solution for this coding contest problem.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is dis... | instruction | 0 | 35,942 | 17 | 71,884 |
"Correct Solution:
```
MOD = 1000000007
n = int(input())
dp = [[0] * (n + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
c = input()
for j in range(n):
if c == "-":
dp[i + 1][j] += dp[i][j]
dp[i + 1][j] %= MOD
if c == "U":
dp[i + 1][j] += j * dp[i][... | output | 1 | 35,942 | 17 | 71,885 |
Provide a correct Python 3 solution for this coding contest problem.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is dis... | instruction | 0 | 35,943 | 17 | 71,886 |
"Correct Solution:
```
#!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import ... | output | 1 | 35,943 | 17 | 71,887 |
Provide a correct Python 3 solution for this coding contest problem.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is dis... | instruction | 0 | 35,944 | 17 | 71,888 |
"Correct Solution:
```
"""
Writer: SPD_9X2
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2439
1位から順番に見ていく。
-ならそこの順位に決めざるを得ない
Uなら、左に空いた空きマスから1つ選んでそこに入れる(空きマスは減る)
Dなら、…?
dpであることは分かっている
重要なのはどの状態をまとめるか…
-は関係ないので無視してUDだけの問題にする
UDの列に通し番号を付ける。Uはそれより右に、Dは左にもっていかなくてはならない
そのような並び替えが構成できなくなるのは、左にもとよりUが多い場合・・・
Uだ... | output | 1 | 35,944 | 17 | 71,889 |
Provide a correct Python 3 solution for this coding contest problem.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is dis... | instruction | 0 | 35,945 | 17 | 71,890 |
"Correct Solution:
```
import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# 箱根
N = int(sys.stdin.readline())
C = [sys.stdin.readline().rstrip() for _ in range(N)]
C = [c for c in C if c != '-']
N = ... | output | 1 | 35,945 | 17 | 71,891 |
Provide a correct Python 3 solution for this coding contest problem.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is dis... | instruction | 0 | 35,946 | 17 | 71,892 |
"Correct Solution:
```
MOD = 10**9+7
n = int(input())
dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
dp[0][0] = 1
for i in range(1, n+1):
s = input()
for j in range(n+1):
if s == "U":
if j > 0:
dp[i][j] += dp[i-1][j-1]
dp[i][j] += j * dp[i-1][j]
elif s == "-":
dp[i][j] += dp[i-1][j]
else:
if... | output | 1 | 35,946 | 17 | 71,893 |
Provide a correct Python 3 solution for this coding contest problem.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is dis... | instruction | 0 | 35,947 | 17 | 71,894 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**3
eps = 1.0 / 10**10
mod = 10**9+7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readli... | output | 1 | 35,947 | 17 | 71,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, t... | instruction | 0 | 35,948 | 17 | 71,896 |
Yes | output | 1 | 35,948 | 17 | 71,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, t... | instruction | 0 | 35,949 | 17 | 71,898 |
Yes | output | 1 | 35,949 | 17 | 71,899 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.
The electoral system in the country is pretty unusual. At the first sta... | instruction | 0 | 36,504 | 17 | 73,008 |
Tags: implementation
Correct Solution:
```
n,m=map(int,input().split())
l=[0]*105
for i in range(m):
t=list(map(int,input().split()))
l[t.index(max(t))]+=1
print(l.index(max(l))+1)
``` | output | 1 | 36,504 | 17 | 73,009 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.
The electoral system in the country is pretty unusual. At the first sta... | instruction | 0 | 36,505 | 17 | 73,010 |
Tags: implementation
Correct Solution:
```
n,m=map(int,input().split())
d=[0]*n
for i in range(m):
a=list(map(int,input().split()))
d[a.index(max(a))]+=1
print(d.index(max(d))+1)
``` | output | 1 | 36,505 | 17 | 73,011 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.
The electoral system in the country is pretty unusual. At the first sta... | instruction | 0 | 36,506 | 17 | 73,012 |
Tags: implementation
Correct Solution:
```
n, m = map(int, input().split())
winnerList = []
for i in range(m):
a = list(map(int, input().split()))
large = a[0]
pos = 0
for j in range(n):
if(large < a[j]):
large = a[j]
pos = j
winnerList.append(pos+1)
winnerCount = dic... | output | 1 | 36,506 | 17 | 73,013 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.
The electoral system in the country is pretty unusual. At the first sta... | instruction | 0 | 36,507 | 17 | 73,014 |
Tags: implementation
Correct Solution:
```
#!/usr/bin/env python3
N, M = input().split(' ')
N = int(N)
M = int(M)
winners = [] # winners[i] is the index of the candidate who won city i
def winning_index(arr):
# returns index with largest entry, break ties by smallest index
sort_by = [(-votes, candidate) for ... | output | 1 | 36,507 | 17 | 73,015 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.
The electoral system in the country is pretty unusual. At the first sta... | instruction | 0 | 36,508 | 17 | 73,016 |
Tags: implementation
Correct Solution:
```
n,m=map(int,input().split())
win=[0]*1000
for i in range(m):
l=[int(i) for i in input().split()]
win[l.index(max(l))]+=1
print(win.index(max(win))+1)
``` | output | 1 | 36,508 | 17 | 73,017 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.
The electoral system in the country is pretty unusual. At the first sta... | instruction | 0 | 36,509 | 17 | 73,018 |
Tags: implementation
Correct Solution:
```
import sys
fin = sys.stdin #open ('in', 'r')
#fout = open ('out', 'w')
[n, m] = [int(x) for x in fin.readline().split()]
votes = [0] * n
for i in range(m):
_votes = [int(x) for x in fin.readline().split()]
sel = _votes.index(max(_votes))
votes[sel] += 1
print(str(1 + v... | output | 1 | 36,509 | 17 | 73,019 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.
The electoral system in the country is pretty unusual. At the first sta... | instruction | 0 | 36,510 | 17 | 73,020 |
Tags: implementation
Correct Solution:
```
n, m = map(int, input().split())
a = [0] * n
for i in range(m):
b = list(map(int, input().split()))
a[b.index(max(b))]+=1
print(a.index(max(a)) + 1)
``` | output | 1 | 36,510 | 17 | 73,021 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.