wrong_submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| user_id
stringlengths 10
10
| time_limit
float64 1k
8k
| memory_limit
float64 131k
1.05M
| wrong_status
stringclasses 2
values | wrong_cpu_time
float64 10
40k
| wrong_memory
float64 2.94k
3.37M
| wrong_code_size
int64 1
15.5k
| problem_description
stringlengths 1
4.75k
| wrong_code
stringlengths 1
6.92k
| acc_submission_id
stringlengths 10
10
| acc_status
stringclasses 1
value | acc_cpu_time
float64 10
27.8k
| acc_memory
float64 2.94k
960k
| acc_code_size
int64 19
14.9k
| acc_code
stringlengths 19
14.9k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s856761241 | p03524 | u513434790 | 2,000 | 262,144 | Wrong Answer | 38 | 4,516 | 400 | Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`. He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible. | # -*- coding: utf-8 -*-
from collections import Counter
def pri(x):
if x == 1:
return print("Yes")
else:
return print("No")
S = list(input())
S.sort()
c = list(Counter(S).values())
if len(c) <= 2:
for _ in range(3-len(c)):
c.append(0)
c.sort(reverse = True)
if c[0] >= c[1] - 1:
if c[2] >= c[0] - 1:
pri(1)
else:
pri(0)
else:
pri(0) | s918371696 | Accepted | 38 | 4,516 | 400 | # -*- coding: utf-8 -*-
from collections import Counter
def pri(x):
if x == 1:
return print("YES")
else:
return print("NO")
S = list(input())
S.sort()
c = list(Counter(S).values())
if len(c) <= 2:
for _ in range(3-len(c)):
c.append(0)
c.sort(reverse = True)
if c[0] >= c[1] - 1:
if c[2] >= c[0] - 1:
pri(1)
else:
pri(0)
else:
pri(0) |
s862153916 | p03494 | u754022296 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 21,456 | 149 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n = int(input())
A = list(map(int, input().split()))
c = 0
while True:
for i in A:
if i%2:
print(c)
break
i //= 2
c += 1 | s533237889 | Accepted | 18 | 2,940 | 163 | n = int(input())
A = list(map(int, input().split()))
c = 0
while True:
for i in range(n):
if A[i]%2:
print(c)
exit()
A[i] //= 2
c += 1 |
s976098127 | p04043 | u276192130 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order. | a, b, c = map(int, input().split())
if a == c == 5 and b == 7:
print('YES')
else:
print('NO') | s183759021 | Accepted | 18 | 2,940 | 114 | n = list(map(int, input().split()))
if n.count(5) == 2 and n.count(7) == 1:
print('YES')
else:
print('NO') |
s767526335 | p02842 | u057964173 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 155 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer). Takahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer. If there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact. | import math
def resolve():
n=int(input())
x=-(-n//1.08)
if n==math.floor(x*1.08):
print(x)
else:
print(':(')
resolve() | s588825524 | Accepted | 29 | 2,940 | 146 | def resolve():
n=int(input())
ans=(':(')
for i in range(1,n+1):
if int(i*1.08)==n:
ans=i
print(ans)
resolve()
|
s501532219 | p03449 | u886297662 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 200 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You will collect all the candies you visit during the travel. The top-left and bottom-right squares also contain candies, and you will also collect them. At most how many candies can you collect when you choose the best way to travel? | N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
max = 0
for i in range(N):
point = sum(A1[:i]) + sum(A2[i:])
if max < point:
max = point
print(max) | s962940432 | Accepted | 18 | 3,060 | 202 | N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
max = 0
for i in range(N):
point = sum(A1[:i+1]) + sum(A2[i:])
if max < point:
max = point
print(max) |
s046246451 | p03493 | u454390998 | 2,000 | 262,144 | Wrong Answer | 27 | 8,908 | 89 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | numList = list(input())
total = 0
for i in range(len(numList)):
total += i
print(total) | s580096882 | Accepted | 27 | 9,096 | 103 | numList = list(input())
total = 0
for i in range(len(numList)):
total += int(numList[i])
print(total) |
s505784066 | p03478 | u705857261 | 2,000 | 262,144 | Wrong Answer | 35 | 3,408 | 273 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | #!/usr/bin/env python
N, A, B = map(int, input().split())
ans = 0;
for num in range(1, N+1):
l = []
q, r = divmod(num, 10)
l.append(r)
l.append(q % 10)
if A <= sum(l) and sum(l) <= B:
print(num)
ans += num
print(ans)
| s912529860 | Accepted | 36 | 3,060 | 321 | #!/usr/bin/env python
N, A, B = map(int, input().split())
ans = 0;
for num in range(1, N+1):
l = []
q, r = divmod(num, 10)
l.append(r)
while q != 0:
q, r = divmod(q, 10)
l.append(r)
if A <= sum(l) and sum(l) <= B:
# print(num)
ans += num
print(ans)
|
s943409746 | p04012 | u120651703 | 2,000 | 262,144 | Wrong Answer | 26 | 9,084 | 211 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | w = input()
w_dict = {}
for char in w:
if char in w_dict:
w_dict[char] += 1
else:
w_dict[char] = 1
if all(elem%2 == 0 for elem in w_dict.values()):
print('YES')
else:
print('NO') | s278883255 | Accepted | 32 | 9,116 | 211 | w = input()
w_dict = {}
for char in w:
if char in w_dict:
w_dict[char] += 1
else:
w_dict[char] = 1
if all(elem%2 == 0 for elem in w_dict.values()):
print('Yes')
else:
print('No') |
s701674158 | p03473 | u434148038 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 27 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | def a(aa):
return 48-aa | s512383196 | Accepted | 17 | 2,940 | 34 | a = input()
a = int(a)
print(48-a) |
s651759382 | p03644 | u493491792 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder. For example, * 6 can be divided by 2 once: 6 -> 3. * 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1. * 3 can be divided by 2 zero times. | n=input()
print(len(n))
word=""
for i in range(len(n)):
if i%2==0:
word+=n[i]
print(word) | s466586169 | Accepted | 17 | 2,940 | 61 | n = int(input())
i=1
while ( i*2<= n):
i*=2
print(i)
|
s599808152 | p03693 | u689258494 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this integer a multiple of 4? | r,g,b=map(int,input().split())
a=100*r+10*g+b
if a%4==0:
print('Yes')
else:
print('No') | s863996350 | Accepted | 17 | 2,940 | 85 | r,g,b=map(int,input().split())
a=10*g+b
if a%4==0:
print('YES')
else:
print('NO') |
s853566813 | p02646 | u358859892 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,116 | 264 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch her when his coordinate is the same as hers. Determine whether he can catch her within T seconds (including exactly T seconds later). We assume that both children move optimally. | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a < b:
if a + v * t >= b + w * t:
print('Yes')
else:
print('No')
else:
if a - v * t <= b - w * t:
print('Yes')
else:
print('No')
| s935789732 | Accepted | 26 | 9,140 | 166 | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
c = abs(a - b)
d = (v - w) * t
if c <= d:
print('YES')
else:
print('NO')
|
s982010612 | p03827 | u488934106 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 182 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x during the operations (including before the first operation, and after the last operation). | N = int(input())
S = str(input())
count = 0
ans = 0
for i in range(N):
if S[i:1] == "I":
count += 1
ans = max(ans,count)
else:
count -= 1
print(ans) | s030708081 | Accepted | 17 | 3,060 | 184 | N = int(input())
S = str(input())
count = 0
ans = 0
for i in range(N):
if S[i:i+1] == "I":
count += 1
ans = max(ans,count)
else:
count -= 1
print(ans) |
s751407000 | p03433 | u629350026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n=int(input())
a=int(input())
if n*500<=a:
print("Yes")
else:
print("No") | s366301962 | Accepted | 17 | 2,940 | 77 | n=int(input())
a=int(input())
if n%500<=a:
print("Yes")
else:
print("No") |
s234837604 | p03625 | u225627575 | 2,000 | 262,144 | Wrong Answer | 104 | 14,252 | 589 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
countBIG = 0
countSMALL = 0
BIG = 0
SMALL = 0
for i in range(N):
if countBIG == 1:
if BIG == A[i]:
countBIG =2
continue
else:
countBIG == 0
if countBIG == 0:
BIG = A[i]
countBIG = 1
if countSMALL == 1:
if A[i] == SMALL:
break
else:
countSMALL = 0
if countBIG == 2:
SMALL = A[i]
countSMALL = 1
if BIG!= 0 and SMALL!=0:
print(BIG*SMALL)
else:
print(0) | s244957912 | Accepted | 111 | 14,224 | 362 | N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
flagBIG = 0
BIG = 0
SMALL = 0
i=1
while i<N:
if A[i] == A[i-1] and flagBIG == 1:
SMALL = A[i]
break
if A[i] == A[i-1] and flagBIG == 0:
BIG = A[i]
flagBIG = 1
i = i+1
i=i+1
if BIG!= 0 and SMALL!=0:
print(BIG*SMALL)
else:
print(0) |
s147631032 | p03049 | u545672909 | 2,000 | 1,048,576 | Wrong Answer | 35 | 3,956 | 310 | Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. | n = int(input())
s_list = [input() for _ in range(n)]
print(s_list)
ab_count = 0
b_start = 0
a_end = 0
for s in s_list:
if s[0] == 'B':
b_start = b_start + 1
if s[-1] == 'A':
a_end = a_end + 1
ab_count = ab_count + s.count('AB')
print(ab_count + min(min(a_end, b_start), n - 1))
| s750171689 | Accepted | 36 | 3,700 | 419 | n = int(input())
s_list = [input() for _ in range(n)]
ab_count = 0
b_start = 0
a_end = 0
concat_max = 0
for s in s_list:
is_b = s[0] == 'B'
is_a = s[-1] == 'A'
if is_b:
b_start = b_start + 1
if is_a:
a_end = a_end + 1
if is_a or is_b:
concat_max = concat_max + 1
ab_count = ab_count + s.count('AB')
print(ab_count + max(min(min(a_end, b_start), concat_max - 1), 0)) |
s124591234 | p03737 | u487288850 | 2,000 | 262,144 | Wrong Answer | 30 | 9,080 | 55 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | s = input().split()
(s[0][0] + s[1][0]+s[2][0]).upper() | s297001265 | Accepted | 28 | 9,016 | 62 | s = input().split()
print((s[0][0] + s[1][0]+s[2][0]).upper()) |
s279434380 | p02259 | u467422569 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 318 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, indices for array elements are based on 0-origin. Your program should also print the number of swap operations defined in line 4 of the pseudocode. | def insertionSort(A,input_num):
for i in range(input_num):
v = A[i]
j = i - 1
while(j >= 0 and A[j] > v):
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(*A)
input_num = int(input())
A = list(map(int, input().split()))
insertionSort(A,input_num)
| s566871824 | Accepted | 20 | 5,612 | 437 | def bubbleSort(A,N):
flag = 1
i = 0
while flag == 1:
flag = 0
for j in range(N-1,0,-1):
if A[j] < A[j-1]:
A[j], A[j-1] = A[j-1], A[j]
flag = 1
i += 1
print(*A)
print(i)
N = int(input())
A = list(map(int,input().split()))
bubbleSort(A,N)
|
s527138160 | p03699 | u622011073 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 126 | You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well. However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade? | a=sorted([int(input()) for _ in[0]*int(input())]);b=sum(a)
for x in a:
if b%10!=0:b=0;break
elif x%10!=0:b-=x
print(b) | s588522403 | Accepted | 18 | 2,940 | 129 | a=sorted([int(input()) for _ in[0]*int(input())]);b=sum(a)
for x in a:
if b%10:break
elif x%10:b-=x
print([0,b][b%10!=0]) |
s860423568 | p03380 | u903005414 | 2,000 | 262,144 | Wrong Answer | 180 | 23,104 | 315 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
num_negative = np.count_nonzero(A < 0)
A = np.abs(A)
if num_negative % 2 == 0:
print(A.sum())
else:
print(A.sum() - A.min() * 2)
| s947007952 | Accepted | 249 | 23,032 | 224 | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
ai = a.max()
v, aj = 0, 0
for i in a:
tmp = i * (ai - i)
if v < tmp:
v = tmp
aj = i
# print(v, aj)
print(*(ai, aj))
|
s003960553 | p03729 | u946386741 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `YES`. Otherwise, print `NO`. | a, b, c = input().split()
if (a[-1] is b[0]) and (b[-1] is c[0]):
print("Yes")
else:
print("No") | s280923689 | Accepted | 18 | 2,940 | 105 | a, b, c = input().split()
if (a[-1] is b[0]) and (b[-1] is c[0]):
print("YES")
else:
print("NO") |
s928047320 | p03449 | u866949333 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 290 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You will collect all the candies you visit during the travel. The top-left and bottom-right squares also contain candies, and you will also collect them. At most how many candies can you collect when you choose the best way to travel? | N = int(input())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
A = [l1, l2]
print (A)
max_candy = 0
for i in range(N):
temp = 0
temp += sum(A[0][0:i+1])
temp += sum(A[1][i:])
if temp > max_candy:
max_candy = temp
print(max_candy)
| s951617529 | Accepted | 17 | 3,064 | 278 | N = int(input())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
A = [l1, l2]
max_candy = 0
for i in range(N):
temp = 0
temp += sum(A[0][0:i+1])
temp += sum(A[1][i:])
if temp > max_candy:
max_candy = temp
print(max_candy)
|
s071457650 | p03854 | u254050469 | 2,000 | 262,144 | Wrong Answer | 82 | 3,188 | 292 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s=input()[::-1]
sample={'maerd':"", 'remae':"rd", 'esare':"", 'resar':"e"}
while True:
if s[:5] in sample and s[5:5+len(sample[s[:5]])] == sample[s[:5]]:
s = s[5+len(sample[s[:5]]):]
else:
print("NO")
break
if len(s) ==0:
print("OK")
break | s941807706 | Accepted | 77 | 3,188 | 287 | s=input()[::-1]
sample=['maerd', 'resare', 'remaerd', 'esare', '']
i=0
while True:
for d in sample:
if s[:len(d)] == d:
s = s[len(d):]
break
if d =='':
print ("NO")
break
if len(s) ==0:
print("YES")
break |
s597690121 | p03795 | u629607744 | 2,000 | 262,144 | Wrong Answer | 28 | 9,012 | 43 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y. | n = int(input())
x = n
y = n//15
print(x-y) | s591059805 | Accepted | 31 | 9,104 | 54 | n = int(input())
x = n
y = n//15
print(800*x - 200*y)
|
s519415208 | p03408 | u859897687 | 2,000 | 262,144 | Wrong Answer | 29 | 3,064 | 179 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will earn 1 yen (the currency of Japan); each time he finds a red card with that string, he will lose 1 yen. Here, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces `atcoder`, he will not earn money even if there are blue cards with `atcoderr`, `atcode`, `btcoder`, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.) At most how much can he earn on balance? Note that the same string may be written on multiple cards. | a=[]
for i in range(int(input())):
a+=input()
b=[]
for i in range(int(input())):
b+=input()
ans=0
for i in range(len(a)):
ans=max(ans,a.count(a[i])-b.count(a[i]))
print(ans) | s822732288 | Accepted | 18 | 3,064 | 183 | a=[]
for i in range(int(input())):
a+=[input()]
b=[]
for i in range(int(input())):
b+=[input()]
ans=0
for i in range(len(a)):
ans=max(ans,a.count(a[i])-b.count(a[i]))
print(ans) |
s207080657 | p03488 | u343523393 | 2,000 | 524,288 | Wrong Answer | 22 | 3,188 | 758 | A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by distance 1. * `T` : Turn 90 degrees, either clockwise or counterclockwise. The objective of the robot is to be at coordinates (x, y) after all the instructions are executed. Determine whether this objective is achievable. | s=input()
x,y=list(map(int,input().split()))
dx=[]
dy=[]
first=True
move=0
xf=0
dir=0
for i in s:
if(i=="F"):
move+=1
else:
if(dir%2==0):
dx.append(move)
else:
dy.append(move)
dir+=1
move=0
tmp=xf
for i in dx:
if tmp<x:
tmp+=i
else:
tmp-=i
adx=tmp
tmp=0
for i in dy:
if tmp<y:
tmp+=i
else:
tmp-=i
ady=tmp
if(ady==y and adx==x):
print("Yes")
else:
print('No') | s221205467 | Accepted | 21 | 3,188 | 770 | s=input()
x,y=list(map(int,input().split()))
dx=[]
dy=[]
first=True
move=0
xf=0
dir=0
for i in s:
if(i=="F"):
move+=1
else:
if(first):
xf = move
first=False
else:
if(dir%2==0):
dx.append(move)
else:
dy.append(move)
dir+=1
move=0
if(dir%2==0):
if(first):
xf = move
else:
dx.append(move)
else:
dy.append(move)
cx=0
cy=0
x-=xf
for i in sorted(dx,reverse=True):
if x>=cx:
cx+=i
else:
cx-=i
for i in sorted(dy,reverse=True):
if y>=cy:
cy+=i
else:
cy-=i
if(cx==x and cy==y):
print("Yes")
else:
print('No')
|
s031758076 | p03386 | u279266699 | 2,000 | 262,144 | Wrong Answer | 2,273 | 62,412 | 226 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | from math import ceil
a, b, k = map(int, input().split())
if ceil((b - a + 1) / 2) >= k:
for i in range(a, b + 1):
print(i)
else:
for i in range(a, a + k + 1):
print(i)
for i in range(b - k, b + 1):
print(i) | s075049459 | Accepted | 29 | 9,144 | 432 | import sys
stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))
def main():
a, b, k = nm()
for i in range(a, min(a + k, b + 1)):
print(i)
for i in range(max(a + k, b - k + 1), b + 1):
print(i)
if __name__ == '__main__':
main()
|
s586424421 | p03378 | u179111046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 163 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a cost of 1. It is guaranteed that there is no toll gate in Square 0, Square X and Square N. Find the minimum cost incurred before reaching the goal. | n, m, x = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
if(x < a[i]):
print(min(i, len(a) - (i - 1)))
exit() | s870673606 | Accepted | 17 | 2,940 | 150 | n, m, x = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
if(x < a[i]):
print(min(i, m-i))
exit() |
s610420221 | p03361 | u594244257 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 455 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= `#`, and to make Square (i, j) white when s_{i, j}= `.`. However, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black. Determine if square1001 can achieve his objective. | def solve():
H,W = list(map(int, input().split()))
S = ['.'*(W+2)]+['.'+input()+'.' for _ in range(H)]+['.'*(W+2)]
result = 'yes'
# print(S)
for i in range(1,H+1):
for j in range(1,W+1):
if S[i][j] == '#':
if not(S[i+1][j] == '#' or S[i-1][j] == '#' or S[i][j+1] == '#' or S[i][j-1] == '#'):
result = 'no'
break
print( result )
solve() | s977196265 | Accepted | 18 | 3,064 | 455 | def solve():
H,W = list(map(int, input().split()))
S = ['.'*(W+2)]+['.'+input()+'.' for _ in range(H)]+['.'*(W+2)]
result = 'Yes'
# print(S)
for i in range(1,H+1):
for j in range(1,W+1):
if S[i][j] == '#':
if not(S[i+1][j] == '#' or S[i-1][j] == '#' or S[i][j+1] == '#' or S[i][j-1] == '#'):
result = 'No'
break
print( result )
solve() |
s363655260 | p03476 | u047668580 | 2,000 | 262,144 | Wrong Answer | 1,811 | 16,196 | 820 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | Q = int(input())
import numpy as np
n = 10 ** 5
doubel_primes = np.zeros(n+1, dtype=int)
primes_flags = np.zeros(n+1, dtype=bool)
primes_flags[1] = True
primes_flags[0] = True
#primes_flags[2] = True
primes_flags[::2] = True
if Q >= 2:
primes_flags[2] = False
def prime_check(n=100000):
i = 3
while i < n:
if not primes_flags[i]:
if not primes_flags[i//2 + 1]:
doubel_primes[i] = 1
k = i * i
while k <= n:
primes_flags[k] = True
k += i
i += 2
prime_check(n)
prime_sum = doubel_primes.cumsum()
for _ in range(Q):
l, r = list(map(int, input().split()))
print(prime_sum[r] - prime_sum[l-1])
| s462868559 | Accepted | 1,866 | 16,324 | 820 | Q = int(input())
import numpy as np
n = 10 ** 5
doubel_primes = np.zeros(n+1, dtype=int)
primes_flags = np.zeros(n+1, dtype=bool)
primes_flags[1] = True
primes_flags[0] = True
#primes_flags[2] = True
primes_flags[::2] = True
if Q >= 1:
primes_flags[2] = False
def prime_check(n=100000):
i = 3
while i < n:
if not primes_flags[i]:
if not primes_flags[i//2 + 1]:
doubel_primes[i] = 1
k = i * i
while k <= n:
primes_flags[k] = True
k += i
i += 2
prime_check(n)
prime_sum = doubel_primes.cumsum()
for _ in range(Q):
l, r = list(map(int, input().split()))
print(prime_sum[r] - prime_sum[l-1])
|
s291962477 | p02606 | u182166469 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,076 | 103 | How many multiples of d are there among the integers between L and R (inclusive)? | l,r,d=map(int,input().split())
i=0
count=0
for i in range(l,r):
if i%d==0:
count+=1
print(count) | s659880162 | Accepted | 24 | 9,164 | 105 | l,r,d=map(int,input().split())
i=0
count=0
for i in range(l,r+1):
if i%d==0:
count+=1
print(count) |
s072140726 | p03844 | u793339159 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 13 | Joisino wants to evaluate the formula "A op B". Here, A and B are integers, and the binary operator op is either `+` or `-`. Your task is to evaluate the formula instead of her. | eval(input()) | s046610147 | Accepted | 17 | 2,940 | 20 | print(eval(input())) |
s558909920 | p03625 | u017810624 | 2,000 | 262,144 | Wrong Answer | 92 | 14,480 | 239 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | n=int(input())
a=list(map(int,input().split()))
b=list(set(a))
b.sort()
b.reverse()
x=0;y=0
for i in range(len(b)):
if x==0 and a.count(b[i])>=2:
x=b[i]
elif y==0 and a.count(b[i])>=2:
y=b[i]
elif x*y==0:
break
print(x*y) | s242239033 | Accepted | 98 | 14,252 | 223 | n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
j=[];x=-2
for i in range(n-1):
if a[i]==a[i+1] and x!=i:
j.append(a[i])
x=i+1
if len(j)>=2:
break
j.append(0)
j.append(0)
print(j[0]*j[1]) |
s647001704 | p04011 | u483151310 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 228 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. |
w = input()
dct_str = dict.fromkeys(w, 0)
for alp in w:
dct_str[alp] += 1
flag = True
for alp in dct_str.keys():
if dct_str[alp] % 2 != 0:
flag = False
if flag == True:
print("Yes")
else:
print("No") | s838413936 | Accepted | 19 | 3,060 | 180 | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
yado = 0
for i in range(1, N+1):
if i <= K:
yado += X
elif i > K:
yado += Y
print(yado) |
s003820675 | p03067 | u035605655 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 182 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a,b,c = map(int, input().split())
if a < b:
if b < c:
print('Yes')
else:
print('No')
else:
if b < c:
print('Yes')
else :
print('No')
| s247207472 | Accepted | 17 | 2,940 | 190 | a,b,c = map(int, input().split())
if a < b:
if a < c < b:
print('Yes')
else :
print('No')
else:
if a > c > b:
print('Yes')
else:
print('No')
|
s288143108 | p02388 | u220308369 | 1,000 | 131,072 | Wrong Answer | 20 | 5,520 | 18 | Write a program which calculates the cube of a given integer x. | x=3
print(x*x*x)
| s622931723 | Accepted | 20 | 5,576 | 28 | x=int(input())
print(x*x*x)
|
s427982532 | p03494 | u310381103 | 2,000 | 262,144 | Time Limit Exceeded | 2,205 | 9,072 | 134 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n=int(input())
a = list(map(int,input().split()))
b=0
while(True):
for i in range(n):
if(a[i]%2!=0):
break
b+=1
print(b) | s413446503 | Accepted | 28 | 9,076 | 182 | import sys
n=int(input())
a = list(map(int,input().split()))
b=0
while(True):
for i in range(n):
if(a[i]%2!=0):
print(b)
sys.exit()
a[i]=a[i]//2
b+=1
print(b) |
s870206215 | p03469 | u798086274 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 43 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to `2018` and prints it. | s=input()
s.replace("2017","2018")
print(s) | s856967646 | Accepted | 18 | 2,940 | 42 | s=input()
print(s.replace("2017","2018"))
|
s253455022 | p03605 | u488127128 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | n = input()
print('Yes' if 's' in n else 'No') | s902583412 | Accepted | 17 | 2,940 | 46 | n = input()
print('Yes' if '9' in n else 'No') |
s108931186 | p03730 | u714878632 | 2,000 | 262,144 | Wrong Answer | 27 | 3,060 | 316 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. | a,b,c = [int(i) for i in input().split()]
r = a%b
if r == 0 and c != 0:
print("NO")
exit()
arr = set()
no = True
while no:
if c%r == 0:
no = False
break
arr.add(r)
rr = int(b/r)
r = ((rr+1)*r)%b
print(r,rr,arr)
if r in arr:
break
print("NO" if no else "YES")
| s748640853 | Accepted | 17 | 3,064 | 489 | a,b,c = [int(i) for i in input().split()]
arr = set()
ret = "NO"
r = a%b
if r==0:
if c==0:
ret="YES"
else:
pass
elif r==1:
ret = "YES"
else:
rr = r
while not(rr in arr):
# print(arr,rr)
if rr <= c and (c-rr)%r == 0:
ret = "YES"
break
else:
arr.add(rr)
n = int((b-rr)/r)
n += 1 if (b-rr)%r != 0 else 0
rr = (n*r + rr)%b
# print(n,rr)
print(ret)
|
s915962988 | p03860 | u552738814 | 2,000 | 262,144 | Wrong Answer | 30 | 8,984 | 36 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. | s = input()
print("A{}C".format(s)) | s135916458 | Accepted | 25 | 8,808 | 44 | a,s,c = input().split()
print("A"+s[0]+"C") |
s878040908 | p03007 | u923270446 | 2,000 | 1,048,576 | Wrong Answer | 151 | 25,656 | 251 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer. | n = int(input())
a = list(map(int, input().split()))
x, y = a[0], a[-1]
l = []
for i in a[1:-1]:
if i < 0:
l.append([y, i])
y -= i
else:
l.append([x, i])
x -= i
print(y - x)
for i in l:
print(*i)
print(y, x) | s236266721 | Accepted | 152 | 20,668 | 308 | n = int(input())
a = list(map(int, input().split()))
a.sort()
x, y = a[0], a[-1]
w, z = a[0], a[-1]
for i in a[1:-1]:
if i < 0:
y -= i
else:
x -= i
print(y - x)
for i in a[1:-1]:
if i < 0:
print(z, i)
z -= i
else:
print(w, i)
w -= i
print(z, w) |
s564124114 | p03067 | u319002530 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 95 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a, b, c = map(int, input().split())
if a > b and b > c:
print('Yes')
else:
print('No') | s425615629 | Accepted | 17 | 2,940 | 122 | a, b, c = map(int, input().split())
if a < c < b:
print('Yes')
elif a > c > b:
print('Yes')
else:
print('No') |
s389562413 | p02397 | u907607057 | 1,000 | 131,072 | Wrong Answer | 20 | 5,612 | 322 | Write a program which reads two integers x and y, and prints them in ascending order. | import sys
def main():
while True:
x, y = [int(i) for i in sys.stdin.readline().split(' ')]
if x == 0 & y == 0:
break
elif x > y:
print('{0} {1}'.format(x, y))
else:
print('{0} {1}'.format(y, x))
return
if __name__ == '__main__':
main()
| s441345381 | Accepted | 30 | 5,900 | 278 | import sys
def main():
while True:
x, y = [int(i) for i in sys.stdin.readline().split(' ')]
if x == 0 and y == 0:
break
elif x <= y:
print(x, y)
else:
print(y, x)
if __name__ == '__main__':
main()
|
s437509909 | p02397 | u713218261 | 1,000 | 131,072 | Wrong Answer | 60 | 6,724 | 169 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
(x, y) = [int(i) for i in input().split()]
print(x, y)
if x > y:
(x, y) == (y, x)
if x == 0 and y == 0:
break
print(x, y) | s770117718 | Accepted | 60 | 6,724 | 168 | while True:
(x, y) = [int(i) for i in input().split()]
if x == 0 and y == 0:
break
if x >= y:
print(y, x)
else:
print(x, y) |
s093451863 | p03494 | u168660441 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 172 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | _ = input()
a = input()
a = a.split(" ")
b = []
d = 0
for i in a:
if int(i)%2 == 0:
b.append(int(i))
c = min(b)
while c%2 == 0:
c = c/2
d += 1
print(d) | s458232313 | Accepted | 19 | 3,060 | 169 | _ = input()
a = input().split()
b = []
for i in a:
minimum = 0
while int(i)%2 == 0:
i = int(i)/2
minimum += 1
b.append(minimum)
print(min(b)) |
s875303343 | p03600 | u691018832 | 2,000 | 262,144 | Wrong Answer | 2,109 | 27,016 | 993 | In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network: * People traveled between cities only through roads. It was possible to reach any city from any other city, via intermediate cities if necessary. * Different roads may have had different lengths, but all the lengths were positive integers. Snuke the archeologist found a table with N rows and N columns, A, in the ruin of Takahashi Kingdom. He thought that it represented the shortest distances between the cities along the roads in the kingdom. Determine whether there exists a road network such that for each u and v, the integer A_{u, v} at the u-th row and v-th column of A is equal to the length of the shortest path from City u to City v. If such a network exist, find the shortest possible total length of the roads. | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
n = int(readline())
memo_graph = [list(map(int, readline().split())) for _ in range(n)]
cost = floyd_warshall(csr_matrix(memo_graph))
cnt_1 = 0
cnt_2 = 0
for i in range(n):
for j in range(n):
if int(cost[i][j]) != memo_graph[i][j]:
print(-1)
exit()
if cost[i][j] == 0:
continue
cnt_1 += cost[i][j]
s = set()
for k in range(n):
for i in range(n):
for j in range(n):
if i != j and j != k and k != i and cost[i][k] + cost[k][j] == cost[i][j]:
if (i, j) not in s:
s.add((i, j))
cnt_2 += cost[i][j]
print((cnt_1 - cnt_2) // 2)
| s574633570 | Accepted | 654 | 16,336 | 555 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
import numpy as np
n = int(readline())
graph = np.array([list(map(int, readline().split())) for _ in range(n)])
inf = 10 ** 10
ans = 0
for i in range(n):
graph[i][i] = inf
for i in range(n):
for j in range(i + 1, n):
v = np.min(graph[i] + graph[j])
if graph[i][j] > v:
print(-1)
exit()
elif graph[i][j] < v:
ans += graph[i][j]
print(ans)
|
s620866319 | p03672 | u518064858 | 2,000 | 262,144 | Wrong Answer | 25 | 2,940 | 97 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by deleting one or more characters from the end of S. It is guaranteed that such a non-empty string exists for a given input. | s=input()
while len(s)>0:
s=s[:-2]
if s[:len(s)//2]==s[len(s)//2:]:
print(len(s)) | s114935258 | Accepted | 18 | 2,940 | 114 | s=input()
while len(s)>0:
s=s[:-2]
if s[:len(s)//2]==s[len(s)//2:]:
print(len(s))
exit()
|
s640668162 | p03068 | u763389500 | 2,000 | 1,048,576 | Wrong Answer | 24 | 3,316 | 327 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | from sys import stdin
import re
n = [int(x) for x in stdin.readline().rstrip().split()]
s = stdin.readline().rstrip().split()
s = s[0]
k = [int(x) for x in stdin.readline().rstrip().split()]
k = k[0]
ast = ''
for i in range(len(s)):
print(s[i])
if i+1 == k:
ast = s[i]
print(re.sub('[^' + ast + ']', '*', s)) | s534293664 | Accepted | 23 | 3,316 | 312 | from sys import stdin
import re
n = [int(x) for x in stdin.readline().rstrip().split()]
s = stdin.readline().rstrip().split()
s = s[0]
k = [int(x) for x in stdin.readline().rstrip().split()]
k = k[0]
ast = ''
for i in range(len(s)):
if i+1 == k:
ast = s[i]
print(re.sub('[^' + ast + ']', '*', s))
|
s806438164 | p03494 | u641406334 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 214 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | N = int(input())
num = list(map(int,input().split()))
cnt = 0
flag=True
while flag:
for i in range(N):
if num[i]%2==1:
flag=False
else:
num[i]=num[i]//2
cnt+=1
print(num)
print(cnt-1) | s799804875 | Accepted | 19 | 3,060 | 201 | N = int(input())
num = list(map(int,input().split()))
cnt = 0
flag=True
while flag:
for i in range(N):
if num[i]%2==1:
flag=False
else:
num[i]=num[i]//2
cnt+=1
print(cnt-1) |
s027957241 | p03998 | u736729525 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 258 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * If the current player's deck contains at least one card, discard the top card in the deck. Then, the player whose name begins with the letter on the discarded card, takes the next turn. (For example, if the card says `a`, Alice takes the next turn.) * If the current player's deck is empty, the game ends and the current player wins the game. You are given the initial decks of the players. More specifically, you are given three strings S_A, S_B and S_C. The i-th (1≦i≦|S_A|) letter in S_A is the letter on the i-th card in Alice's initial deck. S_B and S_C describes Bob's and Charlie's initial decks in the same way. Determine the winner of the game. | A = input()
B = input()
C = input()
cards = {'a':A, 'b':B, 'c':C}
def play(cards):
p = 'a'
while True:
cs = cards[p]
if len(cs) == 0:
return p
next = cs[0]
cards[p] = cs[1:]
p = next
play(cards)
| s030158088 | Accepted | 18 | 3,060 | 273 | A = input()
B = input()
C = input()
cards = {'a':A, 'b':B, 'c':C}
def play(cards):
p = 'a'
while True:
cs = cards[p]
if len(cs) == 0:
return p.upper()
next = cs[0]
cards[p] = cs[1:]
p = next
print(play(cards))
|
s768124412 | p02612 | u471593927 | 2,000 | 1,048,576 | Wrong Answer | 123 | 27,144 | 218 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
def int_mtx(N):
x = []
for _ in range(N):
x.append(list(map(int,input().split())))
return np.array(x)
N = int(input())
print(N%1000) | s793911415 | Accepted | 128 | 27,136 | 261 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
def int_mtx(N):
x = []
for _ in range(N):
x.append(list(map(int,input().split())))
return np.array(x)
N = int(input())
if N%1000 > 0:
print(1000-N%1000)
else:
print(0) |
s549976571 | p03693 | u048956777 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this integer a multiple of 4? | r, g, b = map(str, input().split())
x = int(r + g + b)
if x % 3 == 0:
print('Yes')
else: print('No') | s683809857 | Accepted | 17 | 2,940 | 108 | r, g, b = map(str, input().split())
x = int(r + g + b)
if x % 4 == 0:
print('YES')
else: print('NO') |
s975892343 | p03711 | u865604924 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 400 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | # _*_ coding:utf-8 _*_
import sys
input = [int(i) for i in sys.stdin.readline().split(' ')]
input_matrix = []
for i in range(input[0]):
input_matrix.append(sys.stdin.readline().replace('\n',''))
for i in range(input[1] + 2):
print('#',end='')
print()
for i in range(input[0]):
print('#',end='')
print(input_matrix[i],end='')
print('#',)
for i in range(input[1] + 2):
print('#',end='')
| s291471726 | Accepted | 17 | 3,064 | 318 | # _*_ coding: utf-8_*_
import sys
is_ingroup = False
input = sys.stdin.readline()
num = input.split(' ')
x = int(num[0])
y = int(num[1])
group = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
for i in range(len(group)):
if x in group[i] and y in group[i]:
is_ingroup = True
if is_ingroup:
print('Yes')
else:
print('No') |
s744255918 | p03636 | u916806287 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | a = list(input())
print(a[0]+ str(len(a)) +a[-1]) | s650901203 | Accepted | 17 | 2,940 | 51 | a = list(input())
print(a[0]+ str(len(a)-2) +a[-1]) |
s938175980 | p04043 | u894685221 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 169 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order. | s = list(map(int, input().split()))
print(s)
print(s[1])
#import pdb; pdb.set_trace()
if s[0] == 5 and s[1] == 7 and s[2] == 5:
print("YES")
else:
print("NO")
| s157849299 | Accepted | 18 | 2,940 | 159 | i = list(map(int, input().split(" ")))
#print(s)
#print(s[1])
#import pdb; pdb.set_trace()
if [5, 5, 7] == sorted(i):
print("YES")
else:
print("NO")
|
s096313237 | p03129 | u013202780 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,044 | 50 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | print("YNeos"[eval(input().replace(" ","<="))::2]) | s875892076 | Accepted | 27 | 9,144 | 111 | from math import ceil
n,k=map(int,input().split());
print("YNEOS"[ceil(len([i for i in range(1,n+1)])/2)<k::2]) |
s216736587 | p04029 | u301337088 | 2,000 | 262,144 | Wrong Answer | 27 | 9,092 | 159 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | # abc055_a
N = int(input())
print(N/2*(N+1)) | s150914455 | Accepted | 29 | 9,068 | 153 |
N = int(input())
print(N * (N+1) // 2)
|
s234030696 | p03957 | u247366051 | 1,000 | 262,144 | Wrong Answer | 18 | 2,940 | 190 | This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters. Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way. You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtained from the string s by deleting some characters. | s = input()
f = False
for i in range(len(s)):
if s[i] == 'C':
for j in range(i, len(s)):
if s[j] == 'F':
print('Yes')
f = True
break
if f == True:
print('No')
break | s015222005 | Accepted | 20 | 3,188 | 66 | import re
print('Yes' if re.match('.*C.*F.*',input()) else 'No')
|
s594693736 | p03660 | u539517139 | 2,000 | 262,144 | Wrong Answer | 628 | 30,116 | 665 | Fennec and Snuke are playing a board game. On the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the graph formed by the cells and the roads is a tree. Initially, Cell 1 is painted black, and Cell N is painted white. The other cells are not yet colored. Fennec (who goes first) and Snuke (who goes second) alternately paint an uncolored cell. More specifically, each player performs the following action in her/his turn: * Fennec: selects an uncolored cell that is adjacent to a **black** cell, and paints it **black**. * Snuke: selects an uncolored cell that is adjacent to a **white** cell, and paints it **white**. A player loses when she/he cannot paint a cell. Determine the winner of the game when Fennec and Snuke play optimally. | n=int(input())
ki=[[] for _ in range(n)]
for i in range(n-1):
a,b=map(int,input().split())
ki[a-1].append(b-1)
ki[b-1].append(a-1)
fe=[0]*n
sn=[0]*n
from collections import deque
d=deque()
d.append(0)
visited=[False]*n
visited[0]=True
while d:
g=d.popleft()
for i in ki[g]:
if visited[i]:
continue
d.append(i)
visited[i]=True
fe[i]=fe[g]+1
d=deque()
d.append(n-1)
visited=[False]*n
visited[n-1]=True
while d:
g=d.popleft()
for i in ki[g]:
if visited[i]:
continue
d.append(i)
visited[i]=True
sn[i]=sn[g]+1
x=0
for i in range(n):
if fe[i]<sn[i]:
x+=1
else:
x-=1
print('Fennec' if x<0 else 'Snuke') | s345901534 | Accepted | 581 | 30,112 | 665 | n=int(input())
ki=[[] for _ in range(n)]
for i in range(n-1):
a,b=map(int,input().split())
ki[a-1].append(b-1)
ki[b-1].append(a-1)
fe=[0]*n
sn=[0]*n
from collections import deque
d=deque()
d.append(0)
visited=[False]*n
visited[0]=True
while d:
g=d.popleft()
for i in ki[g]:
if visited[i]:
continue
d.append(i)
visited[i]=True
fe[i]=fe[g]+1
d=deque()
d.append(n-1)
visited=[False]*n
visited[n-1]=True
while d:
g=d.popleft()
for i in ki[g]:
if visited[i]:
continue
d.append(i)
visited[i]=True
sn[i]=sn[g]+1
x=0
for i in range(n):
if fe[i]>sn[i]:
x+=1
else:
x-=1
print('Fennec' if x<0 else 'Snuke') |
s246930911 | p02394 | u517275798 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 103 | Write a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given. | W, H, x, y, r = map(int, input(). split())
if 2*r < x and 2*r < y :
print('Yes')
else:
print('No')
| s061495194 | Accepted | 20 | 5,592 | 126 | W, H, x, y, r = map(int, input().split())
if x < r or y < r or W - x < r or H - y < r:
print("No")
else:
print("Yes")
|
s788783460 | p03861 | u066869486 | 2,000 | 262,144 | Wrong Answer | 32 | 9,180 | 66 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,x = map(int, input().split())
c = b - a
d = c // x
print(d) | s386946942 | Accepted | 28 | 9,132 | 80 | a,b,x = map(int, input().split())
c = (b // x) - ((a - 1) // x)
d = c
print(d) |
s514010407 | p02613 | u737670214 | 2,000 | 1,048,576 | Wrong Answer | 47 | 9,940 | 361 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | N = int(input())
Si = [input for i in range(N)]
C0 = 0
C1 = 0
C2 = 0
C3 = 0
for in1 in Si:
if in1 == "AC":
C0 +=1
elif in1 == "WA":
C1 += 1
elif in1 == "TLE":
C2 += 1
elif in1 == "RE":
C3 += 1
print("AC x {}".format(C0))
print("WA x {}".format(C1))
print("TLE x {}".format(C2))
print("RE x {}".format(C3))
| s312838977 | Accepted | 150 | 16,288 | 359 | N = int(input())
Si = [input() for i in range(N)]
C0 = 0
C1 = 0
C2 = 0
C3 = 0
for in1 in Si:
if in1 == "AC":
C0 +=1
elif in1 == "WA":
C1 += 1
elif in1 == "TLE":
C2 += 1
elif in1 == "RE":
C3 += 1
print("AC x {}".format(C0))
print("WA x {}".format(C1))
print("TLE x {}".format(C2))
print("RE x {}".format(C3))
|
s657076929 | p03449 | u226108478 | 2,000 | 262,144 | Wrong Answer | 341 | 21,564 | 822 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You will collect all the candies you visit during the travel. The top-left and bottom-right squares also contain candies, and you will also collect them. At most how many candies can you collect when you choose the best way to travel? | # -*- coding: utf-8 -*-
import numpy as np
if __name__ == '__main__':
# Input
N = int(input())
route = np.zeros([2, N], dtype=int)
for i in range(2):
line = [int(i) for i in input().split(" ")]
for j in range(N):
route[i][j] = line[j]
# Init
row_count = 2
column_count = N
candy_count = 0
start_point_candy_count = route[0][0]
end_point_candy_count = route[row_count - 1][column_count - 1]
# Route choice.
partly_candy_count = np.sum(route, axis=1)
route1 = partly_candy_count[0] + end_point_candy_count
route2 = partly_candy_count[1] + start_point_candy_count
if route1 >= route2:
candy_count = route1
else:
candy_count = route2
# Output
print(candy_count)
| s786733245 | Accepted | 17 | 3,060 | 323 | # -*- coding: utf-8 -*-
def main():
n = int(input())
a = [list(map(int, input().split())) for i in range(2)]
count = 0
for i in range(n):
first = sum(a[0][:i + 1])
second = sum(a[1][i:])
count = max(count, first + second)
print(count)
if __name__ == '__main__':
main()
|
s164263269 | p02678 | u895515293 | 2,000 | 1,048,576 | Wrong Answer | 883 | 48,460 | 991 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage. Since it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1. * If you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible. Determine whether there is a way to place signposts satisfying our objective, and print one such way if it exists. | import sys
import collections
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
DQ=collections.deque([(1,0)])
VS=set([1])
MP={}
N,M=LI()
RES=[0]*(N+1)
for i in range(M):
ff,tt=LI()
if not ff in MP: MP[ff] = []
if not tt in MP: MP[tt] = []
MP[ff].append(tt)
MP[tt].append(ff)
# print("----")
while DQ:
i, dist = DQ.popleft()
# print(i,dist)
if i in MP:
for j in MP[i]:
if not j in VS:
VS.add(j)
DQ.append((j, dist+1))
RES[j] = i
# print(VS, MP)
if len(VS) < N:
print("No")
else:
for i in range(2, N+1):
print(RES[i])
| s753462468 | Accepted | 904 | 48,348 | 1,008 | import sys
import collections
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
DQ=collections.deque([(1,0)])
VS=set([1])
MP={}
N,M=LI()
RES=[0]*(N+1)
for i in range(M):
ff,tt=LI()
if not ff in MP: MP[ff] = []
if not tt in MP: MP[tt] = []
MP[ff].append(tt)
MP[tt].append(ff)
# print("----")
while DQ:
i, dist = DQ.popleft()
# print(i,dist)
if i in MP:
for j in MP[i]:
if not j in VS:
VS.add(j)
DQ.append((j, dist+1))
RES[j] = i
# print(VS, MP)
if len(VS) < N:
print("No")
else:
print("Yes")
for i in range(2, N+1):
print(RES[i])
|
s266916722 | p02257 | u231136358 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 7,712 | 279 | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list. | import math
def is_prime(num):
i = 2
while i < math.sqrt(num):
if num % i == 0:
return False
return True
N = int(input())
cnt = 0
for i in range(0, N):
n = int(input())
if (is_prime(n)):
cnt = cnt + 1
print(cnt) | s766599665 | Accepted | 1,020 | 7,724 | 267 | def is_prime(num):
i = 2
while i*i <= num:
if num % i == 0:
return False
i = i + 1
return True
N = int(input())
cnt = 0
for i in range(0, N):
n = int(input())
if (is_prime(n)):
cnt = cnt + 1
print(cnt) |
s552998486 | p02389 | u003762655 | 1,000 | 131,072 | Wrong Answer | 30 | 7,508 | 39 | Write a program which calculates the area and perimeter of a given rectangle. | a,b=map(int,input().split())
print(a*b) | s241130899 | Accepted | 20 | 7,600 | 47 | a,b=map(int,input().split())
print(a*b,2*a+2*b) |
s532404149 | p00025 | u724548524 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 336 | Let's play Hit and Blow game. _A_ imagines four numbers and _B_ guesses the numbers. After _B_ picks out four numbers, _A_ answers: * The number of numbers which have the same place with numbers _A_ imagined (Hit) * The number of numbers included (but different place) in the numbers _A_ imagined (Blow) For example, if _A_ imagined numbers: 9 1 8 2 and _B_ chose: 4 1 5 9 _A_ should say 1 Hit and 1 Blow. Write a program which reads four numbers _A_ imagined and four numbers _B_ chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. | import sys
a = list(map(int, input().split()))
for b in sys.stdin:
b = list(map(int, b.split()))
hit = 0
blow = 0
for i in range(4):
try:
if i == a.index(b[i]):
hit += 1
else:
blow += 1
except:
pass
print("{} {}".format(hit, blow))
| s480809804 | Accepted | 20 | 5,592 | 371 | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except:
break
hit = 0
blow = 0
for i in range(4):
try:
if i == a.index(b[i]):
hit += 1
else:
blow += 1
except:
pass
print("{} {}".format(hit, blow))
|
s343320284 | p03760 | u790877102 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 244 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the characters at the even-numbered positions. You are given two strings O and E. O contains the characters at the odd- numbered positions retaining their relative order, and E contains the characters at the even-numbered positions retaining their relative order. Restore the original password. | o = list(input())
e = list(input())
x=[]
if len(e)==len(o):
for i in range(len(e)):
x.append(e[i])
x.append(o[i])
if len(e)+1==len(o):
for i in range(len(e)):
x.append(e[i])
x.append(o[i])
x.append(o[len(o)-1])
print(''.join(x))
| s754429542 | Accepted | 17 | 3,060 | 244 | o = list(input())
e = list(input())
x=[]
if len(e)==len(o):
for i in range(len(e)):
x.append(o[i])
x.append(e[i])
if len(e)+1==len(o):
for i in range(len(e)):
x.append(o[i])
x.append(e[i])
x.append(o[len(o)-1])
print(''.join(x))
|
s524801678 | p03478 | u771756419 | 2,000 | 262,144 | Wrong Answer | 39 | 3,464 | 279 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | nums = input().split()
N = int(nums[0])
A = int(nums[1])
B = int(nums[2])
n = 0
ans = 0
while n < N+1:
print('n:',n)
n4 = n // 10**4
n3 = n // 10**3
n2 = n // 10**2
n1 = n // 10
n0 = n % 10
X = n4 + n3 + n2 + n1 + n0
if X >= A and X <= B:
ans += n
n += 1
print(ans)
| s172825223 | Accepted | 29 | 3,064 | 333 | nums = input().split()
N = int(nums[0])
A = int(nums[1])
B = int(nums[2])
n = 0
ans = 0
while n < N+1:
n4 = n // 10**4
n3 = n // 10**3 - n4 * 10
n2 = n // 10**2 - n4 * 100 - n3 * 10
n1 = n // 10 - n4 * 1000 - n3 * 100 - n2 * 10
n0 = n % 10
X = n4 + n3 + n2 + n1 + n0
if X >= A and X <= B:
ans += n
n += 1
print(ans) |
s436330207 | p02388 | u389610071 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 19 | Write a program which calculates the cube of a given integer x. | x = 3
print(x ** 3) | s668336676 | Accepted | 20 | 7,692 | 30 | x = int(input())
print(x ** 3) |
s962383665 | p02262 | u433154529 | 6,000 | 131,072 | Wrong Answer | 50 | 7,824 | 564 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+g] = A[j] 7 j = j - g 8 cnt++ 9 A[j+g] = v 10 11 shellSort(A, n) 12 cnt = 0 13 m = ? 14 G[] = {?, ?,..., ?} 15 for i = 0 to m-1 16 insertionSort(A, n, G[i]) A function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$. Your task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements: * $1 \leq m \leq 100$ * $0 \leq G_i \leq n$ * cnt does not exceed $\lceil n^{1.5}\rceil$ | def insertionSort(a,n,g):
cnt=0
for i in range(g,n):
v = a[i]
j = i - g
while j >= 0 and a[j] > v:
a[j + g] = a[j]
j = j - g
cnt+=1
a[j+g]=v
return cnt
def shellSort(a,n):
cnt=0
m=3
g=[4,3,1]
for i in g:
cnt+=insertionSort(a,n,i)
return cnt
if __name__=='__main__':
n=int(input())
b=[]
for j in range(n):
b.append(int(input()))
print("3")
print("4 3 1")
print(shellSort(b,n))
for j in range(n):
print(b[j]) | s396314711 | Accepted | 20,980 | 47,512 | 645 | n = int(input())
cn= 1
an= [1]
i = 1
while cn < n / 4:
an.append(cn*3+1)
cn=cn*3+1
an.sort(reverse=True)
def insertionSort(a,n,g):
cnt=0
for i in range(g,n):
v = a[i]
j = i - g
while j>= 0 and a[j]>v:
a[j + g]= a[j]
j = j-g
cnt+=1
a[j + g]=v
return cnt
def shellSort(a,n,an):
cnt=0
m = len(an)
g = an
for i in an:
cnt += insertionSort(a,n,i)
return cnt
x=[]
for i in range(n):
x.append(int(input()))
print(len(an))
print(" ".join([str(i) for i in an]))
y= shellSort(x,n,an)
print(y)
for i in range(n):
print(x[i]) |
s793187268 | p04043 | u844123804 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order. | num = input().split()
if num.count('5')==1 and num.count('7')==2:
print('YES')
else: print('NO') | s080227746 | Accepted | 17 | 2,940 | 98 | num = input().split()
if num.count('5')==2 and num.count('7')==1:
print('YES')
else: print('NO') |
s454367033 | p02392 | u686134343 | 1,000 | 131,072 | Wrong Answer | 30 | 6,716 | 107 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | nums = input().split()
a = int(nums[0])
b = int(nums[0])
c = int(nums[0])
if a < b < c:
print(a, b, c) | s294384089 | Accepted | 30 | 6,724 | 128 | nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
if a < b < c:
print('Yes')
else:
print('No') |
s133822343 | p03024 | u475776984 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 916 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S consisting of `o` and `x`. If the i-th character in S is `o`, it means that Takahashi won the match on the i-th day; if that character is `x`, it means that Takahashi lost the match on the i-th day. Print `YES` if there is a possibility that Takahashi can participate in the next tournament, and print `NO` if there is no such possibility. | #JMD
import sys
import math
#import fractions
#import numpy
###File Operations###
fileoperation=0
if(fileoperation):
orig_stdout = sys.stdout
orig_stdin = sys.stdin
inputfile = open('W:/Competitive Programming/input.txt', 'r')
outputfile = open('W:/Competitive Programming/output.txt', 'w')
sys.stdin = inputfile
sys.stdout = outputfile
###Defines...###
mod=1000000007
###FUF's...###
def nospace(l):
ans=''.join(str(i) for i in l)
return ans
##### Main ####
t=1
for tt in range(t):
s=str(input())
v=s.count('x')
if(15-v<8):
print("No")
else:
print("Yes")
#n,k,s= map(int, sys.stdin.readline().split(' '))
#a=list(map(int,sys.stdin.readline().split(' ')))
#####File Operations#####
if(fileoperation):
sys.stdout = orig_stdout
sys.stdin = orig_stdin
inputfile.close()
outputfile.close() | s068233813 | Accepted | 20 | 3,064 | 930 | #JMD
import sys
import math
#import fractions
#import numpy
###File Operations###
fileoperation=0
if(fileoperation):
orig_stdout = sys.stdout
orig_stdin = sys.stdin
inputfile = open('W:/Competitive Programming/input.txt', 'r')
outputfile = open('W:/Competitive Programming/output.txt', 'w')
sys.stdin = inputfile
sys.stdout = outputfile
###Defines...###
mod=1000000007
###FUF's...###
def nospace(l):
ans=''.join(str(i) for i in l)
return ans
##### Main ####
t=1
for tt in range(t):
s=str(input())
v=s.count('o')
v+=15-len(s)
if(v<8):
print("NO")
else:
print("YES")
#n,k,s= map(int, sys.stdin.readline().split(' '))
#a=list(map(int,sys.stdin.readline().split(' ')))
#####File Operations#####
if(fileoperation):
sys.stdout = orig_stdout
sys.stdin = orig_stdin
inputfile.close()
outputfile.close() |
s616607710 | p02936 | u160861278 | 2,000 | 1,048,576 | Wrong Answer | 1,609 | 45,144 | 460 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operation j (1 \leq j \leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j. Find the value of the counter on each vertex after all operations. | N, Q = map(int, input().split())
G = [[] for n in range(N+1)]
ANS = [0] * (N+1)
for _ in range(N-1):
a,b = map(int, input().split())
G[a].append(b)
for _ in range(Q):
p, x = map(int, input().split())
ANS[p] += x
from collections import deque
que = deque([])
que.append(1)
while que:
node = que.pop()
ans = ANS[node]
for child in G[node]:
ANS[child] += ans
que.append(child)
for i in range(1, N+1):
print(ANS[i]) | s757525416 | Accepted | 1,743 | 56,168 | 555 | N,Q = map(int, input().split())
Links = [[] for _ in range(N)]
for _ in range(N-1):
a, b = map(int, input().split())
Links[a-1].append(b-1)
Links[b-1].append(a-1)
Ans = [0]*N
for _ in range(Q):
p, x = map(int, input().split())
Ans[p-1] += x
checked = [0]*N
import collections
search = collections.deque([0])
while search:
t = search.pop()
checked[t] = 1
for node in Links[t]:
if checked[node]==1:
continue
Ans[node] += Ans[t]
checked[node] = 1
search.append(node)
print(*Ans) |
s499470385 | p03598 | u765401716 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 209 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th type-B robot at coordinates (K, i). Thus, now we have one type-A robot and one type-B robot on each of the N lines y = 1, y = 2, ..., y = N. When activated, each type of robot will operate as follows. * When a type-A robot is activated at coordinates (0, a), it will move to the position of the ball on the line y = a, collect the ball, move back to its original position (0, a) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything. * When a type-B robot is activated at coordinates (K, b), it will move to the position of the ball on the line y = b, collect the ball, move back to its original position (K, b) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything. Snuke will activate some of the 2N robots to collect all of the balls. Find the minimum possible total distance covered by robots. | N = int(input())
K = int(input())
X = list(map(int, input().split()))
count = 0
for i in X:
A = i
B =abs(i - K)
if A >= B:
count = count + B
else:
count = count + A
print(count) | s805860924 | Accepted | 17 | 3,060 | 213 | N = int(input())
K = int(input())
X = list(map(int, input().split()))
count = 0
for i in X:
A = i
B =abs(i - K)
if A >= B:
count = count + 2*B
else:
count = count + 2*A
print(count) |
s743458054 | p03386 | u642528832 | 2,000 | 262,144 | Wrong Answer | 2,242 | 938,268 | 245 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | A,B,K = map(int,input().split())
abl = []
for i in range(A,B+1):
abl.append(i)
print(abl)
if K < len(abl):
for j in abl[:K-1]:
print(j)
for k in abl[-K:]:
print(k)
else:
for j in abl[:K-1]:
print(j) | s713077984 | Accepted | 36 | 9,120 | 298 | a,b,k = map(int,input().split())
num = []
if b-a <= k:
for i in range(a,b+1):
print(i)
else:
for i in range(a,a+k):
num.append(i)
for i in range(b-k+1,b+1):
num.append(i)
num = list(set(num))
num.sort()
for i in num:
print(i)
|
s315885426 | p02389 | u202430481 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 167 | Write a program which calculates the area and perimeter of a given rectangle. | str_input = input()
list_input = str_input.split(" ")
print(list_input)
a = int(list_input[0])
b = int(list_input[1])
area = a * b
circ = (a + b) * 2
print(area, circ) | s094119454 | Accepted | 20 | 5,596 | 78 | a,b = (int(x) for x in input().split())
c = a * b
d = (a + b) * 2
print(c,d)
|
s949397474 | p02659 | u062118800 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,164 | 67 | Compute A \times B, truncate its fractional part, and print the result as an integer. | A,B=input().split()
A=int(A)
B=float(B)
print('{:.0f}'.format(A*B)) | s705110155 | Accepted | 20 | 9,100 | 58 | A,B=input().split()
print(int(A)*round(float(B)*100)//100) |
s013194891 | p03005 | u520276780 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 76 | Takahashi is distributing N balls to K persons. If each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls? | n,k = map(int, input().split())
if k>=2:
print(n-k-1)
else:
print(0) | s498436443 | Accepted | 17 | 2,940 | 74 | n,k = map(int, input().split())
if k>=2:
print(n-k)
else:
print(0) |
s014112986 | p03624 | u619819312 | 2,000 | 262,144 | Wrong Answer | 41 | 4,408 | 277 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | S=input()
A=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
B=[c for c in S]
B.sort()
for i in range(0,24):
if A[i] != B[i]:
print(A[i])
break
if len(B)<26:
print("z")
else:
print("none") | s997244128 | Accepted | 37 | 3,188 | 93 | d=[0]*26
for i in input():
d[ord(i)-97]+=1
print(chr(97+d.index(0)) if 0 in d else"None") |
s428528420 | p03605 | u149580849 | 2,000 | 262,144 | Wrong Answer | 23 | 3,444 | 105 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | a = int(input())
if (a/10 == 9):
print("yes")
if (a%10 == 9):
print("yes")
else:
print("No") | s983791025 | Accepted | 17 | 2,940 | 100 | a = list(map(int,list(input())))
if (a[0] == 9 or a[1] == 9):
print("Yes")
else:
print("No") |
s816328623 | p03623 | u333731247 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 61 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and t on a number line is represented by |s-t|. | x,a,b=map(int,input().split())
print(min(abs(x-a),abs(x-b))) | s843900874 | Accepted | 18 | 2,940 | 105 | x,a,b=map(int,input().split())
if min(abs(x-a),abs(x-b))==abs(x-a):
print('A')
else :
print('B') |
s106921531 | p02606 | u849341325 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,024 | 107 | How many multiples of d are there among the integers between L and R (inclusive)? | L,R,d = map(int,input().split())
n = L//d
m = R//d
if n%d == 0:
ans = m-n+1
else:
ans = m-n
print(ans)
| s162868092 | Accepted | 34 | 9,024 | 107 | L,R,d = map(int,input().split())
n = L//d
m = R//d
if L%d == 0:
ans = m-n+1
else:
ans = m-n
print(ans)
|
s058745597 | p03719 | u627530854 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | (a, b, c) = (int(tok) for tok in input().split())
print("YES" if a <= c and c <= b else "NO") | s890912728 | Accepted | 17 | 2,940 | 93 | (a, b, c) = (int(tok) for tok in input().split())
print("Yes" if a <= c and c <= b else "No") |
s169204486 | p03555 | u925353288 | 2,000 | 262,144 | Wrong Answer | 23 | 9,092 | 132 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. |
C1 =str(input())
C2 =str(input())
if C1[0] == C2[2] and C1[1] == C2[1] and C1[2] == C2[0]:
print('Yes')
else:
print('No') | s187897335 | Accepted | 28 | 9,088 | 134 |
C1 =str(input())
C2 =str(input())
if C1[0] == C2[2] and C1[1] == C2[1] and C1[2] == C2[0]:
print('YES')
else:
print('NO')
|
s046492603 | p03798 | u706159977 | 2,000 | 262,144 | Wrong Answer | 152 | 4,296 | 688 | Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered N is adjacent to the animals numbered N-1 and 1. There are two kinds of animals in this zoo: honest sheep that only speak the truth, and lying wolves that only tell lies. Snuke cannot tell the difference between these two species, and asked each animal the following question: "Are your neighbors of the same species?" The animal numbered i answered s_i. Here, if s_i is `o`, the animal said that the two neighboring animals are of the same species, and if s_i is `x`, the animal said that the two neighboring animals are of different species. More formally, a sheep answered `o` if the two neighboring animals are both sheep or both wolves, and answered `x` otherwise. Similarly, a wolf answered `x` if the two neighboring animals are both sheep or both wolves, and answered `o` otherwise. Snuke is wondering whether there is a valid assignment of species to the animals that is consistent with these responses. If there is such an assignment, show one such assignment. Otherwise, print `-1`. | n = int(input())
s = input()
a = "SS"
ct=0
while ct<6:
for i in range(n-1):
p=a[i]
q="A"
print("hi")
if a[i]=="S":
q="W"
else:
q="S"
if a[i+1]=="S":
if s[i+1] == "o":
a=a+a[i]
else:
a=a+q
else:
if s[i+1] == "o":
a=a+q
else:
a=a+a[i]
if a[0]==a[n]:
print(a[0:n])
break
else:
ct=ct+1
if ct==2:
a="SW"
elif ct==3:
a="WS"
elif ct==4:
a="WW"
else:
print(-1)
break
| s678931330 | Accepted | 276 | 3,572 | 1,238 | n = int(input())
s = input()
a = "SS"
ct=1
while ct<7:
for i in range(n-1):
p=a[i]
q="A"
if a[i]=="S":
q="W"
else:
q="S"
if a[i+1]=="S":
if s[i+1] == "o":
a=a+a[i]
else:
a=a+q
else:
if s[i+1] == "o":
a=a+q
else:
a=a+a[i]
if a[0]==a[n]:
if a[0]=="S" and s[0]=="o" and a[n-1]==a[1]:
print(a[0:n])
break
elif a[0]=="S" and s[0] !="o" and a[n-1]!=a[1]:
print(a[0:n])
break
elif a[0]=="W" and s[0] =="o" and a[n-1]!=a[1]:
print(a[0:n])
break
elif a[0]=="W" and s[0] !="o" and a[n-1]==a[1]:
print(a[0:n])
break
else:
ct=ct+1
if ct==2:
a="SW"
elif ct==3:
a="WS"
elif ct==4:
a="WW"
else:
print(-1)
break
else:
ct=ct+1
if ct==2:
a="SW"
elif ct==3:
a="WS"
elif ct==4:
a="WW"
else:
print(-1)
break |
s263210930 | p03814 | u565204025 | 2,000 | 262,144 | Wrong Answer | 41 | 3,816 | 225 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends with `Z`. | # -*- coding: utf-8 -*-
x = input()
a = 0
z = 0
for i in range(len(x)):
if x[i] == "A":
a = i
break
for i in range(len(x)):
if x[-(i+1)] == "Z":
z = len(x) - i
break
print(x[a:z])
| s634125035 | Accepted | 43 | 3,516 | 230 | # -*- coding: utf-8 -*-
x = input()
a = 0
z = 0
for i in range(len(x)):
if x[i] == "A":
a = i
break
for i in range(len(x)):
if x[-(i+1)] == "Z":
z = len(x) - i
break
print(len(x[a:z]))
|
s027068337 | p03814 | u191423660 | 2,000 | 262,144 | Wrong Answer | 59 | 3,816 | 179 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends with `Z`. | s = input()
k = s[::-1]
print(k)
for i in range(len(s)):
if s[i]=='Z':
z_num = i
if k[i]=='A':
a_num = i
ans = a_num + z_num + 2 - len(s)
print(ans)
| s824270412 | Accepted | 58 | 3,516 | 169 | s = input()
k = s[::-1]
for i in range(len(s)):
if s[i]=='Z':
z_num = i
if k[i]=='A':
a_num = i
ans = a_num + z_num + 2 - len(s)
print(ans)
|
s707527373 | p02606 | u425317134 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,168 | 174 | How many multiples of d are there among the integers between L and R (inclusive)? | import math
l, r, d = map(int, input().split())
if l % d == 0 or r % d == 0:
print(math.floor(r/d) - math.floor(r/d) + 1)
else:
print(math.floor(r/d) - math.floor(r/d)) | s510430650 | Accepted | 28 | 9,176 | 309 | import math
l, r, d = map(int, input().split())
if l % d == 0:
if r % d == 0:
print(math.floor(r/d) - math.floor(l/d) + 1)
else:
print(math.floor(r/d) - math.floor(l/d) + 1)
else:
if r % d == 0:
print(math.floor(r/d) - math.floor(l/d))
else:
print(math.floor(r/d) - math.floor(l/d))
|
s420871794 | p02401 | u726978687 | 1,000 | 131,072 | Wrong Answer | 20 | 5,656 | 608 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | import math
def solve(input_text):
for line in input_text:
op=line[1]
a=int(line[0])
b=int(line[2])
ans=0
if op=='+':
ans=a+b
if op=='-':
ans=a-b
if op=='*':
ans=a*b
if op == '/':
ans ==a/b
print(ans)
def answer():
input_text=[]
line=[]
while True:
line = input()
line= line.split(' ')
if line[1]=='?':
break
input_text.append(line)
solve(input_text)
if __name__ =='__main__':
answer()
| s472113917 | Accepted | 20 | 5,660 | 619 | import math
def solve(input_text):
for line in input_text:
op=line[1]
a=int(line[0])
b=int(line[2])
ans=0
if op=='+':
ans=a+b
if op=='-':
ans=a-b
if op=='*':
ans=a*b
if op == '/':
ans =math.floor(a/b)
print(ans)
def answer():
input_text=[]
line=[]
while True:
line = input()
line= line.split(' ')
if line[1]=='?':
break
input_text.append(line)
solve(input_text)
if __name__ =='__main__':
answer()
|
s591419314 | p03494 | u489959379 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 296 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n = int(input())
numbers = [int(i) for i in input().split()]
for i in range(0,n):
count = 0
while True:
for i in range(n):
if numbers[i] % 2 != 0:
break
else:
numbers[i] = int(numbers[i]) / 2
count += 1
print(count)
| s518961861 | Accepted | 305 | 20,336 | 366 | import sys
import numpy as np
from collections import Counter, deque
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(input())
A = np.array(list(map(int, input().split())))
res = 0
while not any(np.mod(A, 2)):
res += 1
A //= 2
print(res)
if __name__ == '__main__':
resolve()
|
s619705162 | p03352 | u247465867 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 278 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | #2019/10/03
X = int(open(0).read())
print(X)
max_exp=1
exp=0
for i in range(1,X+1):
# print("i", i)
for j in range(2,X+1):
# print("j", j)
exp = i**j
if exp > X:
break
if max_exp < exp:
max_exp = exp
print(max_exp) | s809159065 | Accepted | 18 | 2,940 | 279 | #2019/10/03
X = int(open(0).read())
#print(X)
max_exp=1
exp=0
for i in range(1,X+1):
# print("i", i)
for j in range(2,X+1):
# print("j", j)
exp = i**j
if exp > X:
break
if max_exp < exp:
max_exp = exp
print(max_exp) |
s574150315 | p03024 | u562400059 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 75 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S consisting of `o` and `x`. If the i-th character in S is `o`, it means that Takahashi won the match on the i-th day; if that character is `x`, it means that Takahashi lost the match on the i-th day. Print `YES` if there is a possibility that Takahashi can participate in the next tournament, and print `NO` if there is no such possibility. | S = input()
if S.count('o') >= 8:
print('YES')
else:
print('NO')
| s677821240 | Accepted | 19 | 2,940 | 104 | S = input()
15 - len(S)
if (15 - len(S)) + S.count('o') >= 8:
print('YES')
else:
print('NO')
|
s362848706 | p03469 | u493440568 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 42 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to `2018` and prints it. | S = str(input())
S.replace("2017", "2018") | s900071111 | Accepted | 18 | 2,940 | 33 | S = input()
print("2018" + S[4:]) |
s574863277 | p03719 | u135265051 | 2,000 | 262,144 | Wrong Answer | 28 | 9,152 | 132 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a = list(map(int,input().split()))
# b = list(map(int,input().split()))
if a[0]<=a[2]<=a[1]:
print("yes")
else:
print("No") | s527831005 | Accepted | 31 | 9,176 | 132 | a = list(map(int,input().split()))
# b = list(map(int,input().split()))
if a[0]<=a[2]<=a[1]:
print("Yes")
else:
print("No") |
s253811708 | p03731 | u859491652 | 2,000 | 262,144 | Wrong Answer | 131 | 26,708 | 440 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will push the switch while passing by the shower. The i-th person will push the switch t_i seconds after the first person pushes it. How long will the shower emit water in total? |
l = list(map(int, input().split()))
N = l[0]
T = l[1]
tl = list(map(int, input().split()))
bt = 0
gt = 0
for i, t in enumerate(tl):
if t - bt > T:
gt += T
else:
gt += t - bt
bt = t
print(str(gt)) | s813664877 | Accepted | 116 | 26,832 | 398 |
N,T = map(int, input().split())
tl = list(map(int, input().split()))
bt = 0
gt = T
for t in tl[1:]:
if t - bt > T:
gt += T
else:
gt += t - bt
bt = t
print(str(gt)) |
s547277012 | p03386 | u201234972 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 160 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | A, B, K = map(int, input().split())
K = min(K,B-A+1)
S = set()
for i in range(K):
S.add(A + i)
for i in range(K):
S.add(B - i)
for x in S:
print(x) | s419430504 | Accepted | 17 | 3,060 | 179 | A, B, K = map(int, input().split())
K = min(K,B-A+1)
S = set()
for i in range(K):
S.add(A + i)
for i in range(K):
S.add(B - i)
L = sorted(list(S))
for x in L:
print(x) |
s747429154 | p03555 | u354918239 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 201 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | A = list(input())
B = list(input())
for i in range(3) :
if A[0] == B[2] and A[1] == B[1] and A[2] == B[0] :
print("Yes")
break
else :
print("No")
break
| s646219376 | Accepted | 17 | 2,940 | 137 | A = list(input())
B = list(input())
if A[0] == B[2] and A[1] == B[1] and A[2] == B[0] :
print("YES")
else :
print("NO")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.