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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s982600941 | p04012 | u991604406 | 2,000 | 262,144 | Wrong Answer | 27 | 9,120 | 212 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | w = input()
beau = {}
for i in range(len(w)):
if not w[i] in beau:
beau[w[i]] = 1
else:
beau[w[i]] += 1
num = sum(list(beau.values()))%2
if num == 0:
print('YES')
else:
print('NO') | s943962709 | Accepted | 26 | 9,052 | 235 | w = input()
beau = {}
for i in range(len(w)):
if not w[i] in beau:
beau[w[i]] = 1
else:
beau[w[i]] += 1
num = sum(list(map(lambda x: x%2,list(beau.values()))))
if num == 0:
print('Yes')
else:
print('No') |
s969488392 | p03448 | u914330401 | 2,000 | 262,144 | Wrong Answer | 41 | 3,064 | 386 | 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... | a500 = int(input())
b100 = int(input())
c50 = int(input())
X = int(input())
ans = 0
goukei = 0
is_over = False
for i in range(a500):
for j in range(b100):
for k in range(c50):
goukei = i * 500 + j * 100 + k * 50
if goukei > X:
is_over = True
break
elif goukei == X:
ans +... | s616528451 | Accepted | 52 | 3,064 | 293 | a500 = int(input())
b100 = int(input())
c50 = int(input())
X = int(input())
ans = 0
goukei = 0
is_over = False
for i in range(a500+1):
for j in range(b100+1):
for k in range(c50+1):
goukei = i * 500 + j * 100 + k * 50
if goukei == X:
ans += 1
break
print(ans) |
s656736960 | p03997 | u131405882 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | 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) | s222577724 | Accepted | 17 | 2,940 | 85 | a = int(input())
b = int(input())
h = int(input())
S = (a+b) * h / 2
print(int(S))
|
s048449683 | p03680 | u096931564 | 2,000 | 262,144 | Wrong Answer | 177 | 7,084 | 310 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ... | N = int(input())
a = [int(input()) for i in range(N)]
count = 0
index = 1
end = 2
if end in a:
print(-1)
else :
while(True):
count += 1
index = a[index]
if (index == end):
print(count)
break
elif count > N:
print(-1)
break | s358204686 | Accepted | 199 | 7,084 | 316 | N = int(input())
a = [int(input()) for i in range(N)]
count = 0
index = 1
end = 2
if not end in a:
print(-1)
else :
while(True):
count += 1
index = a[index-1]
if (index == end):
print(count)
break
elif count > N:
print(-1)
break |
s811708916 | p02255 | u424457654 | 1,000 | 131,072 | Wrong Answer | 30 | 7,644 | 198 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | N = int(input())
a = list(map(int, input().split()))
print(*a)
for i in range(1, N):
v = a[i]
j = i - 1
while j >= 0 and a[j] > v:
a[j + 1] = a[j]
j -= 1
a[j + 1] = v
print(*a) | s765702987 | Accepted | 20 | 8,124 | 194 | N = int(input())
a = list(map(int, input().split()))
print(*a)
for i in range(1, N):
v = a[i]
j = i - 1
while j >= 0 and a[j] > v:
a[j + 1] = a[j]
j -= 1
a[j + 1] = v
print(*a) |
s244380649 | p02697 | u271469978 | 2,000 | 1,048,576 | Wrong Answer | 77 | 9,048 | 81 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi... | N, M = map(int, input().split())
for i in range(M):
print(i+1, N)
N -= 1
| s935949418 | Accepted | 83 | 9,120 | 269 | N, M = map(int, input().split())
odd_l = 1
odd_r = M
even_l = M + 1
even_r = 2 * M + 1
i = 0
while i < M:
print(even_l, even_r)
i += 1
if i == M:
break
print(odd_l, odd_r)
i += 1
odd_l += 1
odd_r -= 1
even_l += 1
even_r -= 1
|
s149026859 | p03160 | u375695365 | 2,000 | 1,048,576 | Wrong Answer | 123 | 13,980 | 191 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | n=int(input())
a=list(map(int,input().split()))
dp=[-1]*n
dp[0]=0
dp[1]=abs(a[0]-a[1])
for i in range(2,n):
dp[i]=min(abs(a[i]-a[i-2]),abs(a[i]-a[i-1])+abs(a[i-2]-a[i-1]))
print(dp[-1]) | s022284318 | Accepted | 135 | 13,980 | 219 |
n=int(input())
h=list(map(int,input().split()))
dp=[-1]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
dp[i]=min( abs(h[i]-h[i-1])+dp[i-1] ,abs(h[i]-h[i-2])+dp[i-2] )
#print(dp)
print(dp[-1])
|
s473299256 | p02646 | u172877642 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,184 | 203 | 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 = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if v <= w:
print('No')
else:
if abs(a - b) <= t * (v - w):
print('Yes')
else:
print('No') | s248021390 | Accepted | 19 | 9,180 | 203 | a, v = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if v <= w:
print('NO')
else:
if abs(a - b) <= t * (v - w):
print('YES')
else:
print('NO') |
s656086572 | p02853 | u659587571 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 346 | 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.... | input_line = input().split()
num_1 = int(input_line[0])
num_2 = int(input_line[1])
worse = 0
if num_1 == 1:
worse += 300000
elif num_1 == 2:
worse += 200000
elif num_1 == 3:
worse += 100000
if num_2 == 1:
worse += 300000
elif num_2 == 2:
worse += 200000
elif num_2 == 3:
worse += 100000
if num_1 == 1 and num... | s470484052 | Accepted | 18 | 3,064 | 359 | input_line = input().split()
num_1 = int(input_line[0])
num_2 = int(input_line[1])
worse = 0
if num_1 == 1:
worse += 300000
elif num_1 == 2:
worse += 200000
elif num_1 == 3:
worse += 100000
if num_2 == 1:
worse += 300000
elif num_2 == 2:
worse += 200000
elif num_2 == 3:
worse += 100000
if num_1 == 1 and num... |
s866291953 | p03370 | u940743763 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 189 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | n, x = list(map(int, input().split(' ')))
ms = []
for i in range(n):
ms.append(int(input()))
remain = x - sum(ms)
print(remain)
mind_m = min(ms)
ans = n + remain // mind_m
print(ans)
| s727453347 | Accepted | 17 | 2,940 | 175 | n, x = list(map(int, input().split(' ')))
ms = []
for i in range(n):
ms.append(int(input()))
remain = x - sum(ms)
mind_m = min(ms)
ans = n + remain // mind_m
print(ans)
|
s075161841 | p03455 | u643714578 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | 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") | s108611207 | Accepted | 18 | 2,940 | 83 | a, b=map(int,input().split())
if a*b%2==0:
print("Even")
else:
print("Odd") |
s414704209 | p04012 | u539018546 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | w=input()
for i in range(len(w)):
if w.count(w[i])%2!=0:
print("NO")
print("YES") | s136623381 | Accepted | 17 | 2,940 | 108 | w=input()
for i in range(len(w)):
if w.count(w[i])%2!=0:
print("No")
exit()
print("Yes") |
s354421764 | p03964 | u305965165 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 408 | AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes. AtCoDeer has checked the report N times, and when he c... | n = int(input())
ta = [[int(i) for i in input().split()] for i in range(n)]
ct = ta[0][0]
ca = ta[0][1]
for i in range(1, n):
t, a = ta[i]
if ct / t > ca / a:
if ct%t == 0:
rate = ct//t
else:
rate = ct//t+1
else:
if ca%a == 0:
rate = ca//a
... | s758992333 | Accepted | 21 | 3,188 | 404 | n = int(input())
ta = [[int(i) for i in input().split()] for i in range(n)]
ct = ta[0][0]
ca = ta[0][1]
for i in range(1, n):
t, a = ta[i]
if ct / t > ca / a:
if ct%t == 0:
rate = ct//t
else:
rate = ct//t+1
else:
if ca%a == 0:
rate = ca//a
... |
s590978865 | p03997 | u187205913 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 68 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a+b)//2*h) | s279021137 | Accepted | 19 | 3,316 | 69 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2)
|
s980461485 | p03545 | u450904670 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 527 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | a,b,c,d = list(map(int, list(str(input()))))
def calc(n, op, m):
if(type(n) is not int):
return False
if(op == "+"):
return n + m
elif(op == "-"):
return n - m
elif(op == "*"):
return n * m
elif(m != 0):
return n / m
else:
return False
ops1 = ["/", "+", "-", "*"]
ops2 = ["/", "+", ... | s310061844 | Accepted | 18 | 3,064 | 545 | a,b,c,d = list(map(int, list(str(input()))))
def calc(n, op, m):
if(type(n) is not int):
return False
if(op == "+"):
return n + m
elif(op == "-"):
return n - m
elif(op == "*"):
return n * m
elif(m != 0):
return n / m
else:
return False
ops1 = ["/", "+", "-", "*"]
ops2 = ["/", "+", ... |
s528980662 | p03605 | u254871849 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 40 | 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? | print('Yse' if '9' in input() else 'No') | s753935567 | Accepted | 17 | 2,940 | 157 | import sys
n = sys.stdin.readline().rstrip()
def main():
ans = 'Yes' if '9' in set(n) else 'No'
print(ans)
if __name__ == '__main__':
main() |
s112785607 | p03623 | u030726788 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 107 | 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... | x,a,b=map(int,input().split())
disa=abs(a-x)
disb=abs(b-x)
if(disa<disb):
print(disa)
else:
print(disb) | s254232592 | Accepted | 17 | 2,940 | 106 | x,a,b=map(int,input().split())
disa=abs(a-x)
disb=abs(b-x)
if(disa<disb):
print("A")
else:
print("B")
|
s584656344 | p03456 | u690934440 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 700 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | import math
def binary_search():
s = input().split()
i = int(s[0] + s[1])
low = 0
high = i
while low <= high:
mid = (low + high) // 2
guess = mid**2
if guess == i:
print('YES')
return
elif guess > i:
high = mid - 1
e... | s126401732 | Accepted | 17 | 3,064 | 700 | import math
def binary_search():
s = input().split()
i = int(s[0] + s[1])
low = 0
high = i
while low <= high:
mid = (low + high) // 2
guess = mid**2
if guess == i:
print('Yes')
return
elif guess > i:
high = mid - 1
e... |
s693531115 | p03486 | u859897687 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,060 | 216 | 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. | a=input()
m=[a[i] for i in range(len(a))]
b=input()
n=[b[i] for i in range(len(b))]
m.sort()
n.sort()
i=0
while 1>0:
if m[i]<n[i]:
print("Yes")
break
if i==len(a) or i==len(b):
print("No")
break
| s940099576 | Accepted | 17 | 3,064 | 302 | a=input()
m=[a[i] for i in range(len(a))]
b=input()
n=[b[i] for i in range(len(b))]
m.sort()
n.sort(reverse=1)
i=0
while 1>0:
if i==len(b):
print("No")
break
if i==len(a):
print("Yes")
break
if m[i]<n[i]:
print("Yes")
break
if m[i]>n[i]:
print("No")
break
i+=1 |
s137504903 | p03408 | u125269142 | 2,000 | 262,144 | Wrong Answer | 28 | 9,076 | 279 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | n = int(input())
blue_words = [input() for i in range(n)]
m = int(input())
red_words = [input() for i in range(m)]
ans = 0
for w in set(blue_words):
tmp = blue_words.count(w) - red_words.count(w)
if tmp > ans:
ans = tmp
if ans < 0:
print(ans)
else:
print('0') | s183642785 | Accepted | 28 | 9,180 | 240 | n = int(input())
blue_words = [input() for i in range(n)]
m = int(input())
red_words = [input() for i in range(m)]
ans = 0
for w in set(blue_words):
tmp = blue_words.count(w) - red_words.count(w)
if tmp > ans:
ans = tmp
print(ans) |
s994449595 | p03129 | u941284252 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 91 | 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(x) for x in input().split())
if(N-2 >= 10):
print("YES")
else:
print("NO") | s222321070 | Accepted | 17 | 2,940 | 100 | N,K = (int(x) for x in input().split())
if((N+1)/2 >= K):
print("YES")
else:
print("NO")
|
s211051348 | p03693 | u243572357 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | 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... | a = int(input().replace(' ', ''))
print('NO' if a%4 else 'Yes') | s101318397 | Accepted | 17 | 2,940 | 80 | a = list(input().split())
b = int(''.join(a))
print('YES' if b%4 == 0 else 'NO') |
s680909295 | p03999 | u589969467 | 2,000 | 262,144 | Wrong Answer | 29 | 9,172 | 246 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | s = str(input())
n = len(s)
#print(s,n)
ans = 0
for bit in range(1 << (n-1)):
f = s[0]
for j in range(n-1):
if bit & (1 << j):
f += '+'
f += s[j+1]
ans += sum(map(int,f.split('+')))
print(f)
print(ans)
| s552996876 | Accepted | 29 | 9,180 | 247 | s = str(input())
n = len(s)
#print(s,n)
ans = 0
for bit in range(1 << (n-1)):
f = s[0]
for j in range(n-1):
if bit & (1 << j):
f += '+'
f += s[j+1]
ans += sum(map(int,f.split('+')))
# print(f)
print(ans)
|
s371507206 | p03494 | u276115223 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 291 | 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. | # ABC 081: B – Shift only
n = int(input())
a = [int(s) for s in input().split()]
m = 0
canDivided = True
while canDivided:
for i in range(len(a)):
if a[i] % 2 == 0:
a[i] //= 2
else:
canDivided = False
break
else:
m += 1 | s456206358 | Accepted | 18 | 3,060 | 301 | # ABC 081: B – Shift only
n = int(input())
a = [int(s) for s in input().split()]
m = 0
canDivided = True
while canDivided:
for i in range(len(a)):
if a[i] % 2 == 0:
a[i] //= 2
else:
canDivided = False
break
else:
m += 1
print(m) |
s502929463 | p03251 | u468972478 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,188 | 224 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | n, m, x, y = map(int, input().split())
a, b = [list(map(int, input().split())) for i in range(2)]
for i in range(x + 1, y + 1):
if all(j < i for j in a) and all(k >= i for k in b):
print("No War")
else:
print("War") | s431513520 | Accepted | 30 | 9,212 | 234 | n, m, x, y = map(int, input().split())
a, b = [list(map(int, input().split())) for i in range(2)]
for i in range(x + 1, y + 1):
if all(j < i for j in a) and all(k >= i for k in b):
print("No War")
break
else:
print("War") |
s572659330 | p03657 | u072717685 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 126 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | A, B = map(int, input().split())
if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0:
r = "possible"
else:
r = "impossible"
print(r) | s349378456 | Accepted | 17 | 2,940 | 127 | A, B = map(int, input().split())
if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0:
r = "Possible"
else:
r = "Impossible"
print(r) |
s050665667 | p03163 | u993435350 | 2,000 | 1,048,576 | Wrong Answer | 1,632 | 7,740 | 1,057 | 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())
L = sorted( [ [int(i) for i in input().split()] for _ in range(N) ] )
dp = [0] * (W + 1)
cnt = 0
print(L)
for w, v in L:
cnt = cnt + w
##3,8-5,...15-7
for i in range(min(cnt, W), w - 1, -1):
if d... | s428402804 | Accepted | 1,563 | 9,656 | 266 | N, W = map(int, input().split())
L = sorted([list(map(int,input().split())) for i in range(N)])
dp = [0] * (W + 1)
con = 0
for w, v in L:
con += w
for i in range(min(con, W), w - 1, -1):
if dp[i] < dp[i - w] + v:
dp[i] = dp[i - w] + v
print(max(dp)) |
s302103608 | p03697 | u919633157 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 121 | 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. | s=list(input())
a={}
ans='yes'
for i in s:
a[i]=a.get(i,0)+1
if a[i]>1:
ans='no'
break
print(ans) | s668532610 | Accepted | 17 | 2,940 | 67 | a=int(eval(input().replace(' ','+')))
print(a if a<10 else 'error') |
s022719960 | p03680 | u497046426 | 2,000 | 262,144 | Wrong Answer | 191 | 7,084 | 164 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ... | N = int(input())
A = [int(input())-1 for _ in range(N)]
i = 0
for n in range(1, N+1):
i = A[i]
if i == 2:
print(n)
break
else:
print(-1) | s469201155 | Accepted | 192 | 7,084 | 164 | N = int(input())
A = [int(input())-1 for _ in range(N)]
i = 0
for n in range(1, N+1):
i = A[i]
if i == 1:
print(n)
break
else:
print(-1) |
s388994561 | p00008 | u777299405 | 1,000 | 131,072 | Wrong Answer | 20 | 7,428 | 200 | Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). | from itertools import product
while True:
try:
n = int(input)
except:
break
count = sum(a + b + c + d == n for a, b, c, d in product(range(10), repeat=4))
print(count) | s261115067 | Accepted | 170 | 7,652 | 202 | from itertools import product
while True:
try:
n = int(input())
except:
break
count = sum(a + b + c + d == n for a, b, c, d in product(range(10), repeat=4))
print(count) |
s786385792 | p03251 | u296150111 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 200 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | n,m,x,y=map(int,input().split())
a=map(int,input().split())
b=map(int,input().split())
A=max(a)
B=min(b)
D=0
for w in range(A+1,B+1):
if x<w<=y:
D+=1
if D>=1:
print ("No war")
else:
print("War") | s244660337 | Accepted | 18 | 3,064 | 200 | n,m,x,y=map(int,input().split())
a=map(int,input().split())
b=map(int,input().split())
A=max(a)
B=min(b)
D=0
for w in range(A+1,B+1):
if x<w<=y:
D+=1
if D>=1:
print ("No War")
else:
print("War") |
s381966548 | p03493 | u792671636 | 2,000 | 262,144 | Wrong Answer | 2,104 | 2,940 | 174 | 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. | import sys
l = list(map(int, input().split()))
loop = 0
while (1):
for i in l:
if (i % (2 * (loop + 1)) != 0):
print(loop)
sys.exit(0)
loop = loop + 1
| s519651554 | Accepted | 18 | 2,940 | 92 | l = input()
b = 0
for i in l[0], l[1], l[2]:
if (int(i) == 1):
b = b+1
print(b)
|
s277399068 | p02259 | u938045879 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 369 | 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... | def bubbleSort(a,n):
flag = 1
c=0
while(flag):
flag = 0
for i in reversed(range(1,len(a))):
if(a[i] < a[i-1]):
a[i],a[i-1] = a[i-1],a[i]
c += 1
flag = 1
return [a,c]
n = int(input())
a = list(map(int,input().split(' ')))
sa , c... | s969627024 | Accepted | 30 | 5,608 | 407 | def bubbleSort(a,n):
flag = 1
c=0
while(flag):
flag = 0
for i in reversed(range(1,len(a))):
if(a[i] < a[i-1]):
a[i],a[i-1] = a[i-1],a[i]
c += 1
flag = 1
return [a,c]
n = int(input())
a = list(map(int,input().split(' ')))
sa , c... |
s429202412 | p03658 | u244836567 | 2,000 | 262,144 | Wrong Answer | 25 | 9,164 | 122 | 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. | a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=0
for i in range(b):
d=d+c[i]
print(d) | s814306966 | Accepted | 26 | 9,140 | 125 | a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=0
for i in range(b):
d=d+c[-i-1]
print(d) |
s813605579 | p03386 | u152614052 | 2,000 | 262,144 | Wrong Answer | 34 | 9,184 | 153 | 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())
ans1 = [i for i in range(a,min(a+k,b+1))]
ans2 = [i for i in range(max(b-k,a),b+1)]
ans = set(ans1 + ans2)
print(*ans) | s279557377 | Accepted | 26 | 9,064 | 172 | a,b,k = map(int,input().split())
ans1 = [i for i in range(a,min(a+k,b+1))]
ans2 = [i for i in range(max(b-k+1,a),b+1)]
ans = set(ans1 + ans2)
print(*sorted(ans),sep="\n") |
s786949822 | p03433 | u757030836 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 92 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N = int(input())
A = int(input())
x = N % 500
if x >= A:
print("Yes")
else:
print("No") | s408505971 | Accepted | 17 | 2,940 | 99 | N = int(input())
A = int(input())
num = N % 500
if num <= A:
print("Yes")
else:
print("No")
|
s647197834 | p02975 | u076306174 | 2,000 | 1,048,576 | Wrong Answer | 134 | 20,512 | 476 | 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 Counter
n=int(input())
a=list(map(int, input().split()))
flag="No"
count_by_kw = Counter()
for i in range(n):
count_by_kw[a[i]]+=1
print(count_by_kw)
if count_by_kw.get(0) == n:
flag="Yes"
if count_by_kw.get(0) == n/3 and len(count_by_kw.keys())==2:
flag="Yes"
if len(count... | s838875150 | Accepted | 95 | 14,468 | 500 | from collections import Counter
n=int(input())
a=list(map(int, input().split()))
flag="No"
count_by_kw = Counter()
for i in range(n):
count_by_kw[a[i]]+=1
if count_by_kw.get(0) == n:
flag="Yes"
if count_by_kw.get(0) == n/3 and len(count_by_kw.keys())==2:
flag="Yes"
cl=list(count_by_kw.values())
ck=lis... |
s481462379 | p03433 | u244836567 | 2,000 | 262,144 | Wrong Answer | 31 | 9,064 | 125 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | a=int(input())
b=int(input())
if int(b/100)%5==0:
if b%500<=a:
print("Yes")
else:
print("No")
else:
print("No") | s085038175 | Accepted | 30 | 9,156 | 77 | a=int(input())
b=int(input())
if a%500<=b:
print("Yes")
else:
print("No") |
s468080841 | p03378 | u069129582 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 142 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | n,m,x=map(int,input().split())
a=list(map(int,input().split()))
print(a)
print(min((len([i for i in a if i<x])),(len([i for i in a if i>x])))) | s159397544 | Accepted | 17 | 2,940 | 133 | n,m,x=map(int,input().split())
a=list(map(int,input().split()))
print(min((len([i for i in a if i<x])),(len([i for i in a if i>x])))) |
s223209753 | p02389 | u003684951 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 78 | Write a program which calculates the area and perimeter of a given rectangle. | a, b = map(int,input().split())
print(a,b)
x = a*b
y = 2 * (a + b)
print(x,y)
| s045073036 | Accepted | 20 | 5,584 | 67 | a, b = map(int,input().split())
x = a*b
y = 2 * (a + b)
print(x,y)
|
s622139535 | p03610 | u374802266 | 2,000 | 262,144 | Wrong Answer | 17 | 3,192 | 20 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | print(input()[1::2]) | s091751654 | Accepted | 17 | 3,192 | 20 | print(input()[0::2]) |
s672249486 | p02612 | u953379577 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,140 | 30 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n%1000) | s497352543 | Accepted | 29 | 9,152 | 74 | n = int(input())
if n%1000 == 0:
print(0)
else:
print(1000-n%1000) |
s536037948 | p03861 | u460745860 | 2,000 | 262,144 | Wrong Answer | 31 | 9,016 | 78 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | # ABC048
a, b, x = map(int, input().split())
print(a//x+b//x + (a % x == 0))
| s981310911 | Accepted | 32 | 9,112 | 80 | # ABC048
a, b, x = map(int, input().split())
print(b//x - a//x + (a % x == 0))
|
s972785772 | p02607 | u258933429 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,096 | 255 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | N = int(input())
a = list(map(int, input().split()))
# L, R, d = map(int, input().split())
cnt = 0
for i in range(0, N, 2):
print(i)
if a[i] % 2 != 0:
cnt += 1
print(cnt)
| s064737981 | Accepted | 31 | 9,152 | 243 | N = int(input())
a = list(map(int, input().split()))
# L, R, d = map(int, input().split())
cnt = 0
for i in range(0, N, 2):
if a[i] % 2 != 0:
cnt += 1
print(cnt)
|
s131400542 | p03229 | u826263061 | 2,000 | 1,048,576 | Wrong Answer | 375 | 9,444 | 784 | You are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like. | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 27 19:18:58 2018
tenka1C
@author: maezawa
"""
n = int(input())
a = []
for i in range(n):
a.append(int(input()))
a.sort()
b=a[::-1]
pos = n//2
res = 0
c = [-1]*n
sign = -1
for i in range(n):
print(pos, i)
if i%2 == 0:
c[pos]=a[i]
pos += sign*(i... | s594236888 | Accepted | 299 | 12,484 | 427 | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 27 19:18:58 2018
tenka1C
@author: maezawa
"""
n = int(input())
a = []
for i in range(n):
a.append(int(input()))
a.sort()
b = [2*(-1)**i for i in range(n)]
b[0] = b[0]//2
b[-1] = b[-1]//2
b.sort()
ans1 = sum([a[i]*b[i] for i in range(n)])
c = [-b[i] for i in range(n)]... |
s432279489 | p03433 | u745087332 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
print('YES' if n % 500 <= a else 'NO') | s282325961 | Accepted | 17 | 2,940 | 72 | n = int(input())
a = int(input())
print('Yes' if n % 500 <= a else 'No') |
s373947370 | p03359 | u947327691 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 80 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a,b=map(int,input().split())
c=a-b
if a <= b:
print(c+1)
else:
print(c) | s493650309 | Accepted | 18 | 2,940 | 80 | a,b=map(int,input().split())
c=a-1
if a <= b:
print(c+1)
else:
print(c) |
s337593476 | p03408 | u777028980 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 300 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | n=int(input())
hoge=[]
for i in range(n):
hoge.append(input())
m=int(input())
huga=[]
for i in range(m):
huga.append(input())
ans=0
while 1:
blue=hoge.count(hoge[0])
red=huga.count(hoge[0])
if(blue>red):
ans+=blue-red
hoge.remove(hoge[0])
if(len(hoge)==0):
break
print(ans) | s270978024 | Accepted | 18 | 3,064 | 248 | n=int(input())
hoge=[]
for i in range(n):
hoge.append(input())
m=int(input())
huga=[]
for i in range(m):
huga.append(input())
ans=[]
ans.append(0)
for i in range(len(hoge)):
ans.append(hoge.count(hoge[i])-huga.count(hoge[i]))
print(max(ans)) |
s612048383 | p03730 | u063052907 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 112 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | # coding: utf-8
A, B, C = map(int, input().split())
print(any(A*i%B==C for i in range(1,B+1)) and "Yes" or "NO") | s087824484 | Accepted | 21 | 2,940 | 133 | # coding: utf-8
A, B, C = map(int, input().split())
ans ="NO"
for i in range(1,B+1):
if (A*i)%B==C:
ans= "YES"
print(ans) |
s816861622 | p03836 | u017415492 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 479 | 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 ... | sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
s=""
if tx!=sx and ty!=sy:
s+="R"*x
s+="U"*y
s+="D"*y
s+="L"*x
s+="L"
s+="U"*(y+1)
s+="R"*(x+1)
s+="R"
s+="D"*(y+1)
s+="L"*(x+1)
elif tx==sx:
s+="R"*x
s+="D"+"L"*x+"U"
s+="U"+"R"*x+"D"
s+="R"
s+="U"*2
s+="L"*(x+2)
s+="D"*2
s+... | s877380209 | Accepted | 26 | 9,220 | 235 | sx,sy,tx,ty=map(int,input().split())
ans=""
ans+="U"*(ty-sy)
ans+="R"*(tx-sx)
ans+="D"*(ty-sy)
ans+="L"*(tx-sx)
ans+="L"
ans+="U"*(ty-sy+1)
ans+="R"*(tx-sx+1)
ans+="D"
ans+="R"
ans+="D"*(ty-sy+1)
ans+="L"*(tx-sx+1)
ans+="U"
print(ans)
|
s580129241 | p03501 | u202877219 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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. | n,a,b = map(int, input().split())
if n * a > b:
print (n*a)
else:
print (b) | s509326466 | Accepted | 18 | 2,940 | 84 | n,a,b = map(int, input().split())
if n * a < b:
print (n*a)
else:
print (b) |
s905001034 | p02613 | u000842852 | 2,000 | 1,048,576 | Wrong Answer | 149 | 16,248 | 337 | 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())
str_list = [input() for _ in range(n)]
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(n):
if str_list[i] == 'AC':
AC +=1
elif str_list[i] == 'WA':
WA += 1
elif str_list == 'TLE':
TLE += 1
elif str_list == 'RE':
RE += 1
print('AC ×', AC)
print('WA ×', WA)
print('TLE ×', TLE)
prin... | s429196124 | Accepted | 157 | 16,256 | 339 | n = int(input())
str_list = [input() for _ in range(n)]
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(n):
if str_list[i] == 'AC':
AC +=1
elif str_list[i] == 'WA':
WA += 1
elif str_list[i] == 'TLE':
TLE += 1
elif str_list[i] == 'RE':
RE += 1
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE... |
s416722817 | p02255 | u609315369 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 521 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | #coding: UTF-8
import sys
class Algo:
@staticmethod
def insersion_sort(A, N):
for i in range(1, N):
for k in A:
if k==len(A):
print(k)
else:
print(k, " ", sep="", end="")
v = A[i]
j = i-1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= ... | s459719561 | Accepted | 30 | 6,316 | 531 | #coding: UTF-8
import sys
class Algo:
@staticmethod
def insersion_sort(A, N):
for i in range(1, N):
for k in A:
if k==A[len(A)-1]:
print(k)
else:
print(k, " ", sep="", end="")
v = A[i]
j = i-1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
... |
s412593206 | p03846 | u547167033 | 2,000 | 262,144 | Wrong Answer | 79 | 13,880 | 251 | There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu... | n=int(input())
a=list(map(int,input().split()))
a.sort()
if n%2==0:
for i in range(n):
if a[i]!=i//2+1:
print(0)
exit()
print(2**(n//2))
else:
for i in range(n):
if a[i]!=i//2+2:
print(0)
exit()
print(2**(n//2)) | s399711312 | Accepted | 100 | 13,880 | 286 | n=int(input())
a=list(map(int,input().split()))
a.sort()
mod=10**9+7
if n%2==0:
for i in range(n):
if a[i]!=(i//2)*2+1:
print(0)
exit()
print(pow(2,n//2,mod))
else:
for i in range(n):
if a[i]!=((i+1)//2)*2:
print(0)
exit()
print(pow(2,n//2,mod))
|
s921075817 | p03814 | u917558625 | 2,000 | 262,144 | Wrong Answer | 31 | 9,164 | 159 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s=input()
a,b=0,0
for i in range(len(s)):
if s[i]=='A':
a=i
break
for j in range(len(s)-1,-1):
if s[j]=='Z':
b=j
break
print(len(s[a:b+1])) | s910368889 | Accepted | 43 | 9,240 | 162 | s=input()
a,b=0,0
for i in range(len(s)):
if s[i]=='A':
a=i
break
for j in range(len(s)-1,-1,-1):
if s[j]=='Z':
b=j
break
print(len(s[a:b+1])) |
s209892955 | p02396 | u238001675 | 1,000 | 131,072 | Wrong Answer | 70 | 5,988 | 199 | 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... | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
num = 0
while True:
s = sys.stdin.readline().strip()
if s == '0':
break
num += 1
print('Case: ', num, ' ', s, sep='')
| s232151700 | Accepted | 70 | 5,980 | 199 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
num = 0
while True:
s = sys.stdin.readline().strip()
if s == '0':
break
num += 1
print('Case ', num, ': ', s, sep='')
|
s801646245 | p02612 | u539659844 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,148 | 48 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
change = n % 1000
print(change) | s814414549 | Accepted | 30 | 9,112 | 90 | n = int(input())
change = n % 1000
if change != 0:
print(1000 - change)
else:
print(0) |
s572981787 | p02578 | u364555831 | 2,000 | 1,048,576 | Wrong Answer | 183 | 25,112 | 259 | 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 = map(int, input().split())
#current height
now = 0
total = 0
for a in A:
print("a", a)
if a >= now:
now = a
pass
else:
total += now - a
#print("now", now)
print(total)
| s530510165 | Accepted | 101 | 32,184 | 196 | N = int(input())
A = list(map(int, input().split()))
#current height
now = 0
total = 0
for a in A:
if a >= now:
now = a
pass
else:
total += now - a
print(total)
|
s384705010 | p02392 | u295538678 | 1,000 | 131,072 | Wrong Answer | 20 | 7,656 | 95 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | a,b,c =[int(i) for i in input().split()]
if(a < b and b < c):
print("YES")
else:
print("NO") | s540258260 | Accepted | 30 | 7,688 | 95 | a,b,c =[int(i) for i in input().split()]
if(a < b and b < c):
print("Yes")
else:
print("No") |
s592003445 | p03493 | u577942884 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | 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. | a,b,c = map(int, input().format())
print("a + b + c") | s126528248 | Accepted | 19 | 3,060 | 86 | a = input()
b = str(a)
c = 0
for n in b:
if n == str(1):
c += 1
print(c)
|
s125895454 | p02972 | u686036872 | 2,000 | 1,048,576 | Wrong Answer | 1,194 | 15,288 | 393 | 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... | N = int(input())
B = list(map(int, input().split()))
ans = [0]*N
for i in range(N, 0, -1):
print(i)
cnt = 0
j = 1
while i*j<=N:
cnt += ans[i*j-1]
j += 1
if cnt%2 != B[i-1]:
ans[i-1] = 1
if sum(ans)>= 1:
print(sum(ans))
A =[]
for i, j in enumerate(ans, 1):
... | s938040403 | Accepted | 1,013 | 14,136 | 318 | N = int(input())
B = list(map(int, input().split()))
ans = [0]*N
for i in range(N, 0, -1):
cnt = 0
j = 1
while i*j<=N:
cnt += ans[i*j-1]
j += 1
if cnt%2 != B[i-1]:
ans[i-1] = 1
print(sum(ans))
A =[]
for i, j in enumerate(ans, 1):
if j == 1:
A.append(i)
print(*A) |
s436434522 | p03387 | u372259664 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 213 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | temp = input()
a,b,c = temp.split()
a = int(a)
b = int(b)
c = int(c)
inp = [a,b,c]
inp = sorted(inp)
print(inp)
dif = inp[2] - inp[0] + inp[2] - inp[1]
if dif%2 == 0:
print(dif//2)
else:
print((dif+3)//2)
| s772738992 | Accepted | 17 | 3,060 | 203 | temp = input()
a,b,c = temp.split()
a = int(a)
b = int(b)
c = int(c)
inp = [a,b,c]
inp = sorted(inp)
dif = inp[2] - inp[0] + inp[2] - inp[1]
if dif%2 == 0:
print(dif//2)
else:
print((dif+3)//2)
|
s706357516 | p02796 | u441254033 | 2,000 | 1,048,576 | Wrong Answer | 491 | 27,392 | 623 | In a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative. We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each i (1 \leq i \leq N... | n = int(input())
X = []
for i in range(n):
x,l = map(int,input().split())
ll = x-l
rr = x+l
X.append((x,l,ll,rr))
if n == 1:
print(n)
else:
XL = sorted(X, key=lambda x: x[0])
wkans = 0
idx = 0
m = 1
while idx+m < n:
if XL[idx][3] < XL[idx+m][2]:
idx += m
m = 1
# if idx+m > n... | s022661637 | Accepted | 432 | 26,976 | 337 | n = int(input())
X = []
for i in range(n):
x,l = map(int,input().split())
ll = x-l
rr = x+l
X.append((x,l,ll,rr))
if n == 1:
print(n)
else:
XL = sorted(X, key=lambda x: x[3])
# print(XL)
ans = 0
temp = -1 * (10**9)
for i in range(n):
if temp <= XL[i][2]:
ans += 1
temp = XL[i][3]
... |
s966845657 | p02645 | u306144075 | 2,000 | 1,048,576 | Wrong Answer | 22 | 8,964 | 23 | 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. | l=input()
print(l[0:4]) | s000571933 | Accepted | 21 | 9,088 | 23 | l=input()
print(l[0:3]) |
s835499976 | p03671 | u019578976 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | 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())
d=[a,b,c]
sum = 0
for i in range(2):
sum += d.pop()
print(sum) | s355651404 | Accepted | 17 | 2,940 | 119 | a,b,c=map(int,input().split())
d=[a,b,c]
d.sort(reverse=True)
sum = 0
for i in range(2):
sum += d.pop()
print(sum) |
s322959878 | p03992 | u021893936 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 63 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | import sys
s = sys.stdin.readline()
print(s[0:4] + " " + s[4:]) | s109230689 | Accepted | 22 | 3,064 | 40 | s = input()
print(s[0:4] + " " + s[4:])
|
s935943294 | p02865 | u482157295 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 63 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input())
a,b = divmod(n,2)
if b == 0:
a += 1
print(a) | s139278437 | Accepted | 18 | 2,940 | 63 | n = int(input())
a,b = divmod(n,2)
if b == 0:
a -= 1
print(a) |
s782038432 | p03470 | u598229387 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 66 | 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())
d =[int(input()) for _ in range(n)]
print(len(d)) | s068786130 | Accepted | 17 | 2,940 | 105 | n=int(input())
d=[int(input()) for i in range(n)]
se=set()
for i in d:
se.add(i)
print(len(se)) |
s321414926 | p02265 | u279605379 | 1,000 | 131,072 | Wrong Answer | 20 | 7,716 | 378 | Your task is to implement a double linked list. Write a program which performs the following operations: * insert x: insert an element with key x into the front of the list. * delete x: delete the first element which has the key of x from the list. If there is not such element, you need not do anything. * delet... | #ALDS1_3-C Elementary data structures - Doubly Linked List
n=int(input())
L=[]
for i in range(n):
cmd=input().split()
if(cmd[0]=="insert"):
L.append(cmd[1])
if(cmd[0]=="delete" and cmd[1] in L):
L.remove(cmd[1])
if(cmd[0]=="deleteFirst"):
L.pop(0)
if(cmd[0]=="deleteFirst"):
... | s883937870 | Accepted | 1,990 | 214,356 | 459 | #ALDS1_3-C Elementary data structures - Doubly Linked List
import collections
import sys
q = collections.deque()
n=int(input())
_input = sys.stdin.readlines()
cmds={"insert":lambda cmd: q.appendleft(cmd[1]),
"delete":lambda cmd: q.remove(cmd[1]) if (q.count(cmd[1]) > 0) else "none",
"deleteFirst":lambda cmd... |
s434467221 | p03814 | u492749916 | 2,000 | 262,144 | Wrong Answer | 73 | 3,816 | 257 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | import sys
s = str(input())
ans = ""
for i in range(0,len(s)):
if s[i] == "A":
for j in range(i,len(s)):
if s[j] != "Z":
ans = ans +s[j]
else:
ans = ans + "Z"
print(ans)
print (len(ans))
sys.exit() | s116990482 | Accepted | 41 | 3,516 | 168 | import sys
s = str(input())
for i in range(len(s)):
if s[i]=="A":
for j in range(1,len(s)):
if s[-1*j]=="Z":
print(len(s)-i-j+1)
sys.exit() |
s915612738 | p03435 | u077291787 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 256 | We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ... | # ABC088C - Takahashi's Information
def main():
C = tuple(tuple(map(int, input().split())) for _ in range(3))
memo = {(i, j, j - k) for i, j, k in C}
flg = len(memo) == 1
print("Yes" if flg else "No")
if __name__ == "__main__":
main() | s123664731 | Accepted | 17 | 2,940 | 252 | # ABC088C - Takahashi's Information
def main():
*C, = map(int, open(0).read().split())
memo = {(i - j, j - k) for i, j, k in zip(*[iter(C)] * 3)}
flg = len(memo) == 1
print("Yes" if flg else "No")
if __name__ == "__main__":
main() |
s846890753 | p03761 | u393971002 | 2,000 | 262,144 | Wrong Answer | 89 | 3,188 | 1,391 | Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string. He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headlin... |
def lcs(X, Y, m, n):
L = [[0 for x in range(n+1)] for x in range(m+1)]
# Following steps build L[m+1][n+1] in bottom up fashion. Note
# that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1]
for i in range(m+1):
for j in range(n+1):
if i == 0 or j == 0:
L[... | s866183154 | Accepted | 87 | 3,188 | 1,385 |
def lcs(X, Y, m, n):
L = [[0 for x in range(n+1)] for x in range(m+1)]
# Following steps build L[m+1][n+1] in bottom up fashion. Note
# that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1]
for i in range(m+1):
for j in range(n+1):
if i == 0 or j == 0:
L[... |
s108007051 | p02390 | u213265973 | 1,000 | 131,072 | Wrong Answer | 20 | 7,532 | 103 | 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 = int(input())
h = int(S/360)
rest = S % 360
m = int(rest/60)
s = rest % m
print(h, m, s, sep =":") | s561631395 | Accepted | 20 | 7,620 | 85 | S = int(input())
h = S // 3600
m = (S % 3600) // 60
s = S % 60
print(h,m,s,sep = ":") |
s588193700 | p03214 | u689739702 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,064 | 334 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | n = int(input())
a = list(map(int, input().split()))
ma = sum(a) / len(a)
a.sort()
l = 0
u = len(a)-1
for i in range(len(a)):
if a[i] <= ma and a[l] <= a[i]:
l = i
if a[i] >= ma and a[u] >= a[i]:
u = i
print(a[l])
print(a[u])
print(ma)
if (ma - a[l]) <= (a[u] - ma):
print(a[l])
else:
... | s213407244 | Accepted | 17 | 3,060 | 199 | n = int(input())
a = list(map(int, input().split()))
ma = sum(a) / len(a)
def d(i):
return abs(a[i] - ma)
best = 0
for i in range(len(a)):
if d(i) < d(best):
best = i
print(best)
|
s724690124 | p03044 | u619458041 | 2,000 | 1,048,576 | Wrong Answer | 580 | 58,896 | 801 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | import sys
from collections import defaultdict, deque
def main():
input = sys.stdin.readline
N = int(input())
d = defaultdict(list)
for _ in range(N-1):
u, v, w = map(int, input().split())
d[u-1].append((v-1, w))
d[v-1].append((u-1, w))
dist = [0] * N
q = deque()
q.... | s083406979 | Accepted | 536 | 57,628 | 785 | import sys
from collections import defaultdict, deque
def main():
input = sys.stdin.readline
N = int(input())
d = defaultdict(list)
for _ in range(N-1):
u, v, w = map(int, input().split())
d[u-1].append((v-1, w))
d[v-1].append((u-1, w))
dist = [0] * N
q = deque()
q.... |
s169783651 | p03048 | u955125992 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 14,480 | 269 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | import math
r, g, b, n = map(int, input().split())
ball = [0, r, g, b]
count = 0
for i in range(n+1):
for j in range(n+1):
m = math.floor((n-i*r-j*g)/b)
if i*r+j*g+m*b == n and m >= 0:
count += 1
print(i, j, m)
print(count) | s599310657 | Accepted | 26 | 3,444 | 398 | r, g, b, n = map(int, input().split())
ball = [0, r, g, b]
dp = [[0] * 4 for _ in range(n+1)]
dp[0][0] = 1
for i in range(n+1):
for k in range(4):
if k == 0:
if i != 0:
dp[i][k] = 0
else:
if i - ball[k] < 0:
dp[i][k] = dp[i][k-1]
e... |
s641522418 | p03494 | u914330401 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,060 | 238 | 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())
list = input().split()
ans = 0
is_dev = True
while True:
for i in range(N):
if int(list[i]) % 2 == 1:
is_dev = False
break
list[i] = int(list[i]) / 2
ans += 1
if is_dev:
break
print(ans) | s023062350 | Accepted | 21 | 3,060 | 271 | N = int(input())
list = input().split()
ans = 0
is_dev = True
while True:
for i in range(N):
list[i] = int(list[i])
if list[i] % 2 == 1:
is_dev = False
break
list[i] = int(list[i]) / 2
if not is_dev:
break
else:
ans += 1
print(ans) |
s136685431 | p03945 | u115682115 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 180 | Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones... | s = input()
if s[0] == 'W':
ans = s.count('WB')
elif s[0] == 'B':
ans = s.count('BW')
if s[0] == s[len(s) - 1]:
a = 1
else:
a = 0
print([0,ans * 2 - 1 + a][ans==0]) | s033438492 | Accepted | 18 | 3,188 | 185 | s = input()
if s[0] == 'W':
ans = s.count('WB')
elif s[0] == 'B':
ans = s.count('BW')
if s[0] == s[len(s) - 1]:
a = 1
else:
a = 0
print(0 if ans==0 else ans * 2 - 1 + a) |
s984347025 | p03643 | u483640741 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | n=int(input())
x=1
while True:
if x*2>n:
print(x)
break
else:
x=x*2
| s199265946 | Accepted | 17 | 2,940 | 25 | x=input()
print("ABC"+x)
|
s991496818 | p03846 | u659511702 | 2,000 | 262,144 | Wrong Answer | 85 | 14,008 | 481 | There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu... | n = int(input())
m = list(map(int, input().split()))
l = {}
if n % 2 == 0:
for i in m:
if i < 0 and i > n and i % 2 == 0:
print(0)
exit()
if i in l:
l[i] += 1
else:
l[i] = 1
if l[i] > 2:
print(0)
exit()
else:
for i in m:
if i < 0 and i > n and i % 2 == 1:
... | s236369686 | Accepted | 89 | 17,260 | 410 | n = int(input())
m = list(map(int, input().split()))
l = {}
ll = {}
if n % 2 == 0:
for i in m:
l[2*(i//2)+1] = 2
if i in ll:
ll[i] += 1
else:
ll[i] = 1
else:
for i in m:
if 2*(i//2) == 0:
l[2*(i//2)] = 1
else:
l[2*(i//2)] = 2
if i in ll:
ll[i] += 1
else:
... |
s661691728 | p02613 | u613920660 | 2,000 | 1,048,576 | Wrong Answer | 146 | 9,204 | 281 | 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())
C0=0
C1=0
C2=0
C3=0
for n in range(N):
S=input()
if S=="AC":
C0+=1
elif S=="WA":
C1+=1
elif S=="TLE":
C2+=1
else:
C3+=1
print("AC x"+str(C0))
print("WA x"+str(C1))
print("TLE x"+str(C2))
print("RE x"+str(C3)) | s475508329 | Accepted | 147 | 9,208 | 285 | N=int(input())
C0=0
C1=0
C2=0
C3=0
for n in range(N):
S=input()
if S=="AC":
C0+=1
elif S=="WA":
C1+=1
elif S=="TLE":
C2+=1
else:
C3+=1
print("AC x "+str(C0))
print("WA x "+str(C1))
print("TLE x "+str(C2))
print("RE x "+str(C3)) |
s207413208 | p03380 | u517327166 | 2,000 | 262,144 | Wrong Answer | 379 | 23,040 | 285 | 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 sys
import numpy
import math
N=int(input())
A=list(map(int,input().split()))
dekaiyatu=numpy.argmax(A)
kati=A[dekaiyatu]
A.pop(dekaiyatu)
iikanjinoyatu= numpy.argmin(list(map((lambda x: abs((dekaiyatu/2)-x) ), A)))
string=str(kati)+" "+str(A[iikanjinoyatu])
print(string)
| s005104629 | Accepted | 211 | 23,104 | 278 | import sys
import numpy
import math
N=int(input())
A=list(map(int,input().split()))
dekaiyatu=numpy.argmax(A)
kati=A[dekaiyatu]
A.pop(dekaiyatu)
iikanjinoyatu= numpy.argmin(list(map((lambda x: abs((kati/2)-x)), A)))
string=str(kati)+" "+str(A[iikanjinoyatu])
print(string)
|
s390814283 | p03151 | u674588203 | 2,000 | 1,048,576 | Wrong Answer | 65 | 18,356 | 119 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pa... | N=input()
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if sum(a)<sum(b):
print(-1)
exit() | s222775363 | Accepted | 242 | 30,260 | 552 | N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if sum(a)<sum(b):
print(-1)
exit()
p=0
ori_d=[]
for i in range (N):
_d=a[i]-b[i]
ori_d.append([i,_d])
d=sorted(ori_d,key=lambda x: x[1])
d2=[0]*N
for j in range (N):
if d[j][1]>=0:
break
else:
p+=... |
s698379598 | p02401 | u435917115 | 1,000 | 131,072 | Wrong Answer | 20 | 7,608 | 268 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == '?':
break
if op == '+':
print(a + b)
if op == '-':
print(a -b)
if op == '*':
print(a * b)
if op == '/':
print(a / b) | s169559447 | Accepted | 20 | 7,668 | 269 | while True:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == '?':
break
if op == '+':
print(a + b)
if op == '-':
print(a -b)
if op == '*':
print(a * b)
if op == '/':
print(a // b) |
s849746239 | p03455 | u374146618 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 96 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = [int(x) for x in input().split()]
if (a*b)%2==0:
print("Odd")
else:
print("Even") | s233155796 | Accepted | 17 | 2,940 | 96 | a, b = [int(x) for x in input().split()]
if (a*b)%2==0:
print("Even")
else:
print("Odd") |
s778432163 | p02694 | u268822556 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,168 | 116 | 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... | c = 100
y = 0
x = int(input())
while True:
if c>x:
print(y)
break
c = int(c*1.01)
y += 1 | s760607553 | Accepted | 21 | 9,168 | 117 | c = 100
y = 0
x = int(input())
while True:
if c>=x:
print(y)
break
c = int(c*1.01)
y += 1 |
s002676715 | p03575 | u687574784 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 999 | 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 = list(map(int, input().split()))
L = [list(map(int, input().split())) for _ in range(m)]
from collections import defaultdict
from collections import deque
d=defaultdict(list)
for l in L:
d[l[0]-1].append(l[1]-1)
d[l[1]-1].append(l[0]-1)
print(d)
def check_path(hen):
visit=[False]*n
q=d... | s909250921 | Accepted | 22 | 3,316 | 1,000 | n,m = list(map(int, input().split()))
L = [list(map(int, input().split())) for _ in range(m)]
from collections import defaultdict
from collections import deque
d=defaultdict(list)
for l in L:
d[l[0]-1].append(l[1]-1)
d[l[1]-1].append(l[0]-1)
#print(d)
def check_path(hen):
visit=[False]*n
q=... |
s675852905 | p03719 | u717626627 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | 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 b <= c:
print('Yes')
else:
print('No') | s406438761 | Accepted | 17 | 2,940 | 92 | a,b, c = map(int, input().split())
if a <= c and c <= b:
print('Yes')
else:
print('No') |
s298598974 | p04011 | u375695365 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 84 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n=int(input())
a=int(input())
b=int(input())
c=int(input())
print(n*b+min(0,n-b)*c) | s656845698 | Accepted | 17 | 2,940 | 111 | n=int(input())
a=int(input())
b=int(input())
c=int(input())
if n <= a:
print(n*b)
else:
print(a*b+(n-a)*c) |
s801451971 | p03777 | u023077142 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | Two deer, AtCoDeer and TopCoDeer, are playing a game called _Honest or Dishonest_. In this game, an honest player always tells the truth, and an dishonest player always tell lies. You are given two characters a and b as the input. Each of them is either `H` or `D`, and carries the following information: If a=`H`, AtCo... | A, B = [s == "H" for s in input().split()]
print(["D", "H"][A ^ B]) | s756354371 | Accepted | 17 | 2,940 | 68 | A, B = [s == "H" for s in input().split()]
print(["H", "D"][A ^ B]) |
s020690867 | p03504 | u255280439 | 2,000 | 262,144 | Wrong Answer | 1,039 | 29,036 | 898 | Joisino is planning to record N TV programs with recorders. The TV can receive C channels numbered 1 through C. The i-th program that she wants to record will be broadcast from time s_i to time t_i (including time s_i but not t_i) on Channel c_i. Here, there will never be more than one program that are broadcast on ... | import sys
import math
import collections
import itertools
import array
import inspect
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {
id(v): k
for k, v in inspect.currentframe().f_back.f_locals.items()
}
print(', '.join(
names.get(id(arg), '???') + ' =... | s564391186 | Accepted | 1,046 | 30,972 | 902 | import sys
import math
import collections
import itertools
import array
import inspect
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {
id(v): k
for k, v in inspect.currentframe().f_back.f_locals.items()
}
print(', '.join(
names.get(id(arg), '???') + ' =... |
s806726497 | p02305 | u825008385 | 1,000 | 131,072 | Wrong Answer | 20 | 5,668 | 709 | For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circle is inscribed... | # Intersection of Circles
import math
class Circle:
def __init__(self, x, y, r):
self.x = x
self.y = y
self.r = r
def Exchange(c1, c2):
return list((c2, c1))
data = list(map(int, input("Please enter the value of c1: ").split()))
c1 = Circle(data[0],data[1],data[2])
data = list(map(in... | s608912337 | Accepted | 30 | 5,676 | 649 | # Intersection of Circles
import math
class Circle:
def __init__(self, x, y, r):
self.x = x
self.y = y
self.r = r
def Exchange(c1, c2):
return list((c2, c1))
data = list(map(int, input("").split()))
c1 = Circle(data[0],data[1],data[2])
data = list(map(int, input("").split()))
c2 = Ci... |
s687356418 | p04012 | u520018621 | 2,000 | 262,144 | Wrong Answer | 27 | 8,976 | 129 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | s = input()
n = [0] * 26
for i in s:
n[ord(i) - 97] += 1
if 1 in [x % 2 for x in n]:
print('NO')
else:
print("YES")
| s193120593 | Accepted | 25 | 9,032 | 129 | s = input()
n = [0] * 26
for i in s:
n[ord(i) - 97] += 1
if 1 in [x % 2 for x in n]:
print('No')
else:
print("Yes")
|
s565482392 | p03730 | u075303794 | 2,000 | 262,144 | Wrong Answer | 29 | 9,120 | 118 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A,B,C=map(int,input().split())
for i in range(1,10**4):
if A==B*i+C:
print('Yes')
break
else:
print('No') | s519448594 | Accepted | 40 | 9,164 | 121 | A,B,C=map(int,input().split())
for i in range(1,10**5):
if (B*i+C)%A==0:
print('YES')
break
else:
print('NO') |
s302819797 | p00050 | u024715419 | 1,000 | 131,072 | Wrong Answer | 20 | 5,540 | 84 | 福島県は果物の産地としても有名で、その中でも特に桃とりんごは全国でも指折りの生産量を誇っています。ところで、ある販売用の英文パンフレットの印刷原稿を作ったところ、手違いでりんごに関する記述と桃に関する記述を逆に書いてしまいました。 あなたは、apple と peach を修正する仕事を任されましたが、なにぶん面倒です。1行の英文を入力して、そのなかの apple という文字列を全て peach に、peach という文字列を全てapple に交換した英文を出力するプログラムを作成してください。 | inp = input()
tmp = inp.replace("apple", "XXX")
print(tmp.replace("XXX", "peach"))
| s279604074 | Accepted | 20 | 5,540 | 120 | inp = input()
tmp = inp.replace("apple", "XXX")
tmp = tmp.replace("peach", "apple")
print(tmp.replace("XXX", "peach"))
|
s674673997 | p03160 | u280978334 | 2,000 | 1,048,576 | Wrong Answer | 136 | 14,604 | 213 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | n=int(input())
h=[int(x) for x in input().split()]
cost=[0]
cost.append(abs(h[0]-h[1]))
for p in range(2,n):
cost.append(min(cost[p-1]+abs(h[p]-h[p-1]),abs(h[p]-h[p-2])+cost[p-2]))
print(cost)
print(cost[n-1]) | s649285717 | Accepted | 135 | 13,980 | 201 | n=int(input())
h=[int(x) for x in input().split()]
cost=[0]
cost.append(abs(h[0]-h[1]))
for p in range(2,n):
cost.append(min(cost[p-1]+abs(h[p]-h[p-1]),abs(h[p]-h[p-2])+cost[p-2]))
print(cost[n-1]) |
s548646753 | p02613 | u837507786 | 2,000 | 1,048,576 | Wrong Answer | 153 | 16,160 | 218 | 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())
l = []
for i in range(N):
i = input()
l.append(i)
b = l.count("AC")
c = l.count("WA")
d = l.count("TLE")
e = l.count("RE")
print("AC ×",b)
print("WA ×",c)
print("TLE ×",d)
print("RE ×",e) | s725340318 | Accepted | 145 | 16,292 | 214 | N = int(input())
l = []
for i in range(N):
i = input()
l.append(i)
b = l.count("AC")
c = l.count("WA")
d = l.count("TLE")
e = l.count("RE")
print("AC x",b)
print("WA x",c)
print("TLE x",d)
print("RE x",e) |
s715120107 | p03563 | u724707209 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 236 | 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... | if __name__ == "__main__":
n = int(input())
k = int(input())
result=1
while(n==0):
if (result+k > result*2):
result=result*2
else:
result=result+k
n=n-1
print(result)
| s612692865 | Accepted | 17 | 2,940 | 99 | if __name__ == "__main__":
r = int(input())
g = int(input())
diff=g-r
print(g+diff) |
s053804000 | p00009 | u011621222 | 1,000 | 131,072 | Wrong Answer | 30 | 7,580 | 152 | Write a program which reads an integer n and prints the number of prime numbers which are less than or equal to n. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. | n=int (input())
li=[]
for i in range(2,n+1):
for j in range(2,i):
if i%j==0:
break
else:
li.append(i)
print(len(li)) | s895441254 | Accepted | 790 | 23,448 | 362 | from sys import stdin
a = [True]*1000000
for i in range(2,1000000):
if a[i]:
for j in range(i+i, 1000000)[::i]:
a[j] = False
b = [None]*1000000
b[0] = b[1] = 0
for i in range(2,1000000):
if a[i]:
b[i] = b[i-1] + 1
else:
b[i] = b[i-1]
while True:
try:
print(b... |
s267580534 | p04031 | u077291787 | 2,000 | 262,144 | Wrong Answer | 23 | 3,060 | 299 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... |
def main():
N = int(input())
A = tuple(map(int, input().split()))
ans = []
for i in range(min(A), max(A) + 1):
cnt = sum((i - a) ** 2 for a in A)
ans += [cnt]
print(max(ans))
if __name__ == "__main__":
main() | s413940751 | Accepted | 23 | 3,060 | 387 |
def main():
# find the min cost to rewrite all to i (min(A) <= i <= max(A))
N = int(input())
A = tuple(map(int, input().split()))
ans = []
for i in range(min(A), max(A) + 1):
cnt = sum((i - a) ** 2 for a in A)
ans += [cnt]
print(min(ans))
if __name__ == "__main__":
main() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.