message stringlengths 2 67k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 463 109k | cluster float64 19 19 | __index_level_0__ int64 926 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mojtaba and Arpa are playing a game. They have a list of n numbers in the game.
In a player's turn, he chooses a number pk (where p is a prime number and k is a positive integer) such that pk d... | instruction | 0 | 105,823 | 19 | 211,646 |
No | output | 1 | 105,823 | 19 | 211,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mojtaba and Arpa are playing a game. They have a list of n numbers in the game.
In a player's turn, he chooses a number pk (where p is a prime number and k is a positive integer) such that pk d... | instruction | 0 | 105,824 | 19 | 211,648 |
No | output | 1 | 105,824 | 19 | 211,649 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.
A game is played by N playe... | instruction | 0 | 105,930 | 19 | 211,860 |
"Correct Solution:
```
N,K,Q=map(int,input().split())
A=[0]*N
for i in range(Q):
b=int(input())
A[b-1]+=1
for i in range(N):
if K+A[i]>Q:
print("Yes")
else:
print("No")
``` | output | 1 | 105,930 | 19 | 211,861 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.
A game is played by N playe... | instruction | 0 | 105,931 | 19 | 211,862 |
"Correct Solution:
```
N,K,Q = map(int,input().split())
scores = [K] * N
for i in range(Q):
a = int(input())
scores[a - 1] += 1
for s in scores:
print(("No","Yes")[s - Q > 0])
``` | output | 1 | 105,931 | 19 | 211,863 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.
A game is played by N playe... | instruction | 0 | 105,932 | 19 | 211,864 |
"Correct Solution:
```
N, K, Q = map(int, input().split())
points = [K-Q]*N
for i in range(Q):
points[int(input())-1] += 1
for p in points:
print('Yes' if p>0 else 'No')
``` | output | 1 | 105,932 | 19 | 211,865 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.
A game is played by N playe... | instruction | 0 | 105,933 | 19 | 211,866 |
"Correct Solution:
```
n,k,q=map(int,input().split())
A=[k-q]*n
for i in range(q):
a=int(input())
A[a-1] += 1
for a in A:
print("Yes") if a>0 else print("No")
``` | output | 1 | 105,933 | 19 | 211,867 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.
A game is played by N playe... | instruction | 0 | 105,934 | 19 | 211,868 |
"Correct Solution:
```
n,k,q=map(int,input().split())
A=[0]*n
for i in range(q):
A[int(input())-1]+=1
for i in range(n):
if k-q+A[i]<=0:
print("No")
else:
print("Yes")
``` | output | 1 | 105,934 | 19 | 211,869 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.
A game is played by N playe... | instruction | 0 | 105,935 | 19 | 211,870 |
"Correct Solution:
```
n,k,q=map(int,input().split())
li=[0]*n
for i in range(q):
a=int(input())
li[a-1]+=1
for i in range(n):
if li[i]>q-k:
print("Yes")
else:
print("No")
``` | output | 1 | 105,935 | 19 | 211,871 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.
A game is played by N playe... | instruction | 0 | 105,936 | 19 | 211,872 |
"Correct Solution:
```
N, K, Q = map(int, input().split())
A = [0] * N
for _ in range(Q):
a = int(input())
A[a - 1] += 1
for a in A:
print('Yes' if K - Q + a > 0 else 'No')
``` | output | 1 | 105,936 | 19 | 211,873 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.
A game is played by N playe... | instruction | 0 | 105,937 | 19 | 211,874 |
"Correct Solution:
```
n,k,q = map(int,input().split())
l = [k-q]*n
for _ in range(q): l[int(input())-1]+=1
for i in l: print('YNeos'[i<1::2])
``` | output | 1 | 105,937 | 19 | 211,875 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game,... | instruction | 0 | 105,938 | 19 | 211,876 |
Yes | output | 1 | 105,938 | 19 | 211,877 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game,... | instruction | 0 | 105,939 | 19 | 211,878 |
Yes | output | 1 | 105,939 | 19 | 211,879 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game,... | instruction | 0 | 105,940 | 19 | 211,880 |
Yes | output | 1 | 105,940 | 19 | 211,881 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game,... | instruction | 0 | 105,941 | 19 | 211,882 |
Yes | output | 1 | 105,941 | 19 | 211,883 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game,... | instruction | 0 | 105,942 | 19 | 211,884 |
No | output | 1 | 105,942 | 19 | 211,885 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game,... | instruction | 0 | 105,943 | 19 | 211,886 |
No | output | 1 | 105,943 | 19 | 211,887 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game,... | instruction | 0 | 105,944 | 19 | 211,888 |
No | output | 1 | 105,944 | 19 | 211,889 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game,... | instruction | 0 | 105,945 | 19 | 211,890 |
No | output | 1 | 105,945 | 19 | 211,891 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells contain the same num... | instruction | 0 | 106,115 | 19 | 212,230 |
Tags: brute force, dp, games
Correct Solution:
```
n = int(input())
p = [int(x) for x in input().split()]
dp = ['B' for _ in range(n)]
idx = sorted([[p[i], i] for i in range(n)],reverse=True)
idx = [x[1] for x in idx]
for i in idx:
for j in range(1,n):
ind = i + j*p[i]
ind1 = i - j*p[i]
... | output | 1 | 106,115 | 19 | 212,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells contain the same num... | instruction | 0 | 106,116 | 19 | 212,232 |
Tags: brute force, dp, games
Correct Solution:
```
i=m=n=int(input())
a=[*map(int,input().split())]
s=[0]*n
r=[range(i%a[i],n,a[i])for i in range(n)]
while m:
i=(i-1)%n
if s[i]==0:
if all(a[j]<=a[i] or s[j]=='A'for j in r[i]):s[i]='B';m-=1
if any(a[j]>a[i] and s[j]=='B'for j in r[i]):s[i]='A';m-=1
print(''.join(s... | output | 1 | 106,116 | 19 | 212,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells contain the same num... | instruction | 0 | 106,117 | 19 | 212,234 |
Tags: brute force, dp, games
Correct Solution:
```
R = lambda: map(int, input().split())
n = int(input())
a = list(R())
arr = sorted(([x, i] for i, x in enumerate(a)), reverse=True)
res = [-1] * n
for x, i in arr:
res[i] = 0 if any(res[j] == 1 for j in range(i + x, n, x) if a[j] > a[i]) or any(res[j] == 1 for j in ... | output | 1 | 106,117 | 19 | 212,235 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells contain the same num... | instruction | 0 | 106,118 | 19 | 212,236 |
Tags: brute force, dp, games
Correct Solution:
```
n = int(input())
a = list(map(int,input().split()))
ans = [-1]*n
loc = {}
for i in range(n):
loc[a[i]] = i
for i in range(n):
if a[i]>i and a[i]>=n-i:
ans[i] = "B"
prev = 0
while ans.count(-1)!=prev:
prev = ans.count(-1)
for i in range(n):
if ans[i]==-1:
for... | output | 1 | 106,118 | 19 | 212,237 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells contain the same num... | instruction | 0 | 106,119 | 19 | 212,238 |
Tags: brute force, dp, games
Correct Solution:
```
def f(k):
if mem[k]!=-1:
return mem[k]
t=a[k]
ans="B"
for i in range(k,-1,-t):
if a[i]>t:
if f(i)=="B":
ans="A"
for i in range(k,n,t):
if a[i]>t:
if f(i)=="B":
ans="A"
mem[k]=ans
return ans
n=int(input())
a=list(map... | output | 1 | 106,119 | 19 | 212,239 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells contain the same num... | instruction | 0 | 106,120 | 19 | 212,240 |
Tags: brute force, dp, games
Correct Solution:
```
N = int(input())
a = list(map(int, input().split()))
rec = ["+"] * N
P = [0] * N
for i in range(N):
P[a[i] - 1] = i
for i in range(N, 0, -1):
j = P[i - 1]
rec[j] = "B"
for k in range(j % i, N, i):
if j != k and a[j] <= a[k] and rec[k] == "B":
... | output | 1 | 106,120 | 19 | 212,241 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells contain the same num... | instruction | 0 | 106,121 | 19 | 212,242 |
Tags: brute force, dp, games
Correct Solution:
```
n=int(input())
a=[*map(int,input().split())]
s=[0]*n
t=set(range(n))
while t:
q=set()
for i in t:
x=a[i];r=range(i%x,n,x)
if all(a[j]<=x or s[j]=='A'for j in r):s[i]='B';q|={i}
if any(a[j]>x and s[j]=='B'for j in r):s[i]='A';q|={i}
t-=q
print(''.join(s))
``` | output | 1 | 106,121 | 19 | 212,243 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells contain the same num... | instruction | 0 | 106,122 | 19 | 212,244 |
Tags: brute force, dp, games
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
def main():
n = int(input())
a = list(map(int,input().split()))
ind = sorted(range(n),key=lambda xx:a[xx],reverse=1)
ans = [0]*n
for i in ind... | output | 1 | 106,122 | 19 | 212,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n.... | instruction | 0 | 106,123 | 19 | 212,246 |
Yes | output | 1 | 106,123 | 19 | 212,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n.... | instruction | 0 | 106,124 | 19 | 212,248 |
Yes | output | 1 | 106,124 | 19 | 212,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n.... | instruction | 0 | 106,125 | 19 | 212,250 |
Yes | output | 1 | 106,125 | 19 | 212,251 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n.... | instruction | 0 | 106,126 | 19 | 212,252 |
Yes | output | 1 | 106,126 | 19 | 212,253 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n.... | instruction | 0 | 106,127 | 19 | 212,254 |
No | output | 1 | 106,127 | 19 | 212,255 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n.... | instruction | 0 | 106,128 | 19 | 212,256 |
No | output | 1 | 106,128 | 19 | 212,257 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n.... | instruction | 0 | 106,129 | 19 | 212,258 |
No | output | 1 | 106,129 | 19 | 212,259 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n.... | instruction | 0 | 106,130 | 19 | 212,260 |
No | output | 1 | 106,130 | 19 | 212,261 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 is adjacent to cell n. Initially, each cell is ... | instruction | 0 | 106,404 | 19 | 212,808 |
Tags: chinese remainder theorem, combinatorics, constructive algorithms, fft, games, geometry, math, meet-in-the-middle, string suffix structures
Correct Solution:
```
from sys import stdin
def getInt():
return int(stdin.readline().strip())
def bruteForce(n):
x = [[i,j] for i in range(3) for j in range(3) if ... | output | 1 | 106,404 | 19 | 212,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 is adjacent to cell n. Initially, each cell is ... | instruction | 0 | 106,405 | 19 | 212,810 |
Tags: chinese remainder theorem, combinatorics, constructive algorithms, fft, games, geometry, math, meet-in-the-middle, string suffix structures
Correct Solution:
```
from sys import stdin, gettrace
if gettrace():
def inputi():
return input()
else:
def input():
return next(stdin)[:-1]
de... | output | 1 | 106,405 | 19 | 212,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 is adjacent to cell n. Initially, each cell is ... | instruction | 0 | 106,406 | 19 | 212,812 |
Tags: chinese remainder theorem, combinatorics, constructive algorithms, fft, games, geometry, math, meet-in-the-middle, string suffix structures
Correct Solution:
```
import sys
sys.stderr = sys.stdout
M = 10**9 + 7
def modinv(a):
r0 = a
r1 = M
s0 = 1
s1 = 0
t0 = 0
t1 = 1
while r1:
... | output | 1 | 106,406 | 19 | 212,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 is adjacent to cell n. Initially, each cell is ... | instruction | 0 | 106,407 | 19 | 212,814 |
Tags: chinese remainder theorem, combinatorics, constructive algorithms, fft, games, geometry, math, meet-in-the-middle, string suffix structures
Correct Solution:
```
import sys
input = sys.stdin.readline
n = int(input())
mod = 10 ** 9 + 7
F = [0] * (n + 1)
F[0] = 1
for i in range(1, n + 1):
F[i] = i * F[i - 1] %... | output | 1 | 106,407 | 19 | 212,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 ... | instruction | 0 | 106,408 | 19 | 212,816 |
No | output | 1 | 106,408 | 19 | 212,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 ... | instruction | 0 | 106,409 | 19 | 212,818 |
No | output | 1 | 106,409 | 19 | 212,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 ... | instruction | 0 | 106,410 | 19 | 212,820 |
No | output | 1 | 106,410 | 19 | 212,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 ... | instruction | 0 | 106,411 | 19 | 212,822 |
No | output | 1 | 106,411 | 19 | 212,823 |
Provide a correct Python 3 solution for this coding contest problem.
There is a set of cards with positive integers written on them. Stack the cards to make several piles and arrange them side by side. Select two adjacent piles of cards from them, and stack the left pile on top of the right pile. Repeat this operation... | instruction | 0 | 106,945 | 19 | 213,890 |
"Correct Solution:
```
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect
MOD = 10 ** 9 + 7
INF = 10 ** 18
input = lambda: sys.stdin.readline()... | output | 1 | 106,945 | 19 | 213,891 |
Provide a correct Python 3 solution for this coding contest problem.
There is a set of cards with positive integers written on them. Stack the cards to make several piles and arrange them side by side. Select two adjacent piles of cards from them, and stack the left pile on top of the right pile. Repeat this operation... | instruction | 0 | 106,946 | 19 | 213,892 |
"Correct Solution:
```
# AOJ 0145 Cards
# Python3 2018.6.18 bal4u
# 動的計画法 (行列の積に類似)
INF = 0x7fffffff
n = int(input())
c = [[INF for j in range(n)] for i in range(n)]
a = [[0 for j in range(2)] for i in range(n)]
for i in range(n): c[i][i] = 0
for i in range(n): a[i][0], a[i][1] = list(map(int, input().split()))
for... | output | 1 | 106,946 | 19 | 213,893 |
Provide a correct Python 3 solution for this coding contest problem.
There is a set of cards with positive integers written on them. Stack the cards to make several piles and arrange them side by side. Select two adjacent piles of cards from them, and stack the left pile on top of the right pile. Repeat this operation... | instruction | 0 | 106,947 | 19 | 213,894 |
"Correct Solution:
```
n=int(input())
cards=[]
for i in range(n):
a,b=map(int,input().split())
cards.append((a,b))
memo=[[-1 for i in range(n+1)]for j in range(n+1)]
def getans (l,r,cards):
if(memo[l][r]==-1):
if(l+1==r):
memo[l][r]=0
else:
ans=1<<32
for ... | output | 1 | 106,947 | 19 | 213,895 |
Provide a correct Python 3 solution for this coding contest problem.
There is a set of cards with positive integers written on them. Stack the cards to make several piles and arrange them side by side. Select two adjacent piles of cards from them, and stack the left pile on top of the right pile. Repeat this operation... | instruction | 0 | 106,948 | 19 | 213,896 |
"Correct Solution:
```
"""
dp[i][j] ... j ~ j + i までまとめた時の最小コスト
dp[0][j] = 0
dp[i][j] = min(dp[k][j] + dp[i - k][j + k + 1] +\
top[j] * bottom[j + k] * top[j + k + 1] * bottom[j + i] for k in range(i))
"""
INF = 10 ** 20
n = int(input())
top = []
bottom = []
for _ in range(n):
a, b = map(int, input().s... | output | 1 | 106,948 | 19 | 213,897 |
Provide a correct Python 3 solution for this coding contest problem.
Description
In 200X, the mysterious circle K, which operates at K University, announced K Poker, a new game they created on the 4th floor of K East during the university's cultural festival.
At first glance, this game is normal poker, but it is a de... | instruction | 0 | 106,974 | 19 | 213,948 |
"Correct Solution:
```
from collections import Counter
def parse_card(card):
suit = card[-1]
num = card[:-1]
if num == "A":num = 1
elif num == "K":num = 13
elif num == "Q":num = 12
elif num == "J":num = 11
elif num == "T":num = 10
else:num = int(num)
return (num, suit)
def parse_hand(hand):
retur... | output | 1 | 106,974 | 19 | 213,949 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
GPA is an abbreviation for "Galaxy Point of Aizu" and takes real numbers from 0 to 4.
GPA rock-paper-scissors is a game played by two people. After each player gives a signal of "rock-paper-scissors, pon (hoi)" to each other's favorite move,... | instruction | 0 | 106,982 | 19 | 213,964 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LS(): return input().split()
def I(): return... | output | 1 | 106,982 | 19 | 213,965 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
GPA is an abbreviation for "Galaxy Point of Aizu" and takes real numbers from 0 to 4.
GPA rock-paper-scissors is a game played by two people. After each player gives a signal of "rock-paper-scissors, pon (hoi)" to each other's favorite move,... | instruction | 0 | 106,983 | 19 | 213,966 |
"Correct Solution:
```
from bisect import bisect_left as bl
from bisect import bisect_right as br
n = int(input())
gpa = []
for _ in range(n):
gpa.append(float(input()))
gpa_s = sorted(gpa)
for g in gpa:
less = bl(gpa_s, g)
more = br(gpa_s, g)
print(less * 3 + (more-less-1))
``` | output | 1 | 106,983 | 19 | 213,967 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
GPA is an abbreviation for "Galaxy Point of Aizu" and takes real numbers from 0 to 4.
GPA rock-paper-scissors is a game played by two people. After each player gives a signal of "rock-paper-scissors, pon (hoi)" to each other's favorite move,... | instruction | 0 | 106,984 | 19 | 213,968 |
"Correct Solution:
```
N = int(input())
P = {}
for i in range(N):
p = float(input())
P.setdefault(p, []).append(i)
ans = [0]*N
c = 0
for p, s in sorted(P.items()):
for i in s:
ans[i] = 3*c + len(s)-1
c += len(s)
print(*ans, sep='\n')
``` | output | 1 | 106,984 | 19 | 213,969 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.