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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s346640024 | p03160 | u286136968 | 2,000 | 1,048,576 | Wrong Answer | 150 | 13,908 | 665 | 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... | def difference(n1, n2):
return max(n1 - n2, n2 - n1)
n = int(input())
stones = list(map(int, input().split()))
pos = 0
total = 0
while pos < n:
if pos != n - 2:
if difference(stones[pos], stones[pos + 1]) < difference(stones[pos], stones[pos + 2]) // 2:
total += difference(stones[pos], sto... | s226683004 | Accepted | 171 | 13,980 | 288 | def diff(n1, n2):
return max(n1 - n2, n2 - n1)
n = int(input())
hs = list(map(int, input().split()))
dp = list()
dp.append(0)
dp.append(diff(hs[0], hs[1]))
for t in range(2, n):
dp.append(min(diff(hs[t], hs[t - 1]) + dp[t - 1], diff(hs[t], hs[t - 2]) + dp[t - 2]))
print(dp[-1])
|
s504991783 | p02879 | u544587633 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 163 | Having learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation. Given are two integers A and B. If Takahashi can calculate A \times B, print the result; if he cannot, print `-1` instead. | import sys
for line in sys.stdin:
A, B = list(map(int, line.split(' ')))
out = A*B
if 1 <= out <= 81:
print(out)
else:
print(-1) | s764851592 | Accepted | 17 | 2,940 | 180 | import sys
for line in sys.stdin:
A, B = list(map(int, line.split(' ')))
if 1 <= A <= 9 and 1 <= B <= 9:
out = A*B
print(out)
else:
print(-1) |
s760757795 | p03477 | u774411119 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 152 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | IN=input()
s=IN.split(" ")
L=int(s[0])+int(s[1])
R=int(s[2])+int(s[3])
if L>R:
print("Left")
if L==R:
print("Balanced")
else:
print("Right") | s615424639 | Accepted | 17 | 3,060 | 154 | IN=input()
s=IN.split(" ")
L=int(s[0])+int(s[1])
R=int(s[2])+int(s[3])
if L>R:
print("Left")
if L==R:
print("Balanced")
if R>L:
print("Right") |
s362423794 | p02259 | u017435045 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 324 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | n = int(input())
a = [int(i) for i in input().split()]
def bubblesort(list):
flag = 1
count = 0
while flag:
flag = 0
for i in range(n-1,0,-1):
if a[i]<a[i-1]:
a[i],a[i-1] = a[i-1],a[i]
flag = 1
count+=1
print(count)
bubblesort(a... | s054825583 | Accepted | 20 | 5,604 | 255 | n = int(input())
a = list(map(int, input().split()))
flag = 1
count = 0
while flag:
flag = 0
for i in range(n-1,0,-1):
if a[i]<a[i-1]:
a[i],a[i-1] = a[i-1],a[i]
flag = 1
count+=1
print(*a)
print(count)
|
s528084112 | p00111 | u960312159 | 1,000 | 131,072 | Wrong Answer | 140 | 7,500 | 1,150 | ๅ ๅฃซ : ?D-C'KOPUA ใใผใฟใผ : ใฉใใใใใงใใใใใใใๅๅฃซ? ใใใฎใใใใชใใใจใๅซใถใฎใซใฏใใๆ
ฃใใพใใใใ ไปๆฅใฏๆ็ซ ใซใใใชใฃใฆใใพใใใใ ๅ ๅฃซ : ใปใใ ใใผใฟใผ : ใชใใงใใ? ใใฎ่กจใฏ......ใใใไบ้ธใฎๅ้กใซใใใชใฎใใใใพใใใ่กจใไฝฟใฃใฆๆๅญใ็ฝฎใๆใ ใใจๆๅญๆฐใๆธใใใงใใใญใใพใใไบ้ธใจๆฌ้ธใงๅใๅ้กใๅบใใฆๆใๆใใใฃใฆๆฐใใใชใใงใ ใใใญใ ๅ ๅฃซ : ้ใใใใ ใใผใฟใผ : ้? ใชใใปใฉใไปๅบฆใฏ็ญใใใๆๅญๅใๅ
ใซๆปใใใฃใฆๅ้กใงใใใใจใใใใจใฏใ?D-C'KOPUAใใฎ ๆๅญใใใใฎ่กจใไฝฟใฃใฆใๆๅญใใใใ็ฌฆๅทใใซ็ฝฎใใใใใใงใใญ......... | #! python.exe
dic = {}
for idx, c in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"):
dic[c] = str(format(idx,'b').zfill(5))
decode = {"101" : " ", "0101" : "C", "0110" : "K", "00110" : "S",
"000000" : "'", "0001" : "D", "00100" : "L", "00111" : "T",
"000011" : ",", "110"... | s860466334 | Accepted | 70 | 7,492 | 1,090 | #! python.exe
dic = {}
for idx, c in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"):
dic[c] = str(format(idx,'b').zfill(5))
decode = {"101" : " ", "0101" : "C", "0110" : "K", "00110" : "S",
"000000" : "'", "0001" : "D", "00100" : "L", "00111" : "T",
"000011" : ",", ... |
s660195443 | p03597 | u003501233 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 45 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | N=int(input())
A=int(input())
print((N*2)-A) | s985290430 | Accepted | 17 | 2,940 | 45 | N=int(input())
A=int(input())
print((N*N)-A) |
s656625015 | p03719 | u472721500 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a, b, c = map(int, input().split())
if a <= c and c <= b: print("YES")
else: print("NO") | s085337421 | Accepted | 17 | 2,940 | 82 | a,b,c = map(int, input().split())
if a<=c<=b:
print('Yes')
else:
print('No') |
s375286613 | p02578 | u503111914 | 2,000 | 1,048,576 | Wrong Answer | 114 | 32,312 | 146 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | N = int(input())
A = list(map(int,input().split()))
B = A[0]
ans = 0
for i in range(N):
if B < A[i]:
ans += B - A[i]
B = A[i]
print(ans) | s726206899 | Accepted | 162 | 32,144 | 156 | N = int(input())
A = list(map(int,input().split()))
B = A[0]
ans = 0
for i in range(N):
if B > A[i]:
ans += abs(A[i] - B)
B = max(A[i],B)
print(ans) |
s927202795 | p02396 | u936401118 | 1,000 | 131,072 | Wrong Answer | 90 | 8,108 | 155 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | array = []
x = int(input())
while x != 0 :
array.append(x)
x = int(input())
for i in range(len(array)):
print('Case', str(i) + ':', array[i]) | s550668003 | Accepted | 90 | 7,992 | 155 | array = []
x = input()
while x != "0" :
array.append(x)
x = input()
for i in range(len(array)):
print("Case " + str(i + 1) + ": " + array[i]) |
s026956262 | p02390 | u897466764 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 89 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | S=input()
h=int(S)//3600
m=(int(S)-3600*h)//60
s=int(S)-60*m-3600*h
print(h,';',m,';',s)
| s971541389 | Accepted | 20 | 5,584 | 88 | S=int(input())
h=S//3600
m=(S-3600*h)//60
s=S-(60*m+3600*h)
print(h,':',m,':',s,sep='')
|
s157317486 | p02646 | u257332942 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,176 | 171 | 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())
aa = v * t
bb = w * t
if aa - bb >= abs(b - a):
print('Yes')
else:
print('No') | s567221205 | Accepted | 20 | 9,124 | 171 | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
aa = v * t
bb = w * t
if aa - bb >= abs(b - a):
print('YES')
else:
print('NO') |
s888805656 | p03944 | u163449343 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 429 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 โฆ i โฆ N) po... | w,h,n = map(int, input().split())
xya = []
xl, xr, yu, yt = 0, w, 0, h
for i in range(n):
x, y, a = map(int, input().split())
if a == 1:
if xl < x:
xl = x
elif a == 2:
if xr > x:
xr = x
elif a == 3:
if yu < y:
yu = y
else:
if yt > y:... | s203735310 | Accepted | 18 | 3,064 | 407 | w,h,n = map(int, input().split())
xya = []
xl, xr, yu, yt = 0, w, 0, h
for i in range(n):
x, y, a = map(int, input().split())
if a == 1:
if xl < x:
xl = x
elif a == 2:
if xr > x:
xr = x
elif a == 3:
if yu < y:
yu = y
else:
if yt > y:... |
s910478023 | p03729 | u528720841 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | 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()
if a[-1] == b[0] and b[-1] == c[0]:
print("Yes")
else:
print("No") | s791649209 | Accepted | 18 | 2,940 | 99 | a,b,c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print("YES")
else:
print("NO") |
s515276359 | p03737 | u739843002 | 2,000 | 262,144 | Wrong Answer | 31 | 8,984 | 63 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | print("".join(list(map(lambda s : s[:1], input().split(" "))))) | s706422923 | Accepted | 26 | 9,044 | 71 | print("".join(list(map(lambda s : s[:1], input().split(" ")))).upper()) |
s161067828 | p03693 | u180704972 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | 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(map(int,input().split()))
Num = rgb[0] * 100 + rgb[1] * 10 + rgb[2]
if Num % 4 == 0:
print("Yes")
else:
print("No") | s811857114 | Accepted | 17 | 2,940 | 135 | rgb = list(map(int,input().split()))
Num = rgb[0] * 100 + rgb[1] * 10 + rgb[2]
if Num % 4 == 0:
print("YES")
else:
print("NO") |
s013371058 | p02397 | u299798926 | 1,000 | 131,072 | Wrong Answer | 50 | 7,628 | 201 | Write a program which reads two integers x and y, and prints them in ascending order. | for i in range(3000):
x,y=[int(s) for s in input().split()]
if x>y:
print("{0} {1}".format(y,x))
elif x<y:
print("{0} {1}".format(x,y))
elif x==0 and y==0:
break | s605459704 | Accepted | 60 | 7,732 | 199 | for i in range(3000):
x,y=[int(s) for s in input().split()]
if x==0 and y==0:
break
elif x<=y:
print("{0} {1}".format(x,y))
else :
print("{0} {1}".format(y,x)) |
s104737476 | p03998 | u853900545 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 401 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | sa = list(input())
sb = list(input())
sc = list(input())
cnta = len(sa)
cntb = len(sb)
cntc = len(sc)
d = sa[0]
while cnta == 0 or cntb == 0 or cntc == 0:
if d == 'a':
sa = sa[1::]
d = sa[0]
elif d == 'b':
sb = sb[1::]
d = sb[0]
else:
sc = sc[1::]
d = sc[0]... | s312036034 | Accepted | 17 | 3,064 | 499 | sa = list(input())
sb = list(input())
sc = list(input())
d = 'a'
cnta = 0
cntb = 0
cntc = 0
A = len(sa)
B = len(sb)
C = len(sc)
while 1:
if d == 'a':
cnta += 1
if cnta == A+1:
print('A')
break
d = sa.pop(0)
elif d == 'b':
cntb += 1
if cntb == B+1... |
s709542391 | p02645 | u834598393 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,088 | 28 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | a=str(input())
print(a[0:2]) | s156048297 | Accepted | 21 | 8,952 | 29 | a=str(input())
print(a[0:3])
|
s078275239 | p03369 | u839270538 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 29 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | print(700+input().count('o')) | s479845231 | Accepted | 17 | 2,940 | 33 | print(700+100*input().count('o')) |
s565550854 | p03067 | u457960175 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 98 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a, b, c = map(int,input().split())
if a > c > b or c > a > b :
print('Yes')
else :
print('No') | s917413936 | Accepted | 17 | 2,940 | 98 | a, b, c = map(int,input().split())
if a > c > b or b > c > a :
print('Yes')
else :
print('No') |
s145647508 | p03828 | u941884460 | 2,000 | 262,144 | Wrong Answer | 33 | 3,188 | 326 | You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. | N = int(input())
DIV = pow(10,9)+7
sum = 1
prime = []
stock = []
for i in range(2,N):
for j in range(2,i):
if i%j == 0:
break
if j==(i-1) and i%j !=0:
prime.append(i)
for k in range(len(prime)):
if N%prime[k]==0:
stock.append(N/prime[k])
for j in range(len(stock)):
sum *= (stock[j]+1)
prin... | s910290321 | Accepted | 52 | 3,064 | 464 | N = int(input())
DIV = pow(10,9)+7
sum = 1
prime = []
for i in range(2,N+1):
flg = True
for j in range(2,i+1):
if i != j and i%j == 0:
flg = False
break
if flg:
prime.append(i)
stock = [0]*len(prime)
ind = 0
for x in prime:
work = 0
for y in range(2,N+1):
if y%x == 0:
cnt = 1
... |
s941353854 | p03547 | u063896676 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 184 | In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,... | # -*- coding: utf-8 -*-
XY = input().split()
X = XY[0]
Y = XY[1]
x = ord(X)
y = ord(Y)
print(x)
print(y)
if(x < y):
print("<")
elif(x > y):
print(">")
else:
print("=")
| s504421613 | Accepted | 17 | 2,940 | 165 | # -*- coding: utf-8 -*-
XY = input().split()
X = XY[0]
Y = XY[1]
x = ord(X)
y = ord(Y)
if(x < y):
print("<")
elif(x > y):
print(">")
else:
print("=")
|
s924552013 | p04029 | u027929618 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 163 | 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? | s = list(input())
ans = ""
for c in s:
if c == "0" or c == "1":
ans += c
elif c == "B" and ans != "":
ans = ans[:len(ans) - 1]
print("{}".format(ans)) | s648094988 | Accepted | 17 | 2,940 | 83 | n = int(input())
ans = 0
for i in range(1, n+1):
ans += i
print("{}".format(ans)) |
s900075166 | p03698 | u319818856 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 232 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | def varied(S: str)->bool:
d = {}
for c in S:
if c in S:
return False
d[c] = True
return True
if __name__ == "__main__":
S = input()
yes = varied(S)
print('yes' if yes else 'no')
| s737798388 | Accepted | 17 | 2,940 | 232 | def varied(S: str)->bool:
d = {}
for c in S:
if c in d:
return False
d[c] = True
return True
if __name__ == "__main__":
S = input()
yes = varied(S)
print('yes' if yes else 'no')
|
s831245856 | p03598 | u869265610 | 2,000 | 262,144 | Wrong Answer | 29 | 9,200 | 208 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t... | N=int(input())
M=int(input())
C=list(map(int,input().split()))
ans=0
for i in range(len(C)):
lm=0
rm=0
lm=abs((N-C[i])*2)+4
rm=abs((M-C[i])*2)+4
if lm<=rm:
ans+=lm
else:
ans+=rm
print(ans) | s096983043 | Accepted | 27 | 9,092 | 154 | N=int(input())
B=int(input())
ans=0
X=list(map(int,input().split()))
for i in range(N):
left=X[i]*2
right=(B-X[i])*2
ans+=min(left,right)
print(ans) |
s235471672 | p02612 | u667084803 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,044 | 33 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | print(10000 - int(input())//1000) | s024695440 | Accepted | 28 | 9,144 | 35 | print((10000 - int(input()))%1000)
|
s059146155 | p02612 | u995308690 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,152 | 193 | 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 -*-
# b, c =
# a = int(input())
n = str(input())
print(int(n) % 1000)
| s361274392 | Accepted | 26 | 9,156 | 245 | # -*- coding: utf-8 -*-
# b, c =
# a = int(input())
n = str(input())
if int(n) % 1000 == 0:
print(0)
else:
print(1000 - int(n) % 1000)
|
s309780158 | p03386 | u873269440 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 365 | 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. |
def main():
a,b,k = map(int,input().split())
ansSet = set()
if a+k > b:
c = b
else:
c = a+k
for i in range(a,c):
ansSet.add(i)
if b-k < a:
c = a
else:
c = b-k
for i in range(b,c,-1):
ansSet.add(i)
print(sorted(list(ansSet)))... | s028711274 | Accepted | 17 | 3,064 | 420 |
def main():
a,b,k = map(int,input().split())
ansSet = set()
if a+k > b:
c = b
else:
c = a+k
if a == c:
c += 1
for i in range(a,c):
ansSet.add(i)
if b-k < a:
c = a
else:
c = b-k
for i in range(b,c,-1):
ansSet.add(... |
s707815716 | p02613 | u692311686 | 2,000 | 1,048,576 | Wrong Answer | 153 | 9,220 | 291 | 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())
lis=[0,0,0,0]
for i in range(N):
tmp=input()
if tmp=="AC":
lis[0]+=1
elif tmp=="WA":
lis[1]+=1
elif tmp=="TLE":
lis[2]+=1
else:
lis[3]+=1
print("AC ร "+str(lis[0]))
print("WA ร "+str(lis[1]))
print("TLE ร "+str(lis[2]))
print("RE ร "+str(lis[3])) | s715696501 | Accepted | 151 | 9,216 | 287 | N=int(input())
lis=[0,0,0,0]
for i in range(N):
tmp=input()
if tmp=="AC":
lis[0]+=1
elif tmp=="WA":
lis[1]+=1
elif tmp=="TLE":
lis[2]+=1
else:
lis[3]+=1
print("AC x "+str(lis[0]))
print("WA x "+str(lis[1]))
print("TLE x "+str(lis[2]))
print("RE x "+str(lis[3])) |
s774527930 | p03556 | u388297793 | 2,000 | 262,144 | Wrong Answer | 31 | 9,332 | 39 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | n=int(input())
print(int(n**(1/2)**2))
| s338440270 | Accepted | 25 | 9,220 | 39 | n=int(input())
print(int(n**(1/2))**2)
|
s034105583 | p03993 | u867826040 | 2,000 | 262,144 | Wrong Answer | 202 | 14,008 | 165 | There are N rabbits, numbered 1 through N. The i-th (1โคiโคN) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_iโ i. For a pair of rabbits i and j (i๏ผj), we call the pair (i๏ผj) a _friendly pair_ if the following condition is met. * Rabbit i likes rabbit j and rabbit j likes rabbit i. Calculat... | n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
ai = a[i]
print(a[ai-1],i+1)
if a[ai-1]==i+1:
ans+=1
print(ans//2) | s288806134 | Accepted | 71 | 14,008 | 166 | n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
ai = a[i]
#print(a[ai-1],i+1)
if a[ai-1]==i+1:
ans+=1
print(ans//2) |
s721382871 | p03854 | u131273629 | 2,000 | 262,144 | Wrong Answer | 31 | 3,188 | 540 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | sin = input()
n = len(sin)
s = sin + "ZZZZZZZZZZZZZ"
i = 0
ans = "No"
while(True):
if s[i]=="d":
if s[i:i+5]!="dream" and s[i:i+7]!="dreamer":
break
if s[i+5]=="d" or s[i+5]=="Z" or s[i+7]=="a":
i += 5
elif s[i+7]=="d" or s[i+7]=="e" or s[i+7]=="Z":
i += 7
else:
break
elif s[i]=="e":
if s[i... | s126868617 | Accepted | 29 | 3,316 | 257 | s = input()
revs = s[::-1] + "Z"
i = 0
while(True):
if revs[i:i+5]=="maerd": i+=5
elif revs[i:i+7]=="remaerd": i+=7
elif revs[i:i+5]=="esare": i+=5
elif revs[i:i+6]=="resare": i+=6
elif revs[i]=="Z":
print("YES")
break
else:
print("NO")
break |
s283984371 | p03369 | u645878234 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | # coding: utf-8
print(len(input().replace("x",""))) | s443071967 | Accepted | 17 | 2,940 | 47 | print(700 + 100 * len(input().replace("x",""))) |
s135814836 | p03129 | u594212356 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 106 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | N,K = [int(i) for i in input().split()]
if (N / 2 >= K or K == 1):
print("YES")
else:
print("NO")
| s186822653 | Accepted | 17 | 2,940 | 109 | N,K = [int(i) for i in input().split()]
if (N / 2 + 1 > K or K == 1):
print("YES")
else:
print("NO")
|
s479464792 | p04029 | u623516423 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 124 | 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? | s=input()
ans=''
n=0
for i in s:
if i == '0'or i == '1':
ans+=i
n+=1
else:
ans=ans[:n-1]
n-=1
print(ans) | s674007420 | Accepted | 17 | 2,940 | 55 | N=int(input())
S=0
for i in range(N):
S+=i+1
print(S) |
s556838966 | p03457 | u235905557 | 2,000 | 262,144 | Wrong Answer | 322 | 17,332 | 556 | 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())
routes = [(0,0,0)]
append = routes.append
for _ in range(0, N):
t, x, y = map(int, input().split())
append((t, x, y))
for i in range(1, N+1):
bt, bx, by = routes[i-1]
t, x, y = routes[i]
ct = t - bt
cx = x - bx
if cx > ct or cx % 2 == ct % 2:
print ("No")
... | s732256723 | Accepted | 396 | 17,332 | 550 | N = int(input())
routes = [(0,0,0)]
append = routes.append
for _ in range(0, N):
t, x, y = map(int, input().split())
append((t, x, y))
for i in range(1, N+1):
bt, bx, by = routes[i-1]
t, x, y = routes[i]
ct = t - bt
cx = abs(x - bx)
cy = abs(y - by)
if cx > ct or cy > ct:
pr... |
s166432778 | p03455 | u489108157 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 104 | 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(lambda x: int(x),input().split())
if a%2==0 and b%2==0:
print('Even')
else:
print('Odd') | s100744465 | Accepted | 17 | 2,940 | 103 | a,b=map(lambda x: int(x),input().split())
if a%2==0 or b%2==0:
print('Even')
else:
print('Odd') |
s648264087 | p03599 | u680851063 | 3,000 | 262,144 | Wrong Answer | 798 | 5,124 | 715 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | a, b, c, d, e, f = map(int,input().split())
print(a, b, c, d, e, f)
suger_max = int(f * e/(100+e))
print(suger_max)
water, suger = [], []
for i in range(f//(a*100) + 1):
for j in range(f//(b*100) + 1):
temp = a * 100 * i + b * 100 * j
if temp <= f and 0 < temp:
water.append(temp)
... | s149106305 | Accepted | 776 | 5,124 | 682 | a, b, c, d, e, f = map(int,input().split())
suger_max = int(f * e/(100+e))
water, suger = [], []
for i in range(f//(a*100) + 1):
for j in range(f//(b*100) + 1):
temp = a * 100 * i + b * 100 * j
if temp <= f and 0 < temp:
water.append(temp)
for p in range(suger_max//c + 1):
fo... |
s917686134 | p03854 | u530383736 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 261 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S = input().strip()
#-----
i=0
while i <= len(S)-5:
if S[i:(i+7)] == "dreamer":
i=i+7
elif S[i:(i+6)] == "eraser":
i=i+6
elif S[i:(i+5)] == "dream" or S[i:(i+5)] == "erase":
i=i+5
else:
print("NO")
break | s925595500 | Accepted | 29 | 3,188 | 311 | S = input().strip()
#-----
i=len(S)
while i >= 0:
if S[(i-7):i] == "dreamer":
i=i-7
elif S[(i-6):i] == "eraser":
i=i-6
elif S[(i-5):i] == "dream" or S[(i-5):i] == "erase":
i=i-5
else:
print("NO")
break
if i == 0:
print("YES")
break
|
s064689577 | p03625 | u870518235 | 2,000 | 262,144 | Wrong Answer | 98 | 26,204 | 352 | 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. | import collections
N = int(input())
A = list(map(int, input().split()))
A = collections.Counter(A).most_common()
N = len(A)
ans = [0]
for i in range(N):
if A[i][1] >= 4:
ans.append(A[i][0]**2)
ref = []
for j in range(N):
if A[i][1] >= 2:
ref.append(A[i][0])
if len(ref) >= 2:
ans.append... | s376414542 | Accepted | 90 | 26,448 | 372 | import collections
N = int(input())
A = list(map(int, input().split()))
A = collections.Counter(A).most_common()
N = len(A)
ans = [0]
for i in range(N):
if A[i][1] >= 4:
ans.append(A[i][0]**2)
ref = []
for j in range(N):
if A[j][1] >= 2:
ref.append(A[j][0])
ref = sorted(ref)
if len(ref) >= ... |
s475719161 | p03351 | u926166830 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 150 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d = map(int, input().split())
if abs(c-a) > d:
if abs(b-a) > d or abs(c-b) > d:
print("NO")
else:
print("YES")
else:
print("YES") | s135932205 | Accepted | 17 | 2,940 | 154 | a,b,c,d = map(int, input().split())
if abs(c-a) <= d:
print("Yes")
else:
if abs(b-a) <= d and abs(c-b) <= d:
print("Yes")
else:
print("No") |
s085522127 | p03853 | u150603590 | 2,000 | 262,144 | Wrong Answer | 26 | 3,316 | 420 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... |
if __name__ == '__main__':
H,W=list(map(int,input().split()))
C=[["" for i in range(W)] for j in range(H)]
for i in range(H):
temp=input()
for j in range(W):
C[i][j]=temp[j]
ans=[["" for i in range(W)] for j in range(2*H)]
for i in range(2*H):
for j in range(... | s174344507 | Accepted | 26 | 3,316 | 456 |
if __name__ == '__main__':
H,W=list(map(int,input().split()))
C=[["" for i in range(W)] for j in range(H)]
for i in range(H):
temp=input()
for j in range(W):
C[i][j]=temp[j]
ans=[["" for i in range(W)] for j in range(2*H)]
for i in range(0,2*H,2):
for j in ra... |
s860625374 | p03760 | u318955153 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 149 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | O=input()
E=input()
pw = []
for i in range(len(E)):
pw.append(O[i])
pw.append(E[i])
if len(O)%2 == 1:
pw.append(O[-1])
print(''.join(pw)) | s495494153 | Accepted | 18 | 2,940 | 150 | O=input()
E=input()
pw = []
for i in range(len(E)):
pw.append(O[i])
pw.append(E[i])
if len(O)!=len(E):
pw.append(O[-1])
print(''.join(pw)) |
s449447864 | p03457 | u103393963 | 2,000 | 262,144 | Wrong Answer | 595 | 28,600 | 411 | 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())
grid = [[0,0,0]]
for i in range(N):
array = list(map(int, input().strip().split()))
grid.append(array)
for h in range(N):
bool = False
t = 0
x = 0
y = 0
t = grid[h+1][0] - grid[h][0]
x = grid[h+1][1] - grid[h][1]
y = grid[h+1][2] - grid[h][2]
print(t,x,y)
if (t - x - ... | s226298910 | Accepted | 510 | 27,300 | 477 | N = int(input())
grid = [[0,0,0]]
for i in range(N):
array = list(map(int, input().strip().split()))
grid.append(array)
for h in range(N):
bool = False
t = 0
x = 0
y = 0
t = grid[h+1][0] - grid[h][0]
x = abs(grid[h+1][1] - grid[h][1])
y = abs(grid[h+1][2] - grid[h][2])
if grid[h+1][0] < 0 ... |
s932376171 | p03448 | u728774856 | 2,000 | 262,144 | Wrong Answer | 52 | 2,940 | 203 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500*i + 100*j + 50*k == X:
count += 1
| s855503938 | Accepted | 51 | 3,060 | 224 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500*i + 100*j + 50*k == X:
count += 1
print(count) |
s671816549 | p03447 | u395894569 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 12 | 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? | 1000
108
108 | s339371607 | Accepted | 19 | 2,940 | 68 | x=int(input())
a=int(input())
b=int(input())
print(x-a-((x-a)//b)*b) |
s405621724 | p03377 | u911263794 | 2,000 | 262,144 | Wrong Answer | 25 | 9,052 | 92 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A,B,X=map(int,input().split())
if X>=A and A+B>=X:
print("Yes")
else:
print("No")
| s307616218 | Accepted | 26 | 9,012 | 92 | A,B,X=map(int,input().split())
if X>=A and A+B>=X:
print("YES")
else:
print("NO")
|
s059756399 | p03860 | u522266410 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | 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=input()
if a in ['a','i','u','e','o']:
print('vowel')
else :
print('consonant')
| s858702284 | Accepted | 17 | 2,940 | 43 | x,s,z = input().split()
print("A"+s[0]+"C") |
s020645468 | p02390 | u534156032 | 1,000 | 131,072 | Wrong Answer | 30 | 7,644 | 98 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | n = int(input())
s = n % 60
n = n // 60
m = n % 60
h = n // 60
print("%02d:%02d:%02d" % (h, m, s)) | s046704508 | Accepted | 20 | 7,644 | 84 | n = int(input())
s = n % 60
n = n // 60
m = n % 60
h = n // 60
print(h,m,s, sep=':') |
s329459186 | p03156 | u163320134 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 223 | You have written N problems to hold programming contests. The i-th problem will have a score of P_i points if used in a contest. With these problems, you would like to hold as many contests as possible under the following condition: * A contest has three problems. The first problem has a score not greater than A po... | n=int(input())
a,b=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr)
pos1=0
pos2=0
for i in range(n):
if arr[i]<=a:
pos1=i
if arr[i]<=b:
pos2=i
ans=min(pos1,pos2-pos1,n-pos2)
print(ans) | s680372235 | Accepted | 17 | 3,064 | 227 | n=int(input())
a,b=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr)
pos1=0
pos2=0
for i in range(n):
if arr[i]<=a:
pos1=i+1
if arr[i]<=b:
pos2=i+1
ans=min(pos1,pos2-pos1,n-pos2)
print(ans) |
s911182798 | p02601 | u565679097 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,120 | 240 | 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... | R,G,B = map(int,input().split())
K = int(input())
for i in range(K):
if G < R:
G *= 2
elif B < G:
B *= 2
print('Green: ' + str(G) + ' blue:' + str(B))
if R < G and G < B:
print('Yes')
else:
print('No') | s348577761 | Accepted | 29 | 9,192 | 245 | R,G,B = map(int,input().split())
K = int(input())
for i in range(K):
if G <= R:
G *= 2
elif B <= G:
B *= 2
if R < G and G < B:
print('Yes')
else:
print('No') |
s734014911 | p03605 | u808569469 | 2,000 | 262,144 | Wrong Answer | 25 | 8,876 | 82 | 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()
nlist =list(n)
if 9 in nlist:
print("Yes")
else:
print("No")
| s043199621 | Accepted | 24 | 8,992 | 64 | n = input()
if "9" in n:
print("Yes")
else:
print("No") |
s156584551 | p03563 | u828139046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | r,g = [int(input()) for i in range(2)]
print(g * 2 + r) | s411074705 | Accepted | 18 | 2,940 | 56 | r,g = [int(input()) for i in range(2)]
print(g * 2 - r) |
s940238966 | p02694 | u032955959 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,112 | 58 | 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())
n=0
while 100*(1.01**n)>=X:
n+=1
print(n) | s922531063 | Accepted | 20 | 9,164 | 94 | X=int(input())
i=0
n=100
while True:
if n>=X:
print(i)
break
i=i+1
n=int(n*1.01) |
s494788876 | p03575 | u503901534 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 819 | You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ... | n, m = map(int,input().split())
M = []
for i in range(n+1):
onel = []
for j in range(n+1):
onel.append(0)
M.append(onel)
visited_checklist = []
input_node = []
for i in range(n+1):
visited_checklist.append(i)
for k in range(m):
ai,bi = map(int,input().split())
M[ai][bi] = 1
... | s358162574 | Accepted | 24 | 3,064 | 687 | n,m = map(int,input().split())
H = [[0 for _ in range(n)] for _ in range(n) ]
edge_list = []
for _ in range(m):
a, b = map(int,input().split())
edge_list.append([a,b])
H[a-1][b-1] = 1
H[b-1][a-1] = 1
visited = [0 for _ in range(n)]
def dfs(node):
visited[node] = 1
for node_,edge_ in enum... |
s519341782 | p03853 | u123745130 | 2,000 | 262,144 | Wrong Answer | 24 | 3,828 | 117 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | h,w=map(int,input().split())
lst=[list(input()) for _ in range(h)]
lst_1=[]
for i in lst:
print(*i)
print(*i) | s454968311 | Accepted | 24 | 4,596 | 131 | h,w=map(int,input().split())
lst=[list(input()) for _ in range(h)]
lst_1=[]
for i in lst:
print(*i,sep="")
print(*i,sep="") |
s345393699 | p03386 | u732870425 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 104 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | a, b, k = map(int, input().split())
for i in range(k):
print(a+i)
for j in range(k):
print(b-k) | s282311002 | Accepted | 17 | 3,060 | 113 | a, b, k = map(int, input().split())
li = range(a, b+1)
for i in sorted(set(li[:k]) | set(li[-k:])):
print(i) |
s419467904 | p02694 | u506910932 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,156 | 101 | 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())
ans = 0
now = 100
while (now <= x):
ans += 1
now = int(now*1.01)
print(ans)
| s722748152 | Accepted | 24 | 9,160 | 101 | x = int(input())
ans = 0
now = 100
while (now < x):
ans += 1
now += int(now*0.01)
print(ans)
|
s400817204 | p00728 | u546285759 | 1,000 | 131,072 | Wrong Answer | 20 | 7,620 | 211 | The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestan... | import bisect
while True:
n = int(input())
if n+1:
break
score = []
for _ in range(n):
s = int(input())
bisect.insort(score, s)
print(sum(score[1:-1])//(len(score)-2)) | s237670270 | Accepted | 30 | 7,540 | 214 | import bisect
while True:
n = int(input())
if n == 0:
break
score = []
for _ in range(n):
s = int(input())
bisect.insort(score, s)
print(sum(score[1:-1])//(len(score)-2)) |
s922676266 | p03352 | u685662874 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 125 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | X=int(input())
import math
num = []
for i in range(1,X+1):
if i == math.sqrt(i**2):
num.append(i)
print(max(num)) | s328695276 | Accepted | 17 | 2,940 | 202 | import math
X = int(input())
sq = int(math.sqrt(X))
m = 1
for b in range(2, sq+1):
p = 2
tmp = b ** p
while tmp <= X:
m = max(tmp, m)
p += 1
tmp = b ** p
print(m)
|
s390180200 | p03574 | u994521204 | 2,000 | 262,144 | Wrong Answer | 22 | 3,444 | 521 | 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... | h,w=map(int,input().split())
M=[]
for i in range(h):
l=list(input().replace('.','0').replace('#','9'))
l=list(map(int,l))
M.append(l)
for i in range(h):
for j in range(w):
if M[i][j]==9:
M[i][j]='#'
if i+1 in range(h):
M[i+1][j]+=1
if i-1 in ra... | s018679762 | Accepted | 30 | 3,572 | 650 | h, w = map(int, input().split())
S = [list(input()) for _ in range(h)]
ans = [[0] * (w) for _ in range(h)]
dx = [-1, 0, 1, -1, 1, -1, 0, 1]
dy = [-1, -1, -1, 0, 0, 1, 1, 1]
for i in range(h):
for j in range(w):
if S[i][j] == "#":
for k in range(8):
nx = j + dx[k]
... |
s860333512 | p02694 | u672370694 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,152 | 107 | 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... | k = int(input())
now = 100
count = 0
while now <= k:
now = now + int(now*0.01)
count += 1
print(count)
| s481026718 | Accepted | 20 | 9,152 | 106 | k = int(input())
now = 100
count = 0
while now < k:
now = now + int(now*0.01)
count += 1
print(count)
|
s399225139 | p02612 | u999327182 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,140 | 29 | 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(1000%N) | s265581231 | Accepted | 27 | 9,148 | 66 | N =int(input())
if N%1000==0:
print(0)
else:
print(1000-N%1000) |
s927896497 | p03095 | u068692021 | 2,000 | 1,048,576 | Wrong Answer | 23 | 5,780 | 308 | 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... | # -*- coding: utf-8 -*-
n = int(input())
s = str(input())
b = 10 ** 9 + 7
# print(n);
# print(s);
sum=0
alphabet=['a', 'b', 'c', 'd' ]
alphabet=[chr(i) for i in range(97, 97 + 26)]
for i in alphabet:
count=s.count(i)
sum = (sum * (count + 1) + count ) % b
print (s,i,count,sum)
print(sum)
| s061284534 | Accepted | 20 | 3,188 | 310 | # -*- coding: utf-8 -*-
n = int(input())
s = str(input())
b = 10 ** 9 + 7
# print(n);
# print(s);
sum=0
alphabet=['a', 'b', 'c', 'd' ]
alphabet=[chr(i) for i in range(97, 97 + 26)]
for i in alphabet:
count=s.count(i)
sum = (sum * (count + 1) + count ) % b
# print (s,i,count,sum)
print(sum)
|
s368773259 | p03359 | u848054939 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | 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 = (int(i) for i in input().split())
if(a > b):
print(a-1)
elif(a < b):
print(a) | s729046493 | Accepted | 17 | 2,940 | 90 | a, b = (int(i) for i in input().split())
if(a > b):
print(a-1)
elif(a <= b):
print(a) |
s108001143 | p03738 | u428397309 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 145 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | # -*- coding: utf-8 -*-
A = int(input())
B = int(input())
if A > B:
print('GRATER')
elif B > A:
print('LESS')
else:
print('EQUAL')
| s719453811 | Accepted | 17 | 2,940 | 146 | # -*- coding: utf-8 -*-
A = int(input())
B = int(input())
if A > B:
print('GREATER')
elif B > A:
print('LESS')
else:
print('EQUAL')
|
s566601846 | p03545 | u633548583 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 241 | 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... | n=input()
op_cnt=len(n)-1
for i in range(2**op_cnt):
s=n[0]
for j in range(op_cnt):
if ((i<<j)&1):
s+="+"
else:
s+="-"
s+=n[j+1]
if eval(s)==7:
print(s+"=7")
exit()
| s519771009 | Accepted | 17 | 3,060 | 241 | n=input()
op_cnt=len(n)-1
for i in range(2**op_cnt):
s=n[0]
for j in range(op_cnt):
if ((i>>j)&1):
s+="+"
else:
s+="-"
s+=n[j+1]
if eval(s)==7:
print(s+"=7")
exit()
|
s309932718 | p02694 | u078527650 | 2,000 | 1,048,576 | Wrong Answer | 23 | 8,956 | 149 | 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... | b1= float(input())
b2 = float(100)
for i in range (1,100000000):
b2 =int( b2 * 1.01)
if b2 <= b1 :
continue
else : break
print(i)
| s932633716 | Accepted | 20 | 9,012 | 145 | b1= float(input())
b2 = float(100)
for i in range (1,10**18):
b2 =int( b2 * 1.01)
if b2 < b1 :
continue
else : break
print(i)
|
s006361981 | p04029 | u712445873 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | 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())
print(n*(n+1)/2) | s790672251 | Accepted | 17 | 2,940 | 38 | n = int(input())
print(int(n*(n+1)/2)) |
s656680848 | p03494 | u497049044 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 155 | 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 = input()
li = list(map(int,input().split()))
x = 0
print(N)
print(li)
while all(a%2 == 0 for a in li):
li = [a/2 for a in li]
x += 1
print(x)
| s550166568 | Accepted | 19 | 2,940 | 134 | N = input()
li = list(map(int,input().split()))
x = 0
while all(a%2 == 0 for a in li):
li = [a/2 for a in li]
x += 1
print(x)
|
s533294120 | p03067 | u048867491 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 211 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | def main():
A,B,C = [int(x) for x in input().split()]
if A < C < B:
print('yes')
elif B < C < A:
print('yes')
else:
print('no')
if __name__ == "__main__":
main()
| s450299064 | Accepted | 17 | 2,940 | 211 | def main():
A,B,C = [int(x) for x in input().split()]
if A < C < B:
print('Yes')
elif B < C < A:
print('Yes')
else:
print('No')
if __name__ == "__main__":
main()
|
s928813256 | p04029 | u609814378 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | 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())
Answer = (N*(N+1)/2)
print(Answer) | s901344183 | Accepted | 17 | 2,940 | 57 | N = int(input())
Answer = N * (N + 1) // 2
print(Answer) |
s059440676 | p02853 | u667084803 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 121 | We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.... | X, Y = map(int,input().split())
ans = max(X-4,0)* 100000 + max(Y-4,0)* 100000
if X == Y == 1:
ans += 400000
print(ans) | s926207247 | Accepted | 17 | 2,940 | 130 |
X, Y = map(int,input().split())
ans = max(4-X,0)* 100000 + max(4-Y,0)* 100000
if (X == Y) * (Y== 1):
ans += 400000
print(ans) |
s783872470 | p02606 | u344813796 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,168 | 91 | How many multiples of d are there among the integers between L and R (inclusive)? | l,r,d=map(int, input().split()) #a1 a2 a3
ans=0
s=d
while s<=r:
ans+=1
s+=d
print(ans) | s288598360 | Accepted | 24 | 9,116 | 106 | l,r,d=map(int, input().split()) #a1 a2 a3
ans=0
for i in range(l,r+1):
if i%d==0:
ans+=1
print(ans) |
s573068151 | p03637 | u634079249 | 2,000 | 262,144 | Wrong Answer | 61 | 19,760 | 1,128 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 โค i โค N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(i... | s206193072 | Accepted | 62 | 19,736 | 1,128 | import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(i... |
s284644774 | p02831 | u420332509 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,180 | 255 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ... | def gcd(a, b):
if a == 0: return b
if b == 0: return a
if a == b: return a
if a > b: return gcd(b, a%b)
return gcd(a, b%a)
def lcm(a, b):
if a == b == 0:
return abs(a*b)/gcd(a, b)
return 0
a, b = map(int, input().split())
print(lcm(a, b)) | s857736324 | Accepted | 27 | 9,040 | 280 | def gcd(a, b):
if a == 0: return b
if b == 0: return a
if a == b: return a
if a > b: return gcd(b, a%b)
return gcd(a, b%a)
def lcm(a, b):
if a == b == 0:
return 0
return abs(a*b)/gcd(a, b)
a, b = map(int, input().split())
print(int(lcm(a, b)))
|
s193805782 | p03959 | u413165887 | 2,000 | 262,144 | Wrong Answer | 2,104 | 19,012 | 614 | Mountaineers Mr. Takahashi and Mr. Aoki recently trekked across a certain famous mountain range. The mountain range consists of N mountains, extending from west to east in a straight line as Mt. 1, Mt. 2, ..., Mt. N. Mr. Takahashi traversed the range from the west and Mr. Aoki from the east. The height of Mt. i is h_i... | import sys
n = int(input())
t = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
a.append(a[-1])
for i in range(1, n):
print(t[i], a[i])
if t[i] > t[i-1]:
if t[i] <= a[i]:
a[i] = 1
continue
else:
print(0)
sys.exit()
eli... | s997833702 | Accepted | 204 | 19,136 | 455 | n = int(input())
t = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
result = 1
for i in range(n):
h_max, h_min = min(t[i], a[i])+1, 1
if i != 0:
if t[i-1] < t[i]:
h_min = t[i]
else:
h_min = t[0]
if i != n-1:
if a[i] > a[i+1]:
h_... |
s709685533 | p03997 | u186838327 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 67 | 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) | s240679212 | Accepted | 16 | 2,940 | 73 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2)) |
s507448970 | p02396 | u440180827 | 1,000 | 131,072 | Wrong Answer | 130 | 7,620 | 118 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | i = 1
while True:
x = int(input())
if x:
print('Case {:d}: {:d}'.format(i, x))
else:
break | s886188339 | Accepted | 130 | 7,320 | 100 | x = input()
i = 1
while x != '0':
print('Case {0}: {1}'.format(i, x))
x = input()
i += 1 |
s885543657 | p03486 | u729133443 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 49 | 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. | print('NYoe s'[sorted(input())<list(input())::2]) | s851980896 | Accepted | 18 | 2,940 | 58 | s=lambda:sorted(input());print('NYoe s'[s()<s()[::-1]::2]) |
s717688038 | p03671 | u235066013 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m... | a,b,c=[int(1) for i in input().split()]
list=[a,b,c]
list.sort()
print(list[0]+list[1]) | s573480508 | Accepted | 17 | 2,940 | 87 | a,b,c=[int(i) for i in input().split()]
list=[a,b,c]
list.sort()
print(list[0]+list[1]) |
s644579553 | p02612 | u811436126 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,136 | 43 | 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())
ans = n % 1000
print(ans)
| s671539208 | Accepted | 33 | 9,136 | 62 | n = int(input())
ans = 1000 - n % 1000
ans %= 1000
print(ans)
|
s535058330 | p03644 | u161318582 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 68 | 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... | x = int(input())
ans = 0
while x%2==0:
x /=2
ans += 1
print(ans) | s831472163 | Accepted | 17 | 3,060 | 197 | x = int(input())
if x >= 64:
print(64)
elif x >= 32:
print(32)
elif x >= 16:
print(16)
elif x >= 8:
print(8)
elif x >= 4:
print(4)
elif x >= 2:
print(2)
else:
print(1) |
s207806606 | p02678 | u578514593 | 2,000 | 1,048,576 | Wrong Answer | 2,208 | 85,696 | 901 | 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... | from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path
def get_path(start, goal, pred):
return get_path_row(start, goal, pred[start])
def get_path_row(start, goal, pred_row):
path = []
i = goal
while i != start and i >= 0:
path.append(i)
i = pred_row[i]
... | s848663204 | Accepted | 1,009 | 64,016 | 634 | from heapq import heappush, heappop
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
edges[a].append((1, b))
edges[b].append((1, a))
INF = 10 ** 9
dist = [INF] * n
prev = [-1] * n
def dijkstra(s):
q = [(0, s)]
... |
s982243203 | p03470 | u292220197 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 252 | 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())
an = []
cnt = 0
for i in range(n):
an.append(int(input()))
sorted_an = sorted(an, reverse=True)
for i in range(len(sorted_an)-1):
if i == 0:
cnt += 1
else:
if sorted_an[i] > sorted_an[i+1]:
cnt += 1
print(cnt) | s388538169 | Accepted | 20 | 3,064 | 214 | n = int(input())
an = []
cnt = 1
for i in range(n):
an.append(int(input()))
sorted_an = sorted(an, reverse=True)
for i in range(len(sorted_an)-1):
if sorted_an[i] > sorted_an[i+1]:
cnt += 1
print(cnt) |
s232082429 | p03671 | u609814378 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m... | a,b,c = map(int, input().split())
a_b = a+b
a_c = a+c
b_c = b+c
print(max(a_b,a_c,b_c))
| s896545888 | Accepted | 17 | 2,940 | 89 | a,b,c = map(int, input().split())
a_b = a+b
a_c = a+c
b_c = b+c
print(min(a_b,a_c,b_c)) |
s946524362 | p02399 | u286033857 | 1,000 | 131,072 | Wrong Answer | 30 | 7,612 | 100 | Write a program which reads two integers a and b, and calculates the following values: * a รท b: d (in integer) * remainder of a รท b: r (in integer) * a รท b: f (in real number) | a,b = map(int,input().split())
d = a // b
r = a % b
f = float(a / b)
print("{} {} {}".format(d,r,f)) | s748421748 | Accepted | 30 | 7,616 | 97 | a,b = map(int,input().split())
d = a // b
r = a % b
f = a / b
print("{} {} {:.5f}".format(d,r,f)) |
s444960937 | p03545 | u972652761 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 264 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | s = str(input())
n = len(s) - 1
for i in range(1 << n):
f = ""
f += s[0]
for j in range(n):
if 1 & (i >> j):
f += "+"
f += s[j + 1]
else :
f += "-"
f += s[j + 1]
print(eval(f))
| s436088177 | Accepted | 17 | 3,064 | 304 | s = str(input())
n = len(s) - 1
for i in range(1 << n):
f = ""
f += s[0]
for j in range(n):
if 1 & (i >> j):
f += "+"
f += s[j + 1]
else :
f += "-"
f += s[j + 1]
if eval(f) == 7:
print(f + "=7")
break
|
s398763659 | p02694 | u679236042 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,220 | 153 | 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())
syozikin = 100
ans = 0
while syozikin <= X:
syozikin = syozikin*1.01
syozikin =syozikin // 1
ans = ans + 1
print(ans)
| s278920275 | Accepted | 22 | 9,236 | 150 | X = int(input())
syozikin = 100
ans = 0
while syozikin < X:
syozikin = syozikin*1.01
syozikin =syozikin // 1
ans = ans + 1
print(ans) |
s366655618 | p03712 | u511457539 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 242 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | H, W = map(int, input().split())
a = [str(input()) for i in range(H)]
sharp = str("#"*(W+2))
Lists = []
Lists.append([sharp])
for i in range(H):
Lists.append(["#" + a[0] +"#"])
Lists.append([sharp])
for List in Lists:
print(*List)
| s592653929 | Accepted | 17 | 3,060 | 242 | H, W = map(int, input().split())
a = [str(input()) for i in range(H)]
sharp = str("#"*(W+2))
Lists = []
Lists.append([sharp])
for i in range(H):
Lists.append(["#" + a[i] +"#"])
Lists.append([sharp])
for List in Lists:
print(*List)
|
s374567563 | p03495 | u263226212 | 2,000 | 262,144 | Wrong Answer | 216 | 25,276 | 264 | 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. | # -*- coding: utf-8 -*-
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
num = len(list(set(A)))
c = [0] * A[-1]
for a in A:
c[a - 1] += 1
c.sort()
ans = 0
if num > K:
for i in range(num - K):
ans += c[i]
print(ans)
| s764024962 | Accepted | 280 | 25,276 | 385 | # -*- coding: utf-8 -*-
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
num = len(list(set(A)))
c = [0] * A[-1]
for a in A:
c[a - 1] += 1
c.sort()
ans = 0
if num > K:
i = 0
diff = 0
while diff != num - K:
if c[i] != 0:
ans += c[i]
i += 1
... |
s432133970 | p03471 | u260216890 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 265 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N,Y=map(int,input().split())
a=10000
b=5000
c=1000
x=Y//c
ans=('-1','-1','-1')
if N-x>=0:
for i in range(x):
for j in range(N-i):
for k in range(N-i-j):
if Y==a*k+b*j+c*i:
ans=(str(k),str(j),str(i))
break
print(' '.join(ans)) | s608494651 | Accepted | 1,711 | 3,064 | 342 | n, y = map(int,input().split())
flag=False
for i in range(y//10000, -1, -1):
for j in range((y-i*10000)//5000, -1, -1):
k=(y-i*10000-j*5000)/1000
if i+j+k==n:
print(str(i)+" "+str(j)+" "+str(int(k)))
flag=True
break
if flag==True:
break
if flag==False:... |
s495603455 | p03228 | u333404917 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 353 | 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())
for i in range(k):
if i % 2 ==0:
if a % 2 == 1:
a - 1
else:
diff = int(a/2)
a = a - diff
b += diff
else:
if b % 2 == 1:
b - 1
else:
diff = int(b/2)
b = b - diff... | s658811615 | Accepted | 17 | 3,060 | 295 | a, b, k = map(int, input().split())
for i in range(0,k):
if i % 2 == 0:
if a % 2 == 1:
a -= 1
diff = a//2
a -= diff
b += diff
else:
if b % 2 == 1:
b -= 1
diff = b//2
b -= diff
a += diff
print(a,b) |
s892038399 | p03577 | u921773161 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 31 | 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... | s = input()
print(s[:len(s)-4]) | s866982131 | Accepted | 17 | 2,940 | 32 | s = input()
print(s[:len(s)-8])
|
s147586949 | p03067 | u935685410 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 124 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | A = list(map(int,input().split()))
print(A)
if A[0]>A[2]>A[1] or A[0] < A[2] < A[1]:
print("YES")
else:
print("NO") | s519283063 | Accepted | 17 | 2,940 | 160 | # coding: utf-8
# Your code here!
A = list(map(int,input().split()))
#print(A)
if A[0]>A[2]>A[1] or A[0] < A[2] < A[1]:
print("Yes")
else:
print("No") |
s211993095 | p03493 | u346629192 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 24 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | s = input()
s.count("1") | s784170010 | Accepted | 20 | 3,060 | 31 | s = input()
print(s.count("1")) |
s701392237 | p02927 | u377989038 | 2,000 | 1,048,576 | Wrong Answer | 24 | 3,064 | 240 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | M, D = map(int, input().split())
cnt = 0
for m in range(1, M + 1):
for d in range(22, D + 1):
d1, d10 = int(str(d)[1]), int(str(d)[0])
if d1 >= 2 and d1 * d10 == m:
print(m, d)
cnt += 1
print(cnt) | s393450764 | Accepted | 25 | 3,060 | 216 | M, D = map(int, input().split())
cnt = 0
for m in range(1, M + 1):
for d in range(22, D + 1):
d1, d10 = int(str(d)[1]), int(str(d)[0])
if d1 >= 2 and d1 * d10 == m:
cnt += 1
print(cnt) |
s299501973 | p02742 | u573234244 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 127 | 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 = input().split()
H = int(H)
W = int(W)
t = H * W
mod = t % 2
if mod == 0:
print(t/2)
else:
print(int(t/2) + 1) | s058659976 | Accepted | 17 | 3,060 | 189 | H,W = input().split()
H = int(H)
W = int(W)
t = H * W
mod = t % 2
if H != 1 and W != 1:
if mod == 0:
print(int(t/2))
else:
print(int(t/2) + 1)
else:
print(1) |
s400928830 | p03997 | u417958545 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | 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)
| s677786499 | Accepted | 17 | 2,940 | 106 |
a = int(input())
b = int(input())
h = int(input())
s = (a + b) * h/2
print(round(s))
|
s838919369 | p03471 | u500415792 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,060 | 343 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... |
N, total = map(int, input().strip().split(" "))
bills = [-1, -1, -1]
for i in range(int(total/1000)+1):
x = total - 1000*i
for j in range(int(x/5000)+1):
y = x-5000*j
for k in range(int(y/10000)+1):
z = y-10000*k
buff = [i, j, k]
if sum(buff) == N:
bills... | s505243958 | Accepted | 1,532 | 3,188 | 324 | N, total = map(int, input().strip().split(" "))
bills = [-1, -1, -1]
for i in range(int(total/10000)+1):
x = total - 10000*i
for j in range(int(x/5000)+1):
y = x-5000*j
k = N - i -j
if y-1000*k == 0:
bills = [i, j, k]
break
print(" ".join(map(str, bill... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.