output_description
stringlengths
15
956
submission_id
stringlengths
10
10
status
stringclasses
3 values
problem_id
stringlengths
6
6
input_description
stringlengths
9
2.55k
attempt
stringlengths
1
13.7k
problem_description
stringlengths
7
5.24k
samples
stringlengths
2
2.72k
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s686952787
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = int(input()).split() seki = a * b sekito = seki % 2 if sekito = 1: response = 'Odd' else: response = 'Even' return response
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s149784532
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=map(int,input().split()) if a%2==2:print("Even") elif b%2==2:print("Even") else:print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s115029907
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split()) if a*b % 2 == 0 : print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s939420891
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=map(int,input().split()) if a//2==0 or b//2==0: print('Even') else: print('Odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s538096436
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = int(input().split()) c = (a * b) % 2 if c == 0: print('Even') else: print('Odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s186737250
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
# coding: utf-8 a, b = map(int, input().split()) if a*b % 2 == 0: print("Even") eles: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s396472137
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split()) c = a*b if c % 2 == 0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s079188628
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a=input() c=int(a) b=input() d=int(b) if a*b%2=0: print('Even') else: print('Odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s186449263
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split()) if (a % 2 == 0 || b % 2 == 0): print('Even') else: print('Odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s609552650
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a = [int(i) for i in input().split()] if a[0]*a[1]/2==0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s067621748
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().rstrip().split()) if a * b % 2 == 0: print("Even") eles: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s591816654
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b = map(int, input() .split()) if (a*b) % 2 == 1: print("Odd") else: print("Even")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s406364791
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
str = input() list = str.split() a, b = list c = a*b if c%2 == 0: print(Even) else print(Odd)
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s201644608
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split()) if (a * b) % 2 == 0: print('Even') else: print('Odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s855469832
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split(' ') if a % 2 == 0 or b % 2 == 0: print('Even') else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s943628929
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a = [int(i) for i in input().split()] if a[0]*a[1]/2==0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s701759956
Accepted
p03455
Input is given from Standard Input in the following format: a b
temp = input().split() print("Even" if int(temp[0]) * int(temp[1]) % 2 == 0 else "Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s580853798
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a ,b = map(int ,input().split()) if a*b % 2 =0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s379421158
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b = map(int, input().split()) if (a * b) % == 0: print("Evern") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s202625927
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int,input().split()) if a%2==0 or b%2==0: print("even") else: print("odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s393368324
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = input().split(' ') if a * b % 2 = 0: print('Even') else: print('Odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s724957133
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=list(map(int,input().split()) x=(a*b)%2 if x==0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s511816678
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=map(int,input().split() if a*B%2 == 0: print("Odd") else: print("Even")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s587720381
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
x,y = map(int,input.split()) if x*y%2==0 print("Even") else print("Odd") end
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s903775881
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split()) if a*b % 2 = 0: print('Even') else: print('Odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s029180941
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b = input().split() if int(a)*int(b) % 2 == 0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s397033473
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a , b = map(int, input().split()) if a * b % 2 == 0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s817403997
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=map(int,input().split()) c = a*b if c%2 == 0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s425024356
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split()) if (a*b) % 2==0 print("Odd") else: print("Even")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s601872440
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a = int(input()) b = int(input()) if a * b % 2 = 0: print('even') else: print('odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s194936021
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split()) if a*b%2 == 0{ print("Even") }else{ print("Odd") }
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s820468136
Accepted
p03455
Input is given from Standard Input in the following format: a b
b, c = input().split(" ") print("Odd" if int(b) * int(c) % 2 == 1 else "Even")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s211111097
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
s=input() if (int(s[0])*int(s[-1]))%2 == 1: print("Odd") else: print("Even")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s157138890
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
print("EOvdedn"[int(input()) * int(input()) % 2 :: 2])
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s395835650
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
1<=a,b<=10000 if (a*b)/2 ==0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s603016566
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=map(int,input().split()) if a*b % 2 =0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s761914104
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
if a * b %= 0: print('Even') else: print('Odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s717246747
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b,c=map(int, input().split()) if (a*b)%2==0: print('Even') esle: print('0dd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s912417820
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b = map(int, input(), split()) if a%2 == 1: print("Odd") else print ("Even")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s640552476
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
jud = a * b jud2 = jud / 2 if jud2 == 1: Odd else: Even
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s439262578
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=input().split() if int(a)*int(b)//2==0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s532607094
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split()) if a*b%2 == 0: print(Even) else: print(Odd)
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s262396348
Wrong Answer
p03455
Input is given from Standard Input in the following format: a b
S = list(input()) print("Odd") if int(S[0]) * int(S[2]) % 2 == 1 else print("Even")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s908150780
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = map(int, input().split()) if a*b%2==0: print("Even") else: print("Odd")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s640522673
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a, b = split(int, input())
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s950661838
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=map(int,input().split());print('Even' if a*b%==0 else 'Odd')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s745656771
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
if a * b % == 1 print('odd') else print('Even')
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s302662408
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b =input().split() c=int(a+b) i=1 while True: if i *i ==c: print("Yes") exit() elif i*i >c: print("No") exit() else: i += 1 a,b = list(input().split()) c=int(a+b) i=1 while True: if i *i ==c: print("Yes") exit() elif i*i >c: print("No") exit() else: i += 1
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s691938459
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
function main(input){ const data = input.split(' ') const a = parseInt(data[0], 10) const b = parseInt(data[1], 10) if((a * b) % 2 === 1){ console.log("Even"); }else{ console.log("Odd") } } main(require('fs').readFileSync('/dev/stdin', 'utf8'));
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s432338159
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
hoge=input() hoge=hoge.split() a=int(hoge[0]) b=int(hoge[1]) if a % 2 == 0 or b % 2 == 0: print("Even") else: print("Odd"
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s078648308
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
T = 0 X = 1 Y = 2 item = input() tabiji = [[0, 0, 0]] for i in range(1, int(item) + 1): tabiji.append(input().split(" ")) a = "Yes" for i in range(0, len(tabiji) - 1): time = int(tabiji[i + 1][T]) - int(tabiji[i][T]) dX = int(tabiji[i + 1][X]) - int(tabiji[i][X]) dY = int(tabiji[i + 1][Y]) - int(tabiji[i][Y]) for j in range(time): if dX > 0: dX -= 1 elif dX < 0: dX += 1 elif dY > 0: dY -= 1 elif dY < 0: dY += 1 if dX == 0 and dY == 0 and (time - j + 1) % 2 == 1: a = "No" break elif dX == 0 and dY == 0 and (time - j + 1) % 2 == 0: break if dX != 0 or dY != 0: a = "No" print(a)
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s321754206
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
n, k = map(int, input().split()) l = [input().split() for _ in range(n)] b = [[0] * k for _ in range(k)] w = [[0] * k for _ in range(k)] anb = [[0] * k for _ in range(k)] anw = [[0] * k for _ in range(k)] ans = 0 i = 0 while i < n: m = (((int(l[i][0])) // k) + ((int(l[i][1])) // k)) % 2 if m == 0 and str(l[i][2]) == "W": w[int(l[i][0]) % k][int(l[i][1]) % k] += 1 elif m == 1 and str(l[i][2]) == "B": b[int(l[i][0]) % k][int(l[i][1]) % k] += 1 elif m == 1 and str(l[i][2]) == "W": anw[int(l[i][0]) % k][int(l[i][1]) % k] += 1 else: anb[int(l[i][0]) % k][int(l[i][1]) % k] += 1 from numpy import matrix w = matrix(w) b = matrix(b) anw = matrix(anw) anb = matrix(anb) for a in range(0, k): for b in range(0, k): total = ( w[a:k][b:k].sum() + anw[0:a][0:b].sum() + b[a:k][b:k].sum() + anb[0:a][0:b].sum() ) ans = max(ans, total, n - total) print(ans)
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s311711788
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
def judge(x,y): if (a*b) % 2 == 0: return "Even" return "Odd" a,b = map(int,input().split()) print(judge(a,b)
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s457226242
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=map(int,input().split() c = a*b if c % 2 == 1: print("Odd") elsif c % 2 == 0: print("Even")
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s406362194
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
N = list(map(int,input().split())) math = N[0] * N[1] if math % 2 == 1: return "Odd" else: return "Even"
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s213007703
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b =input().split() c=int(a+b) i=1 while True: if i *i ==c: print("Yes") exit() elif i*i >c: print("No") exit() else: i += 1 a,b = list(input().split()) c=int(a+b) i=1 while True: if i *i ==c: print("Yes") exit() elif i*i >c: print("No") exit() else: i += 1
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s753110032
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a,b=(int(x) for x in input().split()) #print((a * b) % 2) if (a * b) % 2 == 1: print('Odd') else: print('Even')f
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s894973187
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
# import time nk = [int(x) for x in input().strip().split()] d = [] for i in range(nk[0]): d_tmp = input().strip().split() d.append([int(d_tmp[0]), int(d_tmp[1]), int(d_tmp[2] == "B")]) n1 = nk[0] k1 = nk[1] check_x = [0] * n1 * 4 check_y = [0] * n1 * 4 for i in range(n1): check_x[i * 4 + 1] = d[i][0] - k1 + 1 check_x[i * 4 + 2] = d[i][0] check_y[i * 4 + 1] = d[i][1] - k1 + 1 check_y[i * 4 + 2] = d[i][1] check_x = list(set(check_x)) check_y = list(set(check_y)) # d = tuple(d) n = 0 # t = time.clock() # for i in range(k1): # for j in range(k1): for i in check_x: for j in check_y: n_tmp = [0, 0] for k in range(n1): x = (d[k][0] - i) // k1 % 2 y = (d[k][1] - j) // k1 % 2 # if x == y: # n_tmp[1 - d[k][2]] += 1 # else: # n_tmp[d[k][2]] += 1 n_tmp[(x == y) ^ d[k][2]] += 1 if n_tmp[0] > n: n = n_tmp[0] if n_tmp[1] > n: n = n_tmp[1] # print(time.clock() - t) print(n)
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
If the product is odd, print `Odd`; if it is even, print `Even`. * * *
s918332659
Runtime Error
p03455
Input is given from Standard Input in the following format: a b
a = int(input().replace(' ', '')) count = 1 while count < 100001 if a = count ** 2: print('Yes') break count += 1
Statement AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
[{"input": "3 4", "output": "Even\n \n\nAs 3 \u00d7 4 = 12 is even, print `Even`.\n\n* * *"}, {"input": "1 21", "output": "Odd\n \n\nAs 1 \u00d7 21 = 21 is odd, print `Odd`."}]
Print the minimum number of operations required. * * *
s455096981
Accepted
p03140
Input is given from Standard Input in the following format: N A B C
n = input() print(sum(len(set(o)) - 1 for o in zip(input(), input(), input())))
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print the minimum number of operations required. * * *
s796405149
Runtime Error
p03140
Input is given from Standard Input in the following format: N A B C
N = int(input()) L = [input() for i in range(3)] ans = [0] * N. tmp = [] for i in range(N):. for j in range(3): tmp.append(L[j][i]) ans[i] = len(set(tmp)) - 1 tmp = [] print(sum(ans))
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print the minimum number of operations required. * * *
s079902282
Runtime Error
p03140
Input is given from Standard Input in the following format: N A B C
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math # from math import gcd import bisect from collections import defaultdict from collections import deque from collections import Counter from functools import lru_cache ############# # Constants # ############# MOD = 10**9 + 7 INF = float("inf") ############# # Functions # ############# ######INPUT###### def I(): return int(input().strip()) def S(): return input().strip() def IL(): return list(map(int, input().split())) def SL(): return list(map(str, input().split())) def ILs(n): return list(int(input()) for _ in range(n)) def SLs(n): return list(input().strip() for _ in range(n)) def ILL(n): return [list(map(int, input().split())) for _ in range(n)] def SLL(n): return [list(map(str, input().split())) for _ in range(n)] ######OUTPUT###### def P(arg): print(arg) return def Y(): print("Yes") return def N(): print("No") return def E(): exit() def PE(arg): print(arg) exit() def YE(): print("Yes") exit() def NE(): print("No") exit() #####Shorten##### def DD(arg): return defaultdict(arg) #####Inverse##### def inv(n): return pow(n, MOD - 2, MOD) ######Combination###### kaijo_memo = [] def kaijo(n): if len(kaijo_memo) > n: return kaijo_memo[n] if len(kaijo_memo) == 0: kaijo_memo.append(1) while len(kaijo_memo) <= n: kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD) return kaijo_memo[n] gyaku_kaijo_memo = [] def gyaku_kaijo(n): if len(gyaku_kaijo_memo) > n: return gyaku_kaijo_memo[n] if len(gyaku_kaijo_memo) == 0: gyaku_kaijo_memo.append(1) while len(gyaku_kaijo_memo) <= n: gyaku_kaijo_memo.append( gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo), MOD - 2, MOD) % MOD ) return gyaku_kaijo_memo[n] def nCr(n, r): if n == r: return 1 if n < r or r < 0: return 0 ret = 1 ret = ret * kaijo(n) % MOD ret = ret * gyaku_kaijo(r) % MOD ret = ret * gyaku_kaijo(n - r) % MOD return ret ######Factorization###### def factorization(n): arr = [] temp = n for i in range(2, int(-(-(n**0.5) // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) if arr == []: arr.append([n, 1]) return arr #####MakeDivisors###### def make_divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) return divisors #####MakePrimes###### def make_primes(N): max = int(math.sqrt(N)) seachList = [i for i in range(2, N + 1)] primeNum = [] while seachList[0] <= max: primeNum.append(seachList[0]) tmp = seachList[0] seachList = [i for i in seachList if i % tmp != 0] primeNum.extend(seachList) return primeNum #####GCD##### def gcd(a, b): while b: a, b = b, a % b return a #####LCM##### def lcm(a, b): return a * b // gcd(a, b) #####BitCount##### def count_bit(n): count = 0 while n: n &= n - 1 count += 1 return count #####ChangeBase##### def base_10_to_n(X, n): if X // n: return base_10_to_n(X // n, n) + [X % n] return [X % n] def base_n_to_10(X, n): return sum(int(str(X)[-i - 1]) * n**i for i in range(len(str(X)))) #####IntLog##### def int_log(n, a): count = 0 while n >= a: n //= a count += 1 return count ############# # Main Code # ############# N = I() A, B, C = SLs(3) def kyori(S, T): ret = 0 for i in range(N): if S[i] != T[i]: ret += 1 return ret print( sum(kyori(A, B), kyori(A, C), kyori(B, C)) - max(kyori(A, B), kyori(A, C), kyori(B, C)) )
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print the minimum number of operations required. * * *
s750776801
Accepted
p03140
Input is given from Standard Input in the following format: N A B C
# coding: utf-8 import sys # import bisect # import math # import numpy as np """Template""" class IP: """ 入力を取得するクラス """ def __init__(self): self.input = sys.stdin.readline def I(self): """ 1文字の取得に使います :return: int """ return int(self.input()) def S(self): """ 1文字の取得(str :return: str """ return self.input() def IL(self): """ 1行を空白で区切りリストにします(int :return: リスト """ return list(map(int, self.input().split())) def SL(self): """ 1行の文字列を空白区切りでリストにします :return: リスト """ return list(map(str, self.input().split())) def ILS(self, n): """ 1列丸々取得します(int :param n: 行数 :return: リスト """ return [int(self.input()) for _ in range(n)] def SLS(self, n): """ 1列丸々取得します(str :param n: 行数 :return: リスト """ return [self.input() for _ in range(n)] def SILS(self, n): """ Some Int LineS 横に複数、縦にも複数 :param n: 行数 :return: list """ return [self.IL() for _ in range(n)] class Idea: def __init__(self): pass def HF(self, p): """ Half enumeration 半分全列挙です pの要素の和の組み合わせを作ります。 ソート、重複削除行います :param p: list : 元となるリスト :return: list : 組み合わせられた和のリスト """ return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p)))) def Bfs2(self, a): """ bit_full_search2 bit全探索の改良版 全探索させたら2進数のリストと10進数のリストを返す :return: list2つ : 1個目 2進数(16桁) 2個目 10進数 """ # 参考 # https://blog.rossywhite.com/2018/08/06/bit-search/ # https://atcoder.jp/contests/abc105/submissions/4088632 value = [] for i in range(1 << len(a)): output = [] for j in range(len(a)): if self.bit_o(i, j): """右からj+1番目のiが1かどうか判定""" # output.append(a[j]) output.append(a[j]) value.append([format(i, "b").zfill(16), sum(output)]) value.sort(key=lambda x: x[1]) bin = [value[k][0] for k in range(len(value))] val = [value[k][1] for k in range(len(value))] return bin, val def SR(self, s): """ 昇順ソート(reverse書くのが面倒 返り値はありません。注意して下さい。 SR(s) と書いたらsが昇順ソートされるだけです。 Sort Reverse :param s: ソートしたいリスト :return: None """ s.sort(reverse=True) def bit_n(self, a, b): """ bit探索で使います。0以上のときにTrue出します 自然数だからn :param a: int :param b: int :return: bool """ return bool((a >> b & 1) > 0) def bit_o(self, a, b): """ bit探索で使います。1のときにTrue出すよ oneで1 :param a: int :param b: int :return: bool """ return bool(((a >> b) & 1) == 1) def ceil(self, x, y): """ Round up 小数点切り上げ割り算 :param x: int :param y: int :return: int """ return -(-x // y) def ave(self, a): """ 平均を求めます :param a: list :return: int """ return sum(a) / len(a) """ここからメインコード""" def main(): # 1文字に省略 r, e = range, enumerate ip = IP() id = Idea() """この下から書いてね""" n = ip.I() a = ip.S() b = ip.S() c = ip.S() ans = 0 for j in r(n): if a[j] == b[j] and b[j] == c[j]: pass elif a[j] == b[j] or b[j] == c[j] or a[j] == c[j]: ans += 1 else: ans += 2 print(ans) main()
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print the minimum number of operations required. * * *
s325989381
Runtime Error
p03140
Input is given from Standard Input in the following format: N A B C
n = int(input()) a = input() b = input() c = input() cnt2 = 0 cnt3 = 0 for i in range(n): nsame = len(set([a[i], b[i], c[i]])): if nsame == 2: cnt2 += 1 elif nsame == 1: cnt3 += 1 ans = 2*n - cnt2 - 2*cnt3 print(ans)
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print the minimum number of operations required. * * *
s193639612
Accepted
p03140
Input is given from Standard Input in the following format: N A B C
n, *a = open(0) print(sum(len(x) - 1 for x in map(set, zip(*a))))
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print the minimum number of operations required. * * *
s530041527
Runtime Error
p03140
Input is given from Standard Input in the following format: N A B C
n=int(input()) s=[i for i in range(3)] cnt=0 for j in range(n): cnt+=len(set(s[0][j],s[1][j],s[2][j])-1 print(cnt)
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print the minimum number of operations required. * * *
s964746985
Runtime Error
p03140
Input is given from Standard Input in the following format: N A B C
Npt
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print the minimum number of operations required. * * *
s944933307
Runtime Error
p03140
Input is given from Standard Input in the following format: N A B C
n = int(input()) a = input() b = input() c = input() cnt2 = 0 cnt3 = 0 for i in range(n): nsame = len(set([a[i], b[i], c[i]])) if nsame == 2: cnt2 += 1 elif nsame == 1: cnt3 += 1 ans = 2*n - cnt2 - 2*cnt3 print(ans)
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print the minimum number of operations required. * * *
s365234693
Runtime Error
p03140
Input is given from Standard Input in the following format: N A B C
n=int(input()) a=input() b=input() c=input() al=list(a) bl=list(b) cl=list(c) count=0 for i in range(n): if al[i]==bl[i]: if al[i]==cl[i]: plus=2 elif: plus=1 elif bl[i]==cl[i]: plus=1 elif al[i]==cl[i]: plus=1 else: plus=0 count+=plus print(count)
Statement You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter. What is the minimum number of operations required to achieve the objective?
[{"input": "4\n west\n east\n wait", "output": "3\n \n\nIn this sample, initially A = `west`\u3001B = `east`\u3001C = `wait`. We can achieve the\nobjective in the minimum number of operations by performing three operations\nas follows:\n\n * Change the second character in A to `a`. A is now `wast`.\n * Change the first character in B to `w`. B is now `wast`.\n * Change the third character in C to `s`. C is now `wast`.\n\n* * *"}, {"input": "9\n different\n different\n different", "output": "0\n \n\nIf A, B and C are already equal in the beginning, the number of operations\nrequired is 0.\n\n* * *"}, {"input": "7\n zenkoku\n touitsu\n program", "output": "13"}]
Print numbers to write in the grid so that its oddness is maximized, in the following format: a_{1,1}a_{1,2}\cdots a_{1,2^M-1} a_{2,1}a_{2,2}\cdots a_{2,2^M-1} \vdots a_{2^N-1,1}a_{2^N-1,2}\cdots a_{2^N-1,2^M-1} If there are multiple solutions, you can print any of them. * * *
s241234257
Wrong Answer
p02751
Input is given from Standard Input in the following format: N M
n, m = map(int, input().split()) for i in range(int(2**n - 1)): s = 1 for j in range(int(2**m - 2)): s = s * 10 + 1 print(s)
Statement We have a grid with (2^N - 1) rows and (2^M-1) columns. You are asked to write 0 or 1 in each of these squares. Let a_{i,j} be the number written in the square at the i-th row from the top and the j-th column from the left. For a quadruple of integers (i_1, i_2, j_1, j_2) such that 1\leq i_1 \leq i_2\leq 2^N-1, 1\leq j_1 \leq j_2\leq 2^M-1, let S(i_1, i_2, j_1, j_2) = \displaystyle \sum_{r=i_1}^{i_2}\sum_{c=j_1}^{j_2}a_{r,c}. Then, let the _oddness_ of the grid be the number of quadruples (i_1, i_2, j_1, j_2) such that S(i_1, i_2, j_1, j_2) is odd. Find a way to fill in the grid that maximizes its oddness.
[{"input": "1 2", "output": "111\n \n\nFor this grid, S(1, 1, 1, 1), S(1, 1, 2, 2), S(1, 1, 3, 3), and S(1, 1, 1, 3)\nare odd, so it has the oddness of 4.\n\nWe cannot make the oddness 5 or higher, so this is one of the ways that\nmaximize the oddness."}]
Print numbers to write in the grid so that its oddness is maximized, in the following format: a_{1,1}a_{1,2}\cdots a_{1,2^M-1} a_{2,1}a_{2,2}\cdots a_{2,2^M-1} \vdots a_{2^N-1,1}a_{2^N-1,2}\cdots a_{2^N-1,2^M-1} If there are multiple solutions, you can print any of them. * * *
s348573564
Wrong Answer
p02751
Input is given from Standard Input in the following format: N M
def solve(n, m): if m == 1: s1 = "1" s2 = "1" s0 = "1" elif m == 2: s1 = "111" s2 = "101" s0 = "000" else: s1 = "1" + "0" * (2 ** (m - 1) - 2) + "1" + "0" * (2 ** (m - 1) - 2) + "1" s0 = "0" * (2**m - 1) s2 = "1" + "0" * (2**m - 3) + "1" if n == 1: return [s1] res = [] for i in range(2**n - 1): if i == 0: s = s1 elif i == 2**n - 2: s = s1 elif i == 2 ** (n - 1) - 1: s = s2 else: s = s0 res.append(s) return res def main(): n, m = map(int, input().split()) res = solve(n, m) for r in res: print(r) def test(): assert solve() == 0 assert solve() == 0 assert solve() == 0 if __name__ == "__main__": # test() main()
Statement We have a grid with (2^N - 1) rows and (2^M-1) columns. You are asked to write 0 or 1 in each of these squares. Let a_{i,j} be the number written in the square at the i-th row from the top and the j-th column from the left. For a quadruple of integers (i_1, i_2, j_1, j_2) such that 1\leq i_1 \leq i_2\leq 2^N-1, 1\leq j_1 \leq j_2\leq 2^M-1, let S(i_1, i_2, j_1, j_2) = \displaystyle \sum_{r=i_1}^{i_2}\sum_{c=j_1}^{j_2}a_{r,c}. Then, let the _oddness_ of the grid be the number of quadruples (i_1, i_2, j_1, j_2) such that S(i_1, i_2, j_1, j_2) is odd. Find a way to fill in the grid that maximizes its oddness.
[{"input": "1 2", "output": "111\n \n\nFor this grid, S(1, 1, 1, 1), S(1, 1, 2, 2), S(1, 1, 3, 3), and S(1, 1, 1, 3)\nare odd, so it has the oddness of 4.\n\nWe cannot make the oddness 5 or higher, so this is one of the ways that\nmaximize the oddness."}]
Print the diameter of g in a line. The output values should be in a decimal fraction with an error less than 0.000001.
s995355114
Wrong Answer
p02301
n x1 y1 x2 y2 : xn yn The first integer n is the number of points in g. In the following lines, the coordinate of the i-th point pi is given by two real numbers xi and yi. The coordinates of points are given in the order of counter-clockwise visit of them. Each value is a real number with at most 6 digits after the decimal point.
from sys import stdin readline = stdin.readline def cross(a, b): return a.real * b.imag - a.imag * b.real def dot(a, b): return a.real * b.real + a.imag * b.imag def diff(p, i): return p[(i + 1) % len(p)] - p[i] # http://www.prefield.com/algorithm/geometry/convex_diameter.html def convex_diameter(p): js = ks = 0 for i in range(1, len(p)): if p[i].imag > p[js].imag: js = i if p[i].imag < p[ks].imag: ks = i maxd = abs(p[js] - p[ks]) j, k = js, ks while True: if cross(diff(p, j), diff(p, k)) >= 0: k = (k + 1) % len(p) else: j = (j + 1) % len(p) if maxd < abs(p[j] - p[k]): maxd = abs(p[j] - p[k]) if j == js and k == ks: break return maxd n = int(readline()) p = [map(float, readline().split()) for _ in range(n)] p = [x + y * 1j for x, y in p] print("{:.2f}".format(convex_diameter(p)))
Diameter of a Convex Polygon Find the diameter of a convex polygon g. In other words, find a pair of points that have maximum distance between them.
[{"input": "3\n 0.0 0.0\n 4.0 0.0\n 2.0 2.0", "output": "4.00"}, {"input": "4\n 0.0 0.0\n 1.0 0.0\n 1.0 1.0\n 0.0 1.0", "output": "1.414213562373"}]
Print the diameter of g in a line. The output values should be in a decimal fraction with an error less than 0.000001.
s054255167
Runtime Error
p02301
n x1 y1 x2 y2 : xn yn The first integer n is the number of points in g. In the following lines, the coordinate of the i-th point pi is given by two real numbers xi and yi. The coordinates of points are given in the order of counter-clockwise visit of them. Each value is a real number with at most 6 digits after the decimal point.
from math import sqrt def cross(P0, P1, P2): x0, y0 = P0 x1, y1 = P1 x2, y2 = P2 x1 -= x0 x2 -= x0 y1 -= y0 y2 -= y0 return x1 * y2 - x2 * y1 def dot(P0, P1, P2): x0, y0 = P0 x1, y1 = P1 x2, y2 = P2 x1 -= x0 x2 -= x0 y1 -= y0 y2 -= y0 return x1 * x2 + y1 * y2 def dist2(P0, P1): x0, y0 = P0 x1, y1 = P1 return (x1 - x0) ** 2 + (y1 - y0) ** 2 def convex_hull(PS): QS = [] n = len(PS) if n == 1: return PS[:] for P in PS: while len(QS) > 1 and cross(QS[-1], QS[-2], P) > 0: QS.pop() QS.append(P) k = len(QS) RS = reversed(PS) next(RS) for P in RS: while len(QS) > k and cross(QS[-1], QS[-2], P) > 0: QS.pop() QS.append(P) return QS def cross4(S0, S1, T0, T1): x0, y0 = S0 x1, y1 = S1 X0, Y0 = T0 X1, Y1 = T1 return (x1 - x0) * (Y1 - Y0) - (y1 - y0) * (X1 - X0) def calipers(PS): QS = convex_hull(PS) n = len(QS) if n == 2: return sqrt(dist2(*QS)) i = j = 0 for k in range(n): if QS[k] < QS[i]: i = k if QS[j] < QS[k]: j = k res = 0 si = i sj = j while i != sj or j != si: res = max(res, dist2(QS[i], QS[j])) if cross4(QS[i], QS[i - n + 1], QS[j], QS[j - n + 1]) < 0: i = (i + 1) % n else: j = (j + 1) % n return sqrt(res) n = int(input()) PS = [[*map(float, input().split())] for i in range(n)] PS.sort() print("%.09f" % calipers(PS))
Diameter of a Convex Polygon Find the diameter of a convex polygon g. In other words, find a pair of points that have maximum distance between them.
[{"input": "3\n 0.0 0.0\n 4.0 0.0\n 2.0 2.0", "output": "4.00"}, {"input": "4\n 0.0 0.0\n 1.0 0.0\n 1.0 1.0\n 0.0 1.0", "output": "1.414213562373"}]
For each data set, print "YES" or "NO".
s763951577
Accepted
p00003
Input consists of several data sets. In the first line, the number of data set, N is given. Then, N lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
n = int(input()) a = [] c = [] for i in range(n): a.append([]) for j in range(3): a[i].append([]) for i in range(n): # for j in range(3): a[i][0], a[i][1], a[i][2] = map(int, input().split()) a[i].sort() if ((a[i][0] * a[i][0]) + (a[i][1] * a[i][1])) == (a[i][2] * a[i][2]): k = "YES" c.append(k) else: k = "NO" c.append(k) for i in range(n): print(c[i])
Is it a Right Triangle? Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.
[{"input": "4 3 5\n 4 3 6\n 8 8 8", "output": "YES\n NO\n NO"}]
For each data set, print "YES" or "NO".
s283850575
Runtime Error
p00003
Input consists of several data sets. In the first line, the number of data set, N is given. Then, N lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
a, b, c = map(int, input().split()) if a**2 + b**2 == c**2: print("YES") else: print("NO")
Is it a Right Triangle? Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.
[{"input": "4 3 5\n 4 3 6\n 8 8 8", "output": "YES\n NO\n NO"}]
For each data set, print "YES" or "NO".
s273102311
Wrong Answer
p00003
Input consists of several data sets. In the first line, the number of data set, N is given. Then, N lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
def tri(a, b, c): return a ^ 2 == b ^ 2 + c ^ 2
Is it a Right Triangle? Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.
[{"input": "4 3 5\n 4 3 6\n 8 8 8", "output": "YES\n NO\n NO"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s328316945
Accepted
p02897
Input is given from Standard Input in the following format: N
import sys sys.setrecursionlimit(10**6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def IS(): return sys.stdin.readline()[:-1] def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LII(rows_number): return [II() for _ in range(rows_number)] def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def main(): N = II() if N % 2 == 0: print((N // 2) / N) else: print(((N // 2) + 1) / N) main()
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s870156038
Accepted
p02897
Input is given from Standard Input in the following format: N
#!/usr/bin/env python import string import sys from itertools import chain, dropwhile, takewhile INF = float("inf") def read( *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace) ): def read_word(): w = lambda c: c in whitespaces nw = lambda c: c not in whitespaces return f("".join(takewhile(nw, dropwhile(w, it)))) if not shape: return read_word() elif len(shape) == 1: return [read_word() for _ in range(shape[0])] elif len(shape) == 2: return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])] def readi(*shape): return read(*shape) def readi1(*shape): return [i - 1 for i in readi(*shape)] def readf(*shape): return read(*shape, f=float) def reads(*shape): return read(*shape, f=str) def arr(*shape, fill_value=0): if len(shape) == 1: return [fill_value] * shape[0] elif len(shape) == 2: return [[fill_value] * shape[1] for _ in range(shape[0])] def dbg(**kwargs): print( ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()), file=sys.stderr, ) def main(): n = readi() print(sum(i % 2 == 1 for i in range(1, n + 1)) / n) if __name__ == "__main__": main()
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s428264938
Runtime Error
p02897
Input is given from Standard Input in the following format: N
n = int(input()) # bを奇数の数と仮定して b = "math.ceil(n/2)" #  奇数/全体ってやればいいのかな? print(b / n)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s070846906
Runtime Error
p02897
Input is given from Standard Input in the following format: N
def main(): x, y = map(int, input().split()) tmp = [] for i in range(2, max(2, min(int(x // 2) + 1, int(y // 2) + 1))): if x % i == 0 and y % i == 0: tmp.append(i) while True: if x % i == 0: x = x // i else: break while True: if y % i == 0: y = y // i else: break print(len(tmp) + 1) # print(tmp) # for i,a in enumerate(tmp): # if a < 4: # tmp[i] = 1 # continue # j = 2 # for j in range(2,int(a**0.5)+1): # if a % j == 0: # tmp[i] = 0 # break # if tmp[i] != 0: # tmp[i] = 1 # print(sum(tmp)) # print(tmp) # cnt = 0 # # print(tmp) # flg = 0 # for i,a in enumerate(tmp): # # print('out' + str(i) + ' ' + str(a)) # if a == 1: # continue # leng = len(tmp) # for j in range(i+1,leng): # # print(j) # # print(tmp) # # print(leng) # if flg == 1: # j -=1 # flg = 0 # if j >= leng: # break # # print(str(j) + ' ' + str(leng) + ' ' + str(tmp[j])) # if tmp[j] % a == 0: # tmp.pop(j) # leng -=1 # j -= 1 # # print(tmp) # # print(j) # flg = 1 # # # print(j) # # print(a) # # print(len(tmp)) # print(tmp) if __name__ == "__main__": main()
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s382072727
Runtime Error
p02897
Input is given from Standard Input in the following format: N
N, A = int(input()), list(map(int, input().split())) X = [] for i in range(1, N + 1): P = A.index(i) + 1 X.append(P) print(" ".join([str(x) for x in X]))
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s689602911
Runtime Error
p02897
Input is given from Standard Input in the following format: N
################################# # ここからcode import fractions A, B = map(int, input().split()) gcd = fractions.gcd(A, B) if gcd == 1: print(1) else: def factorization(n): arr = [] temp = n for i in range(2, int(-(-(n**0.5) // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) if arr == []: arr.append([n, 1]) return arr soinsulist = factorization(gcd) print(len(soinsulist) + 1)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s401620587
Wrong Answer
p02897
Input is given from Standard Input in the following format: N
print(1 - (2 / int(input())))
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s846292075
Runtime Error
p02897
Input is given from Standard Input in the following format: N
N = int(input()) a = list(map(int, input())) b = a c = 1 if c <= N: d = a[c - 1] b[d - 1] = "c" c += 1 "".join(b)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s850813523
Runtime Error
p02897
Input is given from Standard Input in the following format: N
A, B = [int(x) for x in input().split()] def bunkai(n): sosu = {1} tmp = n stop_flag = n if tmp % 2 == 0: while tmp % 2 == 0: tmp //= 2 sosu.add(2) for i in range(3, n + 1, 2): if tmp % i == 0: while tmp % i == 0: tmp //= i sosu.add(i) stop_flag = tmp if i > stop_flag: break # else: # stop_flag = int(stop_flag/i) if tmp != 1: sosu.add(tmp) if sosu == [1]: sosu.add(n) return sosu def check_sosu(n, x): ans = 0 tmp = n for i in x: if (tmp % i) == 0: ans += 1 return ans ans = check_sosu(B, bunkai(A)) print(ans)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s573475732
Runtime Error
p02897
Input is given from Standard Input in the following format: N
import sys stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().rstrip() # ignore trailing spaces n, m = na() g = [[False] * n for _ in range(n)] gs = [[] for _ in range(n)] for i in range(m): s, t = na() gs[s - 1].append(t - 1) g[s - 1][t - 1] = True ans = 999999 best = None for i in range(n): ds = [9999999] * n prevs = [-1] * n ds[i] = 0 q = [i] qp = 0 while qp < len(q): cur = q[qp] qp += 1 for e in gs[cur]: if ds[e] > ds[cur] + 1: ds[e] = ds[cur] + 1 prevs[e] = cur q.append(e) for j in range(n): if g[j][i]: if ds[j] + 1 < ans: ans = ds[j] + 1 best = [0] * (ds[j] + 1) best[0] = i cur = j r = -1 while cur != i: best[r] = cur r -= 1 cur = prevs[cur] if not best: print(-1) else: print(ans) for x in best: print(x + 1)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s441894291
Runtime Error
p02897
Input is given from Standard Input in the following format: N
A, B = map(int, input().split()) i = 2 cnt = 0 tmpA, tmpB = A, B while i**2 <= min(tmpA, tmpB) and i <= min(A, B): if A % i == 0 and B % i == 0: cnt += 1 while A % i == 0 and B % i == 0: A //= i B //= i i += 1 if cnt == 0 and min(A, B) != 1: cnt += 1 if cnt == 0 and max(A, B) % min(A, B) == 0: cnt += 1 print(cnt + 1)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s135950953
Wrong Answer
p02897
Input is given from Standard Input in the following format: N
def prob_odd(N): number = 0 for i in range(1, N + 1): if i % 2 == 1: number = number + 1 else: pass # print(number) return number / N
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s939362224
Runtime Error
p02897
Input is given from Standard Input in the following format: N
A, B = map(int, input().split()) divisors = [] for i in range(1, min(A, B) + 1): if A % i == 0 and B % i == 0: divisors.append(i) done = {} def is_coprime(a, b): if (a, b) in done: return done[a, b] if b == 1: return True for i in range(2, min(A, B)): if a % i == 0 and b % i == 0: done[(a, b)] = False return False done[(a, b)] = True return True def getMaxLen(sofar, divisors): if len(divisors) == 0: return len(sofar) curr_max = getMaxLen(sofar, divisors[1:]) for i in range(len(divisors)): d = divisors[i] flag = False for s in sofar: if not is_coprime(d, s): flag = True break if flag: continue new = sofar.copy() new.append(d) curr_max = max(curr_max, getMaxLen(new, divisors[i + 1 :])) return curr_max print(getMaxLen([], divisors))
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s640436604
Accepted
p02897
Input is given from Standard Input in the following format: N
inp = int(input()) print((inp - inp // 2) / inp)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s620252029
Accepted
p02897
Input is given from Standard Input in the following format: N
q = int(input()) print((q // 2 + q % 2) / q)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s765705317
Wrong Answer
p02897
Input is given from Standard Input in the following format: N
input1 = float(input()) print(abs((input1 - 2) / input1))
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s801346835
Wrong Answer
p02897
Input is given from Standard Input in the following format: N
i = int(input()) j = i % 2 k = 0.0 if j == 0: k = 0.5 else: k = (float(i - 1) / 2.0) / float(i) print(k)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s713680289
Wrong Answer
p02897
Input is given from Standard Input in the following format: N
a = input() b = 0 for i in range(int(a)): if not i % 2 == 0: b = b + 1 print(b / int(a))
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s298388631
Accepted
p02897
Input is given from Standard Input in the following format: N
def ri(): return int(input()) def rli(): return list(map(int, input().split())) def rls(): return list(map(str, input().split())) def pl(a): print(" ".join(list(map(str, a)))) def ma(): return map(int, input().split()) def nli(x): return [input for _ in range(x)] def hukusuu(): listA = [] # appendのために宣言が必要 while True: try: listA.append(list(map(int, input().split()))) except: break # または、quit(),os.exit()をして止める。 return listA n = ri() if n % 2 == 0: print(0.5) else: print(((n // 2) + 1) / n)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s870351880
Runtime Error
p02897
Input is given from Standard Input in the following format: N
N, M = map(int, input().split()) a = [] for i in range(M): tmp = list(map(int, input().split())) tmpc = list(map(int, input().split())) c = 0 for j in range(len(tmpc)): c += 2 ** (tmpc[j] - 1) tmp[1] = c a += [tmp] dp = [[10**10 for j in range(2**N)] for i in range(M)] dp[0][0] = 0 dp[0][a[0][1]] = a[0][0] for i in range(1, M): dp[i] = dp[i - 1] for j in range(2**N): if dp[i - 1][j] < 10**10: q = j | a[i][1] dp[i][q] = min(dp[i - 1][j] + a[i][0], dp[i][q]) ans = dp[M - 1][2**N - 1] print(ans if ans < 10**10 else -1)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s110633356
Runtime Error
p02897
Input is given from Standard Input in the following format: N
import sys sys.setrecursionlimit(10**6) n, m = map(int, input().split()) e = [[] for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) e[a - 1].append(b - 1) c = [0] * n def search_path(p, temp): c[p] = 1 for x in e[p]: if x in temp: ans = [] + temp[temp.index(x) :] check = 1 while check == 1: check = 0 # print(ans) for i in range(len(ans) - 1): for z in e[ans[i]]: if z == ans[i + 1]: continue elif z in ans: t = ans.index(z) if t < i: ans = [] + ans[t : i + 1] else: ans = [] + ans[i : t + 1] # print(ans, z) check = 1 break if check == 1: break else: e[ans[i]] = [] if check == 1: continue for z in e[ans[-1]]: if z == ans[0]: continue elif z in ans: ans = [] + ans[ans.index(z) :] check = 1 # print(z, ans) break print(len(ans)) for z in ans: print(z + 1) exit() else: search_path(x, temp + [x]) t = 1 for i in range(n): if c[i] == 0: ans = search_path(i, [i]) print(-1)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the probability that a is odd. Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}. * * *
s926091230
Runtime Error
p02897
Input is given from Standard Input in the following format: N
print((input() + 1) / 2)
Statement Given is an integer N. Takahashi chooses an integer a from the positive integers not greater than N with equal probability. Find the probability that a is odd.
[{"input": "4", "output": "0.5000000000\n \n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among\nthem, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\n* * *"}, {"input": "5", "output": "0.6000000000\n \n\n* * *"}, {"input": "1", "output": "1.0000000000"}]
Print the minimum required number of buses. * * *
s532698287
Runtime Error
p03785
The input is given from Standard Input in the following format: N C K T_1 T_2 : T_N
n,c,k = map(int,input().split()) t = [] for i in range(n): t.append(int(input())) t = sorted(t) bus = [] ans = 1 for i in range(n): if len(bus) < c: #バスの定員に余裕があるとき if not bus: #バスに誰も乗っていなかったらバスに人を乗せる bus.append(t[i]) elif t[i] <= bus[0] + k:#バスに初めて人が乗った時刻にkを足して、それよりt[i]が小さければバスに乗せる bus.append(t[i]) else:#上記のelifを満たさない場合( ans +=1 bus = [] bus.append(t[i]) elif len(bus) == c: ans +=1 bus = [] bus.append(t[i]) else: ans +=1 bus = [] print(ans)
Statement Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time.
[{"input": "5 3 5\n 1\n 2\n 3\n 6\n 12", "output": "3\n \n\nFor example, the following three buses are enough:\n\n * A bus departing at time 4.5, that carries the passengers arriving at time 2 and 3.\n * A bus departing at time 6, that carries the passengers arriving at time 1 and 6.\n * A bus departing at time 12, that carries the passenger arriving at time 12.\n\n* * *"}, {"input": "6 3 3\n 7\n 6\n 2\n 8\n 10\n 6", "output": "3"}]
Print the minimum required number of buses. * * *
s800760984
Wrong Answer
p03785
The input is given from Standard Input in the following format: N C K T_1 T_2 : T_N
import sys from bisect import bisect_right as bsr from collections import Counter as cnt from collections import defaultdict as dd from collections import deque from fractions import gcd from itertools import combinations as comb from itertools import permutations as perm from math import ceil, factorial, floor from operator import itemgetter as ig from statistics import mean as avg sys.setrecursionlimit(1000000) # お約束 args = None INF = float("inf") MOD = int(1e9 + 7) def input(*ps): if type(ps[0]) is list: return [input(*ps[0][:-1]) for _ in range(ps[0][-1])] elif len(ps) == 1: return ps[0](next(args)) else: return [p(next(args)) for p in ps] def yesno(v, yes="Yes", no="No", upper=False): if upper: print([yes.upper(), no.upper()][not v]) else: print([yes, no][not v]) def main(): """エントリーポイント""" N, C, K = input([int, 3]) T = input([int, N]) T.sort() ans, first, current = 0, 0, 0 for t in T: if first == -1: first = t current += 1 if first + K < t: ans += ceil(current / C) current = 0 first = -1 else: if 0 < current: ans += ceil(current / C) print(ans) if __name__ == "__main__": args = iter(sys.stdin.read().split()) main()
Statement Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time.
[{"input": "5 3 5\n 1\n 2\n 3\n 6\n 12", "output": "3\n \n\nFor example, the following three buses are enough:\n\n * A bus departing at time 4.5, that carries the passengers arriving at time 2 and 3.\n * A bus departing at time 6, that carries the passengers arriving at time 1 and 6.\n * A bus departing at time 12, that carries the passenger arriving at time 12.\n\n* * *"}, {"input": "6 3 3\n 7\n 6\n 2\n 8\n 10\n 6", "output": "3"}]