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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s844266498 | p03155 | u405256066 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 153 | It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ... | from sys import stdin
N=int(stdin.readline().rstrip())
H=int(stdin.readline().rstrip())
W=int(stdin.readline().rstrip())
ans=int(N/H)*int(W/H)
print(ans) | s094344834 | Accepted | 17 | 2,940 | 151 | from sys import stdin
N=int(stdin.readline().rstrip())
H=int(stdin.readline().rstrip())
W=int(stdin.readline().rstrip())
ans=(N-H+1)*(N-W+1)
print(ans) |
s080601189 | p03457 | u772180901 | 2,000 | 262,144 | Wrong Answer | 377 | 27,300 | 471 | 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())
me = [0,0]
arr = []
for i in range(n):
arr += [list(map(int,input().split()))]
for t in arr:
for _ in range(t[0]):
if me[0] < t[1]:
me[0] += 1
elif me[0] > t[1]:
me[0] -= 1
elif me[1] < t[2]:
me[1] += 1
elif me[1] > t[2]:
... | s107377733 | Accepted | 445 | 27,300 | 518 | n = int(input())
me = [0,0]
arr = []
tmp = 0
flg = True
for i in range(n):
arr += [list(map(int,input().split()))]
for t in arr:
for _ in range(t[0]-tmp):
if me[0] < t[1]:
me[0] += 1
elif me[0] > t[1]:
me[0] -= 1
elif me[1] < t[2]:
me[1] += 1
... |
s848455642 | p03377 | u367130284 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 68 | 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());print("NYoe s"[x in range(a,b+1)::2]) | s954304455 | Accepted | 17 | 2,940 | 70 | a,b,x=map(int,input().split());print("NYOE S"[x in range(a,a+b+1)::2]) |
s380069310 | p02669 | u169138653 | 2,000 | 1,048,576 | Wrong Answer | 420 | 11,140 | 784 | You start with the number 0 and you want to reach the number N. You can change the number, paying a certain amount of coins, with the following operations: * Multiply the number by 2, paying A coins. * Multiply the number by 3, paying B coins. * Multiply the number by 5, paying C coins. * Increase or decrease... | from math import ceil
import sys
sys.setrecursionlimit(10**7)
memo=dict()
def dfs(x,a,b,c,d):
if x==0:
return 0
if x==1:
return d
if x in memo:
return memo[x]
l2=2*(x//2)
r2=2*ceil(x/2)
l3=3*(x//3)
r3=3*ceil(x/3)
l5=5*(x//5)
r5=5*ceil(x/5)
mini=10**18
... | s202302455 | Accepted | 378 | 10,948 | 765 | import sys
sys.setrecursionlimit(10**7)
t=int(input())
for _ in range(t):
memo=dict()
n,a,b,c,d=map(int,input().split())
def dfs(x):
if x==0:
return 0
if x==1:
return d
if x in memo:
return memo[x]
l2=2*(x//2)
r2=2*(-(-x//2))
... |
s823325649 | p03006 | u832039789 | 2,000 | 1,048,576 | Wrong Answer | 1,812 | 5,720 | 1,224 | 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... | from fractions import gcd
n = int(input())
l = []
for i in range(n):
x,y = map(int,input().split())
l.append([x, y])
res = 10 ** 100
for i in range(n):
for j in range(i + 1, n):
sa = []
invalid = False
for p,q in zip(l[i], l[j]):
sa.append(p - q)
if not invalid... | s490229111 | Accepted | 394 | 3,064 | 1,630 | n = int(input())
if n == 1:
print(1)
exit()
l = []
for i in range(n):
x,y = map(int,input().split())
l.append([x, y])
res = 10 ** 100
for i in range(n):
for j in range(i + 1, n):
sa = []
invalid = False
for p,q in zip(l[i], l[j]):
sa.append(p - q)
cnt =... |
s838259924 | p02608 | u970267139 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,176 | 338 | 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). | from math import sqrt
from math import floor
n = int(input())
for i in range(n):
n2 = floor(sqrt(i))
ans = 0
for x in range(1, n2):
for y in range(1, n2):
for z in range(1, n2):
if i == pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x:
ans +=... | s242933217 | Accepted | 916 | 9,128 | 263 | n = int(input())
ans = [0] * n
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
a = x**2 + y**2 + z**2 + x*y + y*z + z*x
if a >= 1 and a <= n:
ans[a - 1] += 1
for a in ans:
print(a)
|
s644607464 | p03067 | u756604554 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 88 | 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 b > c:
print('yes')
else:
print('no') | s087644086 | Accepted | 17 | 3,060 | 326 | a, b, c = map(int, input().split(' '))
if a > b and b > c and a > c:
print('No')
if a > c and a > b and c > b:
print('Yes')
elif b > a and b > c and a > c:
print('No')
elif b > c and c > a and b > a:
print('Yes')
elif c > a and c > b and a > b:
print('No')
elif c > b and c > a and b > a:
print... |
s770895678 | p03997 | u761565491 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h*0.5) | s314131814 | Accepted | 17 | 2,940 | 75 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h*0.5)) |
s359125718 | p03089 | u143492911 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 330 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | n=int(input())
B=list(map(int,input().split()))
flag=True
ans=[]
while flag and len(B):
for i in range(len(B)-1,-1,-1):
if B[i]==i+1:
del B[i]
ans.append(i+1)
break
else:
flag=False
break
if not flag:
print(-1)
else:
for anse in ans:
pr... | s372930740 | Accepted | 18 | 3,060 | 330 | n=int(input())
B=list(map(int,input().split()))
flag=True
ans=[]
while flag and len(B):
for i in range(len(B)-1,-1,-1):
if B[i]==i+1:
del B[i]
ans.append(i+1)
break
else:
flag=False
break
if not flag:
print(-1)
else:
for i in ans[::-1]:
... |
s642454360 | p04030 | u973108807 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | s = input()
ans = ""
for k in s:
if k == 'B':
if len(s) > 0:
ans = ans[:len(s)-1]
else:
ans += k
print(ans) | s703006526 | Accepted | 17 | 2,940 | 126 | s = input()
ans = ""
for k in s:
if k == 'B':
if ans != "":
ans = ans[:len(ans)-1]
else:
ans += k
print(ans) |
s447495980 | p02612 | u911516631 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,136 | 24 | 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. | print(int(input())%1000) | s157941171 | Accepted | 28 | 9,056 | 36 | print((10000 - int(input())) % 1000) |
s927462654 | p02396 | u775586391 | 1,000 | 131,072 | Wrong Answer | 80 | 8,216 | 135 | 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... | l = []
while True:
i = str(input())
if i == '0':
break
else:
l.append(i)
t = 0
for i in l:
print('Case '+str(t)+': '+i) | s138403404 | Accepted | 80 | 8,060 | 144 | l = []
while True:
i = str(input())
if i == '0':
break
else:
l.append(i)
t = 0
for i in l:
t += 1
print('Case '+str(t)+': '+i) |
s911932502 | p03795 | u746419473 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 26 | 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 ... | print(10**int(input())+7)
| s352225294 | Accepted | 17 | 2,940 | 43 | n = int(input())
print(n*800 - n//15*200)
|
s634406394 | p00282 | u221679506 | 1,000 | 131,072 | Wrong Answer | 20 | 7,572 | 315 | 大きな数を表そうとすると、文字数も多くなるし、位取りがわからなくなってしまうので、なかなか面倒です。大きな数をわかりやすく表すために、人々は数の単位を使ってきました。江戸時代に書かれた「塵劫記」という本の中では、数の単位が次のように書かれています。 たとえば、2の100乗のようなとても大きな数は、126穣7650(じょ)6002垓2822京9401兆4967億320万5376と表せます。それでは、正の整数 m と n が与えられたとき、m の n 乗を塵劫記の単位を使って上のように表すプログラムを作成してください。 | s = ("","Man","Oku","Cho","Kei","Gai","Jo",
"Jou","Ko","Kan","Sei","Sai","Gok","Ggs",
"Asg","Nyt","Fks","Mts")
while True:
m,n = map(int,input().split())
if m == 0 and n == 0:
break
ans = ""
for i in range(0,len(str(m**n)),4):
x = m**n//(10**i)%10000#m^n / 10^i
ans = str(x) + s[i//4] + ans
print(ans) | s018085376 | Accepted | 20 | 7,676 | 328 | s = ("","Man","Oku","Cho","Kei","Gai","Jo",
"Jou","Ko","Kan","Sei","Sai","Gok","Ggs",
"Asg","Nyt","Fks","Mts")
while True:
m,n = map(int,input().split())
if m == 0 and n == 0:
break
ans = ""
for i in range(0,len(str(m**n)),4):
x = m**n//(10**i)%10000#m^n / 10^i
if x > 0:
ans = str(x) + s[i//4] + ans
pr... |
s589398269 | p02265 | u150984829 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 175 | Your task is to implement a double linked list. Write a program which performs the following operations: * insert x: insert an element with key x into the front of the list. * delete x: delete the first element which has the key of x from the list. If there is not such element, you need not do anything. * delet... | s=[]
for _ in range(int(input())):
e=input()
if e[0]=='i':s=[e.split()[1]]+s
else:
n=len(s)
if n==6:s.remove(e.split()[1])
elif n%2:s=s[1:]
else:s.pop()
print(*s)
| s781524829 | Accepted | 770 | 69,740 | 268 | import collections,sys
def s():
d=collections.deque()
input()
for e in sys.stdin:
if'i'==e[0]:d.appendleft(e[7:-1])
else:
if' '==e[6]:
m=e[7:-1]
if m in d:d.remove(m)
elif'i'==e[7]:d.popleft()
else:d.pop()
print(*d)
if'__main__'==__name__:s()
|
s047825349 | p03855 | u116348130 | 2,000 | 262,144 | Wrong Answer | 2,107 | 54,912 | 1,379 | There are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities. No two roads connect the same pair of cities. Similarly, no two railways connect the s... | import copy
import itertools
def flatdupdel(fl):
return set(list(itertools.chain.from_iterable(fl)))
def find_root(roads, search):
# s_list = [search]
global rootlist
if len(roads) >= 1 and len(search) >= 1:
for num in search:
list_mutch = []
for ind, road in enumerat... | s928427595 | Accepted | 1,028 | 41,472 | 1,598 | from collections import*
import sys
input = sys.stdin.readline
class UnionFind(object):
def __init__(self, n):
self.parents = [-1 for i in range(n)]
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find... |
s422772805 | p03759 | u248221744 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b, c = list(map(int, input().split()))
if b-a == c-b:
print("Yes")
else:
print("No") | s609057472 | Accepted | 17 | 2,940 | 91 | a, b, c = list(map(int, input().split()))
if b-a == c-b:
print("YES")
else:
print("NO") |
s910809492 | p03433 | u551109821 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | 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-A)%500==0:
print('Yes')
else:
print('No') | s560080922 | Accepted | 17 | 2,940 | 88 | N = int(input())
A = int(input())
if N%500 <= A:
print('Yes')
else:
print('No') |
s346556856 | p03943 | u822353071 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 372 | 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... |
# starttime=time.clock()
A,B,C =input().split()
a=int(A)
b=int(B)
c=int(C)
print(a+c)
if a>b:
temp = a
a = b
b = temp
if b>c:
temp = b
b = c
c = temp
if (a+b)==c:
print("Yes")
else:
print("No")
#
| s487474373 | Accepted | 21 | 3,064 | 176 | a,b,c = map(int,input().split())
if a>b:
temp = a
a = b
b = temp
if b>c:
temp = b
b = c
c = temp
if (a+b)==c:
print("Yes")
else:
print("No")
|
s648968180 | p03605 | u923659712 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | 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") | s720978655 | Accepted | 17 | 2,940 | 71 | n=input()
if n[0]=="9" or n[1]=="9":
print("Yes")
else:
print("No") |
s443657264 | p03672 | u653807637 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 166 | 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... | # encoding:utf-8
S = input()
for i in range(2 , len(S), 2):
mid_p = int((len(S) - i)/2)
if S[0:mid_p] == S[mid_p:(len(S) - i)]:
print(S[0:(len(S) - i)])
break
| s349298245 | Accepted | 17 | 2,940 | 163 | # encoding:utf-8
S = input()
for i in range(2 , len(S), 2):
mid_p = int((len(S) - i)/2)
if S[0:mid_p] == S[mid_p:(len(S) - i)]:
print(int(len(S) - i))
break |
s607839028 | p03352 | u968649733 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 30 | 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. | print(int(int(input())**0.25)) | s845844564 | Accepted | 18 | 3,060 | 212 | X = int(input())
max_v = 1
b = 2
for i in range(2, X):
b =i
for j in range(2,X):
p = j
if b**p > max_v and b**p <= X:
#print(b, p)
max_v = b**p
elif b**p > X:
break
print(max_v) |
s969232746 | p03377 | u608726540 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 116 | 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. | li = list(map(int,input().split()))
if li[0]<=li[2] and li[0]+li[1]>=li[2]:
print('Yes')
else:
print('No')
| s649480629 | Accepted | 17 | 2,940 | 116 | li = list(map(int,input().split()))
if li[0]<=li[2] and li[0]+li[1]>=li[2]:
print('YES')
else:
print('NO')
|
s324316752 | p03089 | u580697892 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 307 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | #coding: utf-8
n = int(input())
a = []
b = list(map(int, input().split()))
b_sort = sorted(b)
cnt = 0
for i in range(1, n+1):
if b_sort[i-1] <= i:
a.append(b_sort[i-1])
else:
pass
print(a)
if len(a) == len(b_sort):
for i in range(len(a)):
print(a[i])
else:
print(-1)
| s897297971 | Accepted | 20 | 3,064 | 371 | #coding: utf-8
n = int(input())
a = []
b = list(map(int, input().split()))
flag = True
for _ in range(n):
add = 0
for j in range(1, len(b)+1):
if j == b[j-1]:
add = max(add, j)
if add == 0:
flag = False
break
a.append(add)
del b[add-1]
if flag:
for i in range(... |
s474864769 | p02277 | u657361950 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 867 | 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 ... |
class Card:
def __init__(self, m, n, o):
self.m = m
self.n = n
self.o = o
def __str__(self):
return str(self.m + ' ' + str(self.n))
def swap(a, i, j):
tmp = a[i]
a[i] = a[j]
a[j] = tmp
def partition(a, f, c):
x = a[c].n
i = f - 1
for j in range(f, c):
if a[j].n <= x:
i += 1
swap(a, i, j)
sw... | s712210441 | Accepted | 1,410 | 29,656 | 880 |
class Card:
def __init__(self, m, n, o):
self.m = m
self.n = n
self.o = o
def __str__(self):
return str(self.m + ' ' + str(self.n))
def swap(a, i, j):
tmp = a[i]
a[i] = a[j]
a[j] = tmp
def partition(a, f, c):
x = a[c].n
i = f - 1
for j in range(f, c):
if a[j].n <= x:
i += 1
swap(a, i, j)
sw... |
s713362409 | p03997 | u956866689 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 92 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | # -*- coding:utf-8 -*-
a = int(input())
b = int(input())
h= int(input())
print((a+b)*h/2)
| s567304669 | Accepted | 18 | 2,940 | 97 | # -*- coding:utf-8 -*-
a = int(input())
b = int(input())
h= int(input())
print(int((a+b)*h/2))
|
s387580759 | p03227 | u683134447 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 70 | 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. | s = input()
if len(s) == 3:
print(reversed(s))
else:
print(s) | s624623084 | Accepted | 17 | 2,940 | 66 | s = input()
if len(s) == 3:
print(s[::-1])
else:
print(s) |
s151864059 | p03339 | u013408661 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 5,916 | 324 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | n=int(input())
line=list(str(input()))
def turn_e(x):
count=0
for i in range(x):
if line[x]=='W':
count+=1
return count
def turn_w(x):
count=0
for i in range(x+1,n):
if line[x]=='E':
count+=1
return count
v=n
for i in range(n):
if (turn_e(i)+turn_w(i))<v:
v=turn_e(i)+turn_w(i)
prin... | s554639144 | Accepted | 195 | 3,700 | 163 | n=int(input())
s=input()
e=s.count('E')
w=0
ans=e+w
p=0
for i in s:
if p==1:
w+=1
p=0
if i=='E':
e-=1
else:
p=1
ans=min(ans,e+w)
print(ans) |
s022262598 | p03457 | u530786533 | 2,000 | 262,144 | Wrong Answer | 32 | 9,192 | 261 | 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())
curx, cury = 0, 0
ans = 'Yes'
prev_t = 0
for _ in range(n):
t, x, y = map(int, input().split())
d = abs(x - curx) + abs(y - cury)
if d > (t - prev_t) or (t - prev_t) % 2 != d % 2:
ans = 'No'
break
prev_t = t
print(ans)
| s824066711 | Accepted | 228 | 9,188 | 271 | n = int(input())
curt, curx, cury = 0, 0, 0
ans = 'Yes'
for _ in range(n):
t, x, y = map(int, input().split())
d = abs(x - curx) + abs(y - cury)
if d > (t - curt) or (t - curt) % 2 != d % 2:
ans = 'No'
break
curt, curx, cury = t, x, y
print(ans)
|
s846440313 | p00042 | u301729341 | 1,000 | 131,072 | Wrong Answer | 30 | 7,756 | 629 | 宝物がたくさん収蔵されている博物館に、泥棒が大きな風呂敷を一つだけ持って忍び込みました。盗み出したいものはたくさんありますが、風呂敷が耐えられる重さが限られており、これを超えると風呂敷が破れてしまいます。そこで泥棒は、用意した風呂敷を破らず且つ最も価値が高くなるようなお宝の組み合わせを考えなくてはなりません。 風呂敷が耐えられる重さ W、および博物館にある個々のお宝の価値と重さを読み込んで、重さの総和が W を超えない範囲で価値の総和が最大になるときの、お宝の価値総和と重さの総和を出力するプログラムを作成してください。ただし、価値の総和が最大になる組み合わせが複数あるときは、重さの総和が小さいものを出力することとします。 | C_num = 1
while True:
Nap = []
W = int(input())
if W == 0:
break
N = int(input())
for i in range(N):
v,w = map(int,input().split(","))
Nap.append([v,w])
DP = [[0 for j in range(W + 1)] for i in range(N + 1)]
for i in range(1,N+1):
for j in range(W+1):
... | s079563928 | Accepted | 1,240 | 20,020 | 644 | C_num = 1
while True:
Nap = []
W = int(input())
if W == 0:
break
N = int(input())
for i in range(N):
v,w = map(int,input().split(","))
Nap.append([v,w])
DP = [[0 for j in range(W + 1)] for i in range(N + 1)]
for i in range(1,N+1):
for j in range(W+1):
... |
s570499261 | p03160 | u863370423 | 2,000 | 1,048,576 | Wrong Answer | 151 | 13,928 | 284 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... |
N = int(input());
salto = [int(i) for i in input().split()];
Costo = [float('inf')]*(N - 2)+[0, abs(salto[1] - salto[0])] ;
for i in range(2, N):
Costo[i] = min(Costo[i - 2] + abs(salto[i] - salto[i - 2]), Costo[i - 1] + abs(salto[i] - salto[i - 1]));
print(Costo[N - 1]); | s830327515 | Accepted | 117 | 20,572 | 202 | n=int(input())
h=list(map(int,input().split()))
dp=[0]*(n+1)
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))
# print(dp)
print(dp[-2])
|
s443584726 | p04011 | u409064224 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | 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. | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
print(x*n)
else:
print(x*n+(k-n)*y) | s421213584 | Accepted | 17 | 2,940 | 120 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n > k:
print(k*x + (n-k)*y)
else:
print(n*x) |
s417697833 | p03485 | u294385082 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | from math import ceil
a,b = map(int,input().split())
print(ceil(a*b)) | s377410534 | Accepted | 17 | 2,940 | 75 | from math import ceil
a,b = map(int,input().split())
print(ceil((a+b)/2))
|
s230910796 | p00001 | u584935933 | 1,000 | 131,072 | Wrong Answer | 30 | 7,388 | 480 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | inp=[]
for i in range(0,10):
inp.append(input())
INP=[0,0,0,0,0,0,0,0,0,0]
for i in range(0,10):
for j in range(i+1,10):
if inp[i]==inp[j]:
INP[i]+=1
INP[j]+=1
elif inp[i]<inp[j]:
INP[j]+=1
else:
INP[i]+=1
z = 0
for i in range(9,-1,-1)... | s535362378 | Accepted | 20 | 7,648 | 498 | a=[]
for i in range(0,10):
a.append(input())
inp = list(map(int,a))
INP=[0,0,0,0,0,0,0,0,0,0]
for i in range(0,10):
for j in range(i+1,10):
if inp[i]<inp[j]:
INP[j]+=1
elif inp[i]>inp[j]:
INP[i]+=1
else:
INP[i]+=1
INP[j]+=1
z = 0
for i... |
s339141063 | p02659 | u165318982 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,064 | 86 | Compute A \times B, truncate its fractional part, and print the result as an integer. | import math
A, B = list(map(float, input().split()))
ans = math.ceil(A * B)
print(ans) | s570871074 | Accepted | 34 | 10,064 | 102 |
from decimal import Decimal
import math
a, b = input().split()
print(math.floor(int(a) * Decimal(b))) |
s129797437 | p03455 | u693694535 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b=map(int,input().split())
if a%2==0:
print('Even')
else:
print('Odd') | s681845694 | Accepted | 17 | 2,940 | 81 | a,b=map(int,input().split())
if (a*b)%2==0:
print('Even')
else:
print('Odd') |
s298359345 | p03473 | u568426505 | 2,000 | 262,144 | Wrong Answer | 26 | 9,044 | 22 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | print(int(input())+24) | s593857853 | Accepted | 24 | 8,976 | 22 | print(48-int(input())) |
s772571755 | p03711 | u470542271 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 160 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | x, y = map(int, input().split())
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
print((x in l1 and y in l1) or (x in l2 and y in l2) or (x in l3 and y in l3))
| s945475356 | Accepted | 17 | 2,940 | 198 | x, y = map(int, input().split())
l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
if ((x in l1 and y in l1) or (x in l2 and y in l2) or (x in l3 and y in l3)):
print('Yes')
else:
print('No')
|
s908264052 | p03737 | u064246852 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | print(str.upper("".join(input().split()))) | s277188798 | Accepted | 18 | 2,940 | 61 | print(str.upper("".join(map(lambda x:x[0],input().split())))) |
s957062706 | p03485 | u782269159 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a, b = map(int, input().split())
c = -(-(a+b)/2)
print(c) | s593433152 | Accepted | 17 | 2,940 | 60 | a, b = map(int, input().split())
c = -(-(a+b)//2)
print(c) |
s427133859 | p03659 | u853900545 | 2,000 | 262,144 | Wrong Answer | 2,108 | 24,820 | 192 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | n = int(input())
a = list(map(int,input().split()))
c = 10**9
if n == 2:
print(a[0]-a[1])
else:
for i in range(n-2):
c = min(c,abs(sum(a[:n-1-i:])-sum(a[n:1+i:-1])))
print(c) | s689473510 | Accepted | 172 | 24,824 | 239 | n = int(input())
a = list(map(int,input().split()))
A = sum(a[:n-1])-a[n-1]
c = n*(10**9)
c = min(c,abs(A))
if n == 2:
print(abs(a[0]-a[1]))
else:
for i in range(1,n-2):
A=A-2*a[n-1-i]
c = min(c,abs(A))
print(c) |
s975687380 | p03478 | u815659544 | 2,000 | 262,144 | Wrong Answer | 52 | 2,940 | 223 | 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). | l = list(map(int, input().split()))
cursum = 0
for n in range(1, l[0]+1):
s = 0
x = n
while x > 0:
s += x % 10
x = int(x/10)
if s <= l[2] and s >= l[1]:
cursum += n
print(n) | s413523548 | Accepted | 30 | 2,940 | 161 | n,a,b = map(int, input().split())
cursum = 0
for x in range(1, n+1):
y = sum(map(int, str(x)))
if a <= y and y <= b:
cursum += x
print(cursum) |
s579713702 | p03163 | u558242240 | 2,000 | 1,048,576 | Wrong Answer | 2,108 | 18,920 | 394 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find ... | import numpy as np
n, w = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(n)]
dp = np.zeros((n+1, w), np.int64)
for i in range(n):
for sum_w in range(w):
wi = wv[i][0]
vi = wv[i][1]
if sum_w - wi >= 0:
dp[i+1][sum_w] = dp[i][sum_w - wi] + vi
... | s549587108 | Accepted | 299 | 91,480 | 284 | import numpy as np
n, w = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(n)]
dp = np.zeros((n+1, w+1), np.int64)
for i, (wi, vi) in enumerate(wv):
dp[i + 1] = dp[i]
np.maximum(dp[i+1][wi:], dp[i][:-wi] + vi, out=dp[i+1][wi:])
print(dp[n, w]) |
s035167208 | p02861 | u026862065 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 324 | There are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \sqrt{\left(x_i- x_j\right)^2+\left(y_i-y_j\right)^2}. There are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the firs... | n = int(input())
l, l1, l2 = list(""), list(""), list("")
for i in range(n):
x, y = map(int, input().split())
l1.append(x)
l2.append(y)
for i in range(n - 1):
for j in range(i + 1, n):
l.append(((l1[i] -l1[j]) ** 2 + (l2[i] - l2[j]) ** 2) ** 0.5)
print(l)
print('{:.10f}'.format(2 * sum(l) / len(... | s090699354 | Accepted | 17 | 3,064 | 310 | n = int(input())
l, l1, l2 = list(""), list(""), list("")
for i in range(n):
x, y = map(int, input().split())
l1.append(x)
l2.append(y)
for i in range(n - 1):
for j in range(i + 1, n):
l.append(((l1[i] -l1[j]) ** 2 + (l2[i] - l2[j]) ** 2) ** 0.5)
print('{:.10f}'.format(2 * sum(l) / n)) |
s896125756 | p02742 | u667024514 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 57 | 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... | n,m=map(int,input().split())
print((n//2+n%1)*(m//2+m%2)) | s394662373 | Accepted | 17 | 2,940 | 108 | import math
h,w = map(int,input().split())
if h == 1 or w == 1:
print(1)
else:
print(math.ceil((h*w)/2)) |
s700936854 | p03494 | u830054172 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 285 | 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 = [int(l) for l in input().split()]
count1 = 0
k = 0
while True:
count2 = 0
for i in range(N):
if A[i]/2** k % 2 !=0:
break
else:
count2 += 1
if count2 == N:
count1 += 1
else:
break
k += 1 | s483031887 | Accepted | 19 | 2,940 | 175 | n = int(input())
a = list(map(int, input().split()))
ans = []
for i in a:
cnt = 0
while i%2 == 0:
i /= 2
cnt += 1
ans.append(cnt)
print(min(ans)) |
s651231294 | p03434 | u279229189 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 482 | 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... | data = [input() for x in range(0, 2, 1)]
cards = [int(x) for x in data[1].split(" ")]
for i in range(0, len(cards), 1):
for j in range(i + 1, len(cards), 1):
if cards[i] > cards[j]:
tmp1 = cards[i]
tmp2 = cards[j]
cards[i] = tmp2
cards[j] = tmp1
print(cards)
alice... | s572295401 | Accepted | 18 | 3,064 | 468 | data = [input() for x in range(0, 2, 1)]
cards = [int(x) for x in data[1].split(" ")]
for i in range(0, len(cards), 1):
for j in range(i + 1, len(cards), 1):
if cards[i] < cards[j]:
tmp1 = cards[i]
tmp2 = cards[j]
cards[i] = tmp2
cards[j] = tmp1
alice = 0
bob = 0
... |
s488197800 | p04012 | u592248346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | 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())
x = set(w)
for i in x:
if w.count(i)%2!=0:
print("NO")
break
else:
print("YES")
| s756633982 | Accepted | 19 | 2,940 | 121 | w = list(input())
x = set(w)
for i in x:
if w.count(i)%2!=0:
print("No")
break
else:
print("Yes") |
s139896119 | p00008 | u301461168 | 1,000 | 131,072 | Wrong Answer | 30 | 7,536 | 228 | Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). | n = int(input().rstrip())
cnt = 0
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a + b + c + d == n:
cnt = cnt + 1
print(str(cnt)) | s624323176 | Accepted | 190 | 7,492 | 342 | while True:
try:
cnt = 0
n = int(input())
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a + b + c + d == n:
cnt = cnt + 1
print(str(cnt))
exce... |
s666514641 | p03139 | u225388820 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 59 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | n,a,b=map(int,input().split())
print(max(a+b-n,0),min(a,b)) | s138223808 | Accepted | 17 | 2,940 | 59 | n,a,b=map(int,input().split())
print(min(a,b),max(a+b-n,0)) |
s577095374 | p03657 | u201082459 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 95 | 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())
if a+b % 3 == 0:
print('Possible')
else:
print('Impossible') | s363555063 | Accepted | 17 | 2,940 | 171 | a,b = map(int,input().split())
if (a+b) % 3 == 0:
print('Possible')
elif a % 3 == 0:
print('Possible')
elif b % 3 == 0:
print('Possible')
else:
print('Impossible') |
s914629371 | p03623 | u798316285 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | 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... | s=input()
for i in range(ord("a"),ord("z")+1):
if chr(i) not in s:
print(chr(i))
break
else:
print("None") | s592699872 | Accepted | 17 | 2,940 | 71 | x,a,b=map(int,input().split())
print("A" if abs(x-a)<abs(x-b) else "B") |
s935761581 | p03623 | u608726540 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | 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())
if abs(x-a)>abs(x-b):
print('A')
else:
print('B')
| s075888704 | Accepted | 17 | 2,940 | 89 | x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
print('A')
else:
print('B')
|
s039322914 | p03359 | u219369949 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 83 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a, b = map(int, input().split())
if a > b + 1:
print(a)
else:
print(a + 1) | s464787081 | Accepted | 17 | 2,940 | 79 | a, b = map(int, input().split())
if a > b:
print(a - 1)
else:
print(a) |
s586830234 | p03672 | u739843002 | 2,000 | 262,144 | Wrong Answer | 24 | 9,048 | 242 | 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... | def isEvenStr(s):
if len(s) % 2 == 1:
return False
elif s[0:int(len(s)/2)] == s[int(len(s)/2):]:
return True
else:
return False
s = input()
i = 0
while not isEvenStr(s):
s = s[:-1]
i += 1
if isEvenStr(s):
print(i) | s394754981 | Accepted | 24 | 9,036 | 268 | def isEvenStr(s):
if len(s) % 2 == 1:
return False
elif s[0:int(len(s)/2)] == s[int(len(s)/2):]:
return True
else:
return False
s = input()
l = len(s)
i = 0
while not isEvenStr(s) or i == 0:
s = s[:-1]
i += 1
if isEvenStr(s):
print(l - i) |
s405543523 | p03695 | u644907318 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 541 | 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 = sorted(list(map(int,input().split())))
G = {i:0 for i in range(9)}
for i in range(N):
if A[i]<=399:
G[0] += 1
elif A[i]<=799:
G[1] += 1
elif A[i]<=1199:
G[2] += 1
elif A[i] <= 1599:
G[3] += 1
elif A[i] <= 1999:
G[4] += 1
elif A[i] <= 2... | s680190503 | Accepted | 17 | 3,064 | 612 | N = int(input())
A = sorted(list(map(int,input().split())))
G = {i:0 for i in range(9)}
for i in range(N):
if A[i]<=399:
G[0] += 1
elif A[i]<=799:
G[1] += 1
elif A[i]<=1199:
G[2] += 1
elif A[i] <= 1599:
G[3] += 1
elif A[i] <= 1999:
G[4] += 1
elif A[i] <= 2... |
s721033324 | p03448 | u516494592 | 2,000 | 262,144 | Wrong Answer | 54 | 3,316 | 282 | 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 = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
total = 500 * A + 100 * B + 50 * C
if total == X:
count = count + 1
print(count) | s746558790 | Accepted | 55 | 3,060 | 282 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A + 1):
for b in range(B + 1):
for c in range(C + 1):
total = 500 * a + 100 * b + 50 * c
if total == X:
count = count + 1
print(count) |
s062839152 | p02409 | u442346200 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 332 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for c in range(n):
(b, f, r, v) = [int(i) for i in input().split()]
data[b-1][f-1][r-1] += v
for b in range(4):
for f in range(3):
for r in range(10):
print(' {0}'.format(data[b][f][r]), end='')
print()
pri... | s158287288 | Accepted | 30 | 6,724 | 378 | data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
count = int(input())
for c in range(count):
(b, f, r, v) = [int(x) for x in input().split()]
data[b - 1][f - 1][r - 1] += v
for b in range(4):
for f in range(3):
for r in range(10):
print('',data[b][f][r], end... |
s092887595 | p00038 | u075836834 | 1,000 | 131,072 | Wrong Answer | 50 | 7,620 | 840 | ポーカーの手札データを読み込んで、それぞれについてその役を出力するプログラムを作成してください。ただし、この問題では、以下のルールに従います。 * ポーカーはトランプ 5 枚で行う競技です。 * 同じ数字のカードは 5 枚以上ありません。 * ジョーカーは無いものとします。 * 以下のポーカーの役だけを考えるものとします。(番号が大きいほど役が高くなります。) 1. 役なし(以下に挙げるどれにも当てはまらない) 2. ワンペア(2 枚の同じ数字のカードが1 組ある) 3. ツーペア(2 枚の同じ数字のカードが2 組ある) 4. スリーカード(3 枚の同じ数字のカードが1 組ある) 5. ストレ... | def function(a,b,c,d,e):
A=[a,b,c,d,e]
A.sort()
#4card
if A[0]==A[1]==A[2]==A[3] or A[1]==A[2]==A[3]==A[4]:
print("four card")
#Full house
elif (A[0]==A[1] and A[2]==A[3]==A[4]) or (A[0]==A[1]==A[2] and A[3]==A[4]):
print("full house")
#straight A?????????
elif A[0]==1 and A[1]==10 and A[2]==11 and A[3]==12... | s640366106 | Accepted | 30 | 7,752 | 694 | def function(a,b,c,d,e):
A=[a,b,c,d,e]
A.sort()
if A[0]==A[3] or A[1]==A[4]:
print("four card")
elif (A[0]==A[1] and A[2]==A[4]) or (A[0]==A[2] and A[3]==A[4]):
print("full house")
elif A[0]==A[2] or A[1]==A[3] or A[2]==A[4]:
print("three card")
elif (A[0]==A[1] and A[2]==A[3]) or (A[0]==A[1] and A[3]==A[4... |
s109737899 | p02268 | u153665391 | 1,000 | 131,072 | Wrong Answer | 20 | 7,760 | 618 | You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S. | def binary_search(S, n, index ):
if S[index] == n:
return 'eq'
elif S[index] < n:
return 'bt'
elif S[index] > n:
return 'lt'
n = int(input())
S = [int(i) for i in input().split()]
q = int(input())
T = [int(i) for i in input().split()]
cnt = 0
for i in T:
mini = 0
maxi = len... | s128915765 | Accepted | 390 | 16,708 | 519 | N = int(input())
S = list(map(int, input().split()))
Q = int(input())
T = list(map(int, input().split()))
def binary_search(target_num, head, tail):
while head <= tail:
idx = int((head+tail)/2)
if target_num == S[idx]:
return True
elif target_num < S[idx]:
tail = idx... |
s411442969 | p02694 | u285891772 | 2,000 | 1,048,576 | Wrong Answer | 30 | 10,072 | 828 | 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 sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... | s813814338 | Accepted | 29 | 10,040 | 825 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, a... |
s700587922 | p03160 | u755215227 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 20 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | times = int(input()) | s355295368 | Accepted | 157 | 14,400 | 400 | times = int(input())
line = input()
list1 = []
if times <= 1:
print("%s" % 0)
else:
for i in line.split():
if i:
list1.append(int(i))
mem = [0] * times
mem[-2] = abs(list1[-1] - list1[-2])
for i in range(len(list1)-3, -1, -1):
step1 = abs(list1[i] - list1[i+1]) + mem[i+1]
step2 = abs(list1[i... |
s484933864 | p03827 | u128914900 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | 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... | n = int(input())
s = input()
x = 0
for i in range(n):
if s[i] == "I":
x +=1
else:
x = x-1
print(x) | s182307923 | Accepted | 18 | 3,060 | 180 | n = int(input())
s = input()
x = 0
result = 0
for i in range(n):
if s[i] == "I":
x +=1
result = max(x,result)
else:
x = x-1
result = max(x,result)
print(result) |
s653097789 | p03549 | u521323621 | 2,000 | 262,144 | Wrong Answer | 95 | 9,400 | 186 | Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th... | import math
n,m = map(int, input().split())
ans = 0
time = (n-m) * 100 + m * 1900
for i in range(1,100000):
ans += pow(1-pow(0.5,m),i-1) * pow(0.5,m) * time * i
print(math.ceil(ans)) | s245216834 | Accepted | 678 | 9,596 | 297 | import math
n,m = map(int, input().split())
ans = 0
time = (n-m) * 100 + m * 1900
for i in range(1, 1000000):
ans += pow(1-pow(0.5,m),i-1) * pow(0.5,m) * time * i
temp = math.ceil(ans)
if str(temp)[-1] == "1":
print(temp - 1)
elif str(temp)[-1] == "9":
print(temp + 1)
else:
print(temp) |
s234206312 | p02645 | u366424761 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,084 | 30 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | s = str(input())
print(s[0:2]) | s331218026 | Accepted | 20 | 9,020 | 25 | s = input()
print(s[0:3]) |
s544176328 | p03610 | u080990738 | 2,000 | 262,144 | Wrong Answer | 66 | 3,188 | 174 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | alphabet="abcdefghijklmnopqrstuvwxyz"
st=input()
s=""
for i in range(0,len(st)):
if alphabet.index(st[i]) % 2 == 0:
s+=str(st[i])
else:
pass
print(s)
| s548080130 | Accepted | 41 | 3,188 | 115 | st=input()
s=""
for i in range(0,len(st)):
if i % 2 ==0:
s+=str(st[i])
else:
pass
print(s)
|
s823829530 | p04012 | u396391104 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 80 | 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())
print("Yes") if len(w) == len(list(set(w)))*2 else print("No") | s171953008 | Accepted | 17 | 2,940 | 88 | w = list(input())
for c in w:
if w.count(c)%2:
print("No")
exit()
print("Yes") |
s329113158 | p03448 | u744034042 | 2,000 | 262,144 | Wrong Answer | 46 | 3,060 | 233 | 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 = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a):
for j in range(b):
for k in range(c):
if 500*i + 100*j + 50*k == x:
count += 1
print(int(count)) | s538300467 | Accepted | 50 | 3,064 | 239 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 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:
count += 1
print(int(count)) |
s454962156 | p03680 | u142415823 | 2,000 | 262,144 | Wrong Answer | 191 | 7,080 | 207 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ... | N = int(input())
a = [0 for _ in range(N)]
for i in range(N):
a[i] = int(input())
c = 0
x = 1
while(x != 2):
x = a[x-1]
if not x:
c = -1
break
else:
c += 1
a[x - 1] = False
print(c) | s128559366 | Accepted | 229 | 7,080 | 217 | N = int(input())
a = [0 for _ in range(N)]
for i in range(N):
a[i] = int(input())
c = 0
x = 1
while(x != 2):
nex = a[x-1]
if not nex:
c = -1
break
else:
c += 1
a[x-1] = 0
x = nex
print(c) |
s570627617 | p03352 | u323626540 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 171 | 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. | X = int(input())
ans = 0
if X == 1:
print(1)
exit()
for b in range(2, 32):
p = 0
while b ** (p+1) <= X:
p += 1
ans = max(ans, b**p)
print(ans) | s833020009 | Accepted | 17 | 3,060 | 207 | X = int(input())
ans = 0
if X < 2**2:
print(1)
exit()
for b in range(2, 32):
p = 2
if b ** p > X:
continue
while b ** (p+1) <= X:
p += 1
ans = max(ans, b**p)
print(ans) |
s429875160 | p03433 | u563145186 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | 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())
t = N%500
if t <= A:
print("yes")
else:
print("no")
| s996425555 | Accepted | 17 | 2,940 | 108 | N = int(input())
A = int(input())
t = N%500
if t <= A:
print("Yes")
else:
print("No") |
s270245415 | p03049 | u389679466 | 2,000 | 1,048,576 | Wrong Answer | 35 | 3,956 | 642 | Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. | import math
N = int(input())
l = []
for i in range(N):
l.append(input())
default = sum(['AB' in i for i in l])
print(l)
a = sum([i[-1]=='A' and i[0]!='B' for i in l])
b = sum([i[0]=='B' and i[-1]!='A' for i in l])
ab = sum([i[0]=='B' and i[-1]=='A' for i in l])
# print("a = ", str(a))
# print("b = ", str(b))
... | s983075747 | Accepted | 35 | 3,700 | 595 | # wrong answer...
import math
N = int(input())
l = []
for i in range(N):
l.append(input())
default = sum([i.count('AB') for i in l])
a = sum([i[-1]=='A' and i[0]!='B' for i in l])
b = sum([i[0]=='B' and i[-1]!='A' for i in l])
ab = sum([i[0]=='B' and i[-1]=='A' for i in l])
num = 0
if ab == 0:
num = min(... |
s610122851 | p03693 | u810735437 | 2,000 | 262,144 | Wrong Answer | 64 | 5,844 | 313 | 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... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import re
import string
R, G, B = map(int, input().split())
if int(R + G + B) % 4 == 0:
ans = 'YES'
else:
ans = 'NO'
print(ans)
| s918910123 | Accepted | 41 | 5,460 | 303 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import re
import string
R, G, B = input().split()
if int(R + G + B) % 4 == 0:
ans = 'YES'
else:
ans = 'NO'
print(ans)
|
s522632526 | p03624 | u538956308 | 2,000 | 262,144 | Wrong Answer | 20 | 3,956 | 105 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | S = input()
str = "abcdefghijklmnopqrstuvwxyz"
l1 = list(str)
l2 = list(S)
l3 = set(l1)-set(l2)
print(l3) | s738280449 | Accepted | 21 | 3,956 | 168 | S = input()
str = "abcdefghijklmnopqrstuvwxyz"
l1 = list(str)
l2 = list(S)
l3 = list(set(l1)-set(l2))
l3.sort()
if len(l3)==0:
print("None")
else:
print(l3[0])
|
s038679274 | p02401 | u067975558 | 1,000 | 131,072 | Wrong Answer | 30 | 6,740 | 360 | 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:
i = input().split()
result = 0
if i[1] == '+':
print(int(i[0]) + int(i[2]))
elif i[1] == '-':
print(int(i[0]) - int(i[2]))
elif i[1] == '/':
print(int(i[0]) / int(i[2]))
elif i[1] == '*':
print(int(i[0]) * int(i[2])) ... | s810239461 | Accepted | 40 | 6,732 | 407 | result = []
while True:
i = input().split()
if i[1] == '+':
result = result +[int(i[0]) + int(i[2])]
elif i[1] == '-':
result = result + [int(i[0]) - int(i[2])]
elif i[1] == '/':
result = result + [int(int(i[0]) / int(i[2]))]
elif i[1] == '*':
result = result + [int(i... |
s742988873 | p03502 | u039623862 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 76 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | n = input()
print('Yes' if sum([int(c) for c in n]) % int(n) == 0 else 'No') | s165105586 | Accepted | 19 | 2,940 | 77 | n = input()
print('Yes' if int(n) % sum([int(c) for c in n]) == 0 else 'No') |
s205321075 | p03486 | u143492911 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | 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()
t.reverse()
if s<t:
print("yes")
else:
print("no") | s646615284 | Accepted | 17 | 2,940 | 108 | s=list(input())
t=list(input())
s.sort()
t.sort()
t.reverse()
if s<t:
print("Yes")
else:
print("No") |
s481404564 | p03679 | u167908302 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 143 | 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... | #coding:utf-8
x, a, b = map(int, input().split())
if a <= b:
print('delicious')
elif (a+x) <= b:
print('safe')
else:
print('dangerous') | s565436994 | Accepted | 17 | 2,940 | 144 | #coding:utf-8
x, a, b = map(int, input().split())
if a >= b:
print('delicious')
elif (a+x) >= b:
print('safe')
else:
print('dangerous')
|
s908073046 | p03778 | u143051858 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | W,a,b = map(int,input().split())
if a+W < b:
print(abs(b-a+W))
elif b+W < a:
print(abs(b+W-a))
else:
print(0) | s116336088 | Accepted | 18 | 2,940 | 122 | W,a,b = map(int,input().split())
if a+W < b:
print(abs(a+W-b))
elif b+W < a:
print(abs(b+W-a))
else:
print(0) |
s544407584 | p03163 | u059436995 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 351 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find ... | n, W =map(int,input().split())
w = [0] * n
v = [0] * n
for i in range(n):
w[i], v[i] = map(int, input().split())
def ks(W,w,v,n):
if n == 0 or W == 0 :
return 0
if (w[n-1] > W):
return ks(W, w, v, n - 1)
else:
return max(v[n - 1] + ks(W - w[n - 1], w, v, n - 1),
... | s981778223 | Accepted | 290 | 18,208 | 207 | import numpy as np
N,W = map(int,input().split())
ndp = np.zeros(W+1,dtype= np.int64)
for _ in range(N):
w,v = map(int,input().split())
np.maximum(ndp[:-w] + v, ndp[w:], out = ndp[w:])
print(ndp[-1]) |
s205510903 | p03997 | u156346531 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 134 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | ue = int(input("上底:"))
sita = int(input("下底:"))
takasa = int(input("高さ:"))
men = (ue+sita)*takasa/2
print(int(men))
| s885857293 | Accepted | 17 | 2,940 | 101 | ue = int(input())
sita = int(input())
takasa = int(input())
men = (ue+sita)*takasa/2
print(int(men))
|
s800882895 | p03796 | u537782349 | 2,000 | 262,144 | Wrong Answer | 35 | 2,940 | 90 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | a = int(input())
b = 1
for i in range(a, 0, -1):
b = b * i % (10 ** 9 + 7)
print(b+b)
| s313116931 | Accepted | 34 | 2,940 | 90 | a = int(input())
b = 1
for i in range(1, a + 1):
b = (b * i) % (10 ** 9 + 7)
print(b)
|
s603857777 | p02694 | u973013625 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,156 | 88 | 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... | x = int(input())
a = 100
c = 0
while a <= x:
a += int(a * 0.01)
c += 1
print(c) | s765060152 | Accepted | 23 | 9,160 | 87 | x = int(input())
a = 100
c = 0
while a < x:
a += int(a * 0.01)
c += 1
print(c) |
s933247708 | p02314 | u957470671 | 1,000 | 131,072 | Wrong Answer | 20 | 5,612 | 241 | Find the minimum number of coins to make change for n cents using coins of denominations d1, d2,.., dm. The coins can be used any number of times. | n, m = input().split()
n, m = int(n), int(m)
C = [int(c) for c in input().split()]
# Coin Changing Problem
INF = float('inf')
T = [INF] * n
T[0] = 0
for c in C:
for j in range(c, n):
T[j] = min(T[j], T[j - c] + 1)
print(T[-1]) | s639840254 | Accepted | 530 | 7,524 | 230 | n, m = input().split()
n, m = int(n), int(m)
C = [int(c) for c in input().split()]
# Coin Changing Problem
T = [0] + [float('inf')] * n
for c in C:
for j in range(c, n+1):
T[j] = min(T[j], T[j - c] + 1)
print(T[-1]) |
s345803894 | p02261 | u370086573 | 1,000 | 131,072 | Wrong Answer | 30 | 7,740 | 1,044 | 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 bubble_sort(r, n):
flag = True
while flag:
flag = False
for i in range(n - 1, 0, -1):
if r[i - 1][1] > r[i][1]:
r[i - 1], r[i] = r[i], r[i - 1]
flag = True
return r
def select_sort(r, n):
for i in range(0, n):
minj = i
f... | s775073974 | Accepted | 120 | 7,848 | 1,173 | def selectionSort(n, A):
cnt = 0
for i in range(n):
minj = i
for j in range(i, n):
if A[minj][1] > A[j][1]:
minj = j
if i != minj:
A[i], A[minj] = A[minj], A[i]
cnt += 1
return A
def bubbleSort(n, A):
flag = True
cnt = 0
... |
s482453211 | p03944 | u595716769 | 2,000 | 262,144 | Wrong Answer | 186 | 3,316 | 725 | 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())
L = []
for i in range(n):
L.append([int(i) for i in input().split()])
Z = [[1]*w for i in range(h)]
print(Z)
for i in range(n):
if L[i][2] == 1:
for j in range(h):
for k in range(w):
if k < L[i][0]:
Z[j][k] = 0
elif L[i][2] == 2:
for j in range... | s309572633 | Accepted | 178 | 3,188 | 706 | w, h, n = map(int, input().split())
L = []
for i in range(n):
L.append([int(i) for i in input().split()])
Z = [[1]*w for i in range(h)]
for i in range(n):
if L[i][2] == 1:
for j in range(h):
for k in range(w):
if k < L[i][0]:
Z[j][k] = 0
elif L[i][2] == 2:
for j in range(h):
... |
s105196805 | p01131 | u509775126 | 8,000 | 131,072 | Wrong Answer | 70 | 5,620 | 449 | Alice さんは Miku さんに携帯電話でメールを送ろうとしている。 携帯電話には入力に使えるボタンは数字のボタンしかない。 そこで、文字の入力をするために数字ボタンを何度か押して文字の入力を行う。携帯電話の数字ボタンには、次の文字が割り当てられており、ボタン 0 は確定ボタンが割り当てられている。この携帯電話では 1 文字の入力が終わったら必ず確定ボタンを押すことになっている。 * 1: . , ! ? (スペース) * 2: a b c * 3: d e f * 4: g h i * 5: j k l * 6: m n o * 7: p q r s * 8: t u v ... | n = int(input())
string = ["", ".,!?", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"]
for i in range(n):
s = input()
count = 0
num = int(s[0])
for c, c1 in zip(s, s[1:]):
if c == c1:
count += 1
else:
if num != 0:
print(string[num][count ... | s298654014 | Accepted | 60 | 5,624 | 460 | n = int(input())
string = ["", ".,!? ", "abc", "def", "ghi",
"jkl", "mno", "pqrs", "tuv", "wxyz"]
for i in range(n):
s = input()
count = 0
num = int(s[0])
for c, c1 in zip(s, s[1:]):
if c == c1:
count += 1
else:
if num != 0:
print(string[... |
s338066952 | p03623 | u674588203 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 60 | 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))) | s698030655 | Accepted | 17 | 2,940 | 112 | x,a,b=map(int,input().split())
DisXA=abs(a-x)
DisXB=abs(b-x)
if DisXA<DisXB:
print('A')
else:
print('B') |
s054385453 | p03997 | u598016178 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | print((int(input())+int(input()))*int(input())/2) | s489305513 | Accepted | 17 | 2,940 | 50 | print((int(input())+int(input()))*int(input())//2) |
s325023429 | p03679 | u955248595 | 2,000 | 262,144 | Wrong Answer | 26 | 9,096 | 101 | 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(T) for T in input().split())
['delicious','safe','dangerous'][(B-A>0)*(1+((X-(B-A))<0))] | s469967448 | Accepted | 29 | 9,028 | 108 | X,A,B = (int(T) for T in input().split())
print(['delicious','safe','dangerous'][(B-A>0)*(1+((X-(B-A))<0))]) |
s650800071 | p03591 | u157461801 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 171 | Ringo is giving a present to Snuke. Ringo has found out that Snuke loves _yakiniku_ (a Japanese term meaning grilled meat. _yaki_ : grilled, _niku_ : meat). He supposes that Snuke likes grilled things starting with `YAKI` in Japanese, and does not like other things. You are given a string S representing the Japanese ... | def solution():
s = list(input().strip())
if len(s) < 4:
print('NO')
else:
s = ''.join(s[:4])
if s == 'YAKI':
print('YES')
else:
print('NO')
solution() | s126112907 | Accepted | 17 | 2,940 | 171 | def solution():
s = list(input().strip())
if len(s) < 4:
print('No')
else:
s = ''.join(s[:4])
if s == 'YAKI':
print('Yes')
else:
print('No')
solution() |
s680764193 | p02612 | u009248415 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,156 | 33 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | print(n := (int(input()) % 1000)) | s525722987 | Accepted | 27 | 9,024 | 120 | n = int(input())
ans = 0
if (n % 1000) == 0:
print(ans := 0)
elif (n % 1000) != 0:
print(ans := (1000 - (n % 1000))) |
s568781941 | p03478 | u030726788 | 2,000 | 262,144 | Wrong Answer | 21 | 3,060 | 147 | 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). | a,b,c=map(int,input().split())
count=0
for i in range(1,a+1):
x=i//10000+i//1000+i//100+i//10+i%10
if(x<=c and x>=b):
count+=1
print(count) | s377385939 | Accepted | 24 | 3,064 | 169 | a,b,c=map(int,input().split())
count=0
for i in range(1,a+1):
x=i//10000+(i%10000)//1000+(i%1000)//100+(i%100)//10+i%10
if(x<=c and x>=b):
count+=i
print(count)
|
s803776418 | p03672 | u131634965 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 326 | 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()
s=s[:len(s)-1]
flag=True
while(flag):
if len(s)%2==0:
left=s[:len(s)//2]
right=s[len(s)//2:]
print(left,right)
if left==right:
print(len(s))
flag=False
else:
s=s[0:len(s)-1]
else:
s=s[0:len(s)-1]
print(s)
... | s839198107 | Accepted | 18 | 3,060 | 283 | s=input()
s=s[:len(s)-1]
flag=True
while(flag):
if len(s)%2==0:
left=s[:len(s)//2]
right=s[len(s)//2:]
if left==right:
print(len(s))
flag=False
else:
s=s[0:len(s)-1]
else:
s=s[0:len(s)-1]
|
s039309628 | p03370 | u695079172 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 168 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | n,x=map(int,input().split())
answer=0
mn=1000
for i in range(n):
temp=int(input())
answer += temp
mn = min(temp,mn)
x -= temp
answer += (x//mn)*mn
print(answer) | s220641776 | Accepted | 17 | 3,060 | 164 |
n,x=map(int,input().split())
answer=0
mn=1000
for i in range(n):
temp=int(input())
answer += 1
mn = min(temp,mn)
x -= temp
answer += (x//mn)
print(answer) |
s436313987 | p03555 | u723721005 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | a,b=input(),input()
print('YES' if reversed(list(a))==list(b)else 'NO') | s023779162 | Accepted | 17 | 3,060 | 291 | str = input()
newStr = input()
def f(s):
s = list(s)
if len(s) <= 1:
return s
i = 0
length = len(s)
while i< length/2:
s[i],s[length-1-i] = s[length-1-i],s[i]
i += 1
return ''.join(s)
if newStr == f(str):
print('YES')
else:
print('NO') |
s357358932 | p03049 | u923712635 | 2,000 | 1,048,576 | Wrong Answer | 41 | 3,700 | 562 | Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. | N = int(input())
s = [input() for _ in range(N)]
num_a = 0
num_b = 0
num_ba = 0
num_ab = 0
for i in s:
if(i[-1]=='A' and i[0]=='B'):
num_ba += 1
elif(i[-1]=='A'):
num_a+=1
elif(i[0]=='B'):
num_b+=1
last = ''
for k in i:
if(k=='A'):
last = 'A'
elif(... | s462771627 | Accepted | 42 | 3,700 | 661 | N = int(input())
s = [input() for _ in range(N)]
ans = 0
num_a = 0
num_b = 0
num_ba = 0
num_ab = 0
for i in s:
if(i[-1]=='A' and i[0]=='B'):
num_ba += 1
elif(i[-1]=='A'):
num_a+=1
elif(i[0]=='B'):
num_b+=1
last = ''
for k in i:
if(k=='A'):
last = 'A'
... |
s890111253 | p03711 | u628965061 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | S="XACABABAABABA"
x,y=map(int,input().split())
print("YES" if S[x]==S[y] else 'NO ') | s505479557 | Accepted | 17 | 2,940 | 83 | S="XACABABAABABA"
x,y=map(int,input().split())
print("Yes" if S[x]==S[y] else 'No') |
s727122914 | p03970 | u503111914 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. So Mr. Takahashi decided to perform an operation that replaces a ce... | S = "CODEFESTIVAL2016"
s = input()
result = 0
for i in range(16):
if S[i] == s[i]:
result += 1
print(result) | s208014249 | Accepted | 17 | 2,940 | 115 | S = "CODEFESTIVAL2016"
s = input()
result = 0
for i in range(16):
if S[i] != s[i]:
result += 1
print(result)
|
s165356558 | p03387 | u064408584 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 207 | 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=list(map(int,input().split()))
a.sort()
print(a)
count=(a[2]-a[0])//2
count+=(a[2]-a[1])//2
if (a[2]-a[0])%2+(a[2]-a[1])%2 == 2:
count+=1
elif (a[2]-a[0])%2+(a[2]-a[1])%2 ==1:
count+=2
print(count) | s578416700 | Accepted | 17 | 3,064 | 198 | a=list(map(int,input().split()))
a.sort()
count=(a[2]-a[0])//2
count+=(a[2]-a[1])//2
if (a[2]-a[0])%2+(a[2]-a[1])%2 == 2:
count+=1
elif (a[2]-a[0])%2+(a[2]-a[1])%2 ==1:
count+=2
print(count) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.