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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s916121210 | p02612 | u366974168 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,084 | 63 | 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())
x=N%1000
if x==1000:
print(0)
else:
print(x) | s529247983 | Accepted | 31 | 9,104 | 67 | N=int(input())
x=N%1000
if x==0:
print(0)
else:
print(1000-x) |
s947499475 | p03386 | u782733831 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | 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())
r=range(a,b+1)
for i in sorted(set(r[:3])|set(r[-3:])):
print(i) | s070246919 | Accepted | 18 | 3,060 | 99 | a,b,k=map(int,input().split())
r=range(a,b+1)
for i in sorted(set(r[:k])|set(r[-k:])):
print(i) |
s728502495 | p02612 | u114099505 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,144 | 62 | 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())
if N%1000==0:
print(0)
print(1000-1000%N) | s928032882 | Accepted | 29 | 9,096 | 103 | N = int(input())
if N%1000==0:
print(0)
elif N<1000:
print(1000-N)
else:
print(1000-N%1000) |
s628082603 | p03228 | u319805917 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 241 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | A,B,K=map(int,input().split())
count=1
while count!=K:
if A%2!=0:
A-=1
A,B=A/2,A/2+B
count+=1
A,B=B,A
if count%2==0:
print(int(A),int(B))
else:
print(int(B),int(A)) | s586518110 | Accepted | 17 | 3,060 | 241 | A,B,K=map(int,input().split())
count=0
while count!=K:
if A%2!=0:
A-=1
A,B=A/2,A/2+B
count+=1
A,B=B,A
if count%2==0:
print(int(A),int(B))
else:
print(int(B),int(A)) |
s991991105 | p03963 | u050622763 | 2,000 | 262,144 | Wrong Answer | 119 | 27,236 | 179 | There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors. Find the number of the possible ways to paint the balls. | def ABC046_B():
import numpy as np
n,k = map(int,input().split())
print(n,k)
for i in range(n):
ans = k*np.power(k-1,n-1)
print(ans)
ABC046_B() | s356194952 | Accepted | 117 | 27,004 | 165 | def ABC046_B():
import numpy as np
n,k = map(int,input().split())
for i in range(n):
ans = k*np.power(k-1,n-1)
print(ans)
ABC046_B() |
s630626849 | p03486 | u418826171 | 2,000 | 262,144 | Wrong Answer | 31 | 9,156 | 357 | 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 = sorted(input())
t = sorted(input())
flag1 = True
flag2 = False
if len(s) < len(t):
for i in range(len(s)):
if s[i] != t[i]:
flag1 = False
break
else:
flag1 = False
for i in range(min(len(s), len(t))):
if s[i] < t[i]:
flag2 = True
break
if flag1 or flag2:
... | s148632727 | Accepted | 31 | 9,096 | 103 | s = sorted(input())
t = sorted(input(),reverse = True)
if s < t:
print('Yes')
else:
print('No') |
s425621796 | p02694 | u301679431 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,080 | 68 | 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())
Y=100
n=0
while Y<=X:
Y=int(Y*1.01)
n+=1
print(n) | s489427437 | Accepted | 22 | 9,000 | 67 | X=int(input())
Y=100
n=0
while Y<X:
Y=int(Y*1.01)
n+=1
print(n) |
s730197311 | p03485 | u102960641 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 65 | 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. | import math
a,b = map(int, input().split())
print(math.ceil(a+b)) | s605939302 | Accepted | 18 | 2,940 | 70 | import math
a,b = map(int, input().split())
print(math.ceil((a+b)/2))
|
s885396544 | p03997 | u334712262 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | 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)//2) | s092977576 | Accepted | 17 | 2,940 | 68 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
s214851406 | p03069 | u166306121 | 2,000 | 1,048,576 | Wrong Answer | 202 | 16,692 | 1,211 | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`. Takahashi wants to change the colors of some stones to black or white so t... | import sys
# gcd
from fractions import gcd
# from math import ceil, floor
# from copy import deepcopy
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# print(S.most_common(2)) # [('b', 5), ('c', 4)]
# from collections import Counter
#
input = sys.stdin.readli... | s457549277 | Accepted | 199 | 14,368 | 1,208 | import sys
# gcd
# from fractions import gcd
# from math import ceil, floor
# from copy import deepcopy
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# print(S.most_common(2)) # [('b', 5), ('c', 4)]
# from collections import Counter
input = sys.stdin.readlin... |
s174748603 | p02975 | u704563784 | 2,000 | 1,048,576 | Wrong Answer | 59 | 14,836 | 557 | 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... | def count(l):
res = {}
for d in l:
if d in res:
res[d] += 1
else:
res[d] = 1
return res
n = float(input())
data = list(map(int, input().split()))
t = count(data)
if len(t) == 3:
if 0 not in t and all(i == n/3 for i in t.values()):
print('YES')
else:
... | s520956231 | Accepted | 58 | 14,116 | 606 | def count(l):
res = {}
for d in l:
if d in res:
res[d] += 1
else:
res[d] = 1
return res
n = float(input())
data = list(map(int, input().split()))
t = count(data)
if len(t) == 3:
ks = list(t.keys())
if 0 not in t and all(i == n/3 for i in t.values()) and ks[0]... |
s641092122 | p03693 | u588526762 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 316 | 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... |
rgb_list = list(map(int, input().split()))
print(rgb_list)
rgb_list = map(str, rgb_list)
rgb = ''.join(rgb_list)
if int(rgb)%4 == 0:
print('YES')
else:
print('NO') | s492215392 | Accepted | 17 | 2,940 | 96 | r,g,b = map(int,input().split())
if((10*g + b) % 4 == 0):
print('YES')
else:
print('NO') |
s827505984 | p03502 | u732870425 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 141 | 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 = int(input())
t = N + 0
c = 0
while 0 < t:
c += t % 10
t = t / 10
print("Yes" if N % c == 0 else "No") | s528970147 | Accepted | 18 | 2,940 | 142 | N = int(input())
t = N + 0
c = 0
while 0 < t:
c += t % 10
t = t // 10
print("Yes" if N % c == 0 else "No") |
s113561954 | p03672 | u539517139 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 150 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | s=input()
if len(s)%2==0:
s=s[:len(s)-3]
else:
s=s[:len(s)-2]
while True:
l=len(s)
if s[:l//2-1]==s[l//2:]:
print(l)
break
s=s[:l-2] | s100986035 | Accepted | 17 | 3,060 | 148 | s=input()
if len(s)%2==0:
s=s[:len(s)-2]
else:
s=s[:len(s)-1]
while True:
l=len(s)
if s[:l//2]==s[l//2:]:
print(l)
break
s=s[:l-2] |
s771953645 | p02936 | u379142263 | 2,000 | 1,048,576 | Wrong Answer | 1,626 | 54,260 | 418 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | import sys
if __name__ == "__main__":
n,q = map(int,input().split())
edge = [[] for i in range(n)]
for i in range(n-1):
a,b = map(int,input().split())
a-=1
b-=1
edge[a].append(b)
edge[b].append(a)
cnt = [0]*n
for i in range(q):
p,x = map(int,input().... | s973188222 | Accepted | 1,164 | 55,200 | 730 | import sys
import collections
INF = 10**18
def dfs(s,cnt):
visited = [False]*n
visited[s] = True
q = collections.deque([s])
while q:
p = q.pop()
visited[p] = True
for v in edge[p]:
if visited[v]:
continue
cnt[v] += cnt[p]
q.app... |
s284949634 | p03470 | u322826875 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 212 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... |
n = int(input ())
print(n)
d = [int(input()) for i in range(n)]
#print(d)
d2 = sorted(d)
#print(d2)
count=1
for i in range(n-1):
if( d2[i] < d2[i+1] ):
count += 1
print(count) | s715564226 | Accepted | 17 | 3,060 | 213 |
n = int(input ())
#print(n)
d = [int(input()) for i in range(n)]
#print(d)
d2 = sorted(d)
#print(d2)
count=1
for i in range(n-1):
if( d2[i] < d2[i+1] ):
count += 1
print(count) |
s945097922 | p00008 | u273843182 | 1,000 | 131,072 | Wrong Answer | 30 | 5,584 | 167 | 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). | num = int(input())
count = 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==num:
count+=1
print(int(count)) | s106893394 | Accepted | 180 | 5,592 | 220 | while True:
try:
num = int(input())
count = 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==num:
count+=1
print(int(count))
except:
break |
s832086175 | p03024 | u063073794 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 64 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | s=input()
if s.count("x")>=8:
print("YES")
else:
print("NO") | s602175391 | Accepted | 17 | 2,940 | 65 | s=input()
if s.count("x")>=8:
print("NO")
else:
print("YES")
|
s755353339 | p03251 | u902468164 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 363 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | str1 = input();
str2 = str1.split(" ")
n = int(str2[0])
m = int(str2[1])
xcap = int(str2[2])
ycap = int(str2[3])
strx = input()
stry = input()
strx2 = strx.split(" ")
stry2 = stry.split(" ")
for i in range(n):
strx2[i] = int(strx2[i])
for i in range(m):
stry2[i] = int(stry2[i])
if max(strx2) >= min(stry2)-1:... | s319005991 | Accepted | 17 | 3,064 | 381 | str1 = input();
str2 = str1.split(" ")
n = int(str2[0])
m = int(str2[1])
xcap = int(str2[2])
ycap = int(str2[3])
strx = input()
stry = input()
strx2 = strx.split(" ")
stry2 = stry.split(" ")
for i in range(n):
strx2[i] = int(strx2[i])
for i in range(m):
stry2[i] = int(stry2[i])
if max(max(strx2),xcap) < min(... |
s094675261 | p02612 | u072284094 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,124 | 26 | 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) | s538690814 | Accepted | 28 | 9,148 | 75 | n = int(input()) % 1000
if n > 0:
print(1000 - n)
else:
print(0)
|
s415229050 | p03502 | u915214301 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | 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. | x = input()
fx = sum([int(num) for num in x])
print("YES" if int(x)%fx == 0 else "NO") | s571847933 | Accepted | 17 | 2,940 | 90 |
x = input()
fx = sum([int(num) for num in x])
print("Yes" if int(x)%fx == 0 else "No")
|
s054298874 | p02936 | u921811474 | 2,000 | 1,048,576 | Wrong Answer | 1,958 | 137,748 | 446 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | N, Q = map(int,input().split())
l = [list(map(int,input().split())) for _ in range(N-1)]
m = [list(map(int,input().split())) for _ in range(Q)]
ll = [0]*N
bb = [[i] for i in range(1,N+1)]
for i in l:
bb[i[0]-1].append(i[1])
for i in m:
ll[i[0]-1] += int(i[1])
ans = [0]*N
# print("bb=",bb)
# print("ll=",ll)
for ... | s574592063 | Accepted | 1,268 | 36,896 | 341 | n, q = map(int, input().split())
ki = [0] * (n + 1)
for i in range(n - 1):
a, b = map(int, input().split())
ki[b] = a
# print("ki=",ki)
c = [0] * (n + 1)
for i in range(q):
p, x = map(int, input().split())
c[p] += x
# print("c=",c)
for i in range(1, n + 1):
c[i] += c[ki[i]]
# print(c)
print(" ".j... |
s913691444 | p03359 | u163320134 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | 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:
print(a)
else:
print(a-1) | s835177409 | Accepted | 19 | 3,060 | 67 | a,b=map(int,input().split())
if a<=b:
print(a)
else:
print(a-1) |
s995609846 | p03416 | u617440820 | 2,000 | 262,144 | Wrong Answer | 103 | 3,188 | 219 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | input_one = input().split()
i = int(input_one[0])
two = input_one[1]
#i = int(one)
while i <= int(two):
i = str(i)
if i[0] == i[4]:
if i[1] == i[3]:
print(int(i))
i = int(i) + 1 | s662920184 | Accepted | 96 | 3,060 | 238 | input_one = input().split()
i = int(input_one[0])
two = input_one[1]
count = 0
#i = int(one)
while i <= int(two):
i = str(i)
if i[0] == i[4]:
if i[1] == i[3]:
count += 1
i = int(i) + 1
print(count) |
s002306271 | p03545 | u786020649 | 2,000 | 262,144 | Wrong Answer | 27 | 9,200 | 207 | 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... | tn=list(map(int,list(input())))
for i in range(2,16,2):
if sum(x*[1,-1][i>>k&1] for k,x in enumerate(tn))==7:
print(str(tn[0])+''.join(list(['+','-'][i>>k&1]+str(tn[k]) for k in range(1,4))))
break | s975911449 | Accepted | 29 | 9,136 | 221 | tn=list(map(int,list(input())))
for i in range(0,16,2):
if sum(x*[1,-1][i>>k&1] for k,x in enumerate(tn))==7:
s=''.join(list(['+','-'][i>>k&1]+str(tn[k]) for k in range(1,4)))
print(str(tn[0])+s+'=7')
break
|
s636328417 | p03131 | u169138653 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 128 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | k,a,b=map(int,input().split())
ans=0
cnt=0
if b<=a+1 or a>k:
print(k+1)
else:
print(a+(k-a+1)*(b-a)//2+(k-a+1)*(b-a)%2)
| s927749143 | Accepted | 17 | 2,940 | 121 | k,a,b=map(int,input().split())
ans=0
cnt=0
if b<=a+1 or a>k:
print(k+1)
else:
print(a+((k-a+1)//2)*(b-a)+((k-a+1)%2)) |
s333838001 | p03095 | u405256066 | 2,000 | 1,048,576 | Wrong Answer | 293 | 22,640 | 168 | You are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings. Here, a subsequence of a string is a conca... | import numpy as np
from sys import stdin
N=int(stdin.readline().rstrip())
S=(stdin.readline().rstrip())
S=list(S)
ans=N**2-2**(((N-len(set(S))))+1)
print(ans%(10**9+7)) | s355429193 | Accepted | 60 | 3,956 | 172 | from sys import stdin
N=int(stdin.readline().rstrip())
S=(stdin.readline().rstrip())
S=list(S)
ans=1
for i in set(S):
ans=ans*(S.count(i)+1)
ans-=1
print(ans%(10**9+7)) |
s419001724 | p03352 | u331036636 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 4 | 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. | s228724897 | Accepted | 86 | 2,940 | 160 | x = int(input())
list_all = [1]
for i in range(2,x):
if i**2 >x:break
list_all.append(max([i**j for j in range(2,x) if x >= i**j]))
print(max(list_all)) | |
s057707326 | p03644 | u204800924 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 262 | 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())
result = 0
for i in range(N+1):
count = 0
flag = True
while flag == True:
if i%2 == 0:
count += 1
i = i/2
else:
flag = False
result = max([result,count])
print(2^(result))
| s068615223 | Accepted | 17 | 2,940 | 88 | N = int(input())
count = 0
while N != 1:
count += 1
N = N//2
print(2**count)
|
s269677604 | p00735 | u328199937 | 3,000 | 131,072 | Wrong Answer | 12,220 | 10,048 | 948 | Chief Judge's log, stardate 48642.5. We have decided to make a problem from elementary number theory. The problem looks like finding all prime factors of a positive integer, but it is not. A positive integer whose remainder divided by 7 is either 1 or 6 is called a 7 ** _N_** +{1,6} number. But as it is hard to pronou... | this_prime_num = [0 for i in range(300001)]
for i in range(300001):
if i % 7 == 1 or i % 7 == 6:
this_prime_num[i] = 1
for i in range(2, 300001):
j = i * 2
while this_prime_num[i] == 1 and j < len(this_prime_num):
#print(j)
this_prime_num[j] = 0
j += i
this_primenum_list ... | s944881441 | Accepted | 12,200 | 10,052 | 949 | this_prime_num = [0 for i in range(300001)]
for i in range(300001):
if i % 7 == 1 or i % 7 == 6:
this_prime_num[i] = 1
for i in range(2, 300001):
j = i * 2
while this_prime_num[i] == 1 and j < len(this_prime_num):
#print(j)
this_prime_num[j] = 0
j += i
this_primenum_list ... |
s889073609 | p03569 | u785205215 | 2,000 | 262,144 | Wrong Answer | 1,497 | 4,212 | 989 | We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly: * Insert a letter `x` to any position in s of his choice, including the beginning and end of s. Snuke's objective is to turn s into a palindrome. Determine whether the objective is achievable. If it is ... | from sys import stdin, stdout
import re
def main():
s = [i for i in stdin.readline()]
left = 0
right = 0
if len(s) == 1:
print(0)
else:
f = True
while f:
if len(s) == 1:
break
else:
while s[0]=='... | s912816722 | Accepted | 69 | 3,316 | 204 | s = input()
ans = 0
p = 0
q = len(s) - 1
while p < q:
if s[p] == s[q]:
p += 1
q -= 1
elif s[p] == "x":
p += 1
ans += 1
elif s[q] == "x":
q -= 1
ans += 1
else:
ans = -1
break
print(ans) |
s093585549 | p03485 | u845937249 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 112 | 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())
import math
print(math.ceil(a/b))
| s278181024 | Accepted | 17 | 2,940 | 116 | a,b = map(int,input().split())
import math
print(math.ceil((a+b)/2))
|
s534892136 | p03370 | u422552722 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 243 | 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(" "))
i = 0
dough = []
count = N
while i < N:
dough.append(int(input()))
i += 1
# make at least one doughnut for each
excess = X - sum(dough)
while X <= 0:
X -= min(dough)
count += 1
print(count) | s394618562 | Accepted | 197 | 3,060 | 258 | N, X = map(int, input().split(" "))
i = 0
dough = []
count = N
while i < N:
dough.append(int(input()))
i += 1
# make at least one doughnut for each
excess = X - sum(dough)
while excess >= 0:
excess -= min(dough)
count += 1
print(count - 1) |
s788267359 | p03387 | u853869447 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 214 | 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 = sorted(map(int, input().split()))
print(A)
x = 0
while A[0] < A[2] - 1:
A[0] += 2
x += 1
while A[1] < A[2] - 1:
A[1] += 2
x += 1
if A[0] == A[1]:
x = x + 1
else:
x = x + 1
print(x) | s137233364 | Accepted | 17 | 3,060 | 243 | A = sorted(map(int, input().split()))
x = 0
while A[0] < A[2] - 1:
A[0] += 2
x += 1
while A[1] < A[2] - 1:
A[1] += 2
x += 1
if A[0] == A[1] == A[2]:
x = x
elif A[0] == A[1]:
x = x + 1
else:
x = x + 2
print(x) |
s236870999 | p03417 | u932868243 | 2,000 | 262,144 | Wrong Answer | 23 | 9,112 | 101 | There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, and initially every card faces up. We will perform the following op... | n,m=map(int,input().split())
if n>=3 and m>=3:
print(n*m-(n-2)*(m-2))
elif n==1 or m==1:
print(2) | s045588720 | Accepted | 24 | 9,172 | 150 | n,m=map(int,input().split())
if n==m==1:
print(1)
exit()
if n>=3 and m>=3:
print((n-2)*(m-2))
elif n==1 or m==1:
print(n*m-2)
else:
print(0) |
s029961465 | p04043 | u317493066 | 2,000 | 262,144 | Wrong Answer | 24 | 3,064 | 439 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | # -*- coding:utf-8 -*-
def check(data):
five_count = 0
seven_count = 0
for i in data:
if i == 5:
five_count += 1
elif i == 7:
seven_count += 1
if five_count == 2 and seven_count == 1:
return True
else:
return False
if __name__ == "__main__":... | s137316102 | Accepted | 23 | 3,064 | 391 | # -*- coding:utf-8 -*-
def check(data):
five_count = 0
seven_count = 0
for i in data:
if i == 5:
five_count += 1
elif i == 7:
seven_count += 1
if five_count == 2 and seven_count == 1:
return "YES"
else:
return "NO"
if __name__ == "__main__":... |
s729105655 | p00293 | u621997536 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 232 | バスマニアの健次郎君は、A市内のバスをよく利用しています。ある日ふと、健次郎君の家の前のバス停から出発するすべてのバスを写真に収めることを思い立ちました。このバス停には飯盛山行きと鶴ケ城行きの2つのバス路線が通ります。各路線の時刻表は手に入れましたが、1つの時刻表としてまとめた方がバス停で写真が撮りやすくなります。 健次郎君を助けるために、2つの路線の時刻表を、0時0分を基準として出発時刻が早い順に1つの時刻表としてまとめるプログラムを作成してください。 | v = []
for i in range(2):
x = list(map(int, input().split()))
N, x = x[0], x[1:]
for j in range(N):
v.append(x[j * 2] * 60 + x[j * 2 + 1])
for i in sorted(set(v)):
print("{0}:{1:02d}".format(i // 60, i % 60)) | s202397204 | Accepted | 30 | 6,724 | 239 | v = []
for i in range(2):
x = list(map(int, input().split()))
N, x = x[0], x[1:]
for j in range(N):
v.append(x[j * 2] * 60 + x[j * 2 + 1])
print(' '.join(['{0}:{1:02d}'.format(i // 60, i % 60) for i in sorted(set(v))])) |
s927797782 | p03958 | u373047809 | 1,000 | 262,144 | Wrong Answer | 18 | 2,940 | 78 | There are K pieces of cakes. Mr. Takahashi would like to eat one cake per day, taking K days to eat them all. There are T types of cake, and the number of the cakes of type i (1 ≤ i ≤ T) is a_i. Eating the same type of cake two days in a row would be no fun, so Mr. Takahashi would like to decide the order for eating ... | k, _, *a = map(int, open(0).read().split())
print(max(b*2 - k - 1 for b in a)) | s602418361 | Accepted | 17 | 2,940 | 75 | k, _, *a = map(int, open(0).read().split())
print(max(max(a)*2 - k - 1, 0)) |
s208287736 | p02842 | u736524428 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 330 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | N = int(input())
X_low = 1
X_high = N
def can_buy(price):
return price * 1.08 >= N
while X_high - X_low > 1:
x = int(X_high + X_low) // 2
if can_buy(x):
X_low = x
else:
X_high = x
if int(X_low * 1.08) == N:
print(1)
else:
print(0)
| s949037332 | Accepted | 17 | 2,940 | 346 | N = int(input())
X_low = 1
X_high = 50001
def can_buy(price):
return int(price * 1.08) <= N
while X_high - X_low > 1:
x = int(X_high + X_low) // 2
if can_buy(x):
X_low = x
else:
X_high = x
if int(X_low * 1.08) == N:
print(X_low)
else:
print(":(")
|
s899874619 | p04030 | u242684850 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | 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()
t = ''
for x in s:
if x == 'B' and len(t) > 0:
t = t[:-1]
else:
t = t + x | s809230887 | Accepted | 19 | 2,940 | 91 | s = input()
t = ''
for x in s:
if x == 'B':
t = t[:-1]
else:
t = t + x
print(t) |
s436010773 | p03997 | u609814378 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | 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*2)/2) | s952572193 | Accepted | 17 | 2,940 | 75 | a = int(input())
b = int(input())
h = int(input())
print(int(((a+b)*h)/2)) |
s512885728 | p03408 | u580404776 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 225 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | from collections import Counter
N=int(input())
A=[input() for _ in range(N)]
M=int(input())
B=[input() for _ in range(M)]
a=Counter(A)
b=Counter(B)
ans=0
for p in A:
print(p)
ans=max(ans,a[p]-b[p])
print(ans) | s901635014 | Accepted | 20 | 3,316 | 212 | from collections import Counter
N=int(input())
A=[input() for _ in range(N)]
M=int(input())
B=[input() for _ in range(M)]
a=Counter(A)
b=Counter(B)
ans=0
for p in A:
ans=max(ans,a[p]-b[p])
print(ans) |
s234866554 | p02928 | u023958502 | 2,000 | 1,048,576 | Wrong Answer | 411 | 3,188 | 554 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
time_ans = 0
A_sort = sorted(A)
before = -1
b = -1
for i in range(N):
a_sorti = A_sort[i]
if a_sorti == before:
time_ans += b
continue
b = A_sort.index(a_sorti)
time_ans += b
... | s671856278 | Accepted | 421 | 3,188 | 564 | # N = int(input())
N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
time_ans = 0
A_sort = sorted(A)
before = -1
b = -1
for i in range(N):
a_sorti = A_sort[i]
if a_sorti == before:
time_ans += b
continue
b = A_sort.index(a_sorti)
ti... |
s013917893 | p02612 | u450288159 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,148 | 90 | 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. | def main():
n = int(input())
print(n%1000)
if __name__ == '__main__':
main() | s084570148 | Accepted | 27 | 9,092 | 150 | def main():
n = int(input())
if n%1000 == 0:
print(0)
else:
print(1000 - (n%1000))
if __name__ == '__main__':
main() |
s141305364 | p03943 | u572561929 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 123 | 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 = (int(x) for x in input().split())
if a == b + c or b == a + c or c == a + b:
print('YES')
else:
print('NO')
| s254966722 | Accepted | 17 | 2,940 | 123 | a, b, c = (int(x) for x in input().split())
if a == b + c or b == a + c or c == a + b:
print('Yes')
else:
print('No')
|
s843658472 | p03605 | u126747509 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | 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? | def main():
n = input()
if '9' in n:
print("YES")
else:
print("NO")
if __name__ == "__main__":
main() | s250164495 | Accepted | 17 | 2,940 | 109 | def main():
if '9' in input(): print("Yes")
else: print("No")
if __name__ == "__main__":
main() |
s029234312 | p02409 | u609407244 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 305 | 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... | rooms = [[[0] * 10 for b in range(3)] for a in range(4)]
n = int(input())
for _ in range(n):
b, f, r, v = map(int, input().split())
rooms[b - 1][f - 1][r - 1] += v
for i in range(4):
for j in range(3):
print(' ' + ' '.join(map(str, rooms[i][j])))
if i < 4:
print('#' * 20) | s661375345 | Accepted | 30 | 6,724 | 305 | rooms = [[[0] * 10 for b in range(3)] for a in range(4)]
n = int(input())
for _ in range(n):
b, f, r, v = map(int, input().split())
rooms[b - 1][f - 1][r - 1] += v
for i in range(4):
for j in range(3):
print(' ' + ' '.join(map(str, rooms[i][j])))
if i < 3:
print('#' * 20) |
s764012140 | p03415 | u345094945 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 65 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | a=input()
b=input()
c=input()
print(a[0])
print(b[1])
print(c[2]) | s695926024 | Accepted | 17 | 2,940 | 51 | a=input()
b=input()
c=input()
print(a[0]+b[1]+c[2]) |
s319178386 | p03160 | u180908266 | 2,000 | 1,048,576 | Wrong Answer | 225 | 13,980 | 252 | 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())
h_s = list(map(int, input().split()))
h_s = [abs(h_s[0]-h) for h in h_s]+[0]*10
# print(h_s)
dp = [float("inf")]*(N+10)
dp[0] = 0
for i in range(N):
for j in range(1, 3):
dp[i+j] = min(dp[i+j], dp[i]+abs(h_s[i]-h_s[i+j]))
| s457575442 | Accepted | 210 | 13,980 | 232 | N = int(input())
h_s = list(map(int, input().split()))+[0]*10
# print(h_s)
dp = [float("inf")]*(N+10)
dp[0] = 0
for i in range(N):
for j in range(1, 3):
dp[i+j] = min(dp[i+j], dp[i]+abs(h_s[i]-h_s[i+j]))
print(dp[N-1]) |
s689953710 | p03563 | u101627912 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | # coding: utf-8
R=int(input())
G=int(input())
print((R+G)/2)
| s973841546 | Accepted | 17 | 2,940 | 62 | # coding: utf-8
R=int(input())
G=int(input())
print((G-R)+G) |
s246871564 | p03399 | u844789719 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 76 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | a = input()
b = input()
c = input()
d = input()
print(min(a, b) + min(c, d)) | s700216349 | Accepted | 17 | 2,940 | 74 | a, b, c, d = [int(input()) for _ in range(4)]
print(min(a, b) + min(c, d)) |
s326844128 | p03485 | u724154852 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 121 | 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. | import sys
import math
input = sys.stdin.readline
x,y = map(int,input().split())
a = float(x + y)
print(math.ceil(a))
| s621898315 | Accepted | 19 | 3,060 | 207 | import sys
import math
input = sys.stdin.readline
x,y = map(int,input().split())
a = float((x + y) / 2)
print(math.ceil(a))
|
s945515163 | p03502 | u375616706 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 207 | 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. | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
dig = 0
while N:
dig += N % 10
if N % dig == 0:
print("Yes")
else:
print("No")
| s615630393 | Accepted | 17 | 2,940 | 215 | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = input()[:-1]
dig = 0
for c in N:
dig += int(c)
if int(N) % dig == 0:
print("Yes")
else:
print("No")
|
s279299063 | p02615 | u075303794 | 2,000 | 1,048,576 | Wrong Answer | 226 | 50,144 | 233 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
ans=A[0]
if N%2==0:
for i in range(1,(N-2)//2+1):
ans+=A[i]*2
else:
for i in range(1,(N-2)//2):
ans+=A[i]*2
else:
ans+=A[i+1]
print(ans) | s903299279 | Accepted | 353 | 49,980 | 259 | import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
A=sorted(A,reverse=True)
ans=A[0]
if N%2==0:
for i in range(1,(N-2)//2+1):
ans+=A[i]*2
else:
for i in range(1,(N-2)//2+1):
ans+=A[i]*2
else:
ans+=A[i+1]
print(ans) |
s118273090 | p02646 | u927860986 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,184 | 209 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())
try:
print("Yes" if abs(A - B) // (V - W) <= T and abs(A - B) // (V - W) >= 0 else "No")
except ZeroDivisionError:
print("No") | s142651153 | Accepted | 23 | 9,184 | 192 | A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())
if V == W or V - W <= 0:
print("NO")
elif abs(A - B) / (V - W) <= T:
print("YES")
else:
print("NO") |
s258676923 | p03494 | u294385082 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 166 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(10**10):
for j in a:
if j%2 != 0:
print(count)
exit()
count += 1
| s183076552 | Accepted | 18 | 2,940 | 206 | n = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(10**10):
for j in range(n):
if a[j]%2 != 0:
print(count)
exit()
else:
a[j] = a[j]//2
count += 1
|
s742404895 | p03494 | u411278350 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,060 | 205 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | N = int(input())
a = list(map(int, input().split()))
cnt = 0
while True:
for i in range(N):
if a[i] % 2 == 1:
break
else:
a[i] = a[i]/2
cnt += 1
print(cnt) | s649801659 | Accepted | 18 | 3,060 | 257 | N = int(input())
a = list(map(int, input().split()))
cnt = 0
t_f = True
while t_f == True:
for i in range(N):
if a[i] % 2 == 1:
t_f = False
break
else:
a[i] = a[i]//2
cnt += 1
print(cnt - 1) |
s689115153 | p02606 | u509150616 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,088 | 157 | How many multiples of d are there among the integers between L and R (inclusive)? | def solve(L,R,d):
count = 0
for i in range(L,R+1):
if i % d == 0:
count += 1
return count
L, R, D = map(int, input().split()) | s743146381 | Accepted | 23 | 9,088 | 177 | def solve(L,R,d):
count = 0
for i in range(L,R+1):
if i % d == 0:
count += 1
return count
L, R, d = map(int, input().split())
print(solve(L,R,d)) |
s264811394 | p02665 | u672542358 | 2,000 | 1,048,576 | Wrong Answer | 365 | 20,144 | 270 | Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1. | n=int(input())
l=list(map(int,input().split()))
xl=list(reversed(l))
g=[]
a=1
k=0
f=0
for i in xl:
k+=i
g.append(k)
g.reverse()
for i in range(len(g)):
if g[i]>=a:
g[i]=a
a-=l[i]
a*=2
if a<=0:
f+=1
break
if f==0:
print(sum(g))
else:
print(-1) | s810312355 | Accepted | 387 | 20,024 | 400 | n=int(input())
l=list(map(int,input().split()))
xl=list(reversed(l))
g=[]
a=1
k=0
f=0
for i in xl:
k+=i
g.append(k)
g.reverse()
for i in range(len(g)):
if g[i]>=a:
g[i]=a
a-=l[i]
a*=2
if a<=0 and i!=len(g)-1:
f+=1
break
if a<0 and i==len(g)-1:
f+=1
break
if f==0 and n!=0:
print(sum(g... |
s913359932 | p02601 | u433697974 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,200 | 350 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | import sys
def hantei(A, B, C, K):
i = 0
while A >= B:
if i >= K:
return False
sys.exit()
B *= 2
i += 1
while B >= C:
if i >= K:
return False
sys.exit()
C *= 2
i += 1
return True
A, B, C = map(int, input().split())
K = int(input())
if(hantei(A, B, C, K)):
pr... | s147691808 | Accepted | 35 | 9,196 | 350 | import sys
def hantei(A, B, C, K):
i = 0
while A >= B:
if i >= K:
return False
sys.exit()
B *= 2
i += 1
while B >= C:
if i >= K:
return False
sys.exit()
C *= 2
i += 1
return True
A, B, C = map(int, input().split())
K = int(input())
if(hantei(A, B, C, K)):
pr... |
s241758808 | p03997 | u679817762 | 2,000 | 262,144 | Wrong Answer | 30 | 9,020 | 90 | 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 / 2) | s339431272 | Accepted | 28 | 9,084 | 97 |
a = int(input())
b = int(input())
h = int(input())
print(int(((a + b) * h) / 2)) |
s884900085 | p03549 | u867848444 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 269 | 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())
ac=(n-m)*100
tle=m*1900
time=0
cnt=1
time_ac=(ac+tle)*(1/2)**m
fault=(1-(1/2)**m)
while True:
temp=cnt*time_ac*(fault**(cnt-1))
if time==time+temp:
print(math.ceil(time))
break
time+=temp
cnt+=1
| s480047181 | Accepted | 20 | 3,188 | 253 | n,m=map(int,input().split())
ac=(n-m)*100
tle=m*1900
time=0
cnt=1
time_ac=(ac+tle)*(1/2)**m
fault=(1-(1/2)**m)
while True:
temp=cnt*time_ac*(fault**(cnt-1))
if time==time+temp:
print(round(time))
break
time+=temp
cnt+=1
|
s962826682 | p03400 | u574053975 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 174 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | n=int(input())
x=input()
x=x.split()
d=int(x[0])
x=int(x[1])
o=0
for i in range(n):
a=int(input())
b=0
c=0
while b<d:
o+=1
b=c*a+1
c+=1
o+=x
print(str(o)) | s265649746 | Accepted | 17 | 3,064 | 174 | n=int(input())
x=input()
x=x.split()
d=int(x[0])
x=int(x[1])
o=0
for i in range(n):
a=int(input())
b=0
c=0
while (c*a+1)<=d:
o+=1
c+=1
o+=x
print(str(o)) |
s418579569 | p02409 | u067975558 | 1,000 | 131,072 | Wrong Answer | 30 | 6,788 | 835 | 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... | floor = [
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, ... | s007836128 | Accepted | 40 | 6,732 | 315 | floor = [[[0] * 10 for x in range(3)] for y in range(4)]
for c in range(int(input())):
(b,f,r,v) = [int(x) for x in input().split()]
floor[b-1][f-1][r-1] += v
for x in range(3 * 4):
if x % 3 == 0 and not x == 0:
print('#' * 20)
print('',' '.join(str(y) for y in floor[int(x / 3)][x % 3])) |
s109088049 | p03095 | u856234158 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 5,492 | 341 | You are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings. Here, a subsequence of a string is a conca... | def counter(flag,st):
count = 0
if st == '':
return count
for i in range(len(st)):
if not st[i] in flag:
flag[st[i]] = 1
count += 1
count += counter(flag,st[i:])
del flag[st[i]]
return count
N = int(input())
S = input()
cnt = 0
for i in range(N):
flag = {}
cnt += counter(f... | s132345323 | Accepted | 229 | 3,188 | 356 | N = int(input())
S = input()
charCnt = []
flag = {}
for c in S:
if not c in flag:
flag[c] = 1
charCnt.append([c,1])
else :
flag[c] += 1
for i in range(len(charCnt)):
if charCnt[i][0] == c:
charCnt[i][1] += 1
break
cnt = 1
for i in range(len(charCnt)):
cnt *= (charCnt[i][1]+1... |
s388198892 | p00015 | u582608581 | 1,000 | 131,072 | Wrong Answer | 30 | 7,720 | 692 | A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t... | def Add(numa, numb):
longer = (numa if len(numa) >= len(numb) else numb)
shorter = (numa if len(numa) < len(numb) else numb)
carry = 0
result = ''
for s in range(-1,-len(shorter) - 1, -1):
ans = int(longer[s]) + int(shorter[s]) + carry
if ans >= 10:
result = str(ans % 10) + result
carry = 1
else:
re... | s162504173 | Accepted | 20 | 7,684 | 737 | def Add(numa, numb):
longer = (numa if len(numa) >= len(numb) else numb)
shorter = (numa if len(numa) < len(numb) else numb)
carry = 0
result = ''
for s in range(-1, -len(shorter) - 1, -1):
ans = int(longer[s]) + int(shorter[s]) + carry
if ans >= 10:
result = str(ans % 10) + result
carry = 1
else:
r... |
s329059266 | p03063 | u591287669 | 2,000 | 1,048,576 | Wrong Answer | 237 | 29,480 | 335 | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`. Takahashi wants to change the colors of some stones to black or white so t... | n=int(input())
s=input()
w=[0]
b=[0]
for i in range(len(s)):
if s[i]=='#':
w.append(w[-1]+1)
else:
w.append(w[-1])
if s[-i-1]=='.':
b.append(b[-1]+1)
else:
b.append(b[-1])
print(w)
print(b)
total=[]
for i in range(len(s)+1):
total.append(w[i]+b[-i-1])
print(total)
pr... | s775762215 | Accepted | 190 | 20,932 | 338 | n=int(input())
s=input()
w=[0]
b=[0]
for i in range(len(s)):
if s[i]=='#':
w.append(w[-1]+1)
else:
w.append(w[-1])
if s[-i-1]=='.':
b.append(b[-1]+1)
else:
b.append(b[-1])
#print(w)
#print(b)
total=[]
for i in range(len(s)+1):
total.append(w[i]+b[-i-1])
#print(total)... |
s411738659 | p03919 | u397531548 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 222 | 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,M=map(int,input().split())
c=0
for i in range(H):
S=input().split()
for j in range(0,M):
if S[j]=="snuke":
a=i
b=j
else:
c+=1
print(chr(ord('A')+a) + str(b+1)) | s914693204 | Accepted | 18 | 3,060 | 224 | H,M=map(int,input().split())
c=0
for i in range(1,H+1):
S=input().split()
for j in range(0,M):
if S[j]=="snuke":
a=i
b=j
else:
c+=1
print(chr(ord('A')+b) + str(a)) |
s317441811 | p03007 | u983918956 | 2,000 | 1,048,576 | Wrong Answer | 288 | 20,456 | 700 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | N = int(input())
A = sorted(list(map(int,input().split())))
ans_list = []
p = []
n = []
p.append(A[-1])
n.append(A[0])
for a in A[1:-1]:
if a >= 0:
p.append(a)
elif a < 0:
n.append(a)
while len(p) != 1:
x = n.pop()
y = p.pop()
n.append(x-y)
ans_list.append((x, y))
while ... | s865659779 | Accepted | 249 | 20,120 | 315 | N = int(input())
A = sorted(list(map(int,input().split())))
p = A[-1]
n = A[0]
ans_list = []
for a in A[1:-1]:
if a >= 0:
ans_list.append((n, a))
n -= a
else:
ans_list.append((p, a))
p -= a
M = p - n
ans_list.append((p, n))
print(M)
for x, y in ans_list:
print(x, y) |
s091817275 | p03679 | u516242950 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 149 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x, a, b = map(int, input().split())
over = b - a
if over < x:
print("delicious")
elif x <= over < x + 1:
print("safe")
else:
print("dangerous") | s063271690 | Accepted | 17 | 2,940 | 143 | x, a, b = map(int, input().split())
over = b - a
if over <= 0:
print("delicious")
elif over <= x:
print("safe")
else:
print("dangerous")
|
s773849852 | p03457 | u316733945 | 2,000 | 262,144 | Wrong Answer | 396 | 27,300 | 296 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
print(txy[0])
for i in range(n):
if txy[i][1] + txy[i][2] >txy[i][0]:
status = "No"
break
elif (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
status = "No"
break
else:
status = "Yes"
print(status) | s095697353 | Accepted | 390 | 3,064 | 250 | n = int(input())
x0, y0, t0 = 0, 0, 0
for _ in range(n):
t, x, y = map(int, input().split())
if abs(x-x0) + abs(y-y0) > t-t0 or (x+y)%2 != t%2:
status = "No"
break
else:
status = "Yes"
t0, x0, y0 = t, x, y
print(status) |
s336520560 | p03693 | u841568901 | 2,000 | 262,144 | Wrong Answer | 26 | 9,024 | 56 | 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... | print("No" if int(input().replace(" ",""))%4 else "Yes") | s649923849 | Accepted | 25 | 9,148 | 56 | print("NO" if int(input().replace(" ",""))%4 else "YES") |
s106112213 | p04043 | u408375121 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 200 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | l = list(map(int, input().split()))
count_5 = 0
count_7 = 0
for r in l:
if r == 5:
count_5 += 1
if r == 7:
count_7 += 1
if count_5 == 2 and count_7 == 1:
print('Yes')
else:
print('No') | s981623239 | Accepted | 17 | 2,940 | 201 | l = list(map(int, input().split()))
count_5 = 0
count_7 = 0
for r in l:
if r == 5:
count_5 += 1
if r == 7:
count_7 += 1
if count_5 == 2 and count_7 == 1:
print('YES')
else:
print('NO')
|
s261096389 | p04045 | u924845460 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 159 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | n,k=map(int, input().split())
ds=list(map(str, input().split()))
while True:
for i in ds:
if i in str(n):
n+=1
continue
break
print(str(n)) | s352300790 | Accepted | 102 | 2,940 | 126 | fn=str
n,k=map(int, input().split())
ds=list(map(fn, input().split()))
while any(i in fn(n) for i in ds):
n+=1
print(fn(n))
|
s464457813 | p03779 | u252828980 | 2,000 | 262,144 | Wrong Answer | 28 | 2,940 | 64 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a... | n = int(input())
t = 0
while t*(t+1) <=2*n:
t += 1
print(t) | s368225311 | Accepted | 40 | 9,072 | 88 | d = int(input())
t = 0
while True:
if t*(t+1)//2 >=d:
print(t)
exit()
t +=1 |
s720172359 | p02646 | u746206084 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,204 | 136 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | a,v = map(int,input().split())
b,w = map(int,input().split())
t=int(input())
if abs(a-b)>(v-w)*t:
print("No")
else:
print("Yes") | s865717879 | Accepted | 22 | 9,180 | 136 | a,v = map(int,input().split())
b,w = map(int,input().split())
t=int(input())
if abs(a-b)>(v-w)*t:
print("NO")
else:
print("YES") |
s935921211 | p03625 | u950708010 | 2,000 | 262,144 | Wrong Answer | 112 | 14,252 | 251 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | n = int(input())
a = sorted(list(int(i) for i in input().split()),reverse=True)
ans = []
for i in range (n-1):
if a[i+1] == a[i]:
ans.append(a[i])
a[i+1]= 0
print(a[i])
if len(ans)>=2:
cand = ans[0]*ans[1]
break
else:
cand = 0
print(cand) | s650526502 | Accepted | 111 | 14,252 | 238 | n = int(input())
a = sorted(list(int(i) for i in input().split()),reverse=True)
ans = []
for i in range (n-1):
if a[i+1] == a[i]:
ans.append(a[i])
a[i+1]= 0
if len(ans)>=2:
cand = ans[0]*ans[1]
break
else:
cand = 0
print(cand)
|
s817497040 | p03545 | u492532572 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 475 | 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... | A, B, C, D = map(int, input())
for i in range(8):
sum = 0
op1 = "+" if i // 4 % 2 == 0 else "-"
op2 = "+" if i // 2 % 2 == 0 else "-"
op3 = "+" if i % 2 == 0 else "-"
if op1 == "+":
sum = A + B
else:
sum = A - B
if op2 == "+":
sum += C
else:
sum -= C
i... | s323740657 | Accepted | 18 | 3,064 | 482 | A, B, C, D = map(int, input())
for i in range(8):
sum = 0
op1 = "+" if i // 4 % 2 == 0 else "-"
op2 = "+" if i // 2 % 2 == 0 else "-"
op3 = "+" if i % 2 == 0 else "-"
if op1 == "+":
sum = A + B
else:
sum = A - B
if op2 == "+":
sum += C
else:
sum -= C
i... |
s204973340 | p03407 | u118019047 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 85 | 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())
if a + b < c:
print("yes")
else:
print("No") | s680670474 | Accepted | 17 | 2,940 | 83 | a,b,c = map(int,input().split())
if a+b>=c:
print("Yes")
else:
print("No") |
s072044489 | p03814 | u361826811 | 2,000 | 262,144 | Wrong Answer | 17 | 3,512 | 292 | 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... |
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
S = readline().rstrip()
print(S.index('A'))
print(len(S)-(S[::-1].index('Z')+1))
print(abs(S.index('A')-(len(S)-(S[::-1].index('Z')+1)))+1)
| s480766692 | Accepted | 18 | 3,516 | 275 |
import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().decode('utf8')
print(-S.find('A') + S.rfind('Z') + 1)
|
s172715952 | p02742 | u086063386 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 90 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | h,w = map(int,input().split())
if h%2 == 1 and w%2 == 1: print(h*w/2+1)
else: print(h*w/2) | s888160127 | Accepted | 17 | 2,940 | 120 | h,w = map(int,input().split())
ans = (h*w)//2
if h%2 == 1 and w%2 == 1: ans += 1
if h == 1 or w == 1: ans = 1
print(ans) |
s232977715 | p02607 | u972658925 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,080 | 133 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | n = int(input())
a = list(map(int,input().split()))
cnt=0
for i in range(len(a)):
if (i+1)&1==a[i]==1:
cnt+=1
print(cnt) | s607589737 | Accepted | 25 | 9,052 | 135 | n = int(input())
a = list(map(int,input().split()))
cnt=0
for i in range(len(a)):
if (i+1)&1==a[i]&1==1:
cnt+=1
print(cnt) |
s222474422 | p02742 | u893661063 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,176 | 155 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | H, W = map(int, input().split())
if H == 1 or W == 1:
ans = 1
elif (H * W) % 2 == 0:
ans = (H * W) / 2
else:
ans = (H * W) // 2 + 1
print (ans) | s898435760 | Accepted | 26 | 8,748 | 156 | H, W = map(int, input().split())
if H == 1 or W == 1:
ans = 1
elif (H * W) % 2 == 0:
ans = (H * W) // 2
else:
ans = (H * W) // 2 + 1
print (ans) |
s662100719 | p03478 | u739360929 | 2,000 | 262,144 | Wrong Answer | 29 | 3,408 | 208 | 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())
someSums = 0
for i in range(1, N+1):
if A <= (i // 1000 % 10) + (i // 100 % 10) + (i // 10 % 10) + (i % 10) <= B:
someSums += i
print(i)
print(someSums) | s901094034 | Accepted | 23 | 2,940 | 212 | N, A, B = map(int, input().split())
someSums = 0
for i in range(1, N+1):
if A <= (i // 10000) % 10 + (i // 1000) % 10 + (i // 100) % 10 + (i // 10) % 10 + (i % 10) <= B:
someSums += i
print(someSums)
|
s448071178 | p03456 | u189575640 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 251 | 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. | import sys
# A,B,C = [int(n) for n in input().split()]
# N = int(input())
# S = str(input())
# T = str(input())
a,b = [str(n) for n in input().split()]
ab = int(a+b)
print(ab)
table = [n*n for n in range(1,101)]
print("Yes" if ab in table else "No")
| s943594841 | Accepted | 18 | 3,192 | 2,169 | import sys
a, b = input().split()
ab = int(str(a) + str(b))
s = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2116, 2209, 2304, 2401, 2500... |
s125608388 | p02694 | u294542073 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,104 | 248 | 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())
t = 100
result = 0
while t >= X:
t += t // 100
result += 1
print(result) | s623851985 | Accepted | 24 | 9,016 | 210 | X = int(input())
n = 100
count = 0
while n < X:
count += 1
n = int(n * 1.01)
print(count) |
s161222176 | p02601 | u763410402 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,016 | 272 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | def main():
r,g,b=map(int,input().split())
k=int(input())
while(k>0):
if(g<=r):
g<<1
k-=1
elif(b<=g):
b<<1
k-=1
if(r<g and g<b):
print('Yes')
else:
print('No')
main()
| s432458300 | Accepted | 28 | 9,068 | 309 | def main():
r,g,b=map(int,input().split())
k=int(input())
while(k>0):
if(g<=r):
g=g<<1
k-=1
elif(b<=g):
b=b<<1
k-=1
else:
break;
if(r<g and g<b):
print('Yes')
else:
print('No')
main()
|
s839157302 | p02398 | u999594662 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 8,220 | 132 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | cnt=0
a,b,c=map(int,input().split())
while True:
if b-a<=0:break
for i in range(a,b):
if (c%a==0):
cnt+=1
a+=1
print(cnt) | s427861599 | Accepted | 20 | 7,636 | 94 | cnt=0
a,b,c=map(int,input().split())
for i in range(a,b+1):
if (c%i==0):
cnt+=1
print(cnt) |
s038308692 | p02842 | u411237324 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 83 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | n = int(input())
x = n // 1.08
if x * 1.08 == n:
print(x)
else:
print(':(') | s683243494 | Accepted | 17 | 2,940 | 151 | n = int(input())
x = int(n // 1.08)
if int(x * 1.08) == n:
print(x)
exit()
x = x + 1
if int(x * 1.08) == n:
print(x)
else:
print(':(')
|
s273905332 | p03971 | u252828980 | 2,000 | 262,144 | Wrong Answer | 76 | 9,204 | 458 | 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... | n,a,b = map(int,input().split())
a_cnt,b_cnt,cnt = 0,0,0
s = input()
cnt = a+b
for i in range(n):
if s[i] == "a":
if a_cnt + b_cnt <= cnt:
#print(a_cnt + b_cnt)
print("Yes")
else:
print("No")
a_cnt +=1
elif s[i] == "b":
if a_cnt + b_cnt < cnt ... | s635246156 | Accepted | 74 | 9,268 | 470 | n,a,b = map(int,input().split())
a_cnt,b_cnt,cnt = 0,0,0
s = input()
cnt = a+b
for i in range(n):
if s[i] == "a":
if a_cnt + b_cnt < cnt:
a_cnt +=1#print(a_cnt + b_cnt)
print("Yes")
else:
print("No")
elif s[i] == "b":
if a_cnt + b_cnt < cnt a... |
s630215204 | p03160 | u821432765 | 2,000 | 1,048,576 | Wrong Answer | 151 | 13,928 | 221 | 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())
h = [int(i) for i in input().split()]
dp = [float("inf")]*N
dp[0] = 0
for i in range(1, N):
dp[i] = min(dp[i], abs(h[i] - h[i-1]))
if i > 1: dp[i] = min(dp[i], abs(h[i] - h[i-2]))
print(dp[-1]) | s569244362 | Accepted | 179 | 13,928 | 245 | INF = 10**9
N = int(input())
h = [int(i) for i in input().split()] + [0, 0]
dp = [INF] * 100010
dp[0] = 0
for i in range(N):
dp[i+1] = min(dp[i+1], dp[i]+abs(h[i+1]-h[i]))
dp[i+2] = min(dp[i+2], dp[i]+abs(h[i+2]-h[i]))
print(dp[N-1]) |
s301758692 | p03852 | u361826811 | 2,000 | 262,144 | Wrong Answer | 147 | 12,400 | 296 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. |
import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().decode('utf8')
vowel = 'aiueo'
print('vowel' if S in vowel else 'consonant')
| s926145844 | Accepted | 269 | 19,748 | 305 |
import sys
import itertools
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().decode('utf8').rstrip()
vowel = 'aiueo'
print('vowel' if S in vowel else 'consonant')
|
s203056789 | p03679 | u144980750 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | 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())
print("delicious" if (c-b)<=a else "dangerous") | s596060575 | Accepted | 17 | 2,940 | 98 | a,b,c=map(int,input().split())
print("delicious" if b>=c else "safe" if (c-b)<=a else "dangerous") |
s550033760 | p03079 | u940102677 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 55 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | print("YNEOS"[len(set(map(int,input().split())))>1::2]) | s113747574 | Accepted | 17 | 2,940 | 55 | print("YNeos"[len(set(map(int,input().split())))>1::2]) |
s115083548 | p03740 | u780962115 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 99 | Alice and Brown loves games. Today, they will play the following game. In this game, there are two piles initially consisting of X and Y stones, respectively. Alice and Bob alternately perform the following operation, starting from Alice: * Take 2i stones from one of the piles. Then, throw away i of them, and put t... |
x,y=map(int,input().split())
if abs(x-y)<=1:
print("Blown")
else:
print("Alice") | s904457018 | Accepted | 17 | 2,940 | 100 |
x,y=map(int,input().split())
if abs(x-y)<=1:
print("Brown")
else:
print("Alice")
|
s674292885 | p02613 | u733866054 | 2,000 | 1,048,576 | Wrong Answer | 150 | 16,308 | 207 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N=int(input())
S=[str(input()) for i in range(N)]
AC=S.count("AC")
WA=S.count("WA")
TLE=S.count("TLE")
RE=S.count("RE")
print(f"AC × {AC}")
print(f"WA × {WA}")
print(f"TLE × {TLE}")
print(f"RE × {RE}") | s215156724 | Accepted | 149 | 16,192 | 203 | N=int(input())
S=[str(input()) for i in range(N)]
AC=S.count("AC")
WA=S.count("WA")
TLE=S.count("TLE")
RE=S.count("RE")
print(f"AC x {AC}")
print(f"WA x {WA}")
print(f"TLE x {TLE}")
print(f"RE x {RE}") |
s872795566 | p02412 | u471400255 | 1,000 | 131,072 | Wrong Answer | 30 | 7,520 | 581 | Write a program which identifies the number of combinations of three integers which satisfy the following conditions: * You should select three distinct integers from 1 to n. * A total sum of the three integers is x. For example, there are two combinations for n = 5 and x = 9. * 1 + 3 + 5 = 9 * 2 + 3 + 4 = 9 | s = []
while True:
cnt = 0
n, x = list(map(int, input().split()))
if n == 0 and x == 0:
break
else:
for i in range(1, n + 1):
for j in range(1, n + 1):
if i == j:
continue
else:
for k in range(1, n + 1):
... | s851546294 | Accepted | 540 | 7,552 | 363 | s = []
while True:
cnt = 0
n, x = list(map(int, input().split()))
if n == 0 and x == 0:
break
else:
for i in range(1, n + 1):
for j in range(1, i):
for k in range(1, j):
if i + j + k == x:
cnt += 1
s.append(c... |
s262331569 | p03997 | u668352391 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | 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) / 2) | s797110918 | Accepted | 17 | 2,940 | 73 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2)) |
s207628629 | p03469 | u843318346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | s = input()
print('2018/'+s[6:11]) | s934131777 | Accepted | 17 | 2,940 | 37 | s = input()
print('2018/01/'+s[-2:])
|
s853170174 | p02364 | u855775311 | 1,000 | 131,072 | Wrong Answer | 30 | 7,628 | 1,046 | Find the sum of weights of edges of the Minimum Spanning Tree for a given weighted undirected graph G = (V, E). | import sys
class UnionFind():
def __init__(self, n):
self.n = n
self.p = [i for i in range(n + 5)]
self.rank = [0 for i in range(n + 5)]
def find_set(self, x):
if self.p[x] != x:
self.p[x] = self.find_set(self.p[x])
return self.p[x]
def unite(self, x, ... | s402304955 | Accepted | 600 | 35,788 | 758 | import heapq
def main():
nvertices, nedges = map(int, input().split())
Adj = [[] for i in range(nvertices)]
for i in range(nedges):
u, v, w = map(int, input().split())
Adj[u].append((v, w))
Adj[v].append((u, w))
INF = float('inf')
Q = [(0, 0)]
for i in range(1, nvertic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.