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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s003824747 | p02936 | u111392182 | 2,000 | 1,048,576 | Wrong Answer | 1,471 | 27,504 | 261 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | n,q = list(map(int,input().split()))
r = [0]*n
ans = [0]*n
for i in range(n-1):
a,b = list(map(int,input().split()))
r[b-1] = a-1
for j in range(q):
p,x = list(map(int,input().split()))
ans[p-1] += x
for k in range(1,n):
ans[k] += ans[r[k]]
print(ans) | s072675240 | Accepted | 1,808 | 55,828 | 360 | n,q = map(int,input().split())
g=[[] for _ in range(n)]
ans = [0]*n
for i in range(n-1):
a,b=map(int,input().split())
g[a-1].append(b-1)
g[b-1].append(a-1)
for j in range(q):
p,x = list(map(int,input().split()))
ans[p-1] += x
f=[1]*n
t=[0]
while t:
v=t.pop()
f[v]=0
for k in g[v]:
if f[k]:
ans[... |
s121623413 | p03436 | u207799478 | 2,000 | 262,144 | Wrong Answer | 30 | 3,832 | 1,596 | We have an H \times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j). Snuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player re... | import math
import string
import collections
from collections import Counter
from collections import deque
def readints():
return list(map(int, input().split()))
def nCr(n, r):
return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
def has_duplicates2(seq):
seen = []
for item in seq:
... | s748168855 | Accepted | 29 | 3,832 | 1,681 | import math
import string
import collections
from collections import Counter
from collections import deque
def readints():
return list(map(int, input().split()))
def nCr(n, r):
return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
def has_duplicates2(seq):
seen = []
for item in seq:
... |
s848379520 | p02678 | u076245995 | 2,000 | 1,048,576 | Wrong Answer | 799 | 69,900 | 602 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import defaultdict
from collections import deque
N, M = map(int,input().split())
sign = defaultdict(set)
for i in range(M):
A_i, B_i = map(int, input().split())
sign[A_i].add(B_i)
sign[B_i].add(A_i)
seen = [False for _ in range(N)]
cost = [0 for _ in range(N)]
ans = [0 for _ in range(N)]
... | s704743241 | Accepted | 845 | 68,776 | 535 | from collections import defaultdict
from collections import deque
N, M = map(int, input().split())
route = defaultdict(set)
for i in range(M):
A_i, B_i = map(int, input().split())
route[A_i].add(B_i)
route[B_i].add(A_i)
q = deque()
q.append(1)
seen = [-1] * (N + 1)
seen[0], seen[1] = 0, 0
while len(q) > ... |
s951502026 | p03387 | u299801457 | 2,000 | 262,144 | Wrong Answer | 21 | 3,064 | 217 | 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 ... | a,b,c=list(map(int,input().split()))
mi=min([a,b,c])
ma=max([a,b,c])
mid=a+b+c-mi-ma
ans=0
if (mid-mi)%2==1:
ans+=1
ma+=1
mi+=1
ans+=(mid-mi)/2
ans+=ma-mid
else:
ans+=(mid-mi)/2
ans+=ma-mid
| s917018202 | Accepted | 17 | 3,064 | 234 | a,b,c=list(map(int,input().split()))
mi=min([a,b,c])
ma=max([a,b,c])
mid=a+b+c-mi-ma
ans=0
if (mid-mi)%2==1:
ans+=1
ma+=1
mi+=1
ans+=(mid-mi)/2
ans+=ma-mid
else:
ans+=(mid-mi)/2
ans+=ma-mid
print(int(ans))
|
s029385662 | p03435 | u957198490 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 252 | 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) ... | c = [list(map(int,input().split())) for _ in range(3)]
b = c[0]
a = [0]
for i in range(1,3):
a.append(c[i][i]-b[i])
for i in range(3):
for j in range(3):
if c[i][j] != a[i] + b[j]:
print('NO')
exit()
print('YES') | s119478946 | Accepted | 18 | 3,064 | 252 | c = [list(map(int,input().split())) for _ in range(3)]
b = c[0]
a = [0]
for i in range(1,3):
a.append(c[i][i]-b[i])
for i in range(3):
for j in range(3):
if c[i][j] != a[i] + b[j]:
print('No')
exit()
print('Yes') |
s409584928 | p03545 | u441191580 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 748 | 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... | x = input().split()
x = [int(i) for i in x]
xCount = len(x)
aaa = 0
for i in range(2**(xCount -1)):
binaryNumber = format(i,'b')
binaryNumber = binaryNumber.zfill(xCount-1)
binaryNumber = list(binaryNumber)
binaryNumber = [int(i) for i in binaryNumber]
for i in range(xCount-1):
if bina... | s579845607 | Accepted | 18 | 3,064 | 919 | x = input()
x = [int(i) for i in x]
xCount = len(x)
aaa = 0
for i in range(2**(xCount -1)):
binaryNumber = format(i,'b')
binaryNumber = binaryNumber.zfill(xCount-1)
binaryNumber = list(binaryNumber)
binaryNumber = [int(i) for i in binaryNumber]
for i in range(xCount-1):
if binaryNumber... |
s636546129 | p02603 | u723792785 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,140 | 94 | To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives. He is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the n... | _,*a=map(int,open(0).read().split());x=1000
for i,j in zip(a,a[1:]):
if j>i:x=x//i*j
print(x) | s027901247 | Accepted | 27 | 9,152 | 96 | _,*a=map(int,open(0).read().split());x=1000
for i,j in zip(a,a[1:]):x+=x//i*(j-i)*(j>i)
print(x) |
s281368711 | p02841 | u610387229 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 185 | In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019. Integers M_1, D_1, M_2, and D_2 will be given as input. It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1. Determine whether the date 2019-M_1-D_1 is the last day of a month. | def mainFunc():
m1, d1 = list(map(int, list(input().split(" "))))
m2, d2 = list(map(int, list(input().split(" "))))
ans = '1' if m1 == m2 else '0'
print(ans)
mainFunc() | s374621005 | Accepted | 17 | 2,940 | 185 | def mainFunc():
m1, d1 = list(map(int, list(input().split(" "))))
m2, d2 = list(map(int, list(input().split(" "))))
ans = '1' if m1 != m2 else '0'
print(ans)
mainFunc() |
s149540796 | p02865 | u941022948 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 71 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | a=int(input())
if a%2==0:
ans=(a/2)-1
else:
ans=a//2
print(ans) | s902749096 | Accepted | 17 | 2,940 | 76 | a=int(input())
if a%2==0:
ans=(a/2)-1
else:
ans=a//2
print(int(ans)) |
s459625745 | p03455 | u898042052 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | 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(i) for i in input().split())
if a % b == 0:
print("Even")
else:
print("Odd")
| s802538177 | Accepted | 17 | 2,940 | 102 | a, b = (int(i) for i in input().split())
if a * b % 2 == 0:
print("Even")
else:
print("Odd")
|
s026854563 | p02578 | u512623857 | 2,000 | 1,048,576 | Wrong Answer | 144 | 32,236 | 208 | 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 ... | #ABC177 C
N = int(input())
A = list(map(int,input().split()))
max = A[0]
F = [0]
for i in range(1,N):
if max > A[i]:
F.append(max - A[i])
else:
max = A[i]
F.append(0)
print(F)
print(sum(F))
| s539615331 | Accepted | 123 | 32,244 | 199 | #ABC177 C
N = int(input())
A = list(map(int,input().split()))
max = A[0]
F = [0]
for i in range(1,N):
if max > A[i]:
F.append(max - A[i])
else:
max = A[i]
F.append(0)
print(sum(F))
|
s664500198 | p03079 | u059210959 | 2,000 | 1,048,576 | Wrong Answer | 170 | 13,600 | 243 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | # encoding:utf-8
import copy
import numpy as np
import random
import bisect
a,b,c = map(int,input().split())
if (a==b and b ==c):
print("Yse")
else:
print("No")
| s509213563 | Accepted | 176 | 13,672 | 236 | # encoding:utf-8
import copy
import numpy as np
import random
import bisect
a,b,c = map(int,input().split())
if (a==b and b==c):
print("Yes")
else:
print("No")
|
s269279086 | p02414 | u017435045 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 361 | 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... | n, m, l = map(int, input().split())
a = []
b = []
for i in range(n):
a.append(list(map(int, input().split())))
for j in range(m):
b.append(list(map(int, input().split())))
c = [[0 for k in range(l)] for i in range(n)]
for i in range(n):
for k in range(l):
c[i][k]=sum([a[i][j]*b[j][k] for j in range... | s787398230 | Accepted | 130 | 7,008 | 232 | 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 j in range(m)]
[print(*x) for x in [[sum(j*k for j, k in zip(x, y)) for y in zip(*b)] for x in a]]
|
s060504478 | p02394 | u628732336 | 1,000 | 131,072 | Wrong Answer | 40 | 7,468 | 157 | Write a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given. | W, H, x, y, r = [int(1) for i in input().split()]
if x <= 0 or y <=0:
print("No")
elif W - x >= r and H - y >= r:
print("Yes")
else:
print("No") | s710374461 | Accepted | 20 | 7,716 | 149 | W, H, x, y, r = [int(i) for i in input().split()]
if x + r <= W and y - r >= 0 and x - r >= 0 and y + r <= H:
print("Yes")
else:
print("No") |
s913266726 | p02308 | u022407960 | 1,000 | 131,072 | Wrong Answer | 30 | 7,800 | 1,710 | For given a circle $c$ and a line $l$, print the coordinates of the cross points of them. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
2 1 1
2
0 1 4 1
3 0 3 3
output:
1.00000000 1.00000000 3.00000000 1.00000000
3.00000000 1.00000000 3.00000000 1.00000000
"""
import sys
import math
class Segment(object):
__slots__ = ('source', 'target')
def __init__(self, source, target):
se... | s756602147 | Accepted | 30 | 8,232 | 1,615 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
2 1 1
2
0 1 4 1
3 0 3 3
output:
1.00000000 1.00000000 3.00000000 1.00000000
3.00000000 1.00000000 3.00000000 1.00000000
"""
import math
import sys
from operator import attrgetter
from collections import namedtuple
def dot(a, b):
return a.real * b.real + ... |
s181836373 | p03719 | u969227451 | 2,000 | 262,144 | Wrong Answer | 26 | 9,140 | 90 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a,b,c=(int(x)for x in input().split())
if a<=c<=b:
print("YES")
else:
print("NO") | s761127517 | Accepted | 26 | 8,884 | 82 | a,b,c=map(int,input().split())
if a<=c<=b:
print("Yes")
else:
print("No") |
s721122594 | p03693 | u855665975 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r,g,b = map(int, input().split())
if (r*100) + (g*10) + b % 4 == 0:
print("YES")
else:
print("NO") | s502831634 | Accepted | 17 | 2,940 | 107 | r,g,b = map(int, input().split())
if ((r*100) + (g*10) + b) % 4 == 0:
print("YES")
else:
print("NO") |
s419110214 | p02612 | u163874353 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,104 | 32 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(1000 - n) | s238433689 | Accepted | 28 | 9,116 | 80 | n = int(input())
if n % 1000 == 0:
print(0)
else:
print(1000 - n % 1000) |
s561430302 | p02262 | u193453446 | 6,000 | 131,072 | Wrong Answer | 30 | 7,900 | 2,132 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
def swap(A, x, y):
t = A[x]
A[x] = A[y]
A[y] = t
def insertionSort(A, n, g):
""" ?????\????????? """
cnt = 0
print(A)
for i in range(g, n, g):
v = A[i]
j = i - g
while j >=0 and A[j] > v:
A[... | s124772451 | Accepted | 21,000 | 47,484 | 1,990 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def insertionSort(A, n, g):
""" ?????\????????? """
c = 0
for i in range(g, n):
v = A[i]
j = i - g
while j >=0 and A[j] > v:
A[j+g] = A[j]
j = j - g
c += 1
A[j+g] = v
return c
... |
s009539391 | p03455 | u915355756 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 254 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | N = 1
data = []
for i in range(N):
data_input = list(map(int,input().split()))
data.append(data_input)
M = 1
print(data)
if data[0][0]//2 == 0:
print('Even')
else:
if data[0][1]//2 ==0:
print('Even')
else:
print('Odd') | s046594499 | Accepted | 17 | 3,060 | 240 | N = 1
data = []
for i in range(N):
data_input = list(map(int,input().split()))
data.append(data_input)
M = 1
if data[0][0]%2 == 0:
print('Even')
else:
if data[0][1]%2 ==0:
print('Even')
else:
print('Odd') |
s391767333 | p03797 | u143278390 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | Snuke loves puzzles. Today, he is working on a puzzle using `S`\- and `c`-shaped pieces. In this puzzle, you can combine two `c`-shaped pieces into one `S`-shaped piece, as shown in the figure below: Snuke decided to create as many `Scc` groups as possible by putting together one `S`-shaped piece and two `c`-shaped... | n,m=[int(i) for i in input().split()]
if(n*2>=m):
print(m//n)
'''else:
m-n*2''' | s999066278 | Accepted | 17 | 2,940 | 65 | n,m=[int(i) for i in input().split()]
print(min(m//2,(2*n+m)//4)) |
s327219309 | p03473 | u248192265 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 29 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | M = int(input())
print (24-M) | s756611612 | Accepted | 17 | 2,940 | 32 | M = int(input())
print (24-M+24) |
s637146649 | p03997 | u159975271 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | 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())
k = (a + b)* h /2
print(k) | s168124621 | Accepted | 17 | 2,940 | 84 | a = int(input())
b = int(input())
h = int(input())
k = (a + b)* h /2
print(round(k)) |
s305073476 | p02606 | u000875186 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,076 | 234 | How many multiples of d are there among the integers between L and R (inclusive)? | stir=input()
lst=stir.split(" ")
l=int(lst[0])
r=int(lst[1])
t=lst[2]
b=1
x=0
multiples=[]
while(b<100):
multiples.append(int(t)*b)
b+=1
for a in range(l, r):
for m in multiples:
if(m==a):
x+=1
print(x) | s550672627 | Accepted | 29 | 9,156 | 236 | stir=input()
lst=stir.split(" ")
l=int(lst[0])
r=int(lst[1])
t=lst[2]
b=1
x=0
multiples=[]
while(b<101):
multiples.append(int(t)*b)
b+=1
for a in range(l, r+1):
for m in multiples:
if(m==a):
x+=1
print(x) |
s829214527 | p02678 | u721407235 | 2,000 | 1,048,576 | Wrong Answer | 795 | 40,144 | 438 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque
N,M=map(int,input().split())
arr=[[] for n in range(N)]
que=deque([1])
for m in range(M):
a,b=map(int,input().split())
arr[a-1].append(b)
arr[b-1].append(a)
dist=[-1]*N
dist[0]=0
arr2=[0]*(N-1)
print("Yes")
while que:
c=que.popleft()
for i in arr[c-1]:
if dist[i-1]!=-1:
... | s899152017 | Accepted | 630 | 34,820 | 427 | from collections import deque
N,M=map(int,input().split())
arr=[[] for n in range(N)]
que=deque([1])
for m in range(M):
a,b=map(int,input().split())
arr[a-1].append(b)
arr[b-1].append(a)
dist=[-1]*N
dist[0]=0
arr2=[0]*(N-1)
print("Yes")
while que:
c=que.popleft()
for i in arr[c-1]:
if dist[i-1]!=-1:
... |
s247565032 | p03129 | u834153484 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 180 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | A, B = map(int, input().split())
if A%2==0:
if A/2 >= B:
print("Yes")
else:
print("No")
else:
if (A+1)/2 >= B:
print("Yes")
else:
print("No") | s645628191 | Accepted | 17 | 2,940 | 180 | A, B = map(int, input().split())
if A%2==0:
if A/2 >= B:
print("YES")
else:
print("NO")
else:
if (A+1)/2 >= B:
print("YES")
else:
print("NO") |
s760888010 | p03606 | u513081876 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 104 | Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now? | N = int(input())
ans = 0
for i in range(N):
l, r = map(int, input().split())
ans += r - l
print(ans) | s900500988 | Accepted | 20 | 2,940 | 108 | N = int(input())
ans = 0
for i in range(N):
l, r = map(int, input().split())
ans += r - l + 1
print(ans) |
s438602187 | p03478 | u699944218 | 2,000 | 262,144 | Wrong Answer | 33 | 3,060 | 139 | 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 = list(map(int, input().split()))
res = 0
for i in range(N+1):
if A <= sum([int(s) for s in str(i)]) <=B:
res += 1
print(res) | s753686043 | Accepted | 33 | 2,940 | 138 | N, A, B = list(map(int, input().split()))
res = 0
for i in range(N+1):
if A <= sum(int(s) for s in str(i)) <= B:
res += i
print(res) |
s173938667 | p03659 | u116002573 | 2,000 | 262,144 | Wrong Answer | 270 | 34,472 | 340 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | def main():
n = int(input())
A = list(map(int, input().split()))
filled = [0]*(n+1)
ans = []
for i in range(n-1, -1, -1):
if sum(filled[::i+1][1:]) % 2 != A[i]:
filled[i+1] = 1
ans.append(i+1)
print(len(ans))
print(' '.join(map(str, ans)))
if __name__ == '_... | s753914650 | Accepted | 146 | 23,800 | 276 | def main():
N = int(input())
A = [int(a) for a in input().split()]
v = 0
tot = sum(A)
min_d = float('inf')
for i in range(N-1):
v += A[i]
min_d = min(min_d, abs(tot - 2*v))
return min_d
if __name__ == '__main__':
print(main()) |
s655655671 | p02694 | u853728588 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,024 | 90 | 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())
total = 100
while total >= x:
if total < x:
total = total * 1.01
| s180878058 | Accepted | 28 | 9,160 | 125 | import math
x = int(input())
initial = 100
count = 0
while initial < x:
initial += initial//100
count += 1
print(count) |
s190697181 | p02408 | u351754662 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 205 | Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers). The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond. | n = int(input())
cards = {}
for i in range(n):
card = input()
cards[card] = 1
for c in ['s','H','C','D']:
for n in range(1,14):
key = c + ' ' +str(n)
if not key in cards:
print(key)
| s178591174 | Accepted | 20 | 5,600 | 208 | n = int(input())
cards = {}
for i in range(n):
card = input()
cards[card] = 1
for c in ['S', 'H', 'C', 'D']:
for n in range(1,14):
key = c + ' ' + str(n)
if not key in cards:
print(key)
|
s308634648 | p02694 | u253389610 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,192 | 289 | 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())
x = divmod(X, 100)
a = [1, 0]
y = 0
while x[0] > a[0]:
ya = 99-a[1] // a[0]
a[1] += a[0]*ya
y += ya
a[1] += a[0]
i, a[1] = divmod(a[1], 100)
a[0] += i
y += 1
while x[0] == a[0] and x[0] > a[0]:
i, a[1] = divmod(a[1]+a[0], 100)
a[0] += i
y += 1
print(y) | s814220180 | Accepted | 24 | 9,108 | 241 | def main():
X = int(input())
x = divmod(X, 100)
a = [1, 0]
y = 0
while a[0] < x[0] or a[0] == x[0] and a[1] < x[1]:
i, a[1] = divmod(a[1] + a[0], 100)
a[0] += i
y += 1
return y
print(main())
|
s946845274 | p03998 | u980503157 | 2,000 | 262,144 | Wrong Answer | 27 | 9,060 | 292 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | first = input()
second = input()
third = input()
d = {}
d["a"]=first
d["b"]=second
d["c"]=third
flag = False
run = "a"
while flag != True:
if d[run] == "":
flag = True
print(run)
else:
l = len(d[run])
temp = d[run][0]
d[run] = d[run][1:l]
run = temp | s290779336 | Accepted | 27 | 9,032 | 430 | a = list(input()) #aca
b = list(input()) #accc
c = list(input()) #ca
win = False
run = a
while win != True:
if run[0] == "a":
run.pop(0)
run = a
if len(run) == 0:
print("A")
win = True
elif run[0] == "b":
run.pop(0)
run = b
if len(run) == 0:
print("B")
... |
s146944170 | p02388 | u088372268 | 1,000 | 131,072 | Wrong Answer | 20 | 7,420 | 12 | Write a program which calculates the cube of a given integer x. | x = 2
x ** 3 | s039246969 | Accepted | 50 | 7,604 | 34 | x = input()
x = int(x)
print(x**3) |
s012963926 | p02412 | u628732336 | 1,000 | 131,072 | Wrong Answer | 20 | 7,628 | 347 | Write a program which identifies the number of combinations of three integers which satisfy the following conditions: * You should select three distinct integers from 1 to n. * A total sum of the three integers is x. For example, there are two combinations for n = 5 and x = 9. * 1 + 3 + 5 = 9 * 2 + 3 + 4 = 9 | while True:
n, x = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for s in range(1, n // 2 + 1):
for e in range(n, n // 2, -1):
m = x - s - e
if m != s and m != e and m > s and m < e and m <= n:
print(s, m, e)
c... | s206971885 | Accepted | 530 | 7,724 | 292 | while True:
n, x = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for s in range(1, n - 1):
for m in range(s + 1, n):
for e in range(m + 1, n + 1):
if x == s+m+e:
count += 1
print(count) |
s295347413 | p00002 | u179070318 | 1,000 | 131,072 | Wrong Answer | 20 | 5,668 | 91 | Write a program which computes the digit number of sum of two integers a and b. | import math
a,b = [int(x) for x in input().split()]
x = a + b
print(int(math.log10(x))+1)
| s589887508 | Accepted | 20 | 5,676 | 170 | import math
while True:
try:
a,b = [int(x) for x in input().split()]
x = a + b
print(int(math.log10(x))+1)
except:
break
|
s236147220 | p02833 | u501451051 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,116 | 148 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | n = int(input())
if n % 2 != 0:
print(0)
else:
ans = 0
tmp = n/2
while tmp:
tmp /= 5
ans += tmp
print(ans) | s459499516 | Accepted | 30 | 9,164 | 154 | n = int(input())
if n % 2 != 0:
print(0)
else:
ans = 0
n //= 2
while n:
ans += n//5
n //= 5
print(int(ans)) |
s607513598 | p03149 | u589716761 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 98 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | S=input().split()
print(S)
if "1" and "7" and "9" and "4" in S:
print("Yes")
else:
print('No') | s063306058 | Accepted | 17 | 2,940 | 112 | S=input().split()
if ("1" in S) and ("9" in S) and ("7" in S) and ("4" in S):
print("YES")
else:
print('NO') |
s308251449 | p03456 | u642418876 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | 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. | a,b=map(str,input().split())
c=a+b
for i in range(101):
if i**2==int(c):
print('Yes')
else:
print('No')
exit()
| s875152456 | Accepted | 17 | 2,940 | 117 | a,b=map(str,input().split())
c=a+b
for i in range(1,320):
if int(c)==i**2:
print('Yes')
exit()
print('No')
|
s136012255 | p03434 | u617449195 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 357 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | N = int(input())
A = [int(i) for i in input().split()]
A_sorted = sorted(A, reverse=True)
print(A_sorted)
Alice_point = 0; Bob_point = 0
for i in range(N):
if i % 2 == 0:
print("Alice=",i)
Alice_point += A_sorted[i]
else:
print("Bob=",i)
Bob_point += A_sorted[i]
ans ... | s476722963 | Accepted | 17 | 3,060 | 291 | N = int(input())
A = [int(i) for i in input().split()]
A_sorted = sorted(A, reverse=True)
Alice_point = 0; Bob_point = 0
for i in range(N):
if i % 2 == 0:
Alice_point += A_sorted[i]
else:
Bob_point += A_sorted[i]
ans = Alice_point - Bob_point
print(ans) |
s669261226 | p03962 | u950337877 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 141 | 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, b, c = map(int, input().split())
if a == b and a == c:
print('3')
elif a==b or a == c or b== c:
print('2')
else:
print('1')
| s843225670 | Accepted | 17 | 2,940 | 132 | a, b, c = map(int, input().split())
if a == b == c:
print('1')
elif a==b or a == c or b== c:
print('2')
else:
print('3')
|
s980107371 | p00003 | u806182843 | 1,000 | 131,072 | Wrong Answer | 50 | 7,732 | 369 | Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so. | def main():
n = int(input())
for _ in range(n):
len_list = map(int, input().split())
check_tri(len_list)
def check_tri(len_list):
import itertools
flag = True
for tmp in list(itertools.permutations(len_list)):
if (tmp[0] + tmp[1]) < tmp[2]:
flag = False
break
if flag == True:
print('yes')
else:
... | s168995666 | Accepted | 60 | 7,748 | 408 | def main():
n = int(input())
for _ in range(n):
len_list = map(int, input().split())
check_tri(len_list)
def check_tri(len_list):
import itertools
import math
flag = False
for tmp in list(itertools.permutations(len_list)):
if (pow(tmp[0], 2) + pow(tmp[1], 2)) == pow(tmp[2], 2):
flag = True
break
... |
s336226235 | p03844 | u790048565 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 26 | Joisino wants to evaluate the formula "A op B". Here, A and B are integers, and the binary operator op is either `+` or `-`. Your task is to evaluate the formula instead of her. | s = input()
print(exec(s)) | s936274696 | Accepted | 17 | 2,940 | 26 | s = input()
print(eval(s)) |
s416869209 | p02412 | u316584871 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 386 | Write a program which identifies the number of combinations of three integers which satisfy the following conditions: * You should select three distinct integers from 1 to n. * A total sum of the three integers is x. For example, there are two combinations for n = 5 and x = 9. * 1 + 3 + 5 = 9 * 2 + 3 + 4 = 9 | while True:
n, x = map(int,input().split())
if(n==0, x==0):
break
nlist = []
for i in range(1,n+1):
nlist.append(i)
count = 0
for i1 in range(n-2):
for i2 in range(i1+1,n-1):
for i3 in range(i2+1,n):
y = nlist[i1]+nlist[i2]+nlist[i3]
... | s217336758 | Accepted | 930 | 5,600 | 430 | while True:
n, x = map(int,input().split())
if(n==0 and x==0):
break
nlist = []
for i in range(1,n+1):
nlist.append(i)
count = 0
for i1 in range(n-2):
for i2 in range(i1+1,n-1):
for i3 in range(i2+1,n):
y = nlist[i1]+nlist[i2]+nlist[i3]
... |
s143669135 | p02390 | u208157605 | 1,000 | 131,072 | Wrong Answer | 20 | 7,452 | 89 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | import time
seconds = int(input())
print(time.strftime('%H:%M:%S', time.gmtime(seconds))) | s454031038 | Accepted | 20 | 7,508 | 164 | seconds = int(input())
hour = str(seconds // 3600)
minute = str(seconds % 3600 // 60)
second = str(seconds % 3600 % 60)
print(hour + ':' + minute + ':' + second) |
s619511239 | p03448 | u840974625 | 2,000 | 262,144 | Wrong Answer | 51 | 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())
res = 0
for ai in range(a):
for bi in range(b):
for ci in range(c):
total = 500 * ai + 100 * bi + 50 * ci
if x == total:
res += 1
print(res) | s342677963 | Accepted | 55 | 3,060 | 256 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
res = 0
for ai in range(a + 1):
for bi in range(b + 1):
for ci in range(c + 1):
total = 500 * ai + 100 * bi + 50 * ci
if x == total:
res += 1
print(res) |
s942051911 | p03378 | u593567568 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 191 | 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... | from bisect import bisect_right
N,M,X = map(int,input().split())
A = list(map(int,input().split()))
left = bisect_right(A,X)
right = N - left
l = X - left
r = N - X - right
print(min(l,r)) | s701809953 | Accepted | 17 | 3,188 | 173 | from bisect import bisect_right
N,M,X = map(int,input().split())
A = list(map(int,input().split()))
left = bisect_right(A,X)
right = len(A) - left
print(min(left,right))
|
s752035376 | p04012 | u981931040 | 2,000 | 262,144 | Wrong Answer | 30 | 9,300 | 163 | 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. | from collections import Counter
S = Counter(input())
flag = False
for c in S.values():
if c % 2 == 1:
flag = True
if flag:
print('Yes')
else:
print('No') | s064000334 | Accepted | 30 | 9,192 | 164 | from collections import Counter
S = Counter(input())
flag = True
for c in S.values():
if c % 2 == 1:
flag = False
if flag:
print('Yes')
else:
print('No')
|
s071502373 | p03624 | u674588203 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 219 | 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()
L=("a","b","c","d","e","f","g","h","i","j","k","l","m","n",
"o","p","q","r","s","t","u","v","w","x","y","z")
for l in L:
if S.count(l)>0:
pass
else:
print(l)
else:
print("None") | s499699840 | Accepted | 20 | 3,188 | 234 | S=input()
L=("a","b","c","d","e","f","g","h","i","j","k","l","m","n",
"o","p","q","r","s","t","u","v","w","x","y","z")
for l in L:
if S.count(l)>0:
pass
else:
print(l)
exit()
else:
print("None") |
s991804607 | p03371 | u733608212 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 245 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | a, b, c, x, y= map(int, input().split())
ans = a*x + b*y
print(ans, c * x * 2, y * c * 2+ (x - y) * b)
if x > y:
ans = min(ans, c * x * 2, y * c * 2+ (x - y) * a)
else:
ans = min(ans, c * y * 2, x * c * 2 + (y - x) * b)
print(ans) | s618842067 | Accepted | 24 | 3,064 | 199 | a, b, c, x, y= map(int, input().split())
ans = a*x + b*y
if x > y:
ans = min(ans, c * x * 2, y * c * 2+ (x - y) * a)
else:
ans = min(ans, c * y * 2, x * c * 2 + (y - x) * b)
print(ans) |
s693329344 | p02399 | u941509088 | 1,000 | 131,072 | Wrong Answer | 50 | 7,676 | 78 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a, b = map(int, input().split())
d = a//b
r = a%b
f = float(a/b)
print(d,r,f) | s325858449 | Accepted | 20 | 7,648 | 97 | a, b = map(int, input().split())
d = a//b
r = a%b
f = float(a/b)
print('%s %s %.5f' % (d, r, f)) |
s418928391 | p02694 | u377834804 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,206 | 8,960 | 92 | 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())
now = 0
cnt = 0
while now < X:
cnt += 1
now = int(now*1.01)
print(cnt) | s797471443 | Accepted | 21 | 9,096 | 96 | X = int(input())
now = 100
cnt = 0
while now < X:
cnt += 1
now += int(now*0.01)
print(cnt) |
s908945938 | p02397 | u477464845 | 1,000 | 131,072 | Wrong Answer | 60 | 5,616 | 194 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
a = list(map(int,input().split()))
if a[0] == 0 and a[1] == 0:
break
elif a[0] > a[1]:
a.sort()
print(*a)
elif a[0] < a[1]:
print(*a)
| s476848382 | Accepted | 60 | 5,608 | 152 | while True:
x,y = map(int,input().split(" "))
if x == 0 and y==0:
break
elif y < x:
print(y,x)
else:
print(x,y)
|
s093013435 | p03110 | u067632118 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 171 | 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())
EBTC = 380000.0
R = 0
for i in range(N):
t = [x for x in input().split()]
R = R + int(t[0]) if t[1]=="JPY" else R + float(t[0])*EBTC
print(int(R)) | s114961068 | Accepted | 17 | 2,940 | 168 | N = int(input())
EBTC = 380000.0
R = 0
for i in range(N):
t = [x for x in input().split()]
R = R + float(t[0]) if t[1]=="JPY" else R + float(t[0])*EBTC
print(R) |
s843932796 | p03401 | u936985471 | 2,000 | 262,144 | Wrong Answer | 169 | 14,048 | 480 | 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()))
sortedA=sorted(A)
L1=sortedA[0]
L2=sortedA[1]
R1=sortedA[-1]
R2=sortedA[-2]
def calcDist(L,R):
if L*R<0:
return (abs(L)+abs(R))*2
else:
return max(abs(L),abs(R))*2
distL1R1=calcDist(L1,R1)
print("distL1R1:",distL1R1)
distL1R2=calcDist(L1,R2)
distL2R1=calc... | s201044709 | Accepted | 260 | 14,172 | 278 | N=int(input())
A=list(map(int,input().split()))
A=[0]+A+[0]
dist=0
diff=[0]*(len(A)-2)
for i in range(len(A)-1):
dist+=abs(A[i+1]-A[i])
if 1<=i<=len(A)-2:
diff[i-1]=abs(A[i]-A[i-1])+abs(A[i+1]-A[i])-abs(A[i+1]-A[i-1])
for i in range(len(diff)):
print(dist-diff[i]) |
s311980169 | p03471 | u113750443 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 1,377 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | def nyu():
num1,num2 = input().split()
num1 = int(num1)
num2 = int(num2)
# print("x = " ,x[i] ,"y = ",y[i])
return num1,num2
def otoshidama(n,y):
n= int(y /10000+1)
success_flg = 0
ichiman = 0
gosen = 0
senen = 0
y_tmp = y
for i in reversed(range(n)):
ichiman ... | s108370790 | Accepted | 1,168 | 3,064 | 1,427 | def nyu():
num1,num2 = input().split()
num1 = int(num1)
num2 = int(num2)
# print("x = " ,x[i] ,"y = ",y[i])
return num1,num2
def otoshidama(n,y):
n = n+1
ichiman = 0
gosen = 0
senen = 0
y_tmp = y
for i in reversed(range(n)):
# print(i)
ichiman = 0
... |
s642613481 | p02742 | u901757711 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 102 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | h, w = map(int, input().split())
ans = h*w
if ans %2 ==0:
print(ans/2)
else:
print(ans//2+1) | s035243930 | Accepted | 17 | 2,940 | 138 | h, w = map(int, input().split())
if h==1 or w==1:
print(1)
else:
ans = h*w
if ans % 2 ==0 :
print(ans//2)
else:
print(ans//2+1) |
s966617904 | p03063 | u060938295 | 2,000 | 1,048,576 | Wrong Answer | 144 | 3,500 | 393 | 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... | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 20:58:04 2019
@author: Yamazaki Kenichi
"""
N = int(input())
S = input()
a,b = 0,0
flg,flg2 = False,False
for i in range(N):
if S[-i-1] == '.':
flg = True
if flg:
if S[-i-1] == "#":
flg2 = True
if flg2 and S[-i-1] == '#':
... | s908143647 | Accepted | 141 | 5,128 | 339 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 21 13:05:54 2019
@author: Yamazaki Kenichi
"""
N = int(input())
S = input()
a,ans = [],0
for c in S:
if c == '.':
ans += 1
a.append(-1)
else:
a.append(1)
tmp = ans
for i in range(N):
tmp += a[i]
ans = min(ans,tmp)
# print(ans,a... |
s421406408 | p03605 | u207799478 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | n=input()
for i in range(len(n)):
if i ==9:
print('Yes')
break
print('No')
| s943543103 | Accepted | 17 | 2,940 | 150 | # coding: utf-8
# Your code here!
n=input()
if n[0]=='9':
print('Yes')
exit()
if n[1]=='9':
print('Yes')
exit()
else:
print('No')
|
s636672058 | p02678 | u708255304 | 2,000 | 1,048,576 | Wrong Answer | 728 | 41,352 | 506 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque, defaultdict
N, M = map(int, input().split())
tree = [[] for _ in range(N)]
for _ in range(M):
a, b = map(lambda x: int(x)-1, input().split())
tree[a].append(b)
tree[b].append(a)
visited = [False]*N
q = deque([0])
visited[0] = True
ans = defaultdict(int)
while len(q):
v = ... | s386005328 | Accepted | 772 | 41,492 | 518 | from collections import deque, defaultdict
N, M = map(int, input().split())
tree = [[] for _ in range(N)]
for _ in range(M):
a, b = map(lambda x: int(x)-1, input().split())
tree[a].append(b)
tree[b].append(a)
visited = [False]*N
q = deque([0])
visited[0] = True
ans = defaultdict(int)
while len(q):
v = ... |
s338003386 | p02261 | u825178626 | 1,000 | 131,072 | Wrong Answer | 20 | 7,836 | 1,002 | 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
# Here your code !
A = int(input())
N = tuple(input().split())
bs=[]
ss=[]
def isStable(a,b):
leng = int(len(a))
for i in range(leng):
for j in range(i+1,leng):
for x in range(leng):
for y in range(x+1,leng):
if a[i][1]==a[j][1] and a[i]==b... | s797506702 | Accepted | 140 | 7,824 | 1,002 | # coding: utf-8
# Here your code !
A = int(input())
N = tuple(input().split())
bs=[]
ss=[]
def isStable(a,b):
leng = int(len(a))
for i in range(leng):
for j in range(i+1,leng):
for x in range(leng):
for y in range(x+1,leng):
if a[i][1]==a[j][1] and a[i]==b... |
s641008272 | p03730 | u864667985 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 174 | 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... | def main():
a, b, c = map(int, input().split())
for i in range(1, b+1):
if i*a % b == c:
print("Yes")
return
print("No")
main()
| s141320452 | Accepted | 17 | 2,940 | 174 | def main():
a, b, c = map(int, input().split())
for i in range(1, b+1):
if i*a % b == c:
print("YES")
return
print("NO")
main()
|
s163800311 | p03599 | u940743763 | 3,000 | 262,144 | Time Limit Exceeded | 3,156 | 3,064 | 633 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | a, b, c, d, e, f = list(map(int, input().split(' ')))
rate = 0
water = 0
suger = 0
for i in range(30 + 1):
for j in range(30 + 1):
for k in range(100 + 1):
for l in range(100 + 1):
w = 100 * a * i + 100 * b * j
s = c * k + d * l
if w + s <= 0:
... | s275068643 | Accepted | 547 | 3,188 | 674 | a, b, c, d, e, f = list(map(int, input().split(' ')))
rate = 0
water = 0
suger = 0
al = f // (a * 100)
bl = f // (b * 100)
for i in range(al + 1):
for j in range(bl + 1):
for k in range(100 + 1):
for l in range(100 + 1):
w = 100 * a * i + 100 * b * j
s = c * k ... |
s777630511 | p03855 | u819135704 | 2,000 | 262,144 | Wrong Answer | 1,007 | 80,608 | 408 | 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 collections import *
N, K, L = map(int,input().split())
def f(m):
*a, = range(N)
def g(i):
if a[i] == i:
return i
a[i] = g(a[i])
return a[i]
for _ in range(m):
p, q = map(int,input().split())
a[g(q-1)] = g(p-1)
return g
x, y = f(K), f(L)
c = Cou... | s248816130 | Accepted | 853 | 55,644 | 399 | from collections import *
N, K, L = map(int,input().split())
def f(m):
*a, = range(N)
def g(i):
if a[i] == i:
return i
a[i] = g(a[i])
return a[i]
for _ in range(m):
p, q = map(int,input().split())
a[g(q-1)] = g(p-1)
return g
x, y = f(K), f(L)
c = Cou... |
s831591410 | p03479 | u753803401 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 162 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl... | x, y = map(int, input().split())
t = x
cnt = 0
while True:
print(t)
if t > y:
print(cnt)
exit()
else:
cnt += 1
t *= 2
| s387109680 | Accepted | 17 | 2,940 | 149 | x, y = map(int, input().split())
t = x
cnt = 0
while True:
if t > y:
print(cnt)
exit()
else:
cnt += 1
t *= 2
|
s938730455 | p03448 | u375695365 | 2,000 | 262,144 | Wrong Answer | 34 | 3,060 | 222 | 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*500,500):
for j in range(0,b*100,100):
for z in range(0,c*50,50):
if i+j+z==x:
ans+=1
print(ans)
| s733256720 | Accepted | 37 | 3,060 | 228 | a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(0,a*500+1,500):
for j in range(0,b*100+1,100):
for z in range(0,c*50+1,50):
if i+j+z==x:
ans+=1
print(ans)
|
s956339864 | p03487 | u371132735 | 2,000 | 262,144 | Wrong Answer | 186 | 18,672 | 266 | You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ... |
import collections
N = int(input())
A = list(map(int,input().split()))
C = collections.Counter(A)
ans = 0
for i,v in C.items():
print(i,v)
if i!=v:
if i<v:
ans += v-1
else:
ans += v
print(ans) | s350990944 | Accepted | 82 | 18,676 | 268 |
import collections
N = int(input())
A = list(map(int,input().split()))
C = collections.Counter(A)
ans = 0
for i,v in C.items():
# print(i,v)
if i!=v:
if i<v:
ans += v-i
else:
ans += v
print(ans) |
s359475036 | p03067 | u492030100 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 109 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | A, B,C = map(int, input().split())
#C = int(input())
Anything= 'Yes' if A<B and B<C else 'No'
print(Anything) | s840168486 | Accepted | 17 | 2,940 | 128 | A, B,C = map(int, input().split())
#C = int(input())
Anything= 'Yes' if (A<C and C<B) or (B<C and C<A) else 'No'
print(Anything) |
s629592229 | p03998 | u746419473 | 2,000 | 262,144 | Wrong Answer | 21 | 3,188 | 164 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | s = {}
for key in ("a", "b", "c"):
s[key] = list(input())
cur = s["a"][0]
while len(s[cur]) != 0:
cur = s[cur].pop(0)
print(cur, s)
print(cur.upper())
| s207635748 | Accepted | 17 | 2,940 | 109 | s = {key:list(input()) for key in "abc"}
c = "a"
while len(s[c]) != 0:
c = s[c].pop(0)
print(c.upper())
|
s258501704 | p03369 | u777078967 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | 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 ... | data=input().rstrip().split()
data=list(data)
ans=700
for i in data:
if "o" ==i:
ans+=100
print(ans) | s798344095 | Accepted | 17 | 2,940 | 98 | data=input().rstrip()
data=list(data)
ans=700
for i in data:
if "o"==i:
ans+=100
print(ans)
|
s251068321 | p03455 | u495296799 | 2,000 | 262,144 | Wrong Answer | 17 | 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=input().split()
a=int(a)
b=int(b)
if (a*b)%2==0:
print ("even")
else:
print ("odd")
| s915341025 | Accepted | 17 | 2,940 | 95 | a,b=input().split()
a=int(a)
b=int(b)
if (a*b)%2==0:
print ("Even")
else:
print ("Odd") |
s569849195 | p02619 | u171654347 | 2,000 | 1,048,576 | Wrong Answer | 40 | 9,648 | 526 | Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to che... | d = int(input())
cList = input().split()
sList = []
for idx in range(0, d):
tempList = input().split()
sList.append(tempList)
tList = []
for idx in range(0, d):
tList.append(int(input()))
print(sList)
print(tList)
countList = [0] * 26
val = 0
for idx in range(0, d):
val += int(sList[idx][tList[i... | s379313034 | Accepted | 39 | 9,652 | 500 | d = int(input())
cList = input().split()
sList = []
for idx in range(0, d):
tempList = input().split()
sList.append(tempList)
tList = []
for idx in range(0, d):
tList.append(int(input()))
countList = [0] * 26
val = 0
for idx in range(0, d):
val += int(sList[idx][tList[idx] -1])
countList = li... |
s471304070 | p03352 | u331381193 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,060 | 151 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | x=int(input())
import math
#y=math.log(1000, 1)
res=[1]
for i in range(2,33):
y=math.floor(math.log(x, i))
res.append(i**y)
print(max(res))
#961 | s161128226 | Accepted | 17 | 3,060 | 158 | x=int(input())
import math
#y=math.log(1000, 1)
res=[1]
for i in range(2,33):
for j in range(2,10):
y=i**j
if y<=x:
res.append(y)
print(max(res)) |
s006698635 | p03624 | u106342872 | 2,000 | 262,144 | Wrong Answer | 85 | 5,416 | 317 | 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. | #! -*- coding:utf-8 -*-
s = str(input())
s = list(s)
x = 'abcdefghijklmnopqrstuvwxyz'
x = list(x)
print(s)
flag = 0
for i in range(len(s)):
try:
if(len(x) == 1 and s[i] == x[0]):
flag = 1
x.remove(s[i])
except:
pass
if(flag == 1):
print('None')
else:
print(x[0])
| s267566270 | Accepted | 78 | 3,956 | 308 | #! -*- coding:utf-8 -*-
s = str(input())
s = list(s)
x = 'abcdefghijklmnopqrstuvwxyz'
x = list(x)
flag = 0
for i in range(len(s)):
try:
if(len(x) == 1 and s[i] == x[0]):
flag = 1
x.remove(s[i])
except:
pass
if(flag == 1):
print('None')
else:
print(x[0])
|
s282478815 | p00008 | u440180827 | 1,000 | 131,072 | Wrong Answer | 30 | 7,536 | 213 | 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). | n = int(input())
count = 0
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
if i + j + k + l == n:
count += 1
print(count) | s423551356 | Accepted | 60 | 7,688 | 267 | import sys
t = [None for i in range(10000)]
c = 0
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
t[c] = i + j + k + l
c += 1
for line in sys.stdin:
print(t.count(int(line))) |
s995968184 | p03644 | u168416324 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n=int(input())
for x in range(0,8):
if pow(2,x)>n:
ans=pow(2,x-1)
print(ans) | s002622169 | Accepted | 17 | 2,940 | 99 | n=int(input())
ans=1
for x in range(0,8):
if n<pow(2,x):
break
ans=pow(2,x)
print(ans) |
s913205403 | p03545 | u001024152 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 388 | 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 = [int(i) for i in input()]
ops = ["+++", "++-", "+-+", "+--", "-++", "-+-", "--+", "---"]
for op in ops:
s = a
print(op)
for i, n in enumerate([b, c, d]):
op = list(op)
if op[i] == "+":
s += n
else:
s -= n
if s == 7:
print(str(a) + op... | s726109274 | Accepted | 17 | 2,940 | 229 | A = list(input())
op = ["-", "+"]
for op1 in op:
for op2 in op:
for op3 in op:
left = A[0]+op1+A[1]+op2+A[2]+op3+A[3]
if eval(left) == 7:
print(left+"=7")
exit() |
s562639454 | p03369 | u003501233 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | 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=str(input())
ans=s.count("〇")
print(700+(int(ans)*100)) | s839499641 | Accepted | 17 | 2,940 | 52 | s=input()
ans=s.count("o")
print(700+(int(ans)*100)) |
s104927443 | p03693 | u652081898 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 95 | 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 (g*10+b)%4 == 0:
print("Yes")
else:
print("No") | s238469937 | Accepted | 17 | 3,064 | 96 | r, g, b = map(int, input().split())
if (g*10+b)%4 == 0:
print("YES")
else:
print("NO")
|
s892413497 | p03139 | u583460863 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 129 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... |
a, b, c = map(int, input().split())
if (a > b ) :
mx_a = b
else:
mx_a = a
mx_y = a+b - c
print(str(mx_a) + ' ' + str(mx_y)) | s042524068 | Accepted | 18 | 3,060 | 202 |
n , a, b = map(int, input().split())
n = int(n)
a = int(a)
b = int(b)
if (a > b ) :
mx_x = b
else:
mx_x = a
if ((a+b - n)<0):
mx_y = 0
else:
mx_y = a+b-n
print(str(mx_x) + ' ' + str(mx_y))
|
s658277676 | p03140 | u025235255 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 220 | 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()
count = 0
for i in range(n):
if a[i] != b[i] and a[i] != c[i]:
count += 2
elif a[i] != b[i] or a[i] != c[i]:
count += 1
print(count) | s950154520 | Accepted | 17 | 3,064 | 281 | n = int(input())
a = input()
b = input()
c = input()
count = 0
for i in range(n):
if a[i] != b[i] and b[i] == c[i]:
count += 1
elif a[i] != b[i] and a[i] != c[i]:
count += 2
elif a[i] != b[i] or a[i] != c[i]:
count += 1
print(count) |
s558019944 | p03160 | u306033313 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 246 | 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... | hight = [2, 9, 4, 5, 1, 6, 10]
lis = [0, hight[1]-hight[0]]
for i in range(len(hight)):
if i == 0 or i == 1:
pass
else:
lis.append(min(lis[i-2] + abs(hight[i]-hight[i-2]), lis[i-1] + abs(hight[i]-hight[i-1])))
print(lis) | s630238326 | Accepted | 135 | 13,908 | 282 | n = int(input())
hight = list(map(int, input().split()))
lis = [0, abs(hight[1]-hight[0])]
for i in range(len(hight)):
if i == 0 or i == 1:
pass
else:
lis.append(min(lis[i-2] + abs(hight[i]-hight[i-2]), lis[i-1] + abs(hight[i]-hight[i-1])))
print(lis[n-1]) |
s728949422 | p03779 | u367130284 | 2,000 | 262,144 | Wrong Answer | 35 | 4,868 | 79 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a... | y=int(input())*2
a=[x*(x+1) for x in range(100000) if x*(x+1)<=y]
print(len(a)) | s165492681 | Accepted | 35 | 4,868 | 78 | y=int(input())*2
a=[x*(x+1) for x in range(100000) if x*(x+1)<y]
print(len(a)) |
s442363646 | p03433 | u095396110 | 2,000 | 262,144 | Wrong Answer | 25 | 9,156 | 131 | 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())
num_list = [a for a in range(A+1)]
if N%500 in num_list:
print('Yse')
else:
print('No') | s385530298 | Accepted | 30 | 8,800 | 85 | n = int(input())
a = int(input())
if n%500 <= a:
print("Yes")
else:
print("No") |
s126363596 | p03828 | u429995021 | 2,000 | 262,144 | Wrong Answer | 24 | 3,188 | 489 | You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. | def main():
N = int(input())
primes = sieve(N)
print(primes)
res = 1
for p in primes:
n = (N//p)
print(n)
res *= (n*(n+1))/2
res = res % (10**9 + 7)
print(res)
def sieve(n):
s = [True] * n
for x in range(2, int(n**0.5) + 1):
if s[x]: mark(s, x)... | s020444595 | Accepted | 23 | 3,192 | 533 | def main():
N = int(input())
primes = sieve(N+1)
res = 1
for p in primes:
f = 0
i = 1
while p ** i <= N:
f += (N//(p**i))
i += 1
res *= f + 1
res = res % (10**9 + 7)
print(res)
def sieve(n):
s = [True] * n
for x in range(2, i... |
s248941363 | p03448 | u113255362 | 2,000 | 262,144 | Wrong Answer | 27 | 8,988 | 214 | 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... | List = []
for i in range (3):
List.append(int(input()))
X=int(input())
res = 0
c = 0
for i in range(List[0]):
for j in range(List[1]):
c = X - 500 * i - 100 * j
if 0<=c<=List[2]:
res+=1
print(res) | s328060045 | Accepted | 27 | 9,128 | 226 | List = []
for i in range (3):
List.append(int(input()))
X=int(input())
res = 0
c = 0
for i in range(List[0]+1):
for j in range(List[1]+1):
c = int(X/50) - 10 * i - 2 * j
if 0<= c <= List[2]:
res+=1
print(res) |
s757168952 | p02612 | u119655368 | 2,000 | 1,048,576 | Wrong Answer | 28 | 8,872 | 24 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | print(int(input())%1000) | s977191189 | Accepted | 32 | 9,144 | 37 | print((1000-int(input())%1000)%1000)
|
s234854306 | p03657 | u174536291 | 2,000 | 262,144 | Wrong Answer | 25 | 9,108 | 133 | 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 = list(map(int, input().split()))
if a % 3 == 0 or b % 3 == 0 or a + b % 3 == 0:
print('Possible')
else:
print('Impossible') | s370169813 | Accepted | 29 | 9,040 | 139 | a, b = list(map(int, input().split()))
n = a + b
if a % 3 == 0 or b % 3 == 0 or n % 3 == 0:
print('Possible')
else:
print('Impossible') |
s029552127 | p03943 | u720417458 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 186 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a, b, c = map(int, input().split())
if a == b == c:
print('1')
elif a == b != c:
print('2')
elif a != b == c:
print('2')
elif b != c == a:
print('2')
else:
print('3') | s166466476 | Accepted | 17 | 2,940 | 160 | a,b,c = map(int,input().split())
if a + b == c:
print('Yes')
elif a + c == b:
print('Yes')
elif b + c == a:
print('Yes')
else:
print('No')
|
s380671283 | p02612 | u086866608 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,128 | 37 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n=int(input())
ans=n%1000
print(ans)
| s187299126 | Accepted | 29 | 9,104 | 90 | n=int(input())
amari=n%1000
if n%1000==0:
print("0")
else:
print(1000-amari)
|
s140451000 | p03455 | u604655161 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 165 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | def ABC_86_A():
a,b = map(int, input().split())
if (a*b)%2:
print('Even')
else:
print('Odd')
if __name__ == '__main__':
ABC_86_A() | s590230897 | Accepted | 17 | 2,940 | 170 | def ABC_86_A():
a,b = map(int, input().split())
if (a*b)%2 == 0:
print('Even')
else:
print('Odd')
if __name__ == '__main__':
ABC_86_A() |
s915101323 | p03637 | u326552320 | 2,000 | 262,144 | Wrong Answer | 70 | 20,024 | 637 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: C
# CreatedDate: 2020-09-04 15:44:42 +0900
# LastModified: 2020-09-13 16:01:33 +0900
#
import os
import sys
# import numpy as np
def main():
n = int(input())
A = list(map(int, input().split()))
A_4 = [x for x in A if x % 4 == 0]
A_2 = [x... | s282440502 | Accepted | 68 | 19,984 | 615 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: C
# CreatedDate: 2020-09-04 15:44:42 +0900
# LastModified: 2020-09-13 16:06:20 +0900
#
import os
import sys
# import numpy as np
def main():
n = int(input())
A = list(map(int, input().split()))
A_4 = [x for x in A if x % 4 == 0]
A_2 = [x... |
s267962924 | p03919 | u380653557 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 238 | There is a grid with H rows and W columns. The square at the i-th row and j-th column contains a string S_{i,j} of length 5. The rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from `A` through the W-th letter of the alphabet. Exactly one of the sq... | import sys
next(sys.stdin)
r = 1
for line in sys.stdin:
line = list(line.strip().split())
try:
c = line.index('snuke')
print(str(r) + chr(ord('A') + c))
break
except ValueError:
pass
r += 1
| s583094024 | Accepted | 21 | 3,064 | 238 | import sys
next(sys.stdin)
r = 1
for line in sys.stdin:
line = list(line.strip().split())
try:
c = line.index('snuke')
print(chr(ord('A') + c) + str(r))
break
except ValueError:
pass
r += 1
|
s010258967 | p03997 | u884323674 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a + b) * h * 0.5) | s419779221 | Accepted | 17 | 2,940 | 80 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h * 0.5)) |
s595905497 | p03612 | u021548497 | 2,000 | 262,144 | Wrong Answer | 67 | 13,880 | 149 | You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this. | n = int(input())
a = [int(x) for x in input().split()]
ans = 0
for i in range(n):
if a[i] == i+1:
ans += 1
print(max([ans-1, 1]) if ans else 0) | s059062306 | Accepted | 88 | 13,880 | 199 | n = int(input())
a = [int(x) for x in input().split()]
ans = 0
for i in range(n):
if i == n-1 and a[i] == n:
ans += 1
elif a[i] == i+1:
ans += 1
a[i], a[i+1] = a[i+1], a[i]
print(ans) |
s267831747 | p03813 | u583631641 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 246 | Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. | import sys
s = input();
i = 0
j = 0
for c in s:
if c == 'A':
j = i
while True:
if s[j] == 'Z':
print(j-i + 1)
sys.exit(0)
else :
j = j + 1
i = i + 1
| s065970553 | Accepted | 22 | 3,064 | 73 | x = int(input())
if x < 1200 :
print("ABC")
else:
print("ARC")
|
s092932024 | p03494 | u845937249 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 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. | def how_many_times_div(n):
ans = 0
while n % 2 == 0:
n /= 2
ans += 1
return ans
n = int(input())
a = map(int, input().split())
print (n)
print (a) | s676961555 | Accepted | 18 | 3,064 | 403 |
n = input()
n = int(n)
nums = input().split()
nums = list(map(int,nums))
l = [0] * n
i = 0
for i in range(0,n):
ans = 0
check = nums[i]
while check % 2 == 0:
check = check / 2
ans = ans + 1
#print(check)
l[i] = ans
#print (l)
print(min(l)) |
s197954360 | p03494 | u661567846 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 182 | 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())
nums = list(map(int, input().split()))
maxval = 0
for i in nums:
cnt = 0
while i % 2 == 0:
cnt+=1
i /= 2
if maxval < cnt: maxval = cnt
print(maxval) | s152649490 | Accepted | 19 | 2,940 | 166 | N = int(input())
nums = list(map(int, input().split()))
lst = []
for i in nums:
cnt = 0
while i % 2 == 0:
cnt+=1
i /= 2
lst.append(cnt)
print(min(lst)) |
s790560517 | p03854 | u905203728 | 2,000 | 262,144 | Wrong Answer | 48 | 3,188 | 302 | 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()[::-1]
words=["dreamer","eraser","dream","erase"]
add=0
while add!=len(s):
cnt=0
for i in words:
length=len(i)
word=s[add:add+length][::-1]
if word==i:
add +=length
break
else:cnt +=1
if cnt==4:print("No");exit()
print("Yes") | s796029272 | Accepted | 43 | 3,188 | 255 | s=input()[::-1]
T=["dream","dreamer","erase","eraser"]
l,n=0,len(s)
while l!=n:
flag=0
for i in T:
word=i[::-1]
if s[l:l+len(word)]==word:
l +=len(word)
flag=1
if flag==0:print("NO");exit()
print("YES") |
s105796919 | p02659 | u089230684 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,156 | 86 | Compute A \times B, truncate its fractional part, and print the result as an integer. | a,b=input().split(" ")
c=int(a)*float(b)
print(round(c)) #round off c | s013164751 | Accepted | 22 | 9,164 | 105 | str_a, str_b = input().split()
a = int(str_a)
b_100 = int(str_b.replace('.', ''))
print(a * b_100 // 100) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.