message
stringlengths
2
65.1k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
0
108k
cluster
float64
14
14
__index_level_0__
int64
0
217k
Provide tags and a correct Python 3 solution for this coding contest problem. In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and...
instruction
0
39,324
14
78,648
Tags: dfs and similar, graphs, trees Correct Solution: ``` n=int(input()) a=[0]+[1]*n p = list(map(int,input().split())) nei=[[] for i in range(n+1)] nei[0]=[1] for i,e in enumerate(p): nei[e]+=[i+2] d=[-1]*(n+1) vert=[0] index=0 while index<=n: v=vert[index] for nnn in nei[v]: d[nnn]=d[v]+1 ...
output
1
39,324
14
78,649
Provide tags and a correct Python 3 solution for this coding contest problem. In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and...
instruction
0
39,325
14
78,650
Tags: dfs and similar, graphs, trees Correct Solution: ``` n = int(input()) dp = dict() cnt = dict() dp[1] = 1 cnt[1] = 1 p = list(map(int, input().split())) for i in range(0, n-1): dp[i+2] = dp[p[i]]+1 if dp[i+2] in cnt: cnt[dp[i+2]]+=1 else: cnt[dp[i+2]] = 1 ans = 0 for k, v in cnt.items(): if v%2 == 1: ans...
output
1
39,325
14
78,651
Provide tags and a correct Python 3 solution for this coding contest problem. In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and...
instruction
0
39,326
14
78,652
Tags: dfs and similar, graphs, trees Correct Solution: ``` R = lambda : map(int, input().split()) n = int(input()) v = list(R()) adj = [[] for _ in range(n)] r = [0]*n for i in range(n-1): adj[v[i]-1].append(i+1) from collections import deque q = deque() q.append((0,0)) while q: v=q.popleft() r[v[1]]+=1...
output
1
39,326
14
78,653
Provide tags and a correct Python 3 solution for this coding contest problem. In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and...
instruction
0
39,327
14
78,654
Tags: dfs and similar, graphs, trees Correct Solution: ``` n=int(input()) le=[0]*(n+1) le[1]=1 l=[int(x) for x in input().split()] for i in range(len(l)): le[i+2]=le[l[i]]+1 f=[0]*(n+1) #print(le) for ele in le: f[ele]+=1 ans=0 #print(f) for ele in f: if ele%2==1: ans+=1 print(ans-1) ```
output
1
39,327
14
78,655
Provide tags and a correct Python 3 solution for this coding contest problem. In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and...
instruction
0
39,328
14
78,656
Tags: dfs and similar, graphs, trees Correct Solution: ``` tree = [] class Node: def __init__(self, num): self.parent = num - 1 self.length = 0 def add_to_tree(self): if self.parent < 0: return self.length = tree[self.parent].length + 1 def main(): n = int(in...
output
1
39,328
14
78,657
Provide tags and a correct Python 3 solution for this coding contest problem. In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and...
instruction
0
39,329
14
78,658
Tags: dfs and similar, graphs, trees Correct Solution: ``` n = int(input()) pi = list(map(int, input().split())) ar = [0] * n ar2 = [0] * n ar2[0] = 1 for i in range(n-1): temp = ar[pi[i]-1] + 1 ar[i+1] = temp ar2[temp] += 1 ans = 0 for i in range(n): if ar2[i] % 2 == 1: ans += 1 print(ans) ...
output
1
39,329
14
78,659
Provide tags and a correct Python 3 solution for this coding contest problem. In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and...
instruction
0
39,330
14
78,660
Tags: dfs and similar, graphs, trees Correct Solution: ``` from collections import Counter n = int(input()) p = list(map(int, input().split())) co = [1] for i in range(n - 1): co.append(co[p[i] - 1] + 1) ans = 0 for v in Counter(co).values(): ans += v % 2 print(ans) ```
output
1
39,330
14
78,661
Provide a correct Python 3 solution for this coding contest problem. There are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not. Person i gives A_i testimonies. The j-th testimony by Person i is represent...
instruction
0
39,398
14
78,796
"Correct Solution: ``` from itertools import product N = int(input()) B = list(product([1, 0], repeat=N)) L = [] for i in range(N): A = int(input()) for j in range(A): x, y = map(int, input().split()) L.append([x, y, i+1]) ans = 0 for b in B: for l in L: if b[l[2]-1] == 1 and l[1] !...
output
1
39,398
14
78,797
Provide a correct Python 3 solution for this coding contest problem. There are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not. Person i gives A_i testimonies. The j-th testimony by Person i is represent...
instruction
0
39,399
14
78,798
"Correct Solution: ``` import itertools N = int(input()) T = [[] for _ in range(N)] for i in range(N): for _ in range(int(input())): x, y = map(int, input().split()) T[i].append([x - 1, y]) ans = 0 for bit in list(itertools.product([0, 1], repeat=N)): ok = True for i in range(N): ...
output
1
39,399
14
78,799
Provide a correct Python 3 solution for this coding contest problem. There are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not. Person i gives A_i testimonies. The j-th testimony by Person i is represent...
instruction
0
39,400
14
78,800
"Correct Solution: ``` import itertools N=int(input()) l=[[] for i in range(N)] for i in range(N): a=int(input()) for j in range(a): x,y=map(int,input().split()) l[i].append((x-1,y)) ans=0 for t in itertools.product(range(2),repeat=N): miss=False for i in range(N): if t[i]==0:continue for x,y in...
output
1
39,400
14
78,801
Provide a correct Python 3 solution for this coding contest problem. There are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not. Person i gives A_i testimonies. The j-th testimony by Person i is represent...
instruction
0
39,401
14
78,802
"Correct Solution: ``` n = int(input()) l = [] for i in range(n): a = int(input()) l.append([tuple(map(int, input().split())) for _ in range(a)]) cnt = 0 for i in range(1 << n): Flag = True for j in range(n): if (i >> j) & 1: for x, y in l[j]: if i >> (x-1) & 1 != y...
output
1
39,401
14
78,803
Provide a correct Python 3 solution for this coding contest problem. There are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not. Person i gives A_i testimonies. The j-th testimony by Person i is represent...
instruction
0
39,402
14
78,804
"Correct Solution: ``` n=int(input()) s=[] ans=0 for i in range(n): a=int(input()) s.append([list(map(int,input().split())) for _ in range(a)]) for i in range(2**n): bit=bin(i)[2:].zfill(n) flag=1 for j in range(n): if bit[j]=='0': continue for sh in s[j]: if ...
output
1
39,402
14
78,805
Provide a correct Python 3 solution for this coding contest problem. There are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not. Person i gives A_i testimonies. The j-th testimony by Person i is represent...
instruction
0
39,403
14
78,806
"Correct Solution: ``` n=int(input()) L=[[list(map(int,input().split())) for _ in range(int(input()))] for _ in range(n)] a=0 for i in range(1, 2**n): f=True for j in range(n): if (i>>j)&1==0: continue for x,y in L[j]: if (i>>(x-1))&1!=y: f=False break if not f: break ...
output
1
39,403
14
78,807
Provide a correct Python 3 solution for this coding contest problem. There are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not. Person i gives A_i testimonies. The j-th testimony by Person i is represent...
instruction
0
39,404
14
78,808
"Correct Solution: ``` N = int(input()) lst = [] for i in range(N): a = int(input()) xy = [[int(x) for x in input().split()] for _ in range(a)] lst.append(xy) ans = 0 for i in range(1, 2**N): f = 1 tmp = [i >> j & 1 for j in range(N)] cnt = sum(tmp) for i, yi in enumerate(tmp): if (y...
output
1
39,404
14
78,809
Provide a correct Python 3 solution for this coding contest problem. There are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not. Person i gives A_i testimonies. The j-th testimony by Person i is represent...
instruction
0
39,405
14
78,810
"Correct Solution: ``` import itertools n = int(input()) data = [] for x in range(n): for y in range(int(input())): k, l = map(int, input().split()) data.append((x, k - 1, l)) ans = 0 for i in itertools.product([1,0], repeat=n): s = sum(list(i)) if ans > s: continue for g in data...
output
1
39,405
14
78,811
Provide a correct Python 3 solution for this coding contest problem. Mr. Dango's family has extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in near future. They all have warm and gracious pers...
instruction
0
39,555
14
79,110
"Correct Solution: ``` while True: n=int(input()) if n==0: break g=[[] for _ in range(n)] for u in range(n): v1,w1,v2,w2=map(int,input().split()) g[u].append((v1,w1)) g[u].append((v2,w2)) res=1 vis=[False]*n for i in range(n): if vis[i]: continue ws=[] p,u=-1,i while True: ...
output
1
39,555
14
79,111
Provide a correct Python 3 solution for this coding contest problem. Mr. Dango's family has extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in near future. They all have warm and gracious pers...
instruction
0
39,556
14
79,112
"Correct Solution: ``` # AOJ 1055 Huge Family # Python3 2018.7.7 bal4u # UNION-FIND library class UnionSet: def __init__(self, nmax): self.size = [1]*nmax self.id = [i for i in range(nmax+1)] def root(self, i): while i != self.id[i]: self.id[i] = self.id[self.id[i]] i = self.id[i] return i def connect...
output
1
39,556
14
79,113
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mr. Dango's family has extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this pla...
instruction
0
39,557
14
79,114
No
output
1
39,557
14
79,115
Provide tags and a correct Python 3 solution for this coding contest problem. The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of n questions; the questions are to...
instruction
0
39,616
14
79,232
Tags: greedy, implementation, math Correct Solution: ``` r=input;r();print(sum(int(v)*i-i+1for i,v in enumerate(r().split(),1))) ```
output
1
39,616
14
79,233
Provide tags and a correct Python 3 solution for this coding contest problem. The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of n questions; the questions are to...
instruction
0
39,617
14
79,234
Tags: greedy, implementation, math Correct Solution: ``` n = int(input()) l = list(map(int,input().split())) if len(set(l)) == 1 and l[0] == 1 or n == 1 : print(sum(l)) else: cnt = l[0] for i in range(1 , n): cnt += l[i] + (l[i]-1) * i print(cnt) ```
output
1
39,617
14
79,235
Provide tags and a correct Python 3 solution for this coding contest problem. The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of n questions; the questions are to...
instruction
0
39,618
14
79,236
Tags: greedy, implementation, math Correct Solution: ``` n = int(input().strip()) answers = [int(ele) for ele in input().strip().split()] total_clicks = 0 for i in range(n): num_wrongs = answers[i] - 1 total_clicks += num_wrongs*(i+1) + 1 print(total_clicks) ```
output
1
39,618
14
79,237
Provide tags and a correct Python 3 solution for this coding contest problem. The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of n questions; the questions are to...
instruction
0
39,619
14
79,238
Tags: greedy, implementation, math Correct Solution: ``` n = int(input()) l = [int(x) for x in input().split()] sum = l[0] for i in range(1,n): sum += 1+(l[i]-1)*(i+1) print(sum) ```
output
1
39,619
14
79,239
Provide tags and a correct Python 3 solution for this coding contest problem. The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of n questions; the questions are to...
instruction
0
39,620
14
79,240
Tags: greedy, implementation, math Correct Solution: ``` n = int(input()) A = list(map(int, input().split())) result = 0 for i in range(n): result += (A[i] - 1) * (i + 1) + 1 print(result) ```
output
1
39,620
14
79,241
Provide tags and a correct Python 3 solution for this coding contest problem. The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of n questions; the questions are to...
instruction
0
39,621
14
79,242
Tags: greedy, implementation, math Correct Solution: ``` class CodeforcesTask104BSolution: def __init__(self): self.result = '' self.n = 0 self.questions = [] def read_input(self): self.n = int(input()) self.questions = [int(x) for x in input().split(" ")] def proce...
output
1
39,621
14
79,243
Provide tags and a correct Python 3 solution for this coding contest problem. The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of n questions; the questions are to...
instruction
0
39,622
14
79,244
Tags: greedy, implementation, math Correct Solution: ``` def arr_inp(): return [int(x) for x in stdin.readline().split()] from sys import * n, a = int(input()), arr_inp() print(sum([a[i] + (a[i] - 1) * i for i in range(n)])) ```
output
1
39,622
14
79,245
Provide tags and a correct Python 3 solution for this coding contest problem. The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of n questions; the questions are to...
instruction
0
39,623
14
79,246
Tags: greedy, implementation, math Correct Solution: ``` r=input;r();print(sum(int(v)*i-i+1for i,v in enumerate(r().split(),1))) # Made By Mostafa_Khaled ```
output
1
39,623
14
79,247
Provide tags and a correct Python 3 solution for this coding contest problem. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For each friend the value f_i is known: it is eith...
instruction
0
39,736
14
79,472
Tags: constructive algorithms, data structures, math Correct Solution: ``` n=int(input()) a=[*map(int,input().split())] b=[1]*(n+1) r=range(n) for i in r:b[a[i]]=0 s={i for i in r if b[i+1]} t=[i for i in s if a[i]<1] for i,j in zip(t,t[1:]+t[:1]): if i^j:a[i]=j+1;s-={i} t+=r for i in t: if a[i]<1: j=s.pop() if j...
output
1
39,736
14
79,473
Provide tags and a correct Python 3 solution for this coding contest problem. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For each friend the value f_i is known: it is eith...
instruction
0
39,737
14
79,474
Tags: constructive algorithms, data structures, math Correct Solution: ``` n = int(input()) want = list(map(int, input().split())) st = set(range(1, n + 1)) for f in want: if f != 0: st.remove(f) st = list(st) for i in range(n): if len(st) == 2: break if want[i] == 0: if st[-1] == i ...
output
1
39,737
14
79,475
Provide tags and a correct Python 3 solution for this coding contest problem. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For each friend the value f_i is known: it is eith...
instruction
0
39,738
14
79,476
Tags: constructive algorithms, data structures, math Correct Solution: ``` def checkSame(notGet, notGive): for index in range(len(notGet)): if notGet[index] == notGive[index]: return True return False totalCase = input() inputNumber = input() newNumber = inputNumber.split() getting = {} notGive = [] notGet = ...
output
1
39,738
14
79,477
Provide tags and a correct Python 3 solution for this coding contest problem. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For each friend the value f_i is known: it is eith...
instruction
0
39,739
14
79,478
Tags: constructive algorithms, data structures, math Correct Solution: ``` n=int(input()) l2=[int(a) for a in input().split()] l3=[] l4=[] for i in range(n+1): l3.append(0) for i in range(n): l3[l2[i]]=1 for i in range(1,n+1): if(l3[i]==0): l4.append(i) c=0 a2=0 a1=0 for i in range(n): if(l2[i]==0): if(i+1==l4[...
output
1
39,739
14
79,479
Provide tags and a correct Python 3 solution for this coding contest problem. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For each friend the value f_i is known: it is eith...
instruction
0
39,740
14
79,480
Tags: constructive algorithms, data structures, math Correct Solution: ``` def inp(dtype=str, strip=True): s = input() res = [dtype(p) for p in s.split()] res = res[0] if len(res) == 1 and strip else res return res def problem1(): t = inp(int) for _ in range(t): h, m = inp(int) ...
output
1
39,740
14
79,481
Provide tags and a correct Python 3 solution for this coding contest problem. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For each friend the value f_i is known: it is eith...
instruction
0
39,741
14
79,482
Tags: constructive algorithms, data structures, math Correct Solution: ``` if __name__ == '__main__': input() giving = list(map(lambda x: x - 1, map(int, input().split()))) not_giving = [i for i, x in enumerate(giving) if x < 0] first_not_giver = not_giving[0] receiving = [False for _ in range(l...
output
1
39,741
14
79,483
Provide tags and a correct Python 3 solution for this coding contest problem. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For each friend the value f_i is known: it is eith...
instruction
0
39,742
14
79,484
Tags: constructive algorithms, data structures, math Correct Solution: ``` n = int(input()) l = list(map(int,input().split())) dostal = [0] * (n+1) for i in range(n): dostal[l[i]] = 1 do_dania = [] ind = [] for i in range(n): if l[i] == 0: ind.append(i) for i in range(1, n+1): if dostal[i] == 0: do_dania.append(...
output
1
39,742
14
79,485
Provide tags and a correct Python 3 solution for this coding contest problem. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For each friend the value f_i is known: it is eith...
instruction
0
39,743
14
79,486
Tags: constructive algorithms, data structures, math Correct Solution: ``` n=int(input()) f=[int(i) for i in input().split()] m=dict() for i in range(n): m[f[i]]=1 l=list() for i in range(1,n+1): if m.get(i): continue else: l.insert(len(l),i) l.sort(reverse=True) val=-1 pre=[] nex=[] for i i...
output
1
39,743
14
79,487
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For...
instruction
0
39,744
14
79,488
Yes
output
1
39,744
14
79,489
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For...
instruction
0
39,745
14
79,490
Yes
output
1
39,745
14
79,491
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For...
instruction
0
39,746
14
79,492
Yes
output
1
39,746
14
79,493
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For...
instruction
0
39,747
14
79,494
Yes
output
1
39,747
14
79,495
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For...
instruction
0
39,748
14
79,496
No
output
1
39,748
14
79,497
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For...
instruction
0
39,749
14
79,498
No
output
1
39,749
14
79,499
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For...
instruction
0
39,750
14
79,500
No
output
1
39,750
14
79,501
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself. For...
instruction
0
39,751
14
79,502
No
output
1
39,751
14
79,503
Provide tags and a correct Python 3 solution for this coding contest problem. The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has m Spyke chats just to d...
instruction
0
39,939
14
79,878
Tags: implementation Correct Solution: ``` R = lambda:map(int, input().split()) n, m, k = R() a = [list(R()) for _ in range(n)] b = [[0] * m for _ in range(n)] c = [0] * m for i in range(k): x, y = R() x -= 1 y -= 1 c[y] += 1 b[x][y] += 1 print(" ".join(map(str, (sum(c[j] - b[i][j] for j in range(m) if a[i][j...
output
1
39,939
14
79,879
Provide tags and a correct Python 3 solution for this coding contest problem. The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has m Spyke chats just to d...
instruction
0
39,940
14
79,880
Tags: implementation Correct Solution: ``` n,m,k = [int(a) for a in input().split() ] table = [] for i in range(n): table.append([int(a) for a in input().split() ]) # print(table) event = [] for i in range(k): event.append([int(a) for a in input().split() ]) multiplier = [0]*m subtract = [0]*n sumRes = [0]*n f...
output
1
39,940
14
79,881
Provide tags and a correct Python 3 solution for this coding contest problem. The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has m Spyke chats just to d...
instruction
0
39,941
14
79,882
Tags: implementation Correct Solution: ``` from sys import stdin,stdout n,m,k=map(int,input().split()) l=[[0]*m]*n for i in range(n): l[i]=list(map(int,stdin.readline().split())) t=[[0]*2]*k e=[0]*n c=[0]*m for i in range(k): t0,t1=map(int,stdin.readline().split()) e[t0-1]-=1 c[t1-1]+=1 p=[""]...
output
1
39,941
14
79,883
Provide tags and a correct Python 3 solution for this coding contest problem. The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has m Spyke chats just to d...
instruction
0
39,942
14
79,884
Tags: implementation Correct Solution: ``` # -*- coding: utf-8 -*- """ YL 2 B. K6nelogi """ n,m,k=list(map(int,input().split())) too=dict() chat=dict() chat2=dict() for i in range(n): too[i]=0 for i in range(m): chat2[i]=0 # Korda postitati for i in range(n): chat[i]=list(map(int,input().split()))# info ini...
output
1
39,942
14
79,885
Provide tags and a correct Python 3 solution for this coding contest problem. The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has m Spyke chats just to d...
instruction
0
39,943
14
79,886
Tags: implementation Correct Solution: ``` n, m, k = map(int, input().split()) p, s, t = [[] for y in range(m)], [0] * n, [0] * m for x in range(n): for y, c in enumerate(input()[:: 2]): if c == '1': p[y].append(x) for i in range(k): x, y = map(int, input().split()) s[x - 1] -= 1 t[y - 1] += 1 f...
output
1
39,943
14
79,887
Provide tags and a correct Python 3 solution for this coding contest problem. The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has m Spyke chats just to d...
instruction
0
39,944
14
79,888
Tags: implementation Correct Solution: ``` R = lambda:map(int, input().split()) n, m, k = R() a = [list(R()) for _ in range(n)] b = [0] * n c = [0] * m for i in range(k): x, y = R() b[x - 1] += 1 c[y - 1] += 1 print(" ".join(map(str, (sum(a[i][j] * c[j] for j in range(m)) - b[i] for i in range(n))))) ```
output
1
39,944
14
79,889
Provide tags and a correct Python 3 solution for this coding contest problem. The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has m Spyke chats just to d...
instruction
0
39,945
14
79,890
Tags: implementation Correct Solution: ``` R = lambda:map(int, input().split()) n, m, k = R() a = [list(R()) for _ in range(n)] b = [0] * n c = [0] * m for i in range(k): x, y = R() b[x - 1] += 1 c[y - 1] += 1 print(" ".join(map(str, (sum(a[i][j] * c[j] for j in range(m)) - b[i] for i in range(n))))) ...
output
1
39,945
14
79,891
Provide tags and a correct Python 3 solution for this coding contest problem. The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has m Spyke chats just to d...
instruction
0
39,946
14
79,892
Tags: implementation Correct Solution: ``` R = lambda: map(int, input().split()) n, m, k = R() chat = [] for i in range(n): chat.append(list(R())) man = [0] * n; room = [0] * m for i in range(k): a, b = R() man[a-1] += 1 room[b-1] += 1 for i in range(n): t = 0 for j in range(m): if chat[...
output
1
39,946
14
79,893