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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s877184599 | p03719 | u093783313 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 218 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | # coding: utf-8
# Your code here!
line = input().split()
l = [int(s) for s in line]
# print(l)
a = 0
if -100 <= l[0] <= l[1] <= l[2]<=100:
a = 1
if a == 1 :
print("Yes")
else:
print("No") | s793493178 | Accepted | 17 | 2,940 | 139 | line = input().split()
l = [int(s) for s in line]
if -100 <= l[0] <= l[2] <= l[1]<=100:
print("Yes")
else:
print("No") |
s776652261 | p03679 | u816919571 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x,a,b = map(int,input().split())
print("delicious" if b <= a else "safe" if a<b<=x else "dangerous") | s756944672 | Accepted | 17 | 2,940 | 102 | x,a,b = map(int,input().split())
print("delicious" if b <= a else "safe" if a<b<=a+x else "dangerous") |
s950083108 | p03501 | u498465804 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 65 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | a, b, c = map(int, input().split())
print(a*b if a*b >= c else c) | s382701043 | Accepted | 17 | 2,940 | 65 | a, b, c = map(int, input().split())
print(a*b if a*b <= c else c) |
s129141183 | p03475 | u887207211 | 3,000 | 262,144 | Wrong Answer | 79 | 3,064 | 280 | A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t... | N = int(input())
CSF = [list(map(int,input().split())) for _ in range(N-1)]
for i in range(N):
t = 0
for j in range(i,N-1):
if(t < CSF[j][1]):
t = CSF[j][1]
elif(t%CSF[j][2] == 0):
pass
else:
t = CSF[j][2]-t%CSF[j][2]
t += CSF[j][0]
print(t) | s797466333 | Accepted | 107 | 3,188 | 283 | N = int(input())
CSF = [list(map(int,input().split())) for _ in range(N-1)]
for i in range(N):
t = 0
for j in range(i,N-1):
if(t < CSF[j][1]):
t = CSF[j][1]
elif(t%CSF[j][2] == 0):
pass
else:
t += CSF[j][2]-t%CSF[j][2]
t += CSF[j][0]
print(t) |
s411383758 | p03729 | u217303170 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | 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')
| s522428112 | Accepted | 17 | 3,064 | 101 | a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print('YES')
else:
print('NO')
|
s336741666 | p03110 | u063550903 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 182 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | N=int(input())
T=[0]*N
mysum=0
for i in range(N):
T[i]=[float(i) for i in input().replace("JPY","1").replace("BTC","380000").split()]
mysum+=T[i][0]*T[i][1]
print(int(mysum)) | s609932963 | Accepted | 18 | 3,060 | 177 | N=int(input())
T=[0]*N
mysum=0
for i in range(N):
T[i]=[float(i) for i in input().replace("JPY","1").replace("BTC","380000").split()]
mysum+=T[i][0]*T[i][1]
print(mysum) |
s882854856 | p03555 | u924308178 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | a = input()
b = input()
if a==b[::-1]:
print("Yes")
else:
print("No") | s380225706 | Accepted | 17 | 2,940 | 77 | a = input()
b = input()
if a==b[::-1]:
print("YES")
else:
print("NO") |
s984865284 | p03379 | u353855427 | 2,000 | 262,144 | Wrong Answer | 303 | 25,620 | 174 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | N = int(input())
X = list(map(int,input().split()))
X_s = sorted(X)
print(X)
l1 = X_s[N//2 - 1]
l2 = X_s[(N//2)+1 - 1]
for i in X:
if i <= l1:
print(l2)
else:
print(l1) | s543551013 | Accepted | 281 | 25,620 | 165 | N = int(input())
X = list(map(int,input().split()))
X_s = sorted(X)
l1 = X_s[N//2 - 1]
l2 = X_s[(N//2)+1 - 1]
for i in X:
if i <= l1:
print(l2)
else:
print(l1) |
s486496077 | p02612 | u459023872 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,144 | 44 | 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())
payment=N%1000
print(payment) | s402419600 | Accepted | 34 | 9,092 | 85 | N=int(input())
payment=N%1000
if payment==0:
print("0")
else:
print(1000-payment) |
s453616062 | p03827 | u256464928 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 149 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | n = int(input())
s = input()
x = 0
X = [0]
for i in range(n):
if s[0]=="I":
x+=1
X.append(x)
else:
x-=1
X.append(x)
print(max(X)) | s394541620 | Accepted | 17 | 3,060 | 149 | n = int(input())
s = input()
x = 0
X = [0]
for i in range(n):
if s[i]=="I":
x+=1
X.append(x)
else:
x-=1
X.append(x)
print(max(X)) |
s111968971 | p03545 | u612223903 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 558 | 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... | abcd = input()
answers =[]
for i in range(2**3):
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])
plus_minus = [1,1,1]
for j in range(3):
if (i >> j)& 1:
plus_minus[j] = -1
ans = a + b*plus_minus[0] + c*plus_minus[1] + d*plus_minus[2]
if ans == 7:
... | s130327356 | Accepted | 17 | 3,064 | 572 | abcd = input()
answers =[]
for i in range(2**3):
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])
plus_minus = [1,1,1]
for j in range(3):
if (i >> j)& 1:
plus_minus[j] = -1
ans = a + b*plus_minus[0] + c*plus_minus[1] + d*plus_minus[2]
if ans == 7:
... |
s090056973 | p03524 | u018984506 | 2,000 | 262,144 | Wrong Answer | 46 | 3,188 | 254 | Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`. He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible. | s=input()
n=[0,0,0]
for i in range(len(s)):
if s[i] == "a":
n[0]+=1
elif s[i] == "b":
n[1]+=1
else:
n[2]+=1
if abs(n[0]-n[1]) <= 1 and abs(n[1]-n[2]) <= 1 and abs(n[0]-n[2]) <= 1:
print("Yes")
else:
print("No") | s512767487 | Accepted | 46 | 3,188 | 254 | s=input()
n=[0,0,0]
for i in range(len(s)):
if s[i] == "a":
n[0]+=1
elif s[i] == "b":
n[1]+=1
else:
n[2]+=1
if abs(n[0]-n[1]) <= 1 and abs(n[1]-n[2]) <= 1 and abs(n[0]-n[2]) <= 1:
print("YES")
else:
print("NO") |
s441279613 | p02975 | u107639613 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 14,468 | 806 | Snuke has N hats. The i-th hat has an integer a_i written on it. There are N camels standing in a circle. Snuke will put one of his hats on each of these camels. If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print `Yes`; otherwise, print `No... | from collections import deque
N = int(input())
A = deque(map(int, input().split()))
first = A.popleft()
def round(a):
B = set(A)
eval = 0
pre = first
post = a
B.discard(a)
while len(B) != 0:
c = pre ^ post
if c in B:
... | s770192395 | Accepted | 1,774 | 14,468 | 1,053 | from collections import deque
N = int(input())
A = deque(map(int, input().split()))
first = A.popleft()
def round(a):
B = list(A)
eval = 0
pre = first
post = a
B.remove(a)
num = N - 2
while num != 0:
c = pre ^ post
try:
... |
s415774732 | p03080 | u035605655 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 213 | 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. | # -*- coding: utf-8 -*-
N = int(input())
s = input()
rcount = 0
for c in s:
if c == 'Red':
rcount += 1
bcount = N - rcount
if rcount > bcount:
print('Yes')
else:
print('No')
| s108835383 | Accepted | 18 | 2,940 | 211 | # -*- coding: utf-8 -*-
N = int(input())
s = input()
rcount = 0
for c in s:
if c == 'R':
rcount += 1
bcount = N - rcount
if rcount > bcount:
print('Yes')
else:
print('No')
|
s196767262 | p03697 | u813371068 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 62 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | A,B=map(int,input().split())
print(A+B if A+B>10 else 'error') | s976421539 | Accepted | 17 | 2,940 | 76 |
A,B=map(int,input().split())
print(A+B if A+B<10 else 'error') |
s518684804 | p00005 | u298999032 | 1,000 | 131,072 | Wrong Answer | 50 | 6,920 | 93 | Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. | import fractions as f
a,b=map(float,input().split())
print(f.gcd(a,b))
print(a*b//f.gcd(a,b)) | s870913137 | Accepted | 20 | 5,596 | 220 | import sys
for i in sys.stdin:
a,b=map(int,i.split())
if a<b:a,b=b,a
def gcd(x,y):
while y>0:x,y=y,x%y
return x
def lcm(x,y):
return x*y/gcd(x,y)
print(gcd(a,b),int(lcm(a,b))) |
s414564077 | p03131 | u223904637 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 156 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | k,a,b=map(int,input().split())
if k+1<=a:
print(k+1)
exit()
s=k+1-a
if a>=b-1:
print(k+1)
else:
n=s//2
m=s%2
print(n*(a-b)+m)
| s267927248 | Accepted | 17 | 2,940 | 158 | k,a,b=map(int,input().split())
if k+1<=a:
print(k+1)
exit()
s=k+1-a
if a>=b-1:
print(k+1)
else:
n=s//2
m=s%2
print(a+n*(b-a)+m)
|
s794937666 | p03593 | u905582793 | 2,000 | 262,144 | Wrong Answer | 21 | 3,444 | 340 | 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 ... | from collections import Counter
import sys
h,w=map(int,input().split())
a=list(sys.stdin.read())
c=Counter(a)
c["\n"]=0
n1=0
n2=0
if h*w%2:
n1=1
if h%2:
n2+=w//2
if w%2:
n2+=h//2
n4=h//2+w//2
n1r,n2r,n4r=0,0,0
for i in c.values():
n1r += i%2
n2r += (i//2)%2
n4r += i//4
if n1==n1r and n4r>=n4:
print("Yes")... | s918268115 | Accepted | 22 | 3,444 | 344 | from collections import Counter
import sys
h,w=map(int,input().split())
a=list(sys.stdin.read())
c=Counter(a)
c["\n"]=0
n1=0
n2=0
if h*w%2:
n1=1
if h%2:
n2+=w//2
if w%2:
n2+=h//2
n4=(h//2)*(w//2)
n1r,n2r,n4r=0,0,0
for i in c.values():
n1r += i%2
n2r += (i//2)%2
n4r += i//4
if n1==n1r and n4r>=n4:
print("Y... |
s630325117 | p02416 | u088337682 | 1,000 | 131,072 | Wrong Answer | 20 | 5,540 | 73 | Write a program which reads an integer and prints sum of its digits. | while True:
x = input()
if x == "0":break
print(len(str(x)))
| s066261450 | Accepted | 20 | 5,588 | 83 | while True:
x = input()
if x == "0":break
print(sum(list(map(int,x))))
|
s416778069 | p03448 | u335281728 | 2,000 | 262,144 | Wrong Answer | 123 | 3,952 | 285 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
total = i*500+j*100+k*50
if total == x:
count += 1
else: print('a')
print(count) | s713028438 | Accepted | 53 | 3,060 | 256 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
total = i*500+j*100+k*50
if total == x:
count += 1
print(count) |
s724612343 | p03455 | u431981421 | 2,000 | 262,144 | Wrong Answer | 18 | 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') | s676739243 | Accepted | 17 | 2,940 | 88 | a, b = map(int, input().split())
if a * b % 2 == 0:
print('Even')
else:
print('Odd') |
s598786941 | p03997 | u692711472 | 2,000 | 262,144 | Wrong Answer | 23 | 9,036 | 73 | 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())
s = (a+b)*h/2
print(s) | s202383411 | Accepted | 28 | 9,152 | 78 | a = int(input())
b = int(input())
h = int(input())
s = (a+b)*h/2
print(int(s)) |
s420582432 | p03997 | u992759582 | 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) | s827414704 | Accepted | 17 | 2,940 | 74 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h /2)) |
s848086711 | p03862 | u353638740 | 2,000 | 262,144 | Wrong Answer | 2,103 | 149,884 | 641 | There are N boxes arranged in a row. Initially, the i-th box from the left contains a_i candies. Snuke can perform the following operation any number of times: * Choose a box containing at least one candy, and eat one of the candies in the chosen box. His objective is as follows: * Any two neighboring boxes con... | N, x = map(int,input().split())
a_list = list(map(int,input().split()))
b_list = [a_list[i]+a_list[i+1] for i in range(0,N-1)]
excess_list = [max(0,val -x) for val in b_list]
ans = 0
for i in range(0,len(b_list)-1):
a_val = a_list[i+1]
b_prev = excess_list[i]
b_next = excess_list[i+1]
min_val = min... | s228219701 | Accepted | 195 | 14,948 | 428 | N, x = map(int,input().split())
a_list = list(map(int,input().split()))
b_list = [a_list[i]+a_list[i+1] for i in range(0,N-1)]
excess_list = [max(0,val -x) for val in b_list]
ans = 0
for i in range(0,len(excess_list)-1):
min_val = min(a_list[i+1],excess_list[i],excess_list[i+1])
a_list[i+1] -= min_val
exc... |
s306488137 | p02396 | u029473859 | 1,000 | 131,072 | Wrong Answer | 20 | 7,400 | 20 | 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 = input()
print(i) | s052245450 | Accepted | 120 | 7,344 | 129 | k = 0
while True:
i = input()
k = k + 1
if i == "0":
break
else:
print("Case {}: {}".format(k,i)) |
s952612595 | p04043 | u238605674 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | I=input().split()
if I[0]=="5" and I[1]=="7" and I[2]:
print("YES")
else:
print("NO") | s349275143 | Accepted | 17 | 2,940 | 143 | I=input().split()
c5=0
c7=0
for i in I:
if i=="5":
c5+=1
elif i=="7":
c7+=1
if c5==2 and c7==1:
print("YES")
else:
print("NO") |
s611829840 | p03494 | u522375638 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 177 | 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()
numbers = list(map(int, input().split()))
cnt = 0
while sum([True if n%2==0 else False for n in numbers])>0:
numbers = [n/2 for n in numbers]
cnt += 1
print(cnt) | s916077209 | Accepted | 19 | 3,060 | 178 | N = input()
numbers = list(map(int, input().split()))
cnt = 0
while sum([True if n%2==1 else False for n in numbers])==0:
numbers = [n/2 for n in numbers]
cnt += 1
print(cnt) |
s172556310 | p03472 | u667024514 | 2,000 | 262,144 | Wrong Answer | 426 | 16,728 | 439 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | import math
n, h = map(int,input().split())
thr = []
att = []
ans = 0
for i in range(n):
a, b = map(int,input().split())
att.append(a)
thr.append(b)
thr.sort(reverse = True)
att.sort(reverse = True)
print(h,sum(thr))
for m in range(n):
if h > 0:
if thr[m] > att[0]:
h = h -thr[m]
ans = ans+1
else:
h = ... | s871327493 | Accepted | 409 | 11,392 | 406 | import math
n, h = map(int,input().split())
thr = []
att = []
ans = 0
for i in range(n):
a, b = map(int,input().split())
att.append(a)
thr.append(b)
thr.sort(reverse = True)
att.sort(reverse = True)
for m in range(n):
if h > 0:
if thr[m] > att[0]:
h = h -thr[m]
ans = ans+1
else:
h = h-att[0]
ans =... |
s134588893 | p03557 | u994988729 | 2,000 | 262,144 | Wrong Answer | 494 | 23,744 | 281 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ... | import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
b=list(map(int,input().split()))
c=sorted(list(map(int,input().split())))
ans=0
for i in b:
a_tmp=bisect.bisect_left(a,i)
c_tmp=n-bisect.bisect(c,i)
print(a_tmp,c_tmp)
ans+=a_tmp*c_tmp
print(ans) | s962247206 | Accepted | 266 | 26,476 | 350 | import numpy as np
N = int(input())
A = np.array(input().split(), dtype=int)
B = np.array(input().split(), dtype=int)
C = np.array(input().split(), dtype=int)
A.sort()
B.sort()
C.sort()
CB = np.searchsorted(B, C, side="left")
BA = np.searchsorted(A, B, side="left")
tmp = [0]+BA.cumsum().tolist()
tmp = np.array(tmp)
a... |
s264883204 | p03360 | u604262137 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 215 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | A, B, C = list(map(int, input().split()))
K = int(input())
seisuu_list = [A, B, C]
seisuu_list.sort(reverse=True)
seisuu_list[0] *= 1024*seisuu_list[0]
sum = seisuu_list[0]+seisuu_list[1]+seisuu_list[2]
print(sum)
| s971676630 | Accepted | 17 | 3,060 | 219 | A, B, C = list(map(int, input().split()))
K = int(input())
seisuu_list = [A, B, C]
seisuu_list.sort(reverse=True)
for _ in range(K):
seisuu_list[0] *= 2
sum = seisuu_list[0]+seisuu_list[1]+seisuu_list[2]
print(sum) |
s685840008 | p03494 | u607074939 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 250 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n = int(input())
a = list(map(int, input().split()))
count = 0
flg = True
while(flg):
for i in range(n):
if a[i]%2 != 0:
flg = False
break
else:
a[i] = a[i]/2
count += 1
print(count) | s365537318 | Accepted | 19 | 3,060 | 256 | n = int(input())
a = list(map(int, input().split()))
count = 0
flg = True
while(flg):
for i in range(n):
if a[i]%2 != 0:
flg = False
break
else:
a[i] = a[i]/2
else:
count += 1
print(count) |
s943170858 | p02277 | u643021750 | 1,000 | 131,072 | Wrong Answer | 20 | 5,624 | 1,742 | 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 ... |
def merge(A, n, left, mid, right):
n1 = mid - left
n2 = right - mid
for i in range(n1):
L[i] = A[left + i]
for i in range(n2):
R[i] = A[mid + i]
L[n1] = new_list("X", SENTINEL)
R[n2] = new_list("X", SENTINEL)
i = 0
j = 0
for k in range(left, right):
if L[i].v... | s722490088 | Accepted | 2,530 | 70,384 | 1,746 |
def merge(A, n, left, mid, right):
n1 = mid - left
n2 = right - mid
for i in range(n1):
L[i] = A[left + i]
for i in range(n2):
R[i] = A[mid + i]
L[n1] = new_list("X", SENTINEL)
R[n2] = new_list("X", SENTINEL)
i = 0
j = 0
for k in range(left, right):
if L[i].v... |
s416078417 | p03826 | u843318346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the r... | a,b,c,d = map(int,input().split())
print(max(a*b,d*d)) | s068119667 | Accepted | 17 | 2,940 | 55 | a,b,c,d = map(int,input().split())
print(max(a*b,c*d))
|
s906073700 | p03997 | u586577600 | 2,000 | 262,144 | Wrong Answer | 17 | 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) | s933719547 | Accepted | 17 | 2,940 | 68 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
s249466910 | p03997 | u557523358 | 2,000 | 262,144 | Wrong Answer | 23 | 3,188 | 50 | 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,b,h=(int(input())for _ in[0]*3);print((a+b)*h/2) | s867202484 | Accepted | 24 | 3,064 | 51 | a,b,h=(int(input())for _ in[0]*3);print((a+b)*h//2) |
s070353889 | p03486 | u598229387 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 124 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s = input()
t = input()
ss = ''.join(sorted(s))
tt = ''.join(sorted(t))
if ss < tt:
print('Yes')
else:
print('No') | s442902018 | Accepted | 17 | 2,940 | 104 | s = input()
t = input()
print('Yes' if ''.join(sorted(s)) < ''.join(sorted(t,reverse=True)) else 'No')
|
s638218836 | p03400 | u614459338 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 190 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | N = int(input())
D,X = map(int,input().split())
A = [0]*N
for i in range(N):
A[i] = int(input())
cnt = 0
for i in range(N):
print((D-1)//A[i]+1)
cnt += (D-1)//A[i]+1
print(X+cnt) | s470342317 | Accepted | 18 | 3,060 | 165 | N = int(input())
D,X = map(int,input().split())
A = [0]*N
for i in range(N):
A[i] = int(input())
cnt = 0
for i in range(N):
cnt += (D-1)//A[i]+1
print(X+cnt) |
s992580251 | p03997 | u703890795 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | 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) | s549655807 | Accepted | 17 | 2,940 | 63 | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2) |
s684885258 | p02600 | u426108351 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,136 | 22 | 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... | print(10-int(input())) | s169284374 | Accepted | 33 | 9,044 | 28 | print(10-int(input())//200)
|
s884327333 | p04011 | u980503157 | 2,000 | 262,144 | Wrong Answer | 30 | 9,164 | 156 | 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. | num1 = int(input())
num2 = int(input())
num3 = int(input())
num4 = int(input())
if num1>num2:
print(num1*num3+(num2-num1)*num4)
else:
print(num1*num3)
| s051600301 | Accepted | 28 | 9,192 | 156 | num1 = int(input())
num2 = int(input())
num3 = int(input())
num4 = int(input())
if num1>num2:
print(num2*num3+(num1-num2)*num4)
else:
print(num1*num3)
|
s454107327 | p03193 | u814986259 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,144 | 129 | There are N rectangular plate materials made of special metal called AtCoder Alloy. The dimensions of the i-th material are A_i \times B_i (A_i vertically and B_i horizontally). Takahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \times W. He is trying to obtain such a plate by cho... | N,H,W=map(int,input().split())
ans=0
for i in range(N):
x,y=map(int,input().split())
if x<=H and y <=W:
ans+=1
print(ans) | s210097464 | Accepted | 29 | 9,100 | 129 | N,H,W=map(int,input().split())
ans=0
for i in range(N):
x,y=map(int,input().split())
if x>=H and y>=W:
ans+=1
print(ans)
|
s019545849 | p03593 | u375616706 | 2,000 | 262,144 | Wrong Answer | 22 | 3,436 | 852 | 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 ... | from collections import Counter
H, W = map(int, input().split())
D = []
for _ in range(H):
D.extend(list([v for v in input()]))
C = Counter(D)
L = list([v for i, v in C.most_common()])
print(C)
if H == 1 and W == 1:
ans = "Yes"
elif H == 1 or W == 1:
if sum([1 if v % 2 == 1 else 0 for v in L]) == 1:
... | s805653776 | Accepted | 21 | 3,436 | 340 | from collections import Counter
H, W = map(int, input().split())
D = []
for _ in range(H):
D.extend(list([v for v in input()]))
C = Counter(D)
L = list([v for i, v in C.most_common()])
g1 = sum(v % 2 for v in L)
g4 = sum(v//4 for v in L)
if g4 >= (W-(W % 2))*(H-(H % 2))//4 and g1 == H & 1 & W:
print("Yes")
el... |
s132617944 | p03997 | u733337827 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 260 | 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. | Sa = input().strip()
Sb = input().strip()
Sc = input().strip()
l = [len(Sa), len(Sb), len(Sc)]
s = [Sa, Sb, Sc]
p = 0
while True:
l[p] -= 1
if l[p] <= 0:
print("ABC"[p])
break
else:
p = "abc".find(s[p][l[p] - len(s[p]) + 1]) | s208736166 | Accepted | 18 | 2,940 | 79 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h >> 1)) |
s447561546 | p03779 | u227082700 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 58 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a... | x,t=int(input()),0
while round(t*(t+1)/2)>=x:t+=1
print(t) | s612049538 | Accepted | 28 | 2,940 | 75 | x=int(input())
for t in range(1,10**10):
if t*(t+1)//2>=x:print(t);exit() |
s114268466 | p02612 | u267933821 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,096 | 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())
change=n%1000
print(change) | s186058643 | Accepted | 26 | 9,076 | 83 | n=int(input())
change=1000-n%1000
if change==1000:
print(0)
else:
print(change) |
s003404523 | p00604 | u078042885 | 1,000 | 131,072 | Wrong Answer | 20 | 7,728 | 95 | Peter loves any kinds of cheating. A week before ICPC, he broke into Doctor's PC and sneaked a look at all the problems that would be given in ICPC. He solved the problems, printed programs out, and brought into ICPC. Since electronic preparation is strictly prohibited, he had to type these programs again during the co... | n=int(input())
print(sum((n-i)*x for i,x in enumerate(sorted(list(map(int,input().split())))))) | s451716683 | Accepted | 30 | 7,736 | 133 | while 1:
try:n=int(input())
except:break
print(sum((n-i)*x for i,x in enumerate(sorted(list(map(int,input().split())))))) |
s926560919 | p02972 | u122994151 | 2,000 | 1,048,576 | Wrong Answer | 2,105 | 22,652 | 541 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | import fractions
def add(n):
return n + 1
def lcm(a):
print(a)
ans = a[0]
for i in range(1, len(a)):
ans = ans * a[i] // fractions.gcd(ans, a[i])
return ans
if __name__ == "__main__":
n = int(input())
buf = input().split()
a = [int(s) for s in buf]
indexes = [i for i, x i... | s644065954 | Accepted | 274 | 23,332 | 663 | def add(n):
return n + 1
if __name__ == "__main__":
n = int(input())
buf = input().split()
a = [int(s) for s in buf]
boxes = [0] * n
for i in reversed(range(n)):
pick_boxes = boxes[i::i+1]
pick_boxes.pop(0)
if pick_boxes:
if (sum(pick_boxes) % 2) == a[i... |
s611391245 | p03997 | u328090531 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | 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)
| s420420388 | Accepted | 17 | 2,940 | 82 | a = int(input())
b = int(input())
h = int(input())
print(round((a + b) * h / 2))
|
s375631974 | p03163 | u554698951 | 2,000 | 1,048,576 | Wrong Answer | 139 | 29,128 | 199 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find ... | N, W = map(int, input().split())
import numpy as np
dp = np.zeros(W, dtype=int)
for i in range(N):
w, v = map(int, input().split())
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print(dp.max()) | s000068330 | Accepted | 137 | 28,540 | 205 | N, W = map(int, input().split())
import numpy as np
dp = np.zeros(W + 1, dtype=int)
for i in range(N):
w, v = map(int, input().split())
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print(dp[-1]) |
s736756573 | p03380 | u373047809 | 2,000 | 262,144 | Wrong Answer | 2,104 | 17,132 | 172 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | import math
f = math.factorial
_, *a = map(int, open(0).read().split())
a.sort()
n = a.pop(-1)
r = sorted((abs(n/2 - i), i) for i in a)[0][1]
print(f(n) // (f(n-r) * f(r))) | s970540703 | Accepted | 69 | 14,028 | 98 | _, *a = map(int, open(0).read().split())
n = max(a)
print(n, min((abs(n/2 - i), i) for i in a)[1]) |
s522032693 | p02646 | u638231966 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,176 | 172 | 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")
elif(abs(A-B)>T*(W-V)):
print("NO")
else:
print("YES") | s253956562 | Accepted | 24 | 9,184 | 170 | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if(V<W):
print("NO")
elif(abs(A-B)>T*(V-W)):
print("NO")
else:
print("YES") |
s341915303 | p03495 | u746849814 | 2,000 | 262,144 | Wrong Answer | 101 | 32,564 | 146 | 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. | from collections import Counter
n, k = map(int, input().split())
c = Counter(list(map(int, input().split())))
print(sum(sorted(c.values())[k:])) | s177756661 | Accepted | 99 | 32,540 | 160 | from collections import Counter
n, k = map(int, input().split())
c = Counter(list(map(int, input().split())))
print(sum(sorted(c.values(), reverse=True)[k:])) |
s444450699 | p03574 | u468431843 | 2,000 | 262,144 | Wrong Answer | 23 | 3,188 | 1,265 | 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... | # -*- coding: utf-8 -*- #
h, w = map(int, input().split())
s_list = [list(input()) for _ in range(h)]
ans_list = [[0] * w for _ in range(h)]
print(s_list)
print(ans_list)
for i in range(h):
for j in range(w):
if s_list[i][j] == "#":
ans_list[i][j] = "#"
else:
if (i!=0) and ... | s886565853 | Accepted | 24 | 3,188 | 1,235 | # -*- coding: utf-8 -*- #
h, w = map(int, input().split())
s_list = [list(input()) for _ in range(h)]
ans_list = [[0] * w for _ in range(h)]
for i in range(h):
for j in range(w):
if s_list[i][j] == "#":
ans_list[i][j] = "#"
else:
if (i!=0) and (j!=0):
if (s_... |
s618064617 | p03370 | u045408189 | 2,000 | 262,144 | Wrong Answer | 712 | 2,940 | 118 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | a,b=map(int,input().split())
ans=0
for i in range(a+1):
for t in range(b+1):
if i==t:
ans=ans+1
print(ans) | s741105731 | Accepted | 18 | 2,940 | 103 | n,x=map(int,input().split())
m=[int(input()) for i in range(n)]
a=x-sum(m)
b=a//min(m)
print(len(m)+b)
|
s614872487 | p04029 | u728611988 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | 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())
s = 0
for i in range(n):
s = s+i
print(s) | s337115257 | Accepted | 17 | 2,940 | 64 | n = int(input())
s = 0
for i in range(n+1):
s = s+i
print(s) |
s487594100 | p02396 | u067975558 | 1,000 | 131,072 | Wrong Answer | 270 | 7,156 | 225 | 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... | c = 1
a = []
while True:
x = int(input())
a = a + [x]
if x == 0:
break;
for i in a:
print('Case {0}: {1}'.format(c,i))
c += 1 | s846712280 | Accepted | 260 | 6,968 | 239 | c = 1
a = []
while True:
x = int(input())
if x == 0:
break;
else:
a = a + [x]
for i in a:
print('Case {0}: {1}'.format(c,i))
c += 1 |
s132127666 | p02612 | u845847173 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,144 | 54 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = int(input())
x = N // 1000
x = 2 * x
print(x - N) | s984790609 | Accepted | 28 | 9,156 | 110 | N = int(input())
if N%1000 == 0:
print(0)
else:
x = N // 1000
x = (x + 1) * 1000
print(x - N) |
s023357285 | p03658 | u802963389 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 121 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | n, k = map(int, input().split())
L = list(map(int, input().split()))
L.sort(reverse=True)
ans = sum(L[:k + 1])
print(ans) | s829596076 | Accepted | 17 | 2,940 | 118 | n, k = map(int, input().split())
L = list(map(int, input().split()))
L.sort(reverse=True)
ans = sum(L[:k])
print(ans)
|
s887602143 | p03478 | u309120194 | 2,000 | 262,144 | Wrong Answer | 42 | 9,176 | 157 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | N, A, B = map(int, input().split())
ans = 0
for n in range(1, N+1):
s = sum(list(map(int, list(str(n)))))
if A <= s and s <= B: ans += 1
print(ans) | s554327472 | Accepted | 35 | 9,176 | 230 | N, A, B = map(int, input().split())
ans = 0
for n in range(1, N+1):
s = 0
m = n
while m > 0:
s += m % 10
m = m // 10
if A <= s and s <= B: ans += n
print(ans) |
s553304010 | p03998 | u663014688 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 535 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | A = list(input())
B = list(input())
C = list(input())
turn = "a"
while True:
if turn == "a":
if len(A):
turn = A[0]
A.pop(0)
else:
break
elif turn == "b":
if len(B):
turn = B[0]
B.pop(0)
else:
break
else... | s649077835 | Accepted | 17 | 3,064 | 535 | A = list(input())
B = list(input())
C = list(input())
turn = "a"
while True:
if turn == "a":
if len(A):
turn = A[0]
A.pop(0)
else:
break
elif turn == "b":
if len(B):
turn = B[0]
B.pop(0)
else:
break
else... |
s791552756 | p03623 | u765401716 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 239 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | S = list(input())
S.sort()
S = set(S)
alphabet = list("abcdefghijklmnopqrstuvwxyz")
for i in alphabet:
if i in S:
if i == "z":
print("None")
else:
pass
elif i not in S:
print(i)
break | s181292917 | Accepted | 17 | 3,064 | 103 | x,a,b = list(map(int, input().split()))
if abs(x - a) > abs(x - b):
print("B")
else:
print("A") |
s878507216 | p03503 | u859897687 | 2,000 | 262,144 | Wrong Answer | 276 | 3,064 | 428 | Joisino is planning to open a shop in a shopping street. Each of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those ... | n=int(input())
f=[list(map(int,input().split())) for i in range(n)]
p=[list(map(int,input().split())) for i in range(n)]
ans=-10**9
for i in range(1,2**10):
a=0
m=[i%2,i//2%2,i//4%2,i//8%2,i//16%2,i//32%2,i//64%2,i//128%2,i//256%2,i//512%2]
mm=[0 for i in range(n)]
for i in range(10):
for j in range(n):
... | s649456917 | Accepted | 204 | 3,064 | 437 | n=int(input())
f=[list(map(int,input().split())) for i in range(n)]
p=[list(map(int,input().split())) for i in range(n)]
ans=-10**9
for i in range(1,2**10):
a=0
m=[i%2,i//2%2,i//4%2,i//8%2,i//16%2,i//32%2,i//64%2,i//128%2,i//256%2,i//512%2]
mm=[0 for i in range(n)]
for i in range(10):
for j in range(n):
... |
s278746591 | p03545 | u788068140 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 392 | 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 = [int(s) for s in input()]
res = []
for i in range(2**4):
s = S[0]
c = []
for j in range(3):
m = i >> j & 1
if m == 0:
s = s + S[j+1]* -1
c.append("-")
else:
s = s + S[j+1]
c.append("+")
if s == 7:
print(str(S[0])+""+c[... | s726719096 | Accepted | 17 | 3,064 | 397 | S = [int(s) for s in input()]
res = []
for i in range(2**4):
s = S[0]
c = []
for j in range(3):
m = i >> j & 1
if m == 0:
s = s + S[j+1]* -1
c.append("-")
else:
s = s + S[j+1]
c.append("+")
if s == 7:
print(str(S[0])+""+c[... |
s840090241 | p03472 | u152566588 | 2,000 | 262,144 | Wrong Answer | 298 | 11,020 | 573 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | def main():
N, H = map(int, input().split())
A = []
B = []
throwTotal = 0
throwCount = 0
count = 0
for _ in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
swing = max(A)
for i in range(N):
if B[i] > swing:
throwTotal +=... | s285509917 | Accepted | 313 | 11,296 | 502 | def main():
N, H = map(int, input().split())
A = []
B = []
count = 0
for _ in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
B.sort(reverse=True)
swing = max(A)
for i in range(N):
if B[i] > swing:
H -= B[i]
coun... |
s232345940 | p02795 | u893270619 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 99 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | H = int(input())
W = int(input())
N = int(input())
if H > W:
print(N // H)
else:
print(N // W) | s146774875 | Accepted | 18 | 3,060 | 114 | import math
H = int(input())
W = int(input())
N = int(input())
Big = W if W > H else H
print(math.ceil(N / Big)) |
s177741164 | p03110 | u103902792 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 167 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | n = int(input())
amount = 0
for i in range(n):
x,c = input().split()
if c == 'JPY':
amount += int(x)
else :
amount += int(float(x)* 380000)
print(amount) | s452904389 | Accepted | 17 | 2,940 | 163 | n = int(input())
amount = 0
for i in range(n):
x,c = input().split()
if c == 'JPY':
amount += int(x)
else :
amount += float(x)* 380000
print(amount)
|
s585184841 | p02927 | u199356004 | 2,000 | 1,048,576 | Wrong Answer | 24 | 2,940 | 227 | 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=[int(i) for i in input().split()]
if D<10:
print(0)
else :
count = 0
for i in range(1,M+1):
for id in list(range(10, D+1)):
if ( int(str(id)[0]))*int((str(id))[1]) == i :
count += 1
print(count)
| s425525135 | Accepted | 26 | 3,060 | 254 | M,D=[int(i) for i in input().split()]
if D<20:
print(0)
else :
count = 0
for i in range(1,M+1):
for id in list(range(20, D+1)):
if int((str(id))[1]) >= 2 and ( int(str(id)[0]))*int((str(id))[1]) == i :
count += 1
print(count)
|
s371744410 | p02742 | u941645670 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 399 | 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... | a,b=map(int, input().split())
if a%2 == 0:
if b%2 == 0:
print(int((a*b)/2))
elif a > b:
print(int((-(-a//2)*b) /2))
else:
print(int((-(-b//2)*a) /2))
elif b%2 == 0:
if a > b:
print(int((-(-a//2)*b) /2))
else:
print(int((-(-b//2)*a) /2))
else:
if a > b:
... | s311525215 | Accepted | 18 | 3,064 | 294 | a,b=map(int, input().split())
if a ==1 or b == 1:
print(1)
exit()
if a%2 != 0:
if b%2 != 0:
if a > b:
print(int((-(-a//2))+(a*(b-1)/2)))
else:
print(int((-(-a//2))+(a*(b-1)/2)))
else:
print(int(a*b/2))
else:
print(int(a*b/2)) |
s582782516 | p03598 | u858136677 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 168 | 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())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
if K - x[i] <= x[i]:
L = L + x[i]
else:
L = K -x[i]
print (L)
| s608691852 | Accepted | 17 | 3,060 | 169 | N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
if K - x[i] >= x[i]:
L += x[i]
else:
L += K -x[i]
print (2 * L) |
s924534886 | p02344 | u408284582 | 3,000 | 262,144 | Wrong Answer | 20 | 5,616 | 1,128 | There is a sequence $A = a_0, a_1, ..., a_{n-1}$. You are given the following information and questions. * relate$(x, y, z)$: $a_y$ is greater than $a_x$ by $z$ * diff$(x, y)$: report the difference between $a_x$ and $a_y$ $(a_y - a_x)$ |
def union(x, y, t):
x, t_x = findSet(x)
y, t_y = findSet(y)
link(x, t_x, y, t_y, t)
def link(x, d_x, y, d_y, t):
print('', 'x', 'y')
print('', x, y)
print('', d_x, d_y, t)
if r[x] > r[y]:
p[y] = x
d[y] = d_x + d_y - t
print('', y, '->', p[y], '=', d[y], '\n')
... | s432092086 | Accepted | 1,860 | 11,400 | 1,133 |
def union(x, y, t):
x, t_x = findSet(x)
y, t_y = findSet(y)
link(x, t_x, y, t_y, t)
def link(x, d_x, y, d_y, t):
#print('', 'x', 'y')
#print('', x, y)
#print('', d_x, d_y, t)
if r[x] > r[y]:
p[y] = x
d[y] = d_x - d_y - t
#print('', y, '->', p[y], '=', d[y], '\n')
... |
s349419967 | p03919 | u785220618 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 187 | 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 = [input().split() for _ in range(h)]
for i in range(h):
for j in range(w):
if S[i][j] == 'snuke':
print(chr(i+65) + str(j+1))
| s220608812 | Accepted | 17 | 3,060 | 187 | h, w = map(int, input().split())
S = [input().split() for _ in range(h)]
for i in range(h):
for j in range(w):
if S[i][j] == 'snuke':
print(chr(j+65) + str(i+1))
|
s989211766 | p03416 | u710952331 | 2,000 | 262,144 | Wrong Answer | 84 | 2,940 | 138 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | A, B = map(int, input().split())
cc = 0
for i in range(A, B+1):
x = list(str(i))
if x[0]==x[4] and x[1]==x[2]:
cc += 1
print(cc) | s704539741 | Accepted | 74 | 3,060 | 141 | A, B = map(int, input().split())
cc = 0
for i in range(A,B+1):
x = list(str(i))
if x[0]==x[4] and x[1]==x[3]:
cc += 1
print(cc) |
s952539379 | p02743 | u143051858 | 2,000 | 1,048,576 | Wrong Answer | 20 | 2,940 | 133 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | import math
a,b,c=(int(x) for x in input().split())
if math.sqrt(a) + math.sqrt(b) < math.sqrt(c):
print('YES')
else:
print('NO') | s718475133 | Accepted | 33 | 9,936 | 156 | from decimal import *
a,b,c = map(Decimal,input().split())
if a**Decimal(0.5) + b**Decimal(0.5) < c**Decimal(0.5):
print('Yes')
else:
print('No')
|
s377124998 | p02831 | u750120744 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 80 | 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 ... | a, b = map(int, input().split())
while b:
a, b = b, a%b
print(a*b//a) | s688837858 | Accepted | 17 | 2,940 | 87 | a, b = map(int, input().split())
x = a * b
while b:
a, b = b, a%b
print(x//a) |
s569939495 | p03836 | u634079249 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 933 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | import sys
import os
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readl... | s895017632 | Accepted | 42 | 10,732 | 1,693 | 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
# import fractions
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il ... |
s818494920 | p03659 | u578953945 | 2,000 | 262,144 | Wrong Answer | 2,240 | 1,841,440 | 102 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | import itertools
n=int(input())
l=map(int,input().split())
print(list(itertools.combinations(l,n-1))) | s541721039 | Accepted | 197 | 23,800 | 230 | import sys
N=int(input())
A=list(map(int,input().split()))
L=[0]*(N+1)
ans=sys.maxsize
for i in range(N):
L[i+1]=L[i]+A[i]
for i in range(1,N):
x = L[i]
y = L[-1] - L[i]
if ans >= abs(x-y):
ans = abs(x-y)
print(ans) |
s636251510 | p03943 | u131666536 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 145 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | # -*- coding: utf-8 -*-
abc = [int(s) for s in input().split()]
abc.sort()
if abc[0]+abc[1] == abc[2]:
print('yYs')
else:
print('No')
| s327126787 | Accepted | 17 | 2,940 | 119 | abc = [int(s) for s in input().split()]
abc.sort()
if abc[0]+abc[1] == abc[2]:
print('Yes')
else:
print('No')
|
s522050710 | p03545 | u686390526 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 517 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | a=input()
A=int(a[0])
B=int(a[1])
C=int(a[2])
D=int(a[3])
f=False
if A+B+C+D==7:
print("{}+{}+{}+{}".format(A,B,C,D))
elif A+B+C-D==7:
print("{}+{}+{}-{}".format(A,B,C,D))
elif A+B-C+D==7:
print("{}+{}-{}+{}".format(A,B,C,D))
elif A+B-C-D==7:
print("{}+{}-{}-{}".format(A,B,C,D))
elif A-B+C+D==7:
print("{}-{}... | s846975622 | Accepted | 18 | 3,064 | 533 | a=input()
A=int(a[0])
B=int(a[1])
C=int(a[2])
D=int(a[3])
f=False
if A+B+C+D==7:
print("{}+{}+{}+{}=7".format(A,B,C,D))
elif A+B+C-D==7:
print("{}+{}+{}-{}=7".format(A,B,C,D))
elif A+B-C+D==7:
print("{}+{}-{}+{}=7".format(A,B,C,D))
elif A+B-C-D==7:
print("{}+{}-{}-{}=7".format(A,B,C,D))
elif A-B+C+D==7:
prin... |
s425915041 | p03555 | u516242950 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | one = list(input())
two = list(input())
if one == two.reverse():
print('YES')
else:
print('NO') | s805419257 | Accepted | 17 | 2,940 | 140 | one = list(input())
two = list(input())
two.reverse()
iti = "".join(one)
ni = "".join(two)
if iti == ni:
print('YES')
else:
print('NO')
|
s892767014 | p03377 | u432453907 | 2,000 | 262,144 | Wrong Answer | 28 | 9,116 | 78 | 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())
ans="No"
if A<=X<=A+B:
ans="Yes"
print(ans) | s399891229 | Accepted | 27 | 8,988 | 78 | A,B,X=map(int,input().split())
ans="NO"
if A<=X<=A+B:
ans="YES"
print(ans) |
s753612010 | p03352 | u633548583 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 54 | 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. | import math as m
x=int(input())
print(m.floor(x**0.5)) | s791200913 | Accepted | 22 | 2,940 | 135 | x=int(input())
a=[]
for i in range(1,100):
for j in range(2,100):
if i**j<=x:
a.append(i**j)
print(max(set(a))) |
s404154624 | p03473 | u085530099 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 28 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | m = int(input())
print(24+m) | s012089642 | Accepted | 17 | 2,940 | 31 | m = int(input())
print(24-m+24) |
s891728822 | p02694 | u560464565 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,156 | 103 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | x = int(input())
a = 100
cnt = 0
while x >= a:
a = a * 1.01
a = int(a)
cnt += 1
print(cnt)
| s711845882 | Accepted | 24 | 9,156 | 102 | x = int(input())
a = 100
cnt = 0
while x > a:
a = a * 1.01
a = int(a)
cnt += 1
print(cnt)
|
s076494409 | p02534 | u867200256 | 2,000 | 1,048,576 | Wrong Answer | 38 | 10,016 | 520 | 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`. | # coding: utf-8
# Your code here!
import collections
import sys
import copy
import re
import math
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rs... | s760518913 | Accepted | 36 | 10,000 | 520 | # coding: utf-8
# Your code here!
import collections
import sys
import copy
import re
import math
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rs... |
s359801613 | p03471 | u084949493 | 2,000 | 262,144 | Wrong Answer | 1,717 | 3,064 | 356 | 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())
res10000 = -1
res5000 = -1
res1000 = -1
for ai in range(N+1):
for bi in range(N+1):
ci = N - ai - bi
total = 10000*ai + 5000*bi + 1000*ci
if total == Y:
res10000 = ai
res5000 = bi
res1000 = ci
break
print(res... | s623758394 | Accepted | 920 | 3,064 | 379 | N, Y = map(int, input().split())
res10000 = -1
res5000 = -1
res1000 = -1
for ai in range(N+1):
for bi in range(0, N-ai+1):
ci = N - ai - bi
total = 10000*ai + 5000*bi + 1000*ci
if total == Y:
res10000 = ai
res5000 = bi
res1000 = ci
break
pri... |
s147943719 | p03997 | u052332717 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | 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())
length = int(input())
area = ((a + b) * length) / 2
print(area) | s788519254 | Accepted | 18 | 2,940 | 69 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
s772763834 | p03829 | u672475305 | 2,000 | 262,144 | Wrong Answer | 84 | 14,224 | 164 | There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the... | n,a,b = map(int,input().split())
X = list(map(int,input().split()))
pos = X[0]
ans = 0
for i in range(1, n):
ans += min(b, X[i] - pos)
pos = X[i]
print(ans) | s823413426 | Accepted | 95 | 14,224 | 168 | n,a,b = map(int,input().split())
X = list(map(int,input().split()))
pos = X[0]
ans = 0
for i in range(1, n):
ans += min(b, (X[i] - pos)*a)
pos = X[i]
print(ans) |
s530203126 | p02420 | u436634575 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 160 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | while True:
s = input()
if s == '-': break
n = int(input())
for i in range(n):
h = int(input())
s = s[-h:] + s[:-h]
print(s) | s893056423 | Accepted | 30 | 6,724 | 158 | while True:
s = input()
if s == '-': break
n = int(input())
for i in range(n):
h = int(input())
s = s[h:] + s[:h]
print(s) |
s321127878 | p04030 | u559126797 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 206 | 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()
answer=""
for i in range(len(s)):
if s[i]== '0':
answer+="0"
elif s[i]=='1':
answer+="1"
elif len(answer)>0:
print("a")
answer=answer[:-1]
print(answer) | s297169550 | Accepted | 17 | 2,940 | 187 | s=input()
answer=""
for i in range(len(s)):
if s[i]== '0':
answer+="0"
elif s[i]=='1':
answer+="1"
elif len(answer)>0:
answer=answer[:-1]
print(answer) |
s510565297 | p02669 | u984276646 | 2,000 | 1,048,576 | Wrong Answer | 414 | 9,200 | 524 | You start with the number 0 and you want to reach the number N. You can change the number, paying a certain amount of coins, with the following operations: * Multiply the number by 2, paying A coins. * Multiply the number by 3, paying B coins. * Multiply the number by 5, paying C coins. * Increase or decrease... | T = int(input())
b, c, e = [1], [1], [1]
pos = 0
while max(b) <= 10**18:
b.append(2 * b[pos])
pos += 1
pos = 0
while max(c) <= 10**18:
c.append(3 * c[pos])
pos += 1
pos = 0
while max(e) <= 10**18:
e.append(5 * e[pos])
pos += 1
bn, cn, en = len(b), len(c), len(e)
for _ in range(T):
N, A, B, C, D = map(int,... | s491234633 | Accepted | 379 | 10,888 | 731 | peak = int(1e18)
A, B, C, D = 0, 0, 0, 0
memo = {}
def PtW(n):
if n == 0:
return 0
if n == 1:
return D
if n in memo:
return memo[n]
m = peak
if n * D < peak:
m = n * D
u2, d2 = n // 2 + (n % 2 != 0), n // 2
u3, d3 = n // 3 + (n % 3 != 0), n // 3
u5, d5 = n... |
s497967339 | p03779 | u169138653 | 2,000 | 262,144 | Wrong Answer | 2,104 | 2,940 | 114 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a... | x=int(input())
r=0
while 1:
if x-r==r+1:
print(r)
exit()
if x-r==r+2:
print(r+2)
exit()
r+=1 | s103454710 | Accepted | 17 | 2,940 | 95 | x=int(input())
r=(-1+(1+8*x)**0.5)/2
if r.is_integer():
print(int(r))
else:
print(int(r)+1) |
s065351155 | p04044 | u357751375 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 109 | 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 = map(int,input().split())
s = []
for i in range(n):
s.append(input())
sorted(s)
print(''.join(s)) | s345012979 | Accepted | 25 | 9,064 | 93 | n,l = map(int,input().split())
s = list(input() for i in range(n))
s.sort()
print(''.join(s)) |
s569486037 | p03997 | u914330401 | 2,000 | 262,144 | Wrong Answer | 17 | 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) | s590272305 | Accepted | 17 | 2,940 | 69 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2)
|
s892456605 | p00032 | u651428295 | 1,000 | 131,072 | Wrong Answer | 20 | 7,640 | 200 | 機械に辺・対角線の長さのデータを入力し、プラスティック板の型抜きをしている工場があります。この工場では、サイズは様々ですが、平行四辺形の型のみを切り出しています。あなたは、切り出される平行四辺形のうち、長方形とひし形の製造個数を数えるように上司から命じられました。 「機械に入力するデータ」を読み込んで、長方形とひし形の製造個数を出力するプログラムを作成してください。 | import sys
t = 0
h = 0
for line in sys.stdin :
line = list(map(int, line.split(',')))
if line[2]**2 == line[0] ** 2 + line[1] ** 2 :
t += 1
else :
h += 1
print(t)
print(h) | s308969627 | Accepted | 20 | 7,648 | 219 | import sys
t = 0
h = 0
for line in sys.stdin :
line = list(map(int, line.split(',')))
if line[2]**2 == line[0] ** 2 + line[1] ** 2 :
t += 1
elif line[0] == line[1] :
h += 1
print(t)
print(h) |
s268176087 | p03699 | u225388820 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 183 | You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When... | n=int(input())
scr=[int(input()) for i in range(n)]
s=sum(scr)
if s%10==0:
print(s)
exit()
scr.sort()
for i in range(n):
if scr[i]%10!=0:
print(s-scr[i])
exit()
print(0) | s770374331 | Accepted | 18 | 3,060 | 183 | n=int(input())
scr=[int(input()) for i in range(n)]
s=sum(scr)
if s%10!=0:
print(s)
exit()
scr.sort()
for i in range(n):
if scr[i]%10!=0:
print(s-scr[i])
exit()
print(0) |
s576947671 | p03574 | u578850957 | 2,000 | 262,144 | Wrong Answer | 169 | 12,460 | 913 | 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 countsherp(S_pad,i,j):
count = 0
for k in range(-1,2):
for l in range(-1,2):
if S_pad[i+k][j+l]=='#':
count += 1
return count
h, w = map(int,input().split())
S = np.array([list(input()) for i in range(h)])
w_pad = np.array([['p' for i in rang... | s355767771 | Accepted | 171 | 13,088 | 969 | import numpy as np
def countsherp(S_pad,i,j):
count = 0
for k in range(-1,2):
for l in range(-1,2):
if S_pad[i+k][j+l]=='#':
count += 1
return count
h, w = map(int,input().split())
S = np.array([list(input()) for i in range(h)])
w_pad = np.array([['p' for i in rang... |
s088079747 | p03470 | u227082700 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 181 | 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... | def sortex(X):
X.sort()
a=[]
for i in range(len(X)-1):
if X[i]!=X[i+1]:a.append(X[i])
return a
n=int(input());a=[int(input())for i in range(n)];a=sortex(a);print(len(a)) | s373360516 | Accepted | 19 | 3,060 | 201 | def sortex(X):
b=sorted(X)
b.append("null")
a=[]
for i in range(len(X)):
if b[i]!=b[i+1]:a.append(b[i])
return a
n=int(input());a=[int(input())for i in range(n)];a=sortex(a);print(len(a)) |
s164099806 | p03719 | u545503667 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | 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 = [int(x) for x in input().split()]
if c < a or c > b:
print("NO")
else:
print("YES") | s332142897 | Accepted | 17 | 2,940 | 104 | a, b, c = [int(x) for x in input().split()]
if c < a or c > b:
print("No")
else:
print("Yes")
|
s544455216 | p02865 | u973167272 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,012 | 67 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input())
if n%2 == 0:
print(n/2-1)
else:
print((n-1)/2) | s980760103 | Accepted | 28 | 9,056 | 77 | n = int(input())
if n%2 == 0:
print(int(n/2-1))
else:
print(int((n-1)/2)) |
s865383757 | p02833 | u990300472 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 207 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | N = "1000000000000000000"
if int(N[-1]) %2 == 0:
ans = int(N[:-1])
N = int(N[:-1])
k = 1
while k != 0:
k = N // 5
N = k
ans += k
print(ans)
else:
print(0)
| s936419378 | Accepted | 17 | 3,060 | 229 | N = input()
if len(N) <= 1:
print(0)
exit()
if int(N[-1]) %2 == 0:
ans = int(N[:-1])
N = int(N[:-1])
k = 1
while k != 0:
k = N // 5
N = k
ans += k
print(ans)
else:
print(0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.