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. Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only lim...
instruction
0
55,140
19
110,280
Yes
output
1
55,140
19
110,281
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only lim...
instruction
0
55,141
19
110,282
No
output
1
55,141
19
110,283
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only lim...
instruction
0
55,142
19
110,284
No
output
1
55,142
19
110,285
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only lim...
instruction
0
55,143
19
110,286
No
output
1
55,143
19
110,287
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only lim...
instruction
0
55,144
19
110,288
No
output
1
55,144
19
110,289
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one poi...
instruction
0
55,165
19
110,330
Tags: binary search Correct Solution: ``` n = int(input()) line = input().split() lst = [] for num in line: lst.append(int(num)) cnt1 = [0] cnt2 = [0] c1 = 0 c2 = 0 for num in lst: if num == 1: c1 += 1 cnt1.append(c2) else: c2 += 1 cnt2.append(c1) w = lst[n - 1] ans = [] ...
output
1
55,165
19
110,331
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one poi...
instruction
0
55,166
19
110,332
Tags: binary search Correct Solution: ``` #!/usr/bin/env python3 import itertools n = int(input()) a = [int(x) for x in input().split()] winner = a[-1] looser = 3 - winner serve_win_cnt, serve_loose_cnt, win_pos, loose_pos, result = [0], [0], [-1], [-1], [] win_cnt = a.count(winner) for i in range(n): if a[i] =...
output
1
55,166
19
110,333
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one poi...
instruction
0
55,167
19
110,334
Tags: binary search Correct Solution: ``` #!/usr/bin/env python3 import itertools n = int(input()) a = [int(x) for x in input().split()] winner = a[-1] looser = 3 - winner serve_win_cnt, serve_loose_cnt, win_pos, loose_pos, result = [0], [0], [-1], [-1], [] win_cnt = a.count(winner) for i in range(n): if a[i] =...
output
1
55,167
19
110,335
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one poi...
instruction
0
55,168
19
110,336
Tags: binary search Correct Solution: ``` import itertools n = int(input()) a = [int(x) for x in input().split()] winner = a[-1] looser = 3 - winner serve_win_cnt, serve_loose_cnt, win_pos, loose_pos, result = [0], [0], [-1], [-1], [] win_cnt = a.count(winner) for i in range(n): if a[i] == winner: win_po...
output
1
55,168
19
110,337
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one poi...
instruction
0
55,169
19
110,338
Tags: binary search Correct Solution: ``` from itertools import chain def main(n,a, info=False): winner = a[-1] looser = 3-winner csw, csl, pw, pl, ans = [0], [0], [-1], [-1], [] nw,nl = a.count(winner), a.count(looser) for i in range(n): if a[i]==winner: pw.append(i) else: pl.append...
output
1
55,169
19
110,339
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by...
instruction
0
55,170
19
110,340
No
output
1
55,170
19
110,341
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by...
instruction
0
55,171
19
110,342
No
output
1
55,171
19
110,343
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by...
instruction
0
55,172
19
110,344
No
output
1
55,172
19
110,345
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by...
instruction
0
55,173
19
110,346
No
output
1
55,173
19
110,347
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars. Each ...
instruction
0
55,190
19
110,380
Tags: implementation, math, number theory Correct Solution: ``` n = int(input()) a = list(map(int,input().split())) for i in range(len(a)) : while(a[i]%2==0) : a[i] = a[i]//2 while(a[i]%3==0) : a[i] = a[i]//3 flag = 1 #print(a) for i in range(1,len(a)) : ...
output
1
55,190
19
110,381
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars. Each ...
instruction
0
55,191
19
110,382
Tags: implementation, math, number theory Correct Solution: ``` #!/usr/bin/env python3 # -*- coding: utf-8 -*- # AUTHOR: haya14busa import sys import io def div(n): while n % 2 == 0: n //= 2 while n % 3 == 0: n //= 3 return n def solve(n, bs): # n: n players (including Limak himself) ...
output
1
55,191
19
110,383
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars. Each ...
instruction
0
55,192
19
110,384
Tags: implementation, math, number theory Correct Solution: ``` N = int(input()) x = [int(i) for i in input().split()] for i in range(N): while x[i] % 2 == 0: x[i] //= 2 while x[i] % 3 == 0: x[i] //= 3 T = True for i in range(N - 1): if x[i] != x[i+1]: T = False print('Yes' if T e...
output
1
55,192
19
110,385
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars. Each ...
instruction
0
55,193
19
110,386
Tags: implementation, math, number theory Correct Solution: ``` def fun(num): while num%2==0: num//=2 while num%3==0: num//=3 return num n=int(input()); flag=True; p=0; c=0 for i in input().split(): if p==0: p=fun(int(i)) else: c=fun(int(i)) if c!=p: ...
output
1
55,193
19
110,387
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars. Each ...
instruction
0
55,194
19
110,388
Tags: implementation, math, number theory Correct Solution: ``` import fractions n = int(input()) l = [int(i) for i in input().split()] gcd = l[0] for i in range(1,n): gcd = fractions.gcd(gcd,l[i]) while gcd%2 == 0 : gcd/=2 while gcd%3 == 0 : gcd/=3 ans = 'YES' for i in range(n): k = l[i] t=1 t1=1 while k%(2*t) ...
output
1
55,194
19
110,389
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars. Each ...
instruction
0
55,195
19
110,390
Tags: implementation, math, number theory Correct Solution: ``` def divide(n): while True: if(n%2 == 0): n//=2 elif(n%3 == 0): n//=3 else: break return n n = int(input()) l = [int(i) for i in input().split()] itJustWorks = True rem = divide(l[0]) ...
output
1
55,195
19
110,391
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars. Each ...
instruction
0
55,196
19
110,392
Tags: implementation, math, number theory Correct Solution: ``` from sys import stdin, stdout input = stdin.readline def nod(a,b): if b == 0: return a else: return nod(b, a%b) def good(a): while a > 1: if a % 2 == 0: a //= 2 elif a % 3 == 0: a //= 3 ...
output
1
55,196
19
110,393
Provide tags and a correct Python 3 solution for this coding contest problem. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars. Each ...
instruction
0
55,197
19
110,394
Tags: implementation, math, number theory Correct Solution: ``` from sys import stdin,stdout from collections import Counter from math import ceil from bisect import bisect_left from bisect import bisect_right import math ai = lambda: list(map(int, stdin.readline().split())) ei = lambda: map(int, stdin.readline().spl...
output
1
55,197
19
110,395
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-...
instruction
0
55,198
19
110,396
Yes
output
1
55,198
19
110,397
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-...
instruction
0
55,199
19
110,398
Yes
output
1
55,199
19
110,399
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-...
instruction
0
55,200
19
110,400
Yes
output
1
55,200
19
110,401
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-...
instruction
0
55,201
19
110,402
Yes
output
1
55,201
19
110,403
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-...
instruction
0
55,202
19
110,404
No
output
1
55,202
19
110,405
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-...
instruction
0
55,203
19
110,406
No
output
1
55,203
19
110,407
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-...
instruction
0
55,204
19
110,408
No
output
1
55,204
19
110,409
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-...
instruction
0
55,205
19
110,410
No
output
1
55,205
19
110,411
Provide tags and a correct Python 3 solution for this coding contest problem. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will ...
instruction
0
55,302
19
110,604
Tags: bitmasks, brute force, dfs and similar, expression parsing, implementation Correct Solution: ``` def func(b0, b1, op): if op == 0: return b0 ^ b1 if op == 1: return b0 | b1 if op == 2: return b0 & b1 n, m = [int(x) for x in input().split()] cs = {} ops = ['XOR', 'OR', 'AND'] f...
output
1
55,302
19
110,605
Provide tags and a correct Python 3 solution for this coding contest problem. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will ...
instruction
0
55,303
19
110,606
Tags: bitmasks, brute force, dfs and similar, expression parsing, implementation Correct Solution: ``` import sys def calc(b0, b1, q): if q == 0: return b0 ^ b1 if q == 1: return b0 | b1 if q == 2: return b0 & b1 n, m = map(int,sys.stdin.readline().split()) arr1 = {} opt = ['XOR', 'O...
output
1
55,303
19
110,607
Provide tags and a correct Python 3 solution for this coding contest problem. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will ...
instruction
0
55,304
19
110,608
Tags: bitmasks, brute force, dfs and similar, expression parsing, implementation Correct Solution: ``` #from math import * from sys import * from decimal import * def main(): n,k=(int(z) for z in stdin.readline().split()) d=[] nm=[0]*n bt1=[False]*(n+1) bt2=[False]*(n+1) bt2[-1]=True nam=di...
output
1
55,304
19
110,609
Provide tags and a correct Python 3 solution for this coding contest problem. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will ...
instruction
0
55,305
19
110,610
Tags: bitmasks, brute force, dfs and similar, expression parsing, implementation Correct Solution: ``` n, m = map(int, input().split()) v = [('?', '')] temp = [(0, 1)] d = {} d['?'] = 0 mn, mx = '', '' for i in range(n): name, val = input().split(' := ') v.append((name, val.split())) temp.append((-1, -1)...
output
1
55,305
19
110,611
Provide tags and a correct Python 3 solution for this coding contest problem. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will ...
instruction
0
55,306
19
110,612
Tags: bitmasks, brute force, dfs and similar, expression parsing, implementation Correct Solution: ``` f = {'OR': lambda x, y: x | y, 'AND': lambda x, y: x & y, 'XOR': lambda x, y: x ^ y} n, m = map(int, input().split()) u, v = [], [] d = {'?': n} for i in range(n): q, s = input().split(' := ') if ' ' in s: ...
output
1
55,306
19
110,613
Provide tags and a correct Python 3 solution for this coding contest problem. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will ...
instruction
0
55,307
19
110,614
Tags: bitmasks, brute force, dfs and similar, expression parsing, implementation Correct Solution: ``` #from math import * from sys import * from decimal import * n,k=(int(z) for z in stdin.readline().split()) d=[] #bt1=dict() #bt2=dict() nm=[0]*n bt1=[False]*(n+1) bt2=[False]*(n+1) bt2[-1]=True nam=dict() nam["?"]=-1...
output
1
55,307
19
110,615
Provide tags and a correct Python 3 solution for this coding contest problem. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will ...
instruction
0
55,308
19
110,616
Tags: bitmasks, brute force, dfs and similar, expression parsing, implementation Correct Solution: ``` n, m = map(int, input().split()) vars = {} def mxor(a, b): if a == b: return '0' elif (a == '0' and b == '1') or (a == '1' and b =='0'): return '1' elif (a == '0' and b == 'x') or (a == '...
output
1
55,308
19
110,617
Provide tags and a correct Python 3 solution for this coding contest problem. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will ...
instruction
0
55,309
19
110,618
Tags: bitmasks, brute force, dfs and similar, expression parsing, implementation Correct Solution: ``` def sumBin(a, b, varMap): lhs = varMap[a] rhs = varMap[b] return bin(int(lhs, 2) + int(rhs, 2))[2:] def andBin(a, b, varMap): lhs = varMap[a] rhs = varMap[b] return bin(int(lhs, 2) & int(rhs, 2))[2:] def...
output
1
55,309
19
110,619
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game,...
instruction
0
55,310
19
110,620
Yes
output
1
55,310
19
110,621
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game,...
instruction
0
55,311
19
110,622
Yes
output
1
55,311
19
110,623
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game,...
instruction
0
55,312
19
110,624
No
output
1
55,312
19
110,625
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game,...
instruction
0
55,313
19
110,626
No
output
1
55,313
19
110,627
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game,...
instruction
0
55,314
19
110,628
No
output
1
55,314
19
110,629
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game,...
instruction
0
55,315
19
110,630
No
output
1
55,315
19
110,631
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that she's not the best at games. The game is played on a directed acyclic graph (a DAG)...
instruction
0
55,356
19
110,712
Tags: dfs and similar, dp, games, graphs Correct Solution: ``` # python3 from functools import lru_cache def readline(): return list(map(int, input().split())) def main(): n, m = readline() edges = [list() for __ in range(n)] for __ in range(m): tokens = input().split() begin, end = map...
output
1
55,356
19
110,713
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that she's not the best at games. The game is played on a directed acyclic graph (a DAG)...
instruction
0
55,357
19
110,714
Tags: dfs and similar, dp, games, graphs Correct Solution: ``` # int(input()) # [int(i) for i in input().split()] import sys sys.setrecursionlimit(20000) def go(v,w,last): if game[v][w][last] >= 0: return(game[v][w][last]) flag = 0 move = 0 for p in edges_out[v]: if p[1] >= last: ...
output
1
55,357
19
110,715
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that she's not the best at games. The game is played on a directed acyclic graph (a DAG)...
instruction
0
55,358
19
110,716
Tags: dfs and similar, dp, games, graphs Correct Solution: ``` # int(input()) # [int(i) for i in input().split()] import sys sys.setrecursionlimit(20000) def go(v,w,last): if game[v][w][last] >= 0: return(game[v][w][last]) flag = 0 move = 0 for p in edges_out[v]: if p[1] >= last: m...
output
1
55,358
19
110,717
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that she's not the best at games. The game is played on a directed acyclic graph (a DAG)...
instruction
0
55,359
19
110,718
Tags: dfs and similar, dp, games, graphs Correct Solution: ``` import sys import bisect as bi import math from collections import defaultdict as dd input=sys.stdin.readline sys.setrecursionlimit(10**7) def solve(u,v,k,adj,dp): if(dp[u][v][k]!=-1):return dp[u][v][k] for child in adj[u]: dest,charstored=c...
output
1
55,359
19
110,719
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that she's not the best at games. The game is played on a directed acyclic graph (a DAG)...
instruction
0
55,360
19
110,720
Tags: dfs and similar, dp, games, graphs Correct Solution: ``` import sys import bisect as bi import math from collections import defaultdict as dd input=sys.stdin.readline sys.setrecursionlimit(10**7) def solve(u,v,k,adj,dp): if(dp[u][v][k]!=-1):return dp[u][v][k] for child in adj[u]: dest,charstored=c...
output
1
55,360
19
110,721
Provide tags and a correct Python 3 solution for this coding contest problem. As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that she's not the best at games. The game is played on a directed acyclic graph (a DAG)...
instruction
0
55,361
19
110,722
Tags: dfs and similar, dp, games, graphs Correct Solution: ``` import sys # sys.setrecursionlimit(10**5) n,m=map(int,input().split()) g={i:[] for i in range(1,n+1)} dp=[[[-1]*26 for _ in range(n+1)] for i in range(n+1)] def rec(i,j,ch): if dp[i][j][ord(ch)-ord('a')]!=-1: return dp[i][j][ord(ch)-ord('a')] for x in ...
output
1
55,361
19
110,723