message
stringlengths
2
19.9k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
322
108k
cluster
float64
15
15
__index_level_0__
int64
644
217k
Provide tags and a correct Python 3 solution for this coding contest problem. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on the following field. <image> Players are makin...
instruction
0
37,432
15
74,864
Tags: implementation Correct Solution: ``` R=input g=[list(R()) for _ in range(11)] r,c=map(lambda x:(x-1)%3*4,map(int,R().split())) f,d='.!' for i in range(9): s,e=g[r+i//3],c+i%3 if s[e]<'o': s[e]=f=d for v in g:print(''.join(v).replace(f,d)) ```
output
1
37,432
15
74,865
Provide tags and a correct Python 3 solution for this coding contest problem. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on the following field. <image> Players are makin...
instruction
0
37,433
15
74,866
Tags: implementation Correct Solution: ``` dy = 0 dx = 0 ok = 0 v = [] for i in range(11): x = list(''.join(input().split())) if (len(x) > 0): v.append(x) y, x = map(int, input().split()) if (y%3 == 1): dy = 0 elif (y%3 == 2): dy = 3 else: dy = 6 if (x%3 == 1): dx = 0 elif (x%3 == 2): dx = 3 else: dx = 6 for i...
output
1
37,433
15
74,867
Provide tags and a correct Python 3 solution for this coding contest problem. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on the following field. <image> Players are makin...
instruction
0
37,434
15
74,868
Tags: implementation Correct Solution: ``` import math,sys,bisect,heapq from collections import defaultdict,Counter,deque from itertools import groupby,accumulate #sys.setrecursionlimit(200000000) int1 = lambda x: int(x) - 1 input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ ilele = lambda: map(int,in...
output
1
37,434
15
74,869
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on t...
instruction
0
37,435
15
74,870
Yes
output
1
37,435
15
74,871
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on t...
instruction
0
37,436
15
74,872
Yes
output
1
37,436
15
74,873
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on t...
instruction
0
37,437
15
74,874
Yes
output
1
37,437
15
74,875
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on t...
instruction
0
37,438
15
74,876
Yes
output
1
37,438
15
74,877
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on t...
instruction
0
37,439
15
74,878
No
output
1
37,439
15
74,879
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on t...
instruction
0
37,440
15
74,880
No
output
1
37,440
15
74,881
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on t...
instruction
0
37,441
15
74,882
No
output
1
37,441
15
74,883
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on t...
instruction
0
37,442
15
74,884
No
output
1
37,442
15
74,885
Provide a correct Python 3 solution for this coding contest problem. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost s...
instruction
0
37,539
15
75,078
"Correct Solution: ``` s = input() ans = [0] * len(s) i = 0 while i < len(s): si = i while s[i] == 'R': i += 1 ti = i while i < len(s) and s[i] == 'L': i += 1 ri = i l = ti - si ans[ti - 1] += (l + 1) // 2 ans[ti] += l // 2 r = ri - ti ans[ti - 1] += r // 2 an...
output
1
37,539
15
75,079
Provide a correct Python 3 solution for this coding contest problem. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost s...
instruction
0
37,540
15
75,080
"Correct Solution: ``` S = input() ans = [0] * len(S) cnt = 0 for _ in range(2): for i in range(len(S)): if S[i] == "R": cnt += 1 else: ans[i] += cnt // 2 ans[i-1] += -(-cnt // 2) cnt = 0 ans = ans[::-1] S = list(S[::-1]) for i in range(len(S)): if S[i] == "R": S[i] = "...
output
1
37,540
15
75,081
Provide a correct Python 3 solution for this coding contest problem. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost s...
instruction
0
37,541
15
75,082
"Correct Solution: ``` s = input()+'R' ans = [0]*(len(s)-1) a = 0 b = 0 cnt = 0 for i in s: if i=='L' and b==0: b = cnt if b!=0 and i=='R': ans[b-1] = 1+(b-1-a)//2+(cnt-b)//2 ans[b] = 1+(b-a)//2+(cnt-1-b)//2 a = cnt b = 0 cnt+=1 print(' '.join(map(str,ans))) ```
output
1
37,541
15
75,083
Provide a correct Python 3 solution for this coding contest problem. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost s...
instruction
0
37,542
15
75,084
"Correct Solution: ``` s = input().replace("RL","R,L").replace("LR","L,R").split(",") s = s[::-1] h = list() while s: a = len(s.pop()) b = len(s.pop()) h.append((a,b)) t = [] for x,y in h: t += [0]*(x-1) + [(x+1)//2+y//2,x//2+(y+1)//2] + [0]*(y-1) print(" ".join(map(str,t))) ```
output
1
37,542
15
75,085
Provide a correct Python 3 solution for this coding contest problem. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost s...
instruction
0
37,543
15
75,086
"Correct Solution: ``` s=input() ans=[] while len(s)>0: index=s.find("LR")+1 if index>0:sub,s=s[:index],s[index:] else:sub,s=s,[] length=len(sub) nums=[0]*length stop=sub.find("RL") odd,even=(length+1)//2,length//2 if stop%2==1:odd,even=even,odd nums[stop],nums[stop+1]=odd,even a...
output
1
37,543
15
75,087
Provide a correct Python 3 solution for this coding contest problem. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost s...
instruction
0
37,544
15
75,088
"Correct Solution: ``` w=input()+"X" n=len(w) ans=[] i=j=0 while True: while w[i]=="R": i+=1 ans+=[0]*(i-j-1) r=(i-j+1)//2 l=(i-j)//2 j=i while w[j]=="L": j+=1 r+=(j-i)//2 l+=(j-i+1)//2 ans.append(r) ans.append(l) ans+=[0]*(j-i-1) if j==n-1: break i=j for a in ans: print(a,end=" ...
output
1
37,544
15
75,089
Provide a correct Python 3 solution for this coding contest problem. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost s...
instruction
0
37,545
15
75,090
"Correct Solution: ``` S = input() N = len(S) L = [1]*N for i,s in enumerate(S): if s == "R": s2 = S[i+1] if s2 == "R": L[i+2] += L[i] L[i] = 0 for i in range(N-1,-1,-1): s = S[i] if s == "L": s2 = S[i-1] if s2 == "L": L[i-2] += L[i] L[i] = 0 print(*L) ```
output
1
37,545
15
75,091
Provide a correct Python 3 solution for this coding contest problem. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost s...
instruction
0
37,546
15
75,092
"Correct Solution: ``` s=input() n=len(s) A=[] b=0 a=1 for i in range(n-1): if s[i+1]==s[i]: a=a+1 else: A.append(a) a=1 A.append(n-sum(A)) B=[0]*n c=0 for i in range(len(A)): c+=A[i] if i%2==0: B[c-1]+=(A[i]+1)//2 B[c]+=A[i]//2 else: c-=A[i] B[c-1]+=A[i]//2 B[c]+=(A[i]+1)//2 ...
output
1
37,546
15
75,093
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square...
instruction
0
37,547
15
75,094
Yes
output
1
37,547
15
75,095
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square...
instruction
0
37,548
15
75,096
Yes
output
1
37,548
15
75,097
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square...
instruction
0
37,549
15
75,098
Yes
output
1
37,549
15
75,099
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square...
instruction
0
37,550
15
75,100
Yes
output
1
37,550
15
75,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square...
instruction
0
37,551
15
75,102
No
output
1
37,551
15
75,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square...
instruction
0
37,552
15
75,104
No
output
1
37,552
15
75,105
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square...
instruction
0
37,553
15
75,106
No
output
1
37,553
15
75,107
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square...
instruction
0
37,554
15
75,108
No
output
1
37,554
15
75,109
Provide tags and a correct Python 3 solution for this coding contest problem. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king. Check the king's moves her...
instruction
0
38,159
15
76,318
Tags: implementation Correct Solution: ``` a = input() if (a=="b8" or a=="c8" or a=="d8" or a=="e8" or a=="f8" or a=="g8" or a=="b1" or a=="c1" or a=="d1" or a=="e1" or a=="f1" or a=="g1" or a=="a2" or a=="a3" or a=="a4" or a=="a5" or a=="a6" or a=="a7" or a=="h2" or a=="h3" or a=="h4" or a=="h5" or a=="h6" or a=="h7")...
output
1
38,159
15
76,319
Provide tags and a correct Python 3 solution for this coding contest problem. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king. Check the king's moves her...
instruction
0
38,160
15
76,320
Tags: implementation Correct Solution: ``` x=input() if (x[0] in ['a','h']) and (x[1]=='1' or x[1]=='8'): print(3) elif (x[0] in ['a','h']) and (x[1] not in ['1','8']): print(5) elif (x[0] in ['b','c','d','e','f','g','h']) and (x[1]=='1' or x[1]=='8'): print(5) else: print(8) ```
output
1
38,160
15
76,321
Provide tags and a correct Python 3 solution for this coding contest problem. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king. Check the king's moves her...
instruction
0
38,161
15
76,322
Tags: implementation Correct Solution: ``` # King Moves def king(s): c = s[0] d = s[1] if c in ['a', 'h'] and d in ['1', '8']: return 3 if c in ['a', 'h'] or d in ['1', '8']: return 5 return 8 s = input() print(king(s)) ```
output
1
38,161
15
76,323
Provide tags and a correct Python 3 solution for this coding contest problem. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king. Check the king's moves her...
instruction
0
38,162
15
76,324
Tags: implementation Correct Solution: ``` inp = input() if inp[0] == 'a': if 2 <= int(inp[1]) < 8: print(5) exit() if int(inp[1]) == 8: if 'a' < inp[0] < 'h': print(5) exit() if int(inp[1]) == 1: if 'a' < inp[0] < 'h': print(5) exit() if inp[0] == 'h': if...
output
1
38,162
15
76,325
Provide tags and a correct Python 3 solution for this coding contest problem. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king. Check the king's moves her...
instruction
0
38,163
15
76,326
Tags: implementation Correct Solution: ``` n=input() if(n=="a8" or n=="a1" or n=="h8" or n=="h1"): print(3) elif((n[0]=='a' and n[1]!=1 and n[1]!=8) or (n[0]=='h' and n[1]!=1 and n[1]!=8) or (n[1]=='1' and n[0]!='a' and n[0]!='h') or (n[1]=='8' and n[0]!='a' and n[0]!='h')): print(5) else: print(8) ```
output
1
38,163
15
76,327
Provide tags and a correct Python 3 solution for this coding contest problem. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king. Check the king's moves her...
instruction
0
38,164
15
76,328
Tags: implementation Correct Solution: ``` a = input() x = a[0] y = a[1] if a == 'a1' or a=='a8' or a=='h1' or a=='h8': print(3) elif x =='a' or x == 'h' or y == '1' or y=='8': print(5) else: print(8) ```
output
1
38,164
15
76,329
Provide tags and a correct Python 3 solution for this coding contest problem. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king. Check the king's moves her...
instruction
0
38,165
15
76,330
Tags: implementation Correct Solution: ``` s =input() c, r = s[0], s[1] if (c == "a" or c == "h") and (r == "1" or r == "8"): print(3) elif (c == "a" or c == "h") and (r != "1" or r != "8"): print(5) elif (c != "a" or c != "h") and (r == "1" or r == "8"): print(5) else: print(8) ```
output
1
38,165
15
76,331
Provide tags and a correct Python 3 solution for this coding contest problem. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king. Check the king's moves her...
instruction
0
38,166
15
76,332
Tags: implementation Correct Solution: ``` s = str(input()) a = s[0] b = s[1] if a in ['a', 'h'] and b in ['1', '8']: print(3) elif a in ['a', 'h'] or b in ['1', '8']: print(5) else: print(8) ```
output
1
38,166
15
76,333
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves perm...
instruction
0
38,167
15
76,334
Yes
output
1
38,167
15
76,335
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves perm...
instruction
0
38,168
15
76,336
Yes
output
1
38,168
15
76,337
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves perm...
instruction
0
38,169
15
76,338
Yes
output
1
38,169
15
76,339
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves perm...
instruction
0
38,170
15
76,340
Yes
output
1
38,170
15
76,341
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves perm...
instruction
0
38,171
15
76,342
No
output
1
38,171
15
76,343
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves perm...
instruction
0
38,172
15
76,344
No
output
1
38,172
15
76,345
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves perm...
instruction
0
38,173
15
76,346
No
output
1
38,173
15
76,347
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves perm...
instruction
0
38,174
15
76,348
No
output
1
38,174
15
76,349
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to school, Karen became fixated on the puzzle game on her phone! <image> The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0. One move consists of ...
instruction
0
39,243
15
78,486
Tags: brute force, greedy, implementation Correct Solution: ``` #------------------------template--------------------------# import os import sys from math import * from collections import * # from fractions import * from heapq import* from bisect import * from io import BytesIO, IOBase def vsInput(): sys.stdin = o...
output
1
39,243
15
78,487
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to school, Karen became fixated on the puzzle game on her phone! <image> The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0. One move consists of ...
instruction
0
39,244
15
78,488
Tags: brute force, greedy, implementation Correct Solution: ``` import sys def min_i_v(row): min_v = None min_i = None for i, v in enumerate(row): if min_v is None or v < min_v: min_v = v min_i = i return min_i, min_v def dec_row(matrix, row_i, val): for i in rang...
output
1
39,244
15
78,489
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to school, Karen became fixated on the puzzle game on her phone! <image> The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0. One move consists of ...
instruction
0
39,245
15
78,490
Tags: brute force, greedy, implementation Correct Solution: ``` n, m = map(int, input().split()) table = [list(map(int, input().split())) for i in range(n)] table2 = [list(l) for l in table] anslst = [] for i in range(n): minv = min(table[i]) for v in range(minv): anslst.append("row {}".format(i + 1)) ...
output
1
39,245
15
78,491
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to school, Karen became fixated on the puzzle game on her phone! <image> The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0. One move consists of ...
instruction
0
39,246
15
78,492
Tags: brute force, greedy, implementation Correct Solution: ``` x,y=map(int,input().split()) grid=[] for i in range(x): grid.append(list(map(int,input().split()))) mi=grid[0][0] prints=[] for i in range(x): mi=min(mi,min(grid[i])) if x > y: for k in range(mi): for i in range(1,y+1): p...
output
1
39,246
15
78,493
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to school, Karen became fixated on the puzzle game on her phone! <image> The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0. One move consists of ...
instruction
0
39,247
15
78,494
Tags: brute force, greedy, implementation Correct Solution: ``` n, m = map(int, input().split()) g = [list(map(int, input().split())) for i in range(n)] x, xi, xj = 500, 0, 0 for i, gi in enumerate(g): for j, gij in enumerate(gi): if gij < x: x, xi, xj = gij, i, j r, c = [g[i][xj] - x for i in r...
output
1
39,247
15
78,495
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to school, Karen became fixated on the puzzle game on her phone! <image> The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0. One move consists of ...
instruction
0
39,248
15
78,496
Tags: brute force, greedy, implementation Correct Solution: ``` # IAWT n, m = list(map(int, input().split())) g = [list(map(int, input().split())) for i in range(n)] class Phrase: # xa + y def __init__(self, x=0, y=0): self.x = x self.y = y def __add__(self, other): return Phrase(self.x...
output
1
39,248
15
78,497
Provide tags and a correct Python 3 solution for this coding contest problem. On the way to school, Karen became fixated on the puzzle game on her phone! <image> The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0. One move consists of ...
instruction
0
39,249
15
78,498
Tags: brute force, greedy, implementation Correct Solution: ``` n, m = list(map(int, input().split())) a = [list(map(int, input().split())) for _ in range(n)] r = [a[i][0] - a[0][0] for i in range(n)] c = [a[0][i] - a[0][0] for i in range(m)] t = min(r) r = [x - t for x in r] t = min(c) c = [x - t for x in c] p = a[0][...
output
1
39,249
15
78,499