Datasets:
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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s577531731 | p03999 | u280978334 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 583 | 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. Evaluate all possible formulas, and print the sum of the results. | S = input()
ans = 0
digit = len(S)-1
for i in range(2**digit):
bit = format(i,"0"+str(digit)+"b")
temp = []
num = S[0]
for j in range(digit):
if j == digit - 1:
if bit[j] == "1":
temp.append(int(num))
temp.append(int(S[j+1]))
else:
temp.append(int(num+S[j+1:]))
else:
if bit[j] == "1":
temp.append(int(num))
num = S[j+1]
else:
num += S[j+1]
print(temp)
ans += sum(temp)
print(ans)
| s109484778 | Accepted | 21 | 3,064 | 593 | S = input()
ans = 0
digit = len(S)-1
for i in range(2**digit):
bit = format(i,"0"+str(digit)+"b")
temp = []
num = S[0]
for j in range(digit):
if j == digit - 1:
if bit[j] == "1":
temp.append(int(num))
temp.append(int(S[j+1]))
else:
temp.append(int(num+S[j+1:]))
else:
if bit[j] == "1":
temp.append(int(num))
num = S[j+1]
else:
num += S[j+1]
ans += sum(temp)
print(int(S) if digit == 0 else ans)
|
s571501408 | p04029 | u194894739 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 35 | 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? | N = int(input())
print(N*(N-1)//2)
| s668270747 | Accepted | 17 | 2,940 | 35 | N = int(input())
print(N*(N+1)//2)
|
s391249543 | p02281 | u255317651 | 1,000 | 131,072 | Wrong Answer | 30 | 5,632 | 2,075 | Binary trees are defined recursively. A binary tree _T_ is a structure defined on a finite set of nodes that either * contains no nodes, or * is composed of three disjoint sets of nodes: \- a root node. \- a binary tree called its left subtree. \- a binary tree called its right subtree. Your task is to write a program which perform tree walks (systematically traverse all nodes in a tree) based on the following algorithms: 1. Print the root, the left subtree and right subtree (preorder). 2. Print the left subtree, the root and right subtree (inorder). 3. Print the left subtree, right subtree and the root (postorder). Here, the given binary tree consists of _n_ nodes and evey node has a unique ID from 0 to _n_ -1. | # -*- coding: utf-8 -*-
"""
Created on Sat May 19 19:34:44 2018
ALDS1_7_B
@author: maezawa
"""
n = int(input())
parent = [-1 for _ in range(n)]
left = [-1 for _ in range(n)]
right = [-1 for _ in range(n)]
height = [None for _ in range(n)]
depth = [None for _ in range(n)]
def set_parent():
global parent
for i in range(n):
if left[i] != -1:
parent[left[i]] = i
if right[i] != -1:
parent[right[i]] = i
def set_depth(i, p):
global depth
if depth[i] != None:
return
depth[i] = p
if right[i] != None:
set_depth(right[i], p)
if left[i] != None:
set_depth(left[i], p+1)
def get_depth(i):
global depth
if depth[i] != None:
return depth[i]
d = 0
u = i
while parent[u] != -1:
u = parent[u]
d += 1
depth[i] = d
return d
def set_height(u):
global height
h1 = 0
h2 = 0
if right[u] != -1:
h1 = set_height(right[u])+1
if left[u] != -1:
h2 = set_height(left[u])+1
height[u] = max(h1, h2)
return height[u]
def get_sib(i):
if right[parent[i]] == i:
return left[parent[i]]
else:
return right[parent[i]]
def get_deg(i):
deg = 0
if right[i] != -1:
deg += 1
if left[i] != -1:
deg += 1
return deg
def get_height(i):
return height[i]
def preparse(i):
if i == -1:
return
print('{} '.format(i), end='')
preparse(left[i])
preparse(right[i])
def inparse(i):
if i == -1:
return
inparse(left[i])
print('{} '.format(i), end='')
preparse(right[i])
def postparse(i):
if i == -1:
return
postparse(left[i])
postparse(right[i])
print('{} '.format(i), end='')
for i in range(n):
line = list(map(int, input().split()))
left[line[0]] = line[1]
right[line[0]] = line[2]
set_parent()
root = parent.index(-1)
print('Preorder')
preparse(root)
print()
print('Inorder')
inparse(root)
print()
print('Postorder')
postparse(root)
print()
| s529787161 | Accepted | 20 | 5,660 | 2,074 | # -*- coding: utf-8 -*-
"""
Created on Sat May 19 19:34:44 2018
ALDS1_7_B
@author: maezawa
"""
n = int(input())
parent = [-1 for _ in range(n)]
left = [-1 for _ in range(n)]
right = [-1 for _ in range(n)]
height = [None for _ in range(n)]
depth = [None for _ in range(n)]
def set_parent():
global parent
for i in range(n):
if left[i] != -1:
parent[left[i]] = i
if right[i] != -1:
parent[right[i]] = i
def set_depth(i, p):
global depth
if depth[i] != None:
return
depth[i] = p
if right[i] != None:
set_depth(right[i], p)
if left[i] != None:
set_depth(left[i], p+1)
def get_depth(i):
global depth
if depth[i] != None:
return depth[i]
d = 0
u = i
while parent[u] != -1:
u = parent[u]
d += 1
depth[i] = d
return d
def set_height(u):
global height
h1 = 0
h2 = 0
if right[u] != -1:
h1 = set_height(right[u])+1
if left[u] != -1:
h2 = set_height(left[u])+1
height[u] = max(h1, h2)
return height[u]
def get_sib(i):
if right[parent[i]] == i:
return left[parent[i]]
else:
return right[parent[i]]
def get_deg(i):
deg = 0
if right[i] != -1:
deg += 1
if left[i] != -1:
deg += 1
return deg
def get_height(i):
return height[i]
def preparse(i):
if i == -1:
return
print(' {}'.format(i), end='')
preparse(left[i])
preparse(right[i])
def inparse(i):
if i == -1:
return
inparse(left[i])
print(' {}'.format(i), end='')
inparse(right[i])
def postparse(i):
if i == -1:
return
postparse(left[i])
postparse(right[i])
print(' {}'.format(i), end='')
for i in range(n):
line = list(map(int, input().split()))
left[line[0]] = line[1]
right[line[0]] = line[2]
set_parent()
root = parent.index(-1)
print('Preorder')
preparse(root)
print()
print('Inorder')
inparse(root)
print()
print('Postorder')
postparse(root)
print()
|
s605883446 | p02578 | u550416338 | 2,000 | 1,048,576 | Wrong Answer | 176 | 32,140 | 160 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool. Find the minimum total height of the stools needed to meet this goal. | N = int(input())
A = [int(i) for i in input().split()]
for i in range(N-1):
if A[i] > A[i+1]:
S = A[i] - A[i+1]
K = A[i+1] + S
A[i+1] = K
print(A) | s544193680 | Accepted | 185 | 32,068 | 258 | N = int(input())
A = [int(i) for i in input().split()]
K = 0
for i in range(N-1):
if A[i] > A[i+1]:
S = A[i] - A[i+1]
A[i+1] += S
K += S
else:
pass
print(K) |
s410965421 | p03860 | u978494963 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | 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. | r = ""
map(lambda x: r+x, str(input()).split(" "))
print(r) | s227033441 | Accepted | 17 | 2,940 | 59 | r = ""
for s in str(input()).split(" "):
r+=s[0]
print(r) |
s831040694 | p03730 | u044632922 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 128 | 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 = map(int, input().split())
x = a % b
for i in range(1, b+1):
if x*i % b == c:
print('Yes')
exit()
print('No') | s837800106 | Accepted | 17 | 2,940 | 128 | a, b, c = map(int, input().split())
x = a % b
for i in range(1, b+1):
if x*i % b == c:
print('YES')
exit()
print('NO') |
s988664175 | p02694 | u865108308 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,156 | 106 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time? | x = int(input())
money = 100
year = 0
while money == x:
money += money / 100
year += 1
print(year) | s799125575 | Accepted | 22 | 9,080 | 107 | x = int(input())
money = 100
year = 0
while money < x:
money += money // 100
year += 1
print(year)
|
s401393968 | p02406 | u698693989 | 1,000 | 131,072 | Wrong Answer | 20 | 7,504 | 97 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement is highly discouraged, because it is difficult to trace the control flow of a program which includes goto. Write a program which does precisely the same thing as the following program (this example is wrtten in C++). Let's try to write the program without goto statements. void call(int n){ int i = 1; CHECK_NUM: int x = i; if ( x % 3 == 0 ){ cout << " " << i; goto END_CHECK_NUM; } INCLUDE3: if ( x % 10 == 3 ){ cout << " " << i; goto END_CHECK_NUM; } x /= 10; if ( x ) goto INCLUDE3; END_CHECK_NUM: if ( ++i <= n ) goto CHECK_NUM; cout << endl; } | x=int(input())
print(" ",end="")
for i in range(x):
if (i+1)%3==0:
print(i+1,end=" ") | s190182814 | Accepted | 30 | 7,868 | 122 | n=int(input())
for i in range(1,n+1):
if i % 3 == 0 or "3" in str(i):
print(" {0}".format(i),end="")
print("") |
s725781198 | p03386 | u691018832 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 206 | 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())
match = 2*(b-a)
if k >= match:
for i in range(a, b):
print(i)
else:
for i in range(a, a+k):
print(i)
for j in range(b-k, b):
print(j) | s257113861 | Accepted | 17 | 3,060 | 199 | a, b, k = map(int, input().split())
if 2*k >= b-a+1:
for i in range(a, b+1):
print(i)
else:
for i in range(a, a+k):
print(i)
for j in range(b-k+1, b+1):
print(j)
|
s901581913 | p03069 | u217940964 | 2,000 | 1,048,576 | Wrong Answer | 1,113 | 30,700 | 427 | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`. Takahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone. Find the minimum number of stones that needs to be recolored. | import numpy as np
N = int(input())
S = input()
L = [0] * N
L1 = [0] * N
L2 = [0] * N
L3 = [0] * N
for i in range(N):
L1[i] = 0
L2[i] = 1
L3[i] = 0
if S[i] == ".":
# white
L[i] = 0
else:
L[i] = 1
L3[N-1] = 1
L = np.array(L)
L1 = np.array(L1)
L2 = np.array(L2)
L3 = np.array(L3)
a = [((L - L1)**2).sum(), ((L - L2)**2).sum(), ((L - L3)**2).sum()]
print(a)
ans = min(a)
print(ans) | s945394481 | Accepted | 174 | 6,632 | 360 | N = int(input())
S = input()
L = [0] * N
for i in range(N):
if S[i] == "#":
L[i] = 1
else:
L[i] = 0
leftblack = 0
rightwhite = len([x for x in L if x == 0])
ans = leftblack + rightwhite
for i in range(N):
if S[i] == "#":
leftblack += 1
else:
rightwhite -=1
ans = min(ans, leftblack + rightwhite)
print(ans) |
s175746288 | p03544 | u393512980 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | a,b=2,1
n=int(input())
for _ in range(n-2):
b=a+b
a=b
print(b)
| s487687190 | Accepted | 18 | 2,940 | 72 | a,b=2,1
n=int(input())
for _ in range(n-1):
t=b
b=a+b
a=t
print(b) |
s869409664 | p02601 | u206890818 | 2,000 | 1,048,576 | Wrong Answer | 40 | 9,708 | 519 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successful if both of the following conditions are satisfied after the operations: * The integer on the green card is **strictly** greater than the integer on the red card. * The integer on the blue card is **strictly** greater than the integer on the green card. Determine whether the magic can be successful. | import math
import collections
import bisect
from collections import deque
from copy import copy, deepcopy
def main():
A, B, C = map(int, input().split())
K = int(input())
ans = 0
tmp1 = math.ceil(math.log2((A + 0.1) / B))
if tmp1 > 0:
B = B * (2**tmp1)
ans += tmp1
tmp2 = math.ceil(math.log2((B + 0.1) / C))
if tmp2 > 0:
ans += tmp2
#print(tmp1, tmp2)
if ans <= K:
print("YES")
else:
print("NO")
if __name__ == '__main__':
main()
| s015898968 | Accepted | 34 | 9,736 | 519 | import math
import collections
import bisect
from collections import deque
from copy import copy, deepcopy
def main():
A, B, C = map(int, input().split())
K = int(input())
ans = 0
tmp1 = math.ceil(math.log2((A + 0.1) / B))
if tmp1 > 0:
B = B * (2**tmp1)
ans += tmp1
tmp2 = math.ceil(math.log2((B + 0.1) / C))
if tmp2 > 0:
ans += tmp2
#print(tmp1, tmp2)
if ans <= K:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
|
s127728933 | p02233 | u255317651 | 1,000 | 131,072 | Wrong Answer | 30 | 5,616 | 322 | Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula: \begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*} | # -*- coding: utf-8 -*-
"""
Created on Fri May 4 20:13:10 2018
ALDS1_10_A
@author: maezawa
"""
fib_arr = [None for _ in range(45)]
fib_arr[1] = 1
fib_arr[2] = 1
def fib(n):
if fib_arr[n] != None:
return fib_arr[n]
fib_arr[n] = fib(n-1)+fib(n-2)
return fib_arr[n]
n = int(input())
print(fib(n))
| s945086174 | Accepted | 20 | 5,616 | 322 | # -*- coding: utf-8 -*-
"""
Created on Fri May 4 20:13:10 2018
ALDS1_10_A
@author: maezawa
"""
fib_arr = [None for _ in range(45)]
fib_arr[0] = 1
fib_arr[1] = 1
def fib(n):
if fib_arr[n] != None:
return fib_arr[n]
fib_arr[n] = fib(n-1)+fib(n-2)
return fib_arr[n]
n = int(input())
print(fib(n))
|
s588056435 | p03194 | u096100666 | 2,000 | 1,048,576 | Wrong Answer | 401 | 3,060 | 129 | There are N integers a_1, a_2, ..., a_N not less than 1. The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P. Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N. | import math
N=4
P=972439611840
a=math.sqrt(P)
res=1
for i in range(1,int(a)):
if P % i**N: continue
res = i
print(res) | s251245658 | Accepted | 310 | 2,940 | 155 | n,p = list(map(int,input().split()))
i = a = o = 1
m = round(p**(1/n))
for i in range(m,0,-1):
a = i**n
if p%a==0:
print(i)
exit() |
s598025841 | p03448 | u989074104 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 453 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different. | a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=0
a_max=min(x//500,a)
for i in range(a_max+1):
b_max=min((x-500*i)//100,b)
print("100円玉最大数",b_max)
for j in range(b_max+1):
# print("i,j",i,j)
if (x-500*i-100*j)//50<=c:
count+=1
print(count)
| s566402550 | Accepted | 17 | 3,060 | 455 | a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=0
a_max=min(x//500,a)
for i in range(a_max+1):
b_max=min((x-500*i)//100,b)
for j in range(b_max+1):
# print("i,j",i,j)
if (x-500*i-100*j)//50<=c:
count+=1
print(count)
|
s076610841 | p02612 | u236441175 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,144 | 48 | 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())
otsuri = N % 1000
print(otsuri) | s088200015 | Accepted | 27 | 9,148 | 89 | N = int(input())
otsuri = N % 1000
if otsuri == 0:
print(0)
else:
print(1000-otsuri) |
s460224671 | p02645 | u250703962 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,032 | 24 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | x = input()
print(x[:4]) | s081687002 | Accepted | 22 | 8,948 | 32 | s = input()
print(s[:3].lower()) |
s281397869 | p02608 | u986190948 | 2,000 | 1,048,576 | Wrong Answer | 102 | 9,216 | 576 | 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())
ans=[0]*n
x=1
y=1
z=1
c=0
for i in range(1,n+1):
if 6*i*i>n:
d=i
break;
print(d)
for i in range(1,n+1):
if 1+2*i*i+i+i+i*i>n:
e=i
break;
print(e)
for i in range(d):
x=i+1
y=x
z=x
for j in range(i,e):
y=j+1
z=y
for k in range(j,n):
z=k+1
print(x,y,z)
b=x*x+y*y+z*z+x*y+y*z+z*x
if b>n:
c=1
break;
if x!=y and y!=z and z!=x:
ans[b-1]+=6
elif (x==y and x!=z) or (y==z and x!=y):
ans[b-1]+=3
elif x==y and y==z:
ans[b-1]+=1
#if c==1:
#break;
#if c==1:
#break;
for i in range(n):
print(ans[i]) | s250887025 | Accepted | 63 | 9,272 | 579 | n=int(input())
ans=[0]*n
x=1
y=1
z=1
c=0
for i in range(1,n+1):
if 6*i*i>n:
d=i
break;
#print(d)
for i in range(1,n+1):
if 1+2*i*i+i+i+i*i>n:
e=i
break;
#print(e)
for i in range(d):
x=i+1
y=x
z=x
for j in range(i,e):
y=j+1
z=y
for k in range(j,n):
z=k+1
#print(x,y,z)
b=x*x+y*y+z*z+x*y+y*z+z*x
if b>n:
c=1
break;
if x!=y and y!=z and z!=x:
ans[b-1]+=6
elif (x==y and x!=z) or (y==z and x!=y):
ans[b-1]+=3
elif x==y and y==z:
ans[b-1]+=1
#if c==1:
#break;
#if c==1:
#break;
for i in range(n):
print(ans[i]) |
s803262635 | p02795 | u474925961 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 293 | 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 the squares in that column black. At least how many operations do you need in order to have N or more black squares in the grid? It is guaranteed that, under the conditions in Constraints, having N or more black squares is always possible by performing some number of operations. | import sys
if sys.platform =='ios':
sys.stdin=open('input_file.txt')
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
def flip(i):
k=A[i]
A[i]=B[i+1]
B[i+1]=k
l=B[i]
B[i]=A[i+1]
A[i+1]=B[i]
if A==sorted(A):
print("0")
else:
print("-1")
| s007527091 | Accepted | 21 | 3,316 | 157 | import sys
if sys.platform =='ios':
sys.stdin=open('input_file.txt')
H=int(input())
W=int(input())
N=int(input())
p=max(H,W)
print(int((N-1/2)//p+1)) |
s122387489 | p04031 | u842689614 | 2,000 | 262,144 | Wrong Answer | 21 | 3,188 | 261 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2). Find the minimum total cost to achieve his objective. | N=int(input())
a=list(map(int,input().split()))
a.sort()
d=[[0]*N for i in range(N)]
for i in range(N):
for j in range(1,N):
if j>i and a[j]!=a[j-1]:
d[i][j]=(a[i]-a[j])**2
else:
d[i][j]=d[j][i]
print(min([sum(d[i]) for i in range(N)])) | s623635450 | Accepted | 67 | 3,700 | 224 | N=int(input())
a=list(map(int,input().split()))
a.sort()
d=[[0]*N for i in range(max(a)-min(a)+1)]
for i in range(max(a)-min(a)+1):
for j in range(N):
d[i][j]=(a[j]-(min(a)+i))**2
print(min([sum(dd) for dd in d])) |
s228697350 | p03080 | u785578220 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 89 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | a=int(input())
b = input()
if b.count("R")< b.count("B"):print("Yes")
else:print("No")
| s685299257 | Accepted | 17 | 2,940 | 87 | a=int(input())
b = input()
if b.count("R")> b.count("B"):print("Yes")
else:print("No")
|
s642284460 | p03605 | u484856305 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 57 | 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()
if n in "9":
print("Yes")
else:
print("No") | s438340095 | Accepted | 17 | 2,940 | 58 | n=input()
if "9" in n:
print("Yes")
else:
print("No")
|
s367420615 | p03644 | u976162616 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 383 | 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. | if __name__ == "__main__":
N = int(input())
if N <= 1:
print (0)
exit()
res_cnt = 0
res = 0
for x in range(N + 1):
cnt = 0
y = x
while (y > 1):
if y % 2 == 0:
y //= 2
cnt += 1
else:
break
if cnt > res_cnt:
res = x
print (res)
| s359442829 | Accepted | 17 | 3,060 | 409 | if __name__ == "__main__":
N = int(input())
if N <= 1:
print (1)
exit()
res_cnt = 0
res = 0
for x in range(N + 1):
cnt = 0
y = x
while (y > 1):
if y % 2 == 0:
y //= 2
cnt += 1
else:
break
if cnt > res_cnt:
res_cnt = cnt
res = x
print (res)
|
s543925837 | p04029 | u757274384 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 58 | 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? | # -*- coding: utf-8-*-
N = int(input())
print(N*(N+1)/2) | s461436624 | Accepted | 17 | 2,940 | 63 | # -*- coding: utf-8-*-
N = int(input())
print(int(N*(N+1)/2)) |
s950467870 | p02603 | u561862393 | 2,000 | 1,048,576 | Wrong Answer | 122 | 27,160 | 873 | To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives. He is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the next N days will be as follows: * A_1 yen on the 1-st day, A_2 yen on the 2-nd day, ..., A_N yen on the N-th day. In the i-th day, M-kun can make the following trade **any number of times** (possibly zero), **within the amount of money and stocks that he has at the time**. * Buy stock: Pay A_i yen and receive one stock. * Sell stock: Sell one stock for A_i yen. What is the maximum possible amount of money that M-kun can have in the end by trading optimally? | import sys
input = sys.stdin.readline
import numpy as np
n = int(input())
AA = [int(a) for a in input().split()]
c = 0
updwn=[None]*(n-1)
for a in AA:
if c ==0:
c +=1
base = a
continue
if a - base >= 0:
updwn[c-1] = True
base = a
else:
updwn[c-1] = False
base = a
c += 1
updwn+=[False, False]
base = False
total = 1000
stock = 0
if n ==2:
if updwn[0]==True:
total += (total//AA[0])*(AA[1]-AA[0])
else:
for i in range(n):
if updwn[i] == True and base == False:
tdcost= AA[i]
stock = total // tdcost
base_cost = tdcost
elif updwn[i] == True and updwn[i+1]==False:
tdcost=AA[i+1]
total += (tdcost - base_cost)*stock
stock = 0
base = updwn[i]
else:
pass
print(total)
| s042271124 | Accepted | 131 | 27,024 | 735 | import sys
input = sys.stdin.readline
import numpy as np
n = int(input())
AA = [int(a) for a in input().split()]
c = 0
updwn=[None]*(n-1)
for a in AA:
if c ==0:
c +=1
base = a
continue
if a - base >= 0:
updwn[c-1] = True
base = a
else:
updwn[c-1] = False
base = a
c += 1
updwn+=[False, False]
base = False
total = 1000
stock = 0
for i in range(n):
if updwn[i] == True and base == False:
tdcost= AA[i]
stock = total // tdcost
base_cost = tdcost
elif updwn[i-1] == True and updwn[i]==False:
tdcost=AA[i]
total += (tdcost - base_cost)*stock
stock = 0
else:
pass
base = updwn[i]
print(total)
|
s761691887 | p03919 | u767664985 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 196 | There is a grid with H rows and W columns. The square at the i-th row and j-th column contains a string S_{i,j} of length 5. The rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from `A` through the W-th letter of the alphabet. Exactly one of the squares in the grid contains the string `snuke`. Find this square and report its location. For example, the square at the 6-th row and 8-th column should be reported as `H6`. | H, W = map(int, input().split())
S = [list(input().split()) for _ in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == "snuke":
print(chr(97 + i).upper() + str(j + 1))
exit()
| s891508547 | Accepted | 17 | 3,060 | 196 | H, W = map(int, input().split())
S = [list(input().split()) for _ in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == "snuke":
print(chr(97 + j).upper() + str(i + 1))
exit()
|
s220505680 | p03795 | u543005033 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 160 | 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())
p = 1
for num in range(1,N+1):
p = p * num
temp = 10**9 + 7
ans = p % temp
print(ans) | s365962028 | Accepted | 17 | 2,940 | 109 |
N = int(input())
#
x = N * 800
temp = N // 15
y = temp * 200
ans = x-y
print(ans) |
s360129672 | p03997 | u191667127 | 2,000 | 262,144 | Wrong Answer | 38 | 3,064 | 154 | 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("a? "))
b = int(input("b? "))
h = int(input("h? "))
# Since h is even, area will always be an integer!
area = int(((a+b)*h)/2)
print(area) | s689220522 | Accepted | 36 | 3,064 | 140 | a = int(input())
b = int(input())
h = int(input())
# Since h is even, area will always be an integer!
area = int(((a+b)*h)/2)
print(area)
|
s893564238 | p02850 | u185948224 | 2,000 | 1,048,576 | Wrong Answer | 2,106 | 91,908 | 961 | 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 colorings satisfying the condition above, construct one that uses the minimum number of colors. | N = int(input())
tree_dict = {}
tree_lst = []
for i in range(N-1):
a, b = map(int, input().split())
tree_lst.append([a, b])
if a in tree_dict:
tree_dict[a].append(b)
else: tree_dict[a] = [b]
if b in tree_dict:
tree_dict[b].append(a)
else: tree_dict[b] = [a]
colors = -1
for val in tree_dict.values():
colors = max(colors, len(val))
bond = []
[bond.append([0]*len(tree_dict[i])) for i in range(1,N + 1) if i in tree_dict]
for a,b in tree_lst:
for i in range(1, colors + 1):
if i in bond[a-1]:continue
elif len(bond[a-1]) < i:break
else:
for ni, bi in enumerate(tree_dict[a]):
if bi == b:bond[a-1][ni] = i
for nj, bj in enumerate(tree_dict[b]):
if bj == a:bond[b-1][nj] = i
print(i, bond)
print(colors)
for a, b in tree_lst:
for ni, bi in enumerate(tree_dict[a]):
if bi == b:print(bond[a-1][ni])
| s380312698 | Accepted | 791 | 50,288 | 555 | N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]
graph = [[] for _ in range(N+1)]
graph[0] = [0]
edct = {}
par = [-1] * (N+1)
par[1] = 0
for a, b in ab:
graph[a].append(b)
graph[b].append(a)
edct[(a, b)] = 0
nmax = 0
for i, g in enumerate(graph[1:], 1):
nmax = max(nmax, len(g))
clr = 1
for j in g:
if par[j] != -1: continue
if clr == par[i]:clr += 1
edct[(min(i, j), max(i, j))] = clr
par[j] = clr
clr += 1
print(nmax)
for a, b in ab:
print(edct[(a, b)]) |
s609468206 | p02409 | u981238682 | 1,000 | 131,072 | Wrong Answer | 20 | 5,628 | 331 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that −v persons left. Assume that initially no person lives in the building. | A = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
b,f,r,v = map(int,input().split())
A[b-1][f-1][r-1] = v
for b in range(4):
for f in range(3):
for r in range(10):
print('',A[b][f][r],end='')
print()
if i != 3:
print('#'*20) | s691283265 | Accepted | 20 | 5,636 | 332 | A = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
b,f,r,v = map(int,input().split())
A[b-1][f-1][r-1] += v
for b in range(4):
for f in range(3):
for r in range(10):
print('',A[b][f][r],end='')
print()
if b != 3:
print('#'*20) |
s286366540 | p03548 | u845427284 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person. At most how many people can sit on the seat? | x, y, z = map(int,input().split())
a = x / (y + z)
b = x % (y + z)
print(a if b >= z else a - 1) | s141342936 | Accepted | 18 | 3,064 | 107 | x, y, z = map(int,input().split())
a = x / (y + z)
b = x % (y + z)
print(int(a) if b >= z else int(a) - 1) |
s889633121 | p03494 | u202406075 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 153 | 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()))
ans = 0
while all( a%2 == 0 for a in A ):
a = [ i/2 for i in A ]
ans += 1
print(ans)
| s581497573 | Accepted | 19 | 2,940 | 153 | n = int(input())
a = list(map(int,input().split()))
ans = 0
while all( A%2 == 0 for A in a ):
a = [ i/2 for i in a ]
ans += 1
print(ans)
|
s150142321 | p03408 | u459283268 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 362 | 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. | n = int(input())
arr1 = [input() for _ in range(n)]
m = int(input())
arr2 = [input() for _ in range(m)]
# print(arr1, arr2)
for i, j in zip(arr1, arr2):
try:
arr1.remove(j)
except:
pass
# print(arr1, arr2)
d = {}
for i in set(arr1):
d[i] = arr1.count(i)
try:
print(max(d.items(), key=lambda x:x[1])[0])
except:
print("0") | s033984485 | Accepted | 18 | 3,060 | 185 | n = int(input())
arr1 = [input() for _ in range(n)]
m = int(input())
arr2 = [input() for _ in range(m)]
r = 0
for i in set(arr1):
r = max(arr1.count(i) - arr2.count(i), r)
print(r)
|
s238811115 | p03992 | u282721391 | 2,000 | 262,144 | Wrong Answer | 23 | 3,064 | 62 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the first 4 letters and last 8 letters in the string s. | s = input('input')
print(s[0:4], end=' ')
print(s[4:], end='') | s095952372 | Accepted | 22 | 3,064 | 47 | s = input()
print(s[0:4], end=' ')
print(s[4:]) |
s189167078 | p03377 | u317440328 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 78 | 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,C = map(int,input().split())
if(A+B>C):
print("Yes")
else:
print("No") | s034003725 | Accepted | 17 | 2,940 | 76 | A,B,C = map(int,input().split())
print("YES" if (A+B>=C)and(A<=C) else "NO") |
s097909709 | p03371 | u196697332 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 198 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively. Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas. | A, B, C, X, Y = map(int, input().split())
if Y - X > 0:
ans_1 = min(X, Y) * C * 2 + (Y - X) * B
else:
ans_1 = min(X, Y) * C * 2 + (X - Y) * B
ans_2 = max(Y, X) * C * 2
print(min(ans_1, ans_2)) | s335282485 | Accepted | 17 | 3,060 | 233 | A, B, C, X, Y = map(int, input().split())
if Y - X > 0:
ans_1 = min(X, Y) * C * 2 + (Y - X) * B
else:
ans_1 = min(X, Y) * C * 2 + (X - Y) * A
ans_2 = max(Y, X) * C * 2
ans_3 = X * A + Y * B
print(min(ans_1, ans_2, ans_3)) |
s092748756 | p02972 | u973240207 | 2,000 | 1,048,576 | Wrong Answer | 1,280 | 22,472 | 737 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied: * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2. Does there exist a good set of choices? If the answer is yes, find one good set of choices. | from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
N = int(input())
alist = list(map(int, input().split()))
ans_list = []
for i in range(len(alist)):
bef = 0
for j in range(2, len(alist)):
if (N-i)*j > N:
break
else:
bef += alist[(N-i)*j-1]
if alist[N-i-1] != bef%2:
ans_list.append(N-i)
print(len(ans_list))
print(*ans_list) | s942234118 | Accepted | 257 | 14,136 | 288 | n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n, 0, -1):
if sum(b[i-1::i]) % 2 == a[i-1]:
continue
else:
b[i-1] = 1
c = []
for i in range(n):
if b[i] == 1:
c.append(i+1)
print(sum(b))
if len(c) > 0:
print(*c) |
s350984809 | p03476 | u267325300 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 7,472 | 801 | 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. | import math
N = 10**5
Q = int(input())
def eratosthenes(n):
if not isinstance(n, int):
raise TypeError('n is int type.')
if n < 2:
raise ValueError('n is more than 2')
prime = []
limit = math.sqrt(n)
data = [i + 1 for i in range(1, n)]
while True:
p = data[0]
if limit <= p:
return prime + data
prime.append(p)
data = [e for e in data if e % p != 0]
primes = eratosthenes(N)
like_2017 = [p for p in primes if (p + 1) // 2 in primes]
c = 0
C = [0]
for i in range(1, 10**5 + 1):
if i in like_2017:
c += 1
C.append(c)
for _ in range(Q):
left, right = map(int, input().split())
print(C[right] - C[left - 1])
| s872397102 | Accepted | 919 | 10,648 | 924 | import math
N = 10**5
Q = int(input())
def eratosthenes(n):
if not isinstance(n, int):
raise TypeError('n is int type.')
if n < 2:
raise ValueError('n is more than 2')
prime = []
limit = math.sqrt(n)
data = [i + 1 for i in range(1, n)]
while True:
p = data[0]
if limit <= p:
return prime + data
prime.append(p)
data = [e for e in data if e % p != 0]
_primes = eratosthenes(N)
primes = [False] * (10**5 + 1)
for p in _primes:
primes[p] = True
like_2017 = [False] * (10**5 + 1)
for p in _primes:
if primes[(p + 1) // 2]:
like_2017[p] = True
c = 0
C = [0]
for i in range(1, 10**5 + 1):
if like_2017[i]:
c += 1
C.append(c)
for _ in range(Q):
left, right = map(int, input().split())
print(C[right] - C[left - 1])
|
s992674906 | p02694 | u258355189 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,160 | 173 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time? | import math
num_x = int(input())
taka = 100
count = 0
while num_x >= taka :
taka = taka*0.01 + taka
taka = math.floor(taka)
count = count + 1
print(count) | s004268087 | Accepted | 22 | 9,104 | 174 | import math
num_x = int(input())
taka = 100
count = 0
while num_x > taka :
taka = taka*0.01 + taka
taka = math.floor(taka)
count = count + 1
print(count) |
s337969409 | p02613 | u440613652 | 2,000 | 1,048,576 | Wrong Answer | 151 | 9,476 | 203 | 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. | from collections import defaultdict
d=defaultdict(int)
for i in range(int(input())):
s=input()
d[s]+=1
print("AC x",d["AC"])
print("WA x",d["WA"])
print("TLE x",d["TLE"])
print("TLE x",d["TLE"]) | s846316353 | Accepted | 146 | 9,420 | 203 | from collections import defaultdict
d=defaultdict(int)
for i in range(int(input())):
s=input()
d[s]+=1
print("AC x",d["AC"])
print("WA x",d["WA"])
print("TLE x",d["TLE"])
print("RE x",d["RE"]) |
s058160171 | p02259 | u022407960 | 1,000 | 131,072 | Wrong Answer | 20 | 7,656 | 800 | 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. | #!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def bubble_sort():
# write your code here
array_length = int(input())
unsorted_array = [int(x) for x in input().split()]
flag = 1
count = 0
while flag:
flag = 0
for j in range(array_length - 1, 0, -1):
if unsorted_array[j] < unsorted_array[j - 1]:
unsorted_array[j], unsorted_array[j - 1] = unsorted_array[j - 1], unsorted_array[j]
flag = 1
count += 1
print(unsorted_array)
print(count)
if __name__ == '__main__':
solution = Solution()
solution.bubble_sort() | s952893846 | Accepted | 20 | 7,708 | 695 | #!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def bubble_sort():
# write your code here
array_length = int(input())
array = [int(x) for x in input().split()]
flag, count, cursor = 1, 0, 0
while flag:
flag = 0
for j in range(array_length - 1, cursor, -1):
if array[j] < array[j - 1]:
array[j], array[j - 1] = array[j - 1], array[j]
flag = 1
count += 1
cursor += 1
print(" ".join(map(str, array)))
print(str(count))
if __name__ == '__main__':
solution = Solution()
solution.bubble_sort() |
s916749636 | p03659 | u103902792 | 2,000 | 262,144 | Wrong Answer | 162 | 24,832 | 196 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively. They would like to minimize |x-y|. Find the minimum possible value of |x-y|. | n = int(input())
A = list(map(int,input().split()))
from itertools import accumulate
A = list(accumulate(A))
ans = float('inf')
for i in range(n-1):
ans = min(ans, abs(A[-1] - A[i]))
print(ans) | s203813434 | Accepted | 173 | 24,812 | 205 | n = int(input())
A = list(map(int,input().split()))
from itertools import accumulate
A = list(accumulate(A))
ans = float('inf')
for i in range(n-1):
ans = min(ans, abs((A[-1] - A[i])-A[i]))
print(ans)
|
s710783092 | p03545 | u167908302 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 498 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted. | # coding:utf-8
number = input()
n = 3
for bit in range(2 ** n):
ope = ['-'] * n
for i in range(n):
if ((bit >> i) & 1):
ope[n - 1 - i] = '+'
# print(ope)
ans = ''
for num, op in zip(number, ope):
ans += num + op
ans += number[-1]
if eval(ans) == 7:
print(ans + '==7')
exit()
| s993779680 | Accepted | 17 | 3,060 | 372 | # coding:utf-8
number = input()
n = 3
for bit in range(2 ** n):
ope = ['-'] * n
for i in range(n):
if ((bit >> i) & 1):
ope[n - 1 - i] = '+'
# print(ope)
ans = ''
for num, op in zip(number, ope):
ans += num + op
ans += number[-1]
if eval(ans) == 7:
print(ans + '=7')
exit()
|
s844101378 | p03826 | u214434454 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the rectangle with the larger area. If the two rectangles have equal areas, print that area. | a, b, c, d = map(int, input().split())
print(max(a+b, c*d)) | s261830428 | Accepted | 18 | 2,940 | 59 | a, b, c, d = map(int, input().split())
print(max(a*b, c*d)) |
s943433075 | p02407 | u742505495 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 149 | Write a program which reads a sequence and prints it in the reverse order. | n = int(input())
a = list(map(int,input().split()))
a.reverse()
for i in range(len(a)):
if i!=len(a)-1:
print(a[i])
else:
print(a[i],end=' ')
| s454510528 | Accepted | 20 | 5,600 | 149 | n = int(input())
a = list(map(int,input().split()))
a.reverse()
for i in range(len(a)):
if i!=len(a)-1:
print(a[i],end=' ')
else:
print(a[i])
|
s524507073 | p00008 | u744114948 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 190 | Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). | #! /usr/bin/python3
s=int(input())
n=0
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
if s == i+j+k+l: n+=1
print(n) | s192744320 | Accepted | 180 | 6,720 | 301 | #! /usr/bin/python3
while True:
try:
s=int(input())
n=0
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
if s == i+j+k+l: n+=1
print(n)
except:
break |
s806910502 | p03606 | u021916304 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 289 | Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now? | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n = ii()
ans = 0
for i in range(n):
l,r = iim()
ans += l-r+1
print(ans) | s460774048 | Accepted | 23 | 3,060 | 289 | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n = ii()
ans = 0
for i in range(n):
l,r = iim()
ans += r-l+1
print(ans) |
s228091918 | p03485 | u004025573 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | A,B=map(int,input().split())
if A%B==0:
print(A//B)
else:
print(A//B + 1) | s707518897 | Accepted | 17 | 2,940 | 92 | A,B=map(int,input().split())
if (A+B)%2==0:
print((A+B)//2)
else:
print((A+B+1)//2) |
s376032446 | p03386 | u519939795 | 2,000 | 262,144 | Wrong Answer | 2,150 | 712,728 | 309 | 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())
l=[int(i) for i in range(a,b+1)]
l1=sorted(l,reverse=True)
ans=[]
if k>len(l):
for a in l:
print(a)
else:
for i in range(0,k):
ans.append(l[i])
for j in range(0,k):
ans.append(l1[j])
ans=set(sorted(ans))
for g in ans:
print(g) | s592779095 | Accepted | 18 | 3,060 | 202 | # coding: utf-8
A, B, K = map(int, input().split())
a = set(i for i in range(A, min(A + K, B + 1)))
b = set(j for j in range(max(B - K + 1, A), B + 1))
c = list(a | b)
c.sort()
for k in c:
print(k)
|
s773098813 | p03455 | u821432765 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 202 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b=map(int,input().split())
ab=int(str(a)+str(b))
j=0
for i in range(318):
if i**2==ab:
print("Yes")
j=1
break
else:
pass
if j==1:
pass
else:
print("No") | s421123880 | Accepted | 17 | 2,940 | 90 | a,b=map(int,input().split())
ab=(a*b)%2
if ab==0:
print("Even")
else:
print("Odd") |
s222359080 | p03387 | u540762794 | 2,000 | 262,144 | Wrong Answer | 29 | 9,132 | 207 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be proved that we can always make A, B and C all equal by repeatedly performing these operations. | # -*- coding: utf-8 -*-
A,B,C = map(int, input().split())
s = A + B + C
M = max(A,B,C)
if M % 2 == 0 and s % 2 != 0:
M += 1
elif M % 2 != 0 and s % 2 == 0:
M += 1
ans = (3 * M - s) / 2
print(ans)
| s564038482 | Accepted | 27 | 9,112 | 212 | # -*- coding: utf-8 -*-
A,B,C = map(int, input().split())
s = A + B + C
M = max(A,B,C)
if M % 2 == 0 and s % 2 != 0:
M += 1
elif M % 2 != 0 and s % 2 == 0:
M += 1
ans = (3 * M - s) / 2
print(int(ans))
|
s443138501 | p03796 | u836737505 | 2,000 | 262,144 | Wrong Answer | 229 | 3,976 | 50 | 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. | import math
N = int(input())
d = math.factorial(N) | s160918220 | Accepted | 229 | 4,020 | 58 | import math
print(math.factorial(int(input()))%1000000007) |
s448323528 | p03069 | u096736378 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 6,888 | 675 | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`. Takahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone. Find the minimum number of stones that needs to be recolored. | n = int(input())
s = input()
def inverse(num, index, first):
offset = 0
if first == '*':
offset = 1
count = 0
for n, i in enumerate(num):
if n <= index and n % 2 == offset:
count += i
elif n > index and n % 2 != offset:
count += i
return count
num = []
first = s[0]
end = s[-1]
pre = first
count = 0
for c in s:
if c == pre:
count += 1
else:
num.append(count)
count = 1
pre = c
num.append(count)
print(num)
if len(num) == 1:
print(0)
else:
minlist = []
for i in range(len(num)):
minlist.append(inverse(num, i, first))
print(min(minlist))
| s132198020 | Accepted | 145 | 13,400 | 558 | n = int(input())
s = input()
num = []
first = s[0]
end = s[-1]
pre = first
count = 0
for c in s:
if c == pre:
count += 1
else:
num.append(count)
count = 1
pre = c
num.append(count)
if len(num) == 1:
print(0)
else:
b = 0
w = n
offset = 0
if first == '#':
offset = 1
w = sum(num[offset::2])
minlist = [b + w]
for i in range(len(num)):
if i % 2 == offset:
w -= num[i]
else:
b += num[i]
minlist.append(b + w)
print(min(minlist)) |
s955553210 | p03943 | u785578220 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 101 | 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. Note that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students. | l= list(map(int, input().split()))
l.sort()
if l[0] == l[1] + l[2]:
print("Yes")
else:print("No") | s854459017 | Accepted | 18 | 2,940 | 101 | l= list(map(int, input().split()))
l.sort()
if l[2] == l[1] + l[0]:
print("Yes")
else:print("No") |
s433702919 | p02601 | u908763441 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,116 | 214 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successful if both of the following conditions are satisfied after the operations: * The integer on the green card is **strictly** greater than the integer on the red card. * The integer on the blue card is **strictly** greater than the integer on the green card. Determine whether the magic can be successful. | a, b, c = map(int, input().split())
k = int(input())
while k > 0:
if (b <= a):
b = b * 2
k -= 1
else:
if (c <= b):
c = c * 2
k -= 1
else:
print('Yes')
exit()
print('No') | s617382057 | Accepted | 31 | 9,188 | 259 | a, b, c = map(int, input().split())
k = int(input())
while k > 0:
if (b <= a):
b = b * 2
k -= 1
else:
if (c <= b):
c = c * 2
k -= 1
else:
print('Yes')
exit()
if (b > a and c > b):
print('Yes')
else:
print('No') |
s930480878 | p00007 | u742505495 | 1,000 | 131,072 | Wrong Answer | 30 | 7,704 | 131 | Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. | import sys
import math
n = int(input())
debt = 100000
for i in range(1,n+1):
debt = math.floor((debt*1.05)/1000)*1000
print(debt) | s878616667 | Accepted | 30 | 7,752 | 130 | import sys
import math
n = int(input())
debt = 100000
for i in range(1,n+1):
debt = math.ceil((debt*1.05)/1000)*1000
print(debt) |
s430163965 | p03623 | u556477263 | 2,000 | 262,144 | Wrong Answer | 28 | 9,144 | 93 | 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|. | a,b,c = map(int,input().split())
if abs(a-b) > abs(a-c):
print('A')
else:
print('B') | s178879749 | Accepted | 27 | 9,084 | 93 | a,b,c = map(int,input().split())
if abs(a-b) < abs(a-c):
print('A')
else:
print('B') |
s028037660 | p03150 | u742729271 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,016 | 289 | 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. | S = input()
s = "keyence"
flag = False
ans = "No"
for i in range(len(S)):
if s[:i] in S:
s1 = s[:i]
s2 = s[i:]
flag = True
if flag:
for i in range(len(S)-len(s1)):
if s1 == S[i:i+len(s1)]:
if s2 in S[i+len(s1):]:
ans = "Yes"
break
print(ans) | s181375634 | Accepted | 30 | 9,064 | 132 | S = input()
s = "keyence"
ans = "NO"
for i in range(len(S)):
if s == S[:i] + S[len(S)-len(s)+i:]:
ans = "YES"
print(ans) |
s052501145 | p03485 | u563588763 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 122 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a,b = map(int,input().split())
if int((a + b)//2) == 0:
print(int((a + b)//2))
else:
print(int((a + b) // 2 + 1))
| s966395451 | Accepted | 18 | 2,940 | 121 | a,b = map(int,input().split())
if int((a + b)%2) == 0:
print(int((a + b)//2))
else:
print(int((a + b) // 2 + 1))
|
s069275107 | p03369 | u252964975 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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 three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen. Write a program that, when S is given, prints the price of the corresponding bowl of ramen. | S=str(input())
k = 0
for i in range(3):
if S[i] == "○":
k = k + 100
print(k) | s543550619 | Accepted | 18 | 3,068 | 84 | S=str(input())
k = 700
for i in range(3):
if S[i] == 'o':
k = k + 100
print(k) |
s409467098 | p02612 | u040642458 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,064 | 31 | 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) | s876416093 | Accepted | 29 | 9,144 | 80 | n = int(input())
a = n%1000
b = 1000-a
if b==1000:
print(0)
else:
print(b) |
s143065254 | p03455 | u079022116 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b = map(int,input().split())
if a*b%2==0:
print("Odd")
else:
print("Even") | s424154643 | Accepted | 17 | 2,940 | 84 | a,b = map(int,input().split())
if a*b%2==0:
print("Even")
else:
print("Odd") |
s485698983 | p03351 | u780111164 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 130 | 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 directly or indirectly. Here, A and C can indirectly communicate when A and B can directly communicate and also B and C can directly communicate. | a,b,c,d=map(int,input().split())
ans="YES"
if a-c>d or c-a>d:
if a-b>d or b-a>d or b-c>d or c-b>d:
ans="NO"
print(ans) | s174019078 | Accepted | 17 | 3,060 | 151 | a,b,c,d=map(int,input().split())
ans="Yes"
if (a-c)*(a-c) >d*d:
ans="No"
if (a-b)*(a-b)<=d*d and (b-c)*(b-c)<=d*d:
ans="Yes"
print(ans) |
s669798928 | p02842 | u651058930 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 139 | 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. | N = int(input())
est_X = int(N/1.08)*1.08
if est_X == N:
print(est_X)
elif est_X + 1 == N:
print(est_X + 1)
else:
print(':(') | s207759550 | Accepted | 17 | 2,940 | 157 | N = int(input())
est_X = int(N/1.08)
if int(est_X*1.08) == N:
print(est_X)
elif int((est_X + 1)*1.08) == N:
print(est_X + 1)
else:
print(':(')
|
s875207944 | p03434 | u244737745 | 2,000 | 262,144 | Wrong Answer | 32 | 9,172 | 170 | 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 cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score. | # 2020-08-30, Sun
n = int(input())
lis = sorted(list(map(int, input().split())))
a = 0
b = 0
for i in lis[::2]:
a += i
for i in lis[1::2]:
b += i
print(a - b) | s516823967 | Accepted | 27 | 9,180 | 184 | # 2020-08-30, Sun
n = int(input())
lis = sorted(list(map(int, input().split())), reverse=True)
a = 0
b = 0
for i in lis[::2]:
a += i
for i in lis[1::2]:
b += i
print(a - b) |
s504573234 | p02578 | u621596556 | 2,000 | 1,048,576 | Wrong Answer | 120 | 32,120 | 176 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool. Find the minimum total height of the stools needed to meet this goal. | n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,n):
if(a[i-1] > a[i]):
while(a[i-1] == a[i]):
a[i] += 1
ans += 1
print(ans) | s122885838 | Accepted | 162 | 32,144 | 185 | n = int(input())
a = list(map(int,input().split()))
ans = 0
diff = 0
for i in range(1,n):
if(a[i-1] > a[i]):
diff = a[i-1] - a[i]
a[i] += diff
ans += diff
print(ans) |
s527677115 | p02831 | u018872912 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 134 | 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 divided and distributed to multiple guests. | n,m =map(int,input().split())
n2=max(n,m)
m2=min(n,m)
while m2!=0:
tmp=n2
n2=m2
m2=tmp%m2
print(n2,m2)
print(int(n*m/n2))
| s961999609 | Accepted | 20 | 3,060 | 121 | n,m =map(int,input().split())
n2=max(n,m)
m2=min(n,m)
while m2!=0:
tmp=n2
n2=m2
m2=tmp%m2
print(int(n*m/n2))
|
s799546742 | p03493 | u106184985 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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. | ss = map(int, input().split())
ans = 0
for s in ss:
if s == 1:
ans+=1
print(ans) | s174046686 | Accepted | 18 | 2,940 | 41 | print(sum(list(map(int, list(input()))))) |
s330722982 | p03433 | u921773161 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 185 | 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:
while N<500:
N = N-500
if N<=A:
print('Yes')
else:
print('No')
else:
if N<=A:
print('Yes')
else:
print('No') | s239181480 | Accepted | 17 | 2,940 | 99 | N = int(input())
A = int(input())
N_500 = N%500
if A >= N_500 :
print('Yes')
else :
print('No') |
s831303081 | p03433 | u321354941 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | 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())
x = n % 500
if x > a:
print("no")
else:
print("yes") | s848051369 | Accepted | 22 | 3,316 | 90 | n = int(input())
a = int(input())
x = n % 500
if a >= x:
print("Yes")
else:
print("No") |
s381453754 | p03479 | u970348538 | 2,000 | 262,144 | Wrong Answer | 22 | 3,188 | 107 | 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 possible length of the sequence. | import math
a,b = [list(map(int, s.split())) for s in open(0)][0]
math.floor(math.log2(b) - math.log2(a))+1 | s624693226 | Accepted | 17 | 3,060 | 122 | import math
a,b = [list(map(int, s.split())) for s in open(0)][0]
ans = 0
while a <= b:
a *= 2
ans += 1
print(ans) |
s983546527 | p02393 | u113501470 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 189 | Write a program which reads three integers, and prints them in ascending order. | abc = input().split()
for n in abc:
n = int(n)
a,b,c = abc[0],abc[1], abc[2]
print(a,b,c)
low = min(abc)
high = max(abc)
abc.remove(low)
abc.remove(high)
print (low, abc.pop(), high)
| s757005404 | Accepted | 20 | 5,600 | 178 | abc = input().split()
for n in abc:
n = int(n)
a,b,c = abc[0],abc[1], abc[2]
low = min(abc)
high = max(abc)
abc.remove(low)
abc.remove(high)
print (low, abc.pop(), high)
|
s109741388 | p03998 | u412481017 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 304 | 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. | dic={"a":input(),"b":input(),"c":input()}
print(dic)
temp="a"
while 1:
temp2=dic[temp][:1]
#print(temp)
dic[temp]=dic[temp][1:]
temp=temp2
#print(dic)
if dic[temp]=="":
if temp=="a":
print("A")
elif temp=="b":
print("B")
elif temp=="c":
print("C")
break | s320900289 | Accepted | 17 | 3,064 | 305 | dic={"a":input(),"b":input(),"c":input()}
#print(dic)
temp="a"
while 1:
temp2=dic[temp][:1]
#print(temp)
dic[temp]=dic[temp][1:]
temp=temp2
#print(dic)
if dic[temp]=="":
if temp=="a":
print("A")
elif temp=="b":
print("B")
elif temp=="c":
print("C")
break |
s604073440 | p03605 | u360515075 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | 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 = int(input())
print ("YES" if N //10 == 9 or N % 10 == 9 else "NO") | s318381885 | Accepted | 17 | 2,940 | 70 | N = int(input())
print ("Yes" if N //10 == 9 or N % 10 == 9 else "No") |
s193308177 | p03485 | u239342230 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 65 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | x=eval(input().replace(' ','+'))
print(x/2 if x%2==0 else x//2+1) | s292802732 | Accepted | 18 | 2,940 | 42 | print(-~eval(input().replace(' ','+'))//2) |
s697220470 | p03943 | u444856278 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 73 | 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. Note that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students. | [print(len(list(i.groupby(input())))-1)for i in[__import__('itertools')]] | s707055602 | Accepted | 18 | 2,940 | 92 | print("Yes"if[x[0]+x[1]==x[2]for x in[sorted([int(i)for i in input().split()])]][0]else"No") |
s779119986 | p03853 | u654558363 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 283 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down). | if __name__ == "__main__":
h, w = map(int, input().split())
c = []
for i in range(h):
c.append(input())
newC = []
for i in range(2*h - 1):
newC.append(c[(i) // 2])
newC.append(c[len(c) - 1])
print("===")
for i in newC:
print(i) | s460483090 | Accepted | 19 | 3,060 | 266 | if __name__ == "__main__":
h, w = map(int, input().split())
c = []
for i in range(h):
c.append(input())
newC = []
for i in range(2*h - 1):
newC.append(c[(i) // 2])
newC.append(c[len(c) - 1])
for i in newC:
print(i) |
s122939556 | p02615 | u229518917 | 2,000 | 1,048,576 | Wrong Answer | 135 | 31,444 | 97 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere. When each player, except the first one to arrive, arrives at the place, the player gets **comfort** equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0. What is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into? | N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
print(A)
print(sum(A[0:-1])) | s468864549 | Accepted | 183 | 31,408 | 204 | N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
AA=[]
AA.append(A[0])
for i in range(1,N):
AA.append(A[i])
AA.append(A[i])
ans=0
for j in range(N-1):
ans+=AA[j]
print(ans) |
s247535607 | p03545 | u892166393 | 2,000 | 262,144 | Wrong Answer | 27 | 9,040 | 402 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted. | abcd=str(input())
for i in range(2**4):
list=[int(abcd[0])]
symbol=[]
for j in range(1,4):
if (i>>j)&1==True:
list.append(int(abcd[j]))
symbol.append('+')
else:
list.append(int(abcd[j])*(-1))
symbol.append('')
if sum(list)==7:
print(list[0],symbol[0],list[1],symbol[1],list[2],symbol[2],list[3],"=7")
break | s643452826 | Accepted | 29 | 9,140 | 440 | import sys
abcd=str(input())
n=len(abcd)
ans=int(abcd[0])
sign=[]
for i in range(2**(n-1)):
for j in range(n-1):
if (i>>j)&1==True:
ans+=int(abcd[j+1])
sign.append("+")
else:
ans-=int(abcd[j+1])
sign.append("-")
if ans==7:
print(abcd[0]+sign[0]+abcd[1]+sign[1]+abcd[2]+sign[2]+abcd[3]+"=7")
sys.exit()
else:
ans=int(abcd[0])
sign=[] |
s548708502 | p03854 | u431624930 | 2,000 | 262,144 | Wrong Answer | 59 | 9,220 | 317 | 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()
flag = 0
while(len(s)>0):
if (s[:6] == 'eraser'):
s = s[6:]
elif (s[:5] == 'erase'):
s = s[5:]
elif (s[:5] == 'dream'):
if (s[5:8] == 'ere' or s[5:8] == 'erd'):
s = s[7:]
else:
s = s[5:]
else:
flag = 1
break
if (flag == 0):
print('Yes')
else:
print('No') | s413184692 | Accepted | 57 | 9,036 | 295 | s = input()
flag = 0
while(len(s)>0):
if (s[-6:] == 'eraser'):
s = s[:-6]
elif (s[-5:] == 'erase'):
s = s[:-5]
elif (s[-7:] == 'dreamer'):
s = s[:-7]
elif (s[-5:] == 'dream'):
s = s[:-5]
else:
flag = 1
break
if (flag == 0):
print('YES')
else:
print('NO') |
s558977849 | p03693 | u175590965 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | 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? | x,a,b = map(int,input().split())
if ((100*x)+(10*a)+(b)% 4)== 0:
print("Yes")
else:
print("No") | s844517483 | Accepted | 17 | 2,940 | 106 | x,a,b = map(int,input().split())
if (((100*x)+(10*a)+(b))% 4) == 0:
print("YES")
else:
print("NO") |
s879936891 | p03545 | u297651868 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 243 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted. | s=input()
op=["+","-"]
for i in range(2):
for j in range(2):
for k in range(2):
formula=s[0]+op[i]+s[1]+op[j]+s[2]+op[k]+s[3]
if eval(formula)==7:
print(formula+"==7")
exit(0) | s453484401 | Accepted | 18 | 3,064 | 204 | a,b,c,d=list(map(str,input()))
def solve(m,n):
if eval(m)==7:
print(m+"=7")
exit(0)
elif n<7:
solve(m,n+2)
solve(m[:n]+"-"+m[n+1:],n+2)
solve(a+"+"+b+"+"+c+"+"+d,1) |
s867477100 | p02646 | u339873473 | 2,000 | 1,048,576 | Wrong Answer | 19 | 9,196 | 231 | 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 = input()
if (int(A) < int(B) and int(V) < int(W)):
print("False")
a = int(A) + (int(V) * int(T))
b = int(B) + (int(W) * int(T))
if a >= b:
print("True") | s328511201 | Accepted | 23 | 9,152 | 148 | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if abs(a-b) <= t* (v-w):
print('YES')
else:
print('NO')
|
s559519170 | p03643 | u224873361 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 153 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | K = int(input())
if K % 2 == 0:
print(2)
print("{0} {1}".format((K)//2 + 1, K//2 + 1))
else:
print(2)
print("{0} {1}".format((K)//2 - 1, (K)//2)) | s029013558 | Accepted | 17 | 2,940 | 22 | print("ABC" + input()) |
s989459499 | p00005 | u002010345 | 1,000 | 131,072 | Wrong Answer | 20 | 5,612 | 159 | Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. | def main():
a,b=(int(x) for x in input().split())
a1=a
b1=b
while b!=0:
c=a%b
a=b
b=c
print(a," ",a1*b1/a)
main()
| s872021498 | Accepted | 20 | 5,600 | 256 | def main():
while True:
try:
a,b=(int(x) for x in input().split())
except:
break
a1=a
b1=b
while b!=0:
c=a%b
a=b
b=c
print(a, a1*b1//a)
main()
|
s173932067 | p03657 | u101627912 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 136 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies. | # -*- coding:utf-8 -*-
a,b=map(int,input().split())
if a%3==0 or b%3==0 or a+b%3==0:
print("Possible")
else:
print("Impossible") | s289171753 | Accepted | 17 | 3,060 | 139 | # -*- coding:utf-8 -*-
a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
print("Possible")
else:
print("Impossible")
|
s232556728 | p02261 | u408260374 | 1,000 | 131,072 | Wrong Answer | 30 | 6,748 | 673 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubble Sort algorithms and the Selection Sort algorithm respectively. These algorithms should be based on the following pseudocode: BubbleSort(C) 1 for i = 0 to C.length-1 2 for j = C.length-1 downto i+1 3 if C[j].value < C[j-1].value 4 swap C[j] and C[j-1] SelectionSort(C) 1 for i = 0 to C.length-1 2 mini = i 3 for j = i to C.length-1 4 if C[j].value < C[mini].value 5 mini = j 6 swap C[i] and C[mini] Note that, indices for array elements are based on 0-origin. For each algorithm, report the stability of the output for the given input (instance). Here, 'stability of the output' means that: cards with the same value appear in the output in the same order as they do in the input (instance). | def bubbleSort(l, n):
for i in range(n):
for j in range(i, n-1):
if l[j][0] > l[j+1][0]:
l[j], l[j+1] = l[j+1], l[j]
return l[:]
def selectionSort(l, n):
for i in range(n):
minj = i
for j in range(i+1, n):
if l[j][0] < l[minj][0]:
minj = j
l[i], l[minj] = l[minj], l[i]
return l[:]
n = int(input())
l = []
for c in input().split():
l.append((int(c[1]), c[0]))
bl = ' '.join([k + str(n) for n, k in bubbleSort(l, n)])
sl = ' '.join([k + str(n) for n, k in selectionSort(l, n)])
print(bl)
print('Stable')
print(sl)
print('Stable' if sl == bl else 'Not stable') | s672776898 | Accepted | 40 | 6,756 | 678 | def bubbleSort(l, n):
for i in range(n):
for j in range(n-1-i):
if l[j][0] > l[j+1][0]:
l[j], l[j+1] = l[j+1], l[j]
return l[:]
def selectionSort(l, n):
for i in range(n):
minj = i
for j in range(i+1, n):
if l[j][0] < l[minj][0]:
minj = j
l[i], l[minj] = l[minj], l[i]
return l[:]
n = int(input())
l = []
for c in input().split():
l.append((int(c[1]), c[0]))
bl = ' '.join([k + str(n) for n, k in bubbleSort(l[:], n)])
sl = ' '.join([k + str(n) for n, k in selectionSort(l[:], n)])
print(bl)
print('Stable')
print(sl)
print('Stable' if sl == bl else 'Not stable') |
s862708605 | p04043 | u099212858 | 2,000 | 262,144 | Wrong Answer | 25 | 9,140 | 138 | 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. | mylist = list(map(int,input().split()))
x = mylist.count(5)
y = mylist.count(7)
if x == 2 and y == 1:
print("Yes")
else:
print("NO")
| s167326061 | Accepted | 25 | 9,164 | 138 | mylist = list(map(int,input().split()))
x = mylist.count(5)
y = mylist.count(7)
if x == 2 and y == 1:
print("YES")
else:
print("NO") |
s156291335 | p02399 | u580737984 | 1,000 | 131,072 | Wrong Answer | 30 | 7,676 | 254 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | i = j = 0
n = ''
m = ''
line = input()
while line[i] != ' ':
n = n + line[i]
i += 1
while i < len(line):
m = m + line[i]
i += 1
n = int(n)
m = int(m)
d = n // m
r = n % m
f = n / m
print(d,end=' ')
print(r,end=' ')
print(f) | s788652451 | Accepted | 30 | 7,684 | 279 | i = j = 0
n = ''
m = ''
line = input()
while line[i] != ' ':
n = n + line[i]
i += 1
while i < len(line):
m = m + line[i]
i += 1
n = int(n)
m = int(m)
d = n // m
r = n % m
f = n / m
print(d,end=' ')
print(r,end=' ')
print("{0:.5f}".format(f)) |
s834784503 | p03672 | u038052425 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 515 | 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. | letters = input()
print(letters)
while True:
not_equal = 0
length = len(letters)
letters = letters[:length-1]
print(letters)
if len(letters) % 2 != 0:
continue
if int(len(letters)) % 2 == 0:
half = int(len(letters)/2 -1)
else:
half = int((len(letters)-1)/2)
i = 0
while i <= half:
if letters[i] != letters[i + half + 1]:
not_equal = 1
break
i += 1
if not_equal == 0:
print(len(letters))
break
| s669548020 | Accepted | 17 | 3,064 | 481 | letters = input()
while True:
not_equal = 0
length = len(letters)
letters = letters[:length-1]
if len(letters) % 2 != 0:
continue
if int(len(letters)) % 2 == 0:
half = int(len(letters)/2 -1)
else:
half = int((len(letters)-1)/2)
i = 0
while i <= half:
if letters[i] != letters[i + half + 1]:
not_equal = 1
break
i += 1
if not_equal == 0:
print(len(letters))
break
|
s335485446 | p03579 | u968404618 | 2,000 | 262,144 | Wrong Answer | 478 | 31,060 | 537 | Rng has a connected undirected graph with N vertices. Currently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i. Rng will add new edges to the graph by repeating the following operation: * Operation: Choose u and v (u \neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v. Find the maximum possible number of edges that can be added. | import sys
sys.setrecursionlimit(10**7)
def dfs(v, color):
colors[v] = color
for to in g[v]:
if colors[to] == color: return False
if colors[to] == 0 and not dfs(to, -color):
return False
return True
n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
colors = [0]*n
ans = -m
if dfs(0,1):
b = sum(colors)//2
w = n-b
ans += b*w
else:
ans += n*(n-1)//2
print(ans) | s926981161 | Accepted | 517 | 31,060 | 541 | import sys
sys.setrecursionlimit(10**7)
def dfs(v, color):
colors[v] = color
for to in g[v]:
if colors[to] == color: return False
if colors[to] == 0 and not dfs(to, -color):
return False
return True
n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a].append(b)
g[b].append(a)
colors = [0]*n
ans = -m
if dfs(0,1):
b = (sum(colors)+n)//2
w = n-b
ans += b*w
else:
ans += n*(n-1)//2
print(ans) |
s355720038 | p03997 | u579875569 | 2,000 | 262,144 | Wrong Answer | 39 | 3,188 | 88 | 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. | #!/usr/bin/python3
a = int(input())
b = int(input())
h = int(input())
print((a+b)*h/2) | s790216752 | Accepted | 38 | 3,064 | 94 | #!/usr/bin/python3
a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2))
|
s421274354 | p03711 | u328755070 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 223 | 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. | x, y = list(map(int, input().split()))
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
if x in a and y in b:
print('Yes')
elif x in b and y in b:
print('Yes')
elif x == 2 and y == 2:
print('Yes')
else:
print('No')
| s334496224 | Accepted | 17 | 2,940 | 223 | x, y = list(map(int, input().split()))
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
if x in a and y in a:
print('Yes')
elif x in b and y in b:
print('Yes')
elif x == 2 and y == 2:
print('Yes')
else:
print('No')
|
s762545198 | p02612 | u767821815 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,144 | 30 | 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(N%1000) | s703998939 | Accepted | 30 | 9,116 | 74 | N = int(input())
if N%1000 == 0:
print(0)
else:
print(1000-N%1000) |
s519358312 | p02257 | u591232952 | 1,000 | 131,072 | Wrong Answer | 20 | 7,660 | 206 | 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. | def prime(n):
for i in range(2, int(n**0.5) + 1):
if n % i:
return False
return True
n = int(input())
c = 0
for _ in range(n):
if prime(int(input())):
c+=1
print(c) | s543004214 | Accepted | 570 | 7,740 | 221 | def prime(n):
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
n = int(input())
c = 0
for _ in range(n):
s = int(input())
if prime(s):
c+=1
print(c) |
s537590024 | p03385 | u702786238 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | s = input()
if sorted(s) == "abc":
print("Yes")
else:
print("No") | s011059777 | Accepted | 17 | 2,940 | 79 | s = input()
if "".join(sorted(s)) == "abc":
print("Yes")
else:
print("No") |
s613914435 | p02833 | u038408819 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 144 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | N = int(input())
if N % 2 == 1:
print(0)
quit()
N /= 2
res = 0
while N:
print(N)
res += int(N / 5)
N = int(N / 5)
print(res) | s266164579 | Accepted | 17 | 3,060 | 143 | N = int(input())
if N % 2 == 1:
print(0)
quit()
N //= 2
s = 1
ans = 0
while N >= 5 ** s:
ans += N // (5 ** s)
s += 1
print(ans) |
s711345659 | p03456 | u674722380 | 2,000 | 262,144 | Wrong Answer | 149 | 12,504 | 203 | 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. | import math
import numpy as np
a, b = map(int, input().split())
c = (int(str(a) + str(b)))
d = math.sqrt(c)
z = np.rint(d)
if z**2== c:
print("Yes")
print(c)
else:
print("No")
print(c) | s756528366 | Accepted | 149 | 12,508 | 177 | import math
import numpy as np
a, b = map(int, input().split())
c = (int(str(a) + str(b)))
d = math.sqrt(c)
z = np.rint(d)
if z**2== c:
print("Yes")
else:
print("No") |
s919697081 | p03456 | u158703648 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 145 | 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. | import math
A,B = map(int, input().split())
C=str(A)+str(B)
C2=int(C)
C3=math.sqrt(C2)
if C3.is_integer():
print("yes")
else:
print("no") | s309688514 | Accepted | 17 | 2,940 | 112 | import math
A,B = map(str,input().split())
if math.sqrt(int(A+B)) % 1==0:
print("Yes")
else:
print("No") |
s098460831 | p03997 | u842388336 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 68 | 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) | s879981341 | Accepted | 17 | 2,940 | 73 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2)) |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 62