message
stringlengths
2
20.2k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
757
108k
cluster
float64
4
4
__index_level_0__
int64
1.51k
217k
Provide a correct Python 3 solution for this coding contest problem. Problem "Ritsumeikan University Competitive Programming Camp" will be held this year as well. I am very much looking forward to this annual training camp. However, I couldn't stand my desires and splurged before the training camp, so I couldn't affo...
instruction
0
757
4
1,514
"Correct Solution: ``` def check_uruu(y): if y % 400 == 0: return True elif y % 100 == 0: return False elif y % 4 == 0: return True else: return False nouruu = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] uruu = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] Y1, M1...
output
1
757
4
1,515
Provide a correct Python 3 solution for this coding contest problem. Problem "Ritsumeikan University Competitive Programming Camp" will be held this year as well. I am very much looking forward to this annual training camp. However, I couldn't stand my desires and splurged before the training camp, so I couldn't affo...
instruction
0
758
4
1,516
"Correct Solution: ``` import datetime y1,m1,d1,y2,m2,d2=map(int,input().split()) qq,y1=divmod(y1,400) y1+=400 qq-=1 q=(y2-y1)//400 y2-=400*q a=688*(q-qq) d=datetime.date(y1,m1,d1) while d<=datetime.date(y2,m2,d2): if d.day==13 and d.weekday()==4:a+=1 d+=datetime.timedelta(days=1) print(a) ```
output
1
758
4
1,517
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem "Ritsumeikan University Competitive Programming Camp" will be held this year as well. I am very much looking forward to this annual training camp. However, I couldn't stand my desires a...
instruction
0
759
4
1,518
No
output
1
759
4
1,519
Provide a correct Python 3 solution for this coding contest problem. There are $ n $ acitivities with start times $ \\ {s_i \\} $ and finish times $ \\ {t_i \\} $. Assuming that a person can only work on a single activity at a time, find the maximum number of activities that can be performed by a single person. Const...
instruction
0
2,439
4
4,878
"Correct Solution: ``` if __name__ == "__main__": num_activities = int(input()) activities = [[0, 0] for _ in range(num_activities)] for i in range(num_activities): activities[i] = list(map(lambda x: int(x), input().split())) # Sort by end time in the ascending order. activities = sorted(ac...
output
1
2,439
4
4,879
Provide a correct Python 3 solution for this coding contest problem. A boy PCK is playing with N electric metronomes. The i-th metronome is set to tick every t_i seconds. He started all of them simultaneously. He noticed that, even though each metronome has its own ticking interval, all of them tick simultaneously fr...
instruction
0
3,255
4
6,510
"Correct Solution: ``` N = int(input()) t = [int(input()) for i in range(N)] M = max(t) div = [i for i in range(1, M + 1) if M % i == 0] di = 0 for i in t: for j in div: if i <= j: di += j - i break print(di) ```
output
1
3,255
4
6,511
Provide a correct Python 3 solution for this coding contest problem. A boy PCK is playing with N electric metronomes. The i-th metronome is set to tick every t_i seconds. He started all of them simultaneously. He noticed that, even though each metronome has its own ticking interval, all of them tick simultaneously fr...
instruction
0
3,256
4
6,512
"Correct Solution: ``` from bisect import bisect_left as bl n = int(input()) tlst = sorted([int(input()) for _ in range(n)]) max_t = tlst[-1] divisors = [i for i in range(1, max_t + 1) if max_t % i == 0] ans = 0 for t in tlst: ind = bl(divisors, t) ans += divisors[ind] - t print(ans) ```
output
1
3,256
4
6,513
Provide a correct Python 3 solution for this coding contest problem. A boy PCK is playing with N electric metronomes. The i-th metronome is set to tick every t_i seconds. He started all of them simultaneously. He noticed that, even though each metronome has its own ticking interval, all of them tick simultaneously fr...
instruction
0
3,257
4
6,514
"Correct Solution: ``` N = int(input()) lst = [int(input()) for _ in range(N)] max_ = max(lst) divisors = [] d = 0 for i in range(1, int(max_**0.5) + 1): if max_ % i == 0: divisors.append(i) divisors.append(max_ // i) divisors.sort() for i in sorted(lst): for divisor in divisors: if i ...
output
1
3,257
4
6,515
Provide a correct Python 3 solution for this coding contest problem. A boy PCK is playing with N electric metronomes. The i-th metronome is set to tick every t_i seconds. He started all of them simultaneously. He noticed that, even though each metronome has its own ticking interval, all of them tick simultaneously fr...
instruction
0
3,258
4
6,516
"Correct Solution: ``` import math n = int(input()) lis = [] cou = 0 ans = 0 for i in range(n): a = int(input()) cou = max(cou,a) lis.append(a) num = [] for i in range(1,cou+1): if cou % i == 0: num.append(i) for nu in lis: co = 0 while num[co] < nu: co += 1 ans += (num[co]-nu) print(ans) ```
output
1
3,258
4
6,517
Provide a correct Python 3 solution for this coding contest problem. A boy PCK is playing with N electric metronomes. The i-th metronome is set to tick every t_i seconds. He started all of them simultaneously. He noticed that, even though each metronome has its own ticking interval, all of them tick simultaneously fr...
instruction
0
3,259
4
6,518
"Correct Solution: ``` n = int(input()) max_t = 0 timing = [] for i in range(n): timing.append(int(input())) if timing[i] > max_t : max_t = timing[i] divisor = [] for i in range(1,(max_t>>1)+1): if max_t%i == 0 : divisor.append(i) divisor.append(max_t) adj = 0 for t in timing : for d in divisor : ...
output
1
3,259
4
6,519
Provide a correct Python 3 solution for this coding contest problem. A boy PCK is playing with N electric metronomes. The i-th metronome is set to tick every t_i seconds. He started all of them simultaneously. He noticed that, even though each metronome has its own ticking interval, all of them tick simultaneously fr...
instruction
0
3,260
4
6,520
"Correct Solution: ``` def divisor_list(x): return tuple([i for i in range(1, x+1) if x % i == 0]) N = int(input()) t = [int(input()) for _ in range(N)] div = divisor_list(max(t)) di = 0 for i in range(N): j = 0 while div[j] < t[i]: j += 1 else: di += div[j] - t[i] print(di) ```
output
1
3,260
4
6,521
Provide a correct Python 3 solution for this coding contest problem. A boy PCK is playing with N electric metronomes. The i-th metronome is set to tick every t_i seconds. He started all of them simultaneously. He noticed that, even though each metronome has its own ticking interval, all of them tick simultaneously fr...
instruction
0
3,261
4
6,522
"Correct Solution: ``` N = int(input()) T = [int(input()) for i in range(N)] T.sort() if N == 1: ans = 0 else: y = T[-1] R = [] for x in range(1, y+1): if y % x == 0: R.append(x) cur = ans = 0 for t in T: while R[cur] < t: cur += 1 ans += R[cur] - ...
output
1
3,261
4
6,523
Provide a correct Python 3 solution for this coding contest problem. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angula...
instruction
0
3,964
4
7,928
"Correct Solution: ``` from math import cos, sqrt, pi A, B, H, M = map(int, input().split()) print(sqrt(A*A + B*B - 2*A*B*cos((30*H-5.5*M)*pi/180))) ```
output
1
3,964
4
7,929
Provide a correct Python 3 solution for this coding contest problem. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angula...
instruction
0
3,965
4
7,930
"Correct Solution: ``` import math a,b,h,m=map(int,input().split()) kaku=math.cos(math.radians(abs((h*60+m)/2-m*6))) print((a**2+b**2-2*a*b*kaku)**(1/2)) ```
output
1
3,965
4
7,931
Provide a correct Python 3 solution for this coding contest problem. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angula...
instruction
0
3,966
4
7,932
"Correct Solution: ``` A,B,H,M=map(int,input().split()) k=abs(11/2*M-30*H) import math l=2*A*B*math.cos(k*math.pi/180) print(math.sqrt(A**2+B**2-l)) ```
output
1
3,966
4
7,933
Provide a correct Python 3 solution for this coding contest problem. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angula...
instruction
0
3,967
4
7,934
"Correct Solution: ``` import math A,B,H,M=map(int,input().split()) P=H*30-M*5.5 c = math.cos(math.radians(P)) L=A*A+B*B-2*A*B*c x=math.sqrt(L) print(x) ```
output
1
3,967
4
7,935
Provide a correct Python 3 solution for this coding contest problem. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angula...
instruction
0
3,968
4
7,936
"Correct Solution: ``` import math a,b,h,m = map(int,input().split()) s = abs(6*m-(h*30+m/2)) print((a**2+b**2-2*a*b*math.cos(math.radians(s)))**(1/2)) ```
output
1
3,968
4
7,937
Provide a correct Python 3 solution for this coding contest problem. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angula...
instruction
0
3,969
4
7,938
"Correct Solution: ``` import math a,b,h,m=map(int,input().split()) c=math.radians(abs(30*(h+m/60)-6*m)) print(math.sqrt(a**2+b**2-2*a*b*math.cos(c))) ```
output
1
3,969
4
7,939
Provide a correct Python 3 solution for this coding contest problem. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angula...
instruction
0
3,970
4
7,940
"Correct Solution: ``` from math import * a,b,h,m=map(int,input().split()) print(sqrt(a*a+b*b-2*a*b*cos(radians(abs(30*h-5.5*m))))) ```
output
1
3,970
4
7,941
Provide a correct Python 3 solution for this coding contest problem. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angula...
instruction
0
3,971
4
7,942
"Correct Solution: ``` import math a, b, h, m = map(int, input().split()) print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(2*(h*60 - m*11)*math.pi/720))) ```
output
1
3,971
4
7,943
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, aro...
instruction
0
3,972
4
7,944
Yes
output
1
3,972
4
7,945
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, aro...
instruction
0
3,973
4
7,946
Yes
output
1
3,973
4
7,947
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, aro...
instruction
0
3,974
4
7,948
Yes
output
1
3,974
4
7,949
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, aro...
instruction
0
3,975
4
7,950
Yes
output
1
3,975
4
7,951
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, aro...
instruction
0
3,976
4
7,952
No
output
1
3,976
4
7,953
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, aro...
instruction
0
3,977
4
7,954
No
output
1
3,977
4
7,955
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, aro...
instruction
0
3,978
4
7,956
No
output
1
3,978
4
7,957
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, aro...
instruction
0
3,979
4
7,958
No
output
1
3,979
4
7,959
Provide tags and a correct Python 3 solution for this coding contest problem. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minim...
instruction
0
4,699
4
9,398
Tags: brute force, implementation Correct Solution: ``` hh, mm = [str(x) for x in input().split(':')] ih = int(hh) im = int(mm) cnt = 0 while True: sh = str(ih) sm = str(im) if len(sh) == 1: sh = '0'+sh if len(sm) == 1: sm = '0'+sm if sh == sm[::-1]: print(cnt) break ...
output
1
4,699
4
9,399
Provide tags and a correct Python 3 solution for this coding contest problem. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minim...
instruction
0
4,700
4
9,400
Tags: brute force, implementation Correct Solution: ``` h, m = input().split(':') pos_hours = list(range(0, 6)) + list(range(10, 16)) + \ list(range(20, 25)) if int(h[1] + h[0]) == int(m): print(0) else: if int(h[1] + h[0]) > int(m) and int(h) in pos_hours: print(int(h[1] + h[0]) - int(m))...
output
1
4,700
4
9,401
Provide tags and a correct Python 3 solution for this coding contest problem. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minim...
instruction
0
4,701
4
9,402
Tags: brute force, implementation Correct Solution: ``` h,m=map(int,input().split(':')) i=0 a=h b=m while(1): if(h%10==m//10 and h//10==m%10): break m+=1 i+=1 if(m>59): h+=1 h=h%24 m=0 print(i) ```
output
1
4,701
4
9,403
Provide tags and a correct Python 3 solution for this coding contest problem. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minim...
instruction
0
4,702
4
9,404
Tags: brute force, implementation Correct Solution: ``` time = input() x = int(time[0]) y = (int(time[3])*10) + int(time[4]) z = int(time[1]) temp = (z*10) + x if x == 0: if z < 5: if y > temp: t1 = ((z+1)*10) + x print((60 - y)+t1) else: print(temp - y) elif ...
output
1
4,702
4
9,405
Provide tags and a correct Python 3 solution for this coding contest problem. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minim...
instruction
0
4,703
4
9,406
Tags: brute force, implementation Correct Solution: ``` rawtime = input() hours = int(rawtime[0:2]) minutes = int(rawtime[3:5]) def isPal(s): a = list(s) a.reverse() return list(s) == a def formatTime(hours, minutes): time = '' if hours < 10: time += '0' time += str(hours) time += ':' if minutes < 10: tim...
output
1
4,703
4
9,407
Provide tags and a correct Python 3 solution for this coding contest problem. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minim...
instruction
0
4,704
4
9,408
Tags: brute force, implementation Correct Solution: ``` h,m = map(int,input().split(':')) count = 0 while h%10 != m//10 or h//10 != m%10: m+=1 count+=1 if m == 60: h+=1 h%=24 m = 0 print(count) ```
output
1
4,704
4
9,409
Provide tags and a correct Python 3 solution for this coding contest problem. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minim...
instruction
0
4,705
4
9,410
Tags: brute force, implementation Correct Solution: ``` now = list(map(int, input().split(":"))) now = now[0] * 60 + now[1] i = now while True: h = str(i // 60).rjust(2, '0') m = str(i % 60).rjust(2, '0') if h[::-1] == m: print((i - now) % (24 * 60)) break else: i += 1 i ...
output
1
4,705
4
9,411
Provide tags and a correct Python 3 solution for this coding contest problem. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minim...
instruction
0
4,706
4
9,412
Tags: brute force, implementation Correct Solution: ``` import sys import math import itertools import collections def sieve(n): prime = [True for i in range(n + 1)] p = 2 while (p * p <= n): if (prime[p] == True): for i in range(p * 2, n + 1, p): prime[i] = False ...
output
1
4,706
4
9,413
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up wh...
instruction
0
4,707
4
9,414
Yes
output
1
4,707
4
9,415
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up wh...
instruction
0
4,708
4
9,416
Yes
output
1
4,708
4
9,417
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up wh...
instruction
0
4,709
4
9,418
Yes
output
1
4,709
4
9,419
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up wh...
instruction
0
4,710
4
9,420
Yes
output
1
4,710
4
9,421
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up wh...
instruction
0
4,711
4
9,422
No
output
1
4,711
4
9,423
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up wh...
instruction
0
4,712
4
9,424
No
output
1
4,712
4
9,425
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up wh...
instruction
0
4,713
4
9,426
No
output
1
4,713
4
9,427
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Karen is getting ready for a new school day! <image> It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up wh...
instruction
0
4,714
4
9,428
No
output
1
4,714
4
9,429
Provide a correct Python 3 solution for this coding contest problem. We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that da...
instruction
0
4,809
4
9,618
"Correct Solution: ``` print(max(map(len, input().split('S')))) ```
output
1
4,809
4
9,619
Provide a correct Python 3 solution for this coding contest problem. We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that da...
instruction
0
4,810
4
9,620
"Correct Solution: ``` def main(): s = input().split('S') x = max(map(len,s)) print(x) main() ```
output
1
4,810
4
9,621
Provide a correct Python 3 solution for this coding contest problem. We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that da...
instruction
0
4,813
4
9,626
"Correct Solution: ``` S = input() l = S.split('S') print(max([len(i) for i in l])) ```
output
1
4,813
4
9,627
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if...
instruction
0
4,817
4
9,634
Yes
output
1
4,817
4
9,635
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if...
instruction
0
4,818
4
9,636
Yes
output
1
4,818
4
9,637
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if...
instruction
0
4,819
4
9,638
Yes
output
1
4,819
4
9,639
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if...
instruction
0
4,820
4
9,640
Yes
output
1
4,820
4
9,641