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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s375127162 | p02853 | u170296094 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 279 | We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.... | x, y = input().split()
s = 0
if x == 1:
s += 300000
elif x == 2:
s += 200000
elif x == 3:
s += 100000
else:
s += 0
if y == 1:
s += 300000
elif y == 2:
s += 200000
elif y == 3:
s += 100000
else:
s += 0
if x == 1 and y == 1:
s += 400000
print(s) | s542227202 | Accepted | 17 | 3,060 | 319 | x, y = input().split()
s = 0
if int(x) == 1:
s += 300000
elif int(x) == 2:
s += 200000
elif int(x) == 3:
s += 100000
else:
s += 0
if int(y) == 1:
s += 300000
elif int(y) == 2:
s += 200000
elif int(y) == 3:
s += 100000
else:
s += 0
if int(x) == 1 and int(y) == 1:
s += 400000
print(s) |
s817518603 | p00015 | u723913470 | 1,000 | 131,072 | Wrong Answer | 20 | 7,584 | 975 | A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t... | import sys
N=int(input())
N=int(N/2)
for i in range(N):
a=input()
b=input()
len_a=len(a)
len_b=len(b)
c=[]
kuriage=0
if(len_a>=len_b):
for i in range(len_b):
c.append((kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))%10)
kuriage=(kuriage+int(a[len_a-1-i])+int(b[le... | s991448816 | Accepted | 20 | 7,620 | 964 | import sys
N=int(input())
for i in range(N):
a=input()
b=input()
len_a=len(a)
len_b=len(b)
c=[]
kuriage=0
if(len_a>=len_b):
for i in range(len_b):
c.append((kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))%10)
kuriage=(kuriage+int(a[len_a-1-i])+int(b[len_b-1-i]))/... |
s130255396 | p03846 | u405660020 | 2,000 | 262,144 | Wrong Answer | 86 | 14,692 | 501 | There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu... | n=int(input())
a=list(map(int, input().split()))
from collections import Counter
c=Counter(a)
cnt_lst=[0]*n
for key in c:
cnt_lst[key]+=c[key]
if n%2==1:
if cnt_lst[0]==1:
cnt_lst.pop(0)
print(cnt_lst)
if all([cnt_lst[i]==2 for i in range(n-1) if i%2==1]):
print(2**(n//2)... | s857579236 | Accepted | 102 | 14,692 | 531 | n=int(input())
a=list(map(int, input().split()))
mod=10**9+7
from collections import Counter
c=Counter(a)
cnt_lst=[0]*n
for key in c:
cnt_lst[key]+=c[key]
flag=True
if n%2==1:
if cnt_lst[0]==1:
cnt_lst.pop(0)
else:
flag=False
for i in range(n-1):
if (i%2==1 and cnt_lst[i]!=2) ... |
s528275076 | p03645 | u291988695 | 2,000 | 262,144 | Wrong Answer | 2,107 | 54,160 | 291 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... | n,m=map(int,input().split())
l=[[0,0]]*m
t=[0]*m
tc=0
a=False
for k in range(m):
l[k]=list(map(int,input().split()))
l.sort()
for k in l:
if k[0]==1:
t[tc]=k[1]
tc+=1
elif k[1]==n:
if k[1] in t:
a=True
break
if a:
print("POSSIBLE")
else:
print("IMPOSSIBLE") | s192923037 | Accepted | 799 | 36,524 | 368 | n,m=map(int,input().split())
l=[[0,0]]*m
at=[0]*m
bt=[0]*m
atc=0
btc=0
a=False
f=0
for k in range(m):
ln=list(map(int,input().split()))
if ln[0]==1:
at[atc]=ln[1]
atc+=1
elif ln[1]==n:
bt[btc]=ln[0]
btc+=1
del at[atc:]
del bt[btc:]
at.sort()
bt.sort()
c=list(set(at)^set(bt))
if len(c)!=(atc+btc):... |
s696391933 | p02659 | u818318325 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,964 | 269 | Compute A \times B, truncate its fractional part, and print the result as an integer. | import math
from decimal import *
getcontext().prec = 28
a,b=map(str, input().split())
#a_ = Decimal(a)
#b_ = Decimal(b)
a = int(a)
b = float(b)*100
#print(round(Decimal(Decimal(a)*Decimal(b))))
print((a*b)//100)
#print(math.floor(Decimal(a)*Decimal(b)/Decimal(100.0))) | s509121276 | Accepted | 20 | 9,164 | 277 | #import math
#from decimal import *
#getcontext().prec = 28
a,b=input().split()
#a_ = Decimal(a)
#b_ = Decimal(b)
a = int(a)
b = int(float(b)*1000)
#print(round(Decimal(Decimal(a)*Decimal(b))))
ans = a*b
print(ans//1000)
#print(math.floor(Decimal(a)*Decimal(b)/Decimal(100.0))) |
s547256902 | p02843 | u799916419 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 220 | AtCoder Mart sells 1000000 of each of the six items below: * Riceballs, priced at 100 yen (the currency of Japan) each * Sandwiches, priced at 101 yen each * Cookies, priced at 102 yen each * Cakes, priced at 103 yen each * Candies, priced at 104 yen each * Computers, priced at 105 yen each Takahashi want... | def bag(x):
max_num = x // 100
print(int(max_num * 5 <= x % 100))
if __name__ == "__main__":
import sys
in_str = ''
for line in sys.stdin:
in_str += line
n = [int(_) for _ in in_str.split()][0]
bag(n) | s510350447 | Accepted | 17 | 2,940 | 220 | def bag(x):
max_num = x // 100
print(int(max_num * 5 >= x % 100))
if __name__ == "__main__":
import sys
in_str = ''
for line in sys.stdin:
in_str += line
n = [int(_) for _ in in_str.split()][0]
bag(n) |
s442407829 | p03729 | u594762426 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a, b , c= map(str, input().split())
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
print("Yes")
else:
print("No") | s324135070 | Accepted | 17 | 2,940 | 125 | a, b, c = map(str, input().split())
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
print("YES")
else:
print("NO") |
s922237321 | p02608 | u571199625 | 2,000 | 1,048,576 | Wrong Answer | 1,039 | 12,496 | 392 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | n = int(input())
dic = {}
for x in range(1,int(n**0.5)+1):
for y in range(1,int(n**0.5)+1):
for z in range(1,int(n**0.5)+1):
ans = x**2 + y **2 + z**2 +x*y+y*z+z*x
if ans in dic:
dic[ans] +=1
else:
dic[ans] = 1
print(dic)
for i in range(n... | s721431059 | Accepted | 1,062 | 11,588 | 380 | n = int(input())
dic = {}
for x in range(1,int(n**0.5)+1):
for y in range(1,int(n**0.5)+1):
for z in range(1,int(n**0.5)+1):
ans = x**2 + y **2 + z**2 +x*y+y*z+z*x
if ans in dic:
dic[ans] +=1
else:
dic[ans] = 1
for i in range(n):
if i+... |
s681208456 | p04029 | u178536051 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | 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)
ret = 0
for i in range(N):
ret += i+1
print(ret) | s825180723 | Accepted | 17 | 2,940 | 69 | N = int(input())
ret = 0
for i in range(N):
ret += i+1
print(ret) |
s364037241 | p00254 | u221679506 | 1,000 | 131,072 | Wrong Answer | 30 | 8,308 | 393 | 0 から 9 の数字からなる四桁の数 N に対して以下の操作を行う。 1. N の桁それぞれの数値を大きい順に並べた結果得た数を L とする 2. N の桁それぞれの数値を小さい順に並べた結果得た数を S とする 3. 差 L-S を新しい N とする(1回分の操作終了) 4. 新しい N に対して 1. から繰り返す このとき、全桁が同じ数字(0000, 1111など)である場合を除き、あらゆる四桁の数はいつかは 6174になることが知られている。例えば N = 2012の場合 1回目 (N = 2012): L = 2210, S = 0122, L-S = 2088 2回... | from functools import reduce
while True:
n = input()
if n == "0000":
break
n = n if len(n) >= 4 else n.zfill(4)
if reduce(lambda x,y:x and y,[n[0] == i for i in n]):
print("NA")
else:
cnt = 0
while n != "6174":
s = ''.join(sorted(n))
l = ''.join(sorted(n,reverse = True))
n = str(int(l)-int(s))
... | s236905724 | Accepted | 350 | 8,300 | 381 | from functools import reduce
while True:
n = input()
if n == "0000":
break
n = n if len(n) >= 4 else n.zfill(4)
if reduce(lambda x,y:x and y,[n[0] == i for i in n]):
print("NA")
else:
cnt = 0
while n != "6174":
s = ''.join(sorted(n))
l = ''.join(sorted(n,reverse = True))
n = str(int(l)-int(s))
... |
s795564829 | p03556 | u102461423 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | N = int(input())
print(int(N**.5)) | s359242247 | Accepted | 17 | 2,940 | 37 | N = int(input())
print(int(N**.5)**2) |
s149404780 | p03494 | u215643129 | 2,000 | 262,144 | Wrong Answer | 25 | 9,072 | 131 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n=input()
l=list(map(int, input().split()))
count=0
while all(i/2==0 for i in l):
l=[i/2 for i in l]
count+=1
print(count) | s180561607 | Accepted | 30 | 9,188 | 140 | int(input())
A = list(map(int, input().split()))
count = 0
while all(a%2==0 for a in A):
A = [a/2 for a in A]
count+=1
print(count) |
s892936345 | p03644 | u432333240 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 253 | 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())
count = 0
ans = 1
for i in range(1,N):
tmp_count = 0
tmp_i = i
while(tmp_i%2==0):
tmp_count+=1
tmp_i /= 2
print(i, tmp_count)
if count < tmp_count:
count = tmp_count
ans = i
print(ans) | s841923203 | Accepted | 18 | 2,940 | 232 | N = int(input())
count = 0
ans = 1
for i in range(1,N+1):
tmp_count = 0
tmp_i = i
while(tmp_i%2==0):
tmp_count+=1
tmp_i /= 2
if count < tmp_count:
count = tmp_count
ans = i
print(ans)
|
s830432579 | p02401 | u315329386 | 1,000 | 131,072 | Wrong Answer | 20 | 7,436 | 93 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
inst = input()
if inst.find("?") > 0:
break
print(eval(inst)) | s265916845 | Accepted | 20 | 7,448 | 112 | while True:
inst = input()
if inst.find("?") > 0:
break
print(eval(inst.replace("/", "//"))) |
s154849624 | p02388 | u027634846 | 1,000 | 131,072 | Wrong Answer | 20 | 7,496 | 29 | Write a program which calculates the cube of a given integer x. | x = int(input())
print(x * 3) | s481091292 | Accepted | 20 | 7,656 | 30 | x = int(input())
print(x ** 3) |
s184724796 | p03556 | u837852400 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | 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. | import math
print(str(int(math.sqrt(int(input()))))) | s463109589 | Accepted | 18 | 2,940 | 69 | import math
print(str(int(math.pow(int(math.sqrt(int(input()))),2)))) |
s502789365 | p03671 | u165988235 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m... | a,b,c = map(int,input().split())
list = []
list.append(a)
list.append(b)
list.append(c)
print(list)
list.sort()
print(list[0]+list[1])
| s298203544 | Accepted | 17 | 2,940 | 123 | a,b,c = map(int,input().split())
list = []
list.append(a)
list.append(b)
list.append(c)
list.sort()
print(list[0]+list[1])
|
s840827624 | p04029 | u349856770 | 2,000 | 262,144 | Wrong Answer | 27 | 9,160 | 106 | 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("人数を入力してね >"))
ame = 0
for i in range(1, n+1):
ame += i
print(ame) | s512298961 | Accepted | 26 | 9,024 | 74 | n = int(input())
ame = 0
for i in range(1, n+1):
ame += i
print(ame) |
s762447558 | p02678 | u531599639 | 2,000 | 1,048,576 | Wrong Answer | 627 | 35,548 | 400 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque
N,M = map(int,input().split())
cnct = [[] for i in range(N+1)]
for _ in range(M):
A,B = map(int,input().split())
cnct[A].append(B)
cnct[B].append(A)
Q = deque()
Q.append(1)
ans = [0]*(N+1)
vstd = [0]*(N+1)
while Q:
temp = Q.popleft()
for a in cnct[temp]:
if vstd[a] == 0:
... | s551839070 | Accepted | 634 | 35,464 | 577 | from collections import deque
N,M = map(int,input().split())
cnct = [[] for i in range(N+1)]
for _ in range(M):
A,B = map(int,input().split())
cnct[A].append(B)
cnct[B].append(A)
Q = deque()
Q.append(1)
ans = [0]*(N+1)
vstd = [0]*(N+1)
while Q:
temp = Q.popleft()
for a in cnct[temp]:
if vstd[a] == 0:
... |
s585289023 | p02261 | u956645355 | 1,000 | 131,072 | Wrong Answer | 30 | 7,736 | 900 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... | def main():
N = int(input())
CARD = tuple(input().split())
sort_ = []
for i in range(1, 10):
for s in CARD:
if str(i) in s:
sort_.append(s)
sort_ = tuple(sort_)
a = list(CARD)
bsort = tuple(bubbleSort(a, N))
ssort = tuple(selectionSort(a, N))
fo... | s344388055 | Accepted | 20 | 7,744 | 899 | def main():
N = int(input())
CARD = tuple(input().split())
sort_ = []
for i in range(1, 10):
for s in CARD:
if str(i) in s:
sort_.append(s)
sort_ = tuple(sort_)
bsort = tuple(bubbleSort(list(CARD), N))
ssort = tuple(selectionSort(list(CARD), N))
for... |
s094830308 | p03448 | u526459074 | 2,000 | 262,144 | Wrong Answer | 49 | 3,060 | 207 | 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, [input() for i in range(4)])
ans = 0
for i in range(a):
for j in range (b):
for k in range (c):
if 500*i + 100*j + 50*k == x:
ans += 1
print(ans) | s984359729 | Accepted | 53 | 3,060 | 213 | a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
for j in range (b+1):
for k in range (c+1):
if 500*i + 100*j + 50*k == x:
ans += 1
print(ans) |
s708047267 | p03861 | u113255362 | 2,000 | 262,144 | Wrong Answer | 2,205 | 9,172 | 138 | 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,c=map(int,input().split())
k = 0
m = a % c
if m == 0:
k = a
else:
k = c-m + a
res = 0
for i in range(k,b,c):
res += 1
print(res) | s551095132 | Accepted | 27 | 9,112 | 211 | a,b,c=map(int,input().split())
mini = 0
m = a % c
if m == 0:
mini = a/c
else:
mini = (c-m + a)/c
maxi = 0
M = b % c
if M == 0:
maxi = b//c
else:
maxi = (b-M)//c
res = int(maxi) - int(mini) + 1
print(res) |
s548793966 | p03605 | u485566817 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | n = input()
if n[0] == 9 or n[1] == 9:
print("Yes")
else:
print("No") | s551187305 | Accepted | 17 | 2,940 | 81 | n = input()
if n[0] == "9" or n[1] == "9":
print("Yes")
else:
print("No") |
s062464529 | p03998 | u583507988 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 401 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | a = list(map(str, input().split()))
b = list(map(str, input().split()))
c = list(map(str, input().split()))
n = 'a'
while True:
if n == 'a':
if len(a) == 0:
print('A')
break
else:
n = a.pop(0)
elif n == b:
if len(b) == 0:
print('B')
break
else:
n = b.pop(0)
el... | s267653041 | Accepted | 25 | 8,980 | 289 | sa=input()+'a'
sb=input()+'b'
sc=input()+'c'
st='a'
a=0
b=0
c=0
while a<len(sa) and b<len(sb) and c<len(sc):
if st=='a':
st=sa[a]
a+=1
elif st=='b':
st=sb[b]
b+=1
else:
st=sc[c]
c+=1
if a==len(sa):
print('A')
elif b==len(sb):
print('B')
else:
print('C') |
s718071245 | p03471 | u341855122 | 2,000 | 262,144 | Wrong Answer | 40 | 3,188 | 465 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N = list(map(int,input().split()))
sen=0
gosen=0
man = 0
man = N[0]
while(N[0]==man+gosen+sen and man > -1 and sen > -1 and gosen > -1):
while(N[0]==man+gosen+sen and man >-1 and sen > -1 and gosen > -1):
print(10000*man+5000*gosen+1000*sen)
if(N[1]==10000*man+5000*gosen+1000*sen):
p... | s389211544 | Accepted | 1,880 | 3,064 | 389 | N = list(map(int,input().split()))
sen=0
gosen=0
man = N[0]
while(N[0]+1>gosen):
sen = 0
while(N[0]+1>sen):
man = N[0] - sen - gosen
if(man < 0):
sen += 1
continue
if(N[1]==(10000*man+5000*gosen+1000*sen)):
print(str(man)+" "+str(gosen)+" "+str(sen))
... |
s098372129 | p03054 | u102126195 | 2,000 | 1,048,576 | Wrong Answer | 254 | 3,896 | 857 | 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... | h, w, n = map(int, input().split())
sr, sc = map(int, input().split())
S = input()
T = input()
win = 0
SR = sr
SC = sc
sr = SR
sc = SC
for i in range(n):
if S[i] == "L":
sc -= 1
if sc <= 0:
break
if T[i] == "R" and sc < w:
sc += 1
if sc <= 0:
win = 1
sr = SR
sc = SC
for i in r... | s210095864 | Accepted | 248 | 3,888 | 858 | h, w, n = map(int, input().split())
sr, sc = map(int, input().split())
S = input()
T = input()
win = 0
SR = sr
SC = sc
sr = SR
sc = SC
for i in range(n):
if S[i] == "L":
sc -= 1
if sc <= 0:
break
if T[i] == "R" and sc < w:
sc += 1
if sc <= 0:
win = 1
sr = SR
sc = SC
for i in r... |
s620045014 | p02602 | u019685451 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 34,056 | 323 | M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m... | def prod(X):
val = 1
for x in X:
val = val * x
return val
N, K = map(int, input().split())
A = list(map(int, input().split()))
G = [prod(A[:K])]
for i in range(K, N):
val = G[-1] // A[i - K] * A[i]
G.append(val)
print(G)
for i in range(1, len(G)):
print('Yes' if G[i] > G[i - 1] else 'N... | s111576023 | Accepted | 152 | 31,604 | 137 | N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(K, N):
print('Yes' if A[i] > A[i - K] else 'No') |
s681101729 | p04011 | u235376569 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 160 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | a=int(input())
b=int(input())
c=int(input())
d=int(input())
ans=0
for i in range(a):
if 0<a:
ans+=c
else:
ans+=d
print(d)
| s614230489 | Accepted | 19 | 2,940 | 172 | a=int(input())
b=int(input())
c=int(input())
d=int(input())
ans=0
for i in range(a):
if 0<b:
ans+=c
else:
ans+=d
b=b-1
print(ans)
|
s915249331 | p03457 | u348868667 | 2,000 | 262,144 | Wrong Answer | 446 | 27,380 | 450 | 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())
txy = []
for i in range(N):
txy.append(list(map(int,input().split())))
ans = "YES"
t = 0
x = 0
y = 0
for i in range(N):
deft = txy[i][0] - t
defx = abs(txy[i][1] - x)
defy = abs(txy[i][2] - y)
t = txy[i][0]
x = txy[i][1]
y = txy[i][2]
if (defx + defy) > deft:
ans... | s591169361 | Accepted | 447 | 27,380 | 423 | N = int(input())
txy = []
for i in range(N):
txy.append(list(map(int,input().split())))
ans = "Yes"
t = 0
x = 0
y = 0
for i in range(N):
deft = txy[i][0] - t
defx = abs(txy[i][1] - x)
defy = abs(txy[i][2] - y)
t = txy[i][0]
x = txy[i][1]
y = txy[i][2]
if (defx + defy) > deft:
ans... |
s091937166 | p02742 | u151079949 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 80 | 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... | H,W=map(int,input().split())
if H*W%2==0:
print(H*W/2)
else:
print(H*W/2+1)
| s025116049 | Accepted | 17 | 2,940 | 134 | H,W=map(int,input().split())
if H!=1 and W!=1:
if H*W%2==0:
print(int(H*W/2))
else:
print(int(H*W/2+0.5))
else:
print(1) |
s729344267 | p03827 | u980503157 | 2,000 | 262,144 | Wrong Answer | 25 | 9,172 | 173 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | firstline = int(input())
sec = input()
maxN = 0
init = 0
for i in sec:
if i == "I":
init -= 1
else:
init += 1
if init > maxN:
maxN = init
print(maxN) | s700011489 | Accepted | 26 | 9,172 | 173 | firstline = int(input())
sec = input()
maxN = 0
init = 0
for i in sec:
if i == "I":
init += 1
else:
init -= 1
if init > maxN:
maxN = init
print(maxN) |
s191912593 | p03814 | u246820565 | 2,000 | 262,144 | Wrong Answer | 18 | 3,560 | 61 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
a = s.index('A')
z = s.index('Z')
print(s[a:z+1]) | s068712067 | Accepted | 44 | 3,516 | 98 | s = input()
a = s.index('A')
for i in range(len(s)):
if s[i] == 'Z':
z = i+1
print(len(s[a:z])) |
s201927766 | p03386 | u803617136 | 2,000 | 262,144 | Wrong Answer | 2,103 | 26,704 | 188 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | a, b, k = map(int, input().split())
upper = min(a + k, b + 1)
bottom = min(max(b - k, upper), a + k, )
for i in range(a, upper):
print(i)
for j in range(bottom, b + 1):
print(j)
| s863193011 | Accepted | 17 | 3,060 | 174 | a, b, k = map(int, input().split())
upper = min(a + k, b)
bottom = max(b - k + 1, upper)
for i in range(a, upper):
print(i)
for j in range(bottom, b + 1):
print(j)
|
s058578418 | p03090 | u608088992 | 2,000 | 1,048,576 | Wrong Answer | 28 | 3,720 | 410 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | N = int(input())
S = 0
for i in range(2, N):
S += i
Ans = []
for i in range(2, N):
Ans.append((1, i))
Ans.append((N, i))
Total = [N+1] * N
Total[0], Total[N-1] = S, S
for i in range(1, N-1):
j = i+1
while Total[i] < S:
Ans.append((i+1, j+1))
Total[i] += j+1
Total[j] += ... | s218776046 | Accepted | 26 | 3,700 | 628 | import sys
def solve():
input = sys.stdin.readline
N = int(input())
Ans = []
AnsNum = 0
if N % 2 == 0:
for i in range(1, N):
for j in range(i + 1, N + 1):
if i + j != N + 1:
Ans.append((i, j))
AnsNum += 1
else:
... |
s964118737 | p02614 | u609561564 | 1,000 | 1,048,576 | Wrong Answer | 65 | 9,104 | 422 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | h, w, k = map(int, input().split())
c = []
ans = 0
c = [list(input()) for _ in range(h)]
print(c)
ans = 0
for i in range(2 ** h):
for j in range(2 ** w):
cnt = 0
for m in range(h):
for n in range(w):
if ((i >> m) & 1 == 0) and ((j >> n) & 1 == 0):
if ... | s132113735 | Accepted | 65 | 9,120 | 424 | h, w, k = map(int, input().split())
c = []
ans = 0
c = [list(input()) for _ in range(h)]
# print(c)
ans = 0
for i in range(2 ** h):
for j in range(2 ** w):
cnt = 0
for m in range(h):
for n in range(w):
if ((i >> m) & 1 == 0) and ((j >> n) & 1 == 0):
i... |
s881629399 | p03433 | u372345564 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 215 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | def main():
N = int(input() )
A = int(input() )
surplus = N % 500
print(surplus)
if(surplus <= A):
print("Yes")
else:
print("No")
if __name__=="__main__":
main() | s589209075 | Accepted | 17 | 2,940 | 216 | def main():
N = int(input() )
A = int(input() )
surplus = N % 500
if(surplus <= A):
print("Yes")
else:
print("No")
if __name__=="__main__":
main() |
s520036261 | p03854 | u558961961 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 582 | 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()
result = "NO"
while True:
if S[-5:-1] == "dream":
if len(S) == 5:
result = "YES"
break
S.rstrip("dream")
elif S[-5:-1] == "erase":
if len(S) == 5:
result = "YES"
break
S.rstrip("erase")
elif S[-6:-1] == "eraser":
... | s918451931 | Accepted | 67 | 3,188 | 543 | S = input()
result = "NO"
while True:
if S[-5:] == "dream":
if len(S) == 5:
result = "YES"
break
S = S[:-5]
elif S[-5:] == "erase":
if len(S) == 5:
result = "YES"
break
S = S[:-5]
elif S[-6:] == "eraser":
if len(S) == ... |
s227141789 | p03730 | u385167811 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 214 | 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... | temp = input().rstrip().split(" ")
A = int(temp[0])
B = int(temp[1])
C = int(temp[2])
if A == B and C > 0:
print("No")
elif A == 1:
print("Yes")
elif A + C == B:
print("Yes")
else:
print("No") | s533278918 | Accepted | 19 | 3,064 | 361 | temp = input().rstrip().split(" ")
A = int(temp[0])
B = int(temp[1])
C = int(temp[2])
flag = 0
if A == B and C > 0:
print("NO")
elif A == 1:
print("YES")
elif A + C == B:
print("YES")
else:
for i in range(1,10000):
if (A * i) % B == C:
print("YES")
flag = 1
br... |
s848367415 | p03361 | u136346222 | 2,000 | 262,144 | Wrong Answer | 161 | 12,508 | 1,001 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | # -*- coding: utf-8 -*-
from sys import stdin
import sys
import numpy as np
xy = stdin.readline().rstrip().split()
x = int(xy[0])
y = int(xy[1])
data = [stdin.readline().rstrip().split() for _ in range(x)]
print(*data, sep='\n')
print('----------------')
for i in range(x):
data[i] = list(data[i][0])
arr = np.... | s092085925 | Accepted | 398 | 20,772 | 1,003 | # -*- coding: utf-8 -*-
from sys import stdin
import sys
import numpy as np
xy = stdin.readline().rstrip().split()
x = int(xy[0])
y = int(xy[1])
data = [stdin.readline().rstrip().split() for _ in range(x)]
#print(*data, sep='\n')
#print('----------------')
for i in range(x):
data[i] = list(data[i][0])
arr = np.... |
s468790976 | p03574 | u002459665 | 2,000 | 262,144 | Wrong Answer | 29 | 3,064 | 935 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | def main():
h, w = map(int, input().split())
b = []
for _ in range(h):
b.append(input())
# b[1][1] -> b[0][0], b[0][1], b[0][2], b[1][0], b[1][2], b[2][0], b[2][1], b[2][2]
ans = []
for i in range(h):
e = []
for j in range(w):
e.append(0)
ans.append(... | s367922107 | Accepted | 31 | 3,444 | 1,009 | def main():
h, w = map(int, input().split())
b = []
for _ in range(h):
b.append(input())
# b[1][1] -> b[0][0], b[0][1], b[0][2], b[1][0], b[1][2], b[2][0], b[2][1], b[2][2]
ans = []
for i in range(h):
e = []
for j in range(w):
e.append(0)
ans.append(... |
s335748843 | p04030 | u303119576 | 2,000 | 262,144 | Wrong Answer | 25 | 8,940 | 1 | 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... | 0 | s490498701 | Accepted | 32 | 8,744 | 122 | s=input()
stk=[]
for c in s:
if c in '01':
stk.append(c)
elif stk:
stk.pop()
print(''.join(stk)) |
s608735469 | p03998 | u131881594 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 335 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | a,b,c=input(),input(),input()
string=[a,b,c]
s=[0,0,0]
ban=0
print(string)
while s[0]!=len(a) and s[1]!=len(b) and s[2]!=len(c):
temp=s[ban]
s[ban]+=1
if string[ban][temp]=="a": ban=0
elif string[ban][temp]=="b": ban=1
else: ban=2
if s[0]==len(a): print("A")
if s[1]==len(b): print("B")
if s[2]==len... | s182160235 | Accepted | 17 | 3,064 | 248 | a,b,c=input(),input(),input()
string=[a,b,c]
ans=["A","B","C"]
s=[0,0,0]
ban=0
while s[ban]!=len(string[ban]):
temp=s[ban]
s[ban]+=1
if string[ban][temp]=="a": ban=0
elif string[ban][temp]=="b": ban=1
else: ban=2
print(ans[ban]) |
s251970320 | p03563 | u331464808 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | 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 = int(input())
g = int(input())
print(float(2*g-r)) | s392594945 | Accepted | 17 | 2,940 | 46 | r = int(input())
g = int(input())
print(2*g-r) |
s614586112 | p03024 | u163320134 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 86 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | s=input()
cnt=s.count('o')
l=len(s)
if 15-l+cnt>=8:
print('Yes')
else:
print('No') | s783971964 | Accepted | 17 | 2,940 | 86 | s=input()
cnt=s.count('o')
l=len(s)
if 15-l+cnt>=8:
print('YES')
else:
print('NO') |
s973971336 | p03251 | u503228842 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 203 | 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 = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
max_X = max(X,max(x))
min_Y = min(Y,min(y))
if max_X<min_Y:
print("War")
else:print("No war")
| s212180956 | Accepted | 18 | 2,940 | 204 | N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
max_X = max(X,max(x))
min_Y = min(Y,min(y))
if max_X<min_Y:
print("No War")
else:print("War")
|
s320710067 | p03657 | u384579799 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 145 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | # -*- coding: utf-8 -*-
import sys
A, B = map(int, input().split())
C = A + B
if C%3 == 0:
print('possible')
else:
print('impossible') | s360140565 | Accepted | 17 | 2,940 | 219 | # -*- coding: utf-8 -*-
import sys
A, B = map(int, input().split())
C = A + B
if A%3 == 0:
print('Possible')
elif B%3 == 0:
print('Possible')
elif C%3 == 0:
print('Possible')
else:
print('Impossible') |
s548399403 | p03380 | u921773161 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 261 | 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. | a = list(map(int, input().split()))
x = max(a)
b1 = x//2
b2 = (x+1)//2
y = x
z = x
for i in range(len(a)):
if a[i] != x:
tmp = min(abs(a[i]-b1), abs(a[i]-b2))
if tmp < y:
z = a[i]
y = min(tmp, y)
ans = x*z
print(x, z) | s625928800 | Accepted | 131 | 14,052 | 294 | n = int(input())
a = list(map(int, input().split()))
x = max(a)
b1 = x//2
b2 = (x+1)//2
y = x
z = x
for i in range(len(a)):
if a[i] != x:
tmp = min(abs(a[i]-b1), abs(a[i]-b2))
if tmp < y:
z = a[i]
y = min(tmp, y)
ans = x*z
print(str(x) + ' '+ str(z)) |
s379622134 | p03637 | u617515020 | 2,000 | 262,144 | Wrong Answer | 76 | 14,252 | 225 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | N=int(input())
a=list(map(int,input().split()))
o = 0
f = 0
t = 0
for i in a:
if i % 2 == 1:
o += 1
if i % 4 == 0:
f += 1
if i % 4 == 2:
t += 1
if f >= o-1 and t % 2 == 0:
print('Yes')
else:
print('No') | s512793528 | Accepted | 73 | 15,020 | 247 | N=int(input())
a=list(map(int,input().split()))
o = 0
f = 0
t = 0
for i in a:
if i % 2 == 1:
o += 1
if i % 4 == 0:
f += 1
if i % 4 == 2:
t += 1
if f >o-1:
print('Yes')
elif f == o-1 and t==0:
print('Yes')
else:
print('No') |
s814245220 | p03167 | u216928054 | 2,000 | 1,048,576 | Wrong Answer | 375 | 49,648 | 2,580 | There is a grid 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. For each i and j (1 \leq i \leq H, 1 \leq j \leq W), Square (i, j) is described by a character a_{i, j}. If a_{i, j} is `.`, Square (i, j) is an empty square; if a... | #!/usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
def debug(*x):
print(*x)
def solve(H, W, data):
"void()"
score = [[... | s058671880 | Accepted | 392 | 50,092 | 2,771 | #!/usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1 # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7
def debug(*x):
print(*x)
def solve(H, W, data):
"void()"
score = [[... |
s948602375 | p03644 | u368270116 | 2,000 | 262,144 | Wrong Answer | 28 | 8,936 | 66 | 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())
for i in range (6):
if n<2**i:
print(i)
quit() | s108698497 | Accepted | 32 | 8,944 | 80 | n=int(input())
for i in reversed(range(7)):
if n>=2**i:
print(2**i)
quit()
|
s961054221 | p02601 | u760961723 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,304 | 237 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | A,B,C = map(int,input().split())
K = int(input())
import math
x = math.ceil(math.log2(A/B))
if x < 0:
x = 0
y = math.ceil(math.log2((B*(2**x))/C))
if y < 0:
y = 0
if 2*x + y <= K:
print("Yes")
else:
print("No")
| s747339391 | Accepted | 29 | 9,344 | 532 | A,B,C = map(int,input().split())
K = int(input())
import math
x,y = 0,0
if A > B:
if math.modf(math.log2(A/B))[0] != 0:
x = math.ceil(math.log2(A/B))
else:
x = math.ceil(math.log2(A/B))+1
elif A == B:
x = 1
else:
pass
if B*(2**x) > C:
if math.modf(math.log2((B*(2**x))/C))[0] != 0:... |
s923318805 | p03369 | u041641933 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 127 | 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()
price = 500
if s[0] == "o":
price += 100
if s[1] == "o":
price += 100
if s[2] == "o":
price += 100
print(price) | s957804575 | Accepted | 17 | 3,060 | 127 | s = input()
price = 700
if s[0] == "o":
price += 100
if s[1] == "o":
price += 100
if s[2] == "o":
price += 100
print(price) |
s228802016 | p03795 | u532099150 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | 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())
a = n%15
print(800*n - a) | s132523322 | Accepted | 17 | 2,940 | 51 | n = int(input())
a = n//15
print((800*n) - (a*200)) |
s520911228 | p03470 | u247043226 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 303 | 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... | def solve():
N = int(input())
d = [int(input()) for _ in range(N)]
d.sort()
number_of_steps = 0
previous_diameter = 0
for i in range(N):
if d[i] > previous_diameter:
number_of_steps += 1
previous_diameter = d[i]
print(number_of_steps)
# solve() | s797309646 | Accepted | 19 | 3,060 | 301 | def solve():
N = int(input())
d = [int(input()) for _ in range(N)]
d.sort()
number_of_steps = 0
previous_diameter = 0
for i in range(N):
if d[i] > previous_diameter:
number_of_steps += 1
previous_diameter = d[i]
print(number_of_steps)
solve() |
s275244223 | p03774 | u303059352 | 2,000 | 262,144 | Wrong Answer | 23 | 3,064 | 645 | There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distan... | while(True):
try:
n, m = map(int, input().split())
except EOFError:
exit()
a, b = [[0 for _ in range(n)] for i in range(2)]
c, d = [[0 for _ in range(m)] for i in range(2)]
for i in range(n):
a[i], b[i] = map(int, input().split())
for i in range(m):
c[i], d[i] = m... | s026138326 | Accepted | 19 | 3,060 | 347 | while(True):
try:
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
except EOFError:
exit()
for a, b in ab:
dist = [abs(a - c) + abs(b - d) for c, d in cd]
print(d... |
s335812839 | p03845 | u278260569 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 242 | 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 = list(map(int,input().split()))
M = int(input())
P_X = []
for i in range(M):
P_X.append(list(map(int,input().split())))
temp_sum = sum(T)
print(temp_sum)
for i in range(M):
print(temp_sum - T[P_X[i][0] - 1] + P_X[i][1]) | s851011499 | Accepted | 19 | 3,064 | 226 | N = int(input())
T = list(map(int,input().split()))
M = int(input())
P_X = []
for i in range(M):
P_X.append(list(map(int,input().split())))
temp_sum = sum(T)
for i in range(M):
print(temp_sum - T[P_X[i][0] - 1] + P_X[i][1]) |
s470909782 | p02608 | u040660107 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,184 | 545 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | import time
import itertools
N = int(input())
def function(x,y,z,n):
n_tmp = pow(x+y+z,2) - (x*y) - (y*z) -(x*z)
if n == n_tmp:
return True
else:
return False
max = pow(10,4)
count = 0
start = time.time()
p = list(itertools.product(range(1,15), repeat=3))
for n in range(1,N):
count... | s810182294 | Accepted | 1,307 | 118,524 | 379 | import time
import itertools
import collections
N = int(input())
start = time.time()
def function(x,y,z):
return pow(x,2) + pow(y,2) + pow(z,2) + (x * y) + (x * z ) + (y * z)
p = list(itertools.product(range(1,100),repeat=3))
a = []
for p_in in p:
a.append(function(p_in[0],p_in[1],p_in[2]))
dict = collectio... |
s940425482 | p03408 | u257449466 | 2,000 | 262,144 | Wrong Answer | 22 | 3,444 | 345 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | from collections import Counter
arr_b = []
N = int(input())
for i in range(N):
arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
arr_r.append(str(input()))
c_b = Counter(arr_b)
c_r = Counter(arr_r)
result = max(c_b[x] for x in c_b) - max(c_r[x] for x in c_r)
if result > 0:
print(re... | s991978593 | Accepted | 22 | 3,316 | 436 | from collections import Counter
arr_b = []
N = int(input())
for i in range(N):
arr_b.append(str(input()))
arr_r = []
N = int(input())
for i in range(N):
arr_r.append(str(input()))
c_b = Counter(arr_b)
c_r = Counter(arr_r)
res = 0
for k_b in c_b.keys():
if k_b in c_r :
if res < c_b[k_b] - c_r[k_b]... |
s587568448 | p00045 | u567380442 | 1,000 | 131,072 | Wrong Answer | 30 | 6,732 | 239 | 販売単価と販売数量を読み込んで、販売金額の総合計と販売数量の平均を出力するプログラムを作成してください。 | import sys
f = sys.stdin
sum_price = sum_amount = kind = 0
for line in f:
price, amount = map(int, line.split(','))
sum_price += price * amount
sum_amount += amount
kind += 1
print(sum_price, round(sum_amount / kind)) | s589771312 | Accepted | 30 | 6,748 | 250 | import sys
f = sys.stdin
sum_price = sum_amount = kind = 0
for line in f:
price, amount = map(int, line.split(','))
sum_price += price * amount
sum_amount += amount
kind += 1
print(sum_price)
print(int(sum_amount / kind + 0.5)) |
s299986799 | p03440 | u368796742 | 2,000 | 262,144 | Wrong Answer | 30 | 9,104 | 108 | You are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1. The edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge. Each vertex i has a value a_i. You want to add edges in the given forest so that the forest becomes connected. To add a... | n,m = map(int,input().split())
if n == 1:
print(0)
exit()
if m*2 < n:
print("Impossible")
exit() | s154437857 | Accepted | 426 | 24,444 | 1,241 | n,m = map(int,input().split())
if m == n-1:
print(0)
exit()
if 2*(n-m-1) > n:
print("Impossible")
exit()
class Unionfind:
def __init__(self,n):
self.uf = [-1]*n
def find(self,x):
if self.uf[x] < 0:
return x
else:
self.uf[x] = self.find(self.uf... |
s939795018 | p03214 | u503111914 | 2,525 | 1,048,576 | Wrong Answer | 28 | 9,072 | 155 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | N = int(input())
A = list(map(int,input().split()))
ave = sum(A) / N
ans = 0
a = 10**10
for i in range(N):
if abs(A[i] - ave) < a:
ans = i
print(ans) | s087964155 | Accepted | 28 | 9,072 | 180 | N = int(input())
A = list(map(int,input().split()))
ave = sum(A) / N
ans = 0
a = 10**10
for i in range(N):
if abs(A[i] - ave) < a:
a = abs(A[i] - ave)
ans = i
print(ans)
|
s811425360 | p03352 | u322185540 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,104 | 2,940 | 141 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | n = int(input())
ans = 0
for i in range(1,1001):
for j in range(1,1001):
if ans < i**j < n:
ans = i**j
print(ans) | s601130783 | Accepted | 18 | 2,940 | 181 | n = int(input())
ans = 1
for i in range(1,1001):
for j in range(2,1001):
if i**j > n:
break
if ans < i**j <= n:
ans = i**j
print(ans) |
s606865078 | p02972 | u237362582 | 2,000 | 1,048,576 | Wrong Answer | 482 | 8,272 | 606 | 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
input = sys.stdin.readline
def main():
N = int(input())
a = list(map(int, input().strip().split()))
ans = [0] * N
for i, a_r in enumerate(a[::-1]):
j = N - i - 1
count = 0
now = j+1
while now <= N:
count += ans[j-1]
now += j+1
... | s142234299 | Accepted | 546 | 10,036 | 712 | import sys
input = sys.stdin.readline
def main():
N = int(input())
a = list(map(int, input().strip().split()))
ans = [0] * N
for i, a_r in enumerate(a[::-1]):
j = N - i - 1
count = 0
now = j+1
while now <= N:
count += ans[now-1]
now += j+1
... |
s009633858 | p02410 | u606989659 | 1,000 | 131,072 | Wrong Answer | 30 | 7,684 | 370 | Write a program which reads a $ n \times m$ matrix $A$ and a $m \times 1$ vector $b$, and prints their product $Ab$. A column vector with m elements is represented by the following equation. \\[ b = \left( \begin{array}{c} b_1 \\\ b_2 \\\ : \\\ b_m \\\ \end{array} \right) \\] A $n \times m$ matrix with $m$ column ve... | n,m = map(int,input().split())
a_list = []
b_list = []
c_list = []
for a in range(n):
a_list.append(list(map(int,input().split())))
for b in range(n):
b_list.append(int(input()))
for c in range(n):
c_list.append([])
for d in range(m):
c_list[c].append((a_list[c][d] * b_list[c]))
c_list = li... | s707862866 | Accepted | 30 | 8,384 | 370 | n,m = map(int,input().split())
a_list = []
b_list = []
c_list = []
for a in range(n):
a_list.append(list(map(int,input().split())))
for b in range(m):
b_list.append(int(input()))
for c in range(n):
c_list.append([])
for d in range(m):
c_list[c].append((a_list[c][d] * b_list[d]))
c_list = li... |
s195326842 | p03795 | u163320134 | 2,000 | 262,144 | Wrong Answer | 27 | 2,940 | 42 | 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(800*n-int(60/15)*200) | s252104483 | Accepted | 17 | 2,940 | 41 | n=int(input())
print(800*n-int(n/15)*200) |
s360525758 | p03623 | u972892985 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x, a, b = map(int,input().split())
print(min(abs(x - a), abs(x - b))) | s441895897 | Accepted | 17 | 2,940 | 98 | x, a, b = map(int,input().split())
if abs(x - a) > abs(x - b):
print("B")
else:
print("A") |
s173779012 | p03494 | u325119213 | 2,000 | 262,144 | Time Limit Exceeded | 2,205 | 9,172 | 302 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | def actual(N, A):
count = 0
while True:
is_all_even = all([a % 2 == 0 for a in A])
if is_all_even:
A = [a // 2 for a in A]
count += 1
else:
break
return count
N = int(input())
A = map(int, input().split())
print(actual(N, A)) | s232604317 | Accepted | 31 | 9,164 | 297 | def actual(N, A):
count = 0
while True:
is_all_even = all([a % 2 == 0 for a in A])
if is_all_even:
A = [a // 2 for a in A]
count += 1
else:
return count
N = int(input())
A = list(map(int, input().split()))
print(actual(N, A))
|
s815801105 | p04043 | u118642796 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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 ... | if sorted(list(map(int,input().split()))) == [5,5,7]:
print("Yes")
else:
print("No") | s587401032 | Accepted | 17 | 2,940 | 100 | if sorted(list(map(int,input().split()))) == [5,5,7]:
print("YES")
else:
print("NO") |
s366241887 | p03469 | u482157295 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 37 | 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 = list(input())
s[3] = "8"
print(s) | s772000055 | Accepted | 17 | 2,940 | 47 | s = list(input())
s[3] = "8"
print("".join(s))
|
s550447847 | p03351 | u059684735 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 112 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a, b, c, d = map(int, input().split())
print('Yes' if (d > abs(a-b) and d > abs(b-c)) or d > abs(a-c) else 'No') | s316779234 | Accepted | 18 | 2,940 | 115 | a, b, c, d = map(int, input().split())
print('Yes' if (d >= abs(a-b) and d >= abs(b-c)) or d >= abs(a-c) else 'No') |
s437394693 | p02397 | u629874472 | 1,000 | 131,072 | Wrong Answer | 40 | 5,568 | 126 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
a,b = input().split()
if a =='0' and b =='0':
break
else:
a,b =b,a
print(b,a)
| s588643243 | Accepted | 50 | 5,612 | 193 | while True:
a,b = map(int,input().split())
if a ==0 and b ==0:
break
else:
if a<=b:
print(a,b)
else:
a,b =b,a
print(a,b)
|
s454832706 | p03945 | u556610039 | 2,000 | 262,144 | Wrong Answer | 46 | 3,956 | 172 | Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones... | s = list(input())
ans = 0
prestr = s[0]
for id in range(len(s) - 1):
if prestr == s[id - 1]: continue
else:
ans += 1
prestr = s[id - 1]
print(ans)
| s612600442 | Accepted | 49 | 3,956 | 172 | s = list(input())
ans = 0
prestr = s[0]
for id in range(len(s) - 1):
if prestr == s[id + 1]: continue
else:
ans += 1
prestr = s[id + 1]
print(ans)
|
s047666583 | p02646 | u954153335 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,180 | 203 | 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 ... | import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
dist=b-a
speed=v-w
if speed<=0:
print("No")
sys.exit()
if dist/speed<=t:
print("Yes")
else:
print("No") | s652682478 | Accepted | 22 | 9,184 | 208 | import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
dist=abs(b-a)
speed=v-w
if speed<=0:
print("NO")
sys.exit()
if dist/speed<=t:
print("YES")
else:
print("NO") |
s231589844 | p03488 | u784022244 | 2,000 | 524,288 | Wrong Answer | 1,270 | 4,584 | 879 | A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction. This robot will be given an instruction sequence s. s consists of the following two kinds of letters, and will be executed in order from front to back. * `F` : Move in the current direction by d... | S=input()
x,y=map(int, input().split())
N=len(S)
now=0
xs=[]
ys=[]
count=0
for i in range(N):
if S[i]=="F":
now+=1
else:
if count%2==0:
xs.append(now)
else:
ys.append(now)
count+=1
now=0
if S[i]=="F" and i==N-1:
if count%2==0:
... | s153287062 | Accepted | 1,276 | 4,576 | 880 | S=input()
x,y=map(int, input().split())
N=len(S)
now=0
xs=[]
ys=[]
count=0
for i in range(N):
if S[i]=="F":
now+=1
else:
if count%2==0:
xs.append(now)
else:
ys.append(now)
count+=1
now=0
if S[i]=="F" and i==N-1:
if count%2==0:
... |
s684989815 | p04012 | u075595666 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 169 | 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. | w = list(input())
for i in range(ord('a'),ord('z')):
if int(w.count("chr(i)"))%2 == 1:
print("No")
break
if int(w.count("chr(i)"))%2 == 0:
continue
print("Yes") | s240426484 | Accepted | 17 | 2,940 | 140 | w = list(input())
ans = "Yes"
for i in w:
if int(w.count(i))%2 == 1:
ans = 'No'
break
if int(w.count(i))%2 == 0:
continue
print(ans) |
s146678668 | p02237 | u733945366 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 241 | There are two standard ways to represent a graph $G = (V, E)$, where $V$ is a set of vertices and $E$ is a set of edges; Adjacency list representation and Adjacency matrix representation. An adjacency-list representation consists of an array $Adj[|V|]$ of $|V|$ lists, one for each vertex in $V$. For each $u \in V$, th... | n=int(input());
G=[[0 for i in range(n)]for j in range(n)]
#print(G)
for i in range(n):
list=[int(m) for m in input().split()]
u=list[0]
k=list[1]
for j in range(2,len(list)):
v=list[j]
G[u-1][v-1]=1
print(G)
| s320210913 | Accepted | 20 | 6,392 | 369 | n=int(input());
G=[[0 for i in range(n)]for j in range(n)]
for i in range(n):
list=[int(m) for m in input().split()]
u=list[0]
k=list[1]
for j in range(2,len(list)):
v=list[j]
G[u-1][v-1]=1
for i in range(n):
for j in range(n):
if j!=n-1:
print(G[i][j],end=" ")
... |
s608903762 | p03545 | u021763820 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 395 | 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... | # -*- coding: utf-8 -*-
n = input()
m = len(n)-1
for i in range(2 ** m):
ops = []
N = [int(n[0]), int(n[1]), int(n[2]), int(n[3])]
for j in range(m):
if (i >> j) & 1:
ops.append("+")
else:
N[j + 1] *= -1
ops.append("-")
if sum(N) == 7:
print(N)... | s279627840 | Accepted | 18 | 3,060 | 341 | # -*- coding: utf-8 -*-
s = input()
l = [int(i) for i in s]
for i in range(2**3):
ans = l[0]
siki = s[0]
for j in range(3):
if i>>j & 1:
ans += l[j+1]
siki += "+"+s[j+1]
else:
ans -= l[j+1]
siki += "-"+s[j+1]
if ans == 7:
print(siki... |
s312291709 | p02390 | u804558166 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 80 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | x=int(input())
print(x/3600, ':', (x-x/3600)/60, ':', x-(x-x/3600)/60, sep='')
| s092538283 | Accepted | 20 | 5,588 | 93 | x=int(input())
a=x//3600
b=(x-a*3600)//60
c=x-(a*3600+b*60)
print(a, ':', b, ':', c, sep='')
|
s446388522 | p03386 | u404057606 | 2,000 | 262,144 | Wrong Answer | 51 | 3,060 | 233 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | a,b,k = map(int,input().split())
l=[]
for i in range(k+1):
if a+i not in l and a+i<=b:
l.append(a+i)
for i in range(k+1):
if b-k+i not in l and b-k+i>=a:
l.append(b-k+i)
for i in range(len(l)):
print(l[i]) | s992360046 | Accepted | 20 | 3,316 | 247 | a,b,k = map(int,input().split())
l=[]
for i in range(k):
if a+i not in l and a+i<=b:
l.append(a+i)
for i in range(k):
if b-k+1+i not in l and b-k+1+i>=a:
l.append(b-k+1+i)
m=sorted(l)
for i in range(len(m)):
print(m[i]) |
s589112229 | p02646 | u560222605 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,176 | 137 | 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 ... |
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
x=a+v*t
y=b+w*t
if x>=y:
print('Yes')
else:
print('No') | s998968580 | Accepted | 22 | 9,136 | 263 |
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a>b:
x=a-v*t
y=b-w*t
if x<=y:
print('YES')
else:
print('NO')
else:
x=a+v*t
y=b+w*t
if x>=y:
print('YES')
else:
print('NO') |
s666589666 | p03557 | u160414758 | 2,000 | 262,144 | Wrong Answer | 2,105 | 23,104 | 597 | 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 ... | import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
N = I()
A,B,C = sorted(Is()),sorted(Is()),sorted(Is())
Bs = [0]*N
for i in range(N):
b... | s227832624 | Accepted | 413 | 23,212 | 762 | import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
N = I()
A,B,C = sorted(Is()),sorted(Is()),sorted(Is())
Bs = [0]*N
b,j = 0,0
for i in range... |
s400857955 | p03416 | u044964932 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 241 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | def main():
a, b = map(int, input().split())
print(b-a)
ans = (b-a)//100
if int(str(a)[-2:]) <= int(str(a)[:1]) and int(str(b)[-2:]) <= int(str(b)[1:]):
ans += 1
print(ans)
if __name__ == "__main__":
main()
| s820243464 | Accepted | 55 | 2,940 | 202 | def main():
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
if str(i) == str(i)[::-1]:
ans += 1
print(ans)
if __name__ == "__main__":
main()
|
s098643860 | p03695 | u853900545 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 506 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | n = int(input())
a = list(map(int,input().split()))
for i in range(n):
if a[i] < 400:
a[i] = 0
elif a[i] < 800:
a[i] = 1
elif a[i] < 1200:
a[i] = 2
elif a[i] < 1600:
a[i] = 3
elif a[i] < 2000:
a[i] = 4
elif a[i] < 2400:
a[i] = 5
elif a[i] < 28... | s145708012 | Accepted | 17 | 3,064 | 526 | n = int(input())
a = list(map(int,input().split()))
for i in range(n):
if a[i] < 400:
a[i] = 0
elif a[i] < 800:
a[i] = 1
elif a[i] < 1200:
a[i] = 2
elif a[i] < 1600:
a[i] = 3
elif a[i] < 2000:
a[i] = 4
elif a[i] < 2400:
a[i] = 5
elif a[i] < 28... |
s501222705 | p03486 | u076764813 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 131 | 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=input()
t=input()
s_=sorted(s)
t_=sorted(t, reverse=True)
print(s_)
print(t_)
if s_ < t_:
print("Yes")
else:
print("No") | s063887114 | Accepted | 18 | 2,940 | 112 | s=input()
t=input()
s_=sorted(s)
t_=sorted(t, reverse=True)
if s_ < t_:
print("Yes")
else:
print("No") |
s241693776 | p03854 | u101490607 | 2,000 | 262,144 | Wrong Answer | 39 | 4,208 | 777 | 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`. | st = input()
sample = ['dream', 'dreamer', 'erase', 'eraser']
sample_edit = ['dream', 'eraser','erase', 'dreamer']
sample_er = ['er']
sample_dr = ['dream']
sample_ase = ['ase', 'aser']
ret = 'No'
reg_len = 0
fd_word = ''
er_flg = False
while( len(st) != 0 ):
if reg_len == len(st):
break
er_flg = False
reg_... | s285742056 | Accepted | 113 | 3,188 | 947 | st = input()
sample = ['dream', 'dreamer', 'erase', 'eraser']
sample_edit = ['dream', 'eraser','erase', 'er']
sample_er = ['er']
sample_dr = ['dream']
sample_ase = ['ase', 'aser']
ret = 'NO'
reg_len = 0
fd_word = ''
dream_flg = False
end_flg = False
word = ''
length = len(sample_edit)
#while( len(st) != 0 ):
while(... |
s527906073 | p03563 | u634079249 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 257 | 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... | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
R = float(sys.stdin.readline().rstrip())
G = float(sys.stdin.readline().rstrip())
print(R+(G-R)*2)
if __name__ == '__main__':
main()
| s703202622 | Accepted | 17 | 2,940 | 250 | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
R = int(sys.stdin.readline().rstrip())
G = int(sys.stdin.readline().rstrip())
print(2*G-R)
if __name__ == '__main__':
main()
|
s391785066 | p03852 | u544050502 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 80 | 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`. | c=input()
print("vowel" if ["a","e","i","u","o",c].index(c)==5 else "consonant") | s965344969 | Accepted | 17 | 2,940 | 53 | print("vowel" if input() in "aiueo" else "consonant") |
s715532452 | p02402 | u829107115 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 160 | 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())
l = input().split()
mini = min(l)
maxi = max(l)
sums = 0
for i in range(0,n):
sums = sums + int(l[i])
print(f"{mini} {maxi} {sums}")
| s300346472 | Accepted | 20 | 6,608 | 176 | n = int(input())
l = list(map(int,input().split()))
mini = min(l)
maxi = max(l)
sums = 0
for i in range(0,n):
sums = sums + int(l[i])
print(f"{mini} {maxi} {sums}")
|
s133796230 | p03473 | u609255576 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 25 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | print(int(input()) + 24)
| s851463917 | Accepted | 17 | 2,940 | 30 | print(24 - int(input()) + 24)
|
s096851101 | p02408 | u085472528 | 1,000 | 131,072 | Wrong Answer | 20 | 7,384 | 131 | 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. | data = ["{0} {1}" .format(s, r)
for s in ('S','H','C','D')
for r in range(1, 13 + 1)
]
print(data) | s126970021 | Accepted | 20 | 7,716 | 218 | data = [
"{0} {1}" .format(s, r)
for s in ('S','H','C','D')
for r in range(1, 13 + 1)
]
count = int(input())
for c in range(count):
card = input()
data.remove(card)
for c in data:
print(c) |
s646227710 | p02402 | u192145025 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 225 | 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())
s = input().split()
max = s[0]
min = s[0]
for i in range(n):
if max < s[i]:
max = s[i]
if min > s[i]:
min = s[i]
sum = min + max
print(min, end =" ")
print(max, end =" ")
print(sum)
| s619266272 | Accepted | 20 | 6,600 | 266 | n = int(input())
s = list(map(int, input().strip().split(' ')))
max = s[0]
min = s[0]
sum = 0
for i in range(n):
sum = sum + s[i]
if max < s[i]:
max = s[i]
if min > s[i]:
min = s[i]
print(min, end =" ")
print(max, end =" ")
print(sum)
|
s754530761 | p00452 | u797673668 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 23,204 | 719 | あなたは以下のルールでダーツゲームをすることになった. あなたは,矢を的(まと)に向かって 4 本まで投げることができる.必ずしも 4 本全てを投げる必要はなく,1 本も投げなくてもかまわない.的は N 個の部分に区切られていて,各々の部分に点数 P1,..., PN が書か れている.矢が刺さった場所の点数の合計 S があなたの得点の基礎となる.S があらかじめ決められたある点数 M 以下の場合は S がそのままあなたの得点となる.しかし,S が M を超えた場合はあなたの得点は 0 点となる. 的に書かれている点数と M の値が与えられたとき,あなたが得ることのできる点数の最大値を求めるプログラムを作成せよ. | while True:
n, m = map(int, input().split())
if not n:
break
ps = {int(input()) for _ in range(n)}
ss = [False] * (m + 1)
min_p, max_p = 1e8, 0
for p in ps:
ss[p] = True
if min_p > p: min_p = p
if max_p < p: max_p = p
max_s = 0
for t in range(1, 4):
... | s484812936 | Accepted | 4,750 | 56,332 | 405 | from bisect import bisect_right
while True:
n, m = map(int, input().split())
if not n:
break
ps = [0] + sorted(int(input()) for _ in range(n))
p2 = set()
for i, pi in enumerate(ps):
for pj in ps[i:]:
if pi + pj > m:
break
p2.add(pi + pj)
... |
s491479728 | p00208 | u755162050 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 7,688 | 290 | ウォーターデブンに住む建築家のデブンキーさんのもとに、古い大病院を改装する仕事の依頼が舞い込んできました。 国によっては忌み数(いみかず)として嫌われる数字を部屋番号に用いたくない人がいます(日本では 4 と 9 が有名です)。しかし、この病院の部屋番号は忌み数に関係なく、1 から順番に付けられていました。 それが気になったデブンキーさんは、機材やベッドの入れ替えが全て終わる前にウォーターデブンの忌み数である「4」と「6」を除いた数字で部屋番号を付けなおしてしまいました。しかし、入れ替え作業は旧部屋番号で計画していたので、残りの作業を確実に行うには旧部屋番号を新部屋番号に変換する必要があります。計算が苦手なデブンキーさんはこのこ... | while True:
num = int(input())
index = 1
for n in range(1, num):
index += 1
while True:
str_index = str(index)
if '4' in str_index or '6' in str_index:
index += 1
else:
break
print(index) | s447663136 | Accepted | 250 | 7,580 | 283 | """ Created by Jieyi on 9/20/16. """
def main():
while True:
num = int(input())
if num == 0:
break
num = str(oct(num)[2:])
ans = num.translate(str.maketrans('4567', '5789'))
print(ans)
if __name__ == '__main__':
main() |
s968530070 | p03827 | u693048766 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 153 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | state = [0]
for c in list(input()):
if c == "D":
a = state[-1]
a -= 1
else:
a = state[-1]
a += 1
state.append(a)
print(max(state))
| s391676844 | Accepted | 21 | 3,316 | 188 | state = [0]
n = int(input())
chars = list(input())
for c in chars:
if c == "D":
a = state[-1]
a -= 1
else:
a = state[-1]
a += 1
state.append(a)
print(max(state))
|
s263730943 | p03679 | u637175065 | 2,000 | 262,144 | Wrong Answer | 41 | 5,456 | 675 | 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... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... | s651910134 | Accepted | 68 | 7,360 | 675 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x... |
s552746005 | p02255 | u520845247 | 1,000 | 131,072 | Wrong Answer | 20 | 7,608 | 249 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | input()
xs = list(map(int, input().split()))
def insertion_sort(xs):
for i in range(1, len(xs)):
v = xs[i]
j = i - 1
while j >= 0 and xs[j] > v:
xs[j + 1] = xs[j]
j -= 1
xs[j + 1] = v
print(*xs)
insertion_sort(xs) | s033328658 | Accepted | 20 | 8,112 | 260 | input()
xs = list(map(int, input().split()))
def insertion_sort(xs):
for i in range(1, len(xs)):
v = xs[i]
j = i - 1
while j >= 0 and xs[j] > v:
xs[j + 1] = xs[j]
j -= 1
xs[j + 1] = v
print(*xs)
print(*xs)
insertion_sort(xs) |
s745113931 | p03473 | u667024514 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 31 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | a = int(input())
print(a + 24) | s768702164 | Accepted | 21 | 3,316 | 34 | a = int(input())
print((24-a)+24) |
s131406511 | p02605 | u667024514 | 3,000 | 1,048,576 | Wrong Answer | 2,132 | 111,268 | 1,727 | M-kun is a brilliant air traffic controller. On the display of his radar, there are N airplanes numbered 1, 2, ..., N, all flying at the same altitude. Each of the airplanes flies at a constant speed of 0.1 per second in a constant direction. The current coordinates of the airplane numbered i are (X_i, Y_i), and the... | n = int(input())
ans = 10 ** 9
upanddown = [[] for i in range(200001)]
leftandright = [[] for i in range(200001)]
lis = []
for i in range(n):
x,y,r = map(str,input().split())
x,y = int(x),int(y)
lis.append([x+y,x-y,x,y,r])
if r == "U":
upanddown[x].append([y,0])
elif r == "D":
upandd... | s953170968 | Accepted | 1,980 | 111,036 | 1,736 | n = int(input())
ans = 10 ** 10
upanddown = [[] for i in range(200001)]
leftandright = [[] for i in range(200001)]
lis = []
for i in range(n):
x,y,r = map(str,input().split())
x,y = int(x),int(y)
lis.append([x+y,x-y,x,y,r])
if r == "U":
upanddown[x].append([y,0])
elif r == "D":
upand... |
s230609501 | p03434 | u919633157 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 134 | 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())
s=list(map(int,input().split()))
s.sort()
a=[int(i) for i in s[::-2]]
b=[int(j) for j in s[1::-2]]
print(sum(a)-sum(b)) | s942540935 | Accepted | 17 | 2,940 | 93 | n=int(input())
a=sorted(list(map(int,input().split())))
print(sum(a[-1::-2])-sum(a[-2::-2]))
|
s507099804 | p00725 | u420446254 | 1,000 | 131,072 | Wrong Answer | 20 | 5,520 | 186 | On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is marked. They use only a single stone. The purpose of the game is to lead the stone from the start to the goal with the minim... | while():
w, h = map(int, input().split())
if w == 0 or h == 0:
break
field = []
for y in range(h):
field.append(map(int, input().split()))
print(-1)
| s282896739 | Accepted | 4,470 | 5,624 | 2,074 | dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
N_MOVE = 4
EMPTY = 0
ROCK = 1
START = 2
GOAL = 3
INF = 100000
def in_field(field, x, y):
return y >=0 and y < len(field) and x >= 0 and x< len(field[0])
def move_to_rock(field, x, y, direction):
while(True):
x += dx[direction]
y += dy[direction]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.