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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s728164521 | p03415 | u624475441 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | 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... | print(input()[0])
print(input()[1])
print(input()[2]) | s049216430 | Accepted | 17 | 2,940 | 39 | print(input()[0]+input()[1]+input()[2]) |
s992744035 | p03409 | u123745130 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 309 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | n=int(input())
ll = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: -x[1])
mm=sorted([list(map(int,input().split())) for _ in range(n)])
count_num=0
for i,j in mm:
for k,h in ll:
if k<=i and h<=j:
count_num+=1
ll.remove([k,h])
break
print(n,ll,mm,count_num) | s982287217 | Accepted | 19 | 3,060 | 302 | n=int(input())
ll = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: -x[1])
mm=sorted([list(map(int,input().split())) for _ in range(n)])
count_num=0
for i,j in mm:
for k,h in ll:
if k<=i and h<=j:
count_num+=1
ll.remove([k,h])
break
print(count_num)
|
s190788981 | p03435 | u329749432 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 371 | We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ... | c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())
t22 = c12+c21-c11
t32 = t22+c31-c21
t23 = t22+c13-c12
t33 = t23+t32-t22
t = [t22,t23,t32,t33]
c = [c22,c23,c32,c33]
flag = True
for i in range(0,4):
if t[i]!=c[i]:
flag = False
if ... | s580433472 | Accepted | 17 | 3,064 | 371 | c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())
t22 = c12+c21-c11
t32 = t22+c31-c21
t23 = t22+c13-c12
t33 = t23+t32-t22
t = [t22,t23,t32,t33]
c = [c22,c23,c32,c33]
flag = True
for i in range(0,4):
if t[i]!=c[i]:
flag = False
if ... |
s917141584 | p04029 | u918935103 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | 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())
count = 0
for i in range(n):
count = count + i*i
print(count) | s479805292 | Accepted | 17 | 2,940 | 80 | n = int(input())
count = 0
for i in range(n+1):
count = count + i
print(count) |
s704425244 | p03644 | u819710930 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 141 | 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... | n=int(input())
i=1
for _ in range(9):
i**=2
if i==n:
print(i)
exit()
elif i>n:
print(i//2)
exit() | s417256142 | Accepted | 17 | 2,940 | 137 | n=int(input())
for i in range(9):
if n==2**i:
print(n)
exit()
elif n<2**i:
print(2**(i-1))
exit() |
s619228323 | p03814 | u737321654 | 2,000 | 262,144 | Wrong Answer | 17 | 3,716 | 92 | 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... | s = input()
indexA = s.find("A")
indexZ = s.rfind("Z")
ans = s[indexA:indexZ + 1]
print(ans) | s721489652 | Accepted | 18 | 3,516 | 97 | s = input()
indexA = s.find("A")
indexZ = s.rfind("Z")
ans = len(s[indexA:indexZ + 1])
print(ans) |
s710966237 | p03407 | u076827647 | 2,000 | 262,144 | Wrong Answer | 347 | 20,792 | 121 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | import numpy as np
a = list(map(int, input().split()))
if a[0] + a[1] >= a[2]:
print('yes')
else:
print('no')
| s795109378 | Accepted | 17 | 2,940 | 99 | a = list(map(int, input().split()))
if a[0] + a[1] >= a[2]:
print('Yes')
else:
print('No') |
s960012948 | p00007 | u503263570 | 1,000 | 131,072 | Wrong Answer | 20 | 7,540 | 36 | 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. | n=int(input())
print(n*10000+100000) | s775829602 | Accepted | 20 | 7,540 | 94 | import math
n=int(input())
r=100000
for i in range(n):
r=math.ceil(r*1.05/1000)*1000
print(r) |
s823578519 | p03693 | u903948194 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | 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... | nums = int(''.join(input().split()))
if nums % 4 == 0:
print('Yes')
else:
print('No') | s149523168 | Accepted | 18 | 2,940 | 93 | nums = int(''.join(input().split()))
if nums % 4 == 0:
print('YES')
else:
print('NO') |
s589868980 | p03433 | u512623857 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
if (n % 500) >= a:
print("NO")
else:
print("YES")
| s784114327 | Accepted | 17 | 2,940 | 92 | n = int(input())
a = int(input())
if (n % 500) <= a:
print("Yes")
else:
print("No")
|
s584009857 | p00001 | u139200784 | 1,000 | 131,072 | Wrong Answer | 20 | 7,532 | 246 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | # -*- coding: utf-8 -*-
#print a # [a1, a2, a3, ..., aN]
import sys
a = []
for line in sys.stdin:
a.append(int(line))
#print a # [a1, a2, a3, ...]
sorted(a, reverse=True)
print(a[0])
print(a[1])
print(a[2]) | s105926465 | Accepted | 40 | 7,656 | 243 | # -*- coding: utf-8 -*-
#print a # [a1, a2, a3, ..., aN]
import sys
a = []
for line in sys.stdin:
a.append(int(line))
#print a # [a1, a2, a3, ...]
a.sort(reverse=True)
print(a[0])
print(a[1])
print(a[2]) |
s876914569 | p03478 | u252828980 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 142 | 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())
sum1 = 0
for i in range(1,n+1):
if a<= i//10 + (i - i//10) <=b:
sum1 += i//10 + (i - i//10)
print(sum1) | s843809195 | Accepted | 48 | 3,060 | 182 | n,a,b = map(int,input().split())
sum1 = 0
ans = 0
for i in range(1,n+1):
sum1 =0
for j in range(len(str(i))):
sum1 +=int(str(i)[j])
if a<= sum1 <=b:
ans += i
print(ans) |
s811745996 | p00025 | u071010747 | 1,000 | 131,072 | Wrong Answer | 20 | 7,400 | 538 | Let's play Hit and Blow game. _A_ imagines four numbers and _B_ guesses the numbers. After _B_ picks out four numbers, _A_ answers: * The number of numbers which have the same place with numbers _A_ imagined (Hit) * The number of numbers included (but different place) in the numbers _A_ imagined (Blow) For examp... | # -*- coding:utf-8 -*-
def main():
while True:
try:
A=input().split()
B=input().split()
Hit=0
Blow=0
for b in B:
if b in A:
index=B.index(b)
print(index)
if b==A[index]:... | s477121779 | Accepted | 20 | 7,400 | 505 | # -*- coding:utf-8 -*-
def main():
while True:
try:
A=input().split()
B=input().split()
Hit=0
Blow=0
for b in B:
if b in A:
index=B.index(b)
if b==A[index]:
Hit+=1
... |
s907227196 | p03449 | u388323466 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 224 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | n = int(input())
arr = []
for i in range(2):
arr += [list(map(int,input().split()))]
ans = 0
for j in range(n):
tmp = 0
tmp += sum(arr[0][0:j+1])
tmp += sum(arr[1][j:])
print(tmp)
ans = max(ans,tmp)
print(ans)
| s652994058 | Accepted | 17 | 3,060 | 212 | n = int(input())
arr = []
for i in range(2):
arr += [list(map(int,input().split()))]
ans = 0
for j in range(n):
tmp = 0
tmp += sum(arr[0][0:j+1])
tmp += sum(arr[1][j:])
ans = max(ans,tmp)
print(ans)
|
s905952318 | p03636 | u559346857 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 37 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | a,*b,c=input()
print(a,str(len(b)),c) | s027444352 | Accepted | 17 | 2,940 | 37 | a,*b,c=input()
print(a+str(len(b))+c) |
s845071632 | p02845 | u852690916 | 2,000 | 1,048,576 | Wrong Answer | 173 | 14,056 | 405 | N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of p... | N = int(input())
A = list(map(int,input().split()))
MOD = 1000000007
C=[0,0,0]
ans=1
for a in A:
found=False
count=C.count(a)
if count==0:
print(0)
exit()
C[C.index(a)]+=1
ans=ans*count%MOD
print(count)
print(ans) | s849470621 | Accepted | 104 | 14,056 | 388 | N = int(input())
A = list(map(int,input().split()))
MOD = 1000000007
C=[0,0,0]
ans=1
for a in A:
found=False
count=C.count(a)
if count==0:
print(0)
exit()
C[C.index(a)]+=1
ans=ans*count%MOD
print(ans) |
s086558769 | p03068 | u943294442 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 138 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | n = int(input())
sstr = input()
k = int(input())
s = list(sstr)
for i in range(n):
if s[k-1] != s[i]:
s[i] = "*"
sStr = "".join(s) | s971947286 | Accepted | 17 | 3,060 | 150 | n = int(input())
sstr = input()
k = int(input())
s = list(sstr)
for i in range(n):
if s[k-1] != s[i]:
s[i] = "*"
sStr = "".join(s)
print(sStr) |
s419032590 | p03386 | u502731482 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 187 | 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())
for i in range(a, a + k):
if i > b:
break
print(i)
for i in range(max(a + k, b - k), b + 1):
if i > b:
break
print(i) | s172240965 | Accepted | 18 | 3,060 | 191 |
a, b, k = map(int, input().split())
for i in range(a, a + k):
if i > b:
break
print(i)
for i in range(max(a + k, b - k + 1), b + 1):
if i > b:
break
print(i) |
s381784965 | p02608 | u222668979 | 2,000 | 1,048,576 | Wrong Answer | 954 | 9,772 | 333 | 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())
cnt = [0] * n
for x in range(1, int(n ** 0.5) + 1):
for y in range(1, int(n ** 0.5) + 1):
for z in range(1, int(n ** 0.5) + 1):
num = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
if num <= n:
print(num)
cnt[num - 1] += 1
print(*cn... | s503768365 | Accepted | 477 | 9,712 | 296 | n = int(input())
cnt = [0] * n
for x in range(1, int(n ** 0.5) + 1):
for y in range(1, int(n ** 0.5) + 1):
for z in range(1, int(n ** 0.5) + 1):
num = (x + y) ** 2 - x * y + z * (x + y + z)
if num <= n:
cnt[num - 1] += 1
print(*cnt, sep="\n")
|
s318317358 | p02409 | u964416376 | 1,000 | 131,072 | Wrong Answer | 30 | 7,752 | 280 | 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 fl... | 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 = [int(i) for i in input().split()]
a[b-1][f-1][r-1] = v
for x in a:
for y in x:
print(' '.join(map(str, y)))
print('####################') | s544270354 | Accepted | 20 | 7,688 | 355 | 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 = [int(i) for i in input().split()]
a[b-1][f-1][r-1] += v
for i, x in enumerate(a):
for y in x:
for z in y:
print(' %d' % z, end='')
print('')
if i < 4 - 1:
... |
s758840822 | p03493 | u476048753 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | 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. | s = input()
ans = 0
if s[0] == "1":
ans += 1
if s[1] == "1":
ans += 1
if s[2] == "1":
ans += 1
| s822372948 | Accepted | 18 | 2,940 | 114 | s = input()
ans = 0
if s[0] == "1":
ans += 1
if s[1] == "1":
ans += 1
if s[2] == "1":
ans += 1
print(ans) |
s679557730 | p03471 | u083494782 | 2,000 | 262,144 | Wrong Answer | 794 | 3,060 | 231 | 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())
#10000:i 5000:j 1000:k
i = -1
j = -1
k = -1
for i in range(N+1):
for j in range(N+1-i):
k = N - i - j
if 10000 * i + 5000 * j + 1000 * k == Y:
break
print(i,j,k)
| s842365650 | Accepted | 828 | 3,060 | 285 | N,Y=map(int,input().split())
#10000:i 5000:j 1000:k
i2 = -1
j2 = -1
k2 = -1
for i in range(N+1):
for j in range(N+1-i):
k = N - i - j
if 10000 * i + 5000 * j + 1000 * k == Y:
i2 = i
j2 = j
k2 = k
break
print(i2,j2,k2) |
s766292543 | p03399 | u705418271 | 2,000 | 262,144 | Wrong Answer | 30 | 9,168 | 92 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | A=int(input())
B=int(input())
C=int(input())
D=int(input())
a=max(A,B)
b=max(C,D)
print(a+b) | s967539073 | Accepted | 28 | 9,168 | 92 | A=int(input())
B=int(input())
C=int(input())
D=int(input())
a=min(A,B)
b=min(C,D)
print(a+b) |
s043620180 | p00002 | u454259029 | 1,000 | 131,072 | Wrong Answer | 20 | 7,540 | 54 | Write a program which computes the digit number of sum of two integers a and b. | a,b = map(int,input().split(" "))
print(len(str(a+b))) | s648482927 | Accepted | 30 | 7,492 | 124 | while True:
try:
a,b = map(int,input().split())
print (len(str(a+b)))
except EOFError:
break |
s604775150 | p03729 | u403984573 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 96 | 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... | A,B,C=input().split()
if A[-0]==B[0]:
if B[-0]==C[0]:
print("YES")
else:
print("NO") | s800847304 | Accepted | 18 | 2,940 | 116 | A,B,C=input().split()
if A[-1]==B[0]:
if B[-1]==C[0]:
print("YES")
else:
print("NO")
else:
print("NO") |
s849403570 | p03765 | u638795007 | 2,000 | 262,144 | Wrong Answer | 690 | 12,500 | 2,362 | Let us consider the following operations on a string consisting of `A` and `B`: 1. Select a character in a string. If it is `A`, replace it with `BB`. If it is `B`, replace with `AA`. 2. Select a substring that is equal to either `AAA` or `BBB`, and delete it from the string. For example, if the first operation i... | def examC():
N = I()
d = defaultdict(int)
for i in range(N):
curD = defaultdict(int)
S = SI()
for s in S:
curD[s]+=1
if i==0:
d = curD
continue
for s in alphabet:
d[s] = min(d[s],curD[s])
d = sorted(d.items())
an... | s869635980 | Accepted | 440 | 10,320 | 2,363 | def examC():
N = I()
d = defaultdict(int)
for i in range(N):
curD = defaultdict(int)
S = SI()
for s in S:
curD[s]+=1
if i==0:
d = curD
continue
for s in alphabet:
d[s] = min(d[s],curD[s])
d = sorted(d.items())
an... |
s192832451 | p02260 | u798803522 | 1,000 | 131,072 | Wrong Answer | 20 | 7,644 | 349 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | length = int(input())
targ = [int(n) for n in input().split(' ')]
ans = 0
for l in range(length):
value = l
for init in range(l + 1,length):
if targ[value] > targ[init]:
value = init
if value != l:
disp = targ[l]
targ[l] = targ[value]
targ[value] = disp
an... | s315896276 | Accepted | 20 | 7,744 | 377 | length = int(input())
targ = [int(n) for n in input().split(' ')]
ans = 0
for l in range(length):
value = l
for init in range(l + 1,length):
if targ[value] > targ[init]:
value = init
if value != l:
disp = targ[l]
targ[l] = targ[value]
targ[value] = disp
an... |
s549301994 | p04030 | u902151549 | 2,000 | 262,144 | Wrong Answer | 46 | 5,576 | 3,572 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | # coding: utf-8
import re
import math
from collections import defaultdict
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.se... | s226479199 | Accepted | 45 | 5,704 | 3,575 | # coding: utf-8
import re
import math
from collections import defaultdict
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.se... |
s928532066 | p03729 | u808569469 | 2,000 | 262,144 | Wrong Answer | 28 | 8,940 | 114 | 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... | a, b, c = map(str, input().split())
if a[-1] == b[-1] and b[-1] == c[-1]:
print("YES")
else:
print("NO")
| s252045735 | Accepted | 27 | 9,092 | 112 | a, b, c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
print("YES")
else:
print("NO")
|
s158217010 | p03759 | u473023730 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | 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") | s358331888 | Accepted | 17 | 3,064 | 79 | a,b,c=map(int, input().split())
if b-a==c-b:
print("YES")
else:
print("NO") |
s143560540 | p03449 | u924828749 | 2,000 | 262,144 | Wrong Answer | 25 | 9,108 | 235 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
res = 0
for i in range(n):
c = 0
for j in range(n):
if j <= i:
c += a[j]
else:
c += b[j]
res = max(res,c)
print(res) | s374459355 | Accepted | 29 | 9,112 | 283 | n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
res = 0
for i in range(n):
c = 0
for j in range(n):
if j < i:
c += a[j]
elif j == i:
c += a[j]
c += b[j]
else:
c += b[j]
res = max(res,c)
print(res) |
s349046409 | p03473 | u613996976 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 29 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | a = int(input())
print(24-a)
| s088097319 | Accepted | 18 | 2,940 | 29 | a = int(input())
print(48-a)
|
s662358046 | p02928 | u478719560 | 2,000 | 1,048,576 | Wrong Answer | 1,180 | 3,572 | 835 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | from sys import stdin
from collections import defaultdict, deque, Counter
import sys
from bisect import bisect_left
import heapq
import math
sys.setrecursionlimit(1000000000)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rst... | s350326056 | Accepted | 806 | 3,572 | 781 | from sys import stdin
from collections import defaultdict, deque, Counter
import sys
from bisect import bisect_left
import heapq
import math
sys.setrecursionlimit(10000000)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstri... |
s680799449 | p02678 | u079022116 | 2,000 | 1,048,576 | Wrong Answer | 1,033 | 106,376 | 863 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque
N, M = map(int, input().split())
AB = [map(int, input().split()) for _ in range(M)]
link = [[] for _ in range(N + 1)]
for a, b in AB:
link[a].append(b)
link[b].append(a)
dist = [-1] * (N + 1)
que = deque([1])
while que:
v = que.popleft()
for i in link[v]:
... | s184253789 | Accepted | 1,118 | 106,472 | 843 | from collections import deque
N, M = map(int, input().split())
AB = [map(int, input().split()) for _ in range(M)]
link = [[] for _ in range(N + 1)]
for a, b in AB:
link[a].append(b)
link[b].append(a)
dist = [-1] * (N + 1)
que = deque([1])
while que:
v = que.popleft()
for i in link[v]:
... |
s271986137 | p02255 | u445032255 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 345 | 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):
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(" ".join(list(map(str, A))))
def main():
N = int(input())
A = [int(i) for i in input().split()]
inse... | s540710798 | Accepted | 20 | 5,600 | 373 | def print_list(A):
print(" ".join(list(map(str, A))))
def main():
N = int(input())
A = list(map(int, input().split()))
print_list(A)
for i in range(1, N):
store_v = A[i]
j = i - 1
while j >= 0 and A[j] > store_v:
A[j + 1] = A[j]
j -= 1
... |
s237446788 | p03494 | u848654125 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 292 | 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. | def count2(number):
count = 0
while True:
if number % 2 == 0:
count = count + 1
number = number / 2
else:
break
return count
A_list = list(map(int, input().split()))
answer = min(list(map(count2, A_list)))
print(answer) | s370973649 | Accepted | 18 | 3,060 | 308 | def count2(number):
count = 0
while True:
if number % 2 == 0:
count = count + 1
number = number / 2
else:
break
return count
N = int(input())
A_list = list(map(int, input().split()))
answer = min(list(map(count2, A_list)))
print(answer) |
s956731799 | p03351 | u096845660 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,164 | 383 | 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 (a - c) <= d:
print('yes')
elif (a - b) <= d and (b - c) <= d:
print('yes')
else:
print('no') | s732065167 | Accepted | 25 | 9,056 | 916 |
a, b, c, d = map(int, input().split())
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
print('Yes')
else:
print('No') |
s544624936 | p03943 | u268516119 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | 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... | ans=["NO","YES"]
candy=list(map(int,input().split()))
print(ans[sum(candy)/2 in candy])
| s574263043 | Accepted | 17 | 2,940 | 88 | ans=["No","Yes"]
candy=list(map(int,input().split()))
print(ans[sum(candy)/2 in candy])
|
s114719278 | p03475 | u543954314 | 3,000 | 262,144 | Wrong Answer | 90 | 3,188 | 279 | A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t... | def tcalc(station):
time = 0
for i in range(station-1,n-1):
f = l[i][2]
s = l[i][1]
c = l[i][0]
time = max(((time-1)//f+1)*f, s)+c
return time
n = int(input())
l = [tuple(map(int, input().split())) for _ in range(n-1)]
for i in range(1,n):
print(tcalc(i)) | s813585691 | Accepted | 83 | 3,064 | 281 | def tcalc(station):
time = 0
for i in range(station-1,n-1):
f = l[i][2]
s = l[i][1]
c = l[i][0]
time = max(((time-1)//f+1)*f, s)+c
return time
n = int(input())
l = [tuple(map(int, input().split())) for _ in range(n-1)]
for j in range(1,n+1):
print(tcalc(j)) |
s256520889 | p02613 | u130076114 | 2,000 | 1,048,576 | Wrong Answer | 167 | 16,332 | 391 | 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`,... | N=int(input())
s=[]
cnt=[0 for i in range(4)]
for i in range(N):
s.append(input())
for i in range(N):
if s[i]=="AC":
cnt[0]+=1
elif s[i]=="WA":
cnt[1]+=1
elif s[i]=="TLE":
cnt[2]+=1
elif s[i]=="RE":
cnt[3]+=1
print("AC x {}".format(cnt[0]))
print("WA x {}".format(cn... | s520809101 | Accepted | 162 | 16,196 | 391 | N=int(input())
s=[]
cnt=[0 for i in range(4)]
for i in range(N):
s.append(input())
for i in range(N):
if s[i]=="AC":
cnt[0]+=1
elif s[i]=="WA":
cnt[1]+=1
elif s[i]=="TLE":
cnt[2]+=1
elif s[i]=="RE":
cnt[3]+=1
print("AC x {}".format(cnt[0]))
print("WA x {}".format(cn... |
s091063702 | p03759 | u228294553 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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")
| s574672937 | Accepted | 17 | 2,940 | 86 | a,b,c=map(int,input().split())
if b-a == c-b:
print("YES")
else:
print("NO")
|
s351317428 | p02261 | u822165491 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 1,017 | 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 Bubbl... | def BubbleSort(A, N):
flag = 1
while flag:
flag = 0
for j in reversed(range(1, N)):
if A[j]['value']<A[j-1]['value']:
A[j], A[j-1] = A[j-1], A[j]
flag = 1
return A
def SelectionSort(A, N):
for i in range(0, N):
minj = i
for j i... | s626200736 | Accepted | 30 | 6,356 | 1,271 | import time
import copy
def BubbleSort(A, N):
flag = 1
while flag:
flag = 0
for j in reversed(range(1, N)):
if A[j]['value']<A[j-1]['value']:
A[j], A[j-1] = A[j-1], A[j]
flag = 1
return A
def SelectionSort(A, N):
for i in range(0, N):
... |
s695290444 | p03338 | u330314953 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 136 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | n = int(input())
s = list(input())
z = 0
for i in range(n-1):
x,y = s[0:i],s[i+1:n-1]
z = max(z,len(set(x) & set(y)))
print(z) | s668164895 | Accepted | 20 | 3,316 | 130 | n = int(input())
s = list(input())
z = 0
for i in range(n):
x,y = s[0:i],s[i:n]
z = max(z,len(set(x) & set(y)))
print(z) |
s000890931 | p02645 | u417348126 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,036 | 31 | 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. | name = input()
print(name[0:2]) | s496339744 | Accepted | 28 | 8,960 | 31 | name = input()
print(name[0:3]) |
s482896793 | p03386 | u584558499 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 317 | 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. | def main():
A, B, K = (int(i) for i in input().split())
result = set()
A_min = min(A+K, B)
B_max = max(A, B-K)
for i in range(A, A_min):
result.add(i)
for j in range(B_max, B+1):
result.add(j)
for i in sorted(result):
print(i)
if __name__ == '__main__':
main() | s944898545 | Accepted | 17 | 3,064 | 324 | def main():
A, B, K = (int(i) for i in input().split())
result = set()
A_min = min(A+K-1, B)
B_max = max(A, B-K+1)
for i in range(A, A_min+1):
result.add(i)
for j in range(B_max, B+1):
result.add(j)
for i in sorted(result):
print(i)
if __name__ == '__main__':
ma... |
s499993138 | p02261 | u387437217 | 1,000 | 131,072 | Wrong Answer | 30 | 7,772 | 754 | 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 Bubbl... | # coding: utf-8
# Here your code !
n=int(input())
cards=input().split()
def bubble_sort(cards,n):
for i in range(n):
for j in range(-1,-i,-1):
a=int(cards[j][1])
b=int(cards[j-1][1])
if a<b:
cards[j],cards[j-1]=cards[j-1],cards[j]
return cards
def se... | s324604112 | Accepted | 20 | 7,780 | 807 | # coding: utf-8
# Here your code !
n=int(input())
cards=input().split()
def bubble_sort(cards_b,n):
for i in range(n):
for j in range(-1,-n,-1):
a=int(cards_b[j][1])
b=int(cards_b[j-1][1])
if a<b:
cards_b[j],cards_b[j-1]=cards_b[j-1],cards_b[j]
return... |
s286875853 | p03369 | u223646582 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | 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 ... | S=input()
print(700+S.count('o')) | s747364500 | Accepted | 17 | 2,940 | 37 | S=input()
print(700+100*S.count('o')) |
s920296601 | p03150 | u003670363 | 2,000 | 1,048,576 | Wrong Answer | 28 | 3,700 | 243 | 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. | A = str(input())
for i in range(len(A)):
for j in range(len(A)):
b =A[:i]+A[len(A)-j:len(A)]
print(b)
if b == "keyence":
print("YES")
exit()
elif i==len(A):
print("NO")
exit()
else:
continue | s153254182 | Accepted | 21 | 2,940 | 191 | A = str(input())
for i in range(len(A)):
for j in range(len(A)):
b =A[:i]+A[len(A)-j:len(A)]
if b == "keyence":
print("YES")
exit()
else:
continue
print("NO") |
s044956101 | p03494 | u260040951 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 232 | 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. | l = list(input().split(","))
d = [0]
count = 0
max_count = 0
for n in l:
while int(n) % 2 == 0:
n = int(n)/2
count = count + 1
if max_count < count:
max_count = count
count = 0
print(max_count) | s371378332 | Accepted | 21 | 3,064 | 340 | number = input()
l = list(input().split(" "))
loop_count = 0
count = 0
min_count = 0
for n in l:
loop_count = loop_count + 1
while int(n) % 2 == 0:
n = int(n)/2
count = count + 1
if loop_count == 1:
min_count = count
elif min_count > count:
min_count = count
count =... |
s458990574 | p03495 | u813174766 | 2,000 | 262,144 | Wrong Answer | 152 | 35,032 | 173 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. | n,k=map(int,input().split())
nm=[0 for i in range(200010)]
a=list(map(int,input().split()))
for i in a:
nm[i]+=1
a.sort(reverse=True)
for i in range(k):
n-=a[i]
print(n) | s719257093 | Accepted | 118 | 35,308 | 175 | n,k=map(int,input().split())
nm=[0 for i in range(200010)]
a=list(map(int,input().split()))
for i in a:
nm[i]+=1
nm.sort(reverse=True)
for i in range(k):
n-=nm[i]
print(n) |
s756796710 | p03720 | u800258529 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 114 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | n,m=map(int,input().split())
l=list(open(0).read().split())
print(*[l.count(str(i+1)) for i in range(n)],sep='\n') | s000875904 | Accepted | 17 | 2,940 | 140 | n,m=map(int,input().split())
l=[]
for _ in range(m):
l+=list(map(int,input().split()))
print(*[l.count(i+1) for i in range(n)],sep='\n') |
s437786989 | p03635 | u928784113 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 77 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | # -*- coding: utf-8 -*-
n,m =map(int,input().split())
print("{}".format(n*m)) | s993070096 | Accepted | 18 | 2,940 | 85 | # -*- coding: utf-8 -*-
n,m =map(int,input().split())
print("{}".format((n-1)*(m-1))) |
s408567630 | p02846 | u972416428 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 418 | Takahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east. They start simultaneously at the same point and moves as follows **towards the east** : * Takahashi runs A_1 meters per minute for the first T_1 minutes, then runs at A_2 meters per minute for th... | import sys
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())
a = a1 * t1 + a2 * t2
b = b1 * t1 + b2 * t2
ha = a1 * t1
hb = b1 * t1
if a == b or ha == hb:
print ("infinity")
sys.exit(0)
if a > b:
a, b = b, a
ha, hb = hb, ha
gap = b - a
hgap = ha - hb
if... | s389406401 | Accepted | 18 | 3,064 | 427 | import sys
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())
a = a1 * t1 + a2 * t2
b = b1 * t1 + b2 * t2
ha = a1 * t1
hb = b1 * t1
if a == b or ha == hb:
print ("infinity")
sys.exit(0)
if a > b:
a, b = b, a
ha, hb = hb, ha
gap = b - a
hgap = ha - hb
if... |
s998420497 | p02255 | u588555117 | 1,000 | 131,072 | Wrong Answer | 20 | 7,604 | 258 | 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 ... | n = int(input())
array = input().split()
intarr = [int(x) for x in array]
print(intarr)
for c in range(1,n):
v = intarr[c]
j = c-1
while j>=0 and intarr[j]>v:
intarr[j+1] = intarr[j]
j -= 1
intarr[j+1] = v
print(intarr) | s785499583 | Accepted | 30 | 8,104 | 434 | n = int(input())
array = input().split()
intarr = [int(x) for x in array]
for x in intarr:
if x == intarr[-1]:
print(x)
else:
print(x,end=' ')
for c in range(1,n):
v = intarr[c]
j = c-1
while j>=0 and intarr[j]>v:
intarr[j+1] = intarr[j]
j -= 1
intarr[j+1] = v... |
s588398586 | p02399 | u177081782 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 114 | 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) | a, b= map(int, input(). split())
d = a / b
r = a % b
f = "%.5F"%(a/b)
print(str(d) + " " + str(r) + " " +str(f))
| s477628633 | Accepted | 20 | 5,604 | 115 | a, b= map(int, input(). split())
d = a // b
r = a % b
f = "%.5F"%(a/b)
print(str(d) + " " + str(r) + " " +str(f))
|
s395175596 | p03919 | u328755070 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 254 | 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 sq... | H, W = list(map(int, input().split()))
S = [input().split() for i in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == 'snuke':
ans = [chr(i) for i in range(97, 97+26)][j] + str(i + 1)
break
print(ans)
| s529193400 | Accepted | 30 | 3,828 | 257 | import string
H, W = list(map(int, input().split()))
S = [input().split() for i in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == 'snuke':
ans = string.ascii_uppercase[j] + str(i + 1)
break
print(ans)
|
s518717787 | p03434 | u509739538 | 2,000 | 262,144 | Wrong Answer | 22 | 3,444 | 2,597 | 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... | import math
from collections import deque
from collections import defaultdict
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
def factorization(n):
res = []
if n%2==0:
res.append(2)
for i in range(... | s413990366 | Accepted | 22 | 3,444 | 2,609 | import math
from collections import deque
from collections import defaultdict
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
def factorization(n):
res = []
if n%2==0:
res.append(2)
for i in range(... |
s074350663 | p03050 | u367130284 | 2,000 | 1,048,576 | Wrong Answer | 119 | 3,268 | 346 | 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. | def dv(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
n=int(input())
ans=0
for i in dv(n):
if n//(i+1)==n%(i+1):
ans+=i%(10**9+7)
pri... | s985259307 | Accepted | 115 | 3,264 | 327 | def dv(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.remove(1)
return divisors
n=int(input())
x=dv(n)
ans=0
for i in x:
if n//(i-1)==n%(i-1):
ans+=i-1
prin... |
s831336642 | p03156 | u970809473 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 229 | You have written N problems to hold programming contests. The i-th problem will have a score of P_i points if used in a contest. With these problems, you would like to hold as many contests as possible under the following condition: * A contest has three problems. The first problem has a score not greater than A po... | n = int(input())
a,b = map(int, input().split())
res = [0,0,0]
arr = list(map(int, input().split()))
for i in range(n):
if arr[i] <= a:
res[0] += 1
elif arr[i] <= b:
res[1] += 1
else:
res[2] += 1
print(min(arr)) | s663114866 | Accepted | 17 | 3,060 | 230 | n = int(input())
a,b = map(int, input().split())
res = [0,0,0]
arr = list(map(int, input().split()))
for i in range(n):
if arr[i] <= a:
res[0] += 1
elif arr[i] <= b:
res[1] += 1
else:
res[2] += 1
print(min(res))
|
s560661846 | p03361 | u009348313 | 2,000 | 262,144 | Wrong Answer | 23 | 3,064 | 438 | 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... | import itertools
H, W = map(int, input().split())
s = []
for i in range(H):
s.append(input())
print(s)
for i in range(H):
for j in range(W):
if s[i][j] == "#":
flag = False
for x, y in [[1, 0],[-1, 0],[0, 1],[0, -1]]:
if i + x >= 0 and i + x <= H - 1 and j + y >= 0 and j + y <= W - 1 a... | s503470786 | Accepted | 24 | 3,064 | 409 | H, W = map(int, input().split())
s = []
for i in range(H):
s.append(input())
for i in range(H):
for j in range(W):
if s[i][j] == "#":
flag = False
for x, y in [[1, 0],[-1, 0],[0, 1],[0, -1]]:
if i + x >= 0 and i + x <= H - 1 and j + y >= 0 and j + y <= W - 1 and s[i + x][j + y] == '#':
... |
s034234855 | p03944 | u281152316 | 2,000 | 262,144 | Wrong Answer | 75 | 9,356 | 799 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | W, H, N = map(int,input().split())
x = 0
y = 0
a = 0
X = []
Y = []
A = []
for i in range(N):
x, y, a = map(int,input().split())
X.append(x)
Y.append(y)
A.append(a)
P = [[0 for i in range(W)] for j in range(H)]
for i in range(N):
if A[i] == 1:
for j in range(X[i]):
for k in range(... | s378135582 | Accepted | 75 | 9,352 | 790 | W, H, N = map(int,input().split())
x = 0
y = 0
a = 0
X = []
Y = []
A = []
for i in range(N):
x, y, a = map(int,input().split())
X.append(x)
Y.append(y)
A.append(a)
P = [[0 for i in range(W)] for j in range(H)]
for i in range(N):
if A[i] == 1:
for j in range(X[i]):
for k in range(... |
s467712235 | p00018 | u868716420 | 1,000 | 131,072 | Wrong Answer | 20 | 7,672 | 99 | Write a program which reads five numbers and sorts them in descending order. | a = [int(temp) for temp in input().split()]
a.sort
a = [str(temp) for temp in a]
print(' '.join(a)) | s153816500 | Accepted | 20 | 7,684 | 115 | a = [int(temp) for temp in input().split()]
a.sort(reverse = True)
a = [str(temp) for temp in a]
print(' '.join(a)) |
s821487257 | p03695 | u488884575 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 275 | 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... | n = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: x//400, A))
#print(A)
import collections
c = collections.Counter(A)
if not 8 in c.keys():
print(len(c.keys()), ' ', len(c.keys()))
else:
print(len(c.keys()) -1, ' ', len(c.keys()) -1 + c[8]) | s887062332 | Accepted | 21 | 3,316 | 431 | n = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: x//400, A))
#print(A)
import collections
c = collections.Counter(A)
#print(c)
f1 = f2 = 0
for k in c.keys():
if k >= 8:
f1 += 1
f2 += c[k]
if f1 == 0:
min_ = max_ = len(c.keys())
else:
min_ = len(c.keys())... |
s344385517 | p02286 | u893844544 | 2,000 | 262,144 | Wrong Answer | 20 | 5,620 | 2,152 | 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):
self.key = key
self.pri = pri
self.left = None
self.right = None
def rightRotate(t):
s = t.left
t.left = s.right
s.right = t
return s
def leftRotate(t):
s = t.right
t.right = s.left
s.left = t
return s
def... | s146946386 | Accepted | 5,500 | 52,020 | 2,158 | class Node:
def __init__(self, key, pri):
self.key = key
self.pri = pri
self.left = None
self.right = None
def rightRotate(t):
s = t.left
t.left = s.right
s.right = t
return s
def leftRotate(t):
s = t.right
t.right = s.left
s.left = t
return s
def... |
s497758940 | p02842 | u115110170 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 122 | 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())
k = n*100/108
k = int(k)
ans = ":("
for i in range(-1,2):
if n==int(k*1.08):
ans = k+i
print(ans) | s202517653 | Accepted | 17 | 2,940 | 125 | n = int(input())
k = n*100/108
k = int(k)
ans = ":("
for i in range(k-1,k+2):
if n==int(i*1.08):
ans = i
print(ans)
|
s098115380 | p03378 | u959759457 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 147 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | N,M,X=map(int,input().split())
A=list(map(int,input().split()))
N_cost=len([i>X for i in A])
Z_cost=len([i<X for i in A])
print(min(N_cost,Z_cost)) | s698756949 | Accepted | 19 | 3,060 | 177 | N,M,X=map(int,input().split())
A=list(map(int,input().split()))
N_cost=len(list(filter(lambda x:x >X, A)))
Z_cost=len(list(filter(lambda x:x <X, A)))
print(min(N_cost,Z_cost))
|
s178432076 | p03494 | u335448425 | 2,000 | 262,144 | Wrong Answer | 30 | 3,520 | 302 | 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. | import math
N = int(input())
A = list(map(int, input().split()))
res = 1000
for a in A:
print('a:', a)
cnt = 0
while a%2 == 0:
a = (a//2)
cnt += 1
print(' ->', a, '(cnt:', cnt, ')')
print(' cnt:', cnt)
res = min(res, cnt)
print(' res:', res)
print(res) | s238550227 | Accepted | 18 | 3,060 | 194 | import math
N = int(input())
A = list(map(int, input().split()))
res = 1000
for a in A:
cnt = 0
while a%2 == 0:
a = (a//2)
cnt += 1
res = min(res, cnt)
print(res) |
s222035622 | p03609 | u459150945 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand. How many grams of sand will the upper bulb contains after t seconds? | X, t = map(int, input().split())
print(min(X-t, 0))
| s280801687 | Accepted | 17 | 2,940 | 52 | X, t = map(int, input().split())
print(max(X-t, 0))
|
s949184736 | p03623 | u117193815 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | 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... | x,a,b=map(int, input().split())
a=abs(a-x)
b=abs(b-x)
print(min(a,b)) | s045138708 | Accepted | 17 | 2,940 | 93 | x,a,b=map(int, input().split())
a=abs(a-x)
b=abs(b-x)
if a<b:
print("A")
else:
print("B") |
s826558713 | p03371 | u930723367 | 2,000 | 262,144 | Wrong Answer | 28 | 9,156 | 351 | "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 curr... | a,b,c,x,y = map(int, input().split())
kei = 0
if c > a/2 + b/2:
kei = a * x + b*y
elif c < a+ b:
kei += c * (min(x,y)*2)
if x > y:
kei += c * ((x - y)*2)
else:
kei += c * ((y - x)*2)
elif c < a/2 + b/2:
kei += c * (min(x,y)*2)
if x > y:
kei += a * (x -y)
else:
... | s516942085 | Accepted | 28 | 9,108 | 421 | a,b,c,x,y = map(int, input().split())
kei = 0
if c >= a/2 + b/2:
kei = a * x + b*y
elif c*2 <= a+ b and a >= c * 2 and x > y:
kei += c * (min(x,y)*2)
kei += c * ((x - y)*2)
elif c*2 <= a+ b and b >= c * 2 and x < y:
kei += c * (min(x,y)*2)
kei += c * ((y - x)*2)
elif c <= a/2 + b/2:
kei += c ... |
s919911047 | p02272 | u890722286 | 1,000 | 131,072 | Wrong Answer | 30 | 7,628 | 727 | Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function. Merge(A, left, mid, right) n1 = mid - left; n2 = right - mid; create array L[0...n1], R[0...n2] for i = 0 to n1-1 do L[i] = A[left + i] ... | import sys
n = int(input())
SENTINEL = 10000000000
COMPAR = 0
A = list(map(int, sys.stdin.readline().split()))
def merge(A, left, mid, right):
global COMPAR
n1 = mid - left
n2 = right - mid
L = A[left:mid]
R = A[mid:right]
L.append(SENTINEL)
R.append(SENTINEL)
j = 0
i = 0
for ... | s183604604 | Accepted | 4,400 | 72,664 | 747 | import sys
n = int(input())
SENTINEL = 10000000000
COMPAR = 0
A = list(map(int, sys.stdin.readline().split()))
def merge(A, left, mid, right):
global COMPAR
n1 = mid - left
n2 = right - mid
L = A[left:mid]
R = A[mid:right]
L.append(SENTINEL)
R.append(SENTINEL)
j = 0
i = 0
for ... |
s004012498 | p03229 | u735763891 | 2,000 | 1,048,576 | Wrong Answer | 214 | 8,272 | 448 | You are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like. | def tpbc_2018_c():
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()
if len(a) % 2 == 0:
low = a[:len(a) // 2]
high = sorted(a[len(a) // 2:], reverse=True)
return 2 * (sum(high) - sum(low)) + max(low) - min(high)
else:
low = a[:len(a) // 2]
high ... | s965621243 | Accepted | 217 | 8,532 | 451 | def tpbc_2018_c():
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()
low = a[:len(a) // 2]
high = a[len(a) // 2:]
if len(a) % 2 == 0:
return 2 * (sum(high) - sum(low)) + max(low) - min(high)
else:
low2 = a[:len(a) // 2 + 1]
high2 = a[len(a) // 2 + 1:]
... |
s755485922 | p03557 | u595353654 | 2,000 | 262,144 | Wrong Answer | 398 | 48,224 | 2,649 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ... | ##a = int(stdin.readline().rstrip())
##b, c = [int(x) for x in stdin.readline().rstrip().split()]
##s = stdin.readline().rstrip()
##a = list(map(int,[int(x) for x in stdin.readline().rstrip().split()])) a[0, 1, 2, ...]
##a = [[0] * 2 for _ in range(n)] a[0,0]
# -*- coding: utf-8 -*-
from sys import stdin
from o... | s323606815 | Accepted | 330 | 48,744 | 2,651 | ##a = int(stdin.readline().rstrip())
##b, c = [int(x) for x in stdin.readline().rstrip().split()]
##s = stdin.readline().rstrip()
##a = list(map(int,[int(x) for x in stdin.readline().rstrip().split()])) a[0, 1, 2, ...]
##a = [[0] * 2 for _ in range(n)] a[0,0]
# -*- coding: utf-8 -*-
from sys import stdin
from o... |
s987832972 | p03478 | u021166294 | 2,000 | 262,144 | Wrong Answer | 48 | 3,884 | 454 | 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). | import math
def main():
num_n, num_a, num_b = list(map(int, input().split()))
count_list = []
for i in range(1, num_n + 1):
print("num", i)
digit_list = list(str(i))
digit_list_int = [int(j) for j in digit_list]
num_sum = sum(digit_list_int)
if num_a <= num_sum and n... | s747224348 | Accepted | 38 | 3,680 | 455 | import math
def main():
num_n, num_a, num_b = list(map(int, input().split()))
count_list = []
for i in range(1, num_n + 1):
#print("num", i)
digit_list = list(str(i))
digit_list_int = [int(j) for j in digit_list]
num_sum = sum(digit_list_int)
if num_a <= num_sum and ... |
s494271472 | p03545 | u868982936 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 308 | 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 in... | ABCD = input()
for i in range(2**3):
ans = ABCD[0]
num = int(ABCD[0])
for j in range(3):
if i >> j & 1:
ans = ans + '+' + ABCD[j+1]
num = num + int(ABCD[j+1])
else:
ans = ans + '-' + ABCD[j+1]
num = num + int(ABCD[j+1])
if num == 7:
print(ans + '=7')
break
| s471406162 | Accepted | 17 | 3,064 | 355 | ABCD = input()
for i in range(2**3):
ans = ABCD[0]
num = int(ABCD[0])
for j in range(3):
if (i >>j & 1):
ans = ans + '+' + ABCD[j+1]
num = num + int(ABCD[j+1])
else:
ans = ans + '-' + ABCD[j+1]
num = num - int(ABCD[j+1])
if num == 7:
... |
s296287111 | p03369 | u210295876 | 2,000 | 262,144 | Wrong Answer | 25 | 8,992 | 97 | 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 ... | S = input()
ramen = 700
for i in range(2):
if S[i] == 'o':
ramen += 100
print(ramen) | s690648632 | Accepted | 26 | 9,000 | 76 | S=input()
ans=700
for i in range(3):
if S[i]=='o':
ans+=100
print(ans) |
s229314653 | p03860 | u799521877 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 31 | 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... | s = input()
print('A'+s[0]+'C') | s919356197 | Accepted | 17 | 2,940 | 29 | s=input()
print('A'+s[8]+'C') |
s335326609 | p02608 | u452512115 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,206 | 8,828 | 218 | 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())
for n in range(1, N+1):
count = 0
for i in range (1, 101):
for j in range(1, 101):
for k in range(1, 101):
if i*i+j*j+k*k+i*j+j*k+k*i == n:
count += 1
print(count)
| s848623932 | Accepted | 442 | 9,316 | 215 | N = int(input())
ans = [0] * (N + 1)
for i in range (1, 101):
for j in range(1, 101):
for k in range(1, 101):
n = i*i+j*j+k*k+i*j+j*k+k*i
if n <= N:
ans[n] += 1
print(*ans[1:], sep='\n')
|
s725131743 | p03609 | u371467115 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand. How many grams of sand will the upper bulb contains after t seconds? | s=list(input())
s=s[::2]
print("".join(s))
| s480638296 | Accepted | 17 | 2,940 | 72 | X,t=map(int,input().split())
if X-t>0:
print(X-t)
else:
print(0) |
s336761313 | p03796 | u103902792 | 2,000 | 262,144 | Wrong Answer | 41 | 2,940 | 100 | 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 = 1
for i in range(1,n+1):
ans *= i
ans %= mod
print(mod) | s223449830 | Accepted | 41 | 2,940 | 102 | n = int(input())
mod = 10**9 + 7
ans = 1
for i in range(1,n+1):
ans *= i
ans %= mod
print(ans)
|
s580326448 | p03457 | u565380863 | 2,000 | 262,144 | Wrong Answer | 276 | 11,764 | 894 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | import sys
sys.setrecursionlimit(200000)
def input():
return sys.stdin.readline()[:-1]
def ii(t: type = int):
return t(input())
def il(t: type = int):
return list(map(t, input().split()))
def imi(N: int, t: type = int):
return [ii(t) for _ in range(N)]
def iml(N: int, t: type = int):
ret... | s389649786 | Accepted | 280 | 11,764 | 894 | import sys
sys.setrecursionlimit(200000)
def input():
return sys.stdin.readline()[:-1]
def ii(t: type = int):
return t(input())
def il(t: type = int):
return list(map(t, input().split()))
def imi(N: int, t: type = int):
return [ii(t) for _ in range(N)]
def iml(N: int, t: type = int):
ret... |
s807188447 | p03555 | u186426563 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | 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. | print('Yes' if input() == input()[::-1] else 'No') | s439901422 | Accepted | 17 | 2,940 | 50 | print('YES' if input() == input()[::-1] else 'NO') |
s780329795 | p03854 | u626467464 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 157 | 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()
line = s.replace("dream","").replace("dreamer","").replace("erase","").replace("eraser","")
if len(line) == 0:
print("Yes")
else:
print("No") | s474430749 | Accepted | 18 | 3,188 | 147 | s = input()
line = s.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if line:
print("NO")
else:
print("YES") |
s245858271 | p02393 | u293957970 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 66 | Write a program which reads three integers, and prints them in ascending order. | a = list(map(int,input().split()))
a.sort()
print(a[0],a[1],a[1])
| s711782636 | Accepted | 30 | 5,588 | 99 | numbers = list(map(int,input().split()))
numbers .sort()
print(numbers[0],numbers[1],numbers[2])
|
s064122413 | p02619 | u798890085 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,388 | 475 | Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to che... | D = int(input())
C = list(map(int, input().split()))
S = list(list(map(int, input().split())) for i in range(D))
T = list(int(input()) for i in range(D))
manzoku = 0
yasumi= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
print(len(yasumi))
for day in range(D):
yasumi = list(map(lambda... | s306760082 | Accepted | 35 | 9,516 | 456 | D = int(input())
C = list(map(int, input().split()))
S = list(list(map(int, input().split())) for i in range(D))
T = list(int(input()) for i in range(D))
manzoku = 0
yasumi= [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for day in range(D):
yasumi = list(map(lambda x: x + 1, yasumi))... |
s890061340 | p02831 | u164873417 | 2,000 | 1,048,576 | Wrong Answer | 100 | 3,868 | 285 | 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 ... | A, B = map(int, input().split())
N = A*B
#print(N)
if A >= B:
a = int(N/A)
for i in range(a):
if A*(a-i) % B == 0:
N = A*(a-i)
else:
b = int(N/B)
for i in range(b):
print(b-i)
if B*(b-i) % A == 0:
N = B*(b-i)
print(N) | s591877034 | Accepted | 37 | 3,060 | 257 | A, B = map(int, input().split())
N = A*B
if A >= B:
a = int(N/A)
for i in range(a):
if A*(a-i) % B == 0:
N = A*(a-i)
else:
b = int(N/B)
for i in range(b):
if B*(b-i) % A == 0:
N = B*(b-i)
print(N)
|
s826593345 | p02383 | u998435601 | 1,000 | 131,072 | Wrong Answer | 20 | 7,452 | 714 | Write a program to simulate rolling a dice, which can be constructed by the following net. As shown in the figures, each face is identified by a different label from 1 to 6. Write a program which reads integers assigned to each face identified by the label and a sequence of commands to roll the dice, ... | # coding: utf-8
class Dice(object):
def __init__(self):
self.x = [2, 5]
self.y = [3, 4]
self.z = [1, 6]
SN = {'S': 0, 'N': 1}
WE = {'W': 0, 'E': 1}
pass
def rotate(self, _dir):
def rot(_k, _r):
return list(reversed(_r)), _k
if _dir=='N':
self.x, self.z = rot(self.x, self.z)
elif _dir=... | s783211891 | Accepted | 30 | 7,800 | 760 | # coding: utf-8
class Dice(object):
def __init__(self):
self.x = [2, 5]
self.y = [3, 4]
self.z = [1, 6]
SN = {'S': 0, 'N': 1}
WE = {'W': 0, 'E': 1}
pass
def rotate(self, _dir):
def rot(_k, _r):
return list(reversed(_r)), _k
if _dir=='N':
self.x, self.z = rot(self.x, self.z)
elif _dir=... |
s920119853 | p02731 | u096294926 | 2,000 | 1,048,576 | Wrong Answer | 153 | 2,940 | 130 | Given is a positive integer L. Find the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L. | L = int(input())
m = 0
for i in range(L):
for j in range(L-i):
if i*j*(L-i-j)>=m:
m = i*j*(L-i-j)
print(m) | s493771924 | Accepted | 17 | 2,940 | 77 | import math
L = float(input())
m = float((L/3)**3)
print('{:.12f}'.format(m)) |
s584071661 | p04043 | u675044240 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | 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 = list(map(str, input().split()))
if a.count("5") == 2 and a.count("7") == 1:
print("Yes")
else:
print("No") | s586090244 | Accepted | 17 | 2,940 | 120 | a = list(map(str, input().split()))
if a.count("5") == 2 and a.count("7") == 1:
print("YES")
else:
print("NO")
|
s789724832 | p02265 | u938045879 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 404 | Your task is to implement a double linked list. Write a program which performs the following operations: * insert x: insert an element with key x into the front of the list. * delete x: delete the first element which has the key of x from the list. If there is not such element, you need not do anything. * delet... | n = int(input())
output = []
for i in range(n):
li = input().split(' ')
if(li[0] == 'insert'):
output.insert(0, int(li[1]))
elif(li[0] == 'delete'):
if(li[1] in output):
output.remove(int(li[1]))
elif(li[0] == 'deleteFirst'):
del output[0]
elif(li[0] == 'deleteLas... | s861967074 | Accepted | 4,680 | 69,736 | 416 | from collections import deque
n = int(input())
output = deque()
for i in range(n):
li = input().split(' ')
if(li[0] == 'insert'):
output.appendleft(li[1])
elif(li[0] == 'deleteFirst'):
output.popleft()
elif(li[0] == 'deleteLast'):
output.pop()
elif(li[0] == 'delete'):
... |
s264492851 | p03415 | u591295155 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | 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... | A = input()
B = input()
C = input()
print(A[0], B[1], C[2]) | s034650545 | Accepted | 17 | 2,940 | 57 | A = input()
B = input()
C = input()
print(A[0]+B[1]+C[2]) |
s490574048 | p00087 | u452926933 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 753 | 博士 : ピーター君、ついにやったよ。 ピーター : またですか。今度はどんなくだらない発明ですか。 博士 : ついに数式を計算機で処理する画期的な方法を思いついたんだ。この表をみてごらん。 通常の記法| 博士の「画期的な」記法 ---|--- 1 + 2| 1 2 + 3 * 4 + 7| 3 4 * 7 + 10 / ( 2 - 12 ) | 10 2 12 - / ( 3 - 4 ) * ( 7 + 2 * 3 )| 3 4 - 7 2 3 * + * ピーター : はぁ。 博士 : ふっふっふ。これだけでは、未熟者の君には何のことだかわからないだろうねえ。ここからが肝心なんじゃ。 ピ... | def is_float_str(num_str, default=0):
try:
return {"is_float": True, "val": float(num_str)}
except ValueError:
return {"is_float": False, "val": default}
def compute(operand, val1, val2):
if operand == "+":
return val1 + val2
elif operand == "-":
return val1 - v... | s530934220 | Accepted | 20 | 5,596 | 1,089 | def is_float_str(num_str, default=0):
try:
return {"is_float": True, "val": float(num_str)}
except ValueError:
return {"is_float": False, "val": default}
def compute(operand, val1, val2):
if operand == "+":
return val2 + val1
elif operand == "-":
return val2 - val1
... |
s301117813 | p03305 | u729707098 | 2,000 | 1,048,576 | Wrong Answer | 1,731 | 90,548 | 690 | Kenkoooo is planning a trip in Republic of Snuke. In this country, there are n cities and m trains running. The cities are numbered 1 through n, and the i-th train connects City u_i and v_i bidirectionally. Any city can be reached from any city by changing trains. Two currencies are used in the country: yen and snuuk.... | from heapq import heappop,heappush
n,m,s,t = (int(i) for i in input().split())
x,y = [[] for i in range(n+1)],[[] for i in range(n+1)]
for i in range(m):
u,v,a,b = (int(i) for i in input().split())
x[u].append((v,a))
x[v].append((u,a))
y[u].append((v,b))
y[v].append((u,b))
def dijkstra(n,s,adj):
di... | s171020440 | Accepted | 1,742 | 90,572 | 697 | from heapq import heappop,heappush
n,m,s,t = (int(i) for i in input().split())
x,y = [[] for i in range(n+1)],[[] for i in range(n+1)]
for i in range(m):
u,v,a,b = (int(i) for i in input().split())
x[u].append((v,a))
x[v].append((u,a))
y[u].append((v,b))
y[v].append((u,b))
def dijkstra(n,s,adj):
di... |
s515615403 | p03644 | u374103100 | 2,000 | 262,144 | Wrong Answer | 21 | 3,444 | 308 | 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... |
import itertools
from collections import Counter
from collections import defaultdict
import bisect
def main():
N = int(input())
ans = 0
while N % 2 == 0:
ans += 1
N //= 2
print(ans)
if __name__ == '__main__':
main()
| s990177524 | Accepted | 21 | 3,444 | 454 |
import itertools
from collections import Counter
from collections import defaultdict
import bisect
def main():
N = int(input())
ans = 0
count = -1
for i in range(1, N+1):
c = 0
v = i
while v % 2 == 0:
c += 1
v //= 2
if c > count:
cou... |
s907837249 | p02612 | u852870914 | 2,000 | 1,048,576 | Wrong Answer | 41 | 9,604 | 573 | 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. |
from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
import heapq
int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline().split()
multi_int_input =lambda : map(int, std... | s502978057 | Accepted | 31 | 9,600 | 623 |
from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
import heapq
int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline().split()
multi_int_input =lambda : map(int, std... |
s874492542 | p03644 | u119983020 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 127 | 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... | N = int(input())
power = [1,2,4,8,16,32,64]
for i in range(len(power)):
if N <= power[i] :
print(power[i])
break
| s992798343 | Accepted | 20 | 2,940 | 95 | N = int(input())
power = [64,32,16,8,4,2,1]
for i in power:
if N >= i:
print(i)
break |
s826228722 | p00352 | u737311644 | 1,000 | 262,144 | Wrong Answer | 20 | 5,584 | 44 | Alice and Brown are brothers in a family and each receives pocket money in celebration of the coming year. They are very close and share the total amount of the money fifty-fifty. The pocket money each receives is a multiple of 1,000 yen. Write a program to calculate each one’s share given the amount of money Alice an... | a,b=map(int,input().split())
print((a+b)/2)
| s841147161 | Accepted | 20 | 5,580 | 45 | a,b=map(int,input().split())
print((a+b)//2)
|
s903274867 | p03388 | u944209426 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 421 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | import math
q = int(input())
a = [list(map(int, input().split())) for i in range(q)]
for i in range(q):
ans = 0
AB = a[i][0]*a[i][1]
if a[i][0]<=a[i][1]:
A, B = a[i][0], a[i][1]
else:
A, B = a[i][1], a[i][0]
x = int(math.sqrt(AB))
if A==B:
ans=2*A-2
elif A+1==B:
... | s545407131 | Accepted | 18 | 3,064 | 455 | import math
q = int(input())
a = [list(map(int, input().split())) for i in range(q)]
for i in range(q):
ans = 0
AB = a[i][0]*a[i][1]
if a[i][0]<=a[i][1]:
A, B = a[i][0], a[i][1]
else:
A, B = a[i][1], a[i][0]
x = int(math.sqrt(AB-1))
while x*x>=AB:
x-=1
if A==B:
... |
s222123486 | p03448 | u045176840 | 2,000 | 262,144 | Wrong Answer | 120 | 27,148 | 364 | 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 co... | import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_list = [A_init * i for i in range(1,int(input())+1)]
B_list = [B_init * i for i in range(1,int(input())+1)]
C_list = [C_init * i for i in range(1,int(input())+1)]
X = int(input())
All_list = np.concatenate([A_list, B_list, C_list], 0)
np.count_nonzero([k+[i... | s662847536 | Accepted | 29 | 9,136 | 553 | # import numpy as np
A_init = 500
B_init = 100
C_init = 50
A_n = int(input())
B_n = int(input())
C_n = int(input())
X = int(input())
cnt = 0
for a in range(A_n+1):
if A_init * a <= X:
for b in range(B_n+1):
if (A_init * a + B_init * b) <= X:
K = X - (A_init * a + B_init * b)
... |
s048172163 | p03152 | u905802918 | 2,000 | 1,048,576 | Wrong Answer | 22 | 3,188 | 554 | 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... | def f(A,B,M,N):
# return int
ans=1
mod=10**9+7
r,c=0,0
for i in range(M*N,-1,-1):
ans=ans%mod
if (i in A) and (i in B):
r+=1
c+=1
continue
if i in A:
r+=1
if c==0: return 0
ans*=c
continue
if i in B:
c+=1
if r==0: return 0
ans*=r
... | s940635689 | Accepted | 368 | 3,188 | 793 | def f(A,B,M,N):
ans=1
MOD=10**9+7
r,c=1,1
if (M*N not in A) or (M*N not in B):
return 0;
# print("MN in A or B")
for o in range(M*N-1,0,-1):
ans=ans%MOD
if o in A:
r+=1
#row i-th's max is o:
if o in B:
c+=1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.