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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s981157252 | p02747 | u441694890 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 347 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | hitachi = list(input())
if len(hitachi) % 2 == 1:
print("NO")
else:
H = True
for i in range(len(hitachi)):
if i % 2 == 0:
if hitachi[i] != "h":
H = False
else:
if hitachi[i] != "i":
H = False
if H == True:
print("YES")
... | s000869398 | Accepted | 17 | 3,060 | 347 | hitachi = list(input())
if len(hitachi) % 2 == 1:
print("No")
else:
H = True
for i in range(len(hitachi)):
if i % 2 == 0:
if hitachi[i] != "h":
H = False
else:
if hitachi[i] != "i":
H = False
if H == True:
print("Yes")
... |
s787138982 | p03860 | u477114517 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 44 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | s = input()
print('s[0]' + 's[8]' + 's[10]') | s364130835 | Accepted | 17 | 2,940 | 36 | s = input()
print('A' + s[8] + 'C')
|
s288479957 | p03719 | u137726327 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 332 | 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 -*-
#a = int(input())
lists=list(map(int,input().split()))
#s = input()
#print("{} {}".format(a+b+c, s))
if lists[0]<=lists[2] and lists[1]>=lists[2]:
print("YES")
else:
print("NO")
| s263448868 | Accepted | 17 | 2,940 | 332 | # -*- coding: utf-8 -*-
#a = int(input())
lists=list(map(int,input().split()))
#s = input()
#print("{} {}".format(a+b+c, s))
if lists[0]<=lists[2] and lists[1]>=lists[2]:
print("Yes")
else:
print("No")
|
s798408909 | p02260 | u144068724 | 1,000 | 131,072 | Wrong Answer | 30 | 7,620 | 411 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | def selectionSort(A,N):
count = 0
for i in range(N):
minj = i
for j in range(i,N):
if A[j] < A[minj]:
minj = j
A[i],A[minj] = A[minj],A[i]
count += 1
return (count)
if __name__ == '__main__':
n = int(input())
data = [int(i) for i in range(... | s116487642 | Accepted | 30 | 7,748 | 450 | def selection_Sort(A,N):
count = 0
for i in range(N):
minj = i
for j in range(i,N):
if A[j] < A[minj]:
minj = j
if i != minj:
A[i],A[minj] = A[minj],A[i]
count += 1
return (count)
if __name__ == '__main__':
n = int(input())
... |
s842473348 | p02742 | u572026348 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 222 | 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... | def main():
h, w = list(map(int, input().split()))
if (h==1 or w==1):
print(1)
elif (h%2==0 or w%2==0):
print((h*w)/2)
else:
print((h*w)//2+1)
if __name__ == '__main__':
main()
| s579693119 | Accepted | 17 | 2,940 | 232 | def main():
h, w = list(map(int, input().split()))
if (h==1 or w==1):
print(1)
elif (h%2==0 or w%2==0):
print(int((h*w)/2))
else:
print(int((h*w)//2+1))
if __name__ == '__main__':
main()
|
s846390828 | p03759 | u051496905 | 2,000 | 262,144 | Wrong Answer | 26 | 9,092 | 91 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a , b , c = map(int,input().split())
if b - a == c - b:
print("Yes")
else:
print("No") | s350389061 | Accepted | 26 | 9,152 | 91 | a , b , c = map(int,input().split())
if b - a == c - b:
print("YES")
else:
print("NO") |
s409995795 | p03455 | u922769680 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | 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())
c=a*b
# print(c)
d=c%2
if d==0:
print("EVEN")
else:
print("ODD") | s198662447 | Accepted | 18 | 2,940 | 103 | a, b=map(int, input().split())
c=a*b
# print(c)
d=c%2
if d==0:
print("Even")
else:
print("Odd") |
s010934059 | p03796 | u075595666 | 2,000 | 262,144 | Wrong Answer | 28 | 3,064 | 106 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | N = int(input())
x = 1
for i in range(N):
x = x*i
if x >= 10**9+7:
x = x-10**9-7
print(x%(10**+7)) | s571388767 | Accepted | 42 | 2,940 | 163 | N = int(input())
x = 1
for i in range(1,N+1):
x = x*i
x = x%(10**9+7)
print(x%(10**9+7))
#457992974
|
s065377030 | p03759 | u277802731 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | #58a
a,b,c = map(int,input().split())
print('Yes' if b-a==c-b else 'No') | s237790901 | Accepted | 17 | 2,940 | 72 | #58a
a,b,c = map(int,input().split())
print('YES' if b-a==c-b else 'NO') |
s187702618 | p03997 | u667024514 | 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())
c = int(input())
print((a+b)*c/2) | s321805022 | Accepted | 17 | 2,940 | 82 | a = int(input())
b = int(input())
c = int(input())
ans = int((a+b)*c/2)
print(ans) |
s523274853 | p03448 | u100873497 | 2,000 | 262,144 | Wrong Answer | 48 | 3,060 | 244 | 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())
ans=0
for i in range(0,a):
for j in range(0,b):
for k in range(0,c):
if 500*i+100*j+50*k==x:
ans+=1
print(ans) | s041284763 | Accepted | 50 | 3,060 | 211 | a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500*i+100*j+50*k==x:
ans+=1
print(ans) |
s148271234 | p03852 | u101680358 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 315 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | S = input()
S = S[::-1]
T = ['dream'[::-1],'dreamer'[::-1],'erase'[::-1],'eraser'[::-1]]
size = 0
while size < len(S):
if S[size:size+5] == T[0] or S[size:size+5] == T[2]:
size += 5
elif S[size:size+6] == T[3]:
size += 6
elif S[size:size+7] == T[1]:
size += 7
else :
print('No')
exit()
print('Yes') | s255330110 | Accepted | 17 | 2,940 | 72 | c = input()
if c in 'aiueo':
print('vowel')
else:
print('consonant') |
s772915096 | p02414 | u656153606 | 1,000 | 131,072 | Wrong Answer | 40 | 7,636 | 276 | Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula: \\[ c_{ij} = \sum_{k=1}^m a_{ik}b_{kj} \\] where $a_{ij}$, $b_{ij}$ and $c_{ij}$ are elements of $A$, $B$ and $C$ res... | #Input
n,m,l = map(int,input().split())
A = [list(map(int,input().split())) for i in range(n)]
B = [list(map(int,input().split())) for i in range(m)]
c = [list(sum([A[i][k] * B[k][j] for k in range(m)]) for j in range(l)) for i in range(n)]
#Output
for i in c:
print(*c) | s813728885 | Accepted | 280 | 9,104 | 276 | #Input
n,m,l = map(int,input().split())
A = [list(map(int,input().split())) for i in range(n)]
B = [list(map(int,input().split())) for i in range(m)]
c = [list(sum([A[i][k] * B[k][j] for k in range(m)]) for j in range(l)) for i in range(n)]
#Output
for i in c:
print(*i) |
s446533441 | p04043 | u006425112 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 222 | 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 ... | import sys
a = map(int, sys.stdin.readline().split())
seven = 0
five = 0
for i in a:
if i == seven:
seven += 1
else:
five += 1
if seven == 1 and five == 2:
print("YES")
else:
print("NO") | s770648047 | Accepted | 17 | 2,940 | 218 | import sys
a = map(int, sys.stdin.readline().split())
seven = 0
five = 0
for i in a:
if i == 7:
seven += 1
else:
five += 1
if seven == 1 and five == 2:
print("YES")
else:
print("NO") |
s488874730 | p03197 | u511379665 | 2,000 | 1,048,576 | Wrong Answer | 200 | 3,060 | 155 | There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i. You and Lunlun the dachshund alternately perform the following operation (starting from you): * Choose one or more apples from the tree and eat them. Here, the apples chosen a... | n=int(input())
cnt=float('inf')
for i in range(n):
a=int(input())
cnt=min(cnt,a)
tm=n^cnt
if tm%2==0:
print("first")
else:
print("second") | s490862421 | Accepted | 187 | 7,072 | 117 | n=int(input())
a=[int(input()) for i in range(n)]
print( "second" if all(a[i]%2==0 for i in range(n)) else "first" ) |
s231122036 | p03624 | u750651325 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 170 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | S = input()
lll = "abcdefghijklmnopqrstuvwxyz"
for i in range(26):
if lll[i] in S:
print(lll[i])
exit()
else:
pass
print("None")
| s630725980 | Accepted | 18 | 3,188 | 170 | S = input()
lll = "abcdefghijklmnopqrstuvwxyz"
for i in range(26):
if lll[i] in S:
pass
else:
print(lll[i])
exit()
print("None")
|
s571096310 | p03140 | u432333240 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 273 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | N = int(input())
A = input()
B = input()
C = input()
target_list = []
for a, b, c in zip(A, B, C):
if a==b and b==c:
target_list.append(3)
elif a==b or a==c:
target_list.append(2)
else:
target_list.append(1)
print(N*3 - sum(target_list)) | s835533391 | Accepted | 17 | 3,064 | 291 | N = int(input())
A = input()
B = input()
C = input()
target_list = []
for a, b, c in zip(A, B, C):
if a==b and b==c and c==a:
target_list.append(3)
elif a==b or b==c or c==a:
target_list.append(2)
else:
target_list.append(1)
print(N*3 - sum(target_list)) |
s858146500 | p03693 | u189385406 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r,g,b=map(int,input().split())
if(r+g+b)%4 == 0:
print('YES')
else:
print('NO') | s607115630 | Accepted | 17 | 2,940 | 80 | g=int(input().replace(' ', ''))
if g%4 == 0:
print('YES')
else :
print('NO') |
s269130469 | p03494 | u842838534 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 251 | 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. | def how_many_times_divisible(n):
ans = 0
while n % 2 == 0:
n = n / 2
ans += 1
return ans
n = input()
a = list(map(int,input().split()))
a_divided = list(map(how_many_times_divisible,a))
ans = max(a_divided)
print(ans)
| s667128286 | Accepted | 19 | 2,940 | 251 | def how_many_times_divisible(n):
ans = 0
while n % 2 == 0:
n = n / 2
ans += 1
return ans
n = input()
a = list(map(int,input().split()))
a_divided = list(map(how_many_times_divisible,a))
ans = min(a_divided)
print(ans)
|
s088147588 | p02613 | u219937318 | 2,000 | 1,048,576 | Wrong Answer | 153 | 16,316 | 300 | 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())
ac=0
wa=0
tle=0
re=0
S=[input() for i in range(N)]
for s in S:
if s =='AC':
ac=ac+1
elif s == 'WA':
wa = wa + 1
elif s == 'TLE':
tle = tle + 1
else:
re = re + 1
print("AC ×",ac)
print("WA ×",wa)
print("TLE ×",tle)
print("RE ×",re) | s846882605 | Accepted | 146 | 16,188 | 295 | N=int(input())
ac=0
wa=0
tle=0
re=0
S=[input() for i in range(N)]
for s in S:
if s =='AC':
ac=ac+1
elif s == 'WA':
wa = wa + 1
elif s == 'TLE':
tle = tle + 1
else:
re = re + 1
print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re) |
s927827482 | p03448 | u144072139 | 2,000 | 262,144 | Wrong Answer | 50 | 3,060 | 256 | 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())
counts = 0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if (A*500 + B*100 + C*50)==X:
counts += 1
print(counts) | s069107916 | Accepted | 52 | 3,064 | 256 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
counts = 0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if (a*500 + b*100 + c*50)==X:
counts += 1
print(counts) |
s666398952 | p03573 | u353652911 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | a,b,c=map(int,input().split())
print("c" if a==b else "b" if a==c else "a") | s387363769 | Accepted | 17 | 2,940 | 69 | a,b,c=map(int,input().split())
print(c if a==b else b if a==c else a) |
s089647804 | p02694 | u158703648 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,168 | 112 | 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())
money = 100
count = 0
while money <= X:
money = int(money*1.01)
count +=1
print(count) | s369974691 | Accepted | 24 | 9,164 | 111 | X = int(input())
money = 100
count = 0
while money < X:
money = int(money*1.01)
count +=1
print(count) |
s798529880 | p02972 | u241190159 | 2,000 | 1,048,576 | Wrong Answer | 722 | 63,584 | 749 | 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... | def main():
N = int(input())
a = {i: inp for i, inp in enumerate(map(int, input().split()), 1)}
M = 0
b = {i : 0 for i in range(1, N+1)}
for i in range(N, 0, -1):
sum_multiple = 0
cursor = 2
while i * cursor <= N:
sum_multiple += a[i * cursor]
... | s088222757 | Accepted | 698 | 53,108 | 698 | def main():
N = int(input())
a = {i: inp for i, inp in enumerate(map(int, input().split()), 1)}
b = {i : 0 for i in range(1, N+1)}
ret = []
for i in range(N, 0, -1):
sum_multiple = 0
cursor = 2
while i * cursor <= N:
sum_multiple += b[i * cursor]
... |
s508776757 | p03338 | u698479721 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,104 | 10,008 | 230 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | N = int(input())
s = input()
i = 1
li = []
charas = 'abcdefghijklmnopqrstuvwxyz'
while i < N:
m = 0
s1 = s[0:i]
s2 = s[i:]
for chara in charas:
if chara in s1 and chara in s2:
m += 1
li.append(m)
print(max(li)) | s023582407 | Accepted | 17 | 3,060 | 239 | N = int(input())
s = input()
i = 1
li = []
charas = 'abcdefghijklmnopqrstuvwxyz'
while i < N:
m = 0
s1 = s[0:i]
s2 = s[i:]
for chara in charas:
if chara in s1 and chara in s2:
m += 1
li.append(m)
i += 1
print(max(li)) |
s678799296 | p03360 | u214434454 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 95 | 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... | num = list(map(int,input().split()))
k = int(input())
num.sort()
print(sum(num[:2])+num[-1]**k) | s272161587 | Accepted | 17 | 2,940 | 99 | num = list(map(int,input().split()))
k = int(input())
num.sort()
print(sum(num[:2])+num[-1] * 2**k) |
s638913292 | p02796 | u670180528 | 2,000 | 1,048,576 | Wrong Answer | 247 | 18,224 | 230 | 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... | import sys
input=sys.stdin.buffer.readline
L=[]
for _ in range(int(input())):
x,l=map(int,input().split())
L.append((x-l,x+l))
L.sort(key=lambda x:x[1])
ans=0
cur=-1
for a,b in L:
if a>=cur:
cur=b
ans+=1
print(ans) | s641860198 | Accepted | 237 | 18,224 | 246 | import sys
input=sys.stdin.buffer.readline
L=[]
for _ in range(int(input())):
x,l=map(int,input().split())
L.append((x-l,x+l))
L.sort(key=lambda x:x[1])
ans=0
cur=-11111111111111111
for a,b in L:
if a>=cur:
cur=b
ans+=1
print(ans) |
s200353787 | p03719 | u726439578 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | 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<=b:
print("YES")
else:
print("NO") | s413615375 | Accepted | 18 | 2,940 | 81 | a,b,c=map(int,input().split())
if a<=c<=b:
print("Yes")
else:
print("No") |
s306777942 | p03377 | u129978636 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | 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())
D = A + B
if( D <= X):
print('Yes')
if( X <= D):
print('No') | s314726613 | Accepted | 17 | 2,940 | 146 | A, B, X = map( int, input().split())
D = A + B
if( X <= D):
if( A <= X):
print('YES')
else:
print('NO')
else:
print('NO')
|
s131064436 | p03470 | u257541375 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 120 | 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())
a = []
for i in range(n):
getn = int(input())
a.append(getn)
b = set(a)
print(len(a)-len(b)+1) | s906904309 | Accepted | 17 | 2,940 | 111 | n = int(input())
a = []
for i in range(n):
getn = int(input())
a.append(getn)
b = set(a)
print(len(b)) |
s515560482 | p02613 | u729272006 | 2,000 | 1,048,576 | Wrong Answer | 146 | 9,208 | 347 | 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 = input()
n = int(n)
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
wk = input()
if wk == "AC":
ac +=1
elif wk == "WA":
wa += 1
elif wk == "TLE":
tle += 1
else :
re += 1
print("AC × {0}".format(ac))
print("WA × {0}".format(wa))
print("TLE × {0}".format(tle))
print(... | s404755353 | Accepted | 150 | 9,200 | 343 | n = input()
n = int(n)
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
wk = input()
if wk == "AC":
ac +=1
elif wk == "WA":
wa += 1
elif wk == "TLE":
tle += 1
else :
re += 1
print("AC x {0}".format(ac))
print("WA x {0}".format(wa))
print("TLE x {0}".format(tle))
print(... |
s666834220 | p04044 | u334222621 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 164 | 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())
lst = []
ans = str()
for i in range(N):
lst.append(input())
lst.sort
for i in range(len(lst)):
ans += lst[i]
print(ans) | s407173672 | Accepted | 18 | 3,060 | 163 | N, L=map(int, input().split())
lst = []
ans = ""
for i in range(N):
lst.append(input())
lst.sort()
for i in range(len(lst)):
ans += lst[i]
print(ans) |
s636458326 | p03578 | u085717502 | 2,000 | 262,144 | Wrong Answer | 2,206 | 39,328 | 317 | Rng is preparing a problem set for a qualification round of CODEFESTIVAL. He has N candidates of problems. The difficulty of the i-th candidate is D_i. There must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.... | #!/usr/bin/env python
# coding: utf-8
# In[7]:
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
# In[8]:
for i,t in enumerate(T):
if t in D:
D.pop(D.index(t))
else:
print("No")
break
else:
print("Yes")
# In[ ]:
| s794570265 | Accepted | 246 | 57,128 | 483 | #!/usr/bin/env python
# coding: utf-8
# In[9]:
import collections
# In[32]:
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
# In[34]:
t_count = collections.Counter(T)
d_count = collections.Counter(D)
for key,c in t_count.items():
if key in d_coun... |
s195481500 | p02697 | u117541450 | 2,000 | 1,048,576 | Wrong Answer | 79 | 9,180 | 88 | 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):
a=i+1
b=2*M-i
print(a,b) | s994746389 | Accepted | 88 | 9,196 | 189 | N,M = map(int, input().split())
M1 = M//2
M2 = M-M1
for i in range(M1):
a=i+1
b=2*M1+1-i
print(a,b)
for i in range(M2):
a=i+1
b=2*M2-i
print(2*M1+1 + a,2*M1+1 + b) |
s063300600 | p03657 | u667084803 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | 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:
print("Possible")
else:
print("Impossible") | s868566094 | Accepted | 17 | 2,940 | 111 | a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
print("Possible")
else:
print("Impossible") |
s916576940 | p03546 | u639343026 | 2,000 | 262,144 | Wrong Answer | 214 | 14,068 | 577 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | import sys
input=sys.stdin.readline
import numpy as np
from scipy.sparse.csgraph import shortest_path
h,w=map(int,input().split())
c=[list(map(int,input().split())) for i in range(10)]
a=[list(map(int,input().split())) for i in range(h)]
graph = np.zeros((10,10))
for i in range(10):
for j in range(10):
g... | s263194223 | Accepted | 213 | 14,068 | 578 | import sys
input=sys.stdin.readline
import numpy as np
from scipy.sparse.csgraph import shortest_path
h,w=map(int,input().split())
c=[list(map(int,input().split())) for i in range(10)]
a=[list(map(int,input().split())) for i in range(h)]
graph = np.zeros((10,10))
for i in range(10):
for j in range(10):
g... |
s841114623 | p02419 | u823030818 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 209 | Write a program which reads a word W and a text T, and prints the number of word W which appears in text T T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive. | target = input()
count = 0
while True:
line = input()
if line == 'END_OF_TEXT':
break
for word in line.split():
if word.lower == target.lower:
count += 1
print(count) | s680689104 | Accepted | 30 | 6,724 | 213 | target = input()
count = 0
while True:
line = input()
if line == 'END_OF_TEXT':
break
for word in line.split():
if word.lower() == target.lower():
count += 1
print(count) |
s228256040 | p03069 | u994988729 | 2,000 | 1,048,576 | Wrong Answer | 89 | 5,096 | 236 | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`. Takahashi wants to change the colors of some stones to black or white so t... | n=int(input())
s=input()
ndot=0
nx=0
mx=10000000
for i in range(n+1):
if i==0:
ndot=sum([1 for i in s if i=="."])
nx=0
else:
if s[i-1]==".":
ndot-=1
elif s[i-1]=="#":
nx+=1 | s605276996 | Accepted | 147 | 5,096 | 269 | n=int(input())
s=input()
ndot=0
nx=0
mx=10000000
for i in range(n+1):
if i==0:
ndot=sum([1 for i in s if i=="."])
nx=0
else:
if s[i-1]==".":
ndot-=1
elif s[i-1]=="#":
nx+=1
mx=min(mx,nx+ndot)
print(mx) |
s750651483 | p03369 | u180704972 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 144 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | S = input()
Ramen = 700
if S[0] == '○':
Ramen += 100
if S[1] == '○':
Ramen += 100
if S[2] == '○':
Ramen += 100
print(Ramen) | s795348735 | Accepted | 17 | 2,940 | 138 | S = input()
Ramen = 700
if S[0] == 'o':
Ramen += 100
if S[1] == 'o':
Ramen += 100
if S[2] == 'o':
Ramen += 100
print(Ramen) |
s652167519 | p03760 | u324549724 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 199 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | a = input()
b = input()
ans = []
count = 0
while True:
if count == len(a):
print(ans)
exit()
ans += a[count]
if count == len(b):
print(ans)
exit()
ans += b[count]
count += 1 | s192944187 | Accepted | 17 | 2,940 | 200 | a = input()
b = input()
ans = ""
count = 0
while True:
if count == len(a):
print(ans)
exit()
ans += a[count]
if count == len(b):
print(ans)
exit()
ans += b[count]
count += 1
|
s183415964 | p03407 | u779728630 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a, b, c = map(int, input().split())
print("Yes") if a + b <= c else print("No") | s864904732 | Accepted | 17 | 2,940 | 80 | a, b, c = map(int, input().split())
print("Yes") if a + b >= c else print("No")
|
s710420700 | p03889 | u426964396 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 373 | You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a _mirror string_. Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S: 1. Reverse the order of the characters in S. 2. Replace each occurrence of `b` by `... | s=input().split()
if s[0]=='d' and s[3]=='b':
if s[1]=='p' and s[2]=='q':
print('Yes')
elif s[1]=='q' and s[2]=='p':
print('Yes')
else:
print('No')
elif s[0]=='b' and s[3]=='d':
if s[1]=='p' and s[2]=='q':
print('Yes')
elif s[1]=='q' and s[2]=='p':
print('Yes'... | s489941984 | Accepted | 32 | 4,724 | 146 | dict={'b':'d','d':'b','p':'q','q':'p'}
s= input()
t=''.join(map(lambda x: dict[x],list(s[::-1])))
if s==t:
print("Yes")
else :
print("No") |
s947098052 | p03457 | u933622697 | 2,000 | 262,144 | Wrong Answer | 317 | 3,060 | 197 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | n = int(input())
for i in range(n):
t, x, y = map(int, input().split()) # input() when you access each trial
if x + y < t or (x + y + t) % 2:
print("No")
exit()
print("Yes") | s785750589 | Accepted | 329 | 3,060 | 174 | n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if t < x + y or t % 2 != (x + y) % 2:
print("No")
exit()
print("Yes") |
s832854624 | p02694 | u827553608 | 2,000 | 1,048,576 | Wrong Answer | 168 | 9,192 | 122 | 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... | try:
x=int(input())
o=100
count=0
while int(o)!=x:
o=o+(o*(1/100))
print(o)
count+=1
print(count)
except:
pass | s321023539 | Accepted | 22 | 9,164 | 110 | try:
x=int(input())
o=100
count=0
while o<x:
o=int(o+(o*(1/100)))
count+=1
print(count)
except:
pass |
s449676898 | p03962 | u917558625 | 2,000 | 262,144 | Wrong Answer | 24 | 9,188 | 158 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | a=list(map(int,input().split()))
a.sort()
if a[0]==a[1]==a[2]:
print(1)
else:
if a[0]==a[1] or a[1]==a[2] or a[2]==a[0]:
print(2)
else:
print(1) | s286476646 | Accepted | 28 | 9,180 | 158 | a=list(map(int,input().split()))
a.sort()
if a[0]==a[1]==a[2]:
print(1)
else:
if a[0]==a[1] or a[1]==a[2] or a[2]==a[0]:
print(2)
else:
print(3) |
s352499178 | p02613 | u689710606 | 2,000 | 1,048,576 | Wrong Answer | 149 | 9,192 | 334 | 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 i in range(n):
s = input()
if s == "AC":
c0 += 1
elif s == "WA":
c1 += 1
elif s == "TLE":
c2 += 1
elif s == "RE":
c3 += 1
else:
exit()
print(f"AC × {c0}")
print(f"WA × {c1}")
print(f"TLE × {c2}")
print(f"RE... | s065802632 | Accepted | 144 | 9,048 | 330 | n = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for i in range(n):
s = input()
if s == "AC":
c0 += 1
elif s == "WA":
c1 += 1
elif s == "TLE":
c2 += 1
elif s == "RE":
c3 += 1
else:
exit()
print(f"AC x {c0}")
print(f"WA x {c1}")
print(f"TLE x {c2}")
print(f"RE... |
s183415211 | p03470 | u830462928 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 84 | 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())
l = []
for i in range(0, n):
l.append(int(input()))
len(set(l)) | s865170047 | Accepted | 17 | 2,940 | 91 | n = int(input())
l = []
for i in range(0, n):
l.append(int(input()))
print(len(set(l))) |
s827771762 | p03544 | u518455500 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | n = int(input())
l0 = 2
l1 = 1
li = 0
for i in range(2,n):
li = l0 + l1
l0 = l1
l1 = li
print(li) | s728350404 | Accepted | 17 | 2,940 | 177 | n = int(input())
l0 = 2
l1 = 1
li = 0
if n == 0:
print(l0)
elif n == 1:
print(l1)
else:
for i in range(2,n+1):
li = l0 + l1
l0 = l1
l1 = li
print(li)
|
s536941921 | p03163 | u437727817 | 2,000 | 1,048,576 | Wrong Answer | 243 | 15,508 | 300 | 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 ... | import numpy as np
n,w = map(int,input().split())
WV = [list(map(int,input().split()))for _ in range(n)]
dp = np.zeros(w+1,int)
for i in range(n):
W,V = WV[i]
#print(str(dp)+":"+str(dp[W:])+":"+str(dp[:-W]))
dp[W:] = np.maximum(dp[W:],dp[:-W]+V)
print(str(dp))
print(dp[-1])
| s802561193 | Accepted | 220 | 15,464 | 300 | import numpy as np
n,w = map(int,input().split())
WV = [list(map(int,input().split()))for _ in range(n)]
dp = np.zeros(w+1,int)
for i in range(n):
W,V = WV[i]
#print(str(dp)+":"+str(dp[W:])+":"+str(dp[:-W]))
dp[W:] = np.maximum(dp[W:],dp[:-W]+V)
#print(str(dp))
print(dp[-1]) |
s133846910 | p03854 | u797798686 | 2,000 | 262,144 | Wrong Answer | 89 | 9,300 | 778 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | from sys import stdin
data = stdin.readline().rstrip()
def shorten_phrase(x):
l = len(x)
if x.startswith("eraser"):
x = x[6:]
elif x.startswith("erase"):
x = x[5:]
elif x.startswith("dreamera"):
x = x[5:]
elif x.startswith("dreamer"):
x = x[7:]
elif x.startswith(... | s533610972 | Accepted | 86 | 9,056 | 766 | from sys import stdin
data = stdin.readline().rstrip()
def shorten_phrase(x):
l = len(x)
if x.startswith("eraser"):
x = x[6:]
elif x.startswith("erase"):
x = x[5:]
elif x.startswith("dreamera"):
x = x[5:]
elif x.startswith("dreamer"):
x = x[7:]
elif x.startswith(... |
s691094972 | p01085 | u105296105 | 8,000 | 262,144 | Wrong Answer | 130 | 5,628 | 329 | The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. The successful applicants of the examination are chosen as follows. * The score of any successful applicant is higher than that of ... | import sys
while True:
m, nmin, nmax = [int(i) for i in input().split()]
if m == 0:
sys.exit()
p = [int(input()) for i in range(m)]
ansnum = 1000000
ans = 0
for i in range(nmin-1,nmax):
if ansnum >= p[i]-p[i+1]:
ans = i
ansnum = min(ansnum,p[i]-p[i+1])
pri... | s954885269 | Accepted | 120 | 5,640 | 409 | import sys
anslist = []
while True:
m, nmin, nmax = [int(i) for i in input().split()]
if m == 0:
for i in anslist:
print(i)
sys.exit()
p = [int(input()) for i in range(m)]
ansnum = 0
ans = 0
for i in range(nmin-1,nmax):
if ansnum <= p[i]-p[i+1] and not p[i]-p[... |
s604062312 | p04043 | u396858476 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 327 | 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 ... | a, b, c = map(int, input().split())
if a == b and a == 5:
if c == 7:
print("Yes")
else:
print("No")
elif b == c and b == 5:
if a == 7:
print("Yes")
else:
print("No")
elif a == c and c == 5:
if b == 7:
print("Yes")
else:
print("No")
else:
print... | s759324128 | Accepted | 17 | 3,060 | 327 | a, b, c = map(int, input().split())
if a == b and a == 5:
if c == 7:
print("YES")
else:
print("NO")
elif b == c and b == 5:
if a == 7:
print("YES")
else:
print("NO")
elif a == c and c == 5:
if b == 7:
print("YES")
else:
print("NO")
else:
print... |
s705297988 | p03130 | u782098901 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 531 | There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roa... | ab = [[], [], [], [], []]
for i in range(3):
a, b = map(int, input().split())
ab[a].append(b)
ab[b].append(a)
ways = [False] * 4
def f(now, count):
if count > 4:
return False
for n in ab[now]:
if ways[n - 1]:
continue
ways[n - 1] = True
if all(ways):
... | s567491016 | Accepted | 18 | 2,940 | 183 | c = [0] * 5
for _ in range(3):
a, b = map(int, input().split())
c[a] += 1
c[b] += 1
for i in range(1, 5):
if c[i] > 2:
print("NO")
exit()
print("YES")
|
s316782358 | p03006 | u945418216 | 2,000 | 1,048,576 | Wrong Answer | 175 | 3,316 | 379 | There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i). We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation: * Choose a ball remaining in the plane and collect it. Let (a, b) be the coordinat... | N = int(input())
XY = sorted([list(map(int,input().split())) for _ in range(N)])
PQ = []
for i in range(N):
prev = XY[i]
for j in range(N):
if i==j: continue
next = XY[j]
p = next[0] - prev[0]
q = next[1] - prev[1]
PQ.append([p,q])
ans = 0
for pq in PQ:
ans = max(a... | s224702804 | Accepted | 168 | 3,316 | 400 | N = int(input())
XY = sorted([list(map(int,input().split())) for _ in range(N)])
PQ = []
for i in range(N):
prev = XY[i]
for j in range(N):
if i!=j:
next = XY[j]
p = next[0] - prev[0]
q = next[1] - prev[1]
PQ.append((p,q))
ans = 1
for pq in PQ:
ans ... |
s179511175 | p03575 | u887207211 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 391 | You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ... | N, M = map(int,input().split())
v = [i for i in range(1,N+1)]
e = [[]]*(N+1)
for i in range(M):
a, b = map(int,input().split())
e[a] = e[a] + [b]
e[b] = e[b] + [a]
def dfs(v, e):
for num in v:
if(len(e[num]) == 1):
tmp_num = e[num][0]
v.remove(num)
e[num] = []
e[tmp_num].remove(num... | s506435017 | Accepted | 17 | 3,064 | 362 | N, M = map(int,input().split())
v = list(range(1,N+1))
edges = [[] for _ in range(N+1)]
for _ in range(M):
a, b = map(int,input().split())
edges[a] += [b]
edges[b] += [a]
def dfs(v, e):
for x in v:
if(len(e[x]) == 1):
t = e[x][0]
e[x] = []
e[t].remove(x)
v.remove(x)
return df... |
s855840218 | p03401 | u422552722 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,176 | 399 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | n = int(input())
a = list(map(int, input().split(" ")))
print(n, a)
if n == 2:
print(abs(a[0]) + abs(a[0]-a[1]) + abs(a[1]))
else:
for i in range(len(a)):
b = a[:]
b.remove(b[i])
#print(b)
cost = abs(b[0])
for j in range(len(b)-1):
#print(b[j],b[j+1])
... | s490068071 | Accepted | 219 | 14,048 | 262 | n = int(input())
a = list(map(int, input().split(" ")))
a.insert(0,0)
a.append(0)
total = 0
for i in range(len(a)-1):
total += abs(a[i] - a[i+1])
for j in range(1, len(a)-1):
print(total - abs(a[j-1] - a[j]) - abs(a[j] - a[j+1]) + abs(a[j+1]- a[j-1])) |
s894090473 | p03607 | u513900925 | 2,000 | 262,144 | Wrong Answer | 251 | 10,488 | 360 | You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many... | N = int(input())
A = list(int(input()) for _ in range(N))
A.sort()
print(A)
count = 0
test = -1
stack = 0
for i in range(N):
if test != A[i]:
count += 1
stack = 1
test = A[i]
else:
if stack == 1:
count = count - 1
stack = 0
else:
stack ... | s074456891 | Accepted | 243 | 7,400 | 351 | N = int(input())
A = list(int(input()) for _ in range(N))
A.sort()
count = 0
test = -1
stack = 0
for i in range(N):
if test != A[i]:
count += 1
stack = 1
test = A[i]
else:
if stack == 1:
count = count - 1
stack = 0
else:
stack = 1
... |
s878437593 | p03854 | u502721867 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 161 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s = input()
s = s.replace("erase","").replace("eraser","").replace("dream","").replace("dreamer","")
print(s)
if s !="":
print("No")
else:
print("Yes") | s218118702 | Accepted | 26 | 6,516 | 164 | import re
s = input()
p = re.compile(r'^(dream|dreamer|erase|eraser)*(dream|dreamer|erase|eraser)$')
x = p.search(s)
if x :
print("YES")
else:
print("NO") |
s087926605 | p03855 | u677523557 | 2,000 | 262,144 | Wrong Answer | 1,291 | 79,780 | 2,785 | There are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities. No two roads connect the same pair of cities. Similarly, no two railways connect the s... | from operator import itemgetter
import sys
input = sys.stdin.readline
N, K, L = map(int, input().split())
PQ = [list(map(int, input().split())) for _ in range(K)]
RS = [list(map(int, input().split())) for _ in range(L)]
class UnionFind():
def __init__(self, n):
self.n = n
... | s733956797 | Accepted | 1,201 | 44,572 | 1,609 | class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def Find_Root(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
... |
s066686017 | p03110 | u211160392 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 236 | 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())
x = []
u = []
Y = 0
for i in range(N):
s = [i for i in input().split()]
print(s)
x.append(float(s[0]))
u.append(s[1])
if u[i] == 'BTC':
Y += x[i]*380000
else:
Y += x[i]
print(Y) | s008883363 | Accepted | 19 | 3,060 | 223 | N = int(input())
x = []
u = []
Y = 0
for i in range(N):
s = [i for i in input().split()]
x.append(float(s[0]))
u.append(s[1])
if u[i] == 'BTC':
Y += x[i]*380000
else:
Y += x[i]
print(Y) |
s405617852 | p03563 | u045408189 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | r=float(input())
g=float(input())
print(2*g-r) | s835519223 | Accepted | 19 | 2,940 | 52 | r=float(input())
g=float(input())
print(int(2*g-r))
|
s080051567 | p03854 | u060736237 | 2,000 | 262,144 | Wrong Answer | 36 | 5,108 | 887 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | def main():
s = input()
dream = 0
erase = 1
work = []
temp1 = 0
temp2 = 0
kind = -1
append = work.append
for c in s:
if c == 'd':
if kind != -1:
append([kind, temp2-temp1])
kind = dream
temp1 = temp2
elif c == 's':
... | s010213438 | Accepted | 38 | 5,108 | 887 | def main():
s = input()
dream = 0
erase = 1
work = []
temp1 = 0
temp2 = 0
kind = -1
append = work.append
for c in s:
if c == 'd':
if kind != -1:
append([kind, temp2-temp1])
kind = dream
temp1 = temp2
elif c == 's':
... |
s044386462 | p03693 | u757324869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | p = input().split()
s = int(p[0] + p[1] + p[2])
print(s)
if s % 4 == 0:
print("YES")
else:
print("NO") | s721491366 | Accepted | 17 | 2,940 | 113 | p = input().split()
s = int(p[0])*100 + int(p[1])*10 + int(p[2])
if s % 4 == 0:
print("YES")
else:
print("NO") |
s863919733 | p02613 | u437351386 | 2,000 | 1,048,576 | Wrong Answer | 146 | 16,312 | 213 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n=int(input())
s=[]
for i in range(n):
s.append(input())
print("AC"+" × "+str(s.count("AC")))
print("WA"+" × "+str(s.count("WA")))
print("TLE"+" × "+str(s.count("TLE")))
print("RE"+" × "+str(s.count("RE")))
| s929212396 | Accepted | 147 | 16,280 | 208 | n=int(input())
s=[]
for i in range(n):
s.append(input())
print("AC"+" x "+str(s.count("AC")))
print("WA"+" x "+str(s.count("WA")))
print("TLE"+" x "+str(s.count("TLE")))
print("RE"+" x "+str(s.count("RE"))) |
s615493984 | p03228 | u167908302 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 184 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | #coding:utf-8
a, b, k = map(int, input().split())
for i in range(0, k):
if i % 2 == 0:
b += a // 2
a /= 2
else:
a += b // 2
b /= 2
print(a, b) | s039091479 | Accepted | 18 | 2,940 | 192 | #coding:utf-8
a, b, k = map(int, input().split())
for i in range(0, k):
if i % 2 == 0:
b += a // 2
a = a // 2
else:
a += b // 2
b = b // 2
print(a, b) |
s759317519 | p03385 | u513081876 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | S = list(map(str, input()))
if S.sort() == ['a', 'b', 'c']:
print('Yes')
else:
print('No') | s726925201 | Accepted | 17 | 2,940 | 82 | S = list(input())
if len(S) == len(set(S)):
print('Yes')
else:
print('No') |
s458621942 | p03448 | u787059958 | 2,000 | 262,144 | Wrong Answer | 56 | 3,316 | 368 | 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())
la=[]
for a in range(A+1):
la.append(a)
lb=[]
for b in range(B+1):
lb.append(b)
lc=[]
for c in range(C+1):
lc.append(c)
count=0
for i in range(A):
for j in range(B):
for p in range(C):
if(500*la[i]+100*lb[j]+50*... | s064538804 | Accepted | 54 | 3,060 | 217 | 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 p in range(C+1):
if(10*i+2*j+p==x/50):
count+=1
print(count) |
s309836470 | p03401 | u583010173 | 2,000 | 262,144 | Wrong Answer | 275 | 14,048 | 427 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | # -*- coding: utf-8 -*-
n = int(input())
spot = [int(x) for x in input().split()]
spot = [0] + spot + [0]
print(spot)
cost = 0
for i in range(len(spot)-1):
cost += abs(spot[i] - spot[i+1])
#print(cost)
change = 0
for k in range(len(spot)-2):
if (spot[k+1]-spot[k])*(spot[k+2]-spot[k+1]) >= 0:
change = 0... | s172857646 | Accepted | 260 | 14,172 | 402 | # -*- coding: utf-8 -*-
n = int(input())
spot = [int(x) for x in input().split()]
spot = [0] + spot + [0]
cost = 0
for i in range(len(spot)-1):
cost += abs(spot[i] - spot[i+1])
change = 0
for k in range(len(spot)-2):
if (spot[k+1]-spot[k])*(spot[k+2]-spot[k+1]) >= 0:
change = 0
else:
change... |
s029716988 | p03645 | u193264896 | 2,000 | 262,144 | Wrong Answer | 367 | 50,096 | 499 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... | import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N, M = map(int, readline().split())
path = [[] for _ in range(N+1)]
for _ in range(M):
a,b = map(int, readline().split())
path[a].append(b)
path[b].appen... | s330013978 | Accepted | 406 | 48,648 | 461 | import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N, M = map(int, readline().split())
path = [[] for _ in range(N+1)]
for _ in range(M):
a,b = map(int, readline().split())
path[a].append(b)
path[b].appen... |
s402091359 | p02261 | u963402991 | 1,000 | 131,072 | Wrong Answer | 30 | 7,736 | 758 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... | # -*- coding:utf-8 -*-
def Selection_Sort(A,n):
for i in range(n):
mini = i
for j in range(i,n):
if int(A[j][1]) < int(A[mini][1]):
mini = j
if A[i] != A[mini]:
A[i], A[mini] = A[mini], A[i]
return A
def Bubble_Sort(A, n):
for i in range... | s318521388 | Accepted | 20 | 7,808 | 741 | # -*- coding:utf-8 -*-
def Selection_Sort(A,n):
for i in range(n):
mini = i
for j in range(i,n):
if int(A[j][1]) < int(A[mini][1]):
mini = j
if A[i] != A[mini]:
A[i], A[mini] = A[mini], A[i]
return A
def Bubble_Sort(A, n):
for i in range... |
s873497185 | p03671 | u703890795 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | 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())
print(max(a+b, b+c, c+a)) | s004110066 | Accepted | 17 | 2,940 | 61 | a, b, c = map(int, input().split())
print(min(a+b, b+c, c+a)) |
s733230351 | p03730 | u103099441 | 2,000 | 262,144 | Wrong Answer | 21 | 3,188 | 304 | 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())
z = float('inf')
n = int(a / b) + 1
flag = False
while True:
x, y = divmod(n * b + c, a)
if not x:
flag = True
break
elif y >= z:
break
else:
n += 1
z = min(z, y)
if flag:
print('YES')
else:
print('NO') | s673465606 | Accepted | 17 | 3,060 | 231 | a, b, c = map(int, input().split())
n = max(int(b / a), 1)
p = 'NO'
s = set()
r = n * a % b
while r not in s:
if r == c:
p = 'YES'
break
else:
s.add(r)
n += 1
r = n * a % b
print(p)
|
s003968299 | p03695 | u405779580 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 255 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | N =int(input())
scores = [int(i)//400 for i in input().split()]
d = [0]*10
for s in scores:
if s > 7:
s = 8
d[s] = d[s] + 1
print(d)
if any(d[:8]):
m = [bool(i) for i in d[:8]].count(True)
else:
m = 1
M = min(8, m+d[8])
print(m, M) | s965418984 | Accepted | 21 | 3,316 | 185 | from collections import Counter
input()
c = Counter([min(int(i)//400,8) for i in input().split()])
lt3200 = [bool(c[i]) for i in range(8)].count(True)
print(max(1, lt3200), lt3200+c[8]) |
s273065193 | p03547 | u614734359 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,... | x,y = input().split()
if x>y: print(x)
else: print(y) | s264970798 | Accepted | 17 | 2,940 | 78 | x,y = input().split()
if x>y: print('>')
elif x<y: print('<')
else: print('=') |
s016981737 | p03795 | u454866339 | 2,000 | 262,144 | Wrong Answer | 29 | 8,984 | 52 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | N = 60
x = 800 * N
y = 200 * (N // 15)
print(x - y) | s953093466 | Accepted | 27 | 9,096 | 77 | N = int(input())
x = int(800 * N)
y = int(200 * (N // 15))
print(int(x - y)) |
s069613034 | p04045 | u632369368 | 2,000 | 262,144 | Wrong Answer | 24 | 3,700 | 290 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | import itertools
N, K = [int(s) for s in input().split()]
D = [int(s) for s in input().split()]
U = [str(n) for n in range(10) if n not in D]
ret = N * 10
for v in [int(''.join(T)) for T in itertools.product(U, repeat=4)]:
print(v)
if N <= v:
ret = min(ret, v)
print(ret)
| s628513182 | Accepted | 180 | 3,572 | 230 | from functools import reduce
N, _ = [int(s) for s in input().split()]
D = [s for s in input().split()]
R = N
while True:
if reduce(lambda x, y: x and y, [s not in D for s in list(str(R))]):
break
R += 1
print(R)
|
s356534286 | p03712 | u403551852 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 190 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | h,w = map(int,input().split())
aa = [input() for _ in range(h)]
print(aa)
for i in range(h+2):
if i == 0 or i == h+1:
print('#'*(w+2))
else:
print('#'+aa[i-1]+'#')
| s702678584 | Accepted | 17 | 3,060 | 180 | h,w = map(int,input().split())
aa = [input() for _ in range(h)]
for i in range(h+2):
if i == 0 or i == h+1:
print('#'*(w+2))
else:
print('#'+aa[i-1]+'#')
|
s663757566 | p02413 | u216425054 | 1,000 | 131,072 | Wrong Answer | 20 | 7,624 | 238 | Your task is to perform a simple table calculation. Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column. | r,c=[int(x) for x in input().split()]
s_row=[0 for x in range(c+1)]
for i in range(r):
row=[int(x) for x in input().split()]
row.append(sum(row))
print(" ".join([str(x) for x in row]))
s_row=[x+y for x,y in zip(s_row,row)] | s297476583 | Accepted | 30 | 7,736 | 279 | r,c=[int(x) for x in input().split()]
s_row=[0 for x in range(c+1)]
for i in range(r):
row=[int(x) for x in input().split()]
row.append(sum(row))
print(" ".join([str(x) for x in row]))
s_row=[x+y for x,y in zip(s_row,row)]
print(" ".join([str(x) for x in s_row])) |
s491044473 | p03377 | u816376170 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | 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 = input().split()
if int(a[0])<int(a[2]) and int(a[0])+int(a[1])>int(a[2]):
print("yes")
else:
print("no") | s056235433 | Accepted | 17 | 2,940 | 115 | a = input().split()
if int(a[0])<=int(a[2]) and int(a[0])+int(a[1])>=int(a[2]):
print("YES")
else:
print("NO") |
s015910872 | p02261 | u209358977 | 1,000 | 131,072 | Wrong Answer | 20 | 7,564 | 1,425 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... | # -*- coding: utf-8 -*-
def conv_input(arr):
ret = []
for e in arr:
ret.append((e[0], int(e[1])))
return ret
def conv_output(conv_arr):
ret = []
for e in conv_arr:
ret.append(e[0] + str(e[1]))
return ret
def is_stable(arr1, arr2):
ret = 'Stable'
for a1, a2 in zip(ar... | s315645120 | Accepted | 30 | 7,768 | 1,425 | # -*- coding: utf-8 -*-
def conv_input(arr):
ret = []
for e in arr:
ret.append((e[0], int(e[1])))
return ret
def conv_output(conv_arr):
ret = []
for e in conv_arr:
ret.append(e[0] + str(e[1]))
return ret
def is_stable(arr1, arr2):
ret = 'Stable'
for a1, a2 in zip(ar... |
s777274673 | p03478 | u825440127 | 2,000 | 262,144 | Wrong Answer | 34 | 2,940 | 144 | 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 i in range(1, n+1):
if a <= sum([int(c) for c in str(i)]) <= b:
ans += 1
print(ans)
| s800420435 | Accepted | 32 | 2,940 | 144 | n, a, b= map(int, input().split())
ans = 0
for i in range(1, n+1):
if a <= sum([int(c) for c in str(i)]) <= b:
ans += i
print(ans)
|
s955401192 | p03680 | u626337957 | 2,000 | 262,144 | Wrong Answer | 237 | 7,080 | 262 | 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())
nums = [0]
for _ in range(N):
nums.append(int(input()))
check_cnt = 1
_next = nums[1]
while True:
if check_cnt >= N:
break
else:
if next == 2:
print(check_cnt)
exit()
_next = nums[_next]
check_cnt += 1
print(-1) | s443432025 | Accepted | 204 | 7,080 | 264 | N = int(input())
nums = [0]
for _ in range(N):
nums.append(int(input()))
check_cnt = 1
_next = nums[1]
while True:
if check_cnt >= N:
break
else:
if _next == 2:
print(check_cnt)
exit()
_next = nums[_next]
check_cnt += 1
print(-1)
|
s234504789 | p03694 | u672898046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along _TopCoDeer street_. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can star... | s = list(map(int, input().split()))
print(max(s)-min(s)) | s623879675 | Accepted | 18 | 2,940 | 73 | n = int(input())
s = list(map(int, input().split()))
print(max(s)-min(s)) |
s124491327 | p03131 | u349444371 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 220 | 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 b<a+2:
print(1+k)
else:
if k<=a:
print(1+k)
else:
if (k-a-1)%2!=0:
print(b+(b-a)*(k-a-1)//2+1)
else:
print(b+(b-a)*(k-a-1)//2) | s728322944 | Accepted | 17 | 3,060 | 224 | k,a,b=map(int,input().split())
if b<a+2:
print(1+k)
else:
if k<=a:
print(1+k)
else:
if (k-a-1)%2==0:
print(b+(b-a)*((k-a-1)//2))
else:
print(b+(b-a)*((k-a-1)//2)+1) |
s976783226 | p02613 | u166057331 | 2,000 | 1,048,576 | Wrong Answer | 162 | 9,152 | 283 | 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 i in range(0,N):
S = str(input())
if S == 'AC':
C0 += 1
elif S == 'WA':
C1 += 1
elif S == 'TLE':
C2 += 1
elif S == 'RE':
C3 += 1
print('AC ×',C0)
print('WA ×',C1)
print('TLE ×',C2)
print('RE ×',C3) | s973211983 | Accepted | 160 | 9,136 | 284 | N = int(input())
C0 = 0
C1 = 0
C2 = 0
C3 = 0
for i in range(0,N):
S = str(input())
if S == 'AC':
C0 += 1
elif S == 'WA':
C1 += 1
elif S == 'TLE':
C2 += 1
elif S == 'RE':
C3 += 1
print('AC x',C0)
print('WA x',C1)
print('TLE x',C2)
print('RE x',C3)
|
s701764160 | p04043 | u433559751 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 114 | 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 ... | N = list(map(int, input().split(" ")))
if N.count(5) == 2 and N.count(7) == 1:
print('Yes')
else:
print('No') | s097102202 | Accepted | 17 | 2,940 | 114 | N = list(map(int, input().split(" ")))
if N.count(5) == 2 and N.count(7) == 1:
print('YES')
else:
print('NO') |
s224728240 | p00007 | u298999032 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 105 | Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. | x=100000
n=int(input())
for i in range(n):
x*=1.05
if x%1000!=0:
x+=1000-x%1000
print(x)
| s970391000 | Accepted | 20 | 5,604 | 106 | x=100000
for i in range(int(input())):
x*=1.05
if x%1000!=0:
x+=1000-x%1000
print(int(x))
|
s003157769 | p03643 | u268792407 | 2,000 | 262,144 | Wrong Answer | 152 | 12,476 | 70 | 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())
from numpy import log
print(pow(2,int(log(n)/log(2))))
| s719359982 | Accepted | 17 | 2,940 | 20 | print("ABC"+input()) |
s187722405 | p03544 | u698567423 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 92 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | n = int(input())
lf = 2
ls = 1
for _ in range(n-1):
lf, ls = ls, lf + ls
print(ls)
| s212829865 | Accepted | 17 | 2,940 | 89 | n = int(input())
lf = 2
ls = 1
for _ in range(n-1):
lf, ls = ls, lf + ls
print(ls)
|
s825003527 | p03643 | u886655280 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 499 | 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. | input = int(input())
input_list = list(range(1, input + 1))
count_list = []
for e in input_list:
count = 0
e_tmp = e
while True:
if e_tmp % 2 == 0:
e_tmp = e_tmp/2
count += 1
else:
break
count_list.append([e, count])
max_value = 0
max_key = 0
for ... | s032271490 | Accepted | 18 | 2,940 | 92 |
N = input()
ans = 'ABC' + N
print(ans) |
s229669238 | p02613 | u048013400 | 2,000 | 1,048,576 | Wrong Answer | 150 | 16,488 | 215 | 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`,... | from collections import Counter
N = int(input())
S = [input() for i in range(N)]
s = Counter(S)
print('AC×'+ str(s['AC']))
print('WA×' + str(s['WA']))
print('TLE×' + str(s['TLE']))
print('RE×' + str(s['RE'])) | s153503446 | Accepted | 143 | 16,520 | 250 | from collections import Counter
N = int(input())
S = [input() for i in range(N)]
s = Counter(S)
print('AC x ',end='')
print(s['AC'])
print('WA x ', end='')
print(s['WA'])
print('TLE x ',end='')
print(s['TLE'])
print('RE x ', end='')
print(s['RE']) |
s480401316 | p03472 | u356608129 | 2,000 | 262,144 | Wrong Answer | 391 | 12,244 | 506 | 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 sys
(N, H) = tuple(map(int, input().split(" ")))
a = []
b = []
result = -1
for i in range(N):
(ai,bi) = tuple(map(int, input().split(" ")))
a.append(ai)
b.append(bi)
a_max = max(a)
sorted(b).reverse()
b_length = len(b)
for i, bi in enumerate(b):
if bi < a_max:
b_length = i
S = 0
fo... | s153656361 | Accepted | 393 | 11,512 | 531 | import sys
import math
(N, H) = tuple(map(int, input().split(" ")))
a = []
b = []
result = 0
for i in range(N):
(ai,bi) = tuple(map(int, input().split(" ")))
a.append(ai)
b.append(bi)
a_max = max(a)
b.sort()
b.reverse()
b_length = len(b)
for i, bi in enumerate(b):
if bi < a_max:
b_length = ... |
s283160489 | p03379 | u764956288 | 2,000 | 262,144 | Wrong Answer | 314 | 25,620 | 173 | 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())
As = list(map(int, input().split()))
As.sort()
left = As[n//2 - 1]
right = As[n//2]
for x in As:
if x <= left:
print(right)
else:
print(left) | s040512014 | Accepted | 307 | 25,556 | 179 | n = int(input())
As = list(map(int, input().split()))
Xs = sorted(As)
left = Xs[n//2 - 1]
right = Xs[n//2]
for x in As:
if x <= left:
print(right)
else:
print(left) |
s181072385 | p03798 | u432042540 | 2,000 | 262,144 | Wrong Answer | 161 | 4,212 | 702 | Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered... | n = int(input())
s = input()
a = False
b = False
sw = [None] * n
sw[0] = False
sw[1] = False
def next(s,sw,i,j):
if s[i] == 'o':
return not (sw[j] ^ sw[i])
else:
return sw[j] ^ sw[i]
def printsw(sw,n):
s = ''
for i in range(n):
if sw[i]:
s += 'S'
else:
... | s710981000 | Accepted | 186 | 4,212 | 701 | n = int(input())
s = input()
a = False
b = False
sw = [None] * n
sw[0] = True
sw[1] = True
def next(s,sw,j,i):
if s[i] == 'o':
return not (sw[j] ^ sw[i])
else:
return sw[j] ^ sw[i]
def printsw(sw,n):
s = ''
for i in range(n):
if sw[i]:
s += 'S'
else:
... |
s522700119 | p03493 | u425177436 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 47 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | print(list(map(int, input().split())).count(1)) | s290064136 | Accepted | 17 | 2,940 | 45 | print(list(map(int, list(input()))).count(1)) |
s062041733 | p03679 | u063052907 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 117 | 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... | #coding: utf-8
X, A, B = map(int, input().split())
print(["delicious", "safe", "dangerous"][(A > B) + (A + X < B) ])
| s965355673 | Accepted | 17 | 2,940 | 115 | #coding: utf-8
X, A, B = map(int, input().split())
print(["delicious", "safe", "dangerous"][(A < B) + (A + X < B)]) |
s460403208 | p03486 | u623687794 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 357 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s=input()
t=input()
schar=[]
tchar=[]
for i in range(len(s)):
schar.append(ord(s[i]))
for i in range(len(t)):
tchar.append(ord(t[i]))
schar.sort()
tchar.sort(reverse=True)
flag=0
for i in range(min(len(s),len(t))):
if schar[i]>tchar[i]:
flag=1
break
if flag==1:
print("No")
else:
if len(s)>=len(t):
... | s574517849 | Accepted | 18 | 3,064 | 458 | s=input()
t=input()
schar=[]
tchar=[]
for i in range(len(s)):
schar.append(ord(s[i]))
for i in range(len(t)):
tchar.append(ord(t[i]))
schar.sort()
tchar.sort(reverse=True)
flag=0
for i in range(min(len(s),len(t))):
if schar[i]==tchar[i]:
continue
elif schar[i]>tchar[i]:
flag=1
break
else:
flag... |
s700154241 | p02608 | u119015607 | 2,000 | 1,048,576 | Wrong Answer | 992 | 9,252 | 293 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | n = int(input())
ans = [0 for i in range(10001)]
for i in range(105):
for j in range(105):
for m in range(105):
v = i**2+j**2+m**2+i*j+j*m+m*i
#print(v)
if v<10001:
ans[v]+=1
#print(count)
for i in range(n):
print(ans[i+1]) | s224486696 | Accepted | 1,004 | 9,312 | 300 | n = int(input())
ans = [0 for i in range(10001)]
for i in range(1,105):
for j in range(1,105):
for m in range(1,105):
v = i**2+j**2+m**2+i*j+j*m+m*i
#print(v)
if v<10001:
ans[v]+=1
#print(count)
for i in range(n):
print(ans[i+1])
|
s395699444 | p03605 | u806403461 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | N = str(input())
for a in N:
if a == '9':
print('Yes')
else:
print('No')
| s004175409 | Accepted | 18 | 2,940 | 134 | N = str(input())
ans = 'No'
for a in N:
if a == '9':
ans = 'Yes'
break
else:
ans = 'No'
print(ans)
|
s182757548 | p03854 | u998082063 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 143 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s = input().replace("eracer", "").replace("erace", "").replace("dreamer", "").replace("dream", "")
if s:
print("NO")
else:
print("YES") | s444812039 | Accepted | 18 | 3,188 | 143 | s = input().replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")
if s:
print("NO")
else:
print("YES") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.