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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s747550758 | p03469 | u987164499 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 32 | 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 col... | s = input()
print("2017"+s[4:]) | s829478567 | Accepted | 17 | 2,940 | 32 | s = input()
print("2018"+s[4:]) |
s886687853 | p03574 | u655761160 | 2,000 | 262,144 | Wrong Answer | 31 | 3,188 | 630 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | H, W = map(int, input().split(' '))
masu = [input() for i in range(H)]
dx = [1, 1, 0, -1, -1, -1, 0, 1]
dy = [0, -1, -1, -1, 0, 1, 1, 1]
ans = []
for i in range(H):
a = []
for j in range(W):
if (masu[i][j] == '#'):
a.append('#')
continue
cnt = 0
for d in range(len... | s759757899 | Accepted | 30 | 3,188 | 639 | H, W = map(int, input().split(' '))
masu = [input() for i in range(H)]
dx = [1, 1, 0, -1, -1, -1, 0, 1]
dy = [0, -1, -1, -1, 0, 1, 1, 1]
ans = []
for i in range(H):
a = []
for j in range(W):
if (masu[i][j] == '#'):
a.append('#')
continue
cnt = 0
for d in range(len... |
s506111437 | p03434 | u018976119 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 399 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | N=int(input())
numbers=list(map(int,input().split()))
for i in range(1,N):
for k in range(i):
if numbers[k]<numbers[i]:
temp=numbers[k]
numbers[k]=numbers[i]
numbers[i]=temp
break
print(numbers)
Alice=0
Bob=0
for i in range(N//2+N%2):
Alice+=numbers[2*i]
f... | s788709749 | Accepted | 17 | 3,060 | 232 | N=int(input())
numbers=list(map(int,input().split()))
new_numbers=sorted(numbers,reverse=True)
Alice=0
Bob=0
for i in range(N//2+N%2):
Alice+=new_numbers[2*i]
for i in range(N//2):
Bob+=new_numbers[2*i+1]
print(Alice-Bob)
|
s069697344 | p02255 | u614197626 | 1,000 | 131,072 | Wrong Answer | 20 | 7,724 | 275 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | def insertionSort(A,N):
print(A)
for i in range(1,N):
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)
N=int(input())
sl=input()
lis=list(map(int,sl.split()))
insertionSort(lis,N) | s879445152 | Accepted | 30 | 7,724 | 325 | def insertionSort(A,N):
for i in range(1,N):
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(str(A).replace(",",'').replace("[",'').replace("]",''))
N=int(input())
sl=input()
print(sl)
lis=list(map(int,sl.split()))
insertionSort(l... |
s107908770 | p03658 | u941884460 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 171 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | N,K = map(int,input().split())
num = [0]*N
tmp = input().split()
for i in range(N):
num[i] = int(tmp[i])
num.sort()
sum = 0
for j in range(K):
sum += num[j]
print(sum) | s629277212 | Accepted | 17 | 3,064 | 183 | N,K = map(int,input().split())
num = [0]*N
tmp = input().split()
for i in range(N):
num[i] = int(tmp[i])
num.sort(reverse=True)
sum = 0
for j in range(K):
sum += num[j]
print(sum) |
s127455135 | p03415 | u503228842 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | s1 = input()
s2 = input()
s3 = input()
ans = s1[0]+s1[1]+s2[2]
print(ans) | s988892774 | Accepted | 17 | 2,940 | 73 | s1 = input()
s2 = input()
s3 = input()
ans = s1[0]+s2[1]+s3[2]
print(ans) |
s430465637 | p03844 | u757030836 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 30 | 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. | print(input().replace(" ","")) | s627664446 | Accepted | 18 | 2,940 | 20 | print(eval(input())) |
s868570392 | p02742 | u098679988 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 145 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | x = list( map(int, input().split()) )
h = x[0]
w = x[1]
menseki = h*w/2
if h*w % 2 == 0:
print(int(menseki+1))
else:
print(int(menseki)) | s203608882 | Accepted | 18 | 3,060 | 205 | import sys
x = list( map(int, input().split()) )
h = x[0]
w = x[1]
if h == 1 or w == 1:
print(1)
sys.exit()
menseki = h*w//2
if h*w % 2 == 0:
print(menseki)
else:
print(int(menseki)+1)
|
s713193269 | p03494 | u878384274 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 141 | 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 = [int(A_i) for A_i in input().split()]
b = min(A_list)
counter=0
while b%2 ==0:
b /= 2
counter+=1
print(counter) | s653091305 | Accepted | 19 | 3,064 | 200 | def function(b):
counter=0
while b%2 ==0:
b /= 2
counter+=1
return counter
N=int(input())
A_list = [int(A_i) for A_i in input().split()]
B_list = min(map(function,A_list))
print(B_list) |
s852273623 | p03195 | u026788530 | 2,000 | 1,048,576 | Wrong Answer | 220 | 3,060 | 131 | There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i. You and Lunlun the dachshund alternately perform the following operation (starting from you): * Choose one or more apples from the tree and eat them. Here, the apples chosen a... | N=int(input())
c= True
for i in range(N):
if int(input()) % 2 ==0:
c =not(c)
if(c):
print("first")
else:
print("second") | s019489174 | Accepted | 189 | 3,060 | 144 | N= int(input())
c= True
for i in range(N):
if int(input()) % 2 == 1:
c = False
if c:
print("second")
else:
print("first")
|
s949642427 | p03795 | u581603131 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 65 | 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 ... | N = int(input())
import math
print(800*N - 200*(math.ceil(N/15))) | s229755287 | Accepted | 18 | 2,940 | 43 | N = int(input())
print(800*N - 200*(N//15)) |
s112578483 | p03351 | u556225812 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,060 | 156 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a, b, c, d = map(int, input().split())
if abs(a-c) <= d:
print('Yes')
else:
if abs(a-b) <= d and abs(a-c) <= d:
print('Yes')
else:
print('No') | s133348338 | Accepted | 18 | 2,940 | 157 | a, b, c, d = map(int, input().split())
if abs(a-c) <= d:
print('Yes')
else:
if abs(a-b) <= d and abs(b-c) <= d:
print('Yes')
else:
print('No')
|
s749249875 | p02256 | u428229577 | 1,000 | 131,072 | Wrong Answer | 30 | 7,664 | 138 | Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_ | natural = list(map(int, input().split()))
natural.sort
x = natural[1]
y = natural[0]
while (y != 0):
x, y = y, x % y
print(x,y)
print(x) | s028364639 | Accepted | 20 | 7,628 | 126 | natural = list(map(int, input().split()))
natural.sort
x = natural[1]
y = natural[0]
while (y != 0):
x, y = y, x % y
print(x) |
s145373547 | p03796 | u655975843 | 2,000 | 262,144 | Wrong Answer | 34 | 2,940 | 103 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | n = int(input())
mod = 10 ** 9 + 7
ans = 0
for i in range(1, n + 1):
ans *= i
ans %= mod
print(ans) | s525725198 | Accepted | 41 | 2,940 | 103 | n = int(input())
mod = 10 ** 9 + 7
ans = 1
for i in range(1, n + 1):
ans *= i
ans %= mod
print(ans) |
s650888891 | p03351 | u603234915 | 2,000 | 1,048,576 | Wrong Answer | 174 | 13,480 | 220 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | import numpy as np
a,b,c,d = (int(i) for i in input().split())
if np.abs(a - c) < d:
print('YES')
elif a < b < c and c-a < 2*d:
print('YES')
elif c < b < a and a-c < 2*d:
print('YES')
else :
print('NO') | s666369785 | Accepted | 150 | 12,500 | 225 | import numpy as np
a,b,c,d = (int(i) for i in input().split())
if np.abs(a - c) <= d:
print('Yes')
elif a <= b <= c and c-a < 2*d:
print('Yes')
elif c <= b <= a and a-c < 2*d:
print('Yes')
else :
print('No') |
s851655119 | p03050 | u663230781 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 2,940 | 182 | Snuke received a positive integer N from Takahashi. A positive integer m is called a _favorite number_ when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod m holds. Find all favorite numbers and print the sum of those. | n = int(input().rstrip())
total = 0
for number in range(2, n):
remain = n - number
x, y = divmod(remain, number)
if y == 0 and x > number:
total += x
print(total)
| s391318159 | Accepted | 112 | 3,068 | 494 | from math import sqrt
def main():
n = int(input().rstrip())
sqrt_n = int(sqrt(n))
total = 0
for number in range(1,sqrt_n + 1):
if n % number > 0:
continue
remain = n - number
x, y = divmod(remain, number)
#print(x, y, remain, number)
if y == 0 and x >... |
s765135399 | p03471 | u557282438 | 2,000 | 262,144 | Wrong Answer | 2,104 | 2,940 | 250 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | n,y = map(int,input().split())
res = [-1,-1,-1]
for i in range(n):
for j in range(n-i):
for k in range(n-i-j):
if(10000*i + 5000*j + 1000*k == y):
res = [i,j,k]
break
print(res) | s972344502 | Accepted | 708 | 3,060 | 222 | n,y = map(int,input().split())
res = [-1,-1,-1]
for i in range(n+1):
for j in range(n-i+1):
if(10000*i + 5000*j + 1000*(n-i-j) == y):
res = [i,j,n-i-j]
break
print(*res) |
s901225476 | p03829 | u103902792 | 2,000 | 262,144 | Wrong Answer | 98 | 14,252 | 170 | There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the... | n,a,b = map(int,input().split())
towns = list(map(int,input().split()))
fatigue = 0
for i in range(n-1):
d = towns[i+1] -towns[i]
fatigue = max(d*a,b)
print(fatigue) | s581321193 | Accepted | 100 | 14,252 | 173 | n,a,b = map(int,input().split())
towns = list(map(int,input().split()))
fatigue = 0
for i in range(n-1):
d = towns[i+1] -towns[i]
fatigue += min(d*a,b)
print(fatigue)
|
s782582450 | p02606 | u211496288 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,012 | 122 | How many multiples of d are there among the integers between L and R (inclusive)? | L, R, d = map(int, input().split())
count = 0
for i in range(L, R + 1):
if i // d == 0:
count += 1
print(count) | s270657933 | Accepted | 31 | 9,096 | 121 | L, R, d = map(int, input().split())
count = 0
for i in range(L, R + 1):
if i % d == 0:
count += 1
print(count) |
s731481848 | p03152 | u017810624 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,188 | 170 | Consider writing each of the integers from 1 to N \times M in a grid with N rows and M columns, without duplicates. Takahashi thinks it is not fun enough, and he will write the numbers under the following conditions: * The largest among the values in the i-th row (1 \leq i \leq N) is A_i. * The largest among the v... | n,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if len(set(a))!=len(a) or len(set(b))!=len(b):
print(0)
else:
print(-1) | s270597541 | Accepted | 603 | 3,316 | 208 | s,a,b=[set(map(int,input().split()))for j in[0]*3];c=1;N=M=0;x=max(a)
for k in range(x,0,-1):
A=k in a;B=k in b
if A and B:M+=1;N+=1
elif A:c*=M;N+=1
elif B:c*=N;M+=1
else:c*=M*N-x+k
c%=10**9+7
print(c) |
s757149390 | p03524 | u706414019 | 2,000 | 262,144 | Wrong Answer | 35 | 9,392 | 129 | 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. | import collections
A = input()
Ac = collections.Counter(A)
maxA = max(Ac.values())
print('Yes' if maxA<=(len(A)+2)/3 else 'No')
| s128149562 | Accepted | 37 | 9,384 | 129 | import collections
A = input()
Ac = collections.Counter(A)
maxA = max(Ac.values())
print('YES' if maxA<=(len(A)+2)/3 else 'NO')
|
s540092700 | p02267 | u822165491 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 178 | You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S. | def main():
n = int(input())
S = [int(i) for i in input().split()]
q = int(input())
T = [int(i) for i in input().split()]
return len(set(S) & set(T))
main()
| s722518376 | Accepted | 20 | 6,504 | 178 | def main():
n = int(input())
S = [int(i) for i in input().split()]
q = int(input())
T = [int(i) for i in input().split()]
print(len(set(S) & set(T)))
main()
|
s172720717 | p03759 | u089376182 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 72 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b, c = map(int, input().split())
print('Yes' if b-a == c-b else 'No') | s339335469 | Accepted | 17 | 2,940 | 72 | a, b, c = map(int, input().split())
print('YES' if b-a == c-b else 'NO') |
s950735520 | p03997 | u546573715 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int (input())
print((a+b)*h/2) | s121399181 | Accepted | 18 | 2,940 | 74 | a = int(input())
b = int(input())
h = int (input())
print(int((a+b)*h/2)) |
s912526547 | p03150 | u993642190 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 180 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | def main() :
S = input()
remove_len = len(S) - 7
for i in range(len(S) - remove_len) :
s = S[i:i+7]
if (s == "keyence") :
print("YES")
return
print("NO")
main() | s578888770 | Accepted | 17 | 2,940 | 214 | def main() :
S = input()
remove_len = len(S) - 7
for i in range(len(S) - remove_len) :
s = S[0:i] + S[i+remove_len:]
if (s == "keyence") :
print("YES")
return
print("NO")
main() |
s984899537 | p03693 | u401487574 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | 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 i... | r,g,b = map(int,input().split())
if g*10+b %4==0:
print("YES")
else:
print("NO")
| s878739242 | Accepted | 17 | 2,940 | 91 | r,g,b = map(int,input().split())
if (g*10+b )%4==0:
print("YES")
else:
print("NO")
|
s629523209 | p02612 | u457901067 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,152 | 24 | 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. | print(int(input())%1000) | s037243950 | Accepted | 29 | 8,892 | 47 | N = int(input())
print((1000 - N%1000) % 1000)
|
s839464185 | p03089 | u934442292 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,064 | 586 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | import sys
input = sys.stdin.readline # NOQA
sys.setrecursionlimit(10 ** 7) # NOQA
def dfs(N, a, i, b):
if i == N + 1:
if a == b:
return a
else:
return None
i += 1
for j in range(1, i):
A = a[:]
A.insert(j-1, j)
res = dfs(N, A, i, b)
... | s408810048 | Accepted | 29 | 9,160 | 530 | import sys
input = sys.stdin.readline
def main():
N = int(input())
B = list(map(int, input().split()))
is_ok = True
for i, b in enumerate(B, 1):
if i < b:
is_ok = False
if not is_ok:
print(-1)
exit()
ans = []
for _ in range(N):
for i in revers... |
s195670570 | p03479 | u047816928 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 77 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl... | A, Y = map(int, input().split())
ans = 0
while A<=Y:
ans+=1
A*=2
print(A) | s300361820 | Accepted | 17 | 2,940 | 79 | A, Y = map(int, input().split())
ans = 0
while A<=Y:
ans+=1
A*=2
print(ans) |
s434728862 | p02388 | u623827446 | 1,000 | 131,072 | Wrong Answer | 30 | 7,392 | 20 | Write a program which calculates the cube of a given integer x. | x=input()
print(x*3) | s292851149 | Accepted | 20 | 7,516 | 28 | x = int(input())
print(x**3) |
s574881251 | p03737 | u163892325 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 131 | 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. | a = input()
b1 = list(a[0])
b2 = list(a[1])
b3 = list(a[2])
p1 = b1[0]
p2 = b2[0]
p3 = b3[0]
k =""
k += p1 +p2 +p3
print(k.upper()) | s265297016 | Accepted | 18 | 3,060 | 139 | a = input().split()
b1 = list(a[0])
b2 = list(a[1])
b3 = list(a[2])
p1 = b1[0]
p2 = b2[0]
p3 = b3[0]
k =""
k += p1 +p2 +p3
print(k.upper()) |
s219352406 | p03162 | u407784088 | 2,000 | 1,048,576 | Wrong Answer | 824 | 31,400 | 397 | Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain... | import numpy as np
N = int(input())
a = np.zeros((N,3))
for i in range(N):
a[i][0],a[i][1],a[i][2] = map(int,input().split())
memo = np.zeros((N,3))
memo[0][0], memo[0][1], memo[0][2] = a[0][0],a[0][1],a[0][2]
day = 1
while (day < N):
memo[day] = [max(memo[day-1][(x+1)%3],memo[day-1][(x+2)%3]) + a[day][x] \... | s438500070 | Accepted | 780 | 31,156 | 402 | import numpy as np
N = int(input())
a = np.zeros((N,3))
for i in range(N):
a[i][0],a[i][1],a[i][2] = map(int,input().split())
memo = np.zeros((N,3))
memo[0][0], memo[0][1], memo[0][2] = a[0][0],a[0][1],a[0][2]
day = 1
while (day < N):
memo[day] = [max(memo[day-1][(x+1)%3],memo[day-1][(x+2)%3]) + a[day][x] \... |
s906713296 | p02402 | u253463900 | 1,000 | 131,072 | Wrong Answer | 30 | 7,560 | 75 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | input()
d = [int(x) for x in input().split()]
print(max(d), min(d), sum(d)) | s978707564 | Accepted | 20 | 8,648 | 75 | input()
d = [int(x) for x in input().split()]
print(min(d), max(d), sum(d)) |
s021069704 | p03377 | u760831084 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a, b, x = map(int, input().split())
print('Yes' if a <= x <= a + b else 'No') | s928433828 | Accepted | 16 | 2,940 | 77 | a, b, x = map(int, input().split())
print('YES' if a <= x <= a + b else 'NO') |
s652431569 | p03477 | u761320129 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | A,B,C,D = map(int,input().split())
if A+B < C+D:
print('Left')
elif A+B == C+D:
print('Balanced')
else:
print('Right')
| s955628086 | Accepted | 16 | 2,940 | 119 | a,b,c,d = map(int,input().split())
if a+b>c+d:
print('Left')
elif a+b<c+d:
print('Right')
else:
print('Balanced') |
s715949544 | p02608 | u950825280 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,206 | 8,956 | 634 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | N = int(input())
def f(a, b, c):
return a**2 + b**2 + c**2 + a*b + b*c + c*a
for i in range(1, N+1):
if i < 6:
print(0)
else:
x, y, z = 0, 0, 0
ans = 0
while True:
x += 1
y = 0
z = 0
if f(x,y,z) > i:
break
... | s026115925 | Accepted | 845 | 9,112 | 301 | N = int(input())
def f(a, b, c):
return a**2 + b**2 + c**2 + a*b + b*c + c*a
ans = [0] * N
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
n = f(x,y,z)
if n <= N:
ans[n-1] += 1
for a in ans:
print(a)
|
s930995718 | p03997 | u799164835 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print(str((a + b)*h/2))
| s393189159 | Accepted | 18 | 3,060 | 563 |
GBN_DEBUG = False
def dprn(s, i):
if GBN_DEBUG: print(", " + s + " = " + str(i), end = "")
def dprns(s):
if GBN_DEBUG: print(", " + s, end = "")
def dprni(i):
if GBN_DEBUG: print(i, end=" ")
def endl():
if GBN_DEBUG: print('')
def puts(s): print(s)
#S = input()
#N = int(input())
#S, T = input().spl... |
s856636034 | p04043 | u389188163 | 2,000 | 262,144 | Wrong Answer | 26 | 9,020 | 123 | 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 ... | A, B, C = list(map(int, input().split()))
s = A, B, C
print('Yes') if s.count(5) == 2 and s.count(7) == 1 else print('No') | s110509079 | Accepted | 26 | 9,124 | 117 | A, B, C = map(int, input().split())
s = A, B, C
print('YES') if s.count(5) == 2 and s.count(7) == 1 else print('NO') |
s037987226 | p03418 | u952708174 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 605 | Takahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten. He remembers that the remainder of a divided by b was greater than or equal to K. Find the number of possible pairs that he may have had. | def d_remainder_reminder(N, K):
ans = 0
for b in range(K + 1, N + 1):
p = N // b
r = N % b
ans += p * max(0, b - K) + max(0, r + 1 - K)
if K == 0:
ans -= N
return ans | s669884052 | Accepted | 82 | 3,060 | 680 | def d_remainder_reminder(N, K):
ans = 0
for b in range(K + 1, N + 1):
p = N // b
r = N % b
ans += p * max(0, b - K) + max(0, r + 1 - K)
if K == 0:
ans -= N
return ans
N,K = [int(i) for i in input().split()]
print(d_remainder_r... |
s430141259 | p02612 | u938785734 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,140 | 28 | 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. | n=int(input())
print(1000-n) | s204835127 | Accepted | 31 | 9,152 | 61 | n=int(input())
sen=1000
while sen<n:
sen+=1000
print(sen-n) |
s046576528 | p03696 | u977193988 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 512 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | import sys
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
def main():
N = int(input())
S = list(input())
answer = ""
cnt = 0
for s in S:
if s == "(":
cnt += 1
answer += "("
else:
if cnt > 0:
... | s087761500 | Accepted | 18 | 3,064 | 734 | import sys
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
def main():
N = int(input())
S = list(input())
answer = ""
right = 0
left = 0
for s in S:
if s == "(":
if right > 0:
answer = "(" * right + answer
... |
s355569135 | p02850 | u979684411 | 2,000 | 1,048,576 | Wrong Answer | 2,105 | 42,460 | 771 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different. Among the colo... | N = int(input())
palette = [1]
colors = [None] * N
edges = [None] * N
ends = {}
for i in range(1,N):
edges[i] = [int(n) for n in input().split()]
for i in range(1,N):
a, b = edges[i]
if a not in ends:
ends[a] = [i]
else:
ends[a].append(i)
if b not in ends:
ends[b] = [i]
... | s954188595 | Accepted | 857 | 99,764 | 1,298 | import sys
sys.setrecursionlimit(100000)
N = int(input())
palette = 1
colors = {}
ends = {}
edges = {}
for edge in range(1,N):
ends[edge] = [int(n) for n in input().split()]
a, b = ends[edge]
if a not in edges:
edges[a] = [edge]
else:
edges[a].append(edge)
if b not in edges:
... |
s189279999 | p03729 | u363610900 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 139 | 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 `Y... | def func():
A, B, C = input().split()
result = 'Yes' if A[-1] == B[0] and B[-1] == C[0] else 'No'
return result
print(func())
| s179898178 | Accepted | 18 | 2,940 | 83 | A, B, C = input().split()
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO') |
s434583771 | p03814 | u344959959 | 2,000 | 262,144 | Wrong Answer | 39 | 9,132 | 202 | 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 w... | a = input()
for i in range(len(a)):
if a[i] == "A":
b = i
print(b)
break
for j in range(len(a)):
if a[j] == "Z":
c = j
print(c)
break
print(c-b+1) | s086510311 | Accepted | 46 | 9,176 | 155 | a = input()
for i in range(len(a)):
if a[i] == "A":
b = i
break
for j in range(len(a)):
if a[j] == "Z":
c = j
print(c-b+1)
|
s234474083 | p03379 | u947823593 | 2,000 | 262,144 | Wrong Answer | 215 | 25,556 | 334 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | def solve(N, A):
c = int(N / 2)
left = A[c - 1]
right = A[c]
for x in range(c - 1):
print(left)
print(right)
print(left)
for x in range(c + 1, N):
print(right)
if __name__ == "__main__":
N = int(input())
A = list(map(lambda x: int(x), input().split()))
... | s492003249 | Accepted | 387 | 26,772 | 431 | def solve(N, A):
c = int(N / 2)
left = sorted(A)[c - 1]
right = sorted(A)[c]
if left == right:
for x in range(N):
print(left)
return;
for x in range(N):
if A[x] <= left:
print(right)
if A[x] >= right:
print(left)
if __n... |
s353007844 | p04045 | u887207211 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 162 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | N, K = map(int,input().split())
D = list(map(int,input().split()))
while True:
for n in str(N):
if(n in D):
break
else:
break
N += 1
print(N) | s578816511 | Accepted | 51 | 2,940 | 147 | N, K = map(int,input().split())
D = input().split()
while True:
for n in str(N):
if(n in D):
break
else:
break
N += 1
print(N) |
s936970447 | p03611 | u220345792 | 2,000 | 262,144 | Wrong Answer | 2,104 | 13,964 | 212 | You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices. | N = int(input())
A = list(map(int, input().split()))
all_data = list(set(A))
num = 0
for i in all_data:
tmp = all_data.count(i) + all_data.count(i+1) + all_data.count(i-1)
num = max(num, tmp)
print(num) | s297214217 | Accepted | 79 | 13,964 | 155 | N = int(input())
A = list(map(int, input().split()))
ans = [0]*(100000+2)
for i in A:
ans[i-1] += 1
ans[i] += 1
ans[i+1] += 1
print(max(ans))
|
s969723206 | p03637 | u898058223 | 2,000 | 262,144 | Wrong Answer | 78 | 14,228 | 297 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | n=int(input())
a=list(map(int,input().split()))
cnt_odd=0
cnt_even=0
cnt_4=0
for i in range(n):
if a[i]%2!=0:
cnt_odd+=1
else:
cnt_even+=1
if a[i]%4==0:
cnt_4+=1
if n%2!=1 and cnt_odd-1<=cnt_4:
print("Yes")
elif n%2==0 and cnt_odd<=cnt_4:
print("Yes")
else:
print("No") | s834287677 | Accepted | 76 | 14,252 | 337 | n=int(input())
a=list(map(int,input().split()))
cnt_odd=0
cnt_even=0
cnt_4=0
for i in range(n):
if a[i]%2!=0:
cnt_odd+=1
else:
cnt_even+=1
if a[i]%4==0:
cnt_4+=1
if cnt_even-cnt_4==0:
if cnt_4+1>=cnt_odd:
print("Yes")
else:
print("No")
else:
if cnt_4>=cnt_odd:
print("Yes")
else... |
s808357698 | p03447 | u521866787 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | x,a,b = (int(input(i)) for i in range(3))
print((x-a) % b )
| s694387044 | Accepted | 17 | 2,940 | 60 | x,a,b = (int(input()) for i in range(3))
print((x-a) % b )
|
s146383350 | p03568 | u409064224 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 200 | We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are _similar_ when |x_i - y_i| \leq 1 holds for all i (1 \leq i \leq N). In particular, any integer sequence is similar to itself. You are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N. How man... | n = int(input())
a = list(map(int,input().split()))
print(a)
o = 1
for i in range(len(a)):
if a[i]%2 == 1:
#odd
o *= 1
else:
#even
o *= 2
print(3**len(a)-o)
| s455522978 | Accepted | 17 | 2,940 | 191 | n = int(input())
a = list(map(int,input().split()))
o = 1
for i in range(len(a)):
if a[i]%2 == 1:
#odd
o *= 1
else:
#even
o *= 2
print(3**len(a)-o)
|
s478056846 | p02831 | u106181248 | 2,000 | 1,048,576 | Wrong Answer | 38 | 5,304 | 75 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ... | from fractions import gcd
a,b = map(int,input().split())
print(gcd(a, b)) | s485312557 | Accepted | 17 | 2,940 | 160 | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd (a, b)
a,b = map(int,input().split())
print(lcm(a, b)) |
s209803297 | p03574 | u268318377 | 2,000 | 262,144 | Wrong Answer | 29 | 3,188 | 358 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | H,W = map(int, input().split())
S = []
for _ in range(H):
S.append([s for s in input()])
for h in range(H):
for w in range(W):
if S[h][w] == ".":
a = 0
for x in [-1, 0, 1]:
for y in [-1, 0, 1]:
if 0 <= h+x < H and 0 <= w+y < W:
if S[h+x][w+y] == "#":
a +... | s658853057 | Accepted | 29 | 3,188 | 389 | H,W = map(int, input().split())
S = []
for _ in range(H):
S.append([s for s in input()])
for h in range(H):
for w in range(W):
if S[h][w] == ".":
a = 0
for x in [-1, 0, 1]:
for y in [-1, 0, 1]:
if 0 <= h+x < H and 0 <= w+y < W:
if S[h+x][w+y] == "#":
a +... |
s626619088 | p03477 | u536717874 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 278 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | # coding: utf-8
import sys
def main(argv=sys.argv):
a, b, c, d = map(int, input().split(' '))
if a + b > c + d:
print('left')
elif a + b < c + d:
print('Right')
else:
print('Balanced')
return 0
if __name__ == '__main__':
sys.exit(main()) | s471865720 | Accepted | 18 | 3,060 | 278 | # coding: utf-8
import sys
def main(argv=sys.argv):
a, b, c, d = map(int, input().split(' '))
if a + b > c + d:
print('Left')
elif a + b < c + d:
print('Right')
else:
print('Balanced')
return 0
if __name__ == '__main__':
sys.exit(main()) |
s493371011 | p03943 | u016393440 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 125 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a = [int(i) for i in input().split()]
a.sort()
if int(a[0]) + int(a[1]) == int(a[2]):
print('YES')
else:
print('NO')
| s753618084 | Accepted | 18 | 2,940 | 125 | a = [int(i) for i in input().split()]
a.sort()
if int(a[0]) + int(a[1]) == int(a[2]):
print('Yes')
else:
print('No')
|
s376405799 | p02286 | u167493070 | 2,000 | 262,144 | Wrong Answer | 20 | 5,624 | 2,462 | A binary search tree can be unbalanced depending on features of data. For example, if we insert $n$ elements into a binary search tree in ascending order, the tree become a list, leading to long search times. One of strategies is to randomly shuffle the elements to be inserted. However, we should consider to maintain t... | class node:
def __init__(self,key,pri,left=None,right=None):
self.left = left
self.right = right
self.key = key
self.pri = pri
def insert(n,key,pri):
if(n == None):
return node(key,pri)
if(key == n.key):
return n
if(key < n.key):
n.left = insert(n... | s067197239 | Accepted | 5,830 | 52,028 | 2,529 | class node:
def __init__(self,key,pri,left=None,right=None):
self.left = left
self.right = right
self.key = key
self.pri = pri
def insert(n,key,pri):
if(n == None):
return node(key,pri)
if(key == n.key):
return n
if(key < n.key):
n.left = insert(n... |
s995913201 | p03827 | u469953228 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 139 | 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 duri... | n=int(input())
s=input()
x=0
maximum=0
for i in range(n):
if s[i]=="I":
x+=1
else:
x-=0
maximum=max(x,maximum)
print(maximum) | s534634447 | Accepted | 17 | 2,940 | 139 | n=int(input())
s=input()
x=0
maximum=0
for i in range(n):
if s[i]=="I":
x+=1
else:
x-=1
maximum=max(x,maximum)
print(maximum) |
s115943767 | p03543 | u980492406 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | N = input()
for i in range(0,10) :
if N.count('i') >= 3 :
print('Yes')
else :
print('No') | s016167006 | Accepted | 17 | 2,940 | 99 | n = list(input())
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] :
print('Yes')
else :
print('No') |
s456288158 | p03943 | u243159381 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 110 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a,b,c=(int(x) for x in input().split())
if a+b==c or b+c==a or c+a==b:
print('YES')
else:
print('NO')
| s547761398 | Accepted | 18 | 2,940 | 110 | a,b,c=(int(x) for x in input().split())
if a+b==c or b+c==a or c+a==b:
print('Yes')
else:
print('No')
|
s926994366 | p03360 | u023229441 | 2,000 | 262,144 | Wrong Answer | 27 | 9,084 | 84 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a,b,c=map(int,input().split())
n=int(input())
a,b,c= sorted([a,b,c])
print(a+b+c*n) | s987007968 | Accepted | 26 | 9,148 | 88 | a,b,c=map(int,input().split())
n=int(input())
a,b,c= sorted([a,b,c])
print(a+b+c*2**n)
|
s554622369 | p02842 | u008357982 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 90 | 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).... | n = int(input())
x = -(-n // 1.08)
if int(x * 1.08) == n:
print(1)
else:
print(0)
| s672223542 | Accepted | 17 | 2,940 | 98 | n = int(input())
x = -(-n // 1.08)
if int(x * 1.08) == n:
print(int(x))
else:
print(':(')
|
s821241393 | p03693 | u855057563 | 2,000 | 262,144 | Wrong Answer | 27 | 9,136 | 81 | 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 i... | r,g,b=input().split()
n=int(r+g+b)
if n%4==0:
print("Yes")
else:
print("No")
| s704823335 | Accepted | 25 | 9,008 | 82 | r,g,b=input().split()
n=int(r+g+b)
if n%4==0:
print("YES")
else:
print("NO")
|
s768495354 | p03759 | u629350026 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 82 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a,b,c=map(int,input().split())
if (b-a)==(c-b):
print("Yes")
else:
print("No") | s947173897 | Accepted | 17 | 2,940 | 82 | a,b,c=map(int,input().split())
if (b-a)==(c-b):
print("YES")
else:
print("NO") |
s567661446 | p02402 | u613534067 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 74 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | input()
a = list(map(int, input().split()))
print(max(a), min(a), sum(a))
| s904170755 | Accepted | 20 | 6,544 | 74 | input()
a = list(map(int, input().split()))
print(min(a), max(a), sum(a))
|
s934026344 | p03352 | u201802797 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,068 | 197 | 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. | # solution
import io
nim = int(input())
mike = 1
for i in range(2,(nim+1)//2):
kite = 0
counter = 0
while kite <= nim:
m = max(mike,kite)
kite = i**counter
counter+=1
print(mike) | s979374789 | Accepted | 17 | 2,940 | 151 | # solution
data=int(input())
array=[]
for i in range(1,34):
for j in range(2,11):
if (i**j)<=data:
array.append(i**j)
print(max(array)) |
s398686144 | p03636 | u236460988 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | 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. | s = input()
print( s[0] + str(len(s)-1) + s[-1] ) | s712780156 | Accepted | 17 | 2,940 | 50 | s = input()
print( s[0] + str(len(s)-2) + s[-1] ) |
s564558994 | p02842 | u635540732 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 100 | 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).... | n=int(input())
x=n//1.08
if x%1==0:
print(x)
elif (x+1)*1.08-n<1:
print(x+1)
else:
print(':(') | s376841072 | Accepted | 17 | 3,060 | 118 | n=int(input())
x=n/1.08
if x%1==0:
print(int(x))
elif int((int(x)+1)*1.08)==n:
print(int(x)+1)
else:
print(':(') |
s390259299 | p03048 | u277312083 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,126 | 9,120 | 195 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | R, G, B, N = map(int, input().split())
ans = 0
for r in range(3001):
for g in range(3001):
v = R * r + G * g
if N >= v and (N - v) % B == 0:
ans += 1
print(ans)
| s739152856 | Accepted | 1,995 | 9,116 | 270 | R, G, B, N = map(int, input().split())
ans = 0
for r in range(min(3000, 3000 // R) + 1):
if R * r <= N:
for g in range(min(3000, 3000 // G) + 1):
v = R * r + G * g
if N >= v and (N - v) % B == 0:
ans += 1
print(ans)
|
s236296686 | p01132 | u506554532 | 8,000 | 131,072 | Wrong Answer | 4,300 | 5,624 | 832 | Mr. Bill は店で買い物をしている。 彼の財布にはいくらかの硬貨(10 円玉、50 円玉、100 円玉、500 円玉)が入っているが、彼は今この小銭をできるだけ消費しようとしている。 つまり、適切な枚数の硬貨によって品物の代金を払うことで、釣り銭を受け取った後における硬貨の合計枚数を最小にしようとしている。 幸いなことに、この店の店員はとても律儀かつ親切であるため、釣り銭は常に最適な方法で渡される。 したがって、例えば 1 枚の 500 円玉の代わりに 5 枚の 100 円玉が渡されるようなことはない。 また、例えば 10 円玉を 5 枚出して、50 円玉を釣り銭として受け取ることもできる。 ただし、出した硬貨と同じ種類の硬... | def calc(c1,c2,c3,c4):
return c1*10 + c2*50 + c3*100 + c4*500
def coindiff(p,c1,c2,c3,c4):
n = c1+c2+c3+c4
over = calc(c1,c2,c3,c4) - p
n -= (over%50) // 10
n -= (over%100) // 50
n -= (over%500) // 100
n -= over // 500
return n
while True:
N = int(input())
if N == 0: break
... | s601285565 | Accepted | 100 | 5,620 | 498 | first = True
while True:
P = int(input())
if P== 0: break
if first:
first = False
else:
print('')
c1,c2,c3,c4 = map(int,input().split())
v = c1*10 + c2*50 + c3*100 + c4*500
n = c1 + c2 + c3 + c4
ans = {}
rem = v - P
ans[10] = c1 - (rem//10) % 5
ans[50] = c2 - ... |
s659268644 | p02795 | u269724549 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 74 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | h=int(input())
n=int(input())
w=int(input())
print(w+max(h,n)-1//max(h,n)) | s790894341 | Accepted | 17 | 2,940 | 74 | h=int(input())
n=int(input())
w=int(input())
v=max(h,n)
print((w+v-1)//v)
|
s558843367 | p03695 | u107077660 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 179 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | from collections import Counter
N = input()
c = Counter([int(i)//400 for i in input().split()])
print(c)
ans = 0
for i in range(8):
ans += bool(c[i])
print(max(ans,1),ans+c[8]) | s493157591 | Accepted | 20 | 3,316 | 171 | from collections import Counter
input()
c = Counter([min(int(i)//400,8) for i in input().split()])
ans = 0
for i in range(8):
ans += bool(c[i])
print(max(ans,1),ans+c[8]) |
s804374420 | p03640 | u489124637 | 2,000 | 262,144 | Wrong Answer | 28 | 4,340 | 617 | We have a grid with H rows and W columns of squares. Snuke is painting these squares in colors 1, 2, ..., N. Here, the following conditions should be satisfied: * For each i (1 ≤ i ≤ N), there are exactly a_i squares painted in Color i. Here, a_1 + a_2 + ... + a_N = H W. * For each i (1 ≤ i ≤ N), the squares paint... | from collections import deque
import itertools
H , W = map(int,input().split())
N = int(input())
a = list(map(int,input().split()))
acu = [0] + list(itertools.accumulate(a))
ans = [[0] * W for _ in range(H)]
cnt = 1
jdg = 1
for h in range(H):
if h % 2 == 1:
for w in range(W):
ans[... | s201653966 | Accepted | 30 | 4,596 | 644 | from collections import deque
import itertools
H , W = map(int,input().split())
N = int(input())
a = list(map(int,input().split()))
acu = [0] + list(itertools.accumulate(a))
ans = [[0] * W for _ in range(H)]
cnt = 1
jdg = 1
for h in range(H):
if h % 2 == 1:
for w in range(W):
ans[... |
s233258086 | p03597 | u121732701 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 45 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | N = int(input())
A = int(input())
print(N-A) | s546359007 | Accepted | 18 | 2,940 | 47 | N = int(input())
A = int(input())
print(N*N-A) |
s642040577 | p03480 | u227082700 | 2,000 | 262,144 | Wrong Answer | 68 | 3,316 | 111 | You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis... | s=input()
ans=len(s)
for i in range(len(s)-1):
if s[i]!=s[i+1]:
ans=min(ans,min(i+1,len(s)-i))
print(ans) | s219494818 | Accepted | 72 | 3,188 | 113 | s=input()
ans=len(s)
for i in range(len(s)-1):
if s[i]!=s[i+1]:
ans=min(ans,max(i+1,len(s)-i-1))
print(ans) |
s322236537 | p03556 | u887207211 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | N = int(input())
print((int(N**(0.5))-1)**2)
| s493012329 | Accepted | 17 | 3,060 | 38 | N = int(input())
print(int(N**0.5)**2) |
s454916717 | p03369 | u901687869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | money = 700
tp = input()
for s in tp:
if(s == "○"):
money += 100
print(money) | s277399511 | Accepted | 17 | 2,940 | 86 | money = 700
tp = input()
for s in tp:
if(s == "o"):
money += 100
print(money) |
s148627676 | p03470 | u747427153 | 2,000 | 262,144 | Wrong Answer | 27 | 9,188 | 162 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | n = int(input())
l = []
for i in range(n):
s0 = int(input())
l.append(s0)
l.sort()
ans = 1
for i in range(1,n-1):
if l[i] != l[i-1]:
ans += 1
print(ans) | s038772989 | Accepted | 25 | 9,176 | 160 | n = int(input())
l = []
for i in range(n):
s0 = int(input())
l.append(s0)
l.sort()
ans = 1
for i in range(1,n):
if l[i] > l[i-1]:
ans += 1
print(ans)
|
s247885261 | p03719 | u342869120 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 97 | 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 = map(int, input().split())
if b <= a and a <= c:
print("Yes")
else:
print("No")
| s612259878 | Accepted | 17 | 2,940 | 97 | a, b, c = map(int, input().split())
if a <= c and c <= b:
print("Yes")
else:
print("No")
|
s360320511 | p03379 | u814986259 | 2,000 | 262,144 | Wrong Answer | 591 | 40,632 | 205 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | N=int(input())
a=list(map(int,input().split()))
b=[[a[i],i] for i in range(N)]
b.sort()
ans=[b[N//2][0],b[(N//2) -1][0]]
for i in range(N):
if a[i] >= ans[1]:
print(ans[0])
else:
print(ans[1]) | s715055195 | Accepted | 321 | 26,772 | 172 | N=int(input())
a=list(map(int,input().split()))
b=sorted(a)
ans=[b[N//2],b[(N//2) -1]]
for i in range(N):
if a[i] >= ans[0]:
print(ans[1])
else:
print(ans[0])
|
s585642446 | p02418 | u009288816 | 1,000 | 131,072 | Wrong Answer | 20 | 5,560 | 422 | Write a program which finds a pattern $p$ in a ring shaped text $s$. | import sys
def rotate(x,n):
return x[n:]+x[:n]
def tostring(x):
res = ""
for i in range(0,len(x)):
res += x[i]
return res
def isavail(x,y):
for i in range(0,len(x)):
l = list(x)
l = x[:len(x)-1]
temp = tostring(rotate(l,i))
if temp.find(y) != -1:
... | s794009455 | Accepted | 20 | 5,564 | 168 | def ring(s, p):
t = list(s)
for i in range(len(s)):
if ''.join(s[i:] + s[:i]).find(p) > -1:
return 'Yes'
return 'No'
s = input()
p = input()
print(ring(s, p))
|
s175527928 | p03456 | u975997984 | 2,000 | 262,144 | Wrong Answer | 31 | 9,400 | 103 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | n = int(''.join(input().split()))
if isinstance(n ** 0.5, int):
print('Yes')
else:
print('No')
| s886612165 | Accepted | 29 | 9,340 | 101 | n = int(''.join(input().split()))
if int(n ** 0.5) ** 2 == n:
print('Yes')
else:
print('No')
|
s726830653 | p03999 | u543373102 | 2,000 | 262,144 | Wrong Answer | 24 | 9,148 | 106 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | S = input()
sn = len(S)
ans = 0
for i in range(1, sn+1-1):
ans += int(S[i]) + int(S[i:])
print(ans) | s809663569 | Accepted | 33 | 9,088 | 239 | S = input()
n = len(S)-1
ans = 0
for i in range(1 << n):
p = 0
for j in range(n):
if i >> j & 1 == 0:
continue
else:
ans += int(S[p:j+1])
p = j+1
ans += int(S[p:])
print(ans) |
s413628804 | p03474 | u590647174 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 352 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | def judge(S,A,B):
a = list(S)
front = a[:A]
back = a[A+1:]
for i in range(A):
if not type(front[i])==int:
print("No")
return
for j in range(B):
if not type(back[j])==int:
print("No")
return
if not a[A]=="-":
print("No")
return
print("Yes")
A,B = map(int,input().s... | s958823737 | Accepted | 17 | 3,064 | 425 | def judge(S,A,B):
a = list(S)
front = a[0:A]
back = a[A+1:A+B+1]
lst = ["0","1","2","3","4","5","6","7","8","9"]
for i in range(A):
if front[i] not in lst:
print("No")
return
for j in range(B):
if back[j] not in lst:
print("No")
return
if a[A]!="-"... |
s116646699 | p03352 | u918601425 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 265 | 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. | ls=[1,2,4,8,16,32,64,128,256,512,3,9,27,81,243,729,
25,125,625,36,216,49,343,100,1000,
121,144,169,196,225,289,324,361,400,
441,484,529,576,625,676,781,841,900,961,1001]
n=int(input())
for i in range(len(ls)):
if ls[i]>n:
print(ls[i-1])
break
| s825481332 | Accepted | 17 | 3,064 | 276 | ls=[1,2,4,8,16,32,64,128,256,512,3,9,27,81,243,729,
25,125,625,36,216,49,343,100,1000,
121,144,169,196,225,289,324,361,400,
441,484,529,576,625,676,781,841,900,961,1001]
ls.sort()
n=int(input())
for i in range(len(ls)):
if ls[i]>n:
print(ls[i-1])
break
|
s306742473 | p03759 | u339923489 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 136 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b, c =input("数字を入れよう").split(" ")
a=int(a)
b=int(b)
c=int(c)
if b - a == c - b:
print("YES")
else:
print("NO")
| s824739566 | Accepted | 20 | 3,316 | 96 | a, b, c =map(int, input().split(" "))
if b - a == c - b:
print("YES")
else:
print("NO")
|
s182016677 | p02393 | u661041240 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 62 | Write a program which reads three integers, and prints them in ascending order. | a, b, c = map(int, input().split())
print(sorted([a, b, c]))
| s591159140 | Accepted | 20 | 5,596 | 89 | l = list(map(int, input().split()))
l = sorted(l)
print('%d %d %d' % (l[0], l[1], l[2]))
|
s115031216 | p03478 | u194894739 | 2,000 | 262,144 | Wrong Answer | 28 | 2,940 | 193 | 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). | n, a, b = map(int,input().split())
ans = 0
for i in range(1, n + 1):
sum = 0
while i != 0:
sum += i % 10
i = i // 10
if a <= sum <= b:
ans += sum
print(ans)
| s805255424 | Accepted | 29 | 2,940 | 201 | n, a, b = map(int,input().split())
ans = 0
for i in range(1, n + 1):
sum = 0
j = i
while j != 0:
sum += j % 10
j = j // 10
if a <= sum <= b:
ans += i
print(ans)
|
s440300895 | p03860 | u550535134 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | 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 uppe... | A, s, C = input().split()
print(A+s[0]+C) | s989656242 | Accepted | 17 | 2,940 | 47 | A, s, C = input().split()
print(A[0]+s[0]+C[0]) |
s257279934 | p03469 | u541610817 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 38 | 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 col... | str = input()
str[3] == '7'
print(str) | s160880702 | Accepted | 18 | 2,940 | 126 | def solve():
_, m, d = input().split('/')
return '2018/' + m + '/' + d
if __name__ == '__main__':
print(solve())
|
s219306074 | p03377 | u111202730 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map(int, input().split())
if X <= B:
print('Yes')
else:
print('No')
| s204475783 | Accepted | 17 | 2,940 | 94 | A, B, X = map(int, input().split())
if A <= X <= A + B:
print('YES')
else:
print('NO') |
s146025637 | p03556 | u382639013 | 2,000 | 262,144 | Wrong Answer | 30 | 9,408 | 42 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | N = int(input())
print(int(10**(0.5)**2)) | s701631940 | Accepted | 31 | 9,348 | 41 | N = int(input())
print(int(N**(0.5))**2) |
s490760161 | p02747 | u498847144 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 317 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | large_s = input()
con = 0
str_check = ""
for i in range(len(large_s)):
z = large_s.find('hi', con, len(large_s))
if (0 <= z):
print(z)
str_check += str(z)
con += 2
if (str_check=='0' or str_check=='02' or str_check=='024' or str_check=='0246' or str_check=='02468'):
print("YES") | s723582266 | Accepted | 18 | 2,940 | 127 | z = input()
if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
print("Yes")
else:
print("No") |
s398319446 | p03587 | u898651494 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 60 | Snuke prepared 6 problems for a upcoming programming contest. For each of those problems, Rng judged whether it can be used in the contest or not. You are given a string S of length 6. If the i-th character of s is `1`, it means that the i-th problem prepared by Snuke is accepted to be used; `0` means that the problem... | s=input()
ans=0
for i in s:
if i==1:
ans+=1
print(ans) | s247672863 | Accepted | 19 | 2,940 | 76 | s=input()
ans=0
for i in range (6):
if int(s[i])==1:
ans+=1
print(ans) |
s417791219 | p02612 | u281745878 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,148 | 68 | 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. | N = int(input())
if N <1000:
print(N)
else:
print(N % 1000) | s961581932 | Accepted | 28 | 9,160 | 153 | N = int(input())
if N <1000:
print(1000 - N)
elif N % 1000 == 0:
print(0)
else:
tmp = N // 1000
tmp = 1000 * (tmp +1)
print(tmp - N) |
s228204171 | p03555 | u557171945 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 139 | 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. | x = [input() for i in range(2)]
if ((x[0][0]==x[1][2])and(x[0][2]==x[1][0])) and x[0][1]==x[1][1]:
print('Yes')
else:
print('No')
| s833579149 | Accepted | 18 | 2,940 | 139 | x = [input() for i in range(2)]
if ((x[0][0]==x[1][2])and(x[0][2]==x[1][0])) and x[0][1]==x[1][1]:
print('YES')
else:
print('NO')
|
s697496861 | p03610 | u703442202 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | s = "abcde"
s = list(s)
s_cut = s[0::2]
ans = ""
for i in s_cut:
ans += i
print(ans)
| s448530751 | Accepted | 27 | 4,268 | 90 | s = input()
s = list(s)
s_cut = s[0::2]
ans = ""
for i in s_cut:
ans += i
print(ans) |
s655101793 | p02608 | u830036378 | 2,000 | 1,048,576 | Wrong Answer | 1,229 | 118,632 | 482 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | import itertools
import math
import collections
def main():
n = int(input())
s = int(math.sqrt(n))
a = list(itertools.product(range(1,s),repeat=3))
ans = []
for i in range(len(a)):
t = a[i][0] ** 2 + a[i][1] ** 2 + a[i][2] ** 2 + a[i][0] * a[i][1] + a[i][1] * a[i][2] + a[i][2] * a[i][0]
... | s471068378 | Accepted | 1,171 | 118,384 | 486 | import itertools
import math
import collections
def main():
n = int(input())
s = int(math.sqrt(n))
a = list(itertools.product(range(1,s),repeat=3))
ans = []
for i in range(len(a)):
t = a[i][0] ** 2 + a[i][1] ** 2 + a[i][2] ** 2 + a[i][0] * a[i][1] + a[i][1] * a[i][2] + a[i][2] * a[i][0]
... |
s762138370 | p03361 | u185294445 | 2,000 | 262,144 | Wrong Answer | 19 | 3,192 | 1,985 | 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... | n = input().split()
n = [int(n[0]), int(n[1])]
H = n[0]
W=n[1]
s = [list(map(str, input().split())) for i in range(H)]
print(s[0][0][1])
c = True
for i in range(H):
for j in range(W):
if(s[i][0][j] == '#'):
if(i == 0):
if(j == 0):
if(s[i + 1][0][j] == '.' an... | s837124790 | Accepted | 19 | 3,192 | 1,968 | n = input().split()
n = [int(n[0]), int(n[1])]
H = n[0]
W=n[1]
s = [list(map(str, input().split())) for i in range(H)]
c = True
for i in range(H):
for j in range(W):
if(s[i][0][j] == '#'):
if(i == 0):
if(j == 0):
if(s[i + 1][0][j] == '.' and s[i][0][j + 1] ... |
s370898615 | p03486 | u361826811 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 260 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. |
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
a = readline().rstrip()
b = readline().rstrip()
sorted(a)
sorted(b)[::-1]
print("Yes" if a < b else "No")
| s224255111 | Accepted | 18 | 3,064 | 357 |
import sys
# import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
s, t = read().decode('utf8').split()
S=''.join(sorted(s))
T=''.join(sorted(t))
print('Yes' if S < T[::-1] else 'No')
|
s599117276 | p03450 | u099566485 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 2,126 | There are N people standing on the x-axis. Let the coordinate of Person i be x_i. For every i, x_i is an integer between 0 and 10^9 (inclusive). It is possible that more than one person is standing at the same coordinate. You will given M pieces of information regarding the positions of these people. The i-th piece of... | #ABC087-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
class WeightedUnionFind:
def __init__(self, size):
"""
:param collections.Iterable nodes:
"""
self._parents = [i for i in range(size)... | s370462027 | Accepted | 1,729 | 10,812 | 2,738 | #ABC087-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
class WeightedUnionFind:
def __init__(self, size):
"""
:param collections.Iterable nodes:
"""
self._parents = [i for i in range(size)... |
s697605711 | p02612 | u546165262 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,132 | 66 | 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. | n = int(input())
def change(n):
res = n % 1000
return res
| s981439305 | Accepted | 34 | 9,168 | 180 | N = int(input())
temp = N%1000
if(N > 1000 and temp != 0):
res = 1000 - temp
print(res)
elif (N>1000 and temp == 0):
print(temp)
else:
res = 1000 - N
print(res) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.