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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s744029173 | p04029 | u867848444 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 31 | 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) | s129680578 | Accepted | 18 | 2,940 | 36 | n=int(input())
print(int(n*(n+1)/2)) |
s626492891 | p03674 | u627417051 | 2,000 | 262,144 | Wrong Answer | 260 | 13,812 | 448 | You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s... | n = int(input())
A = list(map(int,input().split()))
S = sum(A)
x = int(S - (n * (n + 1) / 2))
a = A.index(x)
A[a] = 0
b = A.index(x)
C = []
c = []
M = n + 1
N = 1
print(M - N)
for i in range(2, n + a - b + 2):
M = (M * (n + 2 - i) / i) % 1000000007
N = (N * (n + a - b + 1 - i) / (i - 1)) % 1000000007
print(int(... | s571862051 | Accepted | 445 | 34,136 | 1,335 |
import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7
def getlist():
return list(map(int, input().split()))
class Combination(object):
def __init__(self, N, con):
self.fac = [0] * (N + 1)
self.inv = [0] * (N + 1)
self.finv = [0] * (N + 1)
self.fac[0], self.fa... |
s588123911 | p03054 | u843135954 | 2,000 | 1,048,576 | Wrong Answer | 1,189 | 14,640 | 904 | We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,s_c). Takahashi and Aoki will play a game, where each player has a st... | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
h,w,n = na()
sh,sw = na()
s = ns()
t = ns()
iit = [sw,sh,h-sh+1,w-sw+1]
print(iit)
#ludr
tshi = [0,0,0,0]
aoki = [0,0,0,0]
fo... | s317695689 | Accepted | 590 | 3,888 | 861 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
h,w,n = na()
sh,sw = na()
s = ns()
t = ns()
iit = [sw,sh,h-sh+1,w-sw+1]
#ludr
tshi = [0,0,0,0]
aoki = [0,0,0,0]
for i in rang... |
s217328192 | p03067 | u169866169 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 242 | 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. | r_str = input()
r_str = r_str.split()
r = [int(s) for s in r_str]
a = 'Yes'
if r[0] >= r[1]:
if r[0] <= r[2]:
a = 'Yes'
else:
a = 'No'
else:
if r[1] <= r[2]:
a = 'Yes'
else:
a = 'No'
print(a)
| s607694267 | Accepted | 17 | 3,060 | 277 | r_str = input()
r_str = r_str.split()
r = [int(s) for s in r_str]
a = 'Yes'
if r[0] <= r[1]:
if r[0] <= r[2] and r[2] <= r[1]:
a = 'Yes'
else:
a = 'No'
else:
if r[1] <= r[2] and r[2] <= r[0]:
a = 'Yes'
else:
a = 'No'
print(a) |
s979111866 | p04029 | u630211216 | 2,000 | 262,144 | Wrong Answer | 26 | 9,116 | 29 | 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)) | s149547378 | Accepted | 22 | 8,900 | 32 | N=int(input())
print(N*(N+1)//2) |
s999354670 | p03371 | u032484849 | 2,000 | 262,144 | Wrong Answer | 120 | 3,060 | 151 | "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())
ans=float("inf")
for i in range(max(x,y)-1):
t=a*(x-min(x,i))+b*(y-min(y,i))+2*c*i
ans=min(ans,t)
print(ans) | s214166420 | Accepted | 123 | 3,060 | 147 | a,b,c,x,y=map(int,input().split())
ans=float("inf")
for i in range(max(x,y)+1):
t=a*max(0,x-i)+b*max(0,y-i)+2*c*i
ans=min(ans,t)
print(ans) |
s608836083 | p03067 | u507116804 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 85 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a,b,c=map(int,input().split())
if a<b<c or a>b>c:
print("Yes")
else:
print("No") | s808226031 | Accepted | 17 | 2,940 | 85 | a,b,c=map(int,input().split())
if a<c<b or a>c>b:
print("Yes")
else:
print("No") |
s897409592 | p03131 | u740284863 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,064 | 398 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | K,A,B = map(int,input().split())
oK = K
bis = 1
yen = 0
if A >= B:
bis += K
print(bis)
else:
while K > 0:
if yen >= 1:
bis += B
yen -= 1
else:
if bis < A or K < A:
bis += 1
else:
bis -= A
yen += 1... | s762852509 | Accepted | 17 | 3,060 | 273 | k,a,b=map(int,input().split())
if b - a <= 2:
ans = k + 1
else:
if 1 <= k <= a - 1:
ans = k + 1
else:
if (k - (a-1)) % 2 == 0:
ans = a + (b-a)*((k - (a-1))//2)
else:
ans = 1 + a + (b-a)*((k - (a-1))//2)
print(ans) |
s828506169 | p03548 | u594956556 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 55 | 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... | X, Y, Z = map(int, input().split())
X -= Z
print(X//Y)
| s757551083 | Accepted | 17 | 2,940 | 59 | X, Y, Z = map(int, input().split())
X -= Z
print(X//(Y+Z))
|
s798604571 | p03487 | u518987899 | 2,000 | 262,144 | Wrong Answer | 84 | 23,668 | 213 | You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ... | from collections import Counter
N = int(input().strip())
counter_A = Counter(map(int, input().strip().split(' ')))
ans = 0
for k,v in counter_A.items():
if k >= v:
ans += v-k
else:
ans += v
print(ans)
| s390333408 | Accepted | 79 | 23,668 | 213 | from collections import Counter
N = int(input().strip())
counter_A = Counter(map(int, input().strip().split(' ')))
ans = 0
for k,v in counter_A.items():
if v >= k:
ans += v-k
else:
ans += v
print(ans)
|
s920645783 | p03469 | u636684559 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 29 | 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('2008'+S[4:]) | s676533853 | Accepted | 17 | 2,940 | 29 | S=input()
print('2018'+S[4:]) |
s031489533 | p03193 | u859897687 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,060 | 128 | There are N rectangular plate materials made of special metal called AtCoder Alloy. The dimensions of the i-th material are A_i \times B_i (A_i vertically and B_i horizontally). Takahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \times W. He is trying to obtain such a plate by cho... | n,h,w=map(int,input().split())
ans=0
for _ in range(n):
y,x=map(int,input().split())
if y<=h and x<=w:
ans+=1
print(ans) | s785018177 | Accepted | 20 | 3,060 | 128 | n,h,w=map(int,input().split())
ans=0
for _ in range(n):
a,b=map(int,input().split())
if a>=h and b>=w:
ans+=1
print(ans) |
s827149552 | p02393 | u212392281 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 188 | Write a program which reads three integers, and prints them in ascending order. | a, b, c = map(int, input().split())
d = 0
if a > b:
d = a
a = b
b = d
else: pass
d = 0
if b > c:
d = b
b = c
c = d
d = 0
if a > c:
d = a
a = c
c = d
print(a, b, c)
| s477101330 | Accepted | 20 | 5,596 | 208 | a, b, c = map(int, input().split())
d = 0
if a > b:
d = a
a = b
b = d
else: pass
d = 0
if b > c:
d = b
b = c
c = d
else: pass
d = 0
if a > b:
d = a
a = b
b = d
else: pass
print(a, b, c)
|
s252494199 | p03643 | u284262180 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 143 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | list = [64,32,16,8,4,2]
O = int(input())
if O == 1:
print(1)
exit()
for num in list:
if O > num:
print(num)
break
| s597177618 | Accepted | 17 | 2,940 | 20 | print("ABC"+input()) |
s600950040 | p02612 | u457802431 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,144 | 30 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n%1000) | s778615622 | Accepted | 34 | 9,156 | 86 | n = int(input())
ans = 1000 - n%1000
if ans == 1000:
print(0)
else:
print(ans) |
s319019827 | p03845 | u019584841 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 149 | Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d... | n=int(input())
t=[int(x) for x in input().split()]
m=int(input())
for i in range(m):
a,b=map(int,input().split())
s=b+sum(t[0:a])+sum(t[a+1:])
| s752877250 | Accepted | 21 | 3,316 | 164 | N = input()
T = list(map(int, input().split()))
M = int(input())
sumT = sum(T)
for i in range(M):
P, X = map(int, input().split())
print(sumT - T[P-1] + X)
|
s446512750 | p03719 | u513793759 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 84 | 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 c>=a and c>=b:
print('Yes')
else:
print('No') | s814275462 | Accepted | 18 | 2,940 | 86 | a,b,c = map(int, input().split())
if c>=a and c<=b:
print('Yes')
else:
print('No') |
s485330596 | p01224 | u078042885 | 3,000 | 131,072 | Time Limit Exceeded | 40,000 | 7,700 | 219 | ある整数 N に対し,その数自身を除く約数の和を S とする. N = S のとき N は完全数 (perfect number), N > S のとき N は不足数 (deficient number), N < S のとき N は過剰数 (abundant number) と呼ばれる. 与えられた整数が,完全数・不足数・過剰数のどれであるかを 判定するプログラムを作成せよ. プログラムの実行時間が制限時間を越えないように注意すること. | def f(p):
return sum([n for n in range(1,p) if p%n==0])
while 1:
n=int(input())
if n==0:break
m=f(n)
if n==m:print('perfect number')
else: print('deficient number' if n>m else 'abundant number') | s143786049 | Accepted | 130 | 7,680 | 331 | def f(p):
ans=1
if p<=5: return 0
for n in range(2,int(p**0.5)+1):
if p%n==0:
if n!=p//n:ans+=n+p//n
else:ans+=n
return ans
while 1:
n=int(input())
if n==0:break
m=f(n)
if n==m:print('perfect number')
else: print('deficient number' if n>m else 'abunda... |
s278765842 | p03605 | u721425712 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | s = input()
if s[0] == 9 or s[1] == 9:
print('Yes')
else:
print('No') | s435356401 | Accepted | 17 | 2,940 | 77 | s = input()
if s[0] == '9' or s[1] == '9':
print('Yes')
else:
print('No') |
s111933188 | p00025 | u966364923 | 1,000 | 131,072 | Wrong Answer | 20 | 7,636 | 268 | 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... | import sys
for line in sys.stdin:
a = list(map(int, line.split()))
b = list(map(int, line.split()))
hit = 0
blow = 0
for i in range(4):
if b[i] == a[i]:
hit += 1
elif b[i] in a:
blow += 1
print(hit,blow) | s343083433 | Accepted | 20 | 7,532 | 367 | import sys
inputs = []
for line in sys.stdin:
inputs.append(line)
n = len(inputs)
for _ in range(n // 2):
a = list(map(int, inputs[_ * 2].split()))
b = list(map(int, inputs[_ * 2 + 1].split()))
hit = 0
blow = 0
for i in range(4):
if b[i] == a[i]:
hit += 1
elif b[i] i... |
s643214879 | p02420 | u986478725 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 490 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | # AOJ ITP1_9_B
def numinput():
a = input().split()
for i in range(len(a)):
a[i] = int(a[i])
return a
def main():
while True:
string = input()
if string == "-": break
n = int(input())
for i in range(n):
h = int(input())
front = string[0 ... | s245245936 | Accepted | 20 | 5,596 | 433 | # AOJ ITP1_9_B
def main():
while True:
string = input()
if string == "-": break
n = int(input())
for i in range(n):
h = int(input())
front = string[0 : h]
back = string[h : len(string)]
string = back + front
print(string)... |
s202162876 | p03303 | u545411641 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,100 | 79 | You are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom. | s = input()
step = int(input())
for i in range(0, len(s), step):
print(s[i])
| s093774197 | Accepted | 26 | 9,072 | 86 | s = input()
step = int(input())
print(''.join([s[i] for i in range(0, len(s), step)])) |
s339325855 | p02747 | u393512980 | 2,000 | 1,048,576 | Wrong Answer | 21 | 3,316 | 247 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import defaultdict
from bisect import *
mod = 10**9+7
S = input()
for i in range(5):
if 'hi' * (i+1) == S:
print('Yes')
exit()
print('No')
| s915409725 | Accepted | 25 | 3,444 | 252 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import defaultdict
from bisect import *
mod = 10**9+7
S = input()[:-1]
for i in range(5):
if 'hi' * (i+1) == S:
print('Yes')
exit()
print('No')
|
s054999013 | p03449 | u916806287 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 174 | 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())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
c = [0]*n
for i in range(n):
c[i] += sum(A1[:i+1])
c[i] += sum(A2[i:])
print(c) | s294674012 | Accepted | 19 | 3,060 | 179 | n = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
c = [0]*n
for i in range(n):
c[i] += sum(A1[:i+1])
c[i] += sum(A2[i:])
print(max(c)) |
s242598354 | p03563 | u276192130 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 368 | 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... | s = list(input())
t = list(input())
def eq(s, t):
for i in range(len(s)):
if s[i] != t[i] and s[i] != '?':
return False
return True
for i in reversed(range(len(s) - len(t)+1)):
if eq(s[i:i+len(t)], t[:]):
s[i:i + len(t)] = t[:]
ans = ''.join(s)
print(ans.replace... | s578301006 | Accepted | 17 | 2,940 | 50 | r = int(input())
g = int(input())
print(r+(g-r)*2) |
s881156852 | p03636 | u382303205 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = "awefaewf"#input()
n = len(s)
print(s[0]+ str(n - 2) +s[-1]) | s450235279 | Accepted | 17 | 2,940 | 53 | s = input()
n = len(s)
print(s[0]+ str(n - 2) +s[-1]) |
s562899146 | p03434 | u054935796 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 234 | 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()))
n = range(N)
list_Alice = [0]
list_Bob = [0]
A.sort()
for i in n:
if i%2 == 0:
list_Alice.append(A[i])
else:
list_Bob.append(A[i])
print(sum(list_Alice) - sum(list_Bob)) | s486148120 | Accepted | 17 | 3,064 | 248 | N = int(input())
A = list(map(int, input().split()))
n = range(N)
list_Alice = [0]
list_Bob = [0]
A.sort(reverse = True)
for i in n:
if i%2 == 0:
list_Alice.append(A[i])
else:
list_Bob.append(A[i])
print(sum(list_Alice) - sum(list_Bob)) |
s252940834 | p02406 | u780342333 | 1,000 | 131,072 | Wrong Answer | 30 | 7,672 | 115 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | num = int(input())
res = " ".join([str(x) for x in range(1, num+1) if x % 3 == 0])
print(" {}".format(res), end="") | s285184990 | Accepted | 20 | 6,136 | 115 | n = int(input())
res = [i for i in range(3, n+1) if (i % 3 == 0) or ("3" in str(i))]
print(" ",end="")
print(*res)
|
s850569155 | p03852 | u582243208 | 2,000 | 262,144 | Wrong Answer | 23 | 3,064 | 161 | 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()
s=s.replace("eraser","")
s=s.replace("erase","")
s=s.replace("dreamer","")
s=s.replace("dream","")
if len(s)==0:
print("YES")
else:
print("NO") | s274983371 | Accepted | 34 | 3,188 | 53 | print("vowel" if input() in "aiueo" else "consonant") |
s367016657 | p03251 | u611655181 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 492 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... |
N,M,X,Y=input().split()
N=int(N)
M=int(M)
X=int(X)
Y=int(Y)
x=input().split()
y=input().split()
for i in range(0,len(x)):
x[i]=int(x[i])
for i in range(0,len(y)):
y[i]=int(y[i])
#X< Z <=Y
comment='War'
for Z in range(X+1,Y+1):
#print(Z)
if(max(x) < Z):
if(min(y)>=Z):
... | s867837406 | Accepted | 18 | 3,064 | 513 |
N,M,X,Y=input().split()
N=int(N)
M=int(M)
X=int(X)
Y=int(Y)
x=input().split()
y=input().split()
for i in range(0,len(x)):
x[i]=int(x[i])
for i in range(0,len(y)):
y[i]=int(y[i])
#X< Z <=Y
comment='War'
for Z in range(X+1,Y+1):
#print(Z)
if(max(x) < Z):
if(min(y)>=Z):
... |
s730092548 | p03826 | u711626986 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 104 | There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the r... | a, b, c, d=map(int,input().split())
e=a*b
f=c*d
if e>f :
print(e)
if e<f :
print(f)
else:
print(e) | s925494974 | Accepted | 17 | 2,940 | 107 | a, b, c, d=map(int,input().split())
e=a*b
f=c*d
if e>f :
print(e)
elif e<f :
print(f)
else:
print(e)
|
s835210721 | p03693 | u404062634 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | 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())
x = r*100 + g*10 + b
if x%4 == 0:
print('Yes')
else:
print('No') | s756611957 | Accepted | 17 | 2,940 | 105 | r,g,b = map(int,input().split())
x = r*100 + g*10 + b
if x%4 == 0:
print('YES')
else:
print('NO') |
s064155585 | p03067 | u157887852 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 209 | 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. |
input = input().split()
a = int(input[0])
b = int(input[1])
c = int(input[2])
print(a)
print(b)
print(c)
if (c > a and c > b) or (c < a and c < b):
print("No")
else:
print("Yes") | s241722046 | Accepted | 17 | 2,940 | 182 |
input = input().split()
a = int(input[0])
b = int(input[1])
c = int(input[2])
if (c > a and c > b) or (c < a and c < b):
print("No")
else:
print("Yes")
|
s841196324 | p02607 | u261427665 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,172 | 169 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | N = int(input())
a = list(map(int, input().split()))
p = 0
for i in range(0, N):
if i % 2 == 1 and a[i] % 2 == 0:
p = p + 1
else:
p = p
print (p) | s439005255 | Accepted | 24 | 9,116 | 175 | N = int(input())
a = list(map(int, input().split()))
p = 0
for i in range(0, N):
if (i + 1) % 2 == 1 and a[i] % 2 == 1:
p = p + 1
else:
p = p
print (p) |
s894534417 | p02408 | u603049633 | 1,000 | 131,072 | Wrong Answer | 30 | 7,620 | 354 | Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers). The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond. | N = int(input())
FL =[]
for i in range(13):
FL.append("S" + str(i+1))
for i in range(13):
FL.append("H" + str(i+1))
for i in range(13):
FL.append("C" + str(i+1))
for i in range(13):
FL.append("D" + str(i+1))
for i in range(N):
x,y = map(str, input().split())
FL.remove(x + y)
for i in range(52 - N - 1):
print(... | s850510852 | Accepted | 20 | 7,704 | 339 | N = int(input())
#??????????????????????????????
FL =[]
for i in range(13):
FL.append("S " + str(i+1))
for i in range(13):
FL.append("H " + str(i+1))
for i in range(13):
FL.append("C " + str(i+1))
for i in range(13):
FL.append("D " + str(i+1))
for i in range(N):
D = str(input())
FL.remove(D)
for i in range(52 ... |
s401980375 | p02742 | u281796054 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 98 | 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=map(int,input().split())
if a%2==1 and b%2==1:
print(a*(b+1)/2-(a-1)/2)
else:
print(a*b/2) | s963389477 | Accepted | 17 | 2,940 | 157 | a,b=map(int,input().split())
if a%2==1 and b%2==1 and a!=1 and b!=1:
print(int(a*(b+1)/2-(a-1)/2))
elif a==1 or b==1:
print(1)
else:
print(int(a*b/2))
|
s481053306 | p03433 | u851704997 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 86 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N = int(input())
A = int(input())
if N % 500 <= A:
print("YES")
else:
print("NO") | s055672714 | Accepted | 25 | 9,160 | 90 | N = int(input())
A = int(input())
if(N % 500 <= A):
print("Yes")
else:
print("No") |
s191710903 | p03129 | u479977918 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 136 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | # -*- coding: utf-8 -*-
N, K = map(int, input().split())
if int((N+1) /2) > K:
print("Yes")
else:
print("No") | s236321095 | Accepted | 17 | 2,940 | 137 | # -*- coding: utf-8 -*-
N, K = map(int, input().split())
if int((N+1) /2) >= K:
print("YES")
else:
print("NO") |
s946973308 | p02393 | u361028487 | 1,000 | 131,072 | Wrong Answer | 20 | 5,452 | 1 | Write a program which reads three integers, and prints them in ascending order. | s327055710 | Accepted | 20 | 5,560 | 111 | tmp=input().split()
tmp.sort()
for i in range(0,len(tmp)-1):
print(tmp[i],end=' ')
print(tmp[len(tmp)-1])
| |
s293266247 | p03377 | u519721530 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 103 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map(int, input().split())
if 0 < (X-A) and (X-A) <= B:
print('Yes')
else:
print('No') | s745342128 | Accepted | 17 | 2,940 | 100 | A, B, X = map(int, input().split())
if A <= X and (X-A) <= B:
print('YES')
else:
print('NO') |
s378352589 | p03337 | u484856305 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 58 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | a,b=map(int,input().split())
c=[a+b,a*b,a-b]
print(sum(c)) | s236208417 | Accepted | 17 | 2,940 | 58 | a,b=map(int,input().split())
c=[a+b,a-b,a*b]
print(max(c)) |
s874598310 | p02694 | u758884263 | 2,000 | 1,048,576 | Wrong Answer | 105 | 27,136 | 241 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import numpy as np
def main():
x = int(input())
money = 100
ans = 0
while x >= money:
ans += 1
money += money * 0.01
money = np.floor(money)
print(ans)
if __name__ == '__main__':
main()
| s417678859 | Accepted | 115 | 26,988 | 281 | import numpy as np
def main():
x = int(input())
money = 100
ans = 0
while x > money:
money += money * 0.01
ans += 1
money = np.floor(money)
#print(money)
#print(ans)
print(ans)
if __name__ == '__main__':
main() |
s560682788 | p02690 | u667084803 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,205 | 9,040 | 219 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | X = int(input())
A = 0
while True:
for B in range(A):
if A ** 5 + B ** 5 == X:
print(A, B)
break
if A ** 5 - B ** 5 == X:
print(A, B)
break
A += 1 | s147429412 | Accepted | 29 | 9,200 | 328 | import sys
X = int(input())
A = 0
while True:
for B in range(A+1):
if A ** 5 + B ** 5 == X:
print(A, -B)
sys.exit()
if A ** 5 - B ** 5 == X:
print(A, B)
sys.exit()
if - A ** 5 + B ** 5 == X:
print(-A, -B)
sys.exit()
... |
s719057881 | p03623 | u897328029 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 94 | 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 = list(map(int, input().split()))
ans = "A" if abs(x-a) > abs(x-b) else "B"
print(ans) | s788838295 | Accepted | 17 | 2,940 | 95 | x, a, b = list(map(int, input().split()))
ans = "A" if abs(x-a) < abs(x-b) else "B"
print(ans)
|
s404775377 | p03854 | u674395364 | 2,000 | 262,144 | Wrong Answer | 21 | 3,444 | 262 | 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`. | import re
s = input()
re_list = [r'dream$', r'dreamer$', r'erase$', r'eraser$']
while True:
if s == '':
print('YES')
break
for regex in re_list:
m = re.sub(regex, '', s)
if m != s:
s = m
continue
else:
print('NO')
break | s534158315 | Accepted | 82 | 3,188 | 369 | S = input()
S = S[::-1]
while len(S) != 0:
num = len(S)
if S.find('maerd') == 0:
S = S.replace('maerd', '', 1)
if S.find('remaerd') == 0:
S = S.replace('remaerd', '', 1)
if S.find('esare') == 0:
S = S.replace('esare', '', 1)
if S.find('resare') == 0:
S = S.replace('resare', '', 1)
if num == ... |
s854373700 | p00446 | u408260374 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 632 | 次のような2人で行うカードゲームがある. * このゲームでは, 1から2nまでの各整数が書かれた全部で2n枚のカードを使用する. ここで,nは1以上100以下の整数である. * このカードを2人にn枚ずつ配る. * 次のルールに従って交互にカードを1枚ずつ場に出す. * 場にカードが出ていないならば, 好きなカードを出すことができる. * 場にカードが出ているならば, 最後に場に出たカードよりも大きい数の書かれたカードを出すことができる. * カードが出せる場合は,必ず場にカードを出す必要がある. * 出せるカードが無い場合はパスとなり,相手の番になる. このとき,場に出ているカードは無... | n = int(input())
taro = [int(input()) for _ in range(n)]
hanako = [x + 1 for x in range(2*n) if (x + 1) not in taro]
taro.sort()
hanako.sort()
def discard(c, cards):
for card in cards:
if c < card:
return card
return 0
table = 0
while True:
if taro:
table = discard(table, taro)... | s963656555 | Accepted | 40 | 6,724 | 780 | def discard(c, cards):
for card in cards:
if c < card:
return card
return 0
while True:
n = int(input())
if n == 0:
break
taro = [int(input()) for _ in range(n)]
hanako = [x + 1 for x in range(2*n) if (x + 1) not in taro]
taro.sort()
hanako.sort()
table... |
s195965742 | p03455 | u665452497 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 153 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | # -*- coding: utf-8 -*-
a, b = map(int, input().split())
if a%2 and b%2:
print('Even')
else:
print('Odd') | s739799783 | Accepted | 17 | 2,940 | 153 | # -*- coding: utf-8 -*-
a, b = map(int, input().split())
if a%2 and b%2:
print('Odd')
else:
print('Even') |
s187279364 | p02972 | u289288647 | 2,000 | 1,048,576 | Wrong Answer | 451 | 12,292 | 433 | 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... | import sys
n = int(input())
a = list(map(int, input().split()))
for i in range(n, 0, -1):
val = 0
for j in range(i, n+1, i):
val += a[j-1]
if val%2 != a[i-1]:
a[i-1] += 1
if a[i-1] > 1:
print(-1)
sys.exit()
num = sum(a)
if num == 0:
print(0)
else:
pr... | s674005550 | Accepted | 534 | 12,192 | 368 | import sys
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(n)]
for i in range(n, 0, -1):
val = 0
for j in range(i, n+1, i):
val += b[j-1]
if val%2 != a[i-1]:
b[i-1] += 1
num = sum(b)
if num == 0:
print(0)
else:
print(num)
for i in range(n):
if... |
s090011768 | p03836 | u813450984 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 290 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx, sy, tx, ty = map(int, input().split())
ans = ""
temp_x = tx - sx
temp_y = ty - sy
ans += "U"*temp_y + "R"*temp_x + "D"*temp_y + "L"* temp_x
temp_x += 1
temp_y += 1
ans += "L" + "U"*temp_y + "R"*temp_x + "D" + "R" + "D"*temp_y + "L"* temp_x + "U"
print(ans)
print("UURDDLLUUURRDRDDDLLU") | s832377860 | Accepted | 17 | 3,060 | 261 | sx, sy, tx, ty = map(int, input().split())
ans = ""
temp_x = tx - sx
temp_y = ty - sy
ans += "U"*temp_y + "R"*temp_x + "D"*temp_y + "L"* temp_x
temp_x += 1
temp_y += 1
ans += "L" + "U"*temp_y + "R"*temp_x + "D" + "R" + "D"*temp_y + "L"* temp_x + "U"
print(ans)
|
s359431675 | p02612 | u979951365 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,052 | 33 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n % 1000) | s247289778 | Accepted | 30 | 9,156 | 77 | n = int(input())
result = n % 1000
print(0 if result == 0 else 1000 - result) |
s203663236 | p03359 | u686036872 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | 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 if a < b else a-1) | s301003465 | Accepted | 17 | 2,940 | 48 | a, b = map(int, input().split())
print(a-(a>b)) |
s428020594 | p03067 | u247769252 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 221 | 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. | import sys
A, B, C = map(int, sys.stdin.readline().split())
print(A)
if A < B:
if B < C:
print("No")
else:
print("Yes")
if A > B:
if B > C:
print("No")
else:
print("Yes") | s832406339 | Accepted | 17 | 2,940 | 229 | import sys
A, B, C = map(int, sys.stdin.readline().split())
if A < B:
if B < C or C < A:
print("No")
else:
print("Yes")
if A > B:
if B > C or C > A:
print("No")
else:
print("Yes") |
s631895968 | p04043 | u390694622 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 143 | 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 ... | l=map(int,input().split())
for num in l:
if num not in [5,7]:
print("NO")
exit()
if sum(l) == 17:
print("YES")
else:
print("NO")
| s139251407 | Accepted | 17 | 2,940 | 148 | l=list(map(int,input().split()))
for num in l:
if num not in [5,7]:
print("NO")
exit()
if sum(l) == 17:
print("YES")
else:
print("NO") |
s924187939 | p02613 | u349863397 | 2,000 | 1,048,576 | Wrong Answer | 151 | 16,352 | 1,319 | 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`,... | from sys import stdin, stdout
import math,sys
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
import heapq
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')):
#------------------Sublime-----------... | s654697734 | Accepted | 146 | 16,448 | 1,337 | from sys import stdin, stdout
import math,sys
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
import heapq
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')):
#------------------Sublime-----------... |
s519101420 | p03370 | u217627525 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | n,x=map(int,input().split())
m=[int(input()) for _ in range(n)]
ans=n+(x-sum(m))//min(m) | s504394843 | Accepted | 17 | 2,940 | 164 | n,x=map(int,input().split())
m_min=1001
m_sum=0
for _ in range(n):
m=int(input())
m_sum+=m
if m<m_min:
m_min=m
ans=n+(x-m_sum)//m_min
print(ans) |
s084690069 | p03469 | u203211107 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | 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... | #A-Already 2018(ABC085)
S=str(input())
S=S.replace("7","8")
print(S) | s356075240 | Accepted | 17 | 2,940 | 69 | #A-Already 2018(ABC085)
S=input()
S=S.replace("2017","2018")
print(S) |
s214744489 | p03993 | u325956328 | 2,000 | 262,144 | Wrong Answer | 80 | 20,500 | 156 | There are N rabbits, numbered 1 through N. The i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i. For a pair of rabbits i and j (i<j), we call the pair (i,j) a _friendly pair_ if the following condition is met. * Rabbit i likes rabbit j and rabbit j likes rabbit i. Calculat... | N = int(input())
A = [x - 1 for x in map(int, input().split())]
print(A)
cnt = 0
for i in range(N):
if A[A[i]] == i:
cnt += 1
print(cnt // 2)
| s234536348 | Accepted | 69 | 20,452 | 147 | N = int(input())
A = [x - 1 for x in map(int, input().split())]
cnt = 0
for i in range(N):
if A[A[i]] == i:
cnt += 1
print(cnt // 2)
|
s566745377 | p03696 | u535171899 | 2,000 | 262,144 | Wrong Answer | 28 | 9,452 | 1,298 | 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... | def main():
import sys
input = lambda:sys.stdin.readline().strip()
N = int(input())
S = input()
#solve
from itertools import groupby
def runLengthEncode(S: str)->list:
'''
str to list(tuple).required itertools.groupby
'''
grouped = groupby(S)
... | s925765022 | Accepted | 28 | 9,100 | 405 | def main():
import sys
input = lambda:sys.stdin.readline().strip()
N = int(input())
S = input()
#solve
right=0
left=0
for i in range(N):
if S[i]=='(':
right+=1
else:
if right:
right-=1
else:
le... |
s691769467 | p03854 | u369212307 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 448 | 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()
s = s[::-1]
while True:
if s.find("maerd") == 0:
s = s.lstrip("maerd")
elif s.find("remaerd") == 0:
s = s.lstrip("remaerd")
elif s.find("esare") == 0:
s = s.lstrip("esare")
elif s.find("resare") == 0:
s = s.lstrip("resare")
else:
break
if s :
... | s116728467 | Accepted | 19 | 3,188 | 141 | s = input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s :
print("NO")
else:
print("YES") |
s053904499 | p03455 | u076941004 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 162 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a = input().split()
print(a[0])
A = []
for i in range(len(a)):
A.append(int(a[i]))
if not (A[0]*A[1]) % 2:
print('Even')
else:
print('Odd') | s124231180 | Accepted | 18 | 2,940 | 111 | a, b = (int(i) for i in input().split())
product = a*b
if product % 2 == 0:
print('Even')
else:
print('Odd')
|
s029512967 | p03659 | u141574039 | 2,000 | 262,144 | Wrong Answer | 2,108 | 23,792 | 283 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | N=int(input())
A=list(map(int,input().split()))
M=N;SU=0;AR=0;C=[0]*(N);C[0]=abs(A[0]-sum(A[1:]));x=10**9;P=0
for i in range(1,N):
if N-i==1:
p=0
break
else:
C[i]=abs(C[i-1]+A[i]-sum(A[i+1:]))
if x>C[i]:
x=C[i]
p=i
print(abs(C[p-1]+A[p]-sum(A[p+1:]))) | s060154546 | Accepted | 242 | 28,688 | 306 | S=[]
N=int(input())
A=list(map(int,input().split()))
C=[0]*(N);x=10**10;p=0
S.append(A[0])
for i in range(1,N):
S.append(S[i-1]+A[i])
#print(S)
C[0]=abs(A[0]-(S[-1]-S[0]))
for i in range(1,N-1):
C[i]=abs(S[i-1]+A[i]-(S[-1]-S[i]))
if x>(C[i]):
x=(C[i])
p=i
print(abs(S[p-1]+A[p]-(S[-1]-S[p]))) |
s349699493 | p03555 | u960570220 | 2,000 | 262,144 | Wrong Answer | 29 | 8,920 | 73 | 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. | C = str(input())
if C[0] == C[1]:
print('Yes')
else:
print('No') | s969480116 | Accepted | 23 | 8,936 | 135 | C1 = str(input())
C2 = str(input())
if C1[0] == C2[-1] and C1[1] == C2[-2] and C1[2] == C2[-3]:
print('YES')
else:
print('NO') |
s259013580 | p02747 | u368780724 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 156 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | import sys
readline = sys.stdin.buffer.readline
S = readline().strip()
ans = 'No'
for i in range(1, 8):
if S == 'hi'*i:
ans = 'Yes'
print(ans) | s328810265 | Accepted | 17 | 2,940 | 146 | import sys
readline = sys.stdin.buffer.readline
S = input()
ans = 'No'
for i in range(1, 8):
if S == 'hi'*i:
ans = 'Yes'
print(ans)
|
s161735692 | p03129 | u497046426 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 69 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | N, K = map(int, input().split())
print('YES' if N >= 1+2*K else 'NO') | s185349649 | Accepted | 17 | 2,940 | 74 | N, K = map(int, input().split())
print('YES' if (N+1) // K >= 2 else 'NO') |
s906129269 | p02613 | u505582857 | 2,000 | 1,048,576 | Wrong Answer | 92 | 15,396 | 423 | 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`,... | #!/usr/bin/env python3
import sys
rl = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
N = int(rl())
SL = read().split()
A, W, T, R = ord('A'), ord('W'), ord('T'), ord('R')
na, nw, nt, nr = 0, 0, 0, 0
for s in SL:
print(s[0])
if s[0] == A:
na += 1
elif s[0] == W:
nw += 1
elif s[0] == T:
nt ... | s913141217 | Accepted | 60 | 15,244 | 442 | #!/usr/bin/env python3
import sys
rl = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
N = int(rl())
SL = read().split()
A, W, T, R = ord('A'), ord('W'), ord('T'), ord('R')
na, nw, nt, nr = 0, 0, 0, 0
for s in SL:
if s[0] == A:
na += 1
elif s[0] == W:
nw += 1
elif s[0] == T:
nt += 1
elif s[... |
s696968206 | p03943 | u317508154 | 2,000 | 262,144 | Wrong Answer | 28 | 9,072 | 107 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a = list(map(int, input().split()))
a.sort()
if a[0] + a[1] == a[2]:
print('YES')
else:
print('NO') | s615463926 | Accepted | 24 | 9,052 | 107 | a = list(map(int, input().split()))
a.sort()
if a[0] + a[1] == a[2]:
print('Yes')
else:
print('No') |
s880197696 | p03970 | u379692329 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 128 | CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. So Mr. Takahashi decided to perform an operation that replaces a ce... | S = input()
correct = "CODEFESTIVAL2016"
cnt = 0
for i in range(len(S)):
if S[i] == correct[i]:
cnt += 1
print(cnt) | s136317650 | Accepted | 17 | 2,940 | 137 | S = input()
correct = "CODEFESTIVAL2016"
cnt = 0
for i in range(len(S)):
if S[i] == correct[i]:
cnt += 1
print(len(S) - cnt) |
s038140811 | p03997 | u558374183 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | 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. | l = [int(input()) for i in range(3)]
s = (l[0] + l[1]) * l[2] / 2
print(s) | s428583188 | Accepted | 17 | 2,940 | 79 | l = [int(input()) for i in range(3)]
s = int((l[0] + l[1]) * l[2] / 2)
print(s) |
s126064649 | p03407 | u897302879 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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. | A, B, C = map(int, input().split())
print('Yes' if ((A == C) or (B == C) or (A + B == C)) else 'No') | s074749965 | Accepted | 17 | 2,940 | 72 | A, B, C = map(int, input().split())
print('Yes' if A + B >= C else 'No') |
s305068629 | p03635 | u580362735 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | 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? | n,m = map(int,input().split())
print(n*m-2*n-2*m) | s894276980 | Accepted | 17 | 2,940 | 57 | n,m = map(int,input().split())
print((n+1)*(m+1)-2*n-2*m) |
s193424481 | p03469 | u508273185 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | 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[:4]) | s152213712 | Accepted | 18 | 2,940 | 33 | s = input()
print("2018" + s[4:]) |
s218594763 | p02936 | u994910167 | 2,000 | 1,048,576 | Wrong Answer | 2,113 | 102,040 | 600 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | N, Q = map(int, input().split())
tree = list()
ope = list()
cnt = [0] * N
for i in range(N-1):
tree.append(list(map(int, input().split())))
for i in range(Q):
ope.append(list(map(int, input().split())))
#print(tree, ope)
for i in range(Q):
vertex = ope[i][0]
add = ope[i][1]
parent = list()
par... | s051986203 | Accepted | 1,844 | 113,604 | 259 | N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N-1)]
px = [list(map(int, input().split())) for i in range(Q)]
cnt = [0] * N
for p, x in px:
cnt[p-1] += x
for a, b in sorted(ab):
cnt[b-1] += cnt[a-1]
print(*cnt) |
s220803968 | p03644 | u137228327 | 2,000 | 262,144 | Wrong Answer | 25 | 9,112 | 46 | 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())
print(N if N%2 == 0 else N-1) | s579614075 | Accepted | 30 | 8,972 | 78 | N = int(input())
i = 0
while N >= 2**i:
#count+=1
i+=1
print(2**(i-1)) |
s021518557 | p03193 | u405256066 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,188 | 277 | There are N rectangular plate materials made of special metal called AtCoder Alloy. The dimensions of the i-th material are A_i \times B_i (A_i vertically and B_i horizontally). Takahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \times W. He is trying to obtain such a plate by cho... | from sys import stdin
N,k1,k2=[int(x) for x in stdin.readline().rstrip().split()]
a = []
for i in range(N):
a.append([int(x) for x in stdin.readline().rstrip().split()])
cnt=0
for i in a:
tmp1=i[0]-k1
tmp2=i[1]-k2
if tmp1>0 and tmp2>0:
cnt+=1
print(cnt) | s773526528 | Accepted | 19 | 3,188 | 279 | from sys import stdin
N,k1,k2=[int(x) for x in stdin.readline().rstrip().split()]
a = []
for i in range(N):
a.append([int(x) for x in stdin.readline().rstrip().split()])
cnt=0
for i in a:
tmp1=i[0]-k1
tmp2=i[1]-k2
if tmp1>=0 and tmp2>=0:
cnt+=1
print(cnt) |
s318428311 | p03457 | u426964396 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 174 | 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... | n = int(input())
for i in range(n):
a, b, c = map(int, input().split())
if abs(a) + abs(b) > c:
print('No')
break
else:
print('Yes') | s249288135 | Accepted | 337 | 3,060 | 249 | n = int(input())
c = True
for i in range(n):
t, x, y = map(int, input().split())
if x + y == t:
c = True
elif x + y < t and (t - x - y) % 2 == 0:
c = True
else:
c = False
break
if c == True:
print("Yes")
else:
print("No") |
s749250271 | p03409 | u054514819 | 2,000 | 262,144 | Wrong Answer | 30 | 9,188 | 662 | 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, ... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
from bisect import bisect_right
N = int(input())
ab = [list(mapint()) for _ in range(N)]
cd = [list(mapint()) for _ in range(N)]
ab.sort()
cd.sort(key=lambda x: x[1])
clis = [c for c,... | s601073805 | Accepted | 28 | 9,212 | 566 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
from bisect import bisect_right
N = int(input())
ab = [list(mapint()) for _ in range(N)]
cd = [list(mapint()) for _ in range(N)]
ab.sort(reverse=True)
cd.sort(key=lambda x: x[1])
chec... |
s535893939 | p01448 | u192570203 | 8,000 | 131,072 | Wrong Answer | 30 | 8,360 | 297 | 明日から、待ちに待った夏休みが始まります。なのでわたしは、友だちを誘って、海に遊びに行くこ とに決めました。 けれども、わたしの友だちには、恥ずかしがりやさんが多いです。その人たちは、あまり多くの人が いっしょに来ると知ったら、きっと嫌がるでしょう。 ほかにも、わたしの友だちには、目立ちたがりやさんも多いです。その人たちは、いっしょに来る人 があまり多くないと知れば、きっと嫌がるでしょう。 それと、わたしの友だちには、いつもは目立ちたがりやなのに実は恥ずかしがりやさんな人もいま す。その人たちは、いっしょに来る人が多すぎても少なすぎても、きっと嫌がるでしょう。 こういうのは、大勢で行った方が楽しいはずです。だからわたしは、で... | N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]
diff = [0] * 100001
for k in l :
diff[k[0] - 1] += 1
diff[k[1]] -= 1
hist = [0,0]
for i in range(2, N + 1) :
hist.append(hist[-1] + diff[i-1])
print(max([y for (x,y) in zip(hist, range(N + 1)) if x + 1 >= y])) | s220871121 | Accepted | 470 | 38,964 | 307 | N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]
diff = [0] * 100002
for k in l :
diff[k[0] - 1] += 1
diff[k[1]] -= 1
hist = [0,0]
for i in range(2, N + 2) :
hist.append(hist[-1] + diff[i-1])
print(max([0] + [y - 1 for (x,y) in zip(hist, range(N + 2)) if x + 1 >= y])) |
s149192471 | p00012 | u572790226 | 1,000 | 131,072 | Wrong Answer | 30 | 7,456 | 544 | There is a triangle formed by three points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ on a plain. Write a program which prints "YES" if a point $P$ $(x_p, y_p)$ is in the triangle and "NO" if not. | import sys
def crossMulti(p1, p2):
return p1[0] * p2[1] - p1[1] * p2[0]
lines = sys.stdin.readlines()
for line in lines:
Zd = []
x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
Ps = [(x2-x1, y2-y1),(x3-x2, y3-y2),(x1-x3, y1-y3)]
Px = [(xp-x1, yp-y1),(xp-x2, yp-y2),(xp-x3, yp-y... | s032965930 | Accepted | 30 | 7,544 | 544 | import sys
def crossMulti(p1, p2):
return p1[0] * p2[1] - p1[1] * p2[0]
lines = sys.stdin.readlines()
for line in lines:
Zd = []
x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
Ps = [(x2-x1, y2-y1),(x3-x2, y3-y2),(x1-x3, y1-y3)]
Px = [(xp-x1, yp-y1),(xp-x2, yp-y2),(xp-x3, yp-y... |
s031170631 | p01127 | u598551137 | 8,000 | 131,072 | Wrong Answer | 860 | 5,628 | 949 | これは 20XX 年の話である.再生発電網による安定したエネルギー供給,および液化合成燃料の発明によって航空旅客数は鰻登りに増加した.しかし,航空機によるテロリズムの脅威は依然として存在するため,高速でかつ高い信頼性をもつ自動手荷物検査システムの重要性が高まっている.検査官が全部の荷物を調べることは実際問題として困難であることから,自動検査において疑わしいと判断された手荷物だけを検査官で改めて調べるという仕組みを整えたいわけである. 航空機業界からの要請を受け,国際客室保護会社(International Cabin Protection Company)では,新たな自動検査システムを開発するため,最近の旅客の手荷物について調査し... | def is_safe(image, p):
count = 0
for k, v in p.items():
rect = True
for y in range(v[1], v[3] + 1, 1):
for x in range(v[0], v[2] + 1, 1):
m = image[y][x]
if m == '.':
return False
if k != m:
rect ... | s072024332 | Accepted | 850 | 5,624 | 1,172 | def can_fill(image, k, v):
for y in range(v[1], v[3] + 1):
for x in range(v[0], v[2] + 1):
m = image[y][x]
if m != k and m != '*':
return False
return True
def is_safe(image, p):
keys = list(p.keys())
i = 0
while i < len(keys):
k = keys[i]
... |
s347288831 | p03149 | u723583932 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,096 | 193 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". |
n=list(map(int,input().split()))
if ('1' in n) and ('9' in n) and ('7' in n) and ('4' in n):
print('YES')
else:
print('NO') | s222661620 | Accepted | 28 | 9,148 | 185 |
n=list(map(int,input().split()))
if (1 in n) and (9 in n) and (7 in n) and (4 in n):
print('YES')
else:
print('NO') |
s176223376 | p03545 | u049979154 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 412 | 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... | from itertools import *
ABCD = input()
n = len(ABCD) - 1
plumi_list = list(product(["+", "-"], repeat=n))
print(plumi_list)
for bit in range(1 << n):
formula = ABCD[0]
for num, op in zip(ABCD[1:], plumi_list[bit]):
formula += op + num
ans = eval(formula)
if ans == 7:
pr... | s278645100 | Accepted | 18 | 3,060 | 345 | from itertools import *
ABCD = input()
n = len(ABCD) - 1
plumi_list = list(product(["+", "-"], repeat=n))
for bit in range(1 << n):
formula = ABCD[0]
for num, op in zip(ABCD[1:], plumi_list[bit]):
formula += op + num
ans = eval(formula)
if ans == 7:
print(formula + "=7")
... |
s541339743 | p02612 | u367319568 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,148 | 32 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n % 1000) | s764836573 | Accepted | 27 | 9,168 | 93 | n = int(input())
i = 0
m = n
while (m > 0):
m = m - 1000
i = i + 1
print(i*1000 - n) |
s822002736 | p04043 | u361826811 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 322 | 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
# import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().decode('utf8').rstrip().split()
print('Yes' if S.count('5') == 2 and S.count('7') == 1 else 'No')
| s664173253 | Accepted | 17 | 2,940 | 322 |
import sys
# import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().decode('utf8').rstrip().split()
print('YES' if S.count('5') == 2 and S.count('7') == 1 else 'NO')
|
s684339270 | p04012 | u017719431 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 243 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | s = input()
def isBeautiful(s):
dict = {}
for i in s:
if i not in dict:
dict[i] = 1
else:
dict[i] += 1
for key in dict:
if dict[key] % 2 != 0:
return False
return True
print(isBeautiful(s)) | s681963245 | Accepted | 17 | 2,940 | 243 | s = input()
def isBeautiful(s):
dict = {}
for i in s:
if i not in dict:
dict[i] = 1
else:
dict[i] += 1
for key in dict:
if dict[key] % 2 != 0:
return "No"
return "Yes"
print(isBeautiful(s)) |
s179927675 | p03386 | u924308178 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 256 | 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. | # coding: utf-8
# Your code here!
A,B,K = list(map(int,input().split(" ")))
ans = []
for i in range(K):
if A<=A+i<=B:
ans.append(A+i)
if A<=A-i<=B:
ans.append(B-i)
ans = list(set(ans))
ans.sort()
for i in ans:
print(i)
| s193342609 | Accepted | 19 | 3,060 | 256 | # coding: utf-8
# Your code here!
A,B,K = list(map(int,input().split(" ")))
ans = []
for i in range(K):
if A<=A+i<=B:
ans.append(A+i)
if A<=B-i<=B:
ans.append(B-i)
ans = list(set(ans))
ans.sort()
for i in ans:
print(i)
|
s630616950 | p03658 | u089142196 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | N,K=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
print(sum(l[0:K+1])) | s111073797 | Accepted | 17 | 2,940 | 103 | N,K=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
print(sum(l[0:K])) |
s237987166 | p02842 | u723583932 | 2,000 | 1,048,576 | Wrong Answer | 41 | 9,124 | 157 | 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())
ans=0
for i in range(1,50000+1):
z=i*1.08
if n<=z<(n+1):
ans=z
break
if ans==0:
print(":(")
else:
print(ans)
| s051431410 | Accepted | 41 | 9,172 | 157 | n=int(input())
ans=0
for i in range(1,50000+1):
z=i*1.08
if n<=z<(n+1):
ans=i
break
if ans==0:
print(":(")
else:
print(ans)
|
s574268710 | p03565 | u956433805 | 2,000 | 262,144 | Wrong Answer | 31 | 9,116 | 826 | 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... | S = str(input())
T = str(input())
ans = []
flag = False
T_l = len(T)
S_l = len(S)
u = 0
while u < S_l:
cnt = 0
name = S[u]
if name == T[0] or name == "?":
cnt += 1
u += 1
for j in range(u,S_l):
if cnt == T_l:
break
if S[j] == "?" or S[j] == ... | s884651076 | Accepted | 30 | 9,084 | 368 | sd = input()
t = input()
n = len(sd)
m = len(t)
s = []
for i in range(n - m, -1, -1):
t_kamo = sd[i:i + m]
for j in range(m + 1):
if j == m:
print((sd[:i] + t + sd[i + len(t):]).replace("?", "a"))
exit()
if t_kamo[j] == "?":
continue
elif t_kamo[j] !... |
s288037472 | p03448 | u385244248 | 2,000 | 262,144 | Wrong Answer | 48 | 2,940 | 198 | 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... | A,B,C,X = map(int,open(0).read().split())
a = 0
for i in range(1,A+1):
for l in range(1,B+1):
for q in range(1,C+1):
if 500*i+100*B+50*C == X:
a += 1
print(a) | s671419630 | Accepted | 50 | 2,940 | 192 | A,B,C,X = map(int,open(0).read().split())
a = 0
for i in range(A+1):
for l in range(B+1):
for q in range(C+1):
if 500*i+100*l+50*q == X:
a += 1
print(a) |
s551675368 | p04044 | u955691979 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 143 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | a = input().split()
s = [input() for i in range(int(a[0]))]
b = ''
s.sort()
print(s)
for i in range(int(a[0]),0):
b = s[i] + b
print(b) | s848079205 | Accepted | 17 | 3,064 | 103 | a = input().split()
s = [input() for i in range(int(a[0]))]
b = ''
s.sort()
b = ''.join(s)
print(b) |
s044943089 | p03563 | u298497862 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 55 | 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... | R = float(input())
G = float(input())
print(G * 2 - R)
| s229402630 | Accepted | 17 | 2,940 | 51 | R = int(input())
G = int(input())
print(G * 2 - R)
|
s828593726 | p03730 | u940780117 | 2,000 | 262,144 | Wrong Answer | 28 | 9,060 | 173 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A,B,C=map(int,input().split())
mod=set()
tmp=0
D=A
while tmp not in mod:
mod.add(tmp)
tmp=D%B
if tmp==C:
print('Yes')
exit()
D+=A
print('No') | s093202733 | Accepted | 28 | 9,168 | 173 | A,B,C=map(int,input().split())
mod=set()
tmp=0
D=A
while tmp not in mod:
mod.add(tmp)
tmp=D%B
if tmp==C:
print('YES')
exit()
D+=A
print('NO') |
s756036104 | p03828 | u614550445 | 2,000 | 262,144 | Wrong Answer | 23 | 3,064 | 452 | You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. | import math
N = int(input())
mod = 10**9+7
def get_primes(n):
ps = [0, 0] + [i for i in range(2, n)]
for i in range(2, n):
if ps[i] == 0:
continue
for j in range(i * i, n, i):
ps[j] = 0
return [p for p in ps if p]
prime = get_primes(N)
ans = 1
for p in prime:
... | s447755705 | Accepted | 23 | 3,064 | 458 | import math
N = int(input())
mod = 10**9+7
def get_primes(n):
ps = [0, 0] + [i for i in range(2, n+1)]
for i in range(2, n+1):
if ps[i] == 0:
continue
for j in range(i * i, n+1, i):
ps[j] = 0
return [p for p in ps if p]
prime = get_primes(N)
ans = 1
for p in prim... |
s909031484 | p03131 | u782685137 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 85 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | K,A,B=map(int,input().split())
c=K-A;d=B-A
print(K+1 if d<2 or c<1 else A+c%2+c//2*d) | s442508036 | Accepted | 17 | 2,940 | 87 | K,A,B=map(int,input().split())
c=K-A+1;d=B-A
print(K+1 if d<2 or c<1 else A+c%2+c//2*d) |
s274752915 | p03455 | u227082700 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b=map(int,input().split())
if (a*b)&1:print("Even")
else:print("Odd") | s205013567 | Accepted | 17 | 2,940 | 77 | a,b=map(int,input().split())
if ((a*b)&1)==0:print("Even")
else:print("Odd")
|
s301330882 | p02392 | u609407244 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 71 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | a, b, c = map(int, input().split())
print('YES' if a < b < c else 'NO') | s212419342 | Accepted | 30 | 6,724 | 71 | a, b, c = map(int, input().split())
print('Yes' if a < b < c else 'No') |
s171251936 | p02663 | u511379665 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,092 | 85 | In this problem, we use the 24-hour clock. Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can start studying? | h1,m1,h2,m2,k=map(int,input().split())
t=h2*60+m2-(h1*60+m1)
t-=0.5
g=t//k
print(g*k) | s296704249 | Accepted | 22 | 9,080 | 78 | h1,m1,h2,m2,k=map(int,input().split())
t=h2*60+m2-(h1*60+m1)
print(max(0,t-k)) |
s803547852 | p02259 | u065504661 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 404 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | if __name__ == '__main__':
N = input('Please input the number of elements: ')
N = int(N)
array = list(map(int, input('Please input the array: ').split()))
for i in range(N):
print(' '.join(map(str, array)))
for j in range(N-1, i, -1):
if array[j] < array[j-1]:
... | s525013779 | Accepted | 20 | 5,600 | 422 | def bubble_sort(A):
global N
flag = True
i = 0
cnt = 0
while flag:
flag = False
for j in range(N-1, i, -1):
if A[j] < A[j-1]:
A[j],A[j-1] = A[j-1],A[j]
cnt += 1
flag = True
i += 1
return cnt
N = int(input())
A ... |
s496720936 | p03732 | u557437077 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 981 | You have N items and a bag of strength W. The i-th item has a weight of w_i and a value of v_i. You will select some of the items and put them in the bag. Here, the total weight of the selected items needs to be at most W. Your objective is to maximize the total value of the selected items. | def func(n, W, w):
dp = [[0 for _ in range(W+1)] for _ in range(n+1)]
for i in range(1, len(dp)):
for j in range(len(dp[0])):
if j-w[-i][0] >= 0:
dp[i][j] = max(dp[i-1][j-w[-i][0]] + w[-i][1], dp[i-1][j])
else:
dp[i][j] = dp[i-1][j]
... | s349926928 | Accepted | 306 | 3,064 | 1,683 | def func(n, W, w):
_max = 0
weights = [[] for _ in range(4)]
for i in range(n):
weights[w[i][0]-w[0][0]].append(w[i][1])
for i in range(len(weights)):
weights[i].sort()
weights[i].append(0)
weights[i].reverse()
for j in range(1, len(weights[i])):
wei... |
s179026498 | p03545 | u215461917 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 485 | 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 operator
s = [int(i) for i in list(input())]
op = []
op.append( operator.add )
op.append( operator.sub )
for i in range(2) :
for j in range(2) :
for k in range(2) :
r = op[i](s[0],s[1])
r = op[j](r,s[2])
r = op[k](r,s[3])
if r == 7 :
op1 = "+" if i == 0 else "-"
... | s035515607 | Accepted | 18 | 3,064 | 490 | import operator
s = [int(i) for i in list(input())]
op = []
op.append( operator.add )
op.append( operator.sub )
for i in range(2) :
for j in range(2) :
for k in range(2) :
r = op[i](s[0],s[1])
r = op[j](r,s[2])
r = op[k](r,s[3])
if r == 7 :
op1 = "+" if i == 0 else "-"
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.