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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s514553779 | p03546 | u513434790 | 2,000 | 262,144 | Wrong Answer | 344 | 19,428 | 348 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | from scipy.sparse.csgraph import floyd_warshall
H, W = map(int, input().split())
c = []
for i in range(10):
c1 = list(map(int, input().split()))
c.append(c1)
d = floyd_warshall(c)
ans = 0
for i in range(H):
a = list(map(int, input().split()))
for j in a:
if j != -1 and j != 1:
... | s230988591 | Accepted | 274 | 17,700 | 353 | from scipy.sparse.csgraph import floyd_warshall
H, W = map(int, input().split())
c = []
for i in range(10):
c1 = list(map(int, input().split()))
c.append(c1)
d = floyd_warshall(c)
ans = 0
for i in range(H):
a = list(map(int, input().split()))
for j in a:
if j != -1 and j != 1:
... |
s844857282 | p03006 | u427344224 | 2,000 | 1,048,576 | Wrong Answer | 1,322 | 3,316 | 575 | There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i). We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation: * Choose a ball remaining in the plane and collect it. Let (a, b) be the coordinat... | N = int(input())
items = []
for i in range(N):
items.append(tuple(map(int, input().split())))
ans = 0
res = []
for i in range(N):
for j in range(N):
if i == j:
continue
x1, y1 = items[i]
x2, y2 = items[j]
res.append((abs(x1-x2), abs(y1 -y2)))
for i in range(len(res... | s189502804 | Accepted | 1,526 | 3,444 | 623 | N = int(input())
items = []
for i in range(N):
items.append(tuple(map(int, input().split())))
res = []
for i in range(N):
for j in range(N):
if i == j:
continue
x1, y1 = items[i]
x2, y2 = items[j]
res.append((x1-x2, y1 -y2))
ans = 0
tar = list(set(res))
for t in ta... |
s631509495 | p03795 | u117193815 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n=int(input())
print((n*800)-(int(n*800)/15)*200) | s933006932 | Accepted | 17 | 2,940 | 41 | n=int(input())
print((n*800)-(n//15)*200) |
s303802197 | p02388 | u043968625 | 1,000 | 131,072 | Wrong Answer | 50 | 7,516 | 40 | Write a program which calculates the cube of a given integer x. | cube=int(input())
num=cube^3
print(num) | s241000582 | Accepted | 50 | 7,604 | 31 | x=int(input())
#x=2
print(x**3) |
s154107211 | p03386 | u657913472 | 2,000 | 262,144 | Wrong Answer | 2,104 | 26,704 | 104 | 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())
c=min(a+k,b);
for i in range(a,c):print(i)
for i in range(c,b+1):print(i) | s573837591 | Accepted | 17 | 3,060 | 115 | a,b,k=map(int,input().split())
c=min(a+k,b);
for i in range(a,c):print(i)
for i in range(max(c,b-k+1),b+1):print(i) |
s003930001 | p03386 | u460009487 | 2,000 | 262,144 | Wrong Answer | 27 | 9,188 | 278 | 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())
min = [0] * k
max = [0] * k
for i in range(k):
if a+i > b:
break
min[i] = a+i
for n in range(k):
if b-n < a:
break
max[n] = b-n
ans = min + max
ans.sort()
ans = set(ans)
for j in ans:
if j == 0:
continue
print(j) | s585096024 | Accepted | 29 | 9,208 | 293 | a, b, k = map(int, input().split())
min = [0] * k
max = [0] * k
for i in range(k):
if a+i > b:
break
min[i] = a+i
for n in range(k):
if b-n < a:
break
max[n] = b-n
ans = min + max
ans = set(ans)
ans = list(ans)
ans.sort()
for j in ans:
if j == 0:
continue
print(j) |
s496639746 | p03998 | u483151310 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 320 | 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. * ... | players = {}
players["a"] = input()
players["b"] = input()
players["c"] = input()
now_play = "a"
while True:
if len(players[now_play]) == 0:
print("{} is win.".format(now_play))
break
trushed_card = players[now_play][0]
players[now_play] = players[now_play][1:]
now_play = trushed_card | s846578496 | Accepted | 17 | 3,060 | 307 | players = {}
players["A"] = input()
players["B"] = input()
players["C"] = input()
now_play = "A"
while True:
if len(players[now_play]) == 0:
print(now_play)
break
trushed_card = players[now_play][0].upper()
players[now_play] = players[now_play][1:]
now_play = trushed_card |
s032207457 | p03721 | u083960235 | 2,000 | 262,144 | Wrong Answer | 2,120 | 258,892 | 1,508 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | s788562014 | Accepted | 327 | 5,736 | 267 | #14:59
N, K = map(int, input().split())
l = [0] * (10 ** 5 + 1)
for i in range(N):
a, b = map(int, input().split())
l[a] += b
cnt = 0
for i in range(1, 10 ** 5 + 1):
cnt += l[i]
if cnt >= K:
print(i)
break |
s721475207 | p03545 | u790012205 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 361 | 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... | S = input()
def func(i, x, op):
if i == 4:
if x == 7:
return op
else:
return ''
opP = func(i + 1, x + int(S[i]), op+'+'+str(S[i]))
if opP != '':
return opP
opM = func(i + 1, x - int(S[i]), op+'-'+str(S[i]))
if opM != '':
return opM
return ... | s662639377 | Accepted | 32 | 9,112 | 271 | import sys
N = list(input())
for bit in range(2 ** 3):
op = ['-'] * 3
for i in range(3):
if (bit & (1 << i)):
op[i] = '+'
E = N[0] + op[0] + N[1] + op[1] + N[2] + op[2] + N[3]
if eval(E) == 7:
print(E + '=7')
sys.exit() |
s822466680 | p02272 | u464859367 | 1,000 | 131,072 | Wrong Answer | 20 | 5,616 | 899 | Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function. Merge(A, left, mid, right) n1 = mid - left; n2 = right - mid; create array L[0...n1], R[0...n2] for i = 0 to n1-1 do L[i] = A[left + i] ... | N = int(input())
*A, = list(map(int, input().split()))
count = 0
def merge(a, left, mid, right):
global count
n1 = mid - left
n2 = right - mid
la, ra = [], []
for i in range(0, n1):
la += [a[left + i]]
for i in range(0, n2):
ra += [a[mid + i]]
la += [float("inf")]
ra +=... | s054147900 | Accepted | 4,390 | 61,652 | 635 | N = int(input())
*A, = list(map(int, input().split()))
count = 0
def merge(a, left, mid, right):
global count
la = a[left:mid] + [float("inf")]
ra = a[mid:right] + [float("inf")]
i, j = 0, 0
for k in range(left, right):
count += 1
if la[i] <= ra[j]:
a[k] = la[i]
... |
s047123037 | p02606 | u432853936 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,016 | 118 | How many multiples of d are there among the integers between L and R (inclusive)? | l,r,d = map(int,input().split())
if l % d == 0:
print(((r - l) // d) + 1)
else:
print((r - l) // d)
| s000526697 | Accepted | 27 | 9,152 | 126 | l,r,d = map(int,input().split())
ans = 0
for i in range(l,r+1):
if i % d == 0:
ans += 1
print(ans)
|
s098513946 | p03486 | u273010357 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 145 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s = list(input())
t = list(input())
s.sort(), t.sort(reverse=True)
s, t = ''.join(s), ''.join(t)
if s<t:
print('YES')
else:
print('NO')
| s112628408 | Accepted | 17 | 2,940 | 120 | s = ''.join(sorted(list(input())))
t = ''.join(sorted(list(input()), reverse=True))
print('Yes') if s<t else print('No') |
s018806349 | p03545 | u278670845 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 354 | 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 sys
a,b,c,d = map(int, list(input()))
x = [1,-1]
for i in x:
for j in x:
for k in x:
if a+i*b+j*c+k*d==7:
ans = str(a)
ans += "+" if i==1 else"-"
ans += str(b)
ans += "+" if j==1 else"-"
ans += str(c)
ans += "+" if k==1 else"-"
ans += str(d)
... | s332473965 | Accepted | 17 | 3,064 | 377 | import sys
a,b,c,d = map(int, list(input()))
x = [1,-1]
for i in x:
for j in x:
for k in x:
if a+i*b+j*c+k*d==7:
ans = str(a)
ans += "+" if i==1 else "-"
ans += str(b)
ans += "+" if j==1 else "-"
ans += str(c)
ans += "+" if k==1 else "-"
ans += str(d)
... |
s238288844 | p03671 | u973108807 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | 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... | array = sorted(input().split())
print(array[0]+array[1]) | s188531685 | Accepted | 18 | 2,940 | 72 | array = sorted(list(map(int, input().split())))
print(array[0]+array[1]) |
s734192383 | p03719 | u312821683 | 2,000 | 262,144 | Wrong Answer | 28 | 8,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 = input().split()
if C >= A and C <= B:
print('YES')
else:
print('NO') | s583609420 | Accepted | 26 | 9,048 | 95 | A,B,C = map(int, input().split())
if C >= A and C <= B:
print('Yes')
else:
print('No') |
s477577004 | p03478 | u192588826 | 2,000 | 262,144 | Wrong Answer | 27 | 3,060 | 288 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n,a,b = map(int,input().split())
count = 0
for i in range(n):
if (i+1) == 10000 and a == 1:
count += 1
break
judge = (i+1)%10 + ((i+1)%100 - (i+1)%10)//10 + ((i+1)%1000 - (i+1)%100 - (i+1)%10)//100
if judge >= a and judge <= b:
count += 1
print(count)
| s049358466 | Accepted | 26 | 2,940 | 249 | n,a,b = map(int,input().split())
count = 0
for i in range(n+1):
judge = i%10 + (i%100 - i%10)//10 + (i%1000 - i%100)//100 + (i%10000 - i%1000)//1000 + (i%100000 - i%10000)//10000
if judge >= a and judge <= b:
count += i
print(count)
|
s054541105 | p03573 | u367130284 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 43 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | a,b,c=map(int,input().split());print(a+c-b) | s790574894 | Accepted | 17 | 2,940 | 51 | a,b,c=sorted(map(int,input().split()));print(a+c-b) |
s984830692 | p03693 | u245870380 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | 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... | N = input().split()
sn = ""
for i in N:
sn += i
print('Yes' if int(sn) % 4 == 0 else 'No') | s780509234 | Accepted | 17 | 2,940 | 94 | N = input().split()
sn = ""
for i in N:
sn += i
print('YES' if int(sn) % 4 == 0 else 'NO') |
s332374522 | p03679 | u952708174 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | X,A,B = [int(i) for i in input().split()]
if B-A<=X:
print('delicious')
else:
print('dangerous') | s411928567 | Accepted | 17 | 2,940 | 131 | X,A,B = [int(i) for i in input().split()]
if B-A<=0:
print('delicious')
elif 0<B-A<=X:
print('safe')
else:
print('dangerous') |
s585096304 | p03472 | u644778646 | 2,000 | 262,144 | Wrong Answer | 326 | 10,984 | 314 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | N,H = map(int,input().split())
a,b = [],[]
for i in range(N):
k,kk = map(int,input().split())
a.append(k)
b.append(kk)
zanmax = max(a)
num = 0
cnt = 0
for i in b:
if zanmax <= i:
num += i
cnt += 1
if num >= H:
print(cnt)
else:
cnt += int((H - num)/zanmax)
print(cnt)
| s349030135 | Accepted | 356 | 12,080 | 368 | import math
N,H = map(int,input().split())
a,b = [],[]
for i in range(N):
k,kk = map(int,input().split())
a.append(k)
b.append(kk)
zanmax = max(a)
b = sorted(b,reverse=True)
num = 0
cnt = 0
for i in b:
if zanmax < i:
num += i
cnt += 1
if num >= H:
print(cnt)
exit()... |
s315226097 | p03679 | u802963389 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 127 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x, a, b = map(int, input().split())
if b <= a:
print("delicious")
elif a < b <= x:
print("safe")
else:
print("dangerous") | s415769259 | Accepted | 17 | 2,940 | 132 | x, a, b = map(int, input().split())
if b <= a:
print("delicious")
elif a < b <= a + x:
print("safe")
else:
print("dangerous")
|
s410992064 | p00002 | u766477342 | 1,000 | 131,072 | Wrong Answer | 40 | 7,528 | 47 | Write a program which computes the digit number of sum of two integers a and b. | print(len(str(sum(map(int, input().split()))))) | s608659542 | Accepted | 50 | 7,532 | 100 | try:
while 1:
print(len(str(sum(map(int, input().split())))))
except Exception:
pass |
s359280187 | p03007 | u196697332 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 14,020 | 416 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | N = int(input())
A_list = list(map(int, input().split()))
max_list = [0] * (N - 1)
min_list = [0] * (N - 1)
for i in range(N - 1):
max_list[i] = max(A_list)
A_list.pop(A_list.index(max_list[i]))
min_list[i] = min(A_list)
A_list.pop(A_list.index(min_list[i]))
tmp = min_list[i] - max_list[i]
A_... | s890537018 | Accepted | 309 | 23,012 | 685 | N = int(input())
A_list = list(map(int, input().split()))
A_sorted = sorted(A_list)
pos_count = len([a for a in A_sorted if a >= 0])
neg_count = len([a for a in A_sorted if a < 0])
if pos_count == 0:
pos_count = 1
neg_count = N - 1
if neg_count == 0:
pos_count = N - 1
neg_count = 1
output_list = [0... |
s753438656 | p03563 | u750651325 | 2,000 | 262,144 | Wrong Answer | 24 | 9,044 | 109 | 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())
if R >= G:
sa = R-G
print(G+sa)
else:
sa = G-R
print(R+sa) | s395347220 | Accepted | 31 | 9,084 | 56 | R = int(input())
G = int(input())
sa = G-R
print(G+sa)
|
s254508101 | p00444 | u546285759 | 1,000 | 131,072 | Wrong Answer | 20 | 7,608 | 212 | 太郎君はよくJOI雑貨店で買い物をする. JOI雑貨店には硬貨は500円,100円,50円,10円,5円,1円が十分な数だけあり,いつも最も枚数が少なくなるようなおつりの支払い方をする.太郎君がJOI雑貨店で買い物をしてレジで1000円札を1枚出した時,もらうおつりに含まれる硬貨の枚数を求めるプログラムを作成せよ. 例えば入力例1の場合は下の図に示すように,4を出力しなければならない. | c, o= 0, 1000-int(input())
if o>= 500:
o, c= o-500, c+1
if o>= 100:
t= o//100
o, c= o-(100*t), c+t
if o>= 10:
t= o//10
o, c= o-(10*t), c+t
if o>= 5:
t= o//5
o, c= o-(5*t), c+t
print(c) | s121464796 | Accepted | 20 | 7,640 | 224 | def change(v):
global c, o
if o>= v:
t= o//v
o, c= o-(v*t), c+t
while True:
o= int(input())
if o== 0: break
c, o= 0, 1000-o
for l in [500, 100, 50, 10, 5, 1]: change(l)
print(c+o) |
s436048488 | p03457 | u305534505 | 2,000 | 262,144 | Wrong Answer | 426 | 27,380 | 616 | 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... | def check(a,b):
distance = abs(a[1]-b[1]) + abs(a[2]-b[2])
# print(distance)
time = abs(b[0]-a[0])
# print(time)
c = time - distance
if((c >= 0) and (c%2==0)):
return 0
else:
return 1
def main():
n = int(input())
plan = [list(map(int, input().split()))... | s197971571 | Accepted | 380 | 27,380 | 571 | def check(a,b):
distance = abs(a[1]-b[1]) + abs(a[2]-b[2])
time = abs(b[0]-a[0])
c = time - distance
if((c >= 0) and (c%2==0)):
return 0
else:
return 1
def main():
n = int(input())
plan = [list(map(int, input().split())) for i in range(n)]
if(check([0,0,0],plan... |
s116562114 | p03625 | u669382434 | 2,000 | 262,144 | Wrong Answer | 84 | 14,252 | 248 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | input()
a=[int(i) for i in input().split()]
sorted(a,reverse=True)
tyo=0
tan=0
tb=0
for i in range(len(a)-1):
if tb==1:
tb=0
else:
if a[i]==a[i+1] and tyo==0:
tyo=a[i]
tb=1
else:
tan=a[i]
break
print(tyo+tan) | s841747052 | Accepted | 108 | 14,252 | 259 | input()
a=[int(i) for i in input().split()]
a.sort(reverse=True)
tyo=0
tan=0
tb=0
for i in range(len(a)-1):
if tb==1:
tb=0
else:
if a[i]==a[i+1] and tyo==0:
tyo=a[i]
tb=1
elif a[i]==a[i+1]:
tan=a[i]
break
print(tyo*tan) |
s518462179 | p02259 | u418996726 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 334 | 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... | input()
arr = list(map(int, input().split()))
flag = False
count = 0
while not flag:
flag = True
for i in range(len(arr)-1):
if arr[i] > arr[i+1]:
count + 1
flag = False
t = arr[i+1]
arr[i+1] = arr[i]
arr[i] = t
print(" ".join(map(str, arr)))... | s371035404 | Accepted | 20 | 5,596 | 335 | input()
arr = list(map(int, input().split()))
flag = False
count = 0
while not flag:
flag = True
for i in range(len(arr)-1):
if arr[i] > arr[i+1]:
count += 1
flag = False
t = arr[i+1]
arr[i+1] = arr[i]
arr[i] = t
print(" ".join(map(str, arr))... |
s557237438 | p02407 | u886729200 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 159 | Write a program which reads a sequence and prints it in the reverse order. | n = int(input())
num = [int(i) for i in input().split()]
for i in range(round(len(num)/2)):
num[i],num[len(num)-i-1] = num[len(num)-i-1],num[i]
print(num)
| s351718171 | Accepted | 20 | 5,600 | 185 | n = int(input())
num = [int(i) for i in input().split()]
for i in range(round(len(num)/2)):
num[i],num[len(num)-i-1] = num[len(num)-i-1],num[i]
print(' '.join(str(i) for i in num))
|
s029533032 | p02240 | u196653484 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 444 | Write a program which reads relations in a SNS (Social Network Service), and judges that given pairs of users are reachable each other through the network. | def main():
n=list(map(int,input().split()))
n = n[1]
friends=[]
question=[]
for i in range(n):
a=tuple(map(int,input().split()))
friends.append(a)
m=int(input())
for i in range(m):
b=tuple(map(int,input().split()))
question.append(b)
for i in question:
... | s600196259 | Accepted | 570 | 24,988 | 1,208 | #coding:utf-8
class UnionFind:
def __init__(self,n):
self.parent=[i for i in range(n+1)]
self.rank=[0]*(n+1)
def find(self,x):
if self.parent[x] == x: # if x is x`s root
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.par... |
s141449793 | p03597 | u506587641 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | n = int(input())
a = int(input())
print(n**n - a) | s438072324 | Accepted | 17 | 2,940 | 50 | n = int(input())
a = int(input())
print(n**2 - a) |
s338466372 | p03494 | u826771152 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 326 | 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 shift_only(n,array):
tmp = []
counter = 0
while True:
flag = True
for num in array:
if num%2 != 0:
flag = False
if flag == False:
break
array = [i/2 for i in array]
counter +=1
return counter | s529196693 | Accepted | 18 | 3,060 | 396 | def shift_only(array):
tmp = []
counter = 0
while True:
flag = True
for num in array:
if num%2 != 0:
flag = False
if flag == False:
break
array = [i/2 for i in array]
counter +=1
print(counter)
n = int(input())... |
s737907843 | p02408 | u920118302 | 1,000 | 131,072 | Wrong Answer | 30 | 7,644 | 298 | 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. | def CheckCards(Mark):
for i in range(1, 13):
if [Mark, i] not in Cards:
print(Mark + str(i))
n = int(input())
Cards = []
for i in range(n):
Cards.append(input().split())
Cards[i][1] = int(Cards[i][1])
CheckCards("S")
CheckCards("H")
CheckCards("C")
CheckCards("D") | s731404710 | Accepted | 50 | 7,752 | 304 | def CheckCards(Mark):
for i in range(1, 14):
if [Mark, i] not in Cards:
print(Mark + " " + str(i))
n = int(input())
Cards = []
for i in range(n):
Cards.append(input().split())
Cards[i][1] = int(Cards[i][1])
CheckCards("S")
CheckCards("H")
CheckCards("C")
CheckCards("D") |
s346258492 | p03695 | u213431796 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 889 | 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())
l = list(map(int,input().split()))
flag1 = True
flag2 = True
flag3 = True
flag4 = True
flag5 = True
flag6 = True
flag7 = True
flag8 = True
Max = 0
Min = 0
def plus():
Max += 1
Min += 1
return 0
for value in l:
if value < 400 and flag1 == True:
flag1 = False
Max += 1
Min += 1
elif value <... | s628910687 | Accepted | 17 | 3,064 | 1,039 | n = int(input())
l = list(map(int,input().split()))
flag1 = True
flag2 = True
flag3 = True
flag4 = True
flag5 = True
flag6 = True
flag7 = True
flag8 = True
Max = 0
Min = 0
for value in l:
if 1 <= value and value < 400 and flag1 == True:
flag1 = False
Max += 1
Min += 1
elif 400 <= value and value < 800 and fl... |
s103767984 | p03494 | u926046014 | 2,000 | 262,144 | Wrong Answer | 25 | 9,072 | 190 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n = int(input())
a = list(map(int, input().split()))
for i in range(n):
if a[i]%2==1:
print(0)
exit()
b = min(a)
cnt = 0
while b%2==0:
b//=2
cnt+=1
print(cnt) | s306433118 | Accepted | 28 | 9,068 | 200 | n = int(input())
a = list(map(int, input().split()))
for i in range(10**5):
for j in range(n):
if a[j]%2==0:
a[j]=a[j]//2
else:
print(i)
exit() |
s166797366 | p00101 | u583097803 | 1,000 | 131,072 | Wrong Answer | 20 | 7,692 | 145 | An English booklet has been created for publicizing Aizu to the world. When you read it carefully, you found a misnomer (an error in writing) on the last name of Masayuki Hoshina, the lord of the Aizu domain. The booklet says "Hoshino" not "Hoshina". Your task is to write a program which replace all the words "Hoshino... | n=int(input())
s=[input() for i in range(n)]
for i in s:
if "Hoshino" in i:
i=i.replace("Hoshino","Hoshina")
for i in s:
print(i) | s487292416 | Accepted | 30 | 7,592 | 161 | n=int(input())
s=[input() for i in range(n)]
for i in range(n):
if "Hoshino" in s[i]:
s[i]=s[i].replace("Hoshino","Hoshina")
for i in s:
print(i) |
s686029812 | p03457 | u823044869 | 2,000 | 262,144 | Wrong Answer | 2,105 | 29,352 | 654 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | import sys
default_x = 0
default_y = 0
n = int(input())
print(n)
a = []
for i in range(n):
a.append(list(map(int,input().split())))
times = 0
for i in range(n):
for j in range(a[i][0]+times):
if default_x < a[i][1]:
default_x += 1
elif default_x > a[i][1]:
defau... | s296968470 | Accepted | 424 | 17,320 | 366 | n = int(input())
travel = list()
#start point
travel.append((0,0,0))
for i in range(n):
travel.append(tuple(map(int,input().split())))
for j in range(n):
dist = abs(travel[j][0]-travel[j+1][0])
dd = abs(travel[j][1]-travel[j+1][1])+abs(travel[j][2]-travel[j+1][2])
if dist < dd or (dd%2 != dist%2):
... |
s325200014 | p03434 | u310678820 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 98 | 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=sorted([int(i) for i in input().split()])
ans=sum(a[::2])-sum(a[1::2])
print(ans) | s741793427 | Accepted | 17 | 3,060 | 112 | n=int(input())
a=sorted([int(i) for i in input().split()], reverse=True)
ans=sum(a[::2])-sum(a[1::2])
print(ans) |
s050046001 | p03671 | u617659131 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 124 | 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... | s = list(input())
for i in range(len(s)):
s.pop()
if s[:len(s) // 2 - 1] == s[len(s) // 2:]:
print(len(s))
break | s011015558 | Accepted | 17 | 2,940 | 63 | a = list(map(int, input().split()))
a.sort()
print(a[0] + a[1]) |
s652079333 | p03337 | u291278680 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 62 | 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())
print(min([a+b, a-b, a*b]))
| s721164419 | Accepted | 17 | 2,940 | 62 | a, b = map(int, input().split())
print(max([a+b, a-b, a*b]))
|
s269071209 | p03456 | u897328029 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a, b = list(map(int, input().split()))
c = int(str(a) + str(b))
ans = 'Yes' if c == c ** (1/2) ** 2 else 'No'
print(ans)
| s836110629 | Accepted | 17 | 2,940 | 131 | a, b = list(map(int, input().split()))
c = int(str(a) + str(b))
ans = 'Yes' if c ** (1/2) == int(c ** (1/2)) else 'No'
print(ans)
|
s520196099 | p03672 | u497046426 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 153 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | S = input()
if len(S) % 2 == 1:
S = S[:-1]
else:
S = S[:-2]
N = len(S) // 2
print(S[:N], S[N:2*N])
while S[:N] != S[N:2*N]:
N -= 1
print(2*N) | s391902800 | Accepted | 17 | 2,940 | 130 | S = input()
if len(S) % 2 == 1:
S = S[:-1]
else:
S = S[:-2]
N = len(S) // 2
while S[:N] != S[N:2*N]:
N -= 1
print(2*N) |
s677033089 | p02396 | u896065593 | 1,000 | 131,072 | Wrong Answer | 130 | 7,512 | 95 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | while(1):
i = 1
x = int(input())
if(x == 0):break
print("Case %d: %d" % (i, x)) | s253889634 | Accepted | 130 | 7,540 | 102 | i = 1
while(1):
x = int(input())
if(x == 0):break
print("Case %d: %d" % (i, x))
i += 1 |
s026357248 | p03493 | u410026319 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | s = input()
count = 0
for i in range(3):
if s[i] == 1:
count += 1
print(count) | s729600172 | Accepted | 17 | 2,940 | 93 | s = input()
count = 0
for i in range(3):
if s[i] == '1':
count += 1
print(count)
|
s340288670 | p02277 | u365470584 | 1,000 | 131,072 | Wrong Answer | 30 | 7,652 | 654 | Let's arrange a deck of cards. Your task is to sort totally n cards. A card consists of a part of a suit (S, H, C or D) and an number. Write a program which sorts such cards based on the following pseudocode: Partition(A, p, r) 1 x = A[r] 2 i = p-1 3 for j = p to r-1 4 do if A[j] <= x 5 then ... | def partition(A, p, r):
x = A[r]
i = p-1
for j in range(p,r):
if A[j] <= x:
i = i+1
A[i], A[j] = A[j], A[i]
A[i+1], A[r] = A[r], A[i+1]
return i+1
def quickSort(A, p, r):
if p < r:
q = partition(A, p, r)
quickSort(A, q, p-1)
quickSort(A, q+1, r)
def check(A,... | s688657425 | Accepted | 940 | 22,292 | 660 | def partition(A, p, r):
x = A[r][1]
i = p-1
for j in range(p,r):
if A[j][1] <= x:
i = i+1
A[i], A[j] = A[j], A[i]
A[i+1], A[r] = A[r], A[i+1]
return i+1
def quickSort(A, p, r):
if p < r:
q = partition(A, p, r)
quickSort(A, p, q-1)
quickSort(A, q+1, r)
def ch... |
s707772327 | p02843 | u085186789 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,216 | 12,804 | 358 | 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... | X = int(input())
for i1 in range(1000000):
for i2 in range(1000000):
for i3 in range(1000000):
for i4 in range(1000000):
for i5 in range(1000000):
for i6 in range(1000000):
if 100 * i1 + 101 * i2 + 102 * i3 + 103 * i4 + 104 * i5 + 105 * i6 == X:
print("1")
... | s957225731 | Accepted | 30 | 9,072 | 88 | X = int(input())
a = X // 100
r = X % 100
if r <= 5 * a:
print("1")
else:
print("0") |
s437316798 | p02612 | u708211626 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,144 | 72 | 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. | a=input()
if len(a)==4:
b=a[1:]
print(int(b))
else:
print(a)
| s243518504 | Accepted | 26 | 9,172 | 146 | a=input()
if len(a)==4 or len(a)==5:
b=a[1:]
c=1000-int(b)
if c==1000 :
print('0')
else:
print(c)
else:
print(1000-int(a))
|
s786912337 | p02936 | u836311327 | 2,000 | 1,048,576 | Wrong Answer | 114 | 26,440 | 342 | 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... | import sys
import numpy as np
from collections import deque
def input(): return sys.stdin.readline().rstrip()
def main():
n, q = map(int, input().split())
graph = [[] for _ in range(n+1)]
for _ in range(n-1):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
... | s853988332 | Accepted | 841 | 88,204 | 859 | import sys
import numpy as np
from collections import deque
def input(): return sys.stdin.readline().rstrip()
def main():
n, q = map(int, input().split())
graph = [[] for _ in range(n+1)]
for _ in range(n-1):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
... |
s564366677 | p03385 | u505830998 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 347 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | import sys
#+++++
def main():
s = input()
a = ''.join(sorted(s)) == 'abc'
if a:
print('Yes')
else:
print('No')
#print(' '.join([str(v) for v in l]))
#+++++
if __name__ == "__main__":
if sys.platform =='ios':
sys.stdin=open('inputFile.txt')
else:
input = sys.stdin.readline
ret = main()
if re... | s072498828 | Accepted | 17 | 3,060 | 356 | import sys
#+++++
def main():
s = input()
#a ='Yes' if ''.join(sorted(s)) == 'abc' else 'No'
for c in 'abc':
if c not in s:
print('No')
return
print('Yes')
#+++++
if __name__ == "__main__":
if sys.platform =='ios':
sys.stdin=open('inputFile.txt')
else:
input = sys.stdin.readline
ret = main... |
s037611910 | p03068 | u418527037 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 182 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | N = int(input())
S = input()
K = int(input())
k = S[K-1]
print(k)
ans = []
for i in S:
if i == k:
ans.append(k)
else:
ans.append('*')
print(''.join(ans)) | s537887420 | Accepted | 17 | 2,940 | 172 | N = int(input())
S = input()
K = int(input())
k = S[K-1]
ans = []
for i in S:
if i == k:
ans.append(k)
else:
ans.append('*')
print(''.join(ans)) |
s162872542 | p03943 | u993622994 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 143 | 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... | # -*- coding: utf-8 -*-
a, b, c = map(int, input().split())
if a == b + c or b == a + c or c == a + b:
print('YES')
else:
print('NO')
| s948998231 | Accepted | 17 | 2,940 | 140 | # -*- coding: utf-8 -*-
abc = sorted(list(map(int, input().split())))
if abc[0] + abc[1] == abc[2]:
print('Yes')
else:
print('No')
|
s271184710 | p03227 | u927764913 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 76 | You are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it. | a=list(input())
if len(a) == 3:
print(str(a[::-1]))
else:
print(str(a))
| s244341249 | Accepted | 20 | 2,940 | 68 | a=input()
if len(a) == 3:
print(a[::-1])
else:
print(str(a)) |
s166182274 | p03338 | u368796742 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,060 | 182 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | n = int(input())
l = list(input())
ans = 0
for i in range(n):
l1 = l[i:]
count = 0
for j in range(i+1):
if l[j] in l1:
count += 1
ans = max(ans,count)
print(ans) | s464614275 | Accepted | 18 | 2,940 | 136 | n = int(input())
l = list(input())
ans = 0
for i in range(n):
count = len(set(l[:i])&set(l[i:]))
ans = max(count,ans)
print(ans) |
s455050406 | p03944 | u583799976 | 2,000 | 262,144 | Wrong Answer | 32 | 9,192 | 218 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | W,H,N=map(int,input().split())
a,b,c,d=0,0,W,H
for i in range(N):
x,y,A=map(int,input().split())
if A==1: a=max(a,x)
if A==2: b=max(b,y)
if A==3: c=min(c,x)
if A==4: d=min(d,y)
print(max(0,c-a)*max(0,b-d)) | s135905277 | Accepted | 27 | 9,016 | 235 | W,H,N=map(int,input().split())
a,b,c,d=0,W,0,H
for i in range(N):
x,y,A=map(int,input().split())
if A==1:
a=max(a,x)
if A==2:
b=min(b,x)
if A==3:
c=max(c,y)
if A==4:
d=min(d,y)
print(max(0,b-a)*max(0,d-c)) |
s981328766 | p03387 | u826263061 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 539 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | a = [0,0,0]
s = input().split()
a[0] = int(s[0])
a[1] = int(s[1])
a[2] = int(s[2])
#a_min = min(a)
#a[0] -= a_min
#a[1] -= a_min
#a[2] -= a_min
count = 0
while(True):
if a[0] == a[1] and a[1] == a[2]:
#print(count)
break
a.sort()
if a[2] >= a[0]+2:
a[0] += 2
count += 1
... | s058903446 | Accepted | 17 | 3,064 | 374 | a = list(map(int, input().split()))
a.sort()
n0 = abs(a[2]-a[0])//2 + abs(a[2]-a[1])//2
if a[2] % 2 == 1 and a[0] % 2 == 0 and a[1] % 2 == 0:
n0 += 1
elif a[2] % 2 == 0 and a[0] % 2 == 1 and a[1] % 2 == 1:
n0 += 2
elif a[2] % 2 == 1 and a[0] % 2 == 1 and a[1] % 2 == 1:
pass
elif a[2] % 2 == 0 and a[0] % 2 == 0 ... |
s588238977 | p02936 | u871980676 | 2,000 | 1,048,576 | Wrong Answer | 2,116 | 146,072 | 794 | 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... | from copy import deepcopy as dp
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) ]
a = [ab[i][0] for i in range(N-1)]
b = [ab[i][1] for i in range(N-1)]
dic = {}
def make_dic(nowlist, ab, st):
nextlist = [ b[i] for i ... | s464038746 | Accepted | 1,527 | 290,500 | 691 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000)
N,Q = map(int,readline().split())
abpx = list(map(int,read().split()))
ab = iter(abpx[:N+N-2])
px = iter(abpx[N+N-2:])
dic = {}
dic2=[0]*(N+1)
dic3=[0]*N
for i in range(N):
dic[i+1] = []
for a,b in zip(ab,ab... |
s284184453 | p02842 | u253759478 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 101 | 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())
if n % 27 == 13 or n % 27 == 26:
print(':(')
else:
print(int(n / 1.08) + 1)
| s898035180 | Accepted | 17 | 2,940 | 144 | n = int(input())
if n % 27 == 13 or n % 27 == 26:
print(':(')
elif n % 27 == 0:
print(int(n / 1.08))
else:
print(int(n / 1.08) + 1)
|
s028030468 | p03477 | u794173881 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 124 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a,b,c,d = map(int,input().split())
if a+b > c+d :
print("Left")
if a+b < c+d :
print("Right")
else:
print("Balanced") | s512852556 | Accepted | 17 | 2,940 | 126 | a,b,c,d = map(int,input().split())
if a+b > c+d :
print("Left")
elif a+b < c+d :
print("Right")
else:
print("Balanced") |
s409451033 | p02612 | u579508806 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,140 | 57 | 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())
c=0
while n > 0:
n-=1000
c+=1
print(c) | s337292180 | Accepted | 28 | 9,084 | 49 | n=int(input())
while n > 0:
n-=1000
print(n*-1) |
s592465468 | p03493 | u094565093 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | S=input()
S=list(S)
cnt=0
for i in S:
if i =='1':
cnt+=1 | s698316509 | Accepted | 18 | 2,940 | 79 | S=input()
S=list(S)
cnt=0
for i in S:
if i =='1':
cnt+=1
print(cnt) |
s616597698 | p03478 | u018591138 | 2,000 | 262,144 | Wrong Answer | 41 | 3,060 | 291 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | N,A,B = map(int, input(">>").split())
count = 0
for i in range(1,N+1):
m = 0
tmp = i
for t in range(1, len(str(i))+1):
#print(tmp)
m += tmp%10
tmp /= 10
tmp = int(tmp)
if( A <=m and m <= B):
count += i
print(count) | s298890119 | Accepted | 41 | 3,060 | 287 | N,A,B = map(int, input().split())
count = 0
for i in range(1,N+1):
m = 0
tmp = i
for t in range(1, len(str(i))+1):
#print(tmp)
m += tmp%10
tmp /= 10
tmp = int(tmp)
if( A <=m and m <= B):
count += i
print(count) |
s759240896 | p03797 | u298297089 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | Snuke loves puzzles. Today, he is working on a puzzle using `S`\- and `c`-shaped pieces. In this puzzle, you can combine two `c`-shaped pieces into one `S`-shaped piece, as shown in the figure below: Snuke decided to create as many `Scc` groups as possible by putting together one `S`-shaped piece and two `c`-shaped... | N,M = map(int, input().split())
if N * 2 > M:
print(M//2)
exit()
tmp = M - N * 2
print(N*2 + tmp//4)
| s579115243 | Accepted | 17 | 2,940 | 86 | n,m = map(int ,input().split())
ans = min(n, m // 2)
m -= ans * 2
print(ans + m // 4) |
s805180530 | p03351 | u449555432 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 97 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d=map(int,input().split())
if abs(a-b)<d and abs(b-c)<d:
print('Yes')
else:
print('No') | s436452746 | Accepted | 17 | 2,940 | 119 | a,b,c,d=map(int,input().split())
if abs(a-c)<=d or ( abs(b-a)<=d and abs(b-c)<=d ) :
print('Yes')
else:
print('No') |
s198707438 | p03193 | u353797797 | 2,000 | 1,048,576 | Wrong Answer | 39 | 10,412 | 847 | 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 operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
from fractions import Fraction
import sys
sys.setrecursionlimit(10 ** 6)
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(m... | s697201011 | Accepted | 40 | 10,384 | 847 | from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
from fractions import Fraction
import sys
sys.setrecursionlimit(10 ** 6)
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(m... |
s257439440 | p02613 | u389188163 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,172 | 169 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N = int(input())
S = list(input().split())
print(f'AC x {S.count("AC")}')
print(f'WA x {S.count("WA")}')
print(f'TLE x {S.count("TLE")}')
print(f'RE x {S.count("RE")}') | s906771090 | Accepted | 147 | 16,172 | 214 | N = int(input())
lst = []
for _ in range(N):
S = input()
lst.append(S)
print(f'AC x {lst.count("AC")}')
print(f'WA x {lst.count("WA")}')
print(f'TLE x {lst.count("TLE")}')
print(f'RE x {lst.count("RE")}') |
s401985586 | p03501 | u870518235 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 52 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | N, A, B = map(int,input().split())
print(max(N*A,B)) | s868213165 | Accepted | 17 | 2,940 | 52 | N, A, B = map(int,input().split())
print(min(N*A,B)) |
s409604915 | p02619 | u537142137 | 2,000 | 1,048,576 | Wrong Answer | 125 | 27,264 | 418 | Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to che... | import numpy as np
D = int(input())
c = np.array( list(map(int, input().split())) )
s = [[] for i in range(365+1)]
for i in range(D):
s[i] = np.array( list(map(int, input().split())) )
#
last = np.array( [-1]*26 )
av = np.array( [0]*26 )
id = np.identity(4,dtype=int)
v = 0
for d in range(D):
av = s[d] - sum( c*(d... | s322946673 | Accepted | 128 | 27,336 | 414 | import numpy as np
D = int(input())
c = np.array( list(map(int, input().split())) )
s = [[] for i in range(365+1)]
for i in range(D):
s[i] = np.array( list(map(int, input().split())) )
#
last = np.array( [-1]*26 )
av = np.array( [0]*26 )
id = np.identity(4,dtype=int)
v = 0
for d in range(D):
av = s[d] - sum( c*(d... |
s635260513 | p02833 | u311636831 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 270 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | N=1000000000000000000
if(N%2==1):
print(0)
exit()
#s=0
# while(i%5==0 and i!=0):
# s+=1
# i=i//5
#print(s)
s=0
t=10
while(N>=t):
s+=(N//t)
t*=5
print(s)
#L=len(str(N))-1
#T=N//10
#s+=T
#print(s)
| s553373348 | Accepted | 17 | 2,940 | 263 | N=int(input())
if(N%2==1):
print(0)
exit()
#s=0
# while(i%5==0 and i!=0):
# s+=1
# i=i//5
#print(s)
s=0
t=10
while(N>=t):
s+=(N//t)
t*=5
print(s)
#L=len(str(N))-1
#T=N//10
#s+=T
#print(s)
|
s879627233 | p03394 | u754022296 | 2,000 | 262,144 | Wrong Answer | 26 | 4,064 | 87 | Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers. She thinks that a set S = \\{a_{1}, a_{2}, ..., a_{N}\\} of **distinct** positive integers is called **special** if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of t... | n = int(input())
if n%2:
print(2, 3, 25, *[15]*(n-3))
else:
print(2, 8, *[5]*(n-2)) | s244025413 | Accepted | 30 | 4,560 | 473 | n = int(input())
if n <= 15002:
if n==3:
print(2, 5, 63)
else:
if n%3:
l = [2*(i+1) for i in range(n-2)]
l += [3, 9]
print(*l)
else:
l = [2*(i+1) for i in range(n-1) if i!=2]
l += [3, 9]
print(*l)
else:
if n%2==0:
l = [2*(i+1) for i in range(15000)]
l += [3+... |
s441194995 | p02606 | u266014018 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,100 | 229 | How many multiples of d are there among the integers between L and R (inclusive)? | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
l, r , d = map(int, input().split())
ans = (r-l)//d
if l%d == 0:
ans += 1
print(ans)
if __name__ == '__main__':
main() | s333602910 | Accepted | 29 | 9,156 | 237 | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
l, r , d = map(int, input().split())
ans = r//d - l//d
if l%d == 0:
ans += 1
print(ans)
if __name__ == '__main__':
main()
|
s839089790 | p03433 | u694810977 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | 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 == 0:
print("Yes")
else:
print("No") | s256274784 | Accepted | 17 | 2,940 | 111 | N = int(input())
A = int(input())
amari = N % 500
if amari <= A:
print("Yes")
else:
print("No") |
s713586270 | p03605 | u079022116 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | 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? | if input() in '9':
print('Yes')
else:print('No') | s190196856 | Accepted | 17 | 2,940 | 72 | a=input()
if a[0] == '9' or a[1] == '9':
print('Yes')
else:print('No') |
s705681224 | p03470 | u010668949 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 189 | 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... |
N = int(input())
d = [int(i) for i in input().split()]
print(len(list(set(d)))) | s660962484 | Accepted | 17 | 2,940 | 214 |
N = int(input())
d = []
i = 0
while N>i:
d.append(int(input()))
i += 1
print(len(list(set(d)))) |
s460775783 | p00003 | u661290476 | 1,000 | 131,072 | Wrong Answer | 30 | 7,904 | 172 | Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so. | n=int(input())
r=[0]*n
for i in range(n):
r[i]=sorted(list(map(int,input().split())))
for i in range(n):
print("Yes" if r[i][0]**2+r[i][1]**2==r[i][2]**2 else "No") | s056284443 | Accepted | 40 | 5,604 | 197 | n = int(input())
for _ in range(n):
edges = sorted([int(i) for i in input().split()])
if edges[0] ** 2 + edges[1] ** 2 == edges[2] ** 2:
print("YES")
else:
print("NO")
|
s321617839 | p03478 | u556657484 | 2,000 | 262,144 | Wrong Answer | 36 | 3,060 | 178 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | N, A, B = map(int, input().split())
ans = 0
for n in range(1, N):
n = str(n)
n_list = list(map(int, n))
if A <= sum(n_list) <= B:
ans += int(n)
print(ans)
| s489941991 | Accepted | 37 | 3,060 | 180 | N, A, B = map(int, input().split())
ans = 0
for n in range(1, N+1):
n = str(n)
n_list = list(map(int, n))
if A <= sum(n_list) <= B:
ans += int(n)
print(ans)
|
s571857916 | p03565 | u868982936 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 327 | 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 = list(input())
T = input()
ls = []
for i in range(len(S)-len(T)):
for j in range(len(T)):
if S[i+j] != T[j] and S[i+j] != "?":
break
else:
ls.append(i)
if ls:
for j in range(len(T)):
S[ls[-1]+j] = T[j]
print("".join(S).replace("?", "a"))
else:
print("UNRESTOR... | s844224795 | Accepted | 18 | 3,064 | 337 | S = list(input())
T = input()
ls = []
for i in range(len(S)-len(T)+1):
for j in range(len(T)):
if S[i+j] != T[j] and S[i+j] != "?":
break
else:
ls.append(i)
if ls:
for j in range(len(T)):
S[ls[-1]+j] = T[j]
print("".join(S).replace("?", "a"))
else:
print("UNREST... |
s052475202 | p03067 | u065475172 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 113 | 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 C > A and C < B or C < A and C > B:
print('YES')
else:
print('NO') | s332906630 | Accepted | 17 | 2,940 | 113 | A, B, C = map(int, input().split())
if C > A and C < B or C < A and C > B:
print('Yes')
else:
print('No') |
s078210764 | p03544 | u043434786 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 171 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | N=int(input())
if N==0: print(1)
elif N==1: print(0)
else:
Ln_2=0
Ln_1=2
Ln=1
for i in range(N-2):
Ln_2=Ln_1
Ln_1=Ln
Ln=Ln_1+Ln_2
print(Ln)
| s460361537 | Accepted | 17 | 2,940 | 172 | N=int(input())
if N==0: print(2)
elif N==1: print(1)
else:
Ln_2=0
Ln_1=2
Ln=1
for i in range(N-1):
Ln_2=Ln_1
Ln_1=Ln
Ln=Ln_1+Ln_2
print(Ln)
|
s557458409 | p03394 | u631277801 | 2,000 | 262,144 | Wrong Answer | 2,104 | 4,596 | 988 | Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers. She thinks that a set S = \\{a_{1}, a_{2}, ..., a_{N}\\} of **distinct** positive integers is called **special** if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of t... | def gca(a,b):
while 1:
a = a%b
if a == 0:
return b
b = b%a
if b == 0:
return a
def searchAns(nums):
cnt = 0
max_num = sum(nums)
while cnt < 100000:
isNotProper = False
cnt += 1
last_num = max_num*cnt
num... | s380334828 | Accepted | 32 | 4,860 | 1,124 | import sys
stdin = sys.stdin
def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return lis... |
s359676684 | p02694 | u073139376 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,164 | 104 | 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 math
X = int(input())
A = 100
t = 0
while A < X:
A *= 1.01
A = math.floor(A)
t += 1 | s844215435 | Accepted | 23 | 9,096 | 114 | import math
X = int(input())
A = 100
t = 0
while A < X:
A *= 1.01
A = math.floor(A)
t += 1
print(t) |
s701795990 | p03371 | u043236471 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 216 | "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 = [int(x) for x in input().split()]
if a + b < c*2:
res = a*x + b*y
else:
min_c = min(x, y)
max_c = max(x, y)
diff = max_c - min_c
res = (min_c * 2) * c + diff*max(a, b)
print(res) | s022721055 | Accepted | 18 | 3,064 | 318 | a, b, c, x, y = [int(x) for x in input().split()]
if a + b < c*2:
res = a*x + b*y
else:
min_c = min(x, y)
ab_cost = min_c * 2 * c
rem = max(x-min_c, y-min_c)
if x > y:
rem_cost = min(rem * a, rem*2*c)
else:
rem_cost = min(rem*b, rem*2*c)
res = ab_cost + rem_cost
print(res) |
s216820674 | p03377 | u118147328 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A,B,X = map(int, input().split())
if (A + B < X) or (A > X):
print("No")
else:
print("Yes")
| s948779208 | Accepted | 17 | 2,940 | 101 | A,B,X = map(int, input().split())
if (A + B < X) or (A > X):
print("NO")
else:
print("YES")
|
s485171118 | p02972 | u731028462 | 2,000 | 1,048,576 | Wrong Answer | 838 | 22,172 | 510 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | N = int(input())
A = list(map(int, input().split()))
ans=[]
cnt=0
B = [0 for i in range(N)]
import math
for i in range(math.floor(N/2),N):
B[i]=A[i]
if(A[i]==1):
cnt+=1
ans.append(i+1)
from functools import reduce
for i in range(math.floor(N/2)-1,-1,-1):
R=[B[i*j] for j in range(2,... | s448274223 | Accepted | 608 | 22,584 | 519 | N = int(input())
A = list(map(int, input().split()))
ans=[]
cnt=0
B = [0 for i in range(N)]
import math
for i in range(math.floor(N/2),N):
B[i]=A[i]
if(A[i]==1):
cnt+=1
ans.append(i+1)
from functools import reduce
for i in range(math.floor(N/2)-1,-1,-1):
R=[B[(i+1)*j-1] for j in r... |
s095902706 | p03478 | u607139498 | 2,000 | 262,144 | Wrong Answer | 757 | 3,064 | 364 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | # -*- coding: utf-8 -*-
# Some Sums
def calcSumOfDigits(n):
sum = 0
while n > 0:
sum += n % 10
n /= 10
return sum
a = list(map(int, input().split()))
N = a[0]
A = a[1]
B = a[2]
total = 0
for i in range(N):
sumOfDigits = calcSumOfDigits(i+1)
if sumOfDigits >= A and sumOfDigits <= ... | s516618125 | Accepted | 26 | 3,064 | 477 | # -*- coding: utf-8 -*-
# Some Sums
def calcSumOfDigits(n):
sum = 0
while n > 0:
sum += n % 10
# print(sum)
n = n // 10
return sum
a = list(map(int, input().split()))
N = a[0]
A = a[1]
B = a[2]
total = 0
for i in range(N):
sumOfDigits = calcSumOfDigits(i+1)
# print("sumOf... |
s529520687 | p03386 | u612721349 | 2,000 | 262,144 | Wrong Answer | 2,232 | 2,063,384 | 123 | 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, x = map(int, input().split())
l = [i for i in range(a, b+1)]
for i in l:
if i <= a + x and b - x <= i:
print(i) | s783107595 | Accepted | 17 | 3,060 | 206 | a, b, x = map(int, input().split())
s = set()
for i in [j for j in range(a, min(b + 1, a + x))] :
print(i)
s.add(i)
for i in [j for j in range(max(a, b - x + 1), b + 1)] :
if i not in s:
print(i)
|
s661358521 | p03657 | u904945034 | 2,000 | 262,144 | Wrong Answer | 28 | 9,156 | 111 | 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... | a,b = map(int,input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or a+b % 3 == 0 else "Impossible")
| s184009034 | Accepted | 25 | 9,084 | 113 | a,b = map(int,input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0 else "Impossible")
|
s375407404 | p03377 | u377036395 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | 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 a <= x <= a + b:
print("Yes")
else:
print("No") | s805259644 | Accepted | 17 | 2,940 | 90 | a, b, x = map(int, input().split())
if a <= x <= a + b:
print("YES")
else:
print("NO") |
s913696612 | p03471 | u644126199 | 2,000 | 262,144 | Wrong Answer | 24 | 3,192 | 1,062 | 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... | line = input().split()
sheet = int(line[0])
total =int(line[1])
total_store =total
out = [0,0,0]
sheet_count =0
for i in range(sheet):
switch_10000 =0
switch_5000 =0
if int(total /10000 )>0 and sheet_count <sheet:
total -=10000
sheet_count +=1
out[0] +=1
switch_10000 +=1
if int(total/5000)>0... | s271294955 | Accepted | 20 | 3,064 | 612 | line = input().split()
sheet = int(line[0])
total = int(line[1])
out =[0,0,0]
cnt =0
for x in range(1,int(total/10000)+1):
if (int((total/1000))-sheet-9*x) %4 ==0:
y =int((int(total/1000)-sheet-9*x)/4)
z =sheet - y - x
if x + y + z ==sheet and z>=0 and y>=0 and cnt ==0:
cnt +=1
print(x,y,... |
s140836105 | p02821 | u508486691 | 2,000 | 1,048,576 | Wrong Answer | 973 | 36,312 | 1,213 | Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a _power_ of A_i. Takahashi has decided to perform M _handshakes_ to increase the _happiness_ of the party (let the current happiness be 0). A handshake will be performed as follows: * Takahashi c... | import sys
import math
from collections import defaultdict
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
if N<=0:
ret... | s375796945 | Accepted | 646 | 35,928 | 1,156 | import sys
import math
from collections import defaultdict
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
if N<=0:
ret... |
s116051433 | p03712 | u102960641 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 102 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | h,w = map(int, input().split())
print("#"*w)
for i in range(h):
print("#"+input()+"#")
print("#"*w)
| s603212170 | Accepted | 18 | 2,940 | 110 | h,w = map(int, input().split())
print("#"*(w+2))
for i in range(h):
print("#"+input()+"#")
print("#"*(w+2))
|
s712125378 | p00006 | u175111751 | 1,000 | 131,072 | Wrong Answer | 40 | 7,344 | 29 | Write a program which reverses a given string str. | print(str(reversed(input()))) | s551470230 | Accepted | 20 | 7,260 | 20 | print(input()[::-1]) |
s282162483 | p02255 | u083560765 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 150 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | n=int(input())
a=list(map(int,input().split()))
for i in range(n):
v=a[i]
j=i-1
while j>=0 and a[j]>v:
a[j+1]=a[j]
j-=1
a[j+1]=v
print(a)
| s740322683 | Accepted | 20 | 5,604 | 175 | n=int(input())
a=list(map(int,input().split()))
for i in range(n):
v=a[i]
j=i-1
while j>=0 and a[j]>v:
a[j+1]=a[j]
j-=1
a[j+1]=v
print(' '.join(list(map(str,a))))
|
s080185091 | p03139 | u532966492 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 57 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | a,b,c=map(int,input().split())
print(min(c,a+b),min(a,b)) | s066256191 | Accepted | 17 | 2,940 | 59 | a,b,c=map(int,input().split())
print(min(b,c),max(0,b+c-a)) |
s675122690 | p02742 | u493555013 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 84 | 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) | s144823509 | Accepted | 17 | 2,940 | 143 | H,W = map(int,input().split())
if H==1 or W==1:
print(int(1))
else:
if H*W%2 == 0:
print(int(H*W/2))
else:
print(int(H*W//2+1))
|
s275040773 | p02694 | u842028864 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,416 | 114 | 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... | goal = int(input())
count = 0
money = 100
while money < goal:
count += 1
money = int(money**1.01)
print(count) | s858128867 | Accepted | 19 | 9,148 | 113 | goal = int(input())
count = 0
money = 100
while money < goal:
count += 1
money = int(money*1.01)
print(count) |
s662412917 | p03448 | u001207659 | 2,000 | 262,144 | Wrong Answer | 51 | 2,940 | 222 | 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... | s1, s2, s3, total =[int(input()) for h in range(4)]
ans = 0
for i in range(s1+1):
for j in range(s2+1):
for k in range(s3+1):
if 500*s1 + 100*s2 + 50*s3 == total:
ans += 1
print(ans) | s342447047 | Accepted | 50 | 3,060 | 212 | a, b, c, x = [int(input()) for _ 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) |
s266367790 | p03401 | u086503932 | 2,000 | 262,144 | Wrong Answer | 210 | 14,048 | 397 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | N = int(input())
A = list(map(int, input().split()))
A.append(0)
ans = abs(0 - A[0])
for i in range(N):
ans += abs(A[i] - A[i+1])
for i in range(N):
if i == 0:
if A[0] * A[1] >= 0:
print(ans)
else:
print(ans - 2*abs(A[0]))
else:
if (A[i] - A[i-1]) * (A[i+1] - A[i]) >= 0:
print(a... | s385358973 | Accepted | 203 | 14,048 | 312 | N = int(input())
A = list(map(int, input().split()))
A.append(0)
ans = [None] * (N+1)
ans[0] = abs(0 - A[0])
for i in range(N):
ans[i+1] = abs(A[i] - A[i+1])
ansS = sum(ans)
for i in range(N):
if i == 0:
tmp = abs(A[1])
else:
tmp = abs(A[i+1] - A[i-1])
print(ansS - ans[i] - ans[i+1] + tmp) |
s095667691 | p02613 | u602481141 | 2,000 | 1,048,576 | Wrong Answer | 147 | 16,200 | 386 | 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`,... | AC = WA = TLE = RE = 0
N = int(input())
s = [input() for i in range(N)]
for v in s:
if(v == "AC"):
AC+=1
elif(v == "WA"):
WA+=1
elif(v == "TLE"):
TLE+=1
else:
RE+=1
print('AC x %d' % (AC))
print('AC x %d' % (WA))
print('AC x %d' % (TLE))
print('AC x %d' % (RE... | s314054818 | Accepted | 148 | 16,168 | 387 | AC = WA = TLE = RE = 0
N = int(input())
s = [input() for i in range(N)]
for v in s:
if(v == "AC"):
AC+=1
elif(v == "WA"):
WA+=1
elif(v == "TLE"):
TLE+=1
else:
RE+=1
print('AC x %d' % (AC))
print('WA x %d' % (WA))
print('TLE x %d' % (TLE))
print('RE x %d' % (R... |
s134088666 | p03050 | u268516119 | 2,000 | 1,048,576 | Wrong Answer | 139 | 3,060 | 136 | Snuke received a positive integer N from Takahashi. A positive integer m is called a _favorite number_ when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod m holds. Find all favorite numbers and print the sum of those. | import math
N=int(input())
root=math.ceil(math.sqrt(N)-1)
ans=0
for i in range(1,root):
if not N%i:
ans+=(N//i-1)
print(ans) | s146981847 | Accepted | 134 | 3,060 | 157 | import math
N=int(input())
root=math.ceil(math.sqrt(N))
ans=0
for i in range(1,root):
if not N%i:
if N//i>i+1:
ans+=N//i-1
print(ans) |
s079520067 | p03378 | u785578220 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 243 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | n,m,x = map(int,input().split())
y = list(map(int,input().split()))
s = 0
cs = 0
t = 0
for i in y:
if x > i:
s+=1
elif x == i:
cs=0
else:
t+=1
if t>s and cs!=0:
print(s)
elif t<=s and cs!=0:
print(t) | s142727388 | Accepted | 19 | 2,940 | 141 | a,b,c= map(int, input().split())
p = list(map(int, input().split()))
k = 0
for i in range(b):
if p[i] < c:
k+=1
print(min(k,b-k)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.