message
stringlengths
2
20.2k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
757
108k
cluster
float64
4
4
__index_level_0__
int64
1.51k
217k
Provide tags and a correct Python 3 solution for this coding contest problem. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday.
instruction
0
34,772
4
69,544
Tags: implementation Correct Solution: ``` day=["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"] a=day.index(str(input())) b=day.index(str(input())) ans="NO" if (b-a)%7 in [3,0,2]: ans="YES" print(ans) ```
output
1
34,772
4
69,545
Provide tags and a correct Python 3 solution for this coding contest problem. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday.
instruction
0
34,773
4
69,546
Tags: implementation Correct Solution: ``` s1=input() s2=input() if s1==s2: print("YES") else: d={"monday":1,"tuesday":2,"wednesday":3,"thursday":4,"friday":5,"saturday":6,"sunday":7} if d[s2]>d[s1]: x=d[s2]-d[s1] else: x=7-d[s1]+d[s2] # print(d[s1],d[s2],x) if x==2 or x==3: print("YES") else: print("NO") ```
output
1
34,773
4
69,547
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday. Submitted Solution: ``` m = [3,0,2] a = input() b = input() month = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"] if (month.index(b) - month.index(a)) % 7 in m: print('YES') else: print('NO') ```
instruction
0
34,774
4
69,548
Yes
output
1
34,774
4
69,549
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday. Submitted Solution: ``` def checking_the_calendar(): months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] text = input() text += input() for i in range(7): res = days[i] next_day = i for j in range(11): next_day += months[j] next_day = next_day % 7 res += days[next_day] if text in res: return 'YES' return 'NO' print(checking_the_calendar()) ```
instruction
0
34,775
4
69,550
Yes
output
1
34,775
4
69,551
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday. Submitted Solution: ``` d = {'monday': 1, 'tuesday': 2, 'wednesday': 3, 'thursday': 4, 'friday': 5, 'saturday': 6, 'sunday': 7} first = d[input()] second = d[input()] cnt = (second + 7 - first) % 7 s = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30} for v in s: if v % 7 == cnt: print('YES') break else: print('NO') ```
instruction
0
34,776
4
69,552
Yes
output
1
34,776
4
69,553
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday. Submitted Solution: ``` a1 = str(input()) a2 = str(input()) l = ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"] ind = l.index(a1) if a2 in [l[ind],l[(ind+3)%7],l[(ind+2)%7]]: print("YES") else: print("NO") ```
instruction
0
34,777
4
69,554
Yes
output
1
34,777
4
69,555
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday. Submitted Solution: ``` from sys import stdin, stdout cin = stdin.readline cout = stdout.write mp = lambda:list(map(int, cin().split())) f = cin()[:-1] s = cin()[:-1] d = {'saturday': 1, 'sunday':2, 'monday':3, 'tuesday':4, 'wednesday':5, 'thursday':6, 'friday':7} l = [0,2,3] if abs(d[f]-d[s]) in l: cout('YES') else: cout('NO') ```
instruction
0
34,778
4
69,556
No
output
1
34,778
4
69,557
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday. Submitted Solution: ``` l=["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday",'monday'] x=input() y=input() if(l.index(x)+1==l.index(y)): print("NO") else: print("YES") ```
instruction
0
34,779
4
69,558
No
output
1
34,779
4
69,559
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday. Submitted Solution: ``` FirstDay=input() SecondDay=input() ListOfDays=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"] if FirstDay in ListOfDays: a=ListOfDays.index(str(FirstDay)) if SecondDay in ListOfDays: b=ListOfDays.index(str(SecondDay)) print(a) print(b) o=[a,a+2,a+3] if b in o: print("YES") else: print("NO") ```
instruction
0
34,780
4
69,560
No
output
1
34,780
4
69,561
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Examples Input monday tuesday Output NO Input sunday sunday Output YES Input saturday tuesday Output YES Note In the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays. In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday. Submitted Solution: ``` one_day = str(input()) another_day = str(input()) first_variant = "" second_variant = "" third_variant = "" if one_day == "monday": one_day = 1 if one_day == "tuesday": one_day = 2 if one_day == "wednesday": one_day = 3 if one_day == "thursday": one_day = 4 if one_day == "friday": one_day = 5 if one_day == "saturday": one_day = 6 if one_day == "sunday": one_day = 7 result = one_day + 3 if result > 7: result -= 7 another_result = one_day + 2 if another_result > 7: another_result -= 7 third_result = one_day if result == 1: first_variant = "monday" elif result == 2: first_variant = "tuesday" elif result == 3: first_variant = "wednesday" elif result == 4: first_variant = "thursday" elif result == 5 : first_variant = "friday" elif result == 6: first_variant = "saturday" elif result == 7: first_variant = "sunday" if another_result == 1: second_variant = "monday" elif another_result == 2: second_variantt = "tuesday" elif another_result == 3: second_variant = "wednesday" elif another_result == 4: second_variant = "thursday" elif another_result == 5 : second_variant = "friday" elif another_result == 6: second_variant = "saturday" elif another_result == 7: second_variant = "sunday" if third_result == 1: third_variant = "monday" elif third_result == 2: third_variant = "tuesday" elif third_result == 3: third_variant = "wednesday" elif third_result == 4: third_variant = "thursday" elif third_result == 5 : third_variant = "friday" elif third_result == 6: third_variant = "saturday" elif third_result == 7: third_variant = "sunday" if first_variant == another_day or second_variant == another_day or third_variant == another_day: print("Yes") else: print("NO") ```
instruction
0
34,781
4
69,562
No
output
1
34,781
4
69,563
Provide a correct Python 3 solution for this coding contest problem. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20
instruction
0
36,806
4
73,612
"Correct Solution: ``` n = float(input()) m = n * 2 hour = int(m // 60) minutes = int(m % 60) print(hour, minutes) ```
output
1
36,806
4
73,613
Provide a correct Python 3 solution for this coding contest problem. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20
instruction
0
36,807
4
73,614
"Correct Solution: ``` print((lambda x:'{} {}'.format(x//30,(x%30)*2))(int(input()))) ```
output
1
36,807
4
73,615
Provide a correct Python 3 solution for this coding contest problem. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20
instruction
0
36,808
4
73,616
"Correct Solution: ``` n = int(input()) print(str(2*n//60) + " " + str((2*n)%60)) ```
output
1
36,808
4
73,617
Provide a correct Python 3 solution for this coding contest problem. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20
instruction
0
36,809
4
73,618
"Correct Solution: ``` d=int(input());print(d//30,d%30*2) ```
output
1
36,809
4
73,619
Provide a correct Python 3 solution for this coding contest problem. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20
instruction
0
36,810
4
73,620
"Correct Solution: ``` theta = int(input()) print(theta//30, (theta%30)*2) ```
output
1
36,810
4
73,621
Provide a correct Python 3 solution for this coding contest problem. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20
instruction
0
36,811
4
73,622
"Correct Solution: ``` num = int(input()) #標準入力 print(str(num // 30) + " " + str(num % 30 * 2)) #時間(入力値を30で割った商)と分(入力値を30で割った余り)を出力する ```
output
1
36,811
4
73,623
Provide a correct Python 3 solution for this coding contest problem. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20
instruction
0
36,812
4
73,624
"Correct Solution: ``` # -*- coding: utf-8 -*- from sys import stdin n = int(stdin.readline().rstrip()) h = n * 2 // 60 m = n * 2 % 60 print("{} {}".format(h,m)) ```
output
1
36,812
4
73,625
Provide a correct Python 3 solution for this coding contest problem. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20
instruction
0
36,813
4
73,626
"Correct Solution: ``` s = int(input()) print(s // 30, 2 * (s % 30)) ```
output
1
36,813
4
73,627
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20 Submitted Solution: ``` t = int(input())*2 print(t//60, t%60) ```
instruction
0
36,814
4
73,628
Yes
output
1
36,814
4
73,629
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20 Submitted Solution: ``` deg_s = input() deg = int(deg_s) print('{} {}'.format(deg*120 // 3600, (deg*120 % 3600) // 60)) ```
instruction
0
36,815
4
73,630
Yes
output
1
36,815
4
73,631
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20 Submitted Solution: ``` theta = int(input()) print('{} {}'.format(theta // 30, (theta % 30) * 2)) ```
instruction
0
36,816
4
73,632
Yes
output
1
36,816
4
73,633
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem Gaccho has his favorite watch. One day the minute hand of the clock came off and I lost it somewhere. However, Gaccho wants to keep using the watch and wants to read the time with only the short hand. Output the time (hour h, minute m) for the information θ of the short hand. A clock is a so-called analog clock, in which numbers 1 to 12 are arranged clockwise at regular intervals in ascending order. Constraints * 0 ≤ θ ≤ 359 Input The input is given in the following format. θ An integer representing the angle θ of the short hand is given in one line in degrees. The direction pointed by the short hand is the direction rotated by θ degrees clockwise when the direction pointing to 12 o'clock is 0 degrees. Output The time when the hour hand takes a given angle h m Output in one line in the form of. Since there is no distinction between morning and afternoon in the time, 0 ≤ h ≤ 11 is set. Examples Input 0 Output 0 0 Input 45 Output 1 30 Input 100 Output 3 20 Submitted Solution: ``` print(*divmod(int(input())*2,60)) ```
instruction
0
36,817
4
73,634
Yes
output
1
36,817
4
73,635
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He knows that the receptionist starts working after ts minutes have passed after midnight and closes after tf minutes have passed after midnight (so that (tf - 1) is the last minute when the receptionist is still working). The receptionist spends exactly t minutes on each person in the queue. If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves). Vasya also knows that exactly n visitors would come tomorrow. For each visitor Vasya knows the point of time when he would come to the passport office. Each visitor queues up and doesn't leave until he was served. If the receptionist is free when a visitor comes (in particular, if the previous visitor was just served and the queue is empty), the receptionist begins to serve the newcomer immediately. <image> "Reception 1" For each visitor, the point of time when he would come to the passport office is positive. Vasya can come to the office at the time zero (that is, at midnight) if he needs so, but he can come to the office only at integer points of time. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and stand in the queue after the last of them. Vasya wants to come at such point of time that he will be served by the receptionist, and he would spend the minimum possible time in the queue. Help him! Input The first line contains three integers: the point of time when the receptionist begins to work ts, the point of time when the receptionist stops working tf and the time the receptionist spends on each visitor t. The second line contains one integer n — the amount of visitors (0 ≤ n ≤ 100 000). The third line contains positive integers in non-decreasing order — the points of time when the visitors arrive to the passport office. All times are set in minutes and do not exceed 1012; it is guaranteed that ts < tf. It is also guaranteed that Vasya can arrive at the passport office at such a point of time that he would be served by the receptionist. Output Print single non-negative integer — the point of time when Vasya should arrive at the passport office. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and queues up the last. If there are many answers, you can print any of them. Examples Input 10 15 2 2 10 13 Output 12 Input 8 17 3 4 3 4 5 8 Output 2 Note In the first example the first visitor comes exactly at the point of time when the receptionist begins to work, and he is served for two minutes. At 12 minutes after the midnight the receptionist stops serving the first visitor, and if Vasya arrives at this moment, he will be served immediately, because the next visitor would only come at 13 minutes after midnight. In the second example, Vasya has to come before anyone else to be served. Submitted Solution: ``` inp = input().split(' ') ts = int(inp[0]) tf = int(inp[1]) T = int(inp[2]) inp = input() n = int(inp) if n == 0: print(ts) else: inp = input().split(' ') min_del_t = 10000000000000; ans = int(inp[0])-1 t_cur = ts for tS in inp: t = int(tS) time_waiting = t_cur-t+1 if t_cur < t and t_cur+T<=tf: ans = t_cur break else: if min_del_t > time_waiting and t_cur+T <= tf: min_del_t = time_waiting ans = t-1 t_cur += T #print(min_del_t) if(t_cur+T<=tf): print(t_cur) else: print(ans) ```
instruction
0
37,351
4
74,702
Yes
output
1
37,351
4
74,703
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He knows that the receptionist starts working after ts minutes have passed after midnight and closes after tf minutes have passed after midnight (so that (tf - 1) is the last minute when the receptionist is still working). The receptionist spends exactly t minutes on each person in the queue. If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves). Vasya also knows that exactly n visitors would come tomorrow. For each visitor Vasya knows the point of time when he would come to the passport office. Each visitor queues up and doesn't leave until he was served. If the receptionist is free when a visitor comes (in particular, if the previous visitor was just served and the queue is empty), the receptionist begins to serve the newcomer immediately. <image> "Reception 1" For each visitor, the point of time when he would come to the passport office is positive. Vasya can come to the office at the time zero (that is, at midnight) if he needs so, but he can come to the office only at integer points of time. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and stand in the queue after the last of them. Vasya wants to come at such point of time that he will be served by the receptionist, and he would spend the minimum possible time in the queue. Help him! Input The first line contains three integers: the point of time when the receptionist begins to work ts, the point of time when the receptionist stops working tf and the time the receptionist spends on each visitor t. The second line contains one integer n — the amount of visitors (0 ≤ n ≤ 100 000). The third line contains positive integers in non-decreasing order — the points of time when the visitors arrive to the passport office. All times are set in minutes and do not exceed 1012; it is guaranteed that ts < tf. It is also guaranteed that Vasya can arrive at the passport office at such a point of time that he would be served by the receptionist. Output Print single non-negative integer — the point of time when Vasya should arrive at the passport office. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and queues up the last. If there are many answers, you can print any of them. Examples Input 10 15 2 2 10 13 Output 12 Input 8 17 3 4 3 4 5 8 Output 2 Note In the first example the first visitor comes exactly at the point of time when the receptionist begins to work, and he is served for two minutes. At 12 minutes after the midnight the receptionist stops serving the first visitor, and if Vasya arrives at this moment, he will be served immediately, because the next visitor would only come at 13 minutes after midnight. In the second example, Vasya has to come before anyone else to be served. Submitted Solution: ``` import sys def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): ts, tf, t = map(int, input().split()) n = int(input()) if n == 0: print(ts) return None AT = [int(i) for i in input().split()] BT = [0]*n for i, at in enumerate(AT): if i == 0: if at > ts: print(ts) return None else: BT[i] = ts else: if at > BT[i - 1] + t and BT[i - 1] + t <= tf: print(BT[i - 1] + t) return None else: BT[i] = BT[i - 1] + t if BT[n - 1] + 2*t <= tf: print(BT[n - 1] + t) return None min_wait = float('inf') ans = None for i in range(n): if i > 0 and AT[i] == AT[i - 1]: continue else: if BT[i] - (AT[i] - 1) < min_wait and BT[i] + t <= tf: min_wait = BT[i] - (AT[i] - 1) ans = AT[i] - 1 print(ans) if __name__ == '__main__': solve() ```
instruction
0
37,352
4
74,704
Yes
output
1
37,352
4
74,705
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He knows that the receptionist starts working after ts minutes have passed after midnight and closes after tf minutes have passed after midnight (so that (tf - 1) is the last minute when the receptionist is still working). The receptionist spends exactly t minutes on each person in the queue. If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves). Vasya also knows that exactly n visitors would come tomorrow. For each visitor Vasya knows the point of time when he would come to the passport office. Each visitor queues up and doesn't leave until he was served. If the receptionist is free when a visitor comes (in particular, if the previous visitor was just served and the queue is empty), the receptionist begins to serve the newcomer immediately. <image> "Reception 1" For each visitor, the point of time when he would come to the passport office is positive. Vasya can come to the office at the time zero (that is, at midnight) if he needs so, but he can come to the office only at integer points of time. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and stand in the queue after the last of them. Vasya wants to come at such point of time that he will be served by the receptionist, and he would spend the minimum possible time in the queue. Help him! Input The first line contains three integers: the point of time when the receptionist begins to work ts, the point of time when the receptionist stops working tf and the time the receptionist spends on each visitor t. The second line contains one integer n — the amount of visitors (0 ≤ n ≤ 100 000). The third line contains positive integers in non-decreasing order — the points of time when the visitors arrive to the passport office. All times are set in minutes and do not exceed 1012; it is guaranteed that ts < tf. It is also guaranteed that Vasya can arrive at the passport office at such a point of time that he would be served by the receptionist. Output Print single non-negative integer — the point of time when Vasya should arrive at the passport office. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and queues up the last. If there are many answers, you can print any of them. Examples Input 10 15 2 2 10 13 Output 12 Input 8 17 3 4 3 4 5 8 Output 2 Note In the first example the first visitor comes exactly at the point of time when the receptionist begins to work, and he is served for two minutes. At 12 minutes after the midnight the receptionist stops serving the first visitor, and if Vasya arrives at this moment, he will be served immediately, because the next visitor would only come at 13 minutes after midnight. In the second example, Vasya has to come before anyone else to be served. Submitted Solution: ``` begin, end, time = list(map(int, input().split())) n = int(input()) if n == 1: print(begin) elif n > 0: ar = list(map(int, input().split())) ar.sort() i = 0 ar.append(end - time + 1) n += 1 num = begin ans = begin - ar[0] + 1 fin_ans = ar[0] - 1 while i < n: num = max(num + time, ar[i] + time) while i + 1 < n and ar[i + 1] == ar[i]: i += 1 num += time i += 1 if i < n and num - ar[i] + 1 < ans and max(ar[i] - 1, num) + time <= end: ans = num - ar[i] + 1 fin_ans = ar[i] - 1 print(fin_ans) else: print(begin) ```
instruction
0
37,353
4
74,706
Yes
output
1
37,353
4
74,707
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He knows that the receptionist starts working after ts minutes have passed after midnight and closes after tf minutes have passed after midnight (so that (tf - 1) is the last minute when the receptionist is still working). The receptionist spends exactly t minutes on each person in the queue. If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves). Vasya also knows that exactly n visitors would come tomorrow. For each visitor Vasya knows the point of time when he would come to the passport office. Each visitor queues up and doesn't leave until he was served. If the receptionist is free when a visitor comes (in particular, if the previous visitor was just served and the queue is empty), the receptionist begins to serve the newcomer immediately. <image> "Reception 1" For each visitor, the point of time when he would come to the passport office is positive. Vasya can come to the office at the time zero (that is, at midnight) if he needs so, but he can come to the office only at integer points of time. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and stand in the queue after the last of them. Vasya wants to come at such point of time that he will be served by the receptionist, and he would spend the minimum possible time in the queue. Help him! Input The first line contains three integers: the point of time when the receptionist begins to work ts, the point of time when the receptionist stops working tf and the time the receptionist spends on each visitor t. The second line contains one integer n — the amount of visitors (0 ≤ n ≤ 100 000). The third line contains positive integers in non-decreasing order — the points of time when the visitors arrive to the passport office. All times are set in minutes and do not exceed 1012; it is guaranteed that ts < tf. It is also guaranteed that Vasya can arrive at the passport office at such a point of time that he would be served by the receptionist. Output Print single non-negative integer — the point of time when Vasya should arrive at the passport office. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and queues up the last. If there are many answers, you can print any of them. Examples Input 10 15 2 2 10 13 Output 12 Input 8 17 3 4 3 4 5 8 Output 2 Note In the first example the first visitor comes exactly at the point of time when the receptionist begins to work, and he is served for two minutes. At 12 minutes after the midnight the receptionist stops serving the first visitor, and if Vasya arrives at this moment, he will be served immediately, because the next visitor would only come at 13 minutes after midnight. In the second example, Vasya has to come before anyone else to be served. Submitted Solution: ``` import math import sys arrival, departure, time_per_client = [int(x) for x in input().split()] num_clients = int(input()) if num_clients > 0: clients_arrival = [int(x) for x in input().split()] else: print(arrival) sys.exit() best_time = None current_time = arrival clients_at_queue = 0 client_to_arrive = 0 client_wait_time = [math.inf for client in clients_arrival] client_to_leave = 0 while current_time <= departure - time_per_client: while client_to_arrive < num_clients and clients_arrival[client_to_arrive] <= current_time: clients_at_queue += 1 client_to_arrive += 1 if clients_at_queue == 0: best_time = current_time break else: clients_at_queue -= 1 client_wait_time[client_to_leave] = current_time - clients_arrival[client_to_leave] client_to_leave += 1 current_time += time_per_client while (best_time is None or best_time < 0) and len(client_wait_time) > 0: happiest_client = client_wait_time.index(min(client_wait_time)) best_time = clients_arrival[happiest_client] - 1 if best_time < 0: client_wait_time = client_wait_time[happiest_client+1:] clients_arrival = clients_arrival[happiest_client+1:] print(best_time) ```
instruction
0
37,354
4
74,708
Yes
output
1
37,354
4
74,709
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He knows that the receptionist starts working after ts minutes have passed after midnight and closes after tf minutes have passed after midnight (so that (tf - 1) is the last minute when the receptionist is still working). The receptionist spends exactly t minutes on each person in the queue. If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves). Vasya also knows that exactly n visitors would come tomorrow. For each visitor Vasya knows the point of time when he would come to the passport office. Each visitor queues up and doesn't leave until he was served. If the receptionist is free when a visitor comes (in particular, if the previous visitor was just served and the queue is empty), the receptionist begins to serve the newcomer immediately. <image> "Reception 1" For each visitor, the point of time when he would come to the passport office is positive. Vasya can come to the office at the time zero (that is, at midnight) if he needs so, but he can come to the office only at integer points of time. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and stand in the queue after the last of them. Vasya wants to come at such point of time that he will be served by the receptionist, and he would spend the minimum possible time in the queue. Help him! Input The first line contains three integers: the point of time when the receptionist begins to work ts, the point of time when the receptionist stops working tf and the time the receptionist spends on each visitor t. The second line contains one integer n — the amount of visitors (0 ≤ n ≤ 100 000). The third line contains positive integers in non-decreasing order — the points of time when the visitors arrive to the passport office. All times are set in minutes and do not exceed 1012; it is guaranteed that ts < tf. It is also guaranteed that Vasya can arrive at the passport office at such a point of time that he would be served by the receptionist. Output Print single non-negative integer — the point of time when Vasya should arrive at the passport office. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and queues up the last. If there are many answers, you can print any of them. Examples Input 10 15 2 2 10 13 Output 12 Input 8 17 3 4 3 4 5 8 Output 2 Note In the first example the first visitor comes exactly at the point of time when the receptionist begins to work, and he is served for two minutes. At 12 minutes after the midnight the receptionist stops serving the first visitor, and if Vasya arrives at this moment, he will be served immediately, because the next visitor would only come at 13 minutes after midnight. In the second example, Vasya has to come before anyone else to be served. Submitted Solution: ``` inp = input().split(' ') ts = int(inp[0]) tf = int(inp[1]) T = int(inp[2]) inp = input() n = int(inp) inp = inp = input().split(' ') t_cur = ts min_del_t = ts-int(inp[0])+1; ans = int(inp[0])-1 for tS in inp: t = int(tS) if t_cur < t and t_cur+T<=tf: ans = t_cur break else: if min_del_t > t_cur-t+1 and t_cur+(t_cur-t+1)+T <= tf: min_del_t = t_cur-t+1 ans = t-1 t_cur += T if(t_cur+T<=tf): print(t_cur) else: print(ans) ```
instruction
0
37,355
4
74,710
No
output
1
37,355
4
74,711
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He knows that the receptionist starts working after ts minutes have passed after midnight and closes after tf minutes have passed after midnight (so that (tf - 1) is the last minute when the receptionist is still working). The receptionist spends exactly t minutes on each person in the queue. If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves). Vasya also knows that exactly n visitors would come tomorrow. For each visitor Vasya knows the point of time when he would come to the passport office. Each visitor queues up and doesn't leave until he was served. If the receptionist is free when a visitor comes (in particular, if the previous visitor was just served and the queue is empty), the receptionist begins to serve the newcomer immediately. <image> "Reception 1" For each visitor, the point of time when he would come to the passport office is positive. Vasya can come to the office at the time zero (that is, at midnight) if he needs so, but he can come to the office only at integer points of time. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and stand in the queue after the last of them. Vasya wants to come at such point of time that he will be served by the receptionist, and he would spend the minimum possible time in the queue. Help him! Input The first line contains three integers: the point of time when the receptionist begins to work ts, the point of time when the receptionist stops working tf and the time the receptionist spends on each visitor t. The second line contains one integer n — the amount of visitors (0 ≤ n ≤ 100 000). The third line contains positive integers in non-decreasing order — the points of time when the visitors arrive to the passport office. All times are set in minutes and do not exceed 1012; it is guaranteed that ts < tf. It is also guaranteed that Vasya can arrive at the passport office at such a point of time that he would be served by the receptionist. Output Print single non-negative integer — the point of time when Vasya should arrive at the passport office. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and queues up the last. If there are many answers, you can print any of them. Examples Input 10 15 2 2 10 13 Output 12 Input 8 17 3 4 3 4 5 8 Output 2 Note In the first example the first visitor comes exactly at the point of time when the receptionist begins to work, and he is served for two minutes. At 12 minutes after the midnight the receptionist stops serving the first visitor, and if Vasya arrives at this moment, he will be served immediately, because the next visitor would only come at 13 minutes after midnight. In the second example, Vasya has to come before anyone else to be served. Submitted Solution: ``` inp = input().split(' ') ts = int(inp[0]) tf = int(inp[1]) T = int(inp[2]) inp = input() n = int(inp) inp = inp = input().split(' ') t_cur = ts min_del_t = 100000000; ans = 0 for tS in inp: t = int(tS) if t_cur < t and t_cur+T<tf: ans = t-1 break else: if min_del_t > t_cur-t and t_cur+(t_cur-t)+T < tf: min_del_t = t_cur-t+1 ans = t-1 t_cur += T if(t_cur+T<tf): print(t_cur) else: print(ans) ```
instruction
0
37,356
4
74,712
No
output
1
37,356
4
74,713
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He knows that the receptionist starts working after ts minutes have passed after midnight and closes after tf minutes have passed after midnight (so that (tf - 1) is the last minute when the receptionist is still working). The receptionist spends exactly t minutes on each person in the queue. If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves). Vasya also knows that exactly n visitors would come tomorrow. For each visitor Vasya knows the point of time when he would come to the passport office. Each visitor queues up and doesn't leave until he was served. If the receptionist is free when a visitor comes (in particular, if the previous visitor was just served and the queue is empty), the receptionist begins to serve the newcomer immediately. <image> "Reception 1" For each visitor, the point of time when he would come to the passport office is positive. Vasya can come to the office at the time zero (that is, at midnight) if he needs so, but he can come to the office only at integer points of time. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and stand in the queue after the last of them. Vasya wants to come at such point of time that he will be served by the receptionist, and he would spend the minimum possible time in the queue. Help him! Input The first line contains three integers: the point of time when the receptionist begins to work ts, the point of time when the receptionist stops working tf and the time the receptionist spends on each visitor t. The second line contains one integer n — the amount of visitors (0 ≤ n ≤ 100 000). The third line contains positive integers in non-decreasing order — the points of time when the visitors arrive to the passport office. All times are set in minutes and do not exceed 1012; it is guaranteed that ts < tf. It is also guaranteed that Vasya can arrive at the passport office at such a point of time that he would be served by the receptionist. Output Print single non-negative integer — the point of time when Vasya should arrive at the passport office. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and queues up the last. If there are many answers, you can print any of them. Examples Input 10 15 2 2 10 13 Output 12 Input 8 17 3 4 3 4 5 8 Output 2 Note In the first example the first visitor comes exactly at the point of time when the receptionist begins to work, and he is served for two minutes. At 12 minutes after the midnight the receptionist stops serving the first visitor, and if Vasya arrives at this moment, he will be served immediately, because the next visitor would only come at 13 minutes after midnight. In the second example, Vasya has to come before anyone else to be served. Submitted Solution: ``` #!/usr/bin/env python3 # -*- coding: utf-8 -*- from collections import * def solve(ts, tf, need_t, n, times): times = Counter(times) if n == 0: return ts else: prev_time = -1 shortest_wait_time = ts - (times[0] - 1) ans_time = times[0] - 1 available_time = ts for i, (t, people_num) in enumerate(times.items()): wait_time = max(0, available_time - (t - 1)) # print("at time {}: avail_t = {}, wait_t = {}".format(t-1, available_time, wait_time)) if wait_time < shortest_wait_time: shortest_wait_time = wait_time ans_time = t - 1 available_time = max(t, available_time) + need_t * people_num # print("at time {}: avail_t = {} ".format(t, available_time)) # the last one if available_time <= tf - 1: ans_time = available_time return ans_time def main(): ts, tf, need_t = map(int, input().split()) n = int(input()) if n > 0: times = list(map(int, input().split())) else: times = [] ret = solve(ts, tf, need_t, n, times) print(ret) if __name__ == '__main__': # print(solve(10, 100, 2, 0, [])) # 10 # print(solve(10, 100, 10, 2, [10, 20])) # 30 main() ```
instruction
0
37,357
4
74,714
No
output
1
37,357
4
74,715
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He knows that the receptionist starts working after ts minutes have passed after midnight and closes after tf minutes have passed after midnight (so that (tf - 1) is the last minute when the receptionist is still working). The receptionist spends exactly t minutes on each person in the queue. If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves). Vasya also knows that exactly n visitors would come tomorrow. For each visitor Vasya knows the point of time when he would come to the passport office. Each visitor queues up and doesn't leave until he was served. If the receptionist is free when a visitor comes (in particular, if the previous visitor was just served and the queue is empty), the receptionist begins to serve the newcomer immediately. <image> "Reception 1" For each visitor, the point of time when he would come to the passport office is positive. Vasya can come to the office at the time zero (that is, at midnight) if he needs so, but he can come to the office only at integer points of time. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and stand in the queue after the last of them. Vasya wants to come at such point of time that he will be served by the receptionist, and he would spend the minimum possible time in the queue. Help him! Input The first line contains three integers: the point of time when the receptionist begins to work ts, the point of time when the receptionist stops working tf and the time the receptionist spends on each visitor t. The second line contains one integer n — the amount of visitors (0 ≤ n ≤ 100 000). The third line contains positive integers in non-decreasing order — the points of time when the visitors arrive to the passport office. All times are set in minutes and do not exceed 1012; it is guaranteed that ts < tf. It is also guaranteed that Vasya can arrive at the passport office at such a point of time that he would be served by the receptionist. Output Print single non-negative integer — the point of time when Vasya should arrive at the passport office. If Vasya arrives at the passport office at the same time with several other visitors, he yields to them and queues up the last. If there are many answers, you can print any of them. Examples Input 10 15 2 2 10 13 Output 12 Input 8 17 3 4 3 4 5 8 Output 2 Note In the first example the first visitor comes exactly at the point of time when the receptionist begins to work, and he is served for two minutes. At 12 minutes after the midnight the receptionist stops serving the first visitor, and if Vasya arrives at this moment, he will be served immediately, because the next visitor would only come at 13 minutes after midnight. In the second example, Vasya has to come before anyone else to be served. Submitted Solution: ``` ts, tf, t = map(int, input().split()) n = int(input()) INF = int(10**18) a = list(map(int, input().split())) i = 0 ans = -1 best = INF end = ts dif = 0 def checkans(curans, time): global ans, best if curans < best and time + curans + t <= tf: ans = time best = curans while i < n: dif = t pri = i - 1 while i + 1 < n and a[i] == a[i + 1]: dif += t i += 1 # check a[i] - 1 if pri < 0 or a[pri] != a[i] - 1: checkans(end - (a[i] - 1), a[i] - 1) end += dif curans = end - a[i] checkans(end - a[i], a[i]) i += 1 print(ans) ```
instruction
0
37,358
4
74,716
No
output
1
37,358
4
74,717
Provide a correct Python 3 solution for this coding contest problem. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15
instruction
0
38,500
4
77,000
"Correct Solution: ``` l=int(input()) a=int(input()) b=int(input()) c=int(input()) d=int(input()) if a%c==0 or b%d==0: if a/c>=b/d: print(l-(a//c)) else: print(l-(b//d)) else: x=(a//c)+1 y=(b//d)+1 if x>=y: print(l-x) else: print(l-y) ```
output
1
38,500
4
77,001
Provide a correct Python 3 solution for this coding contest problem. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15
instruction
0
38,501
4
77,002
"Correct Solution: ``` l = int(input()) a = int(input()) b = int(input()) c = int(input()) d = int(input()) if a % c == 0: kokugo = a // c else: kokugo = a // c + 1 if b % d == 0: sansu = b // d else: sansu = b // d + 1 print(l - max(kokugo, sansu)) ```
output
1
38,501
4
77,003
Provide a correct Python 3 solution for this coding contest problem. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15
instruction
0
38,502
4
77,004
"Correct Solution: ``` import math l=int(input()) a=int(input()) b=int(input()) c=int(input()) d=int(input()) print(l-max(math.ceil(a/c),math.ceil(b/d))) ```
output
1
38,502
4
77,005
Provide a correct Python 3 solution for this coding contest problem. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15
instruction
0
38,503
4
77,006
"Correct Solution: ``` import math def main(): L = int(input()) A = int(input()) B = int(input()) C = int(input()) D = int(input()) hoge = math.ceil(A / C) fuga = math.ceil(B / D) if hoge >= fuga: print(L - hoge) else: print(L - fuga) if __name__ == "__main__": main() ```
output
1
38,503
4
77,007
Provide a correct Python 3 solution for this coding contest problem. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15
instruction
0
38,504
4
77,008
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0576 """ import sys from sys import stdin from math import ceil input = stdin.readline def main(args): L = int(input()) A = int(input()) B = int(input()) C = int(input()) D = int(input()) days_to_finish_A = ceil(A / C) days_to_finish_B = ceil(B / D) print(L - max(days_to_finish_A, days_to_finish_B)) if __name__ == '__main__': main(sys.argv[1:]) ```
output
1
38,504
4
77,009
Provide a correct Python 3 solution for this coding contest problem. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15
instruction
0
38,505
4
77,010
"Correct Solution: ``` # coding: utf-8 # Your code here! L=int(input()) A=int(input()) B=int(input()) C=int(input()) D=int(input()) if A%C==0 and B%D==0: X=A//C Y=B//D X,Y=sorted([X,Y]) print(L-Y) elif A%C==0 and B%D!=0: X=A//C Y=(B//D)+1 X,Y=sorted([X,Y]) print(L-Y) elif A%C!=0 and B%D==0: X=(A//C)+1 Y=B//D else: X=(A//C)+1 Y=(B//D)+1 X,Y=sorted([X,Y]) print(int(L-Y)) ```
output
1
38,505
4
77,011
Provide a correct Python 3 solution for this coding contest problem. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15
instruction
0
38,506
4
77,012
"Correct Solution: ``` L = int(input()) A = int(input()) B = int(input()) C = int(input()) D = int(input()) day_k = 0 day_s = 0 if A % C == 0: day_k = A // C else: day_k = A // C + 1 if B % D == 0: day_s = B // D else: day_s = B // D + 1 print(L - max(day_k, day_s)) ```
output
1
38,506
4
77,013
Provide a correct Python 3 solution for this coding contest problem. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15
instruction
0
38,507
4
77,014
"Correct Solution: ``` L,A,B,C,D = [int(input()) for _ in range(5)] print(L - max((A - 1) // C,(B - 1) // D) - 1) ```
output
1
38,507
4
77,015
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15 Submitted Solution: ``` # -*- coding: utf-8 -*- L = int(input()) A = int(input()) B = int(input()) C = int(input()) D = int(input()) if A % C == 0: X = A // C if A % C != 0: X = A // C + 1 if B % D == 0: Y = B // D if B % D != 0: Y = B // D + 1 ans = L - max(X,Y) print(ans) ```
instruction
0
38,508
4
77,016
Yes
output
1
38,508
4
77,017
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15 Submitted Solution: ``` import math re_day = int(input()) ko_hom = int(input()) ma_hom = int(input()) ko_sp = int(input()) ma_sp = int(input()) print(re_day - math.ceil(max(ko_hom/ko_sp,ma_hom/ma_sp))) ```
instruction
0
38,509
4
77,018
Yes
output
1
38,509
4
77,019
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15 Submitted Solution: ``` L, A, B, C, D = [int(input()) for _ in range(5)] print(L - max(-(-A // C), -(-B // D))) ```
instruction
0
38,510
4
77,020
Yes
output
1
38,510
4
77,021
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15 Submitted Solution: ``` a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) if b%d == 0: x = b // d else: x = b // d +1 if c%e == 0: y = c // e else: y = c // e +1 if x >= y: print(a-x) else: print(a-y) ```
instruction
0
38,511
4
77,022
Yes
output
1
38,511
4
77,023
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15 Submitted Solution: ``` while True: l=int(input()) a=int(input()) b=int(input()) c=int(input()) d=int(input()) if a%c==0 and b%d==0: if a/c>=b/d: print(l-(a//c)) else: print(l-(b//d)) else: x=(a//c)+1 y=(b//d)+1 if x>=y: print(l-x) else: print(l-y) ```
instruction
0
38,512
4
77,024
No
output
1
38,512
4
77,025
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem JOI, who has been suffering from his winter vacation homework every time, decided to do his homework systematically this time. Homework is a national language and math drill, with a national language drill on page A and a math drill on page B. JOI can advance the Japanese drill up to C pages and the math drill up to D pages a day, but if he does his homework, he can't play that day. There are L days during the winter vacation, and JOI must finish his homework during the winter vacation. Create a program that asks how many days JOI can play during the winter vacation. input The input consists of 5 lines, with one positive integer written on each line. The integer L (2 ≤ L ≤ 40) is written on the first line, which indicates the number of days of winter vacation. The integer A (1 ≤ A ≤ 1000) is written on the second line, which indicates the number of pages of the Japanese drill. The integer B (1 ≤ B ≤ 1000) is written on the third line, which indicates the number of pages of the math drill. The integer C (1 ≤ C ≤ 100) is written on the 4th line, which indicates the maximum number of pages of a national language drill that JOI can advance in a day. The integer D (1 ≤ D ≤ 100) is written on the 5th line, which indicates the maximum number of pages of the math drill that JOI can advance in a day. However, given the input data, JOI is guaranteed to be able to finish his homework during the winter vacation and play for at least a day. Example Input 20 25 30 6 8 Output 15 Submitted Solution: ``` l=int(input()) a=int(input()) b=int(input()) c=int(input()) d=int(input()) if a%c==0 and b%d==0: if a/c>=b/d: print(l-(a//c)) else: print(l-(b//d)) else: x=(a//c)+1 y=(b//d)+1 if x>=y: print(l-x) else: print(l-y) ```
instruction
0
38,513
4
77,026
No
output
1
38,513
4
77,027
Provide a correct Python 3 solution for this coding contest problem. As many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan. The other calendar system is era-based calendar, or so-called “Japanese calendar.” This system comes from ancient Chinese systems. Recently in Japan it has been a common way to associate dates with the Emperors. In the era-based system, we represent a year with an era name given at the time a new Emperor assumes the throne. If the era name is “A”, the first regnal year will be “A 1”, the second year will be “A 2”, and so forth. Since we have two different calendar systems, it is often needed to convert the date in one calendar system to the other. In this problem, you are asked to write a program that converts western year to era-based year, given a database that contains association between several western years and era-based years. For the simplicity, you can assume the following: 1. A new era always begins on January 1st of the corresponding Gregorian year. 2. The first year of an era is described as 1. 3. There is no year in which more than one era switch takes place. Please note that, however, the database you will see may be incomplete. In other words, some era that existed in the history may be missing from your data. So you will also have to detect the cases where you cannot determine exactly which era the given year belongs to. Input The input contains multiple test cases. Each test case has the following format: N Q EraName1 EraBasedYear1 WesternYear1 . . . EraNameN EraBasedYearN WesternYearN Query1 . . . QueryQ The first line of the input contains two positive integers N and Q (1 ≤ N ≤ 1000, 1 ≤ Q ≤ 1000). N is the number of database entries, and Q is the number of queries. Each of the following N lines has three components: era name, era-based year number and the corresponding western year (1 ≤ EraBasedYeari ≤ WesternYeari ≤ 109 ). Each of era names consist of at most 16 Roman alphabet characters. Then the last Q lines of the input specifies queries (1 ≤ Queryi ≤ 109 ), each of which is a western year to compute era-based representation. The end of input is indicated by a line containing two zeros. This line is not part of any dataset and hence should not be processed. You can assume that all the western year in the input is positive integers, and that there is no two entries that share the same era name. Output For each query, output in a line the era name and the era-based year number corresponding to the western year given, separated with a single whitespace. In case you cannot determine the era, output “Unknown” without quotes. Example Input 4 3 meiji 10 1877 taisho 6 1917 showa 62 1987 heisei 22 2010 1868 1917 1988 1 1 universalcentury 123 2168 2010 0 0 Output meiji 1 taisho 6 Unknown Unknown
instruction
0
38,540
4
77,080
"Correct Solution: ``` from bisect import bisect_left while True: N, Q = map(int, input().split(' ')) if N == 0: break era = {} # Like {1877: ('Meiji', 10)} years = [] # 西暦 for _ in range(N): name, j, w = input().split(' ') j, w = int(j), int(w) era[w] = (name, j) years.append(w) years.sort() for _ in range(Q): q = int(input()) i = bisect_left(years, q) if i >= len(years): print('Unknown') continue y = years[i] name, length = era[y] if q - y + length <= 0: print('Unknown') else: print(name + ' ' + str(q-y+length)) ```
output
1
38,540
4
77,081
Provide a correct Python 3 solution for this coding contest problem. As many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan. The other calendar system is era-based calendar, or so-called “Japanese calendar.” This system comes from ancient Chinese systems. Recently in Japan it has been a common way to associate dates with the Emperors. In the era-based system, we represent a year with an era name given at the time a new Emperor assumes the throne. If the era name is “A”, the first regnal year will be “A 1”, the second year will be “A 2”, and so forth. Since we have two different calendar systems, it is often needed to convert the date in one calendar system to the other. In this problem, you are asked to write a program that converts western year to era-based year, given a database that contains association between several western years and era-based years. For the simplicity, you can assume the following: 1. A new era always begins on January 1st of the corresponding Gregorian year. 2. The first year of an era is described as 1. 3. There is no year in which more than one era switch takes place. Please note that, however, the database you will see may be incomplete. In other words, some era that existed in the history may be missing from your data. So you will also have to detect the cases where you cannot determine exactly which era the given year belongs to. Input The input contains multiple test cases. Each test case has the following format: N Q EraName1 EraBasedYear1 WesternYear1 . . . EraNameN EraBasedYearN WesternYearN Query1 . . . QueryQ The first line of the input contains two positive integers N and Q (1 ≤ N ≤ 1000, 1 ≤ Q ≤ 1000). N is the number of database entries, and Q is the number of queries. Each of the following N lines has three components: era name, era-based year number and the corresponding western year (1 ≤ EraBasedYeari ≤ WesternYeari ≤ 109 ). Each of era names consist of at most 16 Roman alphabet characters. Then the last Q lines of the input specifies queries (1 ≤ Queryi ≤ 109 ), each of which is a western year to compute era-based representation. The end of input is indicated by a line containing two zeros. This line is not part of any dataset and hence should not be processed. You can assume that all the western year in the input is positive integers, and that there is no two entries that share the same era name. Output For each query, output in a line the era name and the era-based year number corresponding to the western year given, separated with a single whitespace. In case you cannot determine the era, output “Unknown” without quotes. Example Input 4 3 meiji 10 1877 taisho 6 1917 showa 62 1987 heisei 22 2010 1868 1917 1988 1 1 universalcentury 123 2168 2010 0 0 Output meiji 1 taisho 6 Unknown Unknown
instruction
0
38,541
4
77,082
"Correct Solution: ``` while 1: n,m=map(int,input().split()) if n==0:break e=['']*n;b=['']*n;w=['']*n for i in range(n):e[i],b[i],w[i]=input().split() b=list(map(int,b));w=list(map(int,w)) for _ in range(m): q=int(input()) for i in range(n): if w[i]-b[i]<q<=w[i]:print(e[i],b[i]-w[i]+q);break else:print('Unknown') ```
output
1
38,541
4
77,083
Provide a correct Python 3 solution for this coding contest problem. As many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan. The other calendar system is era-based calendar, or so-called “Japanese calendar.” This system comes from ancient Chinese systems. Recently in Japan it has been a common way to associate dates with the Emperors. In the era-based system, we represent a year with an era name given at the time a new Emperor assumes the throne. If the era name is “A”, the first regnal year will be “A 1”, the second year will be “A 2”, and so forth. Since we have two different calendar systems, it is often needed to convert the date in one calendar system to the other. In this problem, you are asked to write a program that converts western year to era-based year, given a database that contains association between several western years and era-based years. For the simplicity, you can assume the following: 1. A new era always begins on January 1st of the corresponding Gregorian year. 2. The first year of an era is described as 1. 3. There is no year in which more than one era switch takes place. Please note that, however, the database you will see may be incomplete. In other words, some era that existed in the history may be missing from your data. So you will also have to detect the cases where you cannot determine exactly which era the given year belongs to. Input The input contains multiple test cases. Each test case has the following format: N Q EraName1 EraBasedYear1 WesternYear1 . . . EraNameN EraBasedYearN WesternYearN Query1 . . . QueryQ The first line of the input contains two positive integers N and Q (1 ≤ N ≤ 1000, 1 ≤ Q ≤ 1000). N is the number of database entries, and Q is the number of queries. Each of the following N lines has three components: era name, era-based year number and the corresponding western year (1 ≤ EraBasedYeari ≤ WesternYeari ≤ 109 ). Each of era names consist of at most 16 Roman alphabet characters. Then the last Q lines of the input specifies queries (1 ≤ Queryi ≤ 109 ), each of which is a western year to compute era-based representation. The end of input is indicated by a line containing two zeros. This line is not part of any dataset and hence should not be processed. You can assume that all the western year in the input is positive integers, and that there is no two entries that share the same era name. Output For each query, output in a line the era name and the era-based year number corresponding to the western year given, separated with a single whitespace. In case you cannot determine the era, output “Unknown” without quotes. Example Input 4 3 meiji 10 1877 taisho 6 1917 showa 62 1987 heisei 22 2010 1868 1917 1988 1 1 universalcentury 123 2168 2010 0 0 Output meiji 1 taisho 6 Unknown Unknown
instruction
0
38,542
4
77,084
"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 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 = [] dd = [(1,1),(1,0),(0,1),(0,-1),(-1,0),(-1,-1)] while True: n,q = LI() if n == 0 and q == 0: break a = [LS() for _ in range(n)] a = [[_[0],int(_[1]),int(_[2])] for _ in a] b = [I() for _ in range(q)] for c in b: r = 'Unknown' for l,e,w in a: if w-e < c <= w: r = '{} {}'.format(l, e-w+c) rr.append(r) return '\n'.join(map(str, rr)) print(main()) ```
output
1
38,542
4
77,085
Provide a correct Python 3 solution for this coding contest problem. As many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan. The other calendar system is era-based calendar, or so-called “Japanese calendar.” This system comes from ancient Chinese systems. Recently in Japan it has been a common way to associate dates with the Emperors. In the era-based system, we represent a year with an era name given at the time a new Emperor assumes the throne. If the era name is “A”, the first regnal year will be “A 1”, the second year will be “A 2”, and so forth. Since we have two different calendar systems, it is often needed to convert the date in one calendar system to the other. In this problem, you are asked to write a program that converts western year to era-based year, given a database that contains association between several western years and era-based years. For the simplicity, you can assume the following: 1. A new era always begins on January 1st of the corresponding Gregorian year. 2. The first year of an era is described as 1. 3. There is no year in which more than one era switch takes place. Please note that, however, the database you will see may be incomplete. In other words, some era that existed in the history may be missing from your data. So you will also have to detect the cases where you cannot determine exactly which era the given year belongs to. Input The input contains multiple test cases. Each test case has the following format: N Q EraName1 EraBasedYear1 WesternYear1 . . . EraNameN EraBasedYearN WesternYearN Query1 . . . QueryQ The first line of the input contains two positive integers N and Q (1 ≤ N ≤ 1000, 1 ≤ Q ≤ 1000). N is the number of database entries, and Q is the number of queries. Each of the following N lines has three components: era name, era-based year number and the corresponding western year (1 ≤ EraBasedYeari ≤ WesternYeari ≤ 109 ). Each of era names consist of at most 16 Roman alphabet characters. Then the last Q lines of the input specifies queries (1 ≤ Queryi ≤ 109 ), each of which is a western year to compute era-based representation. The end of input is indicated by a line containing two zeros. This line is not part of any dataset and hence should not be processed. You can assume that all the western year in the input is positive integers, and that there is no two entries that share the same era name. Output For each query, output in a line the era name and the era-based year number corresponding to the western year given, separated with a single whitespace. In case you cannot determine the era, output “Unknown” without quotes. Example Input 4 3 meiji 10 1877 taisho 6 1917 showa 62 1987 heisei 22 2010 1868 1917 1988 1 1 universalcentury 123 2168 2010 0 0 Output meiji 1 taisho 6 Unknown Unknown
instruction
0
38,543
4
77,086
"Correct Solution: ``` import bisect while True: N,Q = map(int,input().split()) if N == 0: break src = [] for i in range(N): n,l,y = input().split() src.append((int(y), int(l), n)) src.sort() for i in range(Q): q = int(input()) a = bisect.bisect(src,(q,-1,-1)) if a < N: y,l,n = src[a] if y-l < q <= y: print(n + ' ' + str(q-y+l)) continue if a+1 < N: y,l,n = src[a+1] if y-l < q <= y: print(n + ' ' + str(q-y+l)) continue print('Unknown') ```
output
1
38,543
4
77,087
Provide a correct Python 3 solution for this coding contest problem. As many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan. The other calendar system is era-based calendar, or so-called “Japanese calendar.” This system comes from ancient Chinese systems. Recently in Japan it has been a common way to associate dates with the Emperors. In the era-based system, we represent a year with an era name given at the time a new Emperor assumes the throne. If the era name is “A”, the first regnal year will be “A 1”, the second year will be “A 2”, and so forth. Since we have two different calendar systems, it is often needed to convert the date in one calendar system to the other. In this problem, you are asked to write a program that converts western year to era-based year, given a database that contains association between several western years and era-based years. For the simplicity, you can assume the following: 1. A new era always begins on January 1st of the corresponding Gregorian year. 2. The first year of an era is described as 1. 3. There is no year in which more than one era switch takes place. Please note that, however, the database you will see may be incomplete. In other words, some era that existed in the history may be missing from your data. So you will also have to detect the cases where you cannot determine exactly which era the given year belongs to. Input The input contains multiple test cases. Each test case has the following format: N Q EraName1 EraBasedYear1 WesternYear1 . . . EraNameN EraBasedYearN WesternYearN Query1 . . . QueryQ The first line of the input contains two positive integers N and Q (1 ≤ N ≤ 1000, 1 ≤ Q ≤ 1000). N is the number of database entries, and Q is the number of queries. Each of the following N lines has three components: era name, era-based year number and the corresponding western year (1 ≤ EraBasedYeari ≤ WesternYeari ≤ 109 ). Each of era names consist of at most 16 Roman alphabet characters. Then the last Q lines of the input specifies queries (1 ≤ Queryi ≤ 109 ), each of which is a western year to compute era-based representation. The end of input is indicated by a line containing two zeros. This line is not part of any dataset and hence should not be processed. You can assume that all the western year in the input is positive integers, and that there is no two entries that share the same era name. Output For each query, output in a line the era name and the era-based year number corresponding to the western year given, separated with a single whitespace. In case you cannot determine the era, output “Unknown” without quotes. Example Input 4 3 meiji 10 1877 taisho 6 1917 showa 62 1987 heisei 22 2010 1868 1917 1988 1 1 universalcentury 123 2168 2010 0 0 Output meiji 1 taisho 6 Unknown Unknown
instruction
0
38,544
4
77,088
"Correct Solution: ``` while True: inp,oup=map(int,input().split()) if not inp: break dic={} for i in range(inp): era,num,wes=input().split() dic[era] =[int(wes)-int(num)+1, int(wes)] for j in range(oup): p=int(input()) for i in dic: if dic[i][0]<=p<=dic[i][1]: print(i+' '+str(p-dic[i][0]+1)) break else: print('Unknown') ```
output
1
38,544
4
77,089
Provide a correct Python 3 solution for this coding contest problem. As many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan. The other calendar system is era-based calendar, or so-called “Japanese calendar.” This system comes from ancient Chinese systems. Recently in Japan it has been a common way to associate dates with the Emperors. In the era-based system, we represent a year with an era name given at the time a new Emperor assumes the throne. If the era name is “A”, the first regnal year will be “A 1”, the second year will be “A 2”, and so forth. Since we have two different calendar systems, it is often needed to convert the date in one calendar system to the other. In this problem, you are asked to write a program that converts western year to era-based year, given a database that contains association between several western years and era-based years. For the simplicity, you can assume the following: 1. A new era always begins on January 1st of the corresponding Gregorian year. 2. The first year of an era is described as 1. 3. There is no year in which more than one era switch takes place. Please note that, however, the database you will see may be incomplete. In other words, some era that existed in the history may be missing from your data. So you will also have to detect the cases where you cannot determine exactly which era the given year belongs to. Input The input contains multiple test cases. Each test case has the following format: N Q EraName1 EraBasedYear1 WesternYear1 . . . EraNameN EraBasedYearN WesternYearN Query1 . . . QueryQ The first line of the input contains two positive integers N and Q (1 ≤ N ≤ 1000, 1 ≤ Q ≤ 1000). N is the number of database entries, and Q is the number of queries. Each of the following N lines has three components: era name, era-based year number and the corresponding western year (1 ≤ EraBasedYeari ≤ WesternYeari ≤ 109 ). Each of era names consist of at most 16 Roman alphabet characters. Then the last Q lines of the input specifies queries (1 ≤ Queryi ≤ 109 ), each of which is a western year to compute era-based representation. The end of input is indicated by a line containing two zeros. This line is not part of any dataset and hence should not be processed. You can assume that all the western year in the input is positive integers, and that there is no two entries that share the same era name. Output For each query, output in a line the era name and the era-based year number corresponding to the western year given, separated with a single whitespace. In case you cannot determine the era, output “Unknown” without quotes. Example Input 4 3 meiji 10 1877 taisho 6 1917 showa 62 1987 heisei 22 2010 1868 1917 1988 1 1 universalcentury 123 2168 2010 0 0 Output meiji 1 taisho 6 Unknown Unknown
instruction
0
38,545
4
77,090
"Correct Solution: ``` while True: n,m= map(int,input().split()) if n==0 and m==0: break hajime= {} owari= {} for _ in range(n): a,b,c= input().split() hajime[a]= int(c)- int(b) owari[a]= int(c) for _ in range(m): year= int(input()) for a in hajime: flag= True if hajime[a]< year and year<= owari[a]: flag= False print(a,year- hajime[a]) break if flag: print("Unknown") ```
output
1
38,545
4
77,091