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 a correct Python 3 solution for this coding contest problem. You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens. There are N attendees in the party, and they are given attendee numbers from ...
instruction
0
8,186
14
16,372
"Correct Solution: ``` from collections import defaultdict n=int(input()) a=list(map(int,input().split())) a=[0]+a d=defaultdict(int) for i in range(1,n+1): d[a[i]+i]+=1 ans=0 for j in range(1,n+1): ans+=d[-a[j]+j] print(ans) ```
output
1
8,186
14
16,373
Provide a correct Python 3 solution for this coding contest problem. You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens. There are N attendees in the party, and they are given attendee numbers from ...
instruction
0
8,187
14
16,374
"Correct Solution: ``` from collections import defaultdict N = int(input()) A = list(map(int, input().split())) memo = defaultdict(int) ans = 0 for i, a in enumerate(A, 1): ans += memo[i - a] memo[a + i] += 1 print(ans) ```
output
1
8,187
14
16,375
Provide a correct Python 3 solution for this coding contest problem. You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens. There are N attendees in the party, and they are given attendee numbers from ...
instruction
0
8,188
14
16,376
"Correct Solution: ``` from collections import defaultdict N = int(input()) A = list(map(int, input().split())) d = defaultdict(int) ans = 0 for i, x in enumerate(A, 1): ans += d[i-x] d[x+i] += 1 print(ans) ```
output
1
8,188
14
16,377
Provide a correct Python 3 solution for this coding contest problem. You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens. There are N attendees in the party, and they are given attendee numbers from ...
instruction
0
8,189
14
16,378
"Correct Solution: ``` N = int(input()) A = list(map(int,input().split())) from collections import defaultdict d = defaultdict(int) res = 0 for idx,a in enumerate(A): if idx > 0: res += d[idx-a] d[a+idx] += 1 print (res) ```
output
1
8,189
14
16,379
Provide a correct Python 3 solution for this coding contest problem. You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens. There are N attendees in the party, and they are given attendee numbers from ...
instruction
0
8,190
14
16,380
"Correct Solution: ``` from collections import defaultdict N = int(input()) A = list(map(int, input().split())) d = defaultdict(int) for i, a in enumerate(A): d[i + a] += 1 ans = 0 for j, a in enumerate(A): ans += d[j - a] print(ans) ```
output
1
8,190
14
16,381
Provide a correct Python 3 solution for this coding contest problem. You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens. There are N attendees in the party, and they are given attendee numbers from ...
instruction
0
8,191
14
16,382
"Correct Solution: ``` from collections import Counter n = int(input().strip()) L = list(map(int, input().strip().split())) seen=Counter() ans=0 for j in range(n): ans+=seen[j-L[j]] seen[L[j]+j]+=1 print(ans) ```
output
1
8,191
14
16,383
Provide a correct Python 3 solution for this coding contest problem. Mr. Suzuki has opened a new mobile sales shop for freshly squeezed milk in the Aizu area. It is assumed that all the customers who come to buy that day are already in the store with bottles to take home and will not increase any more. Customers only ...
instruction
0
8,325
14
16,650
"Correct Solution: ``` while True: n = int(input()) if not n: break else: lst = [int(input()) for _ in range(n)] lst.sort() acc = ans = 0 for i in lst: ans += acc acc += i print(ans) ```
output
1
8,325
14
16,651
Provide a correct Python 3 solution for this coding contest problem. Mr. Suzuki has opened a new mobile sales shop for freshly squeezed milk in the Aizu area. It is assumed that all the customers who come to buy that day are already in the store with bottles to take home and will not increase any more. Customers only ...
instruction
0
8,326
14
16,652
"Correct Solution: ``` import itertools while 1: n=int(input()) if n==0:break l=[int(input()) for _ in range(n)] ll=len(l) m=sorted(l)[:ll-1] print(sum([sum(m[:i]) for i in range(1,ll)])) ```
output
1
8,326
14
16,653
Provide a correct Python 3 solution for this coding contest problem. Mr. Suzuki has opened a new mobile sales shop for freshly squeezed milk in the Aizu area. It is assumed that all the customers who come to buy that day are already in the store with bottles to take home and will not increase any more. Customers only ...
instruction
0
8,327
14
16,654
"Correct Solution: ``` while True : n = int(input()) if n == 0 : break que = [] for i in range(n) : que.append(int(input())) que.sort() time = 0 for i in range(n) : time += sum(que[0:i]) print(time) ```
output
1
8,327
14
16,655
Provide a correct Python 3 solution for this coding contest problem. Mr. Suzuki has opened a new mobile sales shop for freshly squeezed milk in the Aizu area. It is assumed that all the customers who come to buy that day are already in the store with bottles to take home and will not increase any more. Customers only ...
instruction
0
8,328
14
16,656
"Correct Solution: ``` while True: n = int(input()) if n == 0: break t_list = [] for i in range(n): t_list.append(int(input())) t_list.sort() ans = 0 for i in range(n - 1): ans += t_list[i]*(n - i -1) print(ans) ```
output
1
8,328
14
16,657
Provide a correct Python 3 solution for this coding contest problem. Mr. Suzuki has opened a new mobile sales shop for freshly squeezed milk in the Aizu area. It is assumed that all the customers who come to buy that day are already in the store with bottles to take home and will not increase any more. Customers only ...
instruction
0
8,329
14
16,658
"Correct Solution: ``` while True: n = int(input()) if n == 0: break a = sorted([int(input()) for i in range(n)]) s = 0 for i in range(n-1): s += (n-i-1)*a[i] print(s) ```
output
1
8,329
14
16,659
Provide a correct Python 3 solution for this coding contest problem. Mr. Suzuki has opened a new mobile sales shop for freshly squeezed milk in the Aizu area. It is assumed that all the customers who come to buy that day are already in the store with bottles to take home and will not increase any more. Customers only ...
instruction
0
8,330
14
16,660
"Correct Solution: ``` # Aizu Problem 0112: A Milk Shop # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") while True: N = int(input()) if N == 0: break waits = sorted([int(input()) for _ in range(N)]) latence...
output
1
8,330
14
16,661
Provide a correct Python 3 solution for this coding contest problem. Mr. Suzuki has opened a new mobile sales shop for freshly squeezed milk in the Aizu area. It is assumed that all the customers who come to buy that day are already in the store with bottles to take home and will not increase any more. Customers only ...
instruction
0
8,331
14
16,662
"Correct Solution: ``` while True: try: n = int(input()) if n == 0: break ans = 0 add = 0 arr = [] for i in range(0,n): arr.append(int(input())) arr = sorted(arr) for i in range(0,n - 1): add += arr[i] a...
output
1
8,331
14
16,663
Provide a correct Python 3 solution for this coding contest problem. Mr. Suzuki has opened a new mobile sales shop for freshly squeezed milk in the Aizu area. It is assumed that all the customers who come to buy that day are already in the store with bottles to take home and will not increase any more. Customers only ...
instruction
0
8,332
14
16,664
"Correct Solution: ``` #import math while True: n = int(input()) if n == 0: break t = [] for i in range(n): t.append(int(input())) t.sort() time = 0 sum = 0 for i in range(len(t)): time += t[i] sum += time print(sum-time) ```
output
1
8,332
14
16,665
Provide tags and a correct Python 3 solution for this coding contest problem. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the...
instruction
0
8,668
14
17,336
Tags: greedy, math Correct Solution: ``` from collections import Counter n = int(input()) c = list(map(int, input().split())) count = Counter(c) unused = list(set(range(1, n+1)) - set(count.keys())) for i in range(n): if count[c[i]] > 1 or c[i] > n or c[i] <= 0: count[c[i]] -= 1 c[i] = unused.pop() ...
output
1
8,668
14
17,337
Provide tags and a correct Python 3 solution for this coding contest problem. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the...
instruction
0
8,669
14
17,338
Tags: greedy, math Correct Solution: ``` n = int(input()) pin = input().split(" ") arr = [int(i)-1 for i in pin] free = [True]*n change = [] for i in range(n): if arr[i] <n: if free[arr[i]]: free[arr[i]] = False else: change.append(i) else: change.append(i...
output
1
8,669
14
17,339
Provide tags and a correct Python 3 solution for this coding contest problem. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the...
instruction
0
8,670
14
17,340
Tags: greedy, math Correct Solution: ``` import queue n= int(input()) mas = list(map(int,input().split(" "))) s=set([i for i in range(1,n+1)]) di=queue.Queue() bo=0 for i in range(n): if (mas[i] in s): s.remove(mas[i]) else: di.put(i) for i in s: mas[di.get()]=i print(' '.join(list(map(str,m...
output
1
8,670
14
17,341
Provide tags and a correct Python 3 solution for this coding contest problem. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the...
instruction
0
8,671
14
17,342
Tags: greedy, math Correct Solution: ``` import sys #sys.stdin = open("input2","r") n = int(input()) arr = list(map(int,input().split())) #cnt = 0 #print('arr',arr) store = [0]*n for i in range(n): """count occurences """ if arr[i] > n: continue elif store[arr[i]-1] == 0: store[arr[i]-1] = 1...
output
1
8,671
14
17,343
Provide tags and a correct Python 3 solution for this coding contest problem. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the...
instruction
0
8,672
14
17,344
Tags: greedy, math Correct Solution: ``` def main(): read = lambda: map(int, input().split()) n = int(input()) a = list(read()) used = [True] * (n + 1) C = {i + 1 for i in range(n)} A = {i for i in a if i <= n} B = A ^ C for i in a: if i > n or not used[i]: p...
output
1
8,672
14
17,345
Provide tags and a correct Python 3 solution for this coding contest problem. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the...
instruction
0
8,673
14
17,346
Tags: greedy, math Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) c = [0] * 100000 for i in range(n): c[a[i] - 1] += 1 s = [] for i in range(n): if c[i] == 0: s.append(i + 1) if not s: print(*a) exit() ans = a[:] x = 0 for i in range(n): if c[a[i] - 1] > 1 or a[i]...
output
1
8,673
14
17,347
Provide tags and a correct Python 3 solution for this coding contest problem. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the...
instruction
0
8,674
14
17,348
Tags: greedy, math Correct Solution: ``` n = int(input()) s = list(map(int,input().split())) f = [0]*n for i in range(n): if s[i]>n: s[i]=0 else: if f[s[i]-1]==0: f[s[i]-1]=1 else: s[i]=0 a = 0 for i in range(n): if s[i]==0: while 1: if f[a...
output
1
8,674
14
17,349
Provide tags and a correct Python 3 solution for this coding contest problem. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the...
instruction
0
8,675
14
17,350
Tags: greedy, math Correct Solution: ``` n = int(input()) inp = list(map(int,input().split(' '))) used = set(inp) seen = set() toadd = set(i+1 for i in range(n) if i+1 not in used) res = [] for num in inp: if num < 1 or num > n or num in seen: num = toadd.pop() else: seen.add(num) res.append...
output
1
8,675
14
17,351
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create...
instruction
0
8,676
14
17,352
Yes
output
1
8,676
14
17,353
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create...
instruction
0
8,678
14
17,356
Yes
output
1
8,678
14
17,357
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create...
instruction
0
8,679
14
17,358
Yes
output
1
8,679
14
17,359
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create...
instruction
0
8,680
14
17,360
No
output
1
8,680
14
17,361
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create...
instruction
0
8,682
14
17,364
No
output
1
8,682
14
17,365
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create...
instruction
0
8,683
14
17,366
No
output
1
8,683
14
17,367
Provide tags and a correct Python 3 solution for this coding contest problem. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consider that m (m ≀ 4n) people occupy the seats in ...
instruction
0
8,697
14
17,394
Tags: implementation Correct Solution: ``` #parse_int = list(map(int, input().split())) lines, ppl = list(map(int, input().split())) bus = [ [2*i-1, 2*lines+2*i-1, 2*lines+2*i, 2*i] for i in range(1, lines+1) ] #for line in bus: print(line) #for line in bus: exit_bus.append([ line[1], line[0], line[2], line[3] ]) ...
output
1
8,697
14
17,395
Provide tags and a correct Python 3 solution for this coding contest problem. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consider that m (m ≀ 4n) people occupy the seats in ...
instruction
0
8,698
14
17,396
Tags: implementation Correct Solution: ``` import sys import math #sys.stdin = open('test.inp','r') n, k = map(int, input().split()) l, r, i, ok= n * 2 + 1, 1, 1, False while l <= k or r <= k and (l <= 4*n and r <= 2*n): if l <= k and l <= 4*n: print(l, end=' ') l = l + 1 if r <= k and r <= 2*n: print(r, end='...
output
1
8,698
14
17,397
Provide tags and a correct Python 3 solution for this coding contest problem. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consider that m (m ≀ 4n) people occupy the seats in ...
instruction
0
8,699
14
17,398
Tags: implementation Correct Solution: ``` n,m=input().split(' ') n=int(n) m=int(m) L=[] for i in range (1,2*n+1) : L.append(2*n+i) L.append(i) for i in range(4*n) : if L[i]<=m : print(L[i],end=' ') ```
output
1
8,699
14
17,399
Provide tags and a correct Python 3 solution for this coding contest problem. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consider that m (m ≀ 4n) people occupy the seats in ...
instruction
0
8,700
14
17,400
Tags: implementation Correct Solution: ``` from collections import Counter n, k = list(map(lambda x: int(x), input().split())) result = [] window = 1 non_window = 2*n +1 for row in range(1, n+1): temp = [] temp.append(non_window) temp.append(window) temp.append(non_window+1) temp.append(window+1) ...
output
1
8,700
14
17,401
Provide tags and a correct Python 3 solution for this coding contest problem. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consider that m (m ≀ 4n) people occupy the seats in ...
instruction
0
8,701
14
17,402
Tags: implementation Correct Solution: ``` n,m=map(int,input().split()) op=[] if m<=2*n: for i in range(1,m+1): print(i,end=' ') else: p=m-2*n l=p%2 p=p//2 for i in range(1,p+1): op.append(2*n+2*i-1) op.append(2*i-1) op.append(2*n+2*i) op.append(2*i) if l=...
output
1
8,701
14
17,403
Provide tags and a correct Python 3 solution for this coding contest problem. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consider that m (m ≀ 4n) people occupy the seats in ...
instruction
0
8,702
14
17,404
Tags: implementation Correct Solution: ``` n,m=list(map(int,input().split())) y=[(2*n)-1,-1,2*n,0] k=2 count=0 t=0 i=-1 while t<m: i+=1 if (y[i%4]+k)<=m: print(y[i%4]+k,end=' ') count+=1 t+=1 else: count+=1 if count==4: k+=2 count=0 else: con...
output
1
8,702
14
17,405
Provide tags and a correct Python 3 solution for this coding contest problem. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consider that m (m ≀ 4n) people occupy the seats in ...
instruction
0
8,703
14
17,406
Tags: implementation Correct Solution: ``` n, m = map(int, input().split()) a, b, c, d = [], [], [], [] for i in range(n): if 2 * i + 1 <= m: a.append(2 * i + 1) #print(a) for i in range(n, 2 * n): if 2 * i + 1 <= m: b.append(2 * i + 1) #print(b) for i in range(1, n + 1): if 2 * i <= m: ...
output
1
8,703
14
17,407
Provide tags and a correct Python 3 solution for this coding contest problem. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consider that m (m ≀ 4n) people occupy the seats in ...
instruction
0
8,704
14
17,408
Tags: implementation Correct Solution: ``` n,m = map(int,input().split()) s = [[i for i in range(j+1,4*n+1,2)] for j in range(2)] r = [s[0][0:n],s[0][n::]] l = [s[1][n::],s[1][0:n]] a = [] for i in range(n): if r[1][i]<=m: a.append(r[1][i]) if r[0][i]<=m: a.append(r[0][i]) if l[0][i]<=m: a.append(l[0][i]) if ...
output
1
8,704
14
17,409
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consi...
instruction
0
8,705
14
17,410
Yes
output
1
8,705
14
17,411
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consi...
instruction
0
8,706
14
17,412
Yes
output
1
8,706
14
17,413
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consi...
instruction
0
8,707
14
17,414
Yes
output
1
8,707
14
17,415
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consi...
instruction
0
8,708
14
17,416
Yes
output
1
8,708
14
17,417
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consi...
instruction
0
8,709
14
17,418
No
output
1
8,709
14
17,419
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consi...
instruction
0
8,710
14
17,420
No
output
1
8,710
14
17,421
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consi...
instruction
0
8,711
14
17,422
No
output
1
8,711
14
17,423
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consi...
instruction
0
8,712
14
17,424
No
output
1
8,712
14
17,425
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya studies music. He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C ...
instruction
0
8,779
14
17,558
Tags: brute force, implementation Correct Solution: ``` import itertools tone = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "B", "H"] num = itertools.permutations(input().split()) for arr in num: a, b, c = arr ind_a = tone.index(a) ind_b = tone.index(b) ind_c = tone.index(c) ind_a = ind_a...
output
1
8,779
14
17,559
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya studies music. He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C ...
instruction
0
8,780
14
17,560
Tags: brute force, implementation Correct Solution: ``` def kind(a,b,c): if a==4 and b==3: return "major" if a==3 and b==4: return "minor" if b==4 and c==3: return "major" if b==3 and c==4: return "minor" if c==4 and a==3: return "major" if c==3 and a==4: return "minor" return "strange" note = [n fo...
output
1
8,780
14
17,561
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya studies music. He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C ...
instruction
0
8,781
14
17,562
Tags: brute force, implementation Correct Solution: ``` import itertools def diff(a): d = [] for i, j in list(itertools.combinations(range(3), 2)): c = abs(a[j]-a[i]) d.append(c) d.append(12-c) return d s = input().split() note = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "B", "H"] minor = [[3, ...
output
1
8,781
14
17,563
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya studies music. He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C ...
instruction
0
8,782
14
17,564
Tags: brute force, implementation Correct Solution: ``` # python 3 """ """ from itertools import permutations def note_dist(note_1, note_2): notes_dict = {'C': 0, 'C#': 1, 'D': 2, 'D#': 3, 'E': 4, 'F': 5, 'F#': 6, 'G': 7, 'G#': 8, 'A': 9, 'B': 10, 'H': 11} if notes_dict[note_2] > notes_dict[...
output
1
8,782
14
17,565
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya studies music. He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C ...
instruction
0
8,783
14
17,566
Tags: brute force, implementation Correct Solution: ``` def tipo_acorde(nota1, nota2, nota3): if (((nota1 + 4)%12 == nota2 and (nota2 + 3)%12 == nota3) or ((nota1 + 4)%12 == nota3 and (nota3 + 3)%12 == nota2)): return 'major' elif (((nota1 + 3)%12 == nota2 and (nota2 + 4)%12 == nota3) or ((not...
output
1
8,783
14
17,567
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya studies music. He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C ...
instruction
0
8,784
14
17,568
Tags: brute force, implementation Correct Solution: ``` a = input().split(" ") order = { "C": 0, "C#": 1, "D": 2, "D#": 3, "E": 4, "F": 5, "F#": 6, "G": 7, "G#": 8, "A": 9, "B": 10, "H": 11 } def diff(a, b): if (order[a] - order[b]) > 0: return order[a] - ord...
output
1
8,784
14
17,569