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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s524453222 | p04029 | u961469795 | 2,000 | 262,144 | Wrong Answer | 34 | 9,012 | 69 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | N = int(input())
ans = 0
for i in range(N):
ans += i
print(ans) | s454585669 | Accepted | 23 | 9,064 | 73 | N = int(input())
ans = 0
for i in range(N):
ans += i + 1
print(ans) |
s965460554 | p03338 | u870297120 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 219 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | n = int(input())
s = input()
x = 0
for i in range(1, n):
print(i)
a,b = set(s[:i]), set(s[i:])
if max(len(a),len(b))-max(len(a-b),len(b-a))>x:
x = max(len(a),len(b))-max(len(a-b),len(b-a))
print(x) | s482934084 | Accepted | 17 | 2,940 | 139 | n = int(input())
s = input()
x = 0
for i in range(1, n):
a,b = set(s[:i]), set(s[i:])
if len(a&b)>x:
x = len(a&b)
print(x) |
s861558772 | p03361 | u785578220 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 786 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | N,M = map(int, input().split())
field =[]
field.append(list("."*(M+2)))
for i in range(N):
t = list("."+input()+".")
field.append(t)
field.append(list("."*(M+2)))
print(field)
res = 1
def dfs(x,y):
r = 0
#field[x][y] = "."
for dx in range(-1,2):
for dy in range(-1,2):
if ab... | s867028911 | Accepted | 24 | 3,064 | 773 | N,M = map(int, input().split())
field =[]
field.append(list("."*(M+2)))
for i in range(N):
t = list("."+input()+".")
field.append(t)
field.append(list("."*(M+2)))
res = 1
def dfs(x,y):
r = 0
#field[x][y] = "."
for dx in range(-1,2):
for dy in range(-1,2):
if abs(dx+dy) ==1:... |
s446849752 | p04044 | u924308178 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 89 | 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... | N,L = list(map(int,input().split(" ")))
S = [input() for i in range(N)]
S.sort()
print(S) | s781949191 | Accepted | 17 | 3,060 | 98 | N,L = list(map(int,input().split(" ")))
S = [input() for i in range(N)]
S.sort()
print("".join(S)) |
s934030769 | p03946 | u254871849 | 2,000 | 262,144 | Wrong Answer | 112 | 15,840 | 313 | There are N towns located in a line, conveniently numbered 1 through N. Takahashi the merchant is going on a travel from town 1 to town N, buying and selling apples. Takahashi will begin the travel at town 1, with no apple in his possession. The actions that can be performed during the travel are as follows: * _Mov... | import sys
from bisect import bisect_left as bi_l
n, t, *a = map(int, sys.stdin.read().split())
def main():
cand = []
mi = a[0]
for x in a[1:]:
cand.append(x - mi)
mi = min(mi, x)
cand.sort()
print(cand)
ans = n - bi_l(cand, cand[-1]) - 1
print(ans)
if __name__ == '__main__':
main() | s215836469 | Accepted | 102 | 14,052 | 299 | import sys
from bisect import bisect_left as bi_l
n, t, *a = map(int, sys.stdin.read().split())
def main():
cand = []
mi = a[0]
for x in a[1:]:
cand.append(x - mi)
mi = min(mi, x)
cand.sort()
ans = n - bi_l(cand, cand[-1]) - 1
print(ans)
if __name__ == '__main__':
main() |
s616182503 | p03999 | u670133596 | 2,000 | 262,144 | Wrong Answer | 27 | 3,064 | 533 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | S = input()
combination = 2 ** (len(S) - 1)
ans = 0
for i in range(combination):
bin_str = bin(i)[2:]
bin_str = '0' * (len(S) - len(bin_str) - 1) + bin_str
formula = ''
for i, s_char in enumerate(S):
plus = ''
if len(S) - 1 != i and bin_str[i] == '1':
pl... | s137141202 | Accepted | 28 | 3,064 | 545 | S = input()
combination = 2 ** (len(S) - 1)
ans = 0
for i in range(combination):
bin_str = bin(i)[2:]
bin_str = '0' * (len(S) - len(bin_str) - 1) + bin_str
formula = ''
for i, s_char in enumerate(S):
plus = ''
if len(S) - 1 != i and bin_str[i] == '1':
pl... |
s164530075 | p03433 | u146714526 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 225 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. |
def main():
N = int(input())
a = int(input())
r = N%500
if a >= r:
print ('yes')
else:
print ('No')
if __name__ == "__main__":
# global stime
# stime = time.clock()
main()
| s985928036 | Accepted | 17 | 2,940 | 264 |
def main():
N = int(input())
a = int(input())
r = N%500
if r == 0:
print ('Yes')
elif a >= r:
print ('Yes')
else:
print ('No')
if __name__ == "__main__":
# global stime
# stime = time.clock()
main()
|
s415270895 | p02536 | u395672550 | 2,000 | 1,048,576 | Wrong Answer | 314 | 12,768 | 899 | There are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M. Road i connects City A_i and City B_i. Snuke can perform the following operation zero or more times: * Choose two distinct cities that are not directly connected by a road, and build a new road between the two cities. After he... | class union_find():
def __init__(self,n):
self.n=n
self.root=[-1]*(n+1)
self.rank=[0]*(n+1)
def find_root(self,x):
if self.root[x]<0:
return x
else:
self.root[x]=self.find_root(self.root[x])
return self.root[x]
def unite(self... | s087619570 | Accepted | 333 | 11,576 | 884 | class union_find():
def __init__(self,n):
self.n=n
self.root=[-1]*(n+1)
self.rank=[0]*(n+1)
def find_root(self,x):
if self.root[x]<0:
return x
else:
self.root[x]=self.find_root(self.root[x])
return self.root[x]
def unite(self... |
s821806564 | p03777 | u464912173 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | Two deer, AtCoDeer and TopCoDeer, are playing a game called _Honest or Dishonest_. In this game, an honest player always tells the truth, and an dishonest player always tell lies. You are given two characters a and b as the input. Each of them is either `H` or `D`, and carries the following information: If a=`H`, AtCo... | a,b = input().split()
print("H" if 'a' == 'b' else "D") | s914200893 | Accepted | 17 | 2,940 | 52 | a,b = input().split()
print("H" if a == b else "D") |
s510342938 | p03089 | u706929073 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 372 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | n = int(input())
b = list(map(int, input().split()))
c = []
while 0 < len(b):
candidate = []
for i, b_i in enumerate(b):
if (i + 1) == b_i:
candidate.append(i)
if 0 == len(candidate):
print(-1)
exit(0)
c.append(b[candidate[-1]])
b.pop(candidate[-1])
if 0 != len(... | s798873744 | Accepted | 19 | 3,060 | 310 | n = int(input())
b = list(map(int, input().split()))
result = []
for i in range(len(b)):
for j in reversed(list(range(len(b)))):
if b[j] == j + 1:
result.append(b.pop(j))
break
if len(b) != 0:
print(-1)
exit(0)
for result_i in reversed(result):
print(result_i) |
s900113896 | p03574 | u686390526 | 2,000 | 262,144 | Wrong Answer | 153 | 12,896 | 916 | 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... | import numpy as np
def check_mass(i,j):
c=0
if i>0:
if j>0:
if mass[i-1][j-1]=="#":
c+=1
if mass[i-1][j]=="#":
c+=1
if j<W-1:
if mass[i-1][j+1]=="#":
c+=1
if True:
if mass[i][j-1]=="#":
c+=1
if mass[i][j]=="#":
c+=1
if j<W-1:
... | s197029699 | Accepted | 155 | 12,892 | 954 | import numpy as np
def check_mass(i,j):
c=0
if i>0:
if j>0:
if mass[i-1][j-1]=="#":
c+=1
if mass[i-1][j]=="#":
c+=1
if j<W-1:
if mass[i-1][j+1]=="#":
c+=1
if True:
if j>0:
if mass[i][j-1]=="#":
c+=1
if mass[i][j]=="#":
c+=1
... |
s556797747 | p03170 | u386195929 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 9,732 | 267 | There is a set A = \\{ a_1, a_2, \ldots, a_N \\} consisting of N positive integers. Taro and Jiro will play the following game against each other. Initially, we have a pile consisting of K stones. The two players perform the following operation alternately, starting from Taro: * Choose an element x in A, and remove... | n, k = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
dp = [0 for i in range(k+1)]
for i in range(len(dp)):
for j in arr:
if j+i < k+1:
dp[j+i] = (dp[i]+1)%2
ans = "First" if dp[-1] else "Second"
print(ans)
| s295209454 | Accepted | 120 | 9,864 | 287 | n, k = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
dp = [0 for i in range(k+1)]
for i in range(len(dp)):
if dp[i] == 0:
for j in arr:
if j+i < k+1:
dp[j+i] = 1
ans = "First" if dp[-1] else "Second"
print(ans) |
s276417116 | p03485 | u597436499 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 190 | 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
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
a,b = na()
import math
print(math.ceil((a+b / 2)))
| s332747620 | Accepted | 17 | 3,060 | 192 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
a,b = na()
import math
print(math.ceil(((a+b) / 2)))
|
s442497734 | p03080 | u249685005 | 2,000 | 1,048,576 | Wrong Answer | 24 | 2,940 | 94 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | s=list(input())
x=s.count('R')
y=s.count('B')
if x>>y:
print('Yes')
else:
print('No')
| s972463412 | Accepted | 17 | 2,940 | 103 | a=input()
s=list(input())
x=s.count('R')
y=s.count('B')
if x>y:
print('Yes')
else:
print('No')
|
s947771645 | p03852 | u863841238 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | 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`. | s = input()
if s in "aiueo":
print("Vowel")
else:
print("Consonant") | s660560073 | Accepted | 17 | 2,940 | 77 | s = input()
if s in "aiueo":
print("vowel")
else:
print("consonant")
|
s188878321 | p03386 | u564368158 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 187 | 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())
ans = []
if b - a < k:
k = b - a
for i in range(k):
ans.append(a+i)
ans.append(b-i)
ans = list(set(sorted(ans)))
for i in ans:
print(i) | s289578618 | Accepted | 17 | 3,060 | 197 | a, b, k = map(int, input().split())
if 2*k >= b-a+1:
for i in range(a, b+1):
print(i)
else:
for i in range(a, a+k):
print(i)
for j in range(b-k+1, b+1):
print(j) |
s474085697 | p03796 | u477142306 | 2,000 | 262,144 | Wrong Answer | 2,205 | 9,420 | 64 | 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. | s=int(input())
ans=1
for i in range(1,s):
ans*=i
print(ans) | s289449611 | Accepted | 43 | 9,112 | 92 | s=int(input())
ans=1
for i in range(1,s+1):
ans=ans%(10**9+7)*i
print(ans%(10**9+7)) |
s830598848 | p03474 | u932465688 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 193 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | A,B = map(int,input().split())
S = input()
L = [0,1,2,3,4,5,6,7,8,9]
for i in (range(A) and range(A+1,A+B+1)):
if (S[i] in L):
if (S[A] == '-'):
print('Yes')
else:
print('No') | s662978840 | Accepted | 22 | 3,316 | 281 | A,B = map(int,input().split())
S = list(input())
flag = True
L = ['1','2','3','4','5','6','7','8','9','0']
if (S[A] == '-'):
del S[A]
for i in range(len(S)):
if (S[i] not in L):
flag = False
break
else:
flag = False
if flag:
print('Yes')
else:
print('No') |
s341465029 | p03997 | u000123984 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | 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 ) | s556193269 | Accepted | 17 | 2,940 | 78 | a = int(input())
b = int(input())
h = int(input())
s = int((a+b)*h/2)
print(s) |
s317598806 | p03729 | u603234915 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 73 | 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 = input().split()
print(('No','Yes')[a[-1]==b[0] and b[-1]==c[0]])
| s005713832 | Accepted | 17 | 2,940 | 73 | a,b,c = input().split()
print(('NO','YES')[a[-1]==b[0] and b[-1]==c[0]])
|
s926073088 | p02407 | u369313788 | 1,000 | 131,072 | Wrong Answer | 20 | 7,596 | 86 | Write a program which reads a sequence and prints it in the reverse order. | input()
numbers = [int(i) for i in input().split()]
numbers.reverse()
print(numbers) | s461562436 | Accepted | 30 | 7,424 | 78 | input()
numbers = input().split()
numbers.reverse()
print(" ".join(numbers)) |
s478187885 | p03645 | u796424048 | 2,000 | 262,144 | Wrong Answer | 747 | 39,284 | 301 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... | N,M = map(int,input().split())
a = [[0 for i in range(2)] for j in range(M)]
b = []
for l in range(M):
a[l][0] , a[l][1] = map(int,input().split())
for k in range(M):
if a[k][0] == a[0][1]:
b.append(k)
for m in b:
if a[m][1] == N:
print ('possible')
else:
print('impossible')
| s864993030 | Accepted | 814 | 48,584 | 448 | import sys
N,M = map(int,input().split())
a = [[0 for i in range(2)] for j in range(M)]
b = []
c = []
for i in range(M):
a[i][0] , a[i][1] = map(int,input().split())
first, second = a[i][0],a[i][1]
if first == 1:
b.append(second)
if second == N:
c.append(first)
b_set = set(b)
c_set = set(c)
... |
s334346399 | p03196 | u821432765 | 2,000 | 1,048,576 | Wrong Answer | 123 | 3,064 | 313 | 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(i) for i in input().split()]
div = {}
x = P
y = 2
while y*y <= x:
while x % y == 0:
try:
div[y] += 1
except KeyError:
div[y] = 1
x //= y
y += 1
if x > 1:
div[x] = 1
res = 1
for k, v in div.items():
res *= max(1, (v//4)) * k
print(res) | s633136387 | Accepted | 125 | 3,064 | 304 | N, P = [int(i) for i in input().split()]
div = {}
x = P
y = 2
while y*y <= x:
while x % y == 0:
try:
div[y] += 1
except KeyError:
div[y] = 1
x //= y
y += 1
if x > 1:
div[x] = 1
res = 1
for k, v in div.items():
res *= k**(v//N)
print(res) |
s536582805 | p03797 | u595289165 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | Snuke loves puzzles. Today, he is working on a puzzle using `S`\- and `c`-shaped pieces. In this puzzle, you can combine two `c`-shaped pieces into one `S`-shaped piece, as shown in the figure below: Snuke decided to create as many `Scc` groups as possible by putting together one `S`-shaped piece and two `c`-shaped... | n, m = map(int, input().split())
if 2*n >= m:
ans = m//2
else:
ans = n - (2*n - m)//4 -1
print(ans) | s851356626 | Accepted | 17 | 2,940 | 104 | n, m = map(int, input().split())
if 2*n >= m:
ans = m//2
else:
ans = n + (m - 2*n)//4
print(ans) |
s964261904 | p03860 | u941884460 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 47 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | a,b,c=map(str,input().split())
print('A'+b+'C') | s577604848 | Accepted | 17 | 2,940 | 59 | a,b,c=map(str,input().split())
print('A'+b[0].upper()+'C')
|
s632884719 | p02854 | u598229387 | 2,000 | 1,048,576 | Wrong Answer | 99 | 26,060 | 656 | Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters. Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be po... | n=int(input())
a = [int(i) for i in input().split()]
length = sum(a)
if length %2 ==0:
check = 0
half = length//2
idx = 0
for i in range(len(a)):
check+=a[i]
if check > half:
idx = i
break
if check - half > half - (check-a[idx]):
check -=a[idx]
... | s969274929 | Accepted | 104 | 26,220 | 737 | n=int(input())
a = [int(i) for i in input().split()]
length = sum(a)
if length %2 ==0:
check = 0
half = length//2
idx = 0
for i in range(len(a)):
check+=a[i]
if check > half:
idx = i
break
if check - half > half - (check-a[idx]):
check -=a[idx]
... |
s559921933 | p03719 | u576432509 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | icase=0
if icase==0:
a,b,c=map(int,input().split())
if a<=c and c<=b:
print("YES")
else:
print("NO")
| s853029441 | Accepted | 17 | 2,940 | 130 | icase=61
if icase==61:
a,b,c=map(int,input().split())
if a<=c and c<=b:
print("Yes")
else:
print("No") |
s121626477 | p03150 | u922901775 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 411 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | S = input()
def judge():
L = len(S)
keyence = 'keyence'
if S[0] != 'k':
if S[-7:] != 'keyence':
return False
else:
return True
else:
for i in range(8):
if S[0:i] == keyence[0:i] and S[L-(7-i):L] == keyence[i:7]:
return True
... | s239606327 | Accepted | 17 | 3,060 | 459 | S = input()
def judge():
L = len(S)
keyence = 'keyence'
if S[0] != 'k':
if S[-7:] != 'keyence':
return False
else:
return True
else:
for i in range(8):
if S[0:i] == keyence[0:i] and S[L-(7-i):L] == keyence[i:7]:
return True
... |
s964402848 | p03721 | u536034761 | 2,000 | 262,144 | Wrong Answer | 255 | 18,024 | 282 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | n, k = map(int, input().split())
S = set()
D = dict()
for _ in range(n):
a, b = map(int, input().split())
if a in S:
D[a] += b
else:
S.add(a)
D[a] = b
L = sorted(S)
cnt=0
for l in L:
if cnt >= k:
print(l)
break
cnt += D[l] | s271964029 | Accepted | 229 | 17,924 | 284 | n, k = map(int, input().split())
S = set()
D = dict()
for _ in range(n):
a, b = map(int, input().split())
if a in S:
D[a] += b
else:
S.add(a)
D[a] = b
L = sorted(S)
cnt = 0
for l in L:
cnt += D[l]
if cnt >= k:
print(l)
break |
s329298906 | p02612 | u044220565 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,152 | 523 | 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. | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import nu... | s961389876 | Accepted | 29 | 9,160 | 553 | # coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import nu... |
s447218526 | p03495 | u914529932 | 2,000 | 262,144 | Wrong Answer | 270 | 50,176 | 439 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. | dbflag=0
def debug(*args):
if dbflag: print(*args)
result = -1
N, K = map(int, input().split())
A = [int(i) for i in input().split(' ')]
bag = {}
for x in A:
if x in bag:
bag['x'+str(x)]+=1
else:
bag['x'+str(x)] = 1
debug(bag)
L = sorted(bag.items(),key= lambda x:x[1])
debug(L)
cnt = len(L) - K
if cnt ... | s024304585 | Accepted | 332 | 52,408 | 460 | dbflag=0
def debug(*args):
if dbflag: print(*args)
result = 0
N, K = map(int, input().split())
A = [int(i) for i in input().split(' ')]
bag = {}
for x in A:
if 'x'+str(x) in bag:
bag['x'+str(x)]+=1
else:
bag['x'+str(x)] = 1
debug(bag)
L = sorted(bag.items(),key= lambda x:x[1])
debug(L,len(L),K)
cnt = le... |
s958152825 | p03712 | u760794812 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 216 | 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())
List = []
for _ in range(H):
S = input()
List.append(S)
print('*'*(W+2))
for i in range(H):
print('*'.strip(),end='')
print(List[i].strip(),end='')
print('*')
print('*'*(W+2)) | s258566992 | Accepted | 18 | 3,060 | 216 | H,W = map(int,input().split())
List = []
for _ in range(H):
S = input()
List.append(S)
print('#'*(W+2))
for i in range(H):
print('#'.strip(),end='')
print(List[i].strip(),end='')
print('#')
print('#'*(W+2)) |
s805283294 | p03044 | u532966492 | 2,000 | 1,048,576 | Wrong Answer | 2,107 | 108,196 | 670 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | N=int(input())
uvw=[list(map(int,input().split())) for _ in range(N-1)]
q=[[] for _ in range(N)]
max=10**15
dist=[0]+[max for i in range(N-1)]
for i in range(N-1):
q[uvw[i][0]-1].append((uvw[i][1],uvw[i][2]))
q[uvw[i][1]-1].append((uvw[i][0],uvw[i][2]))
now=0
now_d=0
while(True):
print(q)
if q[q[now][-... | s253979333 | Accepted | 903 | 62,004 | 735 | N=int(input())
uvw=[list(map(int,input().split())) for _ in range(N-1)]
q=[[] for _ in range(N)]
max=10**15
dist=[0]+[max for i in range(N-1)]
for i in range(N-1):
q[uvw[i][0]-1].append((uvw[i][1]-1,uvw[i][2]))
q[uvw[i][1]-1].append((uvw[i][0]-1,uvw[i][2]))
now=0
now_d=0
while(True):
if q[q[now][-1][0]]==[... |
s700813115 | p02612 | u935511247 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,040 | 64 | 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. | t=int(input())
m=0
while 1000*m<t:
m=m+1
c=1000*m-t
print(t) | s153331437 | Accepted | 24 | 9,156 | 64 | t=int(input())
m=0
while 1000*m<t:
m=m+1
c=1000*m-t
print(c) |
s422910885 | p02277 | u247976584 | 1,000 | 131,072 | Wrong Answer | 20 | 7,732 | 1,157 | Let's arrange a deck of cards. Your task is to sort totally n cards. A card consists of a part of a suit (S, H, C or D) and an number. Write a program which sorts such cards based on the following pseudocode: Partition(A, p, r) 1 x = A[r] 2 i = p-1 3 for j = p to r-1 4 do if A[j] <= x 5 then ... | class Quicksort:
def quicksort(self, a, p, r):
if p < r:
q = self.partion(a, p, r)
self.quicksort(a, p, q - 1)
self.quicksort(a, q + 1, r)
return(a)
def partion(self, a, p, r):
x = a[r][1]
i = p - 1
for j in range(p, r):
i... | s969769806 | Accepted | 1,170 | 35,912 | 1,160 | class Quicksort:
def quicksort(self, a, p, r):
if p < r:
q = self.partion(a, p, r)
self.quicksort(a, p, q - 1)
self.quicksort(a, q + 1, r)
return(a)
def partion(self, a, p, r):
x = a[r][1]
i = p - 1
for j in range(p, r):
i... |
s064279787 | p03610 | u979060189 | 2,000 | 262,144 | Wrong Answer | 27 | 3,572 | 107 | 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 = str(input())
odd =[]
n = int(len(s)/2)
for i in range(n):
odd.append(s[2*i])
print(''.join(odd)) | s091188388 | Accepted | 18 | 3,188 | 36 | s = str(input())
s = s[::2]
print(s) |
s063311545 | p03721 | u102242691 | 2,000 | 262,144 | Wrong Answer | 330 | 5,744 | 228 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... |
n,k = map(int,input().split())
x = [0]* (10**5)
for i in range(n):
a,b = map(int,input().split())
x[a-1] += b
#print(x)
count = 0
for i in range(n):
count += x[i]
if count >= k:
print(i)
break
| s758604098 | Accepted | 345 | 10,348 | 226 | N, K = map(int, input().split())
cnt = [0]*100001
S = set()
for i in range(N):
a, b = map(int, input().split())
cnt[a-1] += b
S.add(a)
acc = 0
for s in sorted(S):
acc += cnt[s-1]
if acc >= K:
print(s)
break
|
s162244794 | p03474 | u114954806 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 124 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | a,b=map(int,input().split())
s=input()
print("True") if s[:a].isdigit() and s[a:b]=='-' and s[b:].isdigit() else print("No") | s488643774 | Accepted | 18 | 2,940 | 138 | a,b=map(int,input().split())
s=input()
if s[:a].isdigit() and s[a]=='-' and s[a+1:a+b+1].isdigit():
print("Yes")
else:
print("No") |
s562991520 | p03729 | u722189950 | 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... | #ABC060A
A,B,C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
print("Yes")
else:
print("No") | s491486283 | Accepted | 17 | 2,940 | 107 | #ABC060A
A,B,C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
print("YES")
else:
print("NO") |
s997171650 | p03693 | u827765795 | 2,000 | 262,144 | Wrong Answer | 26 | 9,016 | 104 | 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... | r, g, b = map(int, input().split())
x = 10 * g + b
if x % 4 == 0:
print('Yes')
else:
print('No') | s186228278 | Accepted | 28 | 9,156 | 104 | r, g, b = map(int, input().split())
x = 10 * g + b
if x % 4 == 0:
print('YES')
else:
print('NO') |
s486774694 | p03024 | u850266651 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 113 | 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()
r = 0
for s in S:
if s == "o":
r += 1
if r >= 8:
print("YES")
else:
print("NO")
| s451840516 | Accepted | 17 | 2,940 | 110 | S = input()
r = 0
for s in S:
if s == "x":
r += 1
if r < 8:
print("YES")
else:
print("NO") |
s002899941 | p03945 | u698919163 | 2,000 | 262,144 | Wrong Answer | 33 | 3,188 | 128 | Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones... | S = input()
count = 0
check = S[0]
for i in S[1:]:
if check != S:
count+=1
check = i
print(count) | s658853591 | Accepted | 32 | 3,188 | 128 | S = input()
count = 0
check = S[0]
for i in S[1:]:
if check != i:
count+=1
check = i
print(count)
|
s982153608 | p04012 | u466105944 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 160 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | w = input()
def is_beutifull_str(char_str):
for s in w:
if w.count(s)%2 == 1:
return 'NO'
return 'YES'
print (is_beutifull_str(w)) | s031907105 | Accepted | 17 | 2,940 | 160 | w = input()
def is_beutifull_str(char_str):
for s in w:
if w.count(s)%2 == 1:
return 'No'
return 'Yes'
print (is_beutifull_str(w)) |
s416278174 | p03625 | u457683760 | 2,000 | 262,144 | Time Limit Exceeded | 2,144 | 513,924 | 117 | 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=(int(i) for i in input().split())
C=[0 for i in range(1000000000)]
for i in A:
C[i]+=1
print(C) | s471663791 | Accepted | 1,540 | 14,244 | 394 | N=int(input())
A=[int(i) for i in input().split()]
A.sort(reverse=True)
x=0
y=0
for i in range(N-1):
if A[0]==A[1]:
x=A[0]
A.remove(x)
A.remove(x)
break
else:
A.remove(A[0])
if len(A)>=2:
for i in range(len(A)-1):
if A[0]==A[1]:
y=A... |
s486890674 | p02613 | u914043696 | 2,000 | 1,048,576 | Wrong Answer | 157 | 17,460 | 124 | 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`,... | L = []
for i in range(int(input())):
L.append(input())
print(L)
for j in ['AC','WA','TLE','RE']:
print(j,'x',L.count(j)) | s649429880 | Accepted | 145 | 16,252 | 115 | L = []
for i in range(int(input())):
L.append(input())
for j in ['AC','WA','TLE','RE']:
print(j,'x',L.count(j)) |
s317733012 | p04030 | u842689614 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 159 | 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()
out=[]
for c in list(s):
if c=='0':
out.append('0')
elif c=='1':
out.append('1')
else:
if len(out)>0:
del out[-1]
print(out) | s938095417 | Accepted | 17 | 3,060 | 168 | s=input()
out=[]
for c in list(s):
if c=='0':
out.append('0')
elif c=='1':
out.append('1')
else:
if len(out)>0:
del out[-1]
print(''.join(out)) |
s416788138 | p02613 | u984081384 | 2,000 | 1,048,576 | Wrong Answer | 149 | 9,156 | 292 | 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`,... | c = int(input())
j = [0]*4
for i in range(c):
i = input()
if i == "AC":
j[0] += 1
elif i == "WA":
j[1] += 1
elif i == "TLE":
j[2] += 1
else:
j[3] += 1
print("AC × "+ str(j[0]))
print("WA × "+ str(j[1]))
print("TLE × "+ str(j[2]))
print("RE × "+ str(j[3]))
| s251992026 | Accepted | 146 | 9,056 | 287 | c = int(input())
j = [0]*4
for i in range(c):
a = input()
if a == "AC":
j[0] += 1
elif a == "WA":
j[1] += 1
elif a == "TLE":
j[2] += 1
else:
j[3] += 1
print("AC x "+ str(j[0]))
print("WA x "+ str(j[1]))
print("TLE x "+ str(j[2]))
print("RE x "+ str(j[3])) |
s908086782 | p02608 | u276588887 | 2,000 | 1,048,576 | Wrong Answer | 504 | 10,008 | 192 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | import math
n = int(input())
v = [0]*(100000)
for x in range(101):
for y in range(101):
for z in range(101):
v[x*x+y*y+z*z+x*y+y*z+z*x] += 1
for i in range(n):
print(v[i+1])
| s370263917 | Accepted | 545 | 10,320 | 202 | import math
n = int(input())
v = [0]*(100000)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
v[x*x+y*y+z*z+x*y+y*z+z*x] += 1
print('\n'.join(map(str,v[1:n+1])))
|
s644347677 | p03543 | u258436671 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 126 | 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**? | s = input()
D = []
for i in range(10):
D.append(s.count('i'))
a = max(D)
if a >= 3:
print('Yes')
else:
print('No') | s469577631 | Accepted | 17 | 2,940 | 99 | s = input()
if s[0] == s[1] == s[2] or s[1] == s[2] == s[3]:
print('Yes')
else:
print('No') |
s191315050 | p02856 | u276588887 | 2,000 | 1,048,576 | Wrong Answer | 373 | 9,072 | 143 | N programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals. The preliminary stage consists of several rounds, which will take place as follows: * All the N contestants will participate in the first round. ... | n=int(input())
dnum =0
dsum =0
for i in range(n):
d,c=map(int,input().split())
dnum += c
dsum += d*c
ans = c-1 + dsum//9
print(ans) | s922842504 | Accepted | 368 | 9,124 | 150 | n=int(input())
dnum =0
dsum =0
for i in range(n):
d,c=map(int,input().split())
dnum += c
dsum += d*c
ans = dnum-1 + (dsum-1)//9
print(ans) |
s640188361 | p03493 | u785220618 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | 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()
ans=0
for i in range(3):
if s[i] == 1:
ans += 1
print(ans) | s684539719 | Accepted | 17 | 2,940 | 84 | s = input()
ans=0
for i in range(3):
if s[i] == '1':
ans += 1
print(ans) |
s558540891 | p03473 | u131405882 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 29 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | N = int(input())
print(24-N)
| s622844113 | Accepted | 17 | 2,940 | 29 | N = int(input())
print(48-N)
|
s255960672 | p03469 | u360617739 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | 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... | # 85 A
L = input()
L1 = L.replace("7","8")
print(L1) | s520922492 | Accepted | 19 | 3,060 | 66 |
s = input()
ss = s.replace("7","8",1)
print(ss)
|
s193076141 | p02408 | u678843586 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 234 | Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers). The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond. | n = int(input())
cards = {}
for i in range(n):
card = input()
cards[card] = 1
for c in ['S', 'H', 'C', 'D']:
for n in range(1,14):
key = c + ''+ str(n)
if not key in cards:
print(key)
| s265906766 | Accepted | 20 | 5,600 | 246 | n = int(input())
cards = {}
for i in range(n):
card = input()
cards[card] = 1
for c in ['S', 'H', 'C', 'D']:
for n in range(1,14):
key = c + ' ' + str(n)
if not key in cards:
print(key)
|
s692827279 | p03730 | u711295009 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 255 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | a, b, c = map(int, input().split())
modL=[0]
while True:
amari = (modL[len(modL)-1]+a)%b
if amari == c:
print("Yes")
break
elif amari in modL:
print("No")
break
else:
modL.append(amari)
| s390292339 | Accepted | 17 | 3,060 | 242 | a, b, c = map(int, input().split())
modL=[0]
while True:
amari = (modL[len(modL)-1]+a)%b
if amari == c:
print("YES")
break
elif amari in modL:
print("NO")
break
else:
modL.append(amari) |
s717682151 | p02694 | u864276028 | 2,000 | 1,048,576 | Wrong Answer | 31 | 8,912 | 109 | 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
i = 1
while True:
I = 0.01*M
M += I
i += 1
if M >= X:
print(i)
break | s846373605 | Accepted | 31 | 9,064 | 75 | X = int(input())
A = 100
Y = 0
while A < X:
A += A//100
Y += 1
print(Y) |
s696685398 | p03997 | u213800869 | 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 * 0.5) | s600688586 | Accepted | 18 | 3,188 | 91 | a = int(input())
b = int(input())
h = int(input())
s = (a + b) * h * 0.5
print(round(s))
|
s599880538 | p03737 | u873849550 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | 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. | s1, s2, s3 = input().split()
print(s1[0].upper() + ' ' + s2[0].upper() + ' ' + s3[0].upper()) | s724871514 | Accepted | 17 | 2,940 | 81 | s1, s2, s3 = input().split()
print(s1[0].upper() + s2[0].upper() + s3[0].upper()) |
s906718248 | p03605 | u803647747 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | 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? | str_list = list(input())
if (str_list[0]!="9") and (str_list[1]!="9"):
print("No")
else:
print("No") | s375785563 | Accepted | 16 | 2,940 | 109 | str_list = list(input())
if (str_list[0]!="9") and (str_list[1]!="9"):
print("No")
else:
print("Yes") |
s415807529 | p02646 | u377989038 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,120 | 191 | 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 v <= w:
print("NO")
exit()
if (v - w) * t <= abs(a - b):
print("YES")
else:
print("NO") | s456583166 | Accepted | 23 | 9,140 | 152 | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if (v - w) * t >= abs(a - b):
print("YES")
else:
print("NO") |
s255732181 | p03447 | u350049649 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 61 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | X=int(input())
A=int(input())
B=int(input())
print((X-A)//B) | s072350447 | Accepted | 18 | 2,940 | 61 | X=int(input())
A=int(input())
B=int(input())
print((X-A)%B)
|
s322899309 | p03139 | u712259362 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 131 | 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 = [int(i) for i in input().split()]
X = A if A > B else B
Y = 0 if N > (A+B) else N - (A+B)
print("{0} {1}".format(X, Y)) | s476881438 | Accepted | 17 | 2,940 | 125 | N, A, B = [int(i) for i in input().split()]
X = A if A < B else B
Y = 0 if N > A+B else A+B-N
print("{0} {1}".format(X, Y)) |
s598025381 | p03975 | u328755070 | 1,000 | 262,144 | Wrong Answer | 17 | 2,940 | 195 | Summer vacation ended at last and the second semester has begun. You, a Kyoto University student, came to university and heard a rumor that somebody will barricade the entrance of your classroom. The barricade will be built just before the start of the A-th class and removed by Kyoto University students just before the... | N, A, B = list(map(int, input().split()))
t = [int(input()) for x in range(N)]
ans = 0
for i in range(N):
if t[i] < A or t[i] > B:
continue
else:
ans += 1
print(ans)
| s182936378 | Accepted | 17 | 2,940 | 201 | N, A, B = list(map(int, input().split()))
t = [int(input()) for x in range(N)]
ans = 0
for i in range(N):
if t[i] < A or t[i] >= B:
continue
else:
ans += 1
print(N - ans)
|
s024977792 | p03352 | u920299620 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,105 | 29,316 | 127 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | n=int(input())
i=2
ans=[1]
while(i**2 <= n ):
j=2
while( i**(j+1) <=n ):
j+=1
ans.append( i**j)
print( max(ans) )
| s828755997 | Accepted | 17 | 2,940 | 134 | n=int(input())
i=2
ans=[1]
while(i**2 <= n ):
j=2
while( i**(j+1) <=n ):
j+=1
ans.append( i**j)
i+=1
print( max(ans) )
|
s383085066 | p03997 | u957198490 | 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)*h/2) | s326391081 | Accepted | 17 | 2,940 | 68 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
s255775439 | p02612 | u290886932 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,132 | 55 | 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)
| s847256041 | Accepted | 29 | 9,140 | 75 | N = int(input())
pay = 1000
while pay < N:
pay += 1000
print(pay - N)
|
s321610676 | p03456 | u868600519 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 111 | 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 math
ab = int(input().replace(' ', ''))
r = math.sqrt(ab)
print(round(r) if r.is_integer() else 'No')
| s636507639 | Accepted | 17 | 2,940 | 102 | import math
ab = int(input().replace(' ', ''))
print('Yes' if math.sqrt(ab).is_integer() else 'No')
|
s374932783 | p03721 | u686036872 | 2,000 | 262,144 | Wrong Answer | 378 | 21,248 | 243 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | N, K = map(int, input().split())
A=[]
for i in range(N):
a, b = map(int, input().split())
A.append([a, b])
A.sort(key=lambda x:x[0])
cnt = 0
for i in range(N):
cnt += A[i][1]
if cnt >= N:
print(A[i][0])
break | s289075263 | Accepted | 407 | 21,248 | 243 | N, K = map(int, input().split())
A=[]
for i in range(N):
a, b = map(int, input().split())
A.append([a, b])
A.sort(key=lambda x:x[0])
cnt = 0
for i in range(N):
cnt += A[i][1]
if cnt >= K:
print(A[i][0])
break |
s311098689 | p03605 | u611090896 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | N = input()
if N in "9":
print("Yes")
else:
print("No") | s431550388 | Accepted | 18 | 2,940 | 59 | N = input()
if "9" in N:
print("Yes")
else:
print("No") |
s273386065 | p03351 | u396890425 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 95 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d=map(int, input().split())
print('Yes' if abs(c-a)<=d or abs(a-b)+abs(b-c)<=d else 'No') | s509965178 | Accepted | 17 | 2,940 | 102 | a,b,c,d=map(int, input().split())
print('Yes' if abs(c-a)<=d or abs(a-b)<=d and abs(b-c)<=d else 'No') |
s453535798 | p03455 | u840438868 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 138 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | import math
b, c = map(str, input().split())
d = int(b + c)
e = math.sqrt(d)
f = int(e)
if(e-f==0):
print('Yes')
else:
print('No') | s308992810 | Accepted | 17 | 2,940 | 96 | b, c = map(int, input().split())
if ((b%2)+(c%2) == 2):
print('Odd')
else:
print('Even') |
s523156435 | p03860 | u786020649 | 2,000 | 262,144 | Wrong Answer | 30 | 9,016 | 49 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | a,s,c=input().split()
print('A{}X'.format(s[0])) | s356504951 | Accepted | 26 | 8,996 | 50 | a,s,c=input().split()
print('A{}C'.format(s[0])) |
s583683803 | p02413 | u429841998 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 442 | Your task is to perform a simple table calculation. Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column. | r, c = map(int, input().split())
d = [0] * (c + 1)
print(d)
for i in range(r):
d[i] = list(map(int, input().split()))
d[i].append(0)
for j in range(c):
d[i][c] += d[i][j]
d[r] = [0] * (c + 1)
for i in range(c + 1):
for j in range(r):
d[r][i] += d[j][i]
for i in range(r + 1):
row ... | s580213062 | Accepted | 30 | 5,696 | 433 | r, c = map(int, input().split())
d = [0] * (r + 1)
for i in range(r):
d[i] = list(map(int, input().split()))
d[i].append(0)
for j in range(c):
d[i][c] += d[i][j]
d[r] = [0] * (c + 1)
for i in range(c + 1):
for j in range(r):
d[r][i] += d[j][i]
for i in range(r + 1):
row = ''
... |
s208264347 | p03548 | u408791346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | x, y, z = map(int, input().split())
ans = (x-2)//(y+z)
print(ans) | s016737000 | Accepted | 20 | 3,316 | 56 | x, y, z = map(int, input().split())
print((x-z)//(y+z)) |
s188978639 | p03478 | u735069283 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 109 | 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())
result=0
for i in range(n):
if a<=i//10+i%10<=b:
result+=i
print(result) | s499353771 | Accepted | 46 | 3,060 | 164 | N,A,B=map(int,input().split())
r=[0]*37
for i in range(N+1):
count=0
for j in range(len(str(i))):
count +=int(str(i)[j])
r[count] +=i
print(sum(r[A:B+1])) |
s727414505 | p03577 | u987164499 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 67 | Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For ex... | from sys import stdin
s = stdin.readline().rstrip()
print(s[:-9]) | s133648258 | Accepted | 17 | 2,940 | 67 | from sys import stdin
s = stdin.readline().rstrip()
print(s[:-8]) |
s722502184 | p02612 | u189326411 | 2,000 | 1,048,576 | Wrong Answer | 23 | 8,984 | 31 | 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())
print(n%1000)
| s851996561 | Accepted | 25 | 9,144 | 73 | n = int(input())
if n%1000==0:
print(0)
else:
print(1000-n%1000)
|
s796749373 | p03693 | u305965165 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | 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... | r,g,b = (int(i) for i in input().split())
if (r*100+g*10+b) % 4:
print("YES")
else:
print("NO") | s973770135 | Accepted | 17 | 2,940 | 109 | r,g,b = (int(i) for i in input().split())
if (r*100+g*10+b) % 4 == 0:
print("YES")
else:
print("NO") |
s887776435 | p04011 | u640603056 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n > k:
cost = n*k + (n-k)*y
else:
cost = n*x
print(cost) | s160634389 | Accepted | 17 | 2,940 | 135 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n > k:
cost = k*x + (n-k)*y
else:
cost = n*x
print(cost) |
s268783588 | p03909 | u539517139 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 186 | 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())
s=[list(input().split()) for _ in range(h)]
for i in range(h):
for j in range(w):
if s[i][j]=='snuke':
print(chr(ord('A')+j) +str(i))
break | s186931404 | Accepted | 17 | 3,060 | 187 | h,w=map(int,input().split())
s=[list(input().split()) for _ in range(h)]
for i in range(h):
for j in range(w):
if s[i][j]=='snuke':
print(chr(ord('A')+j)+str(i+1))
break |
s299146056 | p03251 | u255001744 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 189 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | n,m,x,y = map(int, input().split())
x_list = list(map(int,input().split()))
y_list = list(map(int,input().split()))
if max(x_list) - min(y_list) > 1:
print("No War")
else:
print("War") | s957543923 | Accepted | 18 | 3,064 | 368 | n,m,x,y = map(int, input().split())
x_list = list(map(int,input().split()))
y_list = list(map(int,input().split()))
x_max = max(x_list)
y_min = min(y_list)
def is_war(z):
if x_max < z and y_min >=z and x<z and z<=y:
return True
else:
return False
flag = False
for i in range(-100,100,1):
if is_war(i):
... |
s229684511 | p03155 | u263830634 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 85 | It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ... | N = int(input())
H = int(input())
W = int(input())
print ((N - H + 1) * (N - W - 1)) | s544606993 | Accepted | 17 | 2,940 | 85 | N = int(input())
H = int(input())
W = int(input())
print ((N - H + 1) * (N - W + 1)) |
s049359351 | p02606 | u634046173 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,012 | 89 | How many multiples of d are there among the integers between L and R (inclusive)? | L,R,d = map(int,input().split())
c =0
for i in (L,R+1):
if i % d ==0:
c+=1
print(c) | s276532047 | Accepted | 32 | 9,028 | 96 | L,R,d = map(int,input().split())
c = 0
for i in range(L,R+1):
if i % d ==0:
c+=1
print(c)
|
s764346379 | p03563 | u331036636 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | 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... | nr = float(input())
p = float(input())
print((p-nr)+p) | s255910946 | Accepted | 17 | 2,940 | 37 | print(-int(input()) + 2*int(input())) |
s177132884 | p03593 | u792670114 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 717 | We have an H-by-W matrix. Let a_{ij} be the element at the i-th row from the top and j-th column from the left. In this matrix, each a_{ij} is a lowercase English letter. Snuke is creating another H-by-W matrix, A', by freely rearranging the elements in A. Here, he wants to satisfy the following condition: * Every ... | H, W = map(int, input().split())
ns = {}
for i in range(H):
As = input()
for a in As:
if a not in ns: ns[a] = 0
ns[a] += 1
ns4 = [0, 0, 0, 0]
for a in ns:
n = ns[a]
ns4[n%4] += 1
print(ns4)
if H%2 == 0 and W%2 == 0:
if ns4[1] > 0 or ns4[2] > 0 or ns4[3] > 0:
print("No")
else:
print("Yes")
if... | s020907799 | Accepted | 19 | 3,064 | 718 | H, W = map(int, input().split())
ns = {}
for i in range(H):
As = input()
for a in As:
if a not in ns: ns[a] = 0
ns[a] += 1
ns4 = [0, 0, 0, 0]
for a in ns:
n = ns[a]
ns4[n%4] += 1
#print(ns4)
if H%2 == 0 and W%2 == 0:
if ns4[1] > 0 or ns4[2] > 0 or ns4[3] > 0:
print("No")
else:
print("Yes")
i... |
s178574265 | p02413 | u144068724 | 1,000 | 131,072 | Wrong Answer | 30 | 7,624 | 164 | Your task is to perform a simple table calculation. Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column. | r,c = map(int,input().split())
ss = [[int(i) for i in input().split()]for j in range(r)]
for row in ss:
row.append(sum(row))
print(' '.join(map(str, row))) | s207612603 | Accepted | 30 | 7,732 | 282 | r,c = map(int,input().split())
ss = [[int(i) for i in input().split()]for j in range(r)]
sum_ss = [0 for i in range(c + 1)]
for row in ss:
row.append(sum(row))
sum_ss = [x+y for (x, y) in zip(sum_ss, row)]
print(' '.join(map(str, row)))
print(' '.join(map(str, sum_ss))) |
s592388460 | p03371 | u870575557 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 207 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | a,b,c,x,y = list(map(int, input().split()))
s1 = a*x + b*y
s2 = c*(max(x,y)*2)
if x>y:
s3 = c*(y*2) + a*(x-y)
elif y>x:
s3 = c*(x*2) + b*(y-x)
else: s3 = 10**10
print(s1,s2,s3)
print(min(s1,s2,s3)) | s240439532 | Accepted | 19 | 3,064 | 191 | a,b,c,x,y = list(map(int, input().split()))
s1 = a*x + b*y
s2 = c*(max(x,y)*2)
if x>y:
s3 = c*(y*2) + a*(x-y)
elif y>x:
s3 = c*(x*2) + b*(y-x)
else: s3 = 10**10
print(min(s1,s2,s3)) |
s331151720 | p03455 | u619850971 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if (a*b)%2 == 0:
print("even")
else:
print("odd") | s661254216 | Accepted | 17 | 2,940 | 90 | a, b = map(int, input().split())
if (a*b)%2 == 0:
print("Even")
else:
print("Odd") |
s107447364 | p03739 | u731467249 | 2,000 | 262,144 | Wrong Answer | 102 | 19,892 | 612 | You are given an integer sequence of length N. The i-th term in the sequence is a_i. In one operation, you can select a term and either increment or decrement it by one. At least how many operations are necessary to satisfy the following conditions? * For every i (1≤i≤n), the sum of the terms from the 1-st through ... | N = int(input())
A = list(map(int, input().split()))
cntA, sumA = 0, 0
for i in range(N):
sumA += A[i]
if i % 2 == 0:
if sumA < 0:
cntA += abs(sumA) + 1
sumA += abs(sumA) + 1
else:
if sumA > 0:
cntA += abs(sumA) + 1
sumA -= abs(sumA) + 1
... | s314947078 | Accepted | 117 | 20,144 | 608 | N = int(input())
A = list(map(int, input().split()))
cntA, sumA = 0, 0
for i in range(N):
sumA += A[i]
if i % 2 == 0:
if sumA <= 0:
cntA += abs(sumA) + 1
sumA += abs(sumA) + 1
else:
if sumA >= 0:
cntA += abs(sumA) + 1
sumA -= abs(sumA) + 1
... |
s004498338 | p02600 | u634046173 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,176 | 294 | M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr... | N = int(input())
if 400 <= N <= 599:
print(8)
elif 600 <= N <= 799:
print(7)
elif 800 <= N <= 999:
print(6)
elif 1000 <= N <= 1199:
print(5)
if 1200 <= N <= 1399:
print(4)
elif 1400 <= N <= 1599:
print(3)
elif 1600 <= N <= 1799:
print(2)
else:
print(1)
| s637130391 | Accepted | 33 | 9,176 | 296 | N = int(input())
if 400 <= N <= 599:
print(8)
elif 600 <= N <= 799:
print(7)
elif 800 <= N <= 999:
print(6)
elif 1000 <= N <= 1199:
print(5)
elif 1200 <= N <= 1399:
print(4)
elif 1400 <= N <= 1599:
print(3)
elif 1600 <= N <= 1799:
print(2)
else:
print(1)
|
s656785987 | p03457 | u832381404 | 2,000 | 262,144 | Wrong Answer | 373 | 11,636 | 353 | 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())
t = [0] * (n+1)
x = [0] * (n+1)
y = [0] * (n+1)
for i in range(1, n+1):
t[i], x[i], y[i] = map(int, input().split())
can = 1
for i in range(1, n+1):
tm = t[i] - t[i-1]
xm = abs(x[i] - x[i-1])
ym = abs(y[i] - y[i-1])
if((tm < xm+ym) or ((tm-xm+ym)%2)):
can = 0
break... | s506432719 | Accepted | 370 | 11,636 | 353 | n = int(input())
t = [0] * (n+1)
x = [0] * (n+1)
y = [0] * (n+1)
for i in range(1, n+1):
t[i], x[i], y[i] = map(int, input().split())
can = 1
for i in range(1, n+1):
tm = t[i] - t[i-1]
xm = abs(x[i] - x[i-1])
ym = abs(y[i] - y[i-1])
if((tm < xm+ym) or ((tm-xm+ym)%2)):
can = 0
break... |
s586195595 | p02678 | u490553751 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,008 | 11 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | print("No") | s728634313 | Accepted | 783 | 35,676 | 666 | #template
def inputlist(): return [int(k) for k in input().split()]
#template
N,M = inputlist()
graph = [[] for _ in range(N+1)]
for i in range(M):
A,B = inputlist()
graph[A].append(B)
graph[B].append(A)
ans = [0]*(N+1)
seen = [False]*(N+1)
from collections import deque
que = deque()
que.append(1)
while le... |
s735746205 | p02534 | u958820283 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,152 | 72 | You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`. | k = int(input())
ans=""
for i in range(k):
ans=ans+str(k)
print(ans) | s544229225 | Accepted | 23 | 9,148 | 73 | k = int(input())
ans=""
for i in range(k):
ans=ans+"ACL"
print(ans) |
s984651527 | p02422 | u896065593 | 1,000 | 131,072 | Wrong Answer | 20 | 7,680 | 1,075 | Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th character of $str$ * replace a b p: replace from the a-th character to the b-t... |
str = list(input())
str = "".join(str)
p = int(input())
# p??????????????????????????????????????????
orderList = [0 for i in range(p)]
for i in range(0, p):
orderList[i] = list(input())
orderList[i] = "".join(orderList[i]).split()
if orderList[i][0] == "print":
print("{0}".format(str[int(orde... | s308209150 | Accepted | 20 | 7,748 | 885 |
str = list(input())
str = "".join(str)
p = int(input())
# p??????????????????????????????????????????
orderList = [0 for i in range(p)]
for i in range(0, p):
orderList[i] = list(input())
orderList[i] = "".join(orderList[i]).split()
if orderList[i][0] == "print":
print("{0}".format(str[int(orde... |
s368181673 | p03090 | u879870653 | 2,000 | 1,048,576 | Wrong Answer | 23 | 3,612 | 171 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | N = int(input())
for u in range(1, N) :
for v in range(u+1, N+1) :
if u + v == N + (N % 2 != 1) :
continue
else :
print(u, v)
| s509175631 | Accepted | 26 | 3,956 | 263 | N = int(input())
cnt = 0
A = []
for u in range(1, N) :
for v in range(u+1, N+1) :
if u + v == N + (N % 2 != 1) :
continue
else :
cnt += 1
A.append((u, v))
print(cnt)
for i in range(cnt) :
print(*A[i])
|
s981863908 | p03485 | u256868077 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | 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())
if (a+b)%2==0:
print((a+b)/2)
else:
print((a+b+1)/2) | s942849923 | Accepted | 17 | 2,940 | 96 | a,b=map(int,input().split())
if (a+b)%2==0:
print(int((a+b)/2))
else:
print(int((a+b+1)/2))
|
s279189698 | p03493 | u722117999 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 21 | 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. | print(int(input())%2) | s270741115 | Accepted | 17 | 2,940 | 25 | print(input().count('1')) |
s825398876 | p03352 | u197078193 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,316 | 282 | 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. | def beki(n,X):
# the maximum of the form n**k under X
x = 1
while x*n <= X:
x *= n
if x == n:
return 1
else:
return(x)
X = int(input())
a = 1
for n in range(X)[2:]:
b = beki(n,X)
print(n,b)
if b > a:
a = b
print(a)
| s836153525 | Accepted | 17 | 2,940 | 266 | def beki(n,X):
# the maximum of the form n**k under X
x = 1
while x*n <= X:
x *= n
if x == n:
return 1
else:
return(x)
X = int(input())
a = 1
for n in range(X)[2:]:
b = beki(n,X)
if b > a:
a = b
print(a) |
s311294287 | p03044 | u163320134 | 2,000 | 1,048,576 | Wrong Answer | 423 | 12,652 | 444 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | n=int(input())
ans=[0]*(n+1)
s=set()
u,v,w=map(int,input().split())
s.add(u)
s.add(v)
if w%2==0:
ans[u]=1
ans[v]=1
elif w%2==1:
ans[u]=1
ans[v]=0
for i in range(n-2):
u,v,w=map(int,input().split())
if u in s:
s.add(v)
if w%2==0:
ans[v]=ans[u]
else:
ans[v]=abs(ans[u]-1)
elif v in s:... | s343333496 | Accepted | 660 | 39,956 | 454 | import collections
n=int(input())
g=[[] for _ in range(n+1)]
for _ in range(n-1):
a,b,w=map(int,input().split())
g[a].append((b,w))
g[b].append((a,w))
q=collections.deque()
q.append(1)
checked=[0]*(n+1)
ans=[0]*(n+1)
ans[1]=0
while len(q)!=0:
v=q.popleft()
checked[v]=1
for u,w in g[v]:
if checked[u]==... |
s273401767 | p03778 | u143492911 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | w,a,b=map(int,input().split())
if a<=b+w or b<=a+w:
print(0)
else:
print(abs(a+w-b)) | s057734832 | Accepted | 18 | 2,940 | 127 | w,a,b=map(int,input().split())
if a<=b<=a+w:
print(0)
elif a<=b+w<=a+w:
print(0)
else:
print(max(b-(a+w),a-(b+w)))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.