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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s685930405 | p04029 | u587295817 | 2,000 | 262,144 | Wrong Answer | 37 | 3,064 | 32 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | a=int(input())
print(a*(a+1)/2) | s571030175 | Accepted | 39 | 3,064 | 37 | a=int(input())
print(int(a*(a+1)/2)) |
s801562561 | p03698 | u912650255 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | S = input()
if len(set(S)) == len(S) :
print('Yes')
else:
print('No')
| s097191981 | Accepted | 17 | 2,940 | 79 | S = input()
if len(set(S)) == len(S) :
print('yes')
else:
print('no')
|
s169122617 | p03160 | u362771726 | 2,000 | 1,048,576 | Wrong Answer | 48 | 5,824 | 1,188 | 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... | import sys
from io import StringIO
import unittest
def resolve():
n = int(input())
h = [0] + list(map(int, input().split()))
inf = n * 10 ** 4 + 1
ans = [inf for _ in range(n + 1)]
ans[0] = 0
ans[1] = h[0]
for i in range(2, n + 1):
ans[i] = min(ans[i], ans[i - 1] + abs(h[i] - h[i ... | s756988338 | Accepted | 275 | 122,620 | 1,866 | import sys
from io import StringIO
import unittest
sys.setrecursionlimit(10 ** 7)
def memoize(f):
cache={}
def helper(*args):
if args not in cache:
cache[args] = f(*args)
return cache[args]
return helper
def resolve():
n = int(input())
h = list(map(int, input().split... |
s041230140 | p03861 | u599547273 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 60 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = map(int, input().split(" "))
print((b+1)//x-a//x) | s173125648 | Accepted | 17 | 2,940 | 60 | a, b, x = map(int, input().split(" "))
print(b//x-(a-1)//x) |
s978589525 | p03672 | u074220993 | 2,000 | 262,144 | Wrong Answer | 28 | 9,136 | 268 | 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()
D = {}
for c in s:
if c in D.keys():
D[c] += 1
else:
D[c] = 1
for i in range(len(s)+1):
for k in D.values():
if k % 1:
break
else:
ans = len(s)-i
break
D[s[len(s)-1-i]] -= 1
print(ans) | s966356990 | Accepted | 28 | 9,068 | 467 | class mystr:
def __init__(self,string):
self.value = string
def isEven(self):
l = len(self.value)
if (not l & 1) and self.value[:l//2] == self.value[l//2:]:
return True
else:
return False
def pop(self):
l = len(self.value)
self.value ... |
s955563180 | p03599 | u929793345 | 3,000 | 262,144 | Wrong Answer | 2,839 | 9,172 | 700 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | a, b, c, d, e, f = map(int, input().split())
a *= 100
b *= 100
wat = 0
wat_list = []
for i in range(f//a+1):
for j in range(f//b+1):
wat = a*i+b*j
if 0 < wat <= f:
wat_list.append(wat)
print(wat_list)
sug = 0
conc = 0
sug_max = 0
conc_best = 0
sug_best = 0
sug_wat_best = 0
for k in ... | s029408052 | Accepted | 435 | 9,192 | 651 | a, b, c, d, e, f = list(map(int, input().rstrip().split()))
a *= 100
b *= 100
x, y = a, 0
conc_best = 0
for i in range(f // a + 1):
for j in range(((f - a * i) // b) + 1):
water = i * a + j * b
if water == 0:
continue
rest = f - water
sug_max = e * water / 100
... |
s414936929 | p03556 | u239342230 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 31 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | print(int(int(input())**.5//1)) | s416635664 | Accepted | 18 | 2,940 | 31 | print(int(int(input())**.5)**2) |
s824664798 | p03379 | u940102677 | 2,000 | 262,144 | Wrong Answer | 217 | 25,556 | 149 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | n = int(input())
x = list(map(int, input().split()))
a = x[n//2-1]
b = x[n//2-1]
for i in range(n):
if x[i] <= a:
print(b)
else:
print(a) | s606824339 | Accepted | 304 | 26,772 | 161 | n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
a = y[n//2-1]
b = y[n//2]
for i in range(n):
if x[i] <= a:
print(b)
else:
print(a) |
s560658985 | p03545 | u354126779 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 617 | 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... | seq=input()
list=[]
for i in range(4):
list.append(int(seq[i]))
ans=[]
brk=0
for a in range (2):
for b in range (2):
for c in range (2):
if list[0]+(2*a-1)*list[1]+(2*b-1)*list[2]+(2*c-1)*list[2]==7:
ans.append(a)
ans.append(b)
ans.append(c)
... | s342461589 | Accepted | 17 | 3,064 | 622 | seq=input()
list=[]
for i in range(4):
list.append(int(seq[i]))
ans=[]
brk=0
for a in range (2):
for b in range (2):
for c in range (2):
if list[0]+(2*a-1)*list[1]+(2*b-1)*list[2]+(2*c-1)*list[3]==7:
ans.append(a)
ans.append(b)
ans.append(c)
... |
s233507029 | p03141 | u092650292 | 2,000 | 1,048,576 | Wrong Answer | 928 | 41,348 | 1,385 | There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N. When Takahashi eats Dish i, he earns A_i points of _happiness_ ; when Aoki eats Dish i, she earns B_i points of happiness. Starting from Takahashi, they alternately choose one dish a... |
from fractions import gcd
from math import factorial as f
from math import ceil,floor,sqrt
from sys import exit
from copy import deepcopy
import numpy as np
import bisect
def main():
n = int(input())
a = []
b = []
dif = []
for i in range(n):
atmp,btmp = map(int,input().split())
... | s681116900 | Accepted | 447 | 29,940 | 505 |
def main():
n = int(input())
a = []
b = []
s = []
for i in range(n):
atmp,btmp = map(int,input().split())
a.append(atmp)
b.append(btmp)
s.append([atmp+btmp,i])
s = sorted(s, key=lambda x: x[0], reverse=True)
rem = [1 for i in range(n)]
takahashi = 0
... |
s887386972 | p03679 | u813174766 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 116 | 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... | a,b,c=map(int,input().split())
if b<=c:
print("delicious")
elif b<=a+c:
print("safe")
else:
print("dangerous") | s412024555 | Accepted | 17 | 3,064 | 116 | a,b,c=map(int,input().split())
if c<=b:
print("delicious")
elif c<=a+b:
print("safe")
else:
print("dangerous") |
s257496483 | p03998 | u408958033 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 303 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | a = input()
b = input()
c = input()
a = list(a)
b = list(b)
c = list(c)
x = 'a'
while True:
if x=='a':
x = a.pop(0)
elif x=='b':
x = b.pop(0)
else:
x = c.pop(0)
if len(a)==0:
print("A")
break
if len(b)==0:
print("B")
break
if len(c)==0:
print("C")
break | s309467686 | Accepted | 17 | 3,064 | 288 | ss = [input() for _ in range(3)]
i = 0
while ss[i % 3] != "":
card = ss[i % 3][0]
ss[i % 3] = ss[i % 3][1:]
if card == "a":
i = 0
elif card == "b":
i = 1
else:
i = 2
if i == 0:
print("A")
elif i == 1:
print("B")
else:
print("C") |
s787283137 | p03477 | u802977614 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 118 | 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")
elif a+b==c+d:
print("Balanced")
else:
print("Right") | s555927501 | Accepted | 17 | 2,940 | 118 | a,b,c,d=map(int,input().split())
if a+b>c+d:
print("Left")
elif a+b==c+d:
print("Balanced")
else:
print("Right") |
s387855567 | p02398 | u498511622 | 1,000 | 131,072 | Wrong Answer | 20 | 7,492 | 89 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | x,y,z = map(int,input().split())
i=0
for s in range(x,y):
if z%s==0:
i += 1
print(i) | s923225933 | Accepted | 20 | 7,648 | 93 | a,b,c = map(int,input().split())
i=0
for s in range(a,b+1):
if c % s == 0:
i += 1
print(i) |
s876419156 | p03657 | u960513073 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | 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 = list(map(int, input().split()))
if a%3 ==0 or b%3==0 or a+b%3==0:
print("Possible")
else:
print("Impossible") | s503105319 | Accepted | 17 | 2,940 | 121 | a,b = list(map(int, input().split()))
if a%3 ==0 or b%3==0 or (a+b)%3==0:
print("Possible")
else:
print("Impossible") |
s794930503 | p02415 | u634490486 | 1,000 | 131,072 | Wrong Answer | 20 | 5,560 | 206 | Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string. | from sys import stdin
s = list(stdin.readline())
print(s)
for i in range(len(s)):
if s[i].islower():
s[i] = s[i].upper()
elif s[i].isupper():
s[i] = s[i].lower()
print(*s, sep="")
| s523573350 | Accepted | 20 | 5,544 | 72 | from sys import stdin
s = stdin.readline().swapcase()
print(s, end="")
|
s484189335 | p03814 | u925406312 | 2,000 | 262,144 | Wrong Answer | 17 | 3,516 | 76 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s=input()
i=s.find('A')
j=s.rfind('Z')
print(i)
print(j)
print(abs(i-j+1)) | s278550666 | Accepted | 18 | 3,512 | 57 | s=input()
i=s.find('A')
j=s.rfind('Z')
print(abs(i-j)+1) |
s407511093 | p03385 | u807772568 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 90 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | a = list(input())
if "a" in a and "b" in a and "c" in a:
print("YES")
else:
print("NO") | s109855260 | Accepted | 17 | 2,940 | 199 | d = list(input())
a = 0
b = 0
c = 0
for i in range(3):
if d[i] == "a":
a = 1
if d[i] == "b":
b = 1
if d[i] == "c":
c = 1
if a*b*c == 1:
print("Yes")
else:
print("No")
|
s704731052 | p02743 | u870262604 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 151 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a, b, c = map(int,input().split())
left = a+b-c
if left <= 0:
print("Yes")
else:
if (a*b - left**2) > 0:
print("Yes")
else:
print("No") | s740863697 | Accepted | 17 | 2,940 | 155 | a, b, c = map(int,input().split())
right = c-a-b
if right <= 0:
print("No")
else:
if (right**2 - 4*a*b) > 0:
print("Yes")
else:
print("No") |
s572953741 | p03698 | u363118893 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | S = str(input())
if len(list(S)) == len(set(S)):
print("Yes")
else:
print("No")
| s345271157 | Accepted | 17 | 2,940 | 88 | S = str(input())
if len(list(S)) == len(set(S)):
print("yes")
else:
print("no")
|
s392063078 | p04031 | u576917603 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 779 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... | n=int(input())
a=list(map(int,input().split()))
def custom_round(number, ndigits=0):
if type(number) == int:
return number
d_point = len(str(number).split('.')[1])
if ndigits >= d_point:
return number
c = (10 ** d_point) * 2
return round((number * c + 1) / c, ndigits)
ave=c... | s691924474 | Accepted | 19 | 3,188 | 784 | n=int(input())
a=list(map(int,input().split()))
def custom_round(number, ndigits=0):
if type(number) == int:
return number
d_point = len(str(number).split('.')[1])
if ndigits >= d_point:
return number
c = (10 ** d_point) * 2
return round((number * c + 1) / c, ndigits)
ave=c... |
s079840962 | p02401 | u885889402 | 1,000 | 131,072 | Wrong Answer | 30 | 7,736 | 265 | 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):
(a,op,b) = [s for s in input().split()]
a = int(a)
b = int(b)
if op == "+":
print(a+b)
elif op == "-":
print(a-b)
elif op == "//":
print(a/b)
elif op == "*":
print(a*b)
else:
break | s717740300 | Accepted | 20 | 7,676 | 265 | while(True):
(a,op,b) = [s for s in input().split()]
a = int(a)
b = int(b)
if op == "+":
print(a+b)
elif op == "-":
print(a-b)
elif op == "/":
print(a//b)
elif op == "*":
print(a*b)
else:
break |
s781943764 | p02612 | u096025032 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,152 | 77 | 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 = int(input())
if A % 1000 == 0:
print(A/1000)
else:
print(A/1000 + 1) | s491498889 | Accepted | 29 | 9,152 | 62 | import math
A = int(input())
print(math.ceil(A/1000)*1000-A) |
s001415526 | p02271 | u301461168 | 5,000 | 131,072 | Wrong Answer | 30 | 7,560 | 395 | Write a program which reads a sequence _A_ of _n_ elements and an integer _M_ , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise "no". You can use an element only once. You are given the sequence _A_ and _q_ questions where each question contains _M i_. | numA = int(input().rstrip())
listA = list(map(int,input().rstrip().split(" ")))
numQ = int(input().rstrip())
listQ = list(map(int,input().rstrip().split(" ")))
sumA = []
cnt = 0
for i in range(numA):
for j in range(i+1, numA):
sumA.append(listA[i]+listA[j])
for i in range(numQ):
if sumA.count(listQ[... | s889154247 | Accepted | 630 | 58,252 | 441 | import itertools
numA = int(input().rstrip())
listA = list(map(int,input().rstrip().split(" ")))
numQ = int(input().rstrip())
listQ = list(map(int,input().rstrip().split(" ")))
sumA = set([])
cnt = 0
for i in range(1,numA+1):
tmpComb = list(itertools.combinations(listA, i))
for nums in tmpComb:
... |
s521213664 | p02692 | u858742833 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,148 | 11 | There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ... | print('No') | s807207970 | Accepted | 181 | 10,716 | 731 | def main():
N, A, B, C = list(map(int, input().split()))
S = [{'AB':(0, 1), 'BC': (1, 2), 'AC': (0, 2)}[input()] for _ in range(N)]
ABC = [A, B, C]
RR = ['A', 'B', 'C']
R = []
for i, (s1, s2) in enumerate(S):
if ABC[s1] == 0 and ABC[s2] == 0:
return False, None
if ABC... |
s477144474 | p03644 | u943057856 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 128 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n=int(input())
ans=0
for i in range(n):
a=0
while int(i%2)==0:
a+=1
i=i//2
ans=max(ans,a)
print(ans) | s123232155 | Accepted | 17 | 2,940 | 103 | n=int(input())
l=[2**i for i in range(8)]
for i in l[::-1]:
if i<=n:
print(i)
break |
s797122524 | p03493 | u390958150 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | 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. | masu = list(input())
count = 0
for i in range(3):
if masu[0] == '1':
count += 1
print(count) | s443210295 | Accepted | 17 | 2,940 | 100 | masu = list(input())
count = 0
for i in range(3):
if masu[i] == '1':
count += 1
print(count)
|
s251497128 | p02420 | u025362139 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 202 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | #coding: UTF-8
while True:
str = input()
if str == '-':
break
m = int(input())
for num in range(m):
h = int(input())
str = str[h:] + str[:h]
print(str)
| s880353808 | Accepted | 20 | 5,604 | 272 | #coding: UTF-8
shuffle = []
while True:
str = input()
if str == '-':
break
m = int(input())
for num in range(m):
h = int(input())
str = str[h:] + str[:h]
shuffle.append(str)
for i in range(len(shuffle)):
print(shuffle[i])
|
s677000984 | p00102 | u811773570 | 1,000 | 131,072 | Wrong Answer | 30 | 7,564 | 353 | Your task is to develop a tiny little part of spreadsheet software. Write a program which adds up columns and rows of given table as shown in the following figure: | def main():
while True:
n = int(input())
if n == 0:
break
for i in range(n):
num = 0
m = map(int, input().split())
for j in m:
print("{:5}".format(j), end='')
num += j
print("{:5}".format(num))
if _... | s820275768 | Accepted | 40 | 7,920 | 647 | from copy import deepcopy
def main():
while True:
n = int(input())
if n == 0:
break
tate = [0 for i in range(n)]
for i in range(n):
num = 0
m = map(int, input().split())
hoge = deepcopy(m)
tate = [x + y for (x, y) in zip... |
s479167029 | p03943 | u760831084 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a, b, c = sorted(map(int, input().split()))
if a == b + c:
print('Yes')
else:
print('No') | s809029206 | Accepted | 17 | 2,940 | 97 | a, b, c = sorted(map(int, input().split()))
if a + b == c:
print('Yes')
else:
print('No') |
s869750453 | p02419 | u607723579 | 1,000 | 131,072 | Wrong Answer | 20 | 5,460 | 1 | Write a program which reads a word W and a text T, and prints the number of word W which appears in text T T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive. | s239421697 | Accepted | 20 | 5,572 | 328 | import sys
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
P = str(input()).upper()
line = []
while True:
tmp_line = str(input())
if tmp_line == 'END_OF_TEXT':
break
line += tmp_line.upper().split()
ans = 0
for tmp_word in line:
if tmp_word == P:
ans += 1
print("%d"... | |
s184692562 | p02401 | u982632052 | 1,000 | 131,072 | Wrong Answer | 40 | 7,300 | 83 | 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:
s = input()
if (s == '0 ? 0'):
break
print(eval(s)) | s692607101 | Accepted | 30 | 7,544 | 112 | import re
while True:
s = input()
if (re.match(r'.+\s\?\s.+', s)):
break
print(int(eval(s))) |
s309848053 | p03712 | u934442292 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 157 | 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())
a = [""] * H
for _a in a:
_a = input()
print("#" * (W + 2))
for _a in a:
print("#{}#".format(_a))
print("#" * (W + 2))
| s622208223 | Accepted | 18 | 3,060 | 166 | H, W = map(int, input().split())
a = [""] * H
for i in range(H):
a[i] = input()
print("#" * (W+2))
for i in range(H):
print("#" + a[i] + "#")
print("#" * (W+2))
|
s266600972 | p03139 | u814986259 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 76 | 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(0,min(A,B) -(N-max(A,B))),min(A,B)) | s617706794 | Accepted | 17 | 2,940 | 76 | N,A,B=map(int,input().split())
print(min(A,B),max(0,min(A,B) -(N-max(A,B)))) |
s546169506 | p02612 | u015647294 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,072 | 48 | 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())
L = N // 1000
print((L + 1)-N) | s800832529 | Accepted | 29 | 9,160 | 91 | N = int(input())
if (N % 1000) != 0:
ans = 1000 - N % 1000
else:
ans = 0
print(ans) |
s688129548 | p03196 | u340249922 | 2,000 | 1,048,576 | Wrong Answer | 417 | 3,060 | 226 | There are N integers a_1, a_2, ..., a_N not less than 1. The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P. Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N. | N, P = [int(_c) for _c in input().split(" ")]
if N == 1:
print(P)
else:
_max = -1
M = int(P ** (1 / N))
for i in range(1, M):
var = i ** N
if P % var == 0:
_max = i
print(_max) | s844548102 | Accepted | 383 | 3,060 | 226 | N, P = [int(_c) for _c in input().split(" ")]
if N == 1:
print(P)
else:
_max = 1
M = int(P ** (1 / N) + 1.0 * 1e-9)
for i in range(1, M + 1):
if P % (i ** N) == 0:
_max = i
print(_max) |
s127506155 | p03853 | u856232850 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 167 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | n,m =list(map(int,input().split()))
a =[]
for i in range(n):
a.append(list(input()))
b = []
for j in a:
b.append(j)
b.append(j)
for k in b:
print(k)
| s773566975 | Accepted | 18 | 3,060 | 97 | n,m =list(map(int,input().split()))
for i in range(n):
a = input()
print(a)
print(a) |
s864402019 | p02613 | u875756191 | 2,000 | 1,048,576 | Wrong Answer | 151 | 9,136 | 319 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n = int(input())
a = 0
w = 0
t = 0
r = 0
for _ in range(n):
s = input()
if s == 'AC':
a += 1
elif s == 'WA':
w += 1
elif s == 'TLE':
t += 1
elif s == 'RE':
r += 1
print('AC × ' + str(a))
print('WA × ' + str(w))
print('TLE × ' + str(t))
print('RE × ' + str(r))
| s605782671 | Accepted | 146 | 9,204 | 315 | n = int(input())
a = 0
w = 0
t = 0
r = 0
for _ in range(n):
s = input()
if s == 'AC':
a += 1
elif s == 'WA':
w += 1
elif s == 'TLE':
t += 1
elif s == 'RE':
r += 1
print('AC x ' + str(a))
print('WA x ' + str(w))
print('TLE x ' + str(t))
print('RE x ' + str(r))
|
s892929017 | p03555 | u778700306 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 85 | 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 = input()
b = reversed(input())
if a == b:
print("YES")
else:
print("NO") | s489049564 | Accepted | 18 | 2,940 | 81 |
a = input()
b = input()[::-1]
if a == b:
print("YES")
else:
print("NO") |
s276729936 | p03606 | u492447501 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 125 | Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now? | N = int(input())
count = 0
for i in range(N):
l, r = map(int, input().split())
count = count + (r-l)
print(count)
| s522825399 | Accepted | 21 | 2,940 | 129 | N = int(input())
count = 0
for i in range(N):
l, r = map(int, input().split())
count = count + (r-l) + 1
print(count)
|
s057543311 | p02747 | u892308039 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 109 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | S = input()
S_size = len(S)
S_hi = S.count('hi')
if S_size == S_hi:
print('Yes')
else:
print('No')
| s412822681 | Accepted | 18 | 2,940 | 110 | S = input()
S_size = len(S)
S_hi = S.count('hi')
if S_size == S_hi*2:
print('Yes')
else:
print('No') |
s096604072 | p03386 | u379692329 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 193 | 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())
select = []
for i in range(A, min(B, A+K)):
select.append(i)
for i in range(max(A, B-K+1), B+1):
select.append(i)
for i in set(select):
print(i) | s895520808 | Accepted | 17 | 3,060 | 201 | A, B, K = map(int, input().split())
select = []
for i in range(A, min(B, A+K)):
select.append(i)
for i in range(max(A, B-K+1), B+1):
select.append(i)
for i in sorted(set(select)):
print(i) |
s944173668 | p03695 | u013408661 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 458 | 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())
rate=[0]*8
tourist=0
a=list(map(int,input().split()))
for i in range(N):
if 1<=i<399:
rate[0]+=1
elif 400<=i<=799:
rate[1]+=1
elif 800<=i<=1199:
rate[2]+=1
elif 1200<=i<=1599:
rate[3]+=1
elif 1600<=i<=1999:
rate[4]+=1
elif 2000<=i<=2399:
rate[5]+=1
elif 2400<=i<=2799... | s992678396 | Accepted | 17 | 3,064 | 400 | N=int(input())
rate=[0]*8
tourist=0
a=list(map(int,input().split()))
for i in a:
if i<400:
rate[0]+=1
elif i<800:
rate[1]+=1
elif i<1200:
rate[2]+=1
elif i<1600:
rate[3]+=1
elif i<2000:
rate[4]+=1
elif i<2400:
rate[5]+=1
elif i<2800:
rate[6]+=1
elif i<3200:
rate[7]+=1
e... |
s307392789 | p03455 | u354126779 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | 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())
c=a*b
if c%2==0:
print("Odd")
else:
print("Even") | s111596529 | Accepted | 17 | 2,940 | 83 | a,b=map(int,input().split())
c=a*b
if c%2==0:
print("Even")
else:
print("Odd")
|
s293582592 | p03494 | u642120132 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 144 | 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. | _ = input()
a = list(map(int, input().split()))
cnt = 0
while all(i % 2 == 0 for i in a):
for j in a:
j /= 2
cnt += 1
print(cnt) | s910500292 | Accepted | 18 | 3,060 | 140 | _ = input()
a = list(map(int, input().split()))
cnt = 0
while all(i % 2 == 0 for i in a):
a = [j / 2 for j in a]
cnt += 1
print(cnt) |
s083683202 | p03827 | u963903527 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | 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 = input()
s = input()
li = list(s)
x = 0
for argv in li:
if argv == "I":
x += 1
elif argv == "D":
x -= 1
print(x) | s436171933 | Accepted | 19 | 3,060 | 217 | n = input()
s = input()
li = list(s)
x = 0
num_list = list()
num_list.append(0)
for argv in li:
if argv == "I":
x += 1
num_list.append(x)
elif argv == "D":
x -= 1
num_list.append(x)
print(max(num_list))
|
s735408853 | p03909 | u902151549 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 196 | There is a grid with H rows and W columns. The square at the i-th row and j-th column contains a string S_{i,j} of length 5. The rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from `A` through the W-th letter of the alphabet. Exactly one of the sq... | h,w=map(int,input().split())
A=[input().split() for _ in range(h)]
for a in range(h):
for b in range(w):
if A[a][b]=="snuke":
print("{}{}".format(a+1,chr(ord("A")+b)))
break
| s071064858 | Accepted | 17 | 3,060 | 193 | h,w=map(int,input().split())
A=[input().split() for _ in range(h)]
for a in range(h):
for b in range(w):
if A[a][b]=="snuke":
print("{1}{0}".format(a+1,chr(ord("A")+b)))
break |
s662713812 | p02612 | u331640179 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,116 | 56 | 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())
while n < 1000:
n //= 1000
print(n) | s260496376 | Accepted | 29 | 9,156 | 62 | n = int(input())
while n > 1000:
n -= 1000
print(1000 - n) |
s264702627 | p03971 | u062691227 | 2,000 | 262,144 | Wrong Answer | 69 | 9,244 | 318 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | x, s = *open(0),
n, a, b = map(int, x.split())
p = 0
wp = 0
for char in s:
if char == 'c' or p >= a+b:
print('No')
continue
if char == 'a':
p += 1
print('Yes')
continue
if wp < b:
p += 1
wp += 1
print('Yes')
else:
print('No') | s556362937 | Accepted | 72 | 9,192 | 323 | x = input()
s = input()
n, a, b = map(int, x.split())
p = 0
wp = 0
for char in s:
if char == 'c' or p >= a+b:
print('No')
continue
if char == 'a':
p += 1
print('Yes')
continue
if wp < b:
p += 1
wp += 1
print('Yes')
else:
print('N... |
s478794359 | p03682 | u711238850 | 2,000 | 262,144 | Wrong Answer | 2,113 | 147,592 | 3,980 | There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates. You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (the currency of Japan). It is not possible to build other types of road... | import heapq
class Graph:
def __init__(self,v,edgelist,w_v = None,directed = False):
super().__init__()
self.v = v
self.w_e = [{} for _ in [0]*self.v]
self.neighbor = [[] for _ in [0]*self.v]
self.w_v = w_v
self.directed = directed
for i,j,w in edgelist:
... | s583514615 | Accepted | 1,236 | 49,016 | 1,630 | class UnionFind:
def __init__(self,n):
super().__init__()
self.par = [-1]*n
self.rank = [0]*n
self.tsize = [1]*n
def root(self,x):
if self.par[x] == -1:
return x
else:
self.par[x] = self.root(self.par[x])
return self.par[x... |
s924851114 | p03385 | u702208001 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | print('YES' if len(set(input())) == 3 else 'No')
| s185403068 | Accepted | 17 | 2,940 | 49 | print('Yes' if len(set(input())) == 3 else 'No')
|
s098182958 | p04044 | u681323954 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | s=input()
print(s[0]+str((len(s)-2))+s[-1]) | s132647828 | Accepted | 17 | 3,060 | 89 | n,l = map(int, input().split())
s = sorted([input() for i in range(n)])
print(*s, sep="") |
s692745959 | p03433 | u936047618 | 2,000 | 262,144 | Wrong Answer | 24 | 9,156 | 108 | 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("N--->"))
a = int(input("A--->"))
b = n%500
if a > b:
print("Yes")
else:
print("No") | s456381059 | Accepted | 23 | 9,024 | 95 | N = int(input())
A = int(input())
b = N%500
if A >= b:
print("Yes")
else:
print("No") |
s860239899 | p03998 | u136395536 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 7,660 | 147 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | A = input()
B = input()
C = input()
moji = A[0]
while(len(A)!=0 or len(B)!=0 or len(C)!=0):
if moji == "a":
A = A[2:]
print(A) | s125375615 | Accepted | 17 | 3,064 | 466 | A = input()
B = input()
C = input()
throw = "a"
a = 0
b = 0
c = 0
while True:
if throw == "a":
if a == len(A):
print("A")
break
throw = A[a]
a += 1
elif throw == "b":
if b == len(B):
print("B")
break
throw = B[b]
... |
s839210880 | p03407 | u007550226 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 65 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | A,B,C = map(int,input().split())
print('Yes' if A+B<=C else 'No') | s858484192 | Accepted | 17 | 2,940 | 65 | A,B,C = map(int,input().split())
print('Yes' if A+B>=C else 'No') |
s412390440 | p03574 | u576917603 | 2,000 | 262,144 | Wrong Answer | 36 | 3,188 | 542 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | dx=[-1,0,1,-1,1,-1,0,1]
dy=[-1,-1,-1,0,0,1,1,1]
h,w=map(int,input().split())
field = []
for i in range(h):
field.append(list(input()))
print(field)
for y in range(h):
for x in range(w):
if field[y][x]=="#":
continue
cnt=0
for k in range(8):
nx=x+dx[k]
... | s690134319 | Accepted | 31 | 3,188 | 524 | dx=[-1,0,1,-1,1,-1,0,1]
dy=[-1,-1,-1,0,0,1,1,1]
h,w=map(int,input().split())
field = []
for i in range(h):
field.append(list(input()))
for y in range(h):
for x in range(w):
if field[y][x]=="#":
continue
cnt=0
for k in range(8):
nx=x+dx[k]
ny=y+dy[k]
... |
s518526979 | p02612 | u257332942 | 2,000 | 1,048,576 | Wrong Answer | 35 | 9,076 | 58 | 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())
while n >= 1000:
n -= 1000
print(n) | s310163142 | Accepted | 27 | 9,152 | 79 | n = int(input())
a = n % 1000
if a == 0:
print(0)
else:
print(1000-a) |
s637826951 | p02975 | u712397093 | 2,000 | 1,048,576 | Wrong Answer | 114 | 14,212 | 137 | Snuke has N hats. The i-th hat has an integer a_i written on it. There are N camels standing in a circle. Snuke will put one of his hats on each of these camels. If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print `Yes`; otherwise, print `No... | N = int(input())
a = list(map(int, input().split()))
sum = 0
for i in range(N):
sum ^= a[i]
print('Yes' if sum == 0 else 'No')
| s259490528 | Accepted | 58 | 14,116 | 133 | N = int(input())
a = list(map(int, input().split()))
sum = 0
for i in range(N):
sum ^= a[i]
print('Yes' if sum == 0 else 'No')
|
s815858999 | p03729 | u830054172 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a, b, c = list(input().split())
if a[-1] == b[0] and b[-1] == c[0]:
print("Yes")
else:
print("No") | s750049035 | Accepted | 17 | 2,940 | 107 | a, b, c = list(input().split())
if a[-1] == b[0] and b[-1] == c[0]:
print("YES")
else:
print("NO") |
s690954974 | p03657 | u701318346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | 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 % 3 == 0 or B % 3 == 0 or (A + B) == 0:
print('Possible')
else:
print('Impossible') | s347788193 | Accepted | 24 | 3,316 | 132 | A, B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
print('Possible')
else:
print('Impossible')
|
s519717271 | p03854 | u110927356 | 2,000 | 262,144 | Wrong Answer | 1,655 | 21,708 | 461 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | import math
import numpy as np
#n, a, b = map(int, input().split())
#print(len(z))
# print(i)
#print(sum(a[::2]) - sum(a[1::2]))
s = input()
s.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
print("NO")
else:
print("YES")
| s826395133 | Accepted | 1,349 | 21,876 | 466 | import math
import numpy as np
#n, a, b = map(int, input().split())
#print(len(z))
# print(i)
#print(sum(a[::2]) - sum(a[1::2]))
s = input()
s = s.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
print("NO")
else:
print("YES")
|
s446234187 | p03545 | u468206018 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 435 | 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 = list(input())
def calc(i, a, b,tag):
a ,b = int(a), int(b)
if i==0:
c = a+b
tag.append('+')
elif i==1:
c = a-b
tag.append('-')
return c, tag
for i in range(2):
tag = []
c ,tag= calc(i,s[0],s[1],tag)
for j in range(2):
d ,tag = calc(j,c,s[2],tag)
for k in range(2):
e... | s968412314 | Accepted | 18 | 3,064 | 522 | s = list(input())
def calc(i, a, b):
a ,b = int(a), int(b)
if i==0:
c = a+b
elif i==1:
c = a-b
return c
def tag(t_list):
t = []
for p in t_list:
if p==0:
t.append('+')
else:
t.append('-')
return(t)
for i in range(2):
c = calc(i,s[0],s[1])
for j in range(2):
... |
s694050670 | p03369 | u331036636 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 103 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | S = input()
price = 700
for i in range(len(S)):
if S[i] == "○":
price += 100
print(price) | s154745777 | Accepted | 17 | 2,940 | 107 | S = list(input())
price = 700
for i in range(len(S)):
if S[i] == "o":
price += 100
print(price) |
s562956888 | p03486 | u429319815 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 195 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s = input()
S = "".join(sorted(s))
t = input()
T = "".join(sorted(t))
if S < T:
print("Yes")
else:
print("No") | s352114037 | Accepted | 17 | 2,940 | 176 | s = sorted(list(input()))
t = sorted(list(input()), reverse=True)
s_sorted = "".join(s)
t_sorted = "".join(t)
if s_sorted < t_sorted:
print("Yes")
else:
print("No")
|
s649634201 | p03610 | u525117558 | 2,000 | 262,144 | Wrong Answer | 18 | 3,444 | 52 | 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. | s=[input().split()]
for i in s[::2]:
print(s[::2]) | s789365121 | Accepted | 17 | 3,188 | 23 | s=input()
print(s[::2]) |
s227439201 | p00003 | u585035894 | 1,000 | 131,072 | Wrong Answer | 40 | 5,592 | 146 | 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. | for _ in range(int(input())):
l = list(map(int, input().split()))
l.sort()
print('YES' if l[0]**2 + l[1] ** 2 == l[2] ** 2 else 'No') | s816231591 | Accepted | 50 | 5,604 | 169 | for _ in range(int(input())):
a = [int(i) for i in input().split()]
print('YES') if a[0]**2 + a[1]**2 + a[2] ** 2 - max(a) **2 == max(a) ** 2 else print('NO')
|
s841627228 | p03351 | u333731247 | 2,000 | 1,048,576 | Wrong Answer | 21 | 2,940 | 104 | 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') | s248730098 | Accepted | 17 | 2,940 | 141 | a,b,c,d=map(int,input().split())
if abs(a-b)<=d and abs(b-c)<=d:
print('Yes')
elif abs(a-c)<=d:
print('Yes')
else :
print('No') |
s649068366 | p02389 | u095590628 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 60 | Write a program which calculates the area and perimeter of a given rectangle. | ab = [int(n) for n in input().split()]
print(ab[0]*ab[1])
| s004258845 | Accepted | 20 | 5,608 | 113 | ab = [int(n) for n in input().split()]
S = ab[0]*ab[1]
L = 2*ab[0] + 2*ab[1]
print(" ".join(map(str,[S,L])))
|
s084660637 | p03386 | u901582103 | 2,000 | 262,144 | Wrong Answer | 2,217 | 1,839,640 | 105 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | a,b,k=map(int,input().split())
l=[i for i in range(a,b+1)]
for s in list(set(l[:k]+l[-k:])):
print(s) | s671409885 | Accepted | 19 | 3,060 | 158 | a,b,k=map(int,input().split())
s=[i for i in range(a,min(a+k,b+1))]
l=[i for i in range(b,max(b-k,a-1),-1)]
L=list(set(s+l))
L.sort()
for i in L:
print(i) |
s298577420 | p03456 | u710921979 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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=map(int,input().split())
n=int(a+b)
if n==int(n**0.5)**2:
print('YES')
else:
print('NO') | s289605471 | Accepted | 17 | 3,060 | 100 | a,b=map(str,input().split())
n=int(a+b)
if n==int(n**0.5)**2:
print("Yes")
else:
print("No") |
s380498849 | p03610 | u479638406 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,956 | 94 | 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. | s = list(input())
for i in range(len(s)):
if i%2 == 0:
odd = ''.join(s)
print(odd) | s049498051 | Accepted | 38 | 4,388 | 122 | s = list(input())
t = []
for i in range(len(s)):
if i%2 == 0:
t.append(s[i])
odd = ''.join(t)
print(odd)
|
s347166281 | p03149 | u078349616 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 172 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | A = list(map(int, input().split()))
A1 = A.count("1")
A9 = A.count("9")
A7 = A.count("7")
A4 = A.count("4")
if A1 == A9 == A7 == A4 == 1:
print("YES")
else:
print("NO") | s956326800 | Accepted | 17 | 3,060 | 164 | A = list(map(int, input().split()))
A1 = A.count(1)
A9 = A.count(9)
A7 = A.count(7)
A4 = A.count(4)
if A1 == A9 == A7 == A4 == 1:
print("YES")
else:
print("NO") |
s964706722 | p03759 | u090225501 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | 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 = map(int, input().split())
if b - a == c - a:
print('YES')
else:
print('NO') | s108253002 | Accepted | 17 | 2,940 | 89 | a, b, c = map(int, input().split())
if b - a == c - b:
print('YES')
else:
print('NO') |
s624743000 | p02742 | u268792407 | 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... | h,w=map(int,input().split())
print(((h+1)//2)*((w+1)//2)) | s970710133 | Accepted | 18 | 2,940 | 171 | h,w=map(int,input().split())
if h==1 or w==1:
print(1)
exit()
if h%2==1 and w%2==1:
a1=((h+1)//2)*(w+1)//2
a2=(h//2)*(w//2)
print(a1+a2)
else:
print((h*w)//2)
|
s079294836 | p03433 | u057415180 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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 = list(map(int,input().split()))
print(sum(a[::2])-sum(a[1::2]))
| s923695169 | Accepted | 17 | 2,940 | 88 | n = int(input())
a = int(input())
if n%500 <= a:
print('Yes')
else:
print('No') |
s762037547 | p02607 | u124212130 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,104 | 168 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | N = int(input())
Mylist = input().split()
Mylist = [int(s) for s in Mylist]
ANS = 0
for i in range(N):
if i+1 % 2 == 1 and Mylist[i] % 2 == 1:
ANS += 1
print(ANS) | s684776705 | Accepted | 31 | 9,160 | 173 | N = int(input())
Mylist = input().split()
Mylist = [int(s) for s in Mylist]
ANS = 0
for i in range(1,N+1):
if i % 2 == 1 and Mylist[i-1] % 2 == 1:
ANS += 1
print(ANS)
|
s898989213 | p03854 | u460878159 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 953 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S=input()
l=len(S)
r=0
amari = [1,2,3,4]
list5 = ['dream', 'erase']
list81 = ['dreamdre', 'dreamera', 'erasedre', 'eraseera']
list82 = ['dreamerd', 'dreamere', 'eraserdre', 'eraserera']
if l<=4:
print(False)
while l>=5:
if S[r:r+5] in list5:
if r+5==l:
print(True)
break
... | s678410282 | Accepted | 40 | 3,316 | 1,000 | S=input()
l=len(S)
r=0
list5 = ['dream', 'erase']
list81 = ['dreamdre', 'dreamera', 'erasedre', 'eraseera']
list82 = ['dreamerd', 'dreamere']
list83 = ['eraserdr', 'eraserer']
if l<=4:
print('NO')
while l>=5:
if S[r:r+5] in list5:
if r+5==l:
print('YES')
break
elif r+5 =... |
s811603379 | p03493 | u266874640 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | 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()
result =0
for i in S:
if i == 1:
result += 1
print(result)
| s375047803 | Accepted | 20 | 2,940 | 88 | S = input()
result =0
for i in S:
if i == str(1):
result += 1
print(result)
|
s411642124 | p03449 | u917558625 | 2,000 | 262,144 | Wrong Answer | 29 | 9,144 | 228 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | N=int(input())
p=[0]
q=[0]
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
for i in range(N):
p.append(p[i]+A1[N-i-1])
q.append(q[i]+A2[i])
ans=0
for j in range(N):
ans=max(ans,p[j+1]+q[j+1])
print(ans) | s353854854 | Accepted | 32 | 9,144 | 228 | N=int(input())
p=[0]
q=[0]
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
for i in range(N):
p.append(p[i]+A1[i])
q.append(q[i]+A2[N-i-1])
ans=0
for j in range(N):
ans=max(ans,p[j+1]+q[N-j])
print(ans) |
s563762869 | p03493 | u903005414 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | 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()
print(sum([1 for i in s if s == '1'])) | s116132254 | Accepted | 18 | 2,940 | 45 | print(sum([1 for i in input() if i == '1']))
|
s404051727 | p03698 | u136869985 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 53 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s=input()
print(['no', 'ues'][len(set(s)) == len(s)]) | s219525263 | Accepted | 17 | 2,940 | 53 | s=input()
print(['no', 'yes'][len(set(s)) == len(s)]) |
s420949430 | p03796 | u450904670 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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. | n = int(input())
res = 1
for num in (1, n+1):
res = res * num
res = res % (10**9 + 7)
print(res) | s422534863 | Accepted | 40 | 2,940 | 110 | n = int(input())
res = 1
for num in range(1, n+1):
res = res * num
res = res % (10**9 + 7)
print(res)
|
s773738886 | p02618 | u595833382 | 2,000 | 1,048,576 | Wrong Answer | 151 | 27,304 | 613 | AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to sched... | import numpy as np
D = int(input())
C = ([int(x) for x in input().split()])
for d in range(D):
exec('s{} = ([int(x) for x in input().split()])'.format(d))
S = 0
d = 0
lday = np.array([0] * 26)
C = np.array(C)
while d != D:
exec("curs = np.array(s{})".format(d))
pos_max_i = np.argmax(curs)
neg_m... | s119649056 | Accepted | 148 | 27,400 | 569 | import numpy as np
D = int(input())
C = ([int(x) for x in input().split()])
for d in range(D):
exec('s{} = ([int(x) for x in input().split()])'.format(d))
d = 0
lday = np.array([0] * 26)
C = np.array(C)
while d != D:
exec("curs = np.array(s{})".format(d))
pos_max_i = np.argmax(curs)
decl = C * ... |
s077701312 | p03438 | u867069435 | 2,000 | 262,144 | Wrong Answer | 1,087 | 21,492 | 272 | You are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N. Determine if we can repeat the following operation zero or more times so that the sequences a and b become equal. Operation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two ac... | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))
if np.sum(b[a < b] - a[a < b]) > np.sum(a[b < a] - b[b < a]):
print("No")
elif np.sum(a) > np.sum(b):
print("No")
else:
print("Yes") | s466596303 | Accepted | 30 | 4,596 | 562 | import math
n = int(input())
lis1 = list(map(int,input().split()))
lis2 = list(map(int,input().split()))
k = 0
c = 0
s = 0
cou = sum(lis2)-sum(lis1)
if cou < 0:
print("No")
else:
for i in range(n):
if lis1[i] < lis2[i]:
c += math.ceil((lis2[i] - lis1[i]) / 2)
if (lis2[i] - lis1[i... |
s373192185 | p03435 | u641722141 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 237 | We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ... | l =[list(map(int, input().split())) for i in range(3)]
total1 = total2 = 0
for i in range(3):
total1 += sum(l[i])
total2 += l[i][i]
print(total1, total2)
if total1 == total2 * 3:
print('Yes')
else:
print('No') | s353498167 | Accepted | 17 | 2,940 | 214 | l = [[int(i) for i in input().split()] for x in range(3)]
total1 = 0
total2 = 0
for i in range(3):
total1 += sum(l[i])
total2 += l[i][i]
if total1 == total2 * 3:
print('Yes')
else:
print('No')
|
s722244719 | p03165 | u102461423 | 2,000 | 1,048,576 | Wrong Answer | 531 | 82,760 | 843 | You are given strings s and t. Find one longest string that is a subsequence of both s and t. | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
S = np.frombuffer(readline().rstrip(),'S1')
T = np.frombuffer(readline().rstrip(),'S1')
S,T
def LCS(S,T):
LS = len(S); LT = len(T)
dp = np.zeros((LS+1,LT+1),np.int64)
fo... | s474530848 | Accepted | 273 | 61,968 | 1,049 | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def longest_common_subsequence(S, T):
LS, LT = len(S), len(T)
dp = np.zeros((LS + 1, LT + 1), np.int32)
for n in range(1, LS + 1):
dp[n, 1:] = dp[n - 1, :-1] ... |
s187305385 | p03157 | u547167033 | 2,000 | 1,048,576 | Wrong Answer | 671 | 7,028 | 823 | There is a grid with H rows and W columns, where each square is painted black or white. You are given H strings S_1, S_2, ..., S_H, each of length W. If the square at the i-th row from the top and the j-th column from the left is painted black, the j-th character in the string S_i is `#`; if that square is painted whi... | h,w=map(int,input().split())
grid =[list(input()) for i in range(h)]
cntW =[[0]*w for i in range(h)]
visited=[[False]*w for i in range(h)]
for i in range(h):
for j in range(w):
if grid[i][j]=='#':
if j<w-1 and grid[i][j+1]=='.':cntW[i][j]+=1
if j>0 and grid[i][j-1]=='.':cntW[i][j]+=1
if i<h-1 an... | s778382629 | Accepted | 604 | 5,748 | 540 | h,w=map(int,input().split())
grid =[list(input()) for i in range(h)]
visited=[[False]*w for i in range(h)]
ans=0
for i in range(h):
for j in range(w):
if visited[i][j]:
continue
q=[(i,j)]
d={'#':0,'.':0}
while q:
cy,cx=q.pop(0)
for ny,nx in ((cy+1,cx),(cy-1,cx),(cy,cx+1),(cy,cx-1)):
... |
s140564345 | p03054 | u788137651 | 2,000 | 1,048,576 | Wrong Answer | 162 | 3,784 | 705 | We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,s_c). Takahashi and Aoki will play a game, where each player has a st... | H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
S = input()
T = input()
left = 1
right = W
up = 1
down = H
for i in reversed(range(N)):
if i != N - 1:
if T[i] == "U":
if down != H:
down -= 1
elif T[i] == "D":
if up != 1:
... | s187430729 | Accepted | 183 | 3,784 | 731 | H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
S = input()
T = input()
left = 1
right = W
up = 1
down = H
for i in reversed(range(N)):
if T[i] == "U":
down = min(H, down+1)
elif T[i] == "D":
up = max(1, up-1)
elif T[i] == "L":
right = min(W, right+1)
els... |
s143142159 | p03543 | u441320782 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 123 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | x = [int(i) for i in input()]
x.sort()
print(x)
if x[0]==x[1]==x[2] or x[1]==x[2]==x[3]:
print("Yes")
else:
print("No") | s513861361 | Accepted | 17 | 2,940 | 106 | x = [int(i) for i in input()]
if x[0]==x[1]==x[2] or x[1]==x[2]==x[3]:
print("Yes")
else:
print("No") |
s501194304 | p03713 | u057586044 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 406 | There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle. Snuke is trying to divide the bar as evenly as possible. More specifically, he is trying... | H,W = map(int,input().split())
hr,ht,vr,vt = 0,0,0,0
hr,vr = H%3*W,W%3*H
def t(x,y):
if x%3==0:
return 0
elif x%3==1:
a = ((x//3)*2+1)*(y//2)
b = x//3*y
c = x*y-a-b
return max(a,b,c)-min(a,b,c)
else:
a = ((x//3)*2+1)*(y//2)
b = (x//3+1)*y
c = x... | s976021234 | Accepted | 17 | 3,064 | 430 | H,W = map(int,input().split())
res = min(H,W)
hr,ht,vr,vt = 0,0,0,0
hr,vr = H%3*W,W%3*H
def t(x,y):
if x%3==0:
return 0
elif x%3==1:
a = ((x//3)*2+1)*(y//2)
b = x//3*y
c = x*y-a-b
return max(a,b,c)-min(a,b,c)
else:
a = ((x//3)*2+1)*(y//2)
b = (x//3+1)*... |
s384493853 | p02694 | u344232182 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,164 | 93 | 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())
m = 100
count = 1
while x > m:
m = m + m/100
count += 1
print(count) | s519998211 | Accepted | 21 | 9,108 | 109 | x = int(input())
m = 100
count = 0
while x > m:
r = int(m*0.01)
m = m + r
count += 1
print(count) |
s175641440 | p03644 | u113255362 | 2,000 | 262,144 | Wrong Answer | 25 | 9,092 | 122 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | A = int(input())
chek = 1
res = 0
for i in range(10):
chek = 2**i
if chek < A:
res = 2**(i-1)
break
print(res) | s237610656 | Accepted | 30 | 9,020 | 122 | A = int(input())
chek = 1
res = 0
for i in range(10):
chek = 2**i
if chek > A:
res = 2**(i-1)
break
print(res) |
s970784622 | p03643 | u893209854 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 24 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | N = input()
print(N[3:]) | s573018644 | Accepted | 19 | 2,940 | 28 | N = input()
print('ABC' + N) |
s436633604 | p03050 | u476435125 | 2,000 | 1,048,576 | Wrong Answer | 140 | 2,940 | 121 | 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. | N=int(input())
sqrtn=int(N**0.5)
ans=0
for r in range(1,sqrtn):
if N%r==0:
ans+=(int(N/r)-1)
print(int(ans))
| s749915079 | Accepted | 145 | 3,060 | 135 | N=int(input())
sqrtn=int(N**0.5)
ans=0
for r in range(1,sqrtn+1):
if N%r==0 and N/r-1>r:
ans+=(int(N/r)-1)
print(int(ans))
|
s563027181 | p03478 | u094191970 | 2,000 | 262,144 | Wrong Answer | 37 | 3,628 | 229 | 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 i in range(1,n+1):
n=i
cnt=0
while i//10 != 0:
cnt+=i%10
i=i//10
else:
cnt+=i
if a<=cnt and cnt<=b:
print(cnt)
ans+=n
print(ans) | s177560039 | Accepted | 29 | 3,060 | 210 | n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
n=i
cnt=0
while i//10 != 0:
cnt+=i%10
i=i//10
else:
cnt+=i
if a<=cnt and cnt<=b:
ans+=n
print(ans) |
s135027647 | p00460 | u797673668 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 7,588 | 472 | あるプログラミングコンテストでは,競技後の懇親会でビンゴゲームをする習わしがある.しかし,このビンゴゲームで使うビンゴカードは少々特殊で,以下の条件に従って作成される. * ビンゴカードは N 行 N 列のマス目に区切られており,各マス目には正整数が1つずつ書かれている.それらの整数は全て異なる. * マス目に書かれている整数は 1 以上 M 以下である. * ビンゴカードに書かれているN×N個の整数の合計は S である. * どの列を見たときも,上から下に向かって整数は昇順に並んでいる. * どのマス目の整数も,そのマス目より左の列のどの整数よりも大きい. 以下は, N = 5, M = 50, S = 6... | def allocate(remains, limit_h, limit_w):
global m
if not remains:
return 1
if limit_w == 1:
return int(remains <= limit_h)
return sum(allocate(remains - i, i, limit_w - 1) for i in
range(min(limit_h, remains, m - limit_w), (remains - 1) // limit_w, -1))
while True:
n... | s178889445 | Accepted | 210 | 7,756 | 427 | while True:
n, m, s = map(int, input().split())
if not n:
break
n2 = n ** 2
dpp = [0] * (s + 1)
dpp[0] = 1
for i in range(1, n2 + 1):
dpn = [0] * (s + 1)
for j in range(i * (i + 1) // 2, s + 1):
dpn[j] += dpp[j - i] + dpn[j - i]
if j - m - 1 >= 0:... |
s517559739 | p03737 | u127856129 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | 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. | a,b,c=input().split()
print(a[0]+b[0]+c[0])
| s478464839 | Accepted | 17 | 2,940 | 73 | a,b,c=input().split()
print(a[0].upper()+b[0].upper()+c[0].upper())
|
s075756066 | p02262 | u742013327 | 6,000 | 131,072 | Wrong Answer | 20 | 7,628 | 1,347 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D
#???????????????????????????????????????????????????????????????????????????
cnt = 0
def insertion_sort(target_list,g):
maxlen = len(target_list)
global cnt
for focus_index in range(g, maxlen):
target = target_list[focus_index]
... | s418374401 | Accepted | 22,080 | 127,948 | 1,371 | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D
#???????????????????????????????????????????????????????????????????????????
cnt = 0
def insertion_sort(target_list,g):
maxlen = len(target_list)
global cnt
for focus_index in range(g, maxlen):
target = target_list[focus_index]
... |
s250073480 | p02843 | u760802228 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 901 | 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())
total = 0
if x % 10 == 9:
total += 104 + 105
elif x % 10 == 8:
total += 104 + 104
elif x % 10 == 7:
total += 103 + 104
elif x % 10 == 6:
total += 105 + 101
elif x % 10 == 5:
total += 105
elif x % 10 == 4:
total += 104
elif x % 10 == 3:
total += 10... | s783690454 | Accepted | 17 | 3,064 | 911 | x = int(input())
total = 0
if x % 10 == 9:
total += 104 + 105
elif x % 10 == 8:
total += 104 + 104
elif x % 10 == 7:
total += 103 + 104
elif x % 10 == 6:
total += 105 + 101
elif x % 10 == 5:
total += 105
elif x % 10 == 4:
total += 104
elif x % 10 == 3:
total += 10... |
s120026651 | p03592 | u057993957 | 2,000 | 262,144 | Wrong Answer | 33 | 9,112 | 360 | We have a grid with N rows and M columns of squares. Initially, all the squares are white. There is a button attached to each row and each column. When a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa. When a button attach... | n, m, k = list(map(int, input().split()))
flag = False
for y in range(m):
if n - 2 * y == 0:
continue
x = (k - m * y) / (n - 2 * y)
if (k - m * y) % (n - 2 * y) == 0 and (0 <= x and x <= m):
print(y, (k - m * y) / (n - 2 * y), (n - 2 * y), (k - m * y))
flag = True
... | s138800140 | Accepted | 29 | 9,132 | 292 | n, m, k = list(map(int, input().split()))
flag = False
for y in range(n+1):
if n - 2 * y == 0:
continue
x = (k - m * y) / (n - 2 * y)
if (k - m * y) % (n - 2 * y) == 0 and (0 <= x and x <= m):
flag = True
break
print("Yes" if flag else "No") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.