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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s225807551 | p03860 | u144980750 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 40 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | a=input().split()
print("A"+a[1][0]+"B") | s383302189 | Accepted | 17 | 2,940 | 40 | a=input().split()
print("A"+a[1][0]+"C") |
s291250205 | p03470 | u947748301 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 162 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... |
paper = int(input())
moti_list = []
li_uniq = []
for w in range(paper):
paper = int(input())
moti_list.append(paper)
| s029089737 | Accepted | 17 | 3,060 | 214 |
paper = int(input())
moti_list = []
li_uniq = []
for w in range(paper):
paper = int(input())
moti_list.append(paper)
li_uniq = list(set(moti_list))
print(len(li_uniq)) |
s550444885 | p03069 | u720384347 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 317 | 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 t... | S=list(input())
b = 0
w = 0
for i in range(len(S)):
if(S[i]=="#"):
b += 1
else:
w += 1
b_ = w
min_ = min([len(S)+1,w,b])
for i in range(len(S)):
if(S[i]=="#"):
b += 1
w_ = w-(i+1-b)
min_ = min([w_+b_,min_])
print(min_) | s516614910 | Accepted | 175 | 4,840 | 307 | N = int(input())
S=list(input())
b = 0
w = 0
for i in range(len(S)):
if(S[i]=="#"):
b += 1
else:
w += 1
b_ = 0
min_ = min([w,b])
w_ = 0
for i in range(len(S)):
if(S[i]=="#"):
b_ += 1
else:
w_ += 1
min_ = min([w-w_+b_,min_])
print(min_) |
s356581774 | p03457 | u687553041 | 2,000 | 262,144 | Wrong Answer | 231 | 28,176 | 534 | 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
def dis(x0, y0, x1, y1):
d = 0
d += abs(x0 - x1)
d += abs(y0 - y1)
return d
if __name__ == '__main__':
N = int(sys.stdin.readline())
lines = sys.stdin.readlines()
ls = []
for line in lines:
ls.append([int(i) for i in line.split()])
t, x, y = 0, 0, 0
for l i... | s670714409 | Accepted | 261 | 28,296 | 598 | import sys
def dis(x0, y0, x1, y1):
d = 0
d += abs(x0 - x1)
d += abs(y0 - y1)
return d
if __name__ == '__main__':
N = int(sys.stdin.readline())
lines = sys.stdin.readlines()
ls = [[0, 0, 0]]
for line in lines:
ls.append([int(i) for i in line.split()])
for i in range(1, le... |
s751963750 | p03548 | u536685012 | 2,000 | 262,144 | Wrong Answer | 30 | 3,060 | 138 | 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... | n = list(map(int, input().split()))
a = n[0]
b = n[1]
c = n[2]
i = 0
l = a
l -= c
while l > b + c:
i += 1
l -= b + c
print(int(i)) | s531627313 | Accepted | 30 | 2,940 | 145 | n = list(map(int, input().split()))
a = n[0]
b = n[1]
c = n[2]
i = 0
l = a
l -= c
while l >= (b + c):
i += 1
l -= (b + c)
print(i) |
s168340311 | p03048 | u957198490 | 2,000 | 1,048,576 | Wrong Answer | 1,500 | 3,060 | 171 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | r,g,b,n = map(int,input().split())
ans = 0
for i in range(int(n/r)+1):
for j in range(int((n-r*i)+1)):
if (n-r*i-g*j) % b == 0:
ans += 1
print(ans) | s919967048 | Accepted | 1,519 | 3,060 | 169 | r,g,b,n = map(int,input().split())
ans = 0
for i in range((n//r)+1):
for j in range(((n-r*i)//g)+1):
if (n-r*i-g*j) % b == 0:
ans += 1
print(ans) |
s619351491 | p02865 | u505181116 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 73 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input())
if n%2 == 0:
print(int(n/2)+1)
else:
print(int(n/2)) | s059224910 | Accepted | 18 | 2,940 | 74 | n = int(input())
if n%2 == 0:
print(int(n/2)-1)
else:
print(int(n/2))
|
s577306745 | p00002 | u256256172 | 1,000 | 131,072 | Wrong Answer | 30 | 7,556 | 53 | 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))) | s821134407 | Accepted | 20 | 7,692 | 92 | import sys
for line in sys.stdin:
a, b = map(int, line.split())
print(len(str(a+b))) |
s676521825 | p04043 | u559126797 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | 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=input().split()
if a.count('5')==2 and a.count('7')==1:
print("Yes")
else:
print("No") | s385485592 | Accepted | 17 | 2,940 | 92 | a=input().split()
if a.count('5')==2 and a.count('7')==1:
print("YES")
else:
print("NO") |
s742811731 | p03853 | u044952145 | 2,000 | 262,144 | Wrong Answer | 24 | 3,700 | 111 | 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, p... | H, M = map(int, input().split())
C = [input() for _ in range(H)]
for row in C:
print(*row)
print(*row) | s287380514 | Accepted | 17 | 3,060 | 109 | H, M = map(int, input().split())
C = [input() for _ in range(H)]
for row in C:
print(row)
print(row) |
s390504330 | p02409 | u922112509 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 596 | 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... |
n = int(input())
houses = 4
floors = 3
rooms = 10
official = [[[0 for k in range(rooms)] for j in range(floors)] for i in range(houses)]
print(official)
for a in range(n):
info = [int(x) for x in input().rstrip().split()]
b = info[0] - 1
f = info[1] - 1
r = info[2] - 1
v = info[3]
currentFlo... | s022698601 | Accepted | 20 | 5,624 | 634 |
n = int(input())
houses = 4
floors = 3
rooms = 10
official = [[[0 for k in range(rooms)] for j in range(floors)] for i in range(houses)]
for a in range(n):
info = [int(x) for x in input().rstrip().split()]
b = info[0] - 1
f = info[1] - 1
r = info[2] - 1
v = info[3]
currentFloor = official[b... |
s636443318 | p03380 | u785578220 | 2,000 | 262,144 | Wrong Answer | 84 | 14,428 | 147 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | N= map(int, input().split())
x = list(map(int, input().split()))
m = max(x)
M = m/2
s = float("INF")
for i in x:
s = min(s,abs(M-i))
print(m,s) | s010831073 | Accepted | 61 | 13,660 | 234 | a = int(input())
x = list(map(float, input().split()))
m = max(x)
M = m/2
t = 0
s = float("INF")
for i in x:
#print(s,abs(M-i),i,M)
if s >= abs(M-i):
s = min(s,abs(M-i))
t = i
print(str(int(m))+" "+str(int(t))) |
s963677712 | p03673 | u603234915 | 2,000 | 262,144 | Wrong Answer | 131 | 26,180 | 326 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | def split_and_change(N, Array):
Arr1 = [a for ind, a in enumerate(Array) if ind % 2 == 0]
Arr2 = [a for ind, a in enumerate(Array) if ind % 2 != 0]
if N % 2 == 0:
return Arr2[::-1] + Arr1
else:
return Arr1[::-1] + Arr2
print(split_and_change(int(input()), list(map(int, input().split... | s554419299 | Accepted | 46 | 21,572 | 242 | def split_and_change(N, Array):
Arr1 = Array[0::2]
Arr2 = Array[1::2]
if N % 2 == 0:
return Arr2[::-1] + Arr1
else:
return Arr1[::-1] + Arr2
print(" ".join(split_and_change(int(input()), input().split()))) |
s982618161 | p03456 | u672866777 | 2,000 | 262,144 | Wrong Answer | 29 | 9,012 | 282 | 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. | # -*- coding: utf-8 -*-
import math
a, b = map(int, input().split())
connected_num = int(str(a) + str(b))
c = int(math.sqrt(connected_num))
print(connected_num)
if connected_num == c*c:
print("Yes")
else:
print("No") | s434939079 | Accepted | 31 | 8,960 | 261 | # -*- coding: utf-8 -*-
import math
a, b = map(int, input().split())
connected_num = int(str(a) + str(b))
c = int(math.sqrt(connected_num))
if connected_num == c*c:
print("Yes")
else:
print("No") |
s924594991 | p03563 | u147808483 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | a=int(input())
b=int(input())
print(a+b/2) | s649999670 | Accepted | 17 | 2,940 | 35 | print(-int(input())+2*int(input())) |
s518534137 | p03050 | u952022797 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,696 | 593 | 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. | # -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
input = sys.stdin.readline
def main():
#R, G, B, N = map(int, input().split(" "))
N = int(input())
if N <= 2:
print(0)
sys.exit()
ansans = N - 1
if N < 8:
print... | s642699248 | Accepted | 120 | 4,016 | 589 | # -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
def main():
N = int(input())
tmp = make_divisors(N)
ans = []
for i in tmp:
a = i - 1
if a == 0:
continue
if N // a == N % a:
ans.append(a)
print(sum(ans))
def make_... |
s418578742 | p03544 | u305018585 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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) | n = int( input())
a = [2,1] + [0]*(86-1)
print(len(a))
for i in range(2,87) :
a[i] =a[i-1]+a[i-2]
print(a[n]) | s944971513 | Accepted | 17 | 2,940 | 100 | n = int( input())
a = [2,1] + [0]*(86-1)
for i in range(2,87) :
a[i] =a[i-1]+a[i-2]
print(a[n]) |
s672440184 | p04043 | u850582941 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 366 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | A,B,C = map(int, input("").split())
if A == 5:
if B == 5:
if C == 7:
print("YES")
elif B == 7:
if C == 5:
print("YES")
else:
print("NO")
else:
print("NO")
if A == 7:
if B == 5:
if C == 5:
print("YES")
else:... | s404119686 | Accepted | 17 | 2,940 | 103 | x = list(map(int, input().split()))
x.sort()
if x == [5, 5, 7]:
print("YES")
else:
print("NO") |
s093733235 | p03449 | u503901534 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 304 | 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())
a111 = list(map(int,input().split()))
a222 = list(map(int,input().split()))
al = []
sums = 0
for i in range(n):
p = i
for j in range(p):
sums = sums + a111[j]
for k in range(p,n):
sums = sums + a222[k]
al.append(sums)
sums = 0
print(max(al)) | s151763305 | Accepted | 19 | 3,064 | 306 | n = int(input())
a111 = list(map(int,input().split()))
a222 = list(map(int,input().split()))
al = []
sums = 0
for i in range(n):
p = i
for j in range(p+1):
sums = sums + a111[j]
for k in range(p,n):
sums = sums + a222[k]
al.append(sums)
sums = 0
print(max(al)) |
s705028296 | p02927 | u723444827 | 2,000 | 1,048,576 | Wrong Answer | 35 | 3,724 | 250 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | M, D = map(int,input().split())
count = 0
for m in range(M+1):
for d in range(D):
d_1 = d % 10
d_10 = d // 10
print(m, d_10, d_1)
if (d_10 >= 2 and d_1 >= 2 and m == d_10*d_1):
count += 1
print(count) | s093516385 | Accepted | 19 | 2,940 | 224 | M, D = map(int,input().split())
count = 0
for m in range(M+1):
for d in range(D+1):
d_1 = d % 10
d_10 = d // 10
if (d_10 >= 2 and d_1 >= 2 and m == d_10*d_1):
count += 1
print(count) |
s401489486 | p00013 | u777299405 | 1,000 | 131,072 | Wrong Answer | 20 | 7,368 | 129 | This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top- right rail track is used for the exit. Ten cars, which have numbers from 1 to 10 respectively, use the rail tracks. We can simulate the movement (comings and goi... | stack = []
while True:
try:
n = int(input)
except:
break
stack.append(n) if n else print(stack.pop()) | s623596758 | Accepted | 20 | 7,532 | 131 | stack = []
while True:
try:
n = int(input())
except:
break
stack.append(n) if n else print(stack.pop()) |
s188972248 | p02972 | u595952233 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 16,036 | 253 | 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 con... | n = int(input())
a = list(map(int, input().split()))
b = [0]*n
for i in list(range(n))[::-1]:
b[i] = sum([a[j] for j in range(n) if j%(i+1)==0])%2
if sum(b) == 0:
print(0)
else:
print(' '.join(map(str, [i+1 for i in range(n) if b[i]==1]))) | s676735253 | Accepted | 487 | 18,868 | 312 | n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
count = 0
for i in range(n-1, -1, -1):
c = sum([ans[j] for j in range(i, n, i+1)])%2
if c != a[i]:
count+=1
ans[i] = 1
print(count)
ans = [i+1 for i in range(n) if ans[i]==1]
if count > 0:
print(' '.join(map(str, ans))) |
s312707919 | p02398 | u193025715 | 1,000 | 131,072 | Wrong Answer | 30 | 6,716 | 107 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | a, b, c = map(int, input().split())
ans = 0
for i in range(a, b+1):
if i % c == 0:
ans += 1
print(ans) | s655598095 | Accepted | 40 | 6,724 | 107 | a, b, c = map(int, input().split())
ans = 0
for i in range(a, b+1):
if c % i == 0:
ans += 1
print(ans) |
s411124365 | p03359 | u611090896 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a,b = map(int,input().split())
print( (a-1) if a>b else (a+1)) | s716507296 | Accepted | 17 | 2,940 | 57 | a,b = map(int,input().split())
print( a-1 if a>b else a)
|
s689021425 | p03644 | u457901067 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | 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())
ans = 1
while N > 0:
N = N // 2
ans = ans * 2
print(ans) | s252007070 | Accepted | 17 | 2,940 | 79 | N = int(input())
ans = 1
while N > 1:
N = N // 2
ans = ans * 2
print(ans) |
s886173258 | p00102 | u672822075 | 1,000 | 131,072 | Wrong Answer | 40 | 6,720 | 287 | Your task is to develop a tiny little part of spreadsheet software. Write a program which adds up columns and rows of given table as shown in the following figure: | while True:
n=int(input())
if not n: break
a=[list(map(int,input().split())) for _ in range(n)]
t=[[0 for _ in range(n+1)] for _ in range(n+1)]
for i in range(n):
for j in range(n):
t[i][j]=a[i][j]
t[i][n]+=a[i][j]
t[n][j]+=a[i][j]
t[n][n]+=a[i][j]
print(a)
print(t) | s618356129 | Accepted | 30 | 6,720 | 333 | while True:
n=int(input())
if not n: break
a=[list(map(int,input().split())) for _ in range(n)]
t=[[0 for _ in range(n+1)] for _ in range(n+1)]
for i in range(n):
for j in range(n):
t[i][j]=a[i][j]
t[i][n]+=a[i][j]
t[n][j]+=a[i][j]
t[n][n]+=a[i][j]
for i in range(n+1):
print("".join(map("{0:>5}".f... |
s680222203 | p03068 | u021916304 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 312 | 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 `*`. |
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()
s = list(input())
k = ii()
for i in s:
if i != s[k-1]:
i = '*'
print(''.join(s)) | s129212502 | Accepted | 17 | 3,064 | 330 |
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()
s = list(input())
k = ii()
for i in range(len(s)):
if s[i] != s[k-1]:
s[i] = '*'
print('... |
s649513197 | p03738 | u123745130 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | a=int(input())
b=int(input())
print(["GREATER","LESS","EQUAL"][(a>b)+(a==b)]) | s994007503 | Accepted | 17 | 2,940 | 78 | i=input
a=int(i())
b=int(i())
print(["GREATER","LESS","EQUAL"][(b>=a)+(a==b)]) |
s536906007 | p03469 | u604655161 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 138 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | def ABC_85_A():
S = input()
S = list(S)
S[3] = '4'
S = ''.join(S)
print(S)
if __name__ == '__main__':
ABC_85_A() | s715302322 | Accepted | 17 | 2,940 | 138 | def ABC_85_A():
S = input()
S = list(S)
S[3] = '8'
S = ''.join(S)
print(S)
if __name__ == '__main__':
ABC_85_A() |
s836050024 | p03469 | u197078193 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 31 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | S = input()
print('2018'+S[5:]) | s304559951 | Accepted | 17 | 2,940 | 31 | S = input()
print('2018'+S[4:]) |
s508464160 | p03369 | u658993896 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | 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 ... | ans = 0
for x in input():
if x == 'o':
ans += 100
print(ans) | s185005113 | Accepted | 17 | 2,940 | 76 | ans = 0
for x in input():
if x == 'o':
ans += 100
print(700+ans) |
s949734947 | p03523 | u178079174 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 131 | You are given a string S. Takahashi can insert the character `A` at any position in this string any number of times. Can he change S into `AKIHABARA`? | S = input()
if S.replace('A', '') == 'KIHBR' and S.count('AA') == 0 and S.count('KIH') == 1:
print('Yes')
else:
print('No') | s915348639 | Accepted | 17 | 2,940 | 131 | S = input()
if S.replace('A', '') == 'KIHBR' and S.count('AA') == 0 and S.count('KIH') == 1:
print('YES')
else:
print('NO') |
s737013043 | p03693 | u691501673 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 119 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r, g, b = map(int, input().split())
sum = r * 100 + g * 10 + b
if sum % 4 == 0:
print("Yes")
else:
print("No")
| s926053877 | Accepted | 18 | 2,940 | 119 | r, g, b = map(int, input().split())
sum = r * 100 + g * 10 + b
if sum % 4 == 0:
print("YES")
else:
print("NO")
|
s606720419 | p03693 | u867826040 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | 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... | i = int("".join(input().split()))
print(i) | s337020675 | Accepted | 18 | 2,940 | 82 | i = int("".join(input().split()))
if i%4 == 0:
print("YES")
else:
print("NO")
|
s861681681 | p00161 | u221679506 | 1,000 | 131,072 | Wrong Answer | 110 | 9,132 | 326 | 秋の体育祭が行われます。種目は徒競走、ボール運び、障害物競走、リレーの4種目です。参加チームは n チームで、この4種目の合計タイムが最も小さいチームが「優勝」、次に小さいチームが「準優勝」、そして、最下位より2番目のチームを「ブービー賞」として表彰したいと思います。 各チームの成績を入力として、「優勝」、「準優勝」、「ブービー賞」のチームを出力するプログラムを作成してください。 ただし、チームにはそれぞれ 1 から n のチーム番号が割り当てられています。 | while True:
n = int(input())
if n==0:break
d={}
for i in range(n):
c,q,w,e,r,t,y,u,o = input().split()
d[c] = (int(q)+int(e)+int(t)+int(u))*60+int(w)+int(r)+int(y)+int(o)
ans = sorted(d.items(), key=lambda x: x[1])
print(ans)
for j in [0,1,-2]:
a,b = ans[j]
pr... | s435269724 | Accepted | 110 | 8,964 | 311 | while True:
n = int(input())
if n==0:break
d={}
for i in range(n):
c,q,w,e,r,t,y,u,o = input().split()
d[c] = (int(q)+int(e)+int(t)+int(u))*60+int(w)+int(r)+int(y)+int(o)
ans = sorted(d.items(), key=lambda x: x[1])
for j in [0,1,-2]:
a,b = ans[j]
print(a) |
s271741872 | p03696 | u844789719 | 2,000 | 262,144 | Wrong Answer | 25 | 3,316 | 405 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | import re
strorig = input()
closeFirst = re.search('^\)*',strorig).group(0)
openLast = re.search('\(*$',strorig).group(0)
strModified = '(' * len(list(closeFirst)) + strorig + ')' * len(list(openLast))
nums = [-1 if i == '(' else 1 for i in list(strModified)]
sumnums = sum(nums)
if sumnums < 0:
result = strModified... | s051857608 | Accepted | 23 | 3,060 | 360 | n = int(input())
s = input()
def insertRecursively(string):
for i in range(0, len(string)):
part = string[0:i + 1]
if 2 * part.count(')') > len(part):
return insertRecursively('(' + string)
if 2 * string.count('(') > len(string):
return insertRecursively(string + ')')
re... |
s880966708 | p03997 | u378691508 | 2,000 | 262,144 | Wrong Answer | 26 | 8,940 | 61 | 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) | s690480358 | Accepted | 25 | 8,964 | 66 | a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2)) |
s232747544 | p03713 | u315485238 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 339 | There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle. Snuke is trying to divide the bar as evenly as possible. More specifically, he is trying... | H,W=list(map(int,input().split()))
def score(_list):
return max(_list)-min(_list)
answer=H*W
for i in range(W//3,W//3+2):
a=score([H*i, (W-i)*(H//2), (W-i)*(H-H//2)])
answer=min(a,answer)
for i in range(H//3,H//3+2):
a=score([W*i, (H-i)*(W//2), (H-i)*(W-W//2)])
answer=min(a,answer)
print(answer) | s854293185 | Accepted | 254 | 3,064 | 436 | H,W=list(map(int,input().split()))
def score(_list):
return max(_list)-min(_list)
answer=H*W
for i in range(1,W//2+1):
a=score([H*i, (W-i)*(H//2), (W-i)*(H-H//2)])
b=score([H*i, H*((W-i)//2), H*(W-i-(W-i)//2)])
answer=min(a,b,answer)
for i in range(1,H//2+1):
a=score([W*i, (H-i)*(W//2), (H-i)*(W-W//2)... |
s457138108 | p03399 | u333139319 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | 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,b,c,d]=[input() for i in range(4)]
print(min(a,b)+min(c,d))
| s374824141 | Accepted | 17 | 2,940 | 68 | [a,b,c,d]=[int(input()) for i in range(4)]
print(min(a,b)+min(c,d))
|
s416428827 | p03161 | u655612181 | 2,000 | 1,048,576 | Wrong Answer | 2,105 | 14,108 | 636 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \... | # given an array of Heights, jump from 1 to N with at most K sized jump to N
# each jump incurs abs(H[j] - H[i]) cost
# minimize cost of jumps from 1 to N
#
def frog(H, k):
K = [0] * k
n = len(H)
for i in range(n):
cost = 0
for j in range(1, min(i, k)):
icost = abs(H[i] - H[i - j... | s925293214 | Accepted | 1,785 | 14,612 | 985 | # given an array of Heights, jump from 1 to N with at most K sized jump to N
# each jump incurs abs(H[j] - H[i]) cost
# minimize cost of jumps from 1 to N
#
def frog(H, k):
if k > len(H):
k = len(H)
n = len(H)
K = [0] * n
inf = float("inf")
for i in range(n):
cost = 0
if i > ... |
s954023318 | p03369 | u419963262 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | 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()
ans=700
for i in S:
if i==0:
ans+=100
print(ans) | s834057266 | Accepted | 17 | 2,940 | 67 | S=input()
ans=700
for i in S:
if i=="o":
ans+=100
print(ans)
|
s950967432 | p03606 | u226108478 | 2,000 | 262,144 | Wrong Answer | 21 | 3,188 | 363 | 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? | # -*- coding: utf-8 -*-
if __name__ == '__main__':
group_count = int(input())
seated_numbers = [list(map(int, input().split())) for _ in range(group_count)]
print(seated_numbers)
total_person = 0
for line in seated_numbers:
total_person += max(line) - min(line) + 1
print(total_pe... | s995194497 | Accepted | 30 | 3,828 | 364 | # -*- coding: utf-8 -*-
def main():
n = int(input())
seats = [0] * 100000
count = 0
for i in range(n):
left, right = map(int, input().split())
for j in range(left - 1, right):
seats[j] = 1
for seat in seats:
if seat == 1:
count += 1
print(cou... |
s993528354 | p02692 | u223663729 | 2,000 | 1,048,576 | Wrong Answer | 164 | 18,064 | 730 | There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ... |
N, a, b, c, *S = open(0).read().split()
N, a, b, c = map(int, (N, a, b, c))
ans = []
for s in S:
if s == 'AB':
ans.append('B' if a > b else 'A')
if a> b:
a -=1
b += 1
else:
a += 1
b -= 1
elif s == 'AC':
ans.append('C' if a > c e... | s079992476 | Accepted | 108 | 17,908 | 1,747 |
N, a, b, c, *S = open(0).read().split()
N, a, b, c = map(int, (N, a, b, c))
flg = a*b*c == 0 and a+b+c == 2
ans = []
for i, s in enumerate(S):
if s == 'AB':
if flg and a*b == 1 and i < N-1:
s_ = S[i+1]
if s_ == 'AC':
ans.append('A')
a += 1
... |
s148964823 | p03679 | u502028059 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x, a, b = map(int, input().split())
ans = 'dangerous'
if (b - a) < 0:
ans = 'delicious'
elif (b - a) < x:
ans = 'safe '
print(ans) | s576396161 | Accepted | 17 | 2,940 | 137 | x, a, b = map(int, input().split())
ans = 'dangerous'
if (b - a) <= 0:
ans = 'delicious'
elif(b - a) <= x:
ans = 'safe'
print(ans) |
s745433887 | p02412 | u801346721 | 1,000 | 131,072 | Wrong Answer | 20 | 7,544 | 220 | Write a program which identifies the number of combinations of three integers which satisfy the following conditions: * You should select three distinct integers from 1 to n. * A total sum of the three integers is x. For example, there are two combinations for n = 5 and x = 9. * 1 + 3 + 5 = 9 * 2 + 3 + 4 = 9 | while 1:
n, x = map(int, input().split())
if n == 0 and x == 0:
break
counter = 0
for a in range(1, n+1):
for b in range(1, n-1):
for c in range(1, n-2):
if a+b+c == x:
counter += 1
print(counter)
| s205069079 | Accepted | 40 | 7,648 | 248 | while 1:
n, x = map(int, input().split())
counter = 0
if n == 0 and x == 0:
break
y = (x+3) // 3
for a in range(y, n+1):
for b in range(2, a):
if (x-a-b) > 0 and (x-a-b) < b:
counter += 1
print(counter)
|
s687449586 | p02399 | u921810101 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 62 | 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 = [int(x) for x in input().split()]
print(a//b, a%b, a/b)
| s154225796 | Accepted | 20 | 5,612 | 65 | a,b = map(int, input().split())
print(f"{a//b} {a%b} {a/b:.5f}")
|
s698381261 | p00001 | u342537066 | 1,000 | 131,072 | Wrong Answer | 20 | 7,520 | 264 | 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. | lis=[];
for i in range(10):
h=int(input());
lis.append(h);
for i in range(10):
for j in range(10):
if lis[i]<lis[j]:
a=lis[i];
lis[i]=lis[j];
lis[j]=a;
for i in range(3):
print(lis[i]); | s800527807 | Accepted | 20 | 7,616 | 268 | lis=[];
for i in range(10):
h=int(input());
lis.append(h);
for i in range(10):
for j in range(i+1,10):
if lis[i]<lis[j]:
a=lis[i];
lis[i]=lis[j];
lis[j]=a;
for i in range(3):
print(lis[i]); |
s760652493 | p02646 | u358943774 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,196 | 180 | 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 ... | i=(input().split())
j=(input().split())
k=(input())
A=int(i[0])
V=int(i[1])
B=int(j[0])
W=int(j[1])
T=int(k)
print(B)
if (B-A)+W*T <= V*T:
print("YES")
else:
print("NO") | s007905399 | Accepted | 23 | 9,192 | 193 | i=(input().split())
j=(input().split())
k=(input())
A=int(i[0])
V=int(i[1])
B=int(j[0])
W=int(j[1])
T=int(k)
if abs(B-A)+W*T <= V*T:
print("YES")
elif abs(B-A)+W*T > V*T:
print("NO")
|
s844815634 | p03557 | u229660384 | 2,000 | 262,144 | Time Limit Exceeded | 2,105 | 24,052 | 729 | 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 ... | N = int(input())
A = list(map(int, input().split()))
#A = [int(x) for x in input().split()]
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
total = 0
for i in range(N):
low = -1
high = N
while low < high:
mid1 = (low + high) // 2
if A[mid1... | s648258651 | Accepted | 902 | 23,616 | 396 | N = int(input())
A = sorted([int(i) for i in input().split()])
B = [int(i) for i in input().split()]
C = sorted([int(i)-1 for i in input().split()])
def bis(x,y):
low = 0
high = N
while low < high:
mid = (low + high) // 2
if x[mid] < y: low = mid + 1
else: high = mid
return low
... |
s689010276 | p02742 | u639387008 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 106 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | a,b= list(map(int,input("\nEnter the numbers : ").strip().split()))
x=a*b
if(x%2!=0):
x=x+1
print(x//2) | s182867736 | Accepted | 17 | 3,060 | 133 | import sys
a,b= list(map(int,input().strip().split()))
x=a*b
if(a==1 or b==1):
print(1)
sys.exit()
if(x%2!=0):
x=x+1
print(x//2) |
s446604212 | p03478 | u335278042 | 2,000 | 262,144 | Wrong Answer | 48 | 3,444 | 216 | 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())
r = 0
for i in range(1,N+1):
print(i)
stri = str(i)
tmp = 0
for j in stri:
tmp += int(j)
if tmp >= A and tmp <= B:
print(i)
r += i
print(r) | s215132903 | Accepted | 32 | 2,940 | 186 | N,A,B = map(int,input().split())
r = 0
for i in range(1,N+1):
stri = str(i)
tmp = 0
for j in stri:
tmp += int(j)
if tmp >= A and tmp <= B:
r += i
print(r) |
s726841162 | p03067 | u924594299 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 222 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. |
a, b, c = (int(i) for i in input().split())
if a < b:
if a < c and c < b:
print('YES')
else:
print('NO')
elif a > b:
if b < c and c < a:
print('YES')
else:
print('NO')
| s011337881 | Accepted | 17 | 2,940 | 221 | a, b, c = (int(i) for i in input().split())
if a < b:
if a < c and c < b:
print('Yes')
else:
print('No')
elif a > b:
if b < c and c < a:
print('Yes')
else:
print('No') |
s262349880 | p02868 | u550061714 | 2,000 | 1,048,576 | Wrong Answer | 2,105 | 28,900 | 374 | We have N points numbered 1 to N arranged in a line in this order. Takahashi decides to make an undirected graph, using these points as the vertices. In the beginning, the graph has no edge. Takahashi will do M operations to add edges in this graph. The i-th operation is as follows: * The operation uses integers L_... | N, M = map(int, input().split())
lrc_list = []
for _ in range(M):
lrc_list.append(tuple(map(int, input().split())))
lrc_list.sort()
way = [float('inf')] * N
way[0] = 0
print(lrc_list)
for lrc in lrc_list:
for i in range(lrc[0], lrc[1]):
way[i] = min(way[i], way[lrc[0] - 1] + lrc[2])
if way[N - 1] != fl... | s957607502 | Accepted | 1,684 | 238,276 | 558 | import sys
from collections import defaultdict
import networkx as nx
input = sys.stdin.buffer.readline
N, M = map(int, input().split())
LR_dict = defaultdict(lambda: 10 ** 9)
for _ in range(M):
l, r, c = map(int, input().split())
LR_dict[(l, r)] = min(LR_dict[(l, r)], c)
G = nx.DiGraph()
G.add_nodes_from(ran... |
s666437312 | p02399 | u137212517 | 1,000 | 131,072 | Wrong Answer | 30 | 6,740 | 60 | 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())
print(a // b, a / b, a % b) | s167712368 | Accepted | 30 | 6,740 | 78 | a, b = map(int, input().split())
print(a //b , a % b, "{0:.5f}".format(a / b)) |
s990090876 | p03609 | u037221289 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | 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)) | s014924467 | Accepted | 17 | 2,940 | 52 | X,t = map(int,input().split(' '))
print(max(X-t,0))
|
s584872047 | p03997 | u724742135 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 143 | 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. | from sys import stdin
a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
h = int(stdin.readline().rstrip())
print((a+b)*h/2) | s645866857 | Accepted | 18 | 2,940 | 148 | from sys import stdin
a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
h = int(stdin.readline().rstrip())
print(int((a+b)*h/2)) |
s068302055 | p03997 | u191423660 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | 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())
S = ((a + b) * h) / 2
print(str(S))
| s571253685 | Accepted | 17 | 2,940 | 94 | a = int(input())
b = int(input())
h = int(input())
S = ((a + b) * h) / 2
print(str(int(S)))
|
s222115503 | p04029 | u597455618 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | 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) | s753053645 | Accepted | 17 | 2,940 | 34 | n = int(input())
print(n*(n+1)//2) |
s162925560 | p00101 | u585391547 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 174 | An English booklet has been created for publicizing Aizu to the world. When you read it carefully, you found a misnomer (an error in writing) on the last name of Masayuki Hoshina, the lord of the Aizu domain. The booklet says "Hoshino" not "Hoshina". Your task is to write a program which replace all the words "Hoshino... | n=int(input())
for i in range(n):
inputs=list(map(str,input().split()))
for j in inputs:
if j=="Hoshino":
print("Hoshina",end=" ")
else:
print(j,end=" ")
print() | s658973679 | Accepted | 30 | 6,716 | 78 | n=int(input())
for i in range(n):
print(input().replace("Hoshino","Hoshina")) |
s785554305 | p02923 | u658801777 | 2,000 | 1,048,576 | Wrong Answer | 61 | 11,128 | 509 | There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. You will land on a square of your choice, then repeat moving to the adjacent square **on the right** as long as the height of the next square is not greater than that of the current square. Find the maximum ... | while True:
try:
N = int(input())
H = map(int, input().split())
result = 0
pre = None
l = 0
for i in H:
if pre is None:
pre = i
continue
if i <= pre:
l += 1
else:
if l ... | s402409430 | Accepted | 60 | 11,136 | 505 | while True:
try:
N = int(input())
H = map(int, input().split())
result = 0
pre = None
l = 0
for i in H:
if pre is None:
pre = i
continue
if i <= pre:
l += 1
else:
if l ... |
s881399825 | p03944 | u102960641 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 285 | 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())
xya = [list(map(int, input().split())) for i in range(n)]
lx = 0
rx = w
ly = 0
ry = h
for x,y,a in xya:
if a == 1:
lx = x
elif a == 2:
rx = x
elif a == 3:
ly = y
else:
ry = y
ans = w * h - max(0,rx-lx) * max(0,ry-ly)
print(ans) | s481952059 | Accepted | 17 | 3,064 | 309 | w,h,n = map(int, input().split())
xya = [list(map(int, input().split())) for i in range(n)]
lx = 0
rx = w
ly = 0
ry = h
for x,y,a in xya:
if a == 1:
lx = max(lx,x)
elif a == 2:
rx = min(rx,x)
elif a == 3:
ly = max(ly,y)
else:
ry = min(ry,y)
ans = max(0,rx-lx) * max(0,ry-ly)
print(ans) |
s238830803 | p02795 | u509150616 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,112 | 178 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | def solve(H, W, N):
c = 0
b = 0
L = max(H, W)
while b < N:
b += L
c += 1
return c
H = int(input())
W = int(input())
N = int(input())
| s687207283 | Accepted | 27 | 9,172 | 199 | def solve(H, W, N):
c = 0
b = 0
L = max(H, W)
while b < N:
b += L
c += 1
return c
H = int(input())
W = int(input())
N = int(input())
print(solve(H, W, N))
|
s047611308 | p03493 | u001687078 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | 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()
int(s[0])+int(s[1])+int(s[2]) | s060821833 | Accepted | 17 | 2,940 | 48 | s = input()
print(int(s[0])+int(s[1])+int(s[2])) |
s864621300 | p02412 | u335511832 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 272 | Write a program which identifies the number of combinations of three integers which satisfy the following conditions: * You should select three distinct integers from 1 to n. * A total sum of the three integers is x. For example, there are two combinations for n = 5 and x = 9. * 1 + 3 + 5 = 9 * 2 + 3 + 4 = 9 | while True:
(n,x) = [int(i) for i in input().split()]
if n==x==0:
break
goukei = 0
for i in range(1,n):
for j in range(1,n):
for k in range(1,n):
if i+j+k == x:
goukei += 1
print(goukei) | s937255660 | Accepted | 2,940 | 7,620 | 283 | while True:
n,x = [int(i) for i in input().split()]
if n==x==0:break
count=0
for i in range(1,n+1):
for j in range(1,n):
for k in range(1,n-1):
if i+j+k==x and i>j>k and not i==j==k:
count += 1
print(count) |
s580328245 | p03719 | u699296734 | 2,000 | 262,144 | Wrong Answer | 26 | 9,048 | 91 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a, b, c = map(int, input().split())
if a <= c <= b:
print("Yse")
else:
print("No")
| s304723555 | Accepted | 29 | 8,860 | 91 | a, b, c = map(int, input().split())
if a <= c <= b:
print("Yes")
else:
print("No")
|
s613254428 | p03339 | u652150585 | 2,000 | 1,048,576 | Wrong Answer | 162 | 20,520 | 326 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | import sys
import string
import collections
input=sys.stdin.readline
n=int(input())
s=list(input())
#print(s)
snum=[0 if i=='W' else 1 for i in s]
#print(snum)
a=sum(snum)
l=[10**6]
for i in range(0,n):
if snum[i]==1:
a-=1
l.append(a)
elif snum[i]==0:
a+=1
l.append(a-1)
print(m... | s089536018 | Accepted | 157 | 19,956 | 220 | n=int(input())
s=list(input())
ls=[0 if i=='W' else 1 for i in s]
a=sum(ls)
#print(a)
l=[0]*n
for i in range(n):
if ls[i]==1:
a-=1
l[i]=a
elif ls[i]==0:
a+=1
l[i]=a-1
print(min(l)) |
s232918936 | p04030 | u733337827 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | 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... | s = input()
print(s.replace('0b', '').replace('1b', '').replace('b', '')) | s977849185 | Accepted | 17 | 2,940 | 110 | s = input()
ans = s
while 'B' in ans:
ans = ans.lstrip('B').replace('0B', '').replace('1B', '')
print(ans) |
s924320072 | p03545 | u169200126 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 693 | 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... | import math
inp = int(input())
a = int(inp / 1000)
b = int((inp % 1000)/100)
c = int((inp % 100)/10)
d = int((inp % 10))
'''
d = inp % 10
inp //= 10
c = inp % 10
inp //= 10
b = inp % 10
inp //= 10
a = inp % 10
inp //= 10
'''
pm = 8
total = a
siki = "a"
for i in range(8):
total = a
siki = "a"
if(i &... | s114631346 | Accepted | 17 | 3,064 | 752 |
inp = int(input())
a = int(inp / 1000)
b = int((inp % 1000)/100)
c = int((inp % 100)/10)
d = int((inp % 10))
'''
d = inp % 10
inp //= 10
c = inp % 10
inp //= 10
b = inp % 10
inp //= 10
a = inp % 10
inp //= 10
'''
pm = 8
total = a
for i in range(8):
total = a
siki = str(a)
if(i & 1):
total ... |
s111189223 | p03228 | u693566873 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 177 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | A, B, K = [int(s) for s in input().split(' ')]
print(A, B, K)
for i in range(K):
if i % 2:
B //= 2
A += B
else:
A //= 2
B += A
print ('%d %d' % (A, B))
| s500820547 | Accepted | 17 | 2,940 | 161 | A, B, K = [int(s) for s in input().split(' ')]
for i in range(K):
if i % 2:
B //= 2
A += B
else:
A //= 2
B += A
print ('%d %d' % (A, B))
|
s399327671 | p03139 | u859897687 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 52 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | n,a,b=map(int,input().split())
print(min(a,b),a+b-n) | s016536042 | Accepted | 17 | 2,940 | 59 | n,a,b=map(int,input().split())
print(min(a,b),max(0,a+b-n)) |
s465590260 | p04043 | u264564865 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 227 | 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 ... | import sys
input = lambda: sys.stdin.readline().rstrip()
yes = lambda boolean: print('Yes') if boolean else print('No')
input_ints = lambda: list(map(int, input().split()))
numbers = sorted(input_ints())
yes(numbers == [5,5,7]) | s902913675 | Accepted | 17 | 2,940 | 83 | n=list(map(int, input().split()))
print('YES')if sorted(n)==[5,5,7]else print('NO') |
s128262413 | p00446 | u546285759 | 1,000 | 131,072 | Wrong Answer | 30 | 7,724 | 1,084 | 次のような2人で行うカードゲームがある. * このゲームでは, 1から2nまでの各整数が書かれた全部で2n枚のカードを使用する. ここで,nは1以上100以下の整数である. * このカードを2人にn枚ずつ配る. * 次のルールに従って交互にカードを1枚ずつ場に出す. * 場にカードが出ていないならば, 好きなカードを出すことができる. * 場にカードが出ているならば, 最後に場に出たカードよりも大きい数の書かれたカードを出すことができる. * カードが出せる場合は,必ず場にカードを出す必要がある. * 出せるカードが無い場合はパスとなり,相手の番になる. このとき,場に出ているカードは無... | import bisect
while True:
n = int(input())
if n == 0:
break
tc = sorted([int(input()) for _ in range(n)])
hc = sorted([v for v in range(1, 2*n+1) if v not in tc])
ba = []
flag = True
while tc and hc:
if len(ba) == 0:
try:
if flag:
... | s902707829 | Accepted | 30 | 7,760 | 835 | import bisect
while True:
n = int(input())
if n == 0:
break
card_set = [sorted(int(input()) for _ in range(n)), []]
card_set[1] = sorted({i for i in range(1, 2*n+1)}.difference(card_set[0]))
card = turn = 0
flag = 1
ba = []
while flag:
if len(ba) == 0:
card = ... |
s790027132 | p02284 | u007270338 | 2,000 | 131,072 | Wrong Answer | 30 | 5,636 | 1,455 | Write a program which performs the following operations to a binary search tree $T$ by adding the find operation to A: Binary Search Tree I. * insert $k$: Insert a node containing $k$ as key into $T$. * find $k$: Report whether $T$ has a node containing $k$. * print: Print the keys of the binary search tree by... | #coding:utf-8
N = int(input())
trees = [list(input().split()) for i in range(N)]
class BinaryTree:
def __init__(self,key,p=None,l=None,r=None):
self.key = key
self.p = p
self.l = l
self.r = r
def Insert(root,z):
y = None
x = root
while x != None:
y = x
i... | s507135205 | Accepted | 7,240 | 121,624 | 1,580 | #coding:utf-8
class MakeTree():
def __init__(self, key, p=None, l=None, r=None):
self.key = key
self.p = p
self.l = l
self.r = r
def Insert(root,value):
y = None
x = root
z = MakeTree(value)
while x != None:
y = x
if x.key > z.key:
x = ... |
s542817975 | p03795 | u597017430 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 46 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | N = int(input())
print(N * 800 - 200 * N //15) | s804195386 | Accepted | 17 | 2,940 | 49 | N = int(input())
print(N * 800 - 200 * (N //15))
|
s882422205 | p03486 | u940102677 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s = list(input())
t = list(input())
s.sort()
t.sort()
print("Yes" if "".join(s) < "".join(t) else "No") | s684153284 | Accepted | 17 | 2,940 | 115 | s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
print("Yes" if "".join(s) < "".join(t) else "No") |
s777105034 | p02612 | u551967750 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,008 | 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. | s = int(input())
print(s%1000) | s358283644 | Accepted | 28 | 9,092 | 78 | s = int(input())
if s%1000 == 0:
c=0
else:
c = 1000 - ( s%1000 )
print(c)
|
s479003506 | p02389 | u726789377 | 1,000 | 131,072 | Wrong Answer | 20 | 7,652 | 100 | Write a program which calculates the area and perimeter of a given rectangle. | data = input().split()
a = data[0]
b = data[1]
print (int(a) * int(b))
print (2 * (int(a) + int(b))) | s407443427 | Accepted | 20 | 5,588 | 93 | data = input().split()
a = data[0]
b = data[1]
print(int(a) * int(b), 2 * (int(a) + int(b)))
|
s212495299 | p02402 | u591403647 | 1,000 | 131,072 | Wrong Answer | 20 | 5,584 | 139 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | n = int(input()) #
ns = list(map(int, input().split()))
print(*ns[::-1])
| s206265474 | Accepted | 30 | 6,580 | 90 | n = int(input()) #
ns = list(map(int, input().split()))
print(min(ns),max(ns),sum(ns))
|
s504854560 | p03369 | u972658925 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | 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 = list(input())
count = 0
for i in range(len(s)):
if i == "o":
count += 1
print(700 + count*100) | s222955526 | Accepted | 17 | 2,940 | 98 | s = list(input())
count = 0
for i in s:
if i == "o":
count += 1
print(700 + count*100) |
s730198672 | p03564 | u667949809 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 121 | Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: * Operation A: The displayed value is doubled. * Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the m... | n=int(input())
k=int(input())
a=1
for i in range(n):
if a*2>a+k:
a=a*2
else:
a=a+k
print(a)
| s575925017 | Accepted | 18 | 2,940 | 114 | n=int(input())
k=int(input())
a=1
for i in range(n):
if a*2>a+k:
a=a+k
else:
a=a*2
print(a) |
s255069071 | p02265 | u657361950 | 1,000 | 131,072 | Wrong Answer | 20 | 5,612 | 1,797 | 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... | import sys
class Node:
def __init__(self, value):
self.value = value
self.prev = None
self.next = None
class DoublyLinkedList:
def __init__(self):
self.head = None
self.tail = None
self.size = 0
def get_size(self):
return self.size
def is_empty(self):
return self.size == 0
def appendToHead(... | s110815613 | Accepted | 4,520 | 227,600 | 2,223 | class Node(object):
def __init__(self, num, prv = None, nxt = None):
self.num = num
self.prv = prv
self.nxt = nxt
class DoublyLinkedList(object):
def __init__(self):
self.start = self.last = None
def insert(self, num):
new_elem = Node(num)
if self.star... |
s858453516 | p03556 | u492447501 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 30 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | print(int(int(input())**0.5))
| s734024566 | Accepted | 17 | 3,060 | 38 | print(int(int(int(input())**0.5)**2))
|
s989036681 | p02257 | u055885332 | 1,000 | 131,072 | Wrong Answer | 20 | 5,656 | 412 | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list. | import math
def PrimeNum(a):
x=math.sqrt(a)
x=int(x)
tmp=1
if a==1:
tmp=0
elif a==2:
tmp==1
elif a>3 and a<9:
for i in range(2,a):
st=a%i
if st==0:
tmp=0
break
else:
for i in range(2,x):
st=a%i
if st == 0:
tmp=0
break
#print("::::",a,x,st,tmp)
return tmp
n=int(input())... | s481123471 | Accepted | 400 | 6,016 | 443 | import math
def PrimeNum(a):
x=math.sqrt(a)
x=int(x)
tmp=1
if a==1:
tmp=0
elif a==2:
tmp==1
elif a>3 and a<9:
for i in range(2,a):
st=a%i
if st==0:
tmp=0
break
else:
for i in range(2,x+1):
st=a%i
if st == 0:
tmp=0
break
#print("::::",a,x,st,tmp)
return tmp
n=int(i... |
s628578020 | p04043 | u484856305 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 96 | 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 ... | abc=list(map(str,input().split()))
if abc.count("7") ==2:
print("YES")
else:
print("NO") | s085719462 | Accepted | 19 | 2,940 | 118 | abc=list(map(str,input().split()))
if abc.count("7") ==1 and abc.count("5")==2:
print("YES")
else:
print("NO") |
s674998225 | p02603 | u307516601 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,206 | 9,200 | 386 | 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 n... | import sys
sys.setrecursionlimit(10**6)
n = int(input())
A = list(map(int, input().split()))
ans = 1000
def dfs(money, share, day):
global ans
if day > n:
ans = max(ans, money)
return
max_buy = money//A[day-1]
max_sel = share
for n_buy in range(-max_sel, max_buy+1):
dfs(mo... | s161583724 | Accepted | 31 | 9,192 | 272 | import sys
sys.setrecursionlimit(10**6)
n = int(input())
A = list(map(int, input().split()))
CurrentMoney = 1000
for i in range(0, n-1):
Stocks = 0
if A[i] < A[i+1]: Stocks = CurrentMoney // A[i]
CurrentMoney += (A[i+1] - A[i]) * Stocks
print(CurrentMoney) |
s592847797 | p03563 | u010437136 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 286 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | def solve(a,b):
return b+(b-a)
def readQuestion():
a = sys.stdin.readline().strip()
b = sys.stdin.readline().strip()
return (int(a),int(b))
def main():
a ,b = readQuestion()
answer = solve(a ,b)
print(answer)
#if __name__ == '__main__':
# main()
| s077028226 | Accepted | 18 | 2,940 | 296 | import sys
def solve(a,b):
return b+(b-a)
def readQuestion():
a = sys.stdin.readline().strip()
b = sys.stdin.readline().strip()
return (int(a),int(b))
def main():
a ,b = readQuestion()
answer = solve(a ,b)
print(answer)
if __name__ == '__main__':
main()
|
s002022273 | p03548 | u191557685 | 2,000 | 262,144 | Wrong Answer | 57 | 3,824 | 328 | 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... | import sys;
lines = sys.stdin.readlines();
stdIn = {};
for i, line in enumerate(lines):
chairSize,humanSize,spaceSize = map(int, line.split());
total = 0;
maxSize = 0;
while total*(spaceSize+humanSize) <= chairSize:
print(maxSize);
total = total+1;
print (total-1);
| s837305708 | Accepted | 35 | 3,060 | 332 | import sys;
lines = sys.stdin.readlines();
stdIn = {};
for i, line in enumerate(lines):
chairSize,humanSize,spaceSize = map(int, line.split());
total = 0;
maxSize = 0;
while total*(humanSize)+(total-1)*(spaceSize)+spaceSize*2 <= chairSize:
total = total+1;
print (total-1);
|
s288354943 | p03852 | u086503932 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 400 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | S = input()
l = ['maerd','remaerd', 'esare', 'resare']
def test(S,l):
tmpS = S
while len(tmpS) > 0:
if tmpS[::-1] in l:
print('YES')
return
if tmpS[-1:-6:-1] in l:
tmpS = tmpS[:-5]
elif tmpS[-1:-7:-1] in l:
tmpS = tmpS[:-6]
else:
... | s683970474 | Accepted | 17 | 2,940 | 73 | print('vowel')if input() in ['a','e','i','o','u'] else print('consonant') |
s932844605 | p03854 | u075595666 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 901 | 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()
while True:
S = s
if len(S) < 5:
print('No')
break
if S == 'dream' or S == 'erase':
print('Yes')
break
else:
if S[0] == 'd':
if S[7] == 'a':
T ='dream'
if S[:5] == T:
S = S[5:]
T = ""
if S == "":
print('Yes')
break
s = S
else:
print('No')
... | s470960692 | Accepted | 19 | 3,188 | 161 | S=input()
S=S.replace('eraser','')
S=S.replace('erase','')
S=S.replace('dreamer','')
S=S.replace('dream','')
if S=='':
print('YES')
else:
print('NO') |
s628749758 | p03434 | u814986259 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 171 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | N=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
alice=0
bob=0
for i in range(N):
if i % 2==1:
alice+=a[i]
else:
bob+=a[i]
print(alice-bob) | s901389810 | Accepted | 18 | 3,060 | 171 | N=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
alice=0
bob=0
for i in range(N):
if i % 2==0:
alice+=a[i]
else:
bob+=a[i]
print(alice-bob) |
s750764385 | p03495 | u292810930 | 2,000 | 262,144 | Wrong Answer | 2,109 | 34,164 | 465 | 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. | import numpy as np
N, K = map(np.int, input().split())
alist = np.array(list(map(np.int, input().split())))
keys = np.sort(np.array(list(set(alist))))
values = np.zeros(len(keys))
for i in range(len(keys)):
values[i] = np.sum(alist == keys[i])
balls = dict(zip(keys, values))
balls=dict(sorted(balls.items(), key=la... | s220181074 | Accepted | 178 | 41,500 | 271 | import collections
N, K = map(int, input().split())
alist = collections.Counter(map(int, input().split()))
number = max(0,len(alist) - K )
answer = 0
if number == 0:
print(0)
else:
for a in alist.most_common()[-number:]:
answer += a[1]
print(answer)
|
s898465522 | p04045 | u597455618 | 2,000 | 262,144 | Wrong Answer | 151 | 9,104 | 432 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | def dfs(A: list):
if len(A) > nn:
return
if len(A) and (x := int("".join(A))) >= n and ans[0] > x:
ans[0] = x
return
for v in d:
if v == "0" and len(A) == 0:
next
A.append(v)
dfs(A)
A.pop()
n, k = map(int, input().split())
d = sorted(lis... | s833351283 | Accepted | 153 | 9,212 | 435 | def dfs(A: list):
if len(A) > nn:
return
if len(A) and (x := int("".join(A))) >= n and ans[0] > x:
ans[0] = x
return
for v in d:
if v == "0" and len(A) == 0:
next
A.append(v)
dfs(A)
A.pop()
n, k = map(int, input().split())
d = sorted(lis... |
s309921723 | p03563 | u156677492 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 106 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | N = int(input())
K = int(input())
x = 1
for i in range(N):
if x < K:
x *= 2
else:
x += K
print(x) | s024534012 | Accepted | 17 | 2,940 | 47 | R = int(input())
G = int(input())
print(2*G-R)
|
s471568115 | p03853 | u427344224 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 160 | 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, p... | H, W = map(int, input().split())
c_list = []
for i in range(H):
c = input().split()
c_list.append(c)
c_list.append(c)
for c in c_list:
print(c) | s792919077 | Accepted | 17 | 3,060 | 163 | H, W = map(int, input().split())
c_list = []
for i in range(H):
c = input().split()
c_list.append(c)
c_list.append(c)
for c in c_list:
print(c[0]) |
s639558395 | p03565 | u474270503 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 549 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | S0=input()
S1=list(S0)
T=list(input())
T1=['0']*len(T)
is_break=0
for i in range(1 << len(T)):
if is_break:
break
for j in range(len(T)):
T1[j]='?' if i&(1<<j) else T[j]
T2=''.join(T1)
if S0.find(T2)+1:
print(S0, T2)
j=0
for i in range(S0.find(T2),S0.find(T2)+len(... | s384306322 | Accepted | 18 | 3,064 | 493 | S=list(input())
T=list(input())
A=[]
for i in range(len(S)-len(T)+1):
is_ok=1
for j in range(i, i+len(T)):
if S[j]!=T[j-i] and S[j]!='?':
is_ok=0
if is_ok:
tmp=S[:]
is_con=1
for j in range(i, i+len(T)):
tmp[j]=T[j-i]
A.append(tmp)
if len(A)==0:... |
s802160303 | p00003 | u933096856 | 1,000 | 131,072 | Wrong Answer | 40 | 7,680 | 160 | Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so. | n=int(input())
for i in range(n):
a,b,c=map(int, input().split())
if a > b+c and b > c+a and c > b+a:
print('YES')
else:
print('NO') | s010781114 | Accepted | 40 | 7,568 | 170 | n=int(input())
for i in range(n):
a=list(map(int, input().split()))
a.sort()
if a[2]**2 == a[1]**2+a[0]**2:
print('YES')
else:
print('NO') |
s389625937 | p03377 | u996672406 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 101 | 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. | l = input().split()
if l[0] <= l[2] and l[2] <= (l[0] + l[1]):
print("YES")
else:
print("NO") | s157415525 | Accepted | 17 | 2,940 | 113 | l = input().split()
if int(l[0]) <= int(l[2]) <= (int(l[0]) + int(l[1])):
print("YES")
else:
print("NO") |
s708659840 | p03433 | u170183831 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | 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())
print('Yes' if n % 500 >= a else 'No') | s905152469 | Accepted | 17 | 2,940 | 73 | n = int(input())
a = int(input())
print('Yes' if n % 500 <= a else 'No')
|
s458610589 | p03697 | u694422786 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | a,b=map(int,input().split())
print('a+b'if a+b<10 else 'error') | s847928722 | Accepted | 17 | 2,940 | 62 | a,b=map(int,input().split())
print(a+b if a+b<10 else 'error') |
s599669302 | p03861 | u200887663 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 163 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,x=map(int,input().split())
count=0
div=a//x
md=a % x
mn=a+(x-md)
count=(b-mn+1)//x
amari=(b-mn+1) % x
if amari==0 :
print(count)
else :
print(count+1)
| s597224885 | Accepted | 18 | 2,940 | 124 | a,b,x=map(int,input().split())
def fn(n,x) :
if n<0 :
return 0
else :
return n//x +1
print(fn(b,x)-fn(a-1,x))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.