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
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a student of University of Aizu. And you work part-time at a restaurant. Staffs of the restaurant are well trained to be delighted to provide more delicious products faster. The speed providing products particularly depends on skill of the staff. So, the manager of the restaurant want to know how long it takes to provide products. Though some restaurants employ a system which calculates how long it takes to provide products automatically, the restaurant where you work employs a system which calculates it manually. You, a student of University of Aizu, want to write a program to calculate it, and you hope that your program makes the task easier. You are given the checks in a day. If the length of time it takes to provide the products of a check is shorter than or equal to 8 minutes, it is "ok" check. Write a program to output the ratio of "ok" checks to the total in percentage. Hint If you want to read three integers in the following format, integer:integer(space)integer you can read them by scanf("%d%*c%d%d",&a;, &b;, &c;); in C. Input The input consists of multiple datasets. The last dataset is followed by a line containing a single zero. You don't have to process this data. The first line of each dataset contains a single integer n. n (0 < n ≀ 100) is the number of checks. Each of following n lines gives the details of a check in the following format. hh:mm MM hh:mm is the clock time to print the check. MM is minute of the clock time to provide products. The clock time is expressed according to the 24 hour clock. For example, "eleven one PM" is expressed by "23:01". You can assume that the all of products are provided within fifteen minutes. The restaurant is open from AM 11:00 to AM 02:00. After AM 02:00, no check is printed. Also at AM 02:00, no check is printed. Output Your program has to print in the following format for each dataset. lunch L dinner D midnight M L is ratio of "ok" check printed to the total in lunch time. D is ratio of "ok" check printed to the total in dinner time. M is ratio of "ok" check printed to the total in midnight time. You can truncate digits number after the decimal point of the ratio on the percentage. Lunch, dinner, and midnight times are defined as follows: Lunch time is 11:00 ~ 14:59. Dinner time is 18:00 ~ 20:59. Midnight time is 21:00 ~ 01:59. If a check is not printed in the three range of time, you don't have to process it. If no check is in the range of time, you should print "no guest". Example Input 5 12:57 59 20:12 15 12:19 21 18:52 03 16:09 14 0 Output lunch 100 dinner 50 midnight no guest Submitted Solution: ``` while 1: n=int(input()) if n==0:break l=d=m=cl=cm=cd=0 for i in range(n): t,M=input().split() M=int(M) h,m=map(int,t.split(':')) if m>M:M+=60 a=M-m<=8 if 11<=h<15:cl+=1;l+=a elif 18<=h<21:cd+=1;d+=a elif 21<=h or h< 2:cm+=1;m+=a print('lunch', l*100//cl if cl else 'no guest') print('dinner', d*100//cd if cd else 'no guest') print('midnight', m*100//cm if cm else 'no guest') ```
instruction
0
12,434
4
24,868
No
output
1
12,434
4
24,869
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a student of University of Aizu. And you work part-time at a restaurant. Staffs of the restaurant are well trained to be delighted to provide more delicious products faster. The speed providing products particularly depends on skill of the staff. So, the manager of the restaurant want to know how long it takes to provide products. Though some restaurants employ a system which calculates how long it takes to provide products automatically, the restaurant where you work employs a system which calculates it manually. You, a student of University of Aizu, want to write a program to calculate it, and you hope that your program makes the task easier. You are given the checks in a day. If the length of time it takes to provide the products of a check is shorter than or equal to 8 minutes, it is "ok" check. Write a program to output the ratio of "ok" checks to the total in percentage. Hint If you want to read three integers in the following format, integer:integer(space)integer you can read them by scanf("%d%*c%d%d",&a;, &b;, &c;); in C. Input The input consists of multiple datasets. The last dataset is followed by a line containing a single zero. You don't have to process this data. The first line of each dataset contains a single integer n. n (0 < n ≀ 100) is the number of checks. Each of following n lines gives the details of a check in the following format. hh:mm MM hh:mm is the clock time to print the check. MM is minute of the clock time to provide products. The clock time is expressed according to the 24 hour clock. For example, "eleven one PM" is expressed by "23:01". You can assume that the all of products are provided within fifteen minutes. The restaurant is open from AM 11:00 to AM 02:00. After AM 02:00, no check is printed. Also at AM 02:00, no check is printed. Output Your program has to print in the following format for each dataset. lunch L dinner D midnight M L is ratio of "ok" check printed to the total in lunch time. D is ratio of "ok" check printed to the total in dinner time. M is ratio of "ok" check printed to the total in midnight time. You can truncate digits number after the decimal point of the ratio on the percentage. Lunch, dinner, and midnight times are defined as follows: Lunch time is 11:00 ~ 14:59. Dinner time is 18:00 ~ 20:59. Midnight time is 21:00 ~ 01:59. If a check is not printed in the three range of time, you don't have to process it. If no check is in the range of time, you should print "no guest". Example Input 5 12:57 59 20:12 15 12:19 21 18:52 03 16:09 14 0 Output lunch 100 dinner 50 midnight no guest Submitted Solution: ``` while 1: n=int(input()) if n==0:break l=d=m=cl=cm=cd=0 for i in range(n): t,M=input().split() M=int(M) h,m=map(int,t.split(":")) if m>M:M+=60 a=M-m<=8 if 11<=h<15:cl+=1;l+=a elif 18<=h<21:cd+=1;d+=a elif 21<=h or h< 2:cm+=1;m+=a print('lunch', int(l/cl*100) if cl else 'no guest') print('dinner', int(d/cd*100) if cd else 'no guest') print('midnight', int(m/cm*100) if cm else 'no guest') ```
instruction
0
12,435
4
24,870
No
output
1
12,435
4
24,871
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a student of University of Aizu. And you work part-time at a restaurant. Staffs of the restaurant are well trained to be delighted to provide more delicious products faster. The speed providing products particularly depends on skill of the staff. So, the manager of the restaurant want to know how long it takes to provide products. Though some restaurants employ a system which calculates how long it takes to provide products automatically, the restaurant where you work employs a system which calculates it manually. You, a student of University of Aizu, want to write a program to calculate it, and you hope that your program makes the task easier. You are given the checks in a day. If the length of time it takes to provide the products of a check is shorter than or equal to 8 minutes, it is "ok" check. Write a program to output the ratio of "ok" checks to the total in percentage. Hint If you want to read three integers in the following format, integer:integer(space)integer you can read them by scanf("%d%*c%d%d",&a;, &b;, &c;); in C. Input The input consists of multiple datasets. The last dataset is followed by a line containing a single zero. You don't have to process this data. The first line of each dataset contains a single integer n. n (0 < n ≀ 100) is the number of checks. Each of following n lines gives the details of a check in the following format. hh:mm MM hh:mm is the clock time to print the check. MM is minute of the clock time to provide products. The clock time is expressed according to the 24 hour clock. For example, "eleven one PM" is expressed by "23:01". You can assume that the all of products are provided within fifteen minutes. The restaurant is open from AM 11:00 to AM 02:00. After AM 02:00, no check is printed. Also at AM 02:00, no check is printed. Output Your program has to print in the following format for each dataset. lunch L dinner D midnight M L is ratio of "ok" check printed to the total in lunch time. D is ratio of "ok" check printed to the total in dinner time. M is ratio of "ok" check printed to the total in midnight time. You can truncate digits number after the decimal point of the ratio on the percentage. Lunch, dinner, and midnight times are defined as follows: Lunch time is 11:00 ~ 14:59. Dinner time is 18:00 ~ 20:59. Midnight time is 21:00 ~ 01:59. If a check is not printed in the three range of time, you don't have to process it. If no check is in the range of time, you should print "no guest". Example Input 5 12:57 59 20:12 15 12:19 21 18:52 03 16:09 14 0 Output lunch 100 dinner 50 midnight no guest Submitted Solution: ``` #!/usr/bin/python # -*- coding: utf-8 -*- def check(target, isOk): if isOk: target[0] += 1 else: target[1] += 1 target[2] += 1 # [OK, OUT, SUM] lunch = [0, 0, 0] dinner = [0, 0, 0] midnight = [0, 0, 0] n = input() for i in range(int(n)): stdin = input() if stdin is '0': break checkTime, offerMinute = stdin.split(' ') hour, minute = map(int, checkTime.split(':')) # cast offerMinute = int(offerMinute) diff = offerMinute - minute if offerMinute > minute else 60 - minute + offerMinute ok = diff <= 8 # Lunch if 11 <= hour and hour <= 14: check(lunch, ok) continue # Dinner if 18 <= hour and hour <= 20: check(dinner, ok) continue # Midnight if 21 <= hour or hour <= 1: check(midnight, ok) continue if sum(lunch) is 0: print('lunch no guest') else: print('lunch {0}'.format(int(lunch[0]/lunch[2] * 100))) if sum(dinner) is 0: print('dinner no guest') else: print('dinner {0}'.format(int(dinner[0]/dinner[2] * 100))) if sum(midnight) is 0: print('midnight no guest') else: print('midnight {0}'.format(int(midnight[0]/midnight[2] * 100))) ```
instruction
0
12,436
4
24,872
No
output
1
12,436
4
24,873
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a student of University of Aizu. And you work part-time at a restaurant. Staffs of the restaurant are well trained to be delighted to provide more delicious products faster. The speed providing products particularly depends on skill of the staff. So, the manager of the restaurant want to know how long it takes to provide products. Though some restaurants employ a system which calculates how long it takes to provide products automatically, the restaurant where you work employs a system which calculates it manually. You, a student of University of Aizu, want to write a program to calculate it, and you hope that your program makes the task easier. You are given the checks in a day. If the length of time it takes to provide the products of a check is shorter than or equal to 8 minutes, it is "ok" check. Write a program to output the ratio of "ok" checks to the total in percentage. Hint If you want to read three integers in the following format, integer:integer(space)integer you can read them by scanf("%d%*c%d%d",&a;, &b;, &c;); in C. Input The input consists of multiple datasets. The last dataset is followed by a line containing a single zero. You don't have to process this data. The first line of each dataset contains a single integer n. n (0 < n ≀ 100) is the number of checks. Each of following n lines gives the details of a check in the following format. hh:mm MM hh:mm is the clock time to print the check. MM is minute of the clock time to provide products. The clock time is expressed according to the 24 hour clock. For example, "eleven one PM" is expressed by "23:01". You can assume that the all of products are provided within fifteen minutes. The restaurant is open from AM 11:00 to AM 02:00. After AM 02:00, no check is printed. Also at AM 02:00, no check is printed. Output Your program has to print in the following format for each dataset. lunch L dinner D midnight M L is ratio of "ok" check printed to the total in lunch time. D is ratio of "ok" check printed to the total in dinner time. M is ratio of "ok" check printed to the total in midnight time. You can truncate digits number after the decimal point of the ratio on the percentage. Lunch, dinner, and midnight times are defined as follows: Lunch time is 11:00 ~ 14:59. Dinner time is 18:00 ~ 20:59. Midnight time is 21:00 ~ 01:59. If a check is not printed in the three range of time, you don't have to process it. If no check is in the range of time, you should print "no guest". Example Input 5 12:57 59 20:12 15 12:19 21 18:52 03 16:09 14 0 Output lunch 100 dinner 50 midnight no guest Submitted Solution: ``` while 1: n=int(input()) if n==0:break l=d=m=cl=cm=cd=0 for i in range(n): t,M=input().split() M=int(M) h,m=map(int,t.split(":")) if m>M:M+=60 a=M-m<=8 if 11<=h<15:cl+=1;l+=a elif 18<=h<21:cd+=1;d+=a elif 21<=h or h< 2:cm+=1;m+=a print('lunch', int(l*100/cl) if cl else 'no guest') print('dinner', int(d*100/cd) if cd else 'no guest') print('midnight', int(m*100/cm) if cm else 'no guest') ```
instruction
0
12,437
4
24,874
No
output
1
12,437
4
24,875
Provide tags and a correct Python 3 solution for this coding contest problem. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3
instruction
0
12,799
4
25,598
Tags: binary search, brute force, implementation Correct Solution: ``` n, t = input(), [0] * 1002 for i in map(int, input().split()): t[i] += 1 T = int(input()) + 1 for i in range(1000): t[i + 1] += t[i] print(max(t[i + T] - t[i] for i in range(-1, 1001 - T))) # Made By Mostafa_Khaled ```
output
1
12,799
4
25,599
Provide tags and a correct Python 3 solution for this coding contest problem. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3
instruction
0
12,800
4
25,600
Tags: binary search, brute force, implementation Correct Solution: ``` n = int(input()) m = list(map(int, input().split())) t = int(input()) m.sort() if n == 1 or len(m) == 1: print(1) elif m[-1]-m[0] <= t: print(n) else: mx = 1 for i in range(n-1): ma = 1 fr = m[i] for j in range(i+1, n): if m[j]-fr <= t: ma += 1 else: break mx = max(ma, mx) print(mx) ```
output
1
12,800
4
25,601
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3 Submitted Solution: ``` n = int(input()) t = list(map(int, input().split())) tem = int(input()) t.sort() rmax = 1 for cont in range(0,n-1): r = 1 for cont2 in range(cont+1,n): if t[cont2] -t[cont] <= tem: r += 1 else: break if r > rmax: rmax = r print(rmax) ```
instruction
0
12,801
4
25,602
Yes
output
1
12,801
4
25,603
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3 Submitted Solution: ``` class CodeforcesTask386BSolution: def __init__(self): self.result = '' self.n = 0 self.times = [] self.t = 0 def read_input(self): self.n = int(input()) self.times = [int(x) for x in input().split(" ")] self.t = int(input()) def process_task(self): result = 0 self.times.sort() for start in set(self.times): in_range = 0 for time in self.times: if start <= time <= start + self.t: in_range += 1 result = max(result, in_range) self.result = str(result) def get_result(self): return self.result if __name__ == "__main__": Solution = CodeforcesTask386BSolution() Solution.read_input() Solution.process_task() print(Solution.get_result()) ```
instruction
0
12,802
4
25,604
Yes
output
1
12,802
4
25,605
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3 Submitted Solution: ``` import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self.writable else None def read(self): while True: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) if not b: break ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines = 0 return self.buffer.read() def readline(self): while self.newlines == 0: b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) self.newlines = b.count(b"\n") + (not b) ptr = self.buffer.tell() self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr) self.newlines -= 1 return self.buffer.readline() def flush(self): if self.writable: os.write(self._fd, self.buffer.getvalue()) self.buffer.truncate(0), self.buffer.seek(0) class IOWrapper(IOBase): def __init__(self, file): self.buffer = FastIO(file) self.flush = self.buffer.flush self.writable = self.buffer.writable self.write = lambda s: self.buffer.write(s.encode("ascii")) self.read = lambda: self.buffer.read().decode("ascii") self.readline = lambda: self.buffer.readline().decode("ascii") sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout) input = lambda: sys.stdin.readline().rstrip("\r\n") ########################################################## from collections import Counter # c=sorted((i,int(val))for i,val in enumerate(input().split())) import heapq # c=sorted((i,int(val))for i,val in enumerate(input().split())) # n = int(input()) # ls = list(map(int, input().split())) # n, k = map(int, input().split()) # n =int(input()) # e=list(map(int, input().split())) from collections import Counter #print("\n".join(ls)) #print(os.path.commonprefix(ls[0:2])) #for i in range(int(input())): n=int(input()) arr=list(map(int, input().split())) t=int(input()) arr.sort() r=0 l=0 ans=0 while r<n: while arr[r]-arr[l]>t: l+=1 ans=max(ans,r-l+1) r+=1 print(ans) #for i in range(n): ```
instruction
0
12,803
4
25,606
Yes
output
1
12,803
4
25,607
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3 Submitted Solution: ``` __author__ = 'asmn' n = int(input()) a = sorted(map(int, input().split())) dt = int(input()) ans, l, r = 0, 0, 0 while r < len(a): while r < len(a) and a[r] - a[l] <= dt: r += 1 ans = max(ans, r - l) l += 1 print(ans) ```
instruction
0
12,804
4
25,608
Yes
output
1
12,804
4
25,609
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3 Submitted Solution: ``` n=int(input()) a=list(map(int,input().split())) t=int(input()) a.sort() a=set(a) b=list(a) d=1 if(len(b)==1): print(1) else: for i in range(1,len(b)-1): if(b[i]-b[i-1]>t): d=1+d if(b[len(b)-1]-b[len(b)-2]>t): print(d+1) else: print(d) ```
instruction
0
12,805
4
25,610
No
output
1
12,805
4
25,611
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3 Submitted Solution: ``` def check(n, li, t): num = 0 li.sort() for i in range(len(li)): diff = 0 if(i < len(li)-1): diff = li[i] - li[i+1] else: diff = li[i] - li[0] if(abs(diff) <= t ): num += 1 return num n = int(input()) li = list(map(int, input().split())) t = int(input()) print(check(n, li, t)) ```
instruction
0
12,806
4
25,612
No
output
1
12,806
4
25,613
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3 Submitted Solution: ``` n=int(input()) l=list(map(int,input().split())) t=int(input()) l.sort() mx=0 for j in range(0,n-1): i=j count=1 while i<n-1: if l[i+1]-l[i]<=t: i+=1 count+=1 else: break if count>mx: mx=count print(mx) ```
instruction
0
12,807
4
25,614
No
output
1
12,807
4
25,615
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" β€” then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n students living in dormitory shouted treasured words. The i-th student made a sacrament at the time ti, where ti is the number of seconds elapsed since the beginning of the night. It is known that the freebie is a capricious and willful lady. That night the freebie was near dormitory only for T seconds. Therefore, if for two students their sacrament times differ for more than T, then the freebie didn't visit at least one of them. Since all students are optimists, they really want to know what is the maximal number of students visited by the freebie can be. Input The first line of the input contains integer n (1 ≀ n ≀ 100), where n β€” the number of students shouted "Fly, freebie, fly!" The second line contains n positive integers ti (1 ≀ ti ≀ 1000). The last line contains integer T (1 ≀ T ≀ 1000) β€” the time interval during which the freebie was near the dormitory. Output Print a single integer β€” the largest number of people who will pass exam tomorrow because of the freebie visit. Examples Input 6 4 1 7 8 3 8 1 Output 3 Submitted Solution: ``` import math n = int(input()) a = list(map(int,input().strip().split()))[:n] t=int(input()) a.sort() c=0 for i in range(0,n-1,1): if(math.fabs(a[i]-a[i+1])<=t): c+=1 else: continue print(c) ```
instruction
0
12,808
4
25,616
No
output
1
12,808
4
25,617
Provide a correct Python 3 solution for this coding contest problem. In the middle of Tyrrhenian Sea, there is a small volcanic island called Chronus. The island is now uninhabited but it used to be a civilized island. Some historical records imply that the island was annihilated by an eruption of a volcano about 800 years ago and that most of the people in the island were killed by pyroclastic flows caused by the volcanic activity. In 2003, a European team of archaeologists launched an excavation project in Chronus Island. Since then, the project has provided many significant historic insights. In particular the discovery made in the summer of 2008 astonished the world: the project team excavated several mechanical watches worn by the victims of the disaster. This indicates that people in Chronus Island had such a highly advanced manufacturing technology. Shortly after the excavation of the watches, archaeologists in the team tried to identify what time of the day the disaster happened, but it was not successful due to several difficulties. First, the extraordinary heat of pyroclastic flows severely damaged the watches and took away the letters and numbers printed on them. Second, every watch has a perfect round form and one cannot tell where the top of the watch is. Lastly, though every watch has three hands, they have a completely identical look and therefore one cannot tell which is the hour, the minute, or the second (It is a mystery how the people in Chronus Island were distinguishing the three hands. Some archaeologists guess that the hands might be painted with different colors, but this is only a hypothesis, as the paint was lost by the heat. ). This means that we cannot decide the time indicated by a watch uniquely; there can be a number of candidates. We have to consider different rotations of the watch. Furthermore, since there are several possible interpretations of hands, we have also to consider all the permutations of hands. You are an information archaeologist invited to the project team and are asked to induce the most plausible time interval within which the disaster happened, from the set of excavated watches. In what follows, we express a time modulo 12 hours. We write a time by the notation hh:mm:ss, where hh, mm, and ss stand for the hour (hh = 00, 01, 02, . . . , 11), the minute (mm = 00, 01, 02, . . . , 59), and the second (ss = 00, 01, 02, . . . , 59), respectively. The time starts from 00:00:00 and counts up every second 00:00:00, 00:00:01, 00:00:02, . . ., but it reverts to 00:00:00 every 12 hours. The watches in Chronus Island obey the following conventions of modern analog watches. * A watch has three hands, i.e. the hour hand, the minute hand, and the second hand, though they look identical as mentioned above. * Every hand ticks 6 degrees clockwise in a discrete manner. That is, no hand stays between ticks, and each hand returns to the same position every 60 ticks. * The second hand ticks every second. * The minute hand ticks every 60 seconds. * The hour hand ticks every 12 minutes. At the time 00:00:00, all the three hands are located at the same position. Because people in Chronus Island were reasonably keen to keep their watches correct and pyroclastic flows spread over the island quite rapidly, it can be assumed that all the watches were stopped in a short interval of time. Therefore it is highly expected that the time the disaster happened is in the shortest time interval within which all the excavated watches have at least one candidate time. You must calculate the shortest time interval and report it to the project team. Input The input consists of multiple datasets, each of which is formatted as follows. n s1 t1 u1 s2 t2 u2 . . . sn tn un The first line contains a single integer n (2 ≀ n ≀ 10), representing the number of the watches. The three numbers si , ti , ui in each line are integers such that 0 ≀ si ,ti , ui ≀ 59 and they specify the positions of the three hands by the number of ticks relative to an arbitrarily chosen position. Note that the positions of the hands of a watch can be expressed in many different ways. For example, if a watch was stopped at the time 11:55:03, the positions of hands can be expressed differently by rotating the watch arbitrarily (e.g. 59 55 3, 0 56 4, 1 57 5, etc.) and as well by permuting the hour, minute, and second hands arbitrarily (e.g. 55 59 3, 55 3 59, 3 55 59, etc.). The end of the input is indicated by a line containing a single zero. Output For each dataset, output the shortest time interval within which all the watches given in the dataset have at least one candidate time. The output must be written in a single line in the following format for each dataset. hh:mm:ss h'h':m'm':s's' Each line contains a pair of times hh:mm:ss and, h'h':m'm':s's' indicating that the shortest interval begins at hh:mm:ss and ends at h'h':m'm':s's' inclusive. The beginning time and the ending time are separated by a single space and each of them should consist of hour, minute, and second in two digits separated by colons. No extra characters should appear in the output. In calculating the shortest interval, you can exploit the facts that every watch has at least one candidate time and that the shortest time interval contains 00:00:00 only if the interval starts from 00:00:00 (i.e. the shortest interval terminates before the time reverts to 00:00:00). If there is more than one time interval that gives the shortest, output the one that first comes after 00:00:00 inclusive. Example Input 3 8 8 18 32 32 32 57 2 57 5 49 3 49 7 30 44 27 21 21 33 56 56 21 46 4 3 45 52 28 36 26 36 20 55 50 10 33 8 39 50 57 43 35 21 12 21 17 11 16 21 58 45 40 53 45 30 53 39 1 8 55 48 30 7 48 15 0 Output 00:00:00 00:00:10 06:14:56 06:32:09 07:27:37 07:32:02 05:17:40 05:21:03
instruction
0
13,241
4
26,482
"Correct Solution: ``` from itertools import permutations BASE = 12*3600 def convert(v): return "%02d:%02d:%02d" % (v // 3600, (v // 60) % 60, v % 60) while 1: N = int(input()) if N == 0: break R = set() L = [] for i in range(N): ts = set() *E, = map(int, input().split()) for a, b, c in permutations(E, r=3): for i in range(60): h = (a+i) % 60; m = (b+i)%60; s = (c+i) % 60 if m // 12 == h % 5: v = 3600*(h//5) + 60*m + s ts.add(v) R.add(v) L.append(sorted(ts)) R = sorted(R) res = 13*3600; mi = ma = 0 C = [0]*N for r in R: s = r for i in range(N): c = C[i]; ts = L[i]; l = len(ts) while c < l and ts[c] < r: c += 1 C[i] = c if c == l: s = max(s, BASE + ts[0]) else: s = max(s, ts[c]) if s - r < res: res = s - r mi = r % BASE; ma = s % BASE print("%s %s" % (convert(mi), convert(ma))) ```
output
1
13,241
4
26,483
Provide a correct Python 3 solution for this coding contest problem. Claire is a man-eater. She's a real man-eater. She's going around with dozens of guys. She's dating all the time. And one day she found some conflicts in her date schedule. D'oh! So she needs to pick some dates and give the others up. The dates are set by hours like 13:00 to 15:00. She may have more than one date with a guy. For example, she can have dates with Adam from 10:00 to 12:00 and from 14:00 to 16:00 and with Bob from 12:00 to 13:00 and from 18:00 to 20:00. She can have these dates as long as there is no overlap of time. Time of traveling, time of make-up, trouble from love triangles, and the likes are not of her concern. Thus she can keep all the dates with Adam and Bob in the previous example. All dates are set between 6:00 and 22:00 on the same day. She wants to get the maximum amount of satisfaction in total. Each guy gives her some satisfaction if he has all scheduled dates. Let's say, for example, Adam's satisfaction is 100 and Bob's satisfaction is 200. Then, since she can make it with both guys, she can get 300 in total. Your task is to write a program to satisfy her demand. Then she could spend a few hours with you... if you really want. Input The input consists of a sequence of datasets. Each dataset has the following format: N Guy1 ... GuyN The first line of the input contains an integer N (1 ≀ N ≀ 100), the number of guys. Then there come the descriptions of guys. Each description is given in this format: M L S1 E1 ... SM EM The first line contains two integers Mi (1 ≀ Mi ≀ 16) and Li (1 ≀ Li ≀ 100,000,000), the number of dates set for the guy and the satisfaction she would get from him respectively. Then M lines follow. The i-th line contains two integers Si and Ei (6 ≀ Si < Ei ≀ 22), the starting and ending time of the i-th date. The end of input is indicated by N = 0. Output For each dataset, output in a line the maximum amount of satisfaction she can get. Example Input 2 2 100 10 12 14 16 2 200 12 13 18 20 4 1 100 6 22 1 1000 6 22 1 10000 6 22 1 100000 6 22 16 1 100000000 6 7 1 100000000 7 8 1 100000000 8 9 1 100000000 9 10 1 100000000 10 11 1 100000000 11 12 1 100000000 12 13 1 100000000 13 14 1 100000000 14 15 1 100000000 15 16 1 100000000 16 17 1 100000000 17 18 1 100000000 18 19 1 100000000 19 20 1 100000000 20 21 1 100000000 21 22 0 Output 300 100000 1600000000
instruction
0
13,255
4
26,510
"Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 998244353 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def main(): rr = [] while True: n = I() if n == 0: break ms = [] for _ in range(n): m,l = LI() a = [LI() for _ in range(m)] b = 0 for s,e in a: for i in range(s,e): b |= 2**(i-6) ms.append((l,b)) d = collections.defaultdict(int) d[0] = 0 for l,b in ms: for k,v in list(d.items()): if b&k > 0: continue if d[b|k] < v + l: d[b|k] = v + l rr.append(max(d.values())) return '\n'.join(map(str, rr)) print(main()) ```
output
1
13,255
4
26,511
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Claire is a man-eater. She's a real man-eater. She's going around with dozens of guys. She's dating all the time. And one day she found some conflicts in her date schedule. D'oh! So she needs to pick some dates and give the others up. The dates are set by hours like 13:00 to 15:00. She may have more than one date with a guy. For example, she can have dates with Adam from 10:00 to 12:00 and from 14:00 to 16:00 and with Bob from 12:00 to 13:00 and from 18:00 to 20:00. She can have these dates as long as there is no overlap of time. Time of traveling, time of make-up, trouble from love triangles, and the likes are not of her concern. Thus she can keep all the dates with Adam and Bob in the previous example. All dates are set between 6:00 and 22:00 on the same day. She wants to get the maximum amount of satisfaction in total. Each guy gives her some satisfaction if he has all scheduled dates. Let's say, for example, Adam's satisfaction is 100 and Bob's satisfaction is 200. Then, since she can make it with both guys, she can get 300 in total. Your task is to write a program to satisfy her demand. Then she could spend a few hours with you... if you really want. Input The input consists of a sequence of datasets. Each dataset has the following format: N Guy1 ... GuyN The first line of the input contains an integer N (1 ≀ N ≀ 100), the number of guys. Then there come the descriptions of guys. Each description is given in this format: M L S1 E1 ... SM EM The first line contains two integers Mi (1 ≀ Mi ≀ 16) and Li (1 ≀ Li ≀ 100,000,000), the number of dates set for the guy and the satisfaction she would get from him respectively. Then M lines follow. The i-th line contains two integers Si and Ei (6 ≀ Si < Ei ≀ 22), the starting and ending time of the i-th date. The end of input is indicated by N = 0. Output For each dataset, output in a line the maximum amount of satisfaction she can get. Example Input 2 2 100 10 12 14 16 2 200 12 13 18 20 4 1 100 6 22 1 1000 6 22 1 10000 6 22 1 100000 6 22 16 1 100000000 6 7 1 100000000 7 8 1 100000000 8 9 1 100000000 9 10 1 100000000 10 11 1 100000000 11 12 1 100000000 12 13 1 100000000 13 14 1 100000000 14 15 1 100000000 15 16 1 100000000 16 17 1 100000000 17 18 1 100000000 18 19 1 100000000 19 20 1 100000000 20 21 1 100000000 21 22 0 Output 300 100000 1600000000 Submitted Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 998244353 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def main(): rr = [] while True: n = I() if n == 0: break ms = [] for _ in range(n): m,l = LI() a = [LI() for _ in range(m)] b = [] for s,e in a: f = 0 for i in range(s,e): f |= 2**(i-6) b.append(f) ms.append((l,b)) d = collections.defaultdict(int) d[0] = 0 for l,b in ms: g = collections.defaultdict(int) for k,v in d.items(): for f in b: if f&k > 0: continue if g[f|k] < v + l: g[f|k] = v + l for k,v in g.items(): if d[k] < v: d[k] = v rr.append(max(d.values())) return '\n'.join(map(str, rr)) print(main()) ```
instruction
0
13,256
4
26,512
No
output
1
13,256
4
26,513
Provide a correct Python 3 solution for this coding contest problem. G: Working Kou decided to do the same number of jobs every day for the next $ N $. $ A_i $ jobs are added on the $ i $ day of the $ N $ day. Mr. Kou has no work to do now, and he doesn't have to finish all the work by the $ N $ day. How many jobs can you do in a day? However, Mr. Kou is excellent, so he can do as many jobs as he has. input $ N $ is given on the first line. On the second line, $ N $ integers $ A_1, A_2, A_3, \ dots, A_N $ are given, separated by blanks. output Output the maximum number of jobs you can do in a day. Insert a line break at the end. Constraint * $ N $ is an integer greater than or equal to $ 1 $ and less than or equal to $ 100 $ * $ A_1, A_2, A_3, \ dots, A_N $ are integers between $ 1 $ and $ 100 $ Input example 1 Five 4 2 5 3 1 Output example 1 3 If you decide to work more than $ 4 $ a day, you'll run out of work on the second day. Input example 2 Five 9 9 1 9 9 Output example 2 6 Example Input 5 4 2 5 3 1 Output 3
instruction
0
13,259
4
26,518
"Correct Solution: ``` n=int(input()) ls=list(map(int,input().split())) ans=0 for i in range(1,sum(ls)//n+1): am=0 ans+=1 for j in range(0,n-1): am=am+ls[j]-i if am<0: break else: continue if am!=0: ans=ans-1 break print(ans) ```
output
1
13,259
4
26,519
Provide a correct Python 3 solution for this coding contest problem. G: Working Kou decided to do the same number of jobs every day for the next $ N $. $ A_i $ jobs are added on the $ i $ day of the $ N $ day. Mr. Kou has no work to do now, and he doesn't have to finish all the work by the $ N $ day. How many jobs can you do in a day? However, Mr. Kou is excellent, so he can do as many jobs as he has. input $ N $ is given on the first line. On the second line, $ N $ integers $ A_1, A_2, A_3, \ dots, A_N $ are given, separated by blanks. output Output the maximum number of jobs you can do in a day. Insert a line break at the end. Constraint * $ N $ is an integer greater than or equal to $ 1 $ and less than or equal to $ 100 $ * $ A_1, A_2, A_3, \ dots, A_N $ are integers between $ 1 $ and $ 100 $ Input example 1 Five 4 2 5 3 1 Output example 1 3 If you decide to work more than $ 4 $ a day, you'll run out of work on the second day. Input example 2 Five 9 9 1 9 9 Output example 2 6 Example Input 5 4 2 5 3 1 Output 3
instruction
0
13,262
4
26,524
"Correct Solution: ``` n = int(input()) li = list(map(int, input().split())) ans = 1000 s = 0 for i in range(n): s += li[i] ans = min(ans, s//(i+1)) print(ans) ```
output
1
13,262
4
26,525
Provide a correct Python 3 solution for this coding contest problem. G: Working Kou decided to do the same number of jobs every day for the next $ N $. $ A_i $ jobs are added on the $ i $ day of the $ N $ day. Mr. Kou has no work to do now, and he doesn't have to finish all the work by the $ N $ day. How many jobs can you do in a day? However, Mr. Kou is excellent, so he can do as many jobs as he has. input $ N $ is given on the first line. On the second line, $ N $ integers $ A_1, A_2, A_3, \ dots, A_N $ are given, separated by blanks. output Output the maximum number of jobs you can do in a day. Insert a line break at the end. Constraint * $ N $ is an integer greater than or equal to $ 1 $ and less than or equal to $ 100 $ * $ A_1, A_2, A_3, \ dots, A_N $ are integers between $ 1 $ and $ 100 $ Input example 1 Five 4 2 5 3 1 Output example 1 3 If you decide to work more than $ 4 $ a day, you'll run out of work on the second day. Input example 2 Five 9 9 1 9 9 Output example 2 6 Example Input 5 4 2 5 3 1 Output 3
instruction
0
13,266
4
26,532
"Correct Solution: ``` n = int(input()) li = list(map(int,input().split())) fl = False for i in range(1,200): task = 0 if fl == True: break for a in li: task += a if task >= i: task -= i else: print(i-1) fl = True break ```
output
1
13,266
4
26,533
Provide tags and a correct Python 3 solution for this coding contest problem. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year).
instruction
0
13,852
4
27,704
Tags: implementation Correct Solution: ``` def inl(a, b): """a in b""" for i in range(len(b) - len(a)): if a == b[i:i + len(a)]: return True return False n = int(input()) A = list(map(int, input().split())) d = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] u = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] ddd = d + d + d ddu = d + d + u dud = d + u + d udd = u + d + d if inl(A, ddd) or inl(A, ddu) or inl(A, dud) or inl(A, udd): print("Yes") else: print("No") ```
output
1
13,852
4
27,705
Provide tags and a correct Python 3 solution for this coding contest problem. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year).
instruction
0
13,853
4
27,706
Tags: implementation Correct Solution: ``` month1 = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] month2 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] month11 = month1 + month1 month12 = month1 + month2 month21 = month2 + month1 month11 += month11 month12 += month12 month21 += month21 n = int(input()) a = list(map(int, input().split())) flag = False for i in range(49 - n): if a == month11[i:i + n]: flag = True elif a == month12[i: i + n]: flag = True elif a == month21[i:i + n]: flag = True if flag: print("Yes") else: print("No") ```
output
1
13,853
4
27,707
Provide tags and a correct Python 3 solution for this coding contest problem. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year).
instruction
0
13,854
4
27,708
Tags: implementation Correct Solution: ``` n=int(input()) lst = list(map(int, input().strip().split(' '))) l1=[31,28,31,30,31,30,31,31,30,31,30,31]*12 l1[13]=29 l1[61]=29 l1[97]=29 l1[133]=29 f=0 for i in range(144-n+1): if l1[i:i+n]==lst: f=1 print('yes') break if f==0: print('no') ```
output
1
13,854
4
27,709
Provide tags and a correct Python 3 solution for this coding contest problem. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year).
instruction
0
13,855
4
27,710
Tags: implementation Correct Solution: ``` def main(): N = int(input()) A = tuple(map(int, input().split())) d = {28: {2}, 29: {2}, 30: {4, 6, 9, 11}, 31: {1, 3, 5, 7, 8, 10, 12}} for m in d[A[0]]: leap = 1 if A[0] == 29 else 0 for i in range(1, N): if A[i] == 29: leap += 1 if m == 12: m = 1 else: m += 1 if not m in d[A[i]] or leap > 1: break else: print('YES') return print('NO') main() ```
output
1
13,855
4
27,711
Provide tags and a correct Python 3 solution for this coding contest problem. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year).
instruction
0
13,856
4
27,712
Tags: implementation Correct Solution: ``` l1=[31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31] l2=[31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31] l1=''.join(map(str,l1)) l2=''.join(map(str,l2)) l3=l1+l2+l1 n=int(input()) l=list(map(str,input().split())) l=''.join(l) if l in l3 and l.count('29')<=1: print ("YES") else: print ("NO") ```
output
1
13,856
4
27,713
Provide tags and a correct Python 3 solution for this coding contest problem. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year).
instruction
0
13,857
4
27,714
Tags: implementation Correct Solution: ``` arr = "31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31" n = int(input()) s = input() if(s in arr): print("YES",end = "") else: print("NO",end = "") ```
output
1
13,857
4
27,715
Provide tags and a correct Python 3 solution for this coding contest problem. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year).
instruction
0
13,858
4
27,716
Tags: implementation Correct Solution: ``` year = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] leap = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] year = list(map(str, year)) leap = list(map(str, leap)) year1 = " ".join(year+year+year+year) year2 = " ".join(leap+year+year+year) year3 = " ".join(year+leap+year+year) year4 = " ".join(year+year+leap+year) year5 = " ".join(year+year+year+leap) n = int(input()) str = input() if str in year1 or str in year2 or str in year3 or str in year4 or str in year5: print('Yes') else: print('No') ```
output
1
13,858
4
27,717
Provide tags and a correct Python 3 solution for this coding contest problem. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year).
instruction
0
13,859
4
27,718
Tags: implementation Correct Solution: ``` s="312831303130313130313031" t="312931303130313130313031"; n=int(input()) s1=s+s+s; s2=t+s+s; s3=s+t+s; s4=s+s+t; q="" f=0 p=list(map(str,input().split())) for i in range(n): q=q+p[i] if q in s1: f=f+1 if q in s2: f=f+1 if q in s3: f=f+1 if q in s4: f=f+1 if(f==0): print("No") else: print("Yes") ```
output
1
13,859
4
27,719
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year). Submitted Solution: ``` n = int(input()) b = list(map(int, input().split())) a = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] i = -1 j = -1 u = - 2 if b.count(29) > 1: print('No') else: for l in range(12): f = True u += 1 i = u j = -1 while f and j + 1 < n: i = (i + 1) % 12 j += 1 if a[i] == b[j] or (a[i] == 28 and (b[j] == 28 or b[j] == 29)): pass else: f = False if f: print('Yes') break if f == False: print('No') ```
instruction
0
13,860
4
27,720
Yes
output
1
13,860
4
27,721
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year). Submitted Solution: ``` n = int(input()) l = input() ynormal = " 31 28 31 30 31 30 31 31 30 31 30 31" yleap = " 31 29 31 30 31 30 31 31 30 31 30 31" year = yleap + ynormal*3 + yleap + ynormal*3 + yleap if l in year: print('Yes') else: print('No') ```
instruction
0
13,861
4
27,722
Yes
output
1
13,861
4
27,723
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year). Submitted Solution: ``` n = int(input()) months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] a = list(map(int, input().split())) done = False for i in range(len(months)): mnt = i cnt = 0 leaped = False for j in range(len(a)): if months[mnt%12] == a[j] or (not leaped and mnt%12 == 1 and months[mnt%12]+1 == a[j]): if (mnt%12 == 1 and months[mnt%12]+1 == a[j]): leaped = True mnt += 1 cnt += 1 else: break if cnt == len(a): done = True break print ("Yes" if done else "No") ```
instruction
0
13,862
4
27,724
Yes
output
1
13,862
4
27,725
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year). Submitted Solution: ``` k = "31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31" t = int(input()) s = input() p = k.find(s) if p == -1: print("NO") else: print("YES") ```
instruction
0
13,863
4
27,726
Yes
output
1
13,863
4
27,727
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year). Submitted Solution: ``` n = int(input()) months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] a = list(map(int, input().split())) done = False for i in range(len(months)): mnt = i cnt = 0 leaped = False for j in range(len(a)): if months[mnt%12] == a[j] or (not leaped and mnt == 1 and months[mnt%12]+1 == a[j]): if (mnt == 1 and months[mnt%12]+1 == a[j]): leaped = True mnt += 1 cnt += 1 else: break if cnt == len(a): done = True break print ("Yes" if done else "No") ```
instruction
0
13,864
4
27,728
No
output
1
13,864
4
27,729
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year). Submitted Solution: ``` import sys k=[31,29,31,30,31,30,31,31,30,31,30,31] j=[31,28,31,30,31,30,31,31,30,31,30,31] n=int(input()) a=list(map(int,input().split())) if n==24: if a==k+k or a==k+j or a==j+j or a==j+k: print('Yes') else: print('No') sys.exit() h=k+k for i in range(len(h)-n): if h[i:i+n]==a: print('Yes') sys.exit() h=k+j for i in range(len(h)-n): if h[i:i+n]==a: print('Yes') sys.exit() h=j+j for i in range(len(h)-n): if h[i:i+n]==a: print('Yes') sys.exit() h=j+k for i in range(len(h)-n): if h[i:i+n]==a: print('Yes') sys.exit() print('No') ```
instruction
0
13,865
4
27,730
No
output
1
13,865
4
27,731
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year). Submitted Solution: ``` cal = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,] n = int(input()) d = list(map(int, input().split())) for i in range(len(cal) - n): if(cal[i:i+n] == d): print("YES") exit() print("NO") ```
instruction
0
13,866
4
27,732
No
output
1
13,866
4
27,733
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December. A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap. In this problem you are given n (1 ≀ n ≀ 24) integers a1, a2, ..., an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on. Input The first line contains single integer n (1 ≀ n ≀ 24) β€” the number of integers. The second line contains n integers a1, a2, ..., an (28 ≀ ai ≀ 31) β€” the numbers you are to check. Output If there are several consecutive months that fit the sequence, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can print each letter in arbitrary case (small or large). Examples Input 4 31 31 30 31 Output Yes Input 2 30 30 Output No Input 5 29 31 30 31 30 Output Yes Input 3 31 28 30 Output No Input 3 31 31 28 Output Yes Note In the first example the integers can denote months July, August, September and October. In the second example the answer is no, because there are no two consecutive months each having 30 days. In the third example the months are: February (leap year) β€” March β€” April – May β€” June. In the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO. In the fifth example the months are: December β€” January β€” February (non-leap year). Submitted Solution: ``` n = int(input()) l = list(map(int, input().split(" "))) pre = l[0] lcount = 0 if pre!= 29 else 1 flag = 1 for i in range(1, len(l)): if pre == 31: if l[i] != 30 and l[i] != 29 and l[i] != 28 and l[i]!=31: flag = 0 break if l[i] == 29: if lcount: flag = 0 break else: if l[i] != 31: flag=0 break pre = l[i] if flag==1: print("YES") else: print("NO") ```
instruction
0
13,867
4
27,734
No
output
1
13,867
4
27,735
Provide a correct Python 3 solution for this coding contest problem. The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ... Given is a string S representing the weather in the town today. Predict the weather tomorrow. Constraints * S is `Sunny`, `Cloudy`, or `Rainy`. Input Input is given from Standard Input in the following format: S Output Print a string representing the expected weather tomorrow, in the same format in which input is given. Examples Input Sunny Output Cloudy Input Rainy Output Sunny
instruction
0
13,937
4
27,874
"Correct Solution: ``` w = ["Sunny", "Cloudy", "Rainy"] s = input() print(w[(w.index(s) + 1) % 3]) ```
output
1
13,937
4
27,875
Provide a correct Python 3 solution for this coding contest problem. The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ... Given is a string S representing the weather in the town today. Predict the weather tomorrow. Constraints * S is `Sunny`, `Cloudy`, or `Rainy`. Input Input is given from Standard Input in the following format: S Output Print a string representing the expected weather tomorrow, in the same format in which input is given. Examples Input Sunny Output Cloudy Input Rainy Output Sunny
instruction
0
13,941
4
27,882
"Correct Solution: ``` di = {'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Sunny'} print(di[input()]) ```
output
1
13,941
4
27,883
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks. According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot. Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them. Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Can you help him? Input The single line of the input contains two positive integers a and b (1 ≀ a, b ≀ 100) β€” the number of red and blue socks that Vasya's got. Output Print two space-separated integers β€” the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day. Examples Input 3 1 Output 1 1 Input 2 3 Output 2 0 Input 7 3 Output 3 2 Note In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day. Submitted Solution: ``` x=list(map(int,input().split())) print(min(x),abs(x[0]-x[1])//2) ```
instruction
0
14,632
4
29,264
Yes
output
1
14,632
4
29,265
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks. According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot. Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them. Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Can you help him? Input The single line of the input contains two positive integers a and b (1 ≀ a, b ≀ 100) β€” the number of red and blue socks that Vasya's got. Output Print two space-separated integers β€” the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day. Examples Input 3 1 Output 1 1 Input 2 3 Output 2 0 Input 7 3 Output 3 2 Note In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day. Submitted Solution: ``` A = [int(k) for k in input().split()] B = [min(A[0],A[1]),(max(A[0],A[1])-min(A[0],A[1]))//2] for i in range(2): B[i] = str(B[i]) print(' '.join(B)) ```
instruction
0
14,633
4
29,266
Yes
output
1
14,633
4
29,267
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks. According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot. Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them. Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Can you help him? Input The single line of the input contains two positive integers a and b (1 ≀ a, b ≀ 100) β€” the number of red and blue socks that Vasya's got. Output Print two space-separated integers β€” the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day. Examples Input 3 1 Output 1 1 Input 2 3 Output 2 0 Input 7 3 Output 3 2 Note In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day. Submitted Solution: ``` s,k=map(int,input().split()) b=abs(s-k)//2 a=abs((s+k)//2-b) print(a,b) ```
instruction
0
14,634
4
29,268
Yes
output
1
14,634
4
29,269
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks. According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot. Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them. Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Can you help him? Input The single line of the input contains two positive integers a and b (1 ≀ a, b ≀ 100) β€” the number of red and blue socks that Vasya's got. Output Print two space-separated integers β€” the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day. Examples Input 3 1 Output 1 1 Input 2 3 Output 2 0 Input 7 3 Output 3 2 Note In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day. Submitted Solution: ``` a,b=sorted([int(x) for x in input().split()]) print(a,(b-a)//2) ```
instruction
0
14,635
4
29,270
Yes
output
1
14,635
4
29,271
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks. According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot. Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them. Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Can you help him? Input The single line of the input contains two positive integers a and b (1 ≀ a, b ≀ 100) β€” the number of red and blue socks that Vasya's got. Output Print two space-separated integers β€” the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day. Examples Input 3 1 Output 1 1 Input 2 3 Output 2 0 Input 7 3 Output 3 2 Note In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day. Submitted Solution: ``` a, b = map(int,input().split()) if a>b: diff_socks = (min(a,b)) sim_socks = b - a%b print(diff_socks,sim_socks,end=' ') elif b>a: diff_socks = (min(a,b)) sim_socks = a - a%b print(diff_socks,sim_socks,end=' ') elif a==b: diff_socks = (min(a,b)) sim_socks = (b - a%b)-b print(diff_socks,sim_socks,end=' ') ```
instruction
0
14,636
4
29,272
No
output
1
14,636
4
29,273
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks. According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot. Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them. Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Can you help him? Input The single line of the input contains two positive integers a and b (1 ≀ a, b ≀ 100) β€” the number of red and blue socks that Vasya's got. Output Print two space-separated integers β€” the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day. Examples Input 3 1 Output 1 1 Input 2 3 Output 2 0 Input 7 3 Output 3 2 Note In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day. Submitted Solution: ``` a,b = map(int,input().split()) tim = a - b z = tim/2 z = int(z) if(a > b): print(b, z) else: print(a, z) ```
instruction
0
14,637
4
29,274
No
output
1
14,637
4
29,275
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks. According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot. Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them. Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Can you help him? Input The single line of the input contains two positive integers a and b (1 ≀ a, b ≀ 100) β€” the number of red and blue socks that Vasya's got. Output Print two space-separated integers β€” the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day. Examples Input 3 1 Output 1 1 Input 2 3 Output 2 0 Input 7 3 Output 3 2 Note In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day. Submitted Solution: ``` a , b = map(int, input().split()) if a > b: x = b y = int((a-b)/2) print(str(x) + ' ' + str(y)) elif b>a: x = a y = int((b-a)/2) print(str(x)+' '+ str(y)) if a == b: x =(int(a/2)) print(str(x) + ' '+ '0') ```
instruction
0
14,638
4
29,276
No
output
1
14,638
4
29,277
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks. According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot. Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them. Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Can you help him? Input The single line of the input contains two positive integers a and b (1 ≀ a, b ≀ 100) β€” the number of red and blue socks that Vasya's got. Output Print two space-separated integers β€” the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got. Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day. Examples Input 3 1 Output 1 1 Input 2 3 Output 2 0 Input 7 3 Output 3 2 Note In the first sample Vasya can first put on one pair of different socks, after that he has two red socks left to wear on the second day. Submitted Solution: ``` a,b=map(int,input().split()) if a>=b: k=b m=a//2 elif a<b: k=a m=b//2 print(k,m) ```
instruction
0
14,639
4
29,278
No
output
1
14,639
4
29,279
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (i.e. Borya should first visit doctor 1, then doctor 2, then doctor 3 and so on). Borya will get the information about his health from the last doctor. Doctors have a strange working schedule. The doctor i goes to work on the si-th day and works every di day. So, he works on days si, si + di, si + 2di, .... The doctor's appointment takes quite a long time, so Borya can not see more than one doctor per day. What is the minimum time he needs to visit all doctors? Input First line contains an integer n β€” number of doctors (1 ≀ n ≀ 1000). Next n lines contain two numbers si and di (1 ≀ si, di ≀ 1000). Output Output a single integer β€” the minimum day at which Borya can visit the last doctor. Examples Input 3 2 2 1 2 2 2 Output 4 Input 2 10 1 6 5 Output 11 Note In the first sample case, Borya can visit all doctors on days 2, 3 and 4. In the second sample case, Borya can visit all doctors on days 10 and 11. Submitted Solution: ``` import math n = int(input()) s = [] d = [] for i in range(n): inp = input().split() s.append(int(inp[0])) d.append(int(inp[1])) ans = s[0] for i in range(1,len(s)): if(s[i] < ans): ans = (d[i] * math.floor(1+((ans - s[i])/d[i]))) + s[i] else: if(ans == s[i]): ans = s[i] + d[i] else: ans = s[i] print(ans) ```
instruction
0
14,716
4
29,432
Yes
output
1
14,716
4
29,433
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (i.e. Borya should first visit doctor 1, then doctor 2, then doctor 3 and so on). Borya will get the information about his health from the last doctor. Doctors have a strange working schedule. The doctor i goes to work on the si-th day and works every di day. So, he works on days si, si + di, si + 2di, .... The doctor's appointment takes quite a long time, so Borya can not see more than one doctor per day. What is the minimum time he needs to visit all doctors? Input First line contains an integer n β€” number of doctors (1 ≀ n ≀ 1000). Next n lines contain two numbers si and di (1 ≀ si, di ≀ 1000). Output Output a single integer β€” the minimum day at which Borya can visit the last doctor. Examples Input 3 2 2 1 2 2 2 Output 4 Input 2 10 1 6 5 Output 11 Note In the first sample case, Borya can visit all doctors on days 2, 3 and 4. In the second sample case, Borya can visit all doctors on days 10 and 11. Submitted Solution: ``` n = int(input()) k = [] for _ in range(n): l = list(map(int, input().split())) k.append(l) res = k[0][0] for i in range(1,n): if k[i][0]>res: res = k[i][0] else: res= k[i][0] + ((((res - k[i][0])//k[i][1])+1)*k[i][1]) print(res) ```
instruction
0
14,717
4
29,434
Yes
output
1
14,717
4
29,435
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (i.e. Borya should first visit doctor 1, then doctor 2, then doctor 3 and so on). Borya will get the information about his health from the last doctor. Doctors have a strange working schedule. The doctor i goes to work on the si-th day and works every di day. So, he works on days si, si + di, si + 2di, .... The doctor's appointment takes quite a long time, so Borya can not see more than one doctor per day. What is the minimum time he needs to visit all doctors? Input First line contains an integer n β€” number of doctors (1 ≀ n ≀ 1000). Next n lines contain two numbers si and di (1 ≀ si, di ≀ 1000). Output Output a single integer β€” the minimum day at which Borya can visit the last doctor. Examples Input 3 2 2 1 2 2 2 Output 4 Input 2 10 1 6 5 Output 11 Note In the first sample case, Borya can visit all doctors on days 2, 3 and 4. In the second sample case, Borya can visit all doctors on days 10 and 11. Submitted Solution: ``` ar=[] i=0 for x in range(int(input())): ar.append(list(map(int,input().split()))) for x in ar: i=max(x[0],i+(x[0]-i-1)%x[1]+1) #print(i) print(i) ```
instruction
0
14,718
4
29,436
Yes
output
1
14,718
4
29,437
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (i.e. Borya should first visit doctor 1, then doctor 2, then doctor 3 and so on). Borya will get the information about his health from the last doctor. Doctors have a strange working schedule. The doctor i goes to work on the si-th day and works every di day. So, he works on days si, si + di, si + 2di, .... The doctor's appointment takes quite a long time, so Borya can not see more than one doctor per day. What is the minimum time he needs to visit all doctors? Input First line contains an integer n β€” number of doctors (1 ≀ n ≀ 1000). Next n lines contain two numbers si and di (1 ≀ si, di ≀ 1000). Output Output a single integer β€” the minimum day at which Borya can visit the last doctor. Examples Input 3 2 2 1 2 2 2 Output 4 Input 2 10 1 6 5 Output 11 Note In the first sample case, Borya can visit all doctors on days 2, 3 and 4. In the second sample case, Borya can visit all doctors on days 10 and 11. Submitted Solution: ``` from math import ceil d = int(input()) a = list() for k in range(d): s, l = input().split() a.append((int(s), int(l))) t = a[0][0] for i in a[1:]: s, l = i if s > t: t = s else: n = ceil((t - s + 1) / l) t = s + l * n print(t) ```
instruction
0
14,719
4
29,438
Yes
output
1
14,719
4
29,439