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
s625405979
p03214
u528388170
2,525
1,048,576
Wrong Answer
17
3,060
165
Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe...
n=int(input()) a=[int(i) for i in input().split()] s=sum(a) l=len(a) x=s/l ans=100 for cnt,i in enumerate(a): y=abs(i-x) if y<ans: ans=cnt print(ans)
s571899059
Accepted
17
3,064
173
n=int(input()) a=[int(i) for i in input().split()] s=sum(a) l=len(a) x=s/l z=100 for cnt,i in enumerate(a): y=abs(i-x) if y<z: ans=cnt z=y print(ans)
s899402041
p04012
u516447519
2,000
262,144
Wrong Answer
18
2,940
123
Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful.
w = str(input()) for i in range(len(w)): if w.count(w[i]) % 2 ==0: print('Yes') else: print('No')
s401078989
Accepted
17
2,940
165
w = str(input()) count = int() for i in range(len(w)): if w.count(w[i]) % 2 == 0: count += 1 if count == len(w): print('Yes') else: print('No')
s934711844
p03359
u468972478
2,000
262,144
Wrong Answer
23
9,152
75
In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ...
a, b = map(int, input().split()) if a <= b: print(a + 1) else: print(a)
s966741399
Accepted
29
9,152
61
a, b = map(int, input().split()) print(a - 1 if a > b else a)
s969431959
p03545
u061127257
2,000
262,144
Wrong Answer
17
3,064
415
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...
num = list(map(int,list(input()))) for i in range(len(num) ** 2): op = [] for j in range(len(num)): if (i >> j) & 1: op.append("+") else: op.append("-") sum = num[0] for k in range(1,len(num)): if op[k] == "+": sum += num[k] elif op[k] == "-": sum -= num[k] if sum == 7...
s861330065
Accepted
17
3,064
419
num = list(map(int,list(input()))) for i in range(len(num) ** 2): op = [] for j in range(len(num)): if (i >> j) & 1: op.append("+") else: op.append("-") sum = num[0] for k in range(len(num)-1): if op[k] == "+": sum += num[k+1] elif op[k] == "-": sum -= num[k+1] if sum ...
s744660471
p03448
u256833330
2,000
262,144
Wrong Answer
18
2,940
153
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,b,c,x=[int(input()) for _ in range(4)] print(len([1 for i in range(a+1) for j in range(b+1) if (x-500*a-100*b)%50==0 and 0<=(x-500*a-100*b)//50 <=c]))
s238287649
Accepted
18
2,940
153
a,b,c,x=[int(input()) for _ in range(4)] print(len([1 for i in range(a+1) for j in range(b+1) if (x-500*i-100*j)%50==0 and 0<=(x-500*i-100*j)//50 <=c]))
s601318781
p03469
u911793272
2,000
262,144
Wrong Answer
30
8,944
31
On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col...
S = input() print("2018"+S[:4])
s817568402
Accepted
27
8,984
32
S = input() print("2018"+S[4:])
s158539794
p03795
u136843617
2,000
262,144
Wrong Answer
17
2,940
44
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 ...
x = int(input()) print(x*1500 - (x//15)*200)
s067724392
Accepted
17
2,940
106
def solve(): N = int(input()) print(N*800 - (N//15) * 200) if __name__ == '__main__': solve()
s088444273
p02418
u100813820
1,000
131,072
Wrong Answer
20
7,508
9
Write a program which finds a pattern $p$ in a ring shaped text $s$.
import re
s704773730
Accepted
50
7,632
969
# 18-Character-Ring.py # Input # ????????????????????? p ???????????????????????? # Output # Constraints # 1???p????????????s????????????100 # Sample Input 1 # vanceknowledgetoad # advance # Sample Output 1 # Yes # Sample Input 2 # vanceknowledgetoad # advanced # Sample Output 2 # No import re pattern=[] ...
s313788032
p02646
u731807761
2,000
1,048,576
Wrong Answer
112
27,152
2,157
Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ...
import numpy as np import sys #import copy def xnxn(n=0, flag="v"): """ args: int n: a number of lows to read example: input 1 retrun 1 input 1 2 3 return [1,2,3] input 1 2 3 4 return [[1,2,3], [4]] """ ...
s035041849
Accepted
111
27,004
1,426
import numpy as np import sys # import copy def xnxn(n=0, flag="v"): """ args: int n: a number of lows to read example: input 1 retrun 1 input 1 2 3 return [1,2,3] input 1 2 3 4 return [[1,2,3], [4]] """ ...
s571466470
p02396
u328199937
1,000
131,072
Wrong Answer
130
5,568
125
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give...
num = 1 while True: a = input() if a == '0': break print('case ' + str(num) + ':' + str(a)) num += 1
s952431910
Accepted
130
5,564
126
num = 1 while True: a = input() if a == '0': break print('Case ' + str(num) + ': ' + str(a)) num += 1
s419018785
p03160
u681444474
2,000
1,048,576
Wrong Answer
153
14,680
332
There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of...
N = int(input()) H_ = list(map(int,input().split())) def dp_solver(x): H = H_ dp=[float('inf')]*N dp[0]=0 dp[1]=abs(H[1]-H[0]) for i in range(N-2): dp[i+2] = min(dp[i+2],dp[i]+abs(H[i+2]-H[i])) dp[i+2] = min(dp[i+2],dp[i+1]+abs(H[i+2]-H[i+1])) print(dp) return dp[x-1] print(d...
s120961646
Accepted
121
20,716
208
# coding: utf-8 n = int(input()) h = list(map(int,input().split())) dp = [0] * n dp[1] = abs(h[0]-h[1]) for i in range(2, n): dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2])) print(dp[n-1])
s485277962
p03449
u064408584
2,000
262,144
Wrong Answer
17
3,064
336
We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ...
def C_Candies(): N=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) print(a) print(b) count=0 for i in range(N): if sum(a[i+1:N])<sum(b[i:N-1]): break count = count +1 print(count) print(sum(a[0:count+1])+sum(b[count:...
s914308825
Accepted
17
3,064
268
def C_Candies(): N=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) count=0 for i in range(N): if count < sum(a[0:i+1])+sum(b[i:N+1]): count =sum(a[0:i+1])+sum(b[i:N+1]) print(count) C_Candies()
s815768737
p03943
u778348725
2,000
262,144
Wrong Answer
17
3,060
281
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 = (int(x) for x in input().split()) half_pack = int((a+b+c)/2) if(a == half_pack) and ((b+c) == half_pack): print("YES") elif(b == half_pack) and ((a+c) == half_pack): print("YES") elif(c == half_pack) and ((b+a) == half_pack): print("YES") else: print("NO")
s973476636
Accepted
18
3,060
281
a,b,c = (int(x) for x in input().split()) half_pack = int((a+b+c)/2) if(a == half_pack) and ((b+c) == half_pack): print("Yes") elif(b == half_pack) and ((a+c) == half_pack): print("Yes") elif(c == half_pack) and ((b+a) == half_pack): print("Yes") else: print("No")
s327935801
p02833
u903005414
2,000
1,048,576
Wrong Answer
322
22,284
248
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).
import sys import numpy as np N = int(input()) if N % 2 != 0: print(0) sys.exit() N = N // 10 * 10 ans = 0 for i in range(1, 19): if N < 10**i: break ans += N // 10**i ans += N // 50 ans -= N // 200 print('ans', ans)
s834407029
Accepted
17
2,940
140
import sys N = int(input()) if N % 2 != 0: print(0) sys.exit() N //= 2 ans = 0 while N: ans += N // 5 N //= 5 print(ans)
s002640022
p02601
u514334797
2,000
1,048,576
Wrong Answer
28
9,144
212
M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu...
# B>G>R R,G,B = map(int,input().split()) K = int(input()) cnt = 0 while G<R: G *= 2 cnt += 1 while not B>G: B *= 2 cnt += 1 print(cnt) if cnt<=K: print("Yes") else: print("No")
s218364874
Accepted
30
8,968
201
# B>G>R R,G,B = map(int,input().split()) K = int(input()) cnt = 0 while not G>R: G *= 2 cnt += 1 while not B>G: B *= 2 cnt += 1 if cnt<=K: print("Yes") else: print("No")
s056738773
p03556
u403355272
2,000
262,144
Wrong Answer
17
3,060
39
Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer.
x = int(input()) print((int(x ** 0.5)))
s863248015
Accepted
17
2,940
44
x = int(input()) print((int(x ** 0.5)) ** 2)
s872221593
p03861
u279229189
2,000
262,144
Wrong Answer
19
3,060
102
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?
v = input().split(" ") a = int(v[0]) b = int(v[1]) x = int(v[2]) fb = b/x fa = (a-1)/x print(fb-fa)
s696385584
Accepted
17
3,060
112
v = input().split(" ") a = int(v[0]) b = int(v[1]) x = int(v[2]) fb = b//x fa = (a-1)//x print(max(fb-fa, 0))
s472175945
p03455
u985376351
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 = map(int, input().split()) if a%2==0 and b%2==0: print('Even') else: print('Odd')
s098882286
Accepted
19
2,940
92
a, b = map(int, input().split()) c = a*b if c%2==0: print('Even') else: print('Odd')
s449925884
p02665
u135847648
2,000
1,048,576
Wrong Answer
2,211
180,596
462
Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.
def main(): n = int(input()) A = list(map(int, input().split())) if A[0] != 0: print(-1) exit() tree = [2 ** i for i in range(n + 1)] tree[-1] = A[-1] for i in range(n): if A[i] > tree[i]: print(-1) exit() for i in range(n - 1, 0, -1): ...
s333461392
Accepted
84
20,024
822
def main(): n = int(input()) A = list(map(int, input().split())) B = [0] * (n+1) if n == 0: x = A[0] if x == 1: print(1) else: print(-1) exit() # A0 + B0 = 1 now_s = sum(A) s = now_s for i in range(n+1): ...
s426795358
p03644
u408375121
2,000
262,144
Wrong Answer
17
2,940
63
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()) i = 0 while 2 ** i <= N: i += 1 print(i - 1)
s636688243
Accepted
17
2,940
71
N = int(input()) i = 0 while 2 ** i <= N: i += 1 print(2 ** (i - 1))
s610344384
p03337
u413165887
2,000
1,048,576
Wrong Answer
17
2,940
136
You are given two integers A and B. Find the largest value among A+B, A-B and A \times B.
n,*a=map(int,open(0).read().split());x=s=l=c=0 for r,b in enumerate(a): x^=b;s+=b while x<s:x^=a[l];s-=a[l];l+=1 c+=r-l+1 print(c)
s293672836
Accepted
17
2,940
58
a, b = map(int, input().split()) print(max([a*b,a-b,a+b]))
s457167108
p02694
u022215787
2,000
1,048,576
Wrong Answer
24
9,020
84
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()) c = 100 r = 0 while c <= x: c = int(c*1.01) r += 1 print(r)
s336294559
Accepted
22
9,168
88
x = int(input()) c = 100 r = 0 while c < x: c = c + int(c*0.01) r += 1 print(r)
s235830411
p03944
u804358525
2,000
262,144
Wrong Answer
69
3,188
729
There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po...
# -*- coding: utf-8 -*- w,h,n = map(int, input().split()) print(w,h) area = [[0 for i in range(w)] for j in range(h)] for i in range(n): a,b,c = map(int, input().split()) if(c == 1): for j in range(h): for k in range(a): area[j][k] = 1 if (c == 2): for j in ran...
s002799309
Accepted
74
3,064
718
# -*- coding: utf-8 -*- w,h,n = map(int, input().split()) area = [[0 for i in range(w)] for j in range(h)] for i in range(n): a,b,c = map(int, input().split()) if(c == 1): for j in range(h): for k in range(a): area[j][k] = 1 if (c == 2): for j in range(h): ...
s342839867
p02613
u504573674
2,000
1,048,576
Wrong Answer
159
9,124
328
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`,...
t = int(input()) c0 = 0 c1 = 0 c2 = 0 c3 = 0 for i in range(t): 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 ' + str(c0)) print('WA X ' + str(c1)) print('TLE X ' + str(c2)) print('RE X ' + ...
s301551905
Accepted
160
9,096
328
t = int(input()) c0 = 0 c1 = 0 c2 = 0 c3 = 0 for i in range(t): 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 ' + str(c0)) print('WA x ' + str(c1)) print('TLE x ' + str(c2)) print('RE x ' + ...
s851072259
p02396
u313089641
1,000
131,072
Wrong Answer
80
7,960
154
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give...
num = [] while True: x = int(input()) if x == 0: break num.append(x) for i, n in enumerate(num): print('Case{} :{}'.format(i, n))
s551582103
Accepted
70
8,124
163
num = [] while True: x = int(input()) if x == 0: break num.append(x) for i, n in enumerate(num, start=1): print('Case {}: {}'.format(i, n))
s712872434
p03699
u652656291
2,000
262,144
Wrong Answer
19
3,060
202
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When...
n = int(input()) s =[int(input()) for i in range(n)] s.sort() s_sum =sum(s) if s_sum % 10 != 0: print(s_sum) else: for i in range(n): if s[i] % 10 != 0: s[i] = 0 break print(s_sum)
s193690804
Accepted
18
2,940
152
n = int(input()) s = [0] for i in range(n): s.append(int(input())) m=sum(s) s.sort() for x in s: if (m-x)%10!=0: print(m-x) exit() print(0)
s556371526
p02399
u264450287
1,000
131,072
Wrong Answer
20
5,600
75
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 = a / b print(d,r,f)
s682062103
Accepted
20
5,608
92
a,b = map(int,input().split()) d = a // b r = a % b f = a / b print(d,r,"{:.5f}".format(f))
s982003374
p03543
u093492951
2,000
262,144
Wrong Answer
18
2,940
85
We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**?
N = input() if N[0] == N[1] and N[1] == N[2]: print("yes") else: print("no")
s451830393
Accepted
17
2,940
122
N = input() if (N[0] == N[1] and N[1] == N[2]) or (N[1] == N[2] and N[2] == N[3]): print("Yes") else: print("No")
s160710332
p02659
u945405878
2,000
1,048,576
Wrong Answer
22
9,096
116
Compute A \times B, truncate its fractional part, and print the result as an integer.
a, b = input().split(" ") A, B = int(a), float(b) B100 = int(round(B * 100)) C = int(round(A * B100 / 100)) print(C)
s498029663
Accepted
20
9,100
110
a, b = input().split(" ") A, B = int(a), float(b) B100 = round(B * 100) C = A * B100 ans = C // 100 print(ans)
s359888698
p03827
u902151549
2,000
262,144
Wrong Answer
19
3,184
210
You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri...
# coding: utf-8 import time import re import math def main(): n=int(input()) s=input() x=0 mx=0 for a in s: if(a=='I'):x+=1 elif(a=='D'):x-=1 mx=max([mx,x]) main()
s781972256
Accepted
19
3,184
223
# coding: utf-8 import time import re import math def main(): n=int(input()) s=input() x=0 mx=0 for a in s: if(a=='I'):x+=1 elif(a=='D'):x-=1 mx=max([mx,x]) print(mx) main()
s215440508
p02259
u253463900
1,000
131,072
Wrong Answer
30
7,484
404
Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in...
n = int(input()) s = input() A = list(map(int,s.split())) flag = 1 while(flag == 1): for k in range(0,len(A)-1): print(A[k],end=" ") print(A[len(A)-1]) flag = 0 for j in range(n-1,0,-1): if A[j] < A[j-1]: tmp = A[j] A[j] = A[j-1] A[j-1] = tmp ...
s217929547
Accepted
60
7,616
362
n = int(input()) s = input() A = list(map(int,s.split())) flag = 1 cnt = 0 while(flag == 1): flag = 0 for j in range(n-1,0,-1): if A[j] < A[j-1]: tmp = A[j] A[j] = A[j-1] A[j-1] = tmp flag = 1 cnt += 1 for k in range(0,len(A)-1): print(A[...
s780981360
p03480
u846150137
2,000
262,144
Wrong Answer
2,104
9,952
430
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis...
l=input() def hntn(a,s,t): e=s+t n="".join([str((int(i)+1) % 2) for i in a[s:e]]) return a[:s]+ n + a[e:] for i in range(len(l),0,-1): c=[] for w in range(len(l),i-1,-1): d='0'*len(l) for j in range(2*(len(l)-i+1)): b='0'*(len(l)-i+1-len(str(format(j, 'b'))))+str(format(j, 'b')) for v in...
s262283351
Accepted
66
3,188
114
l=input() n=len(l) x = n for i in range(1,n): if l[i-1] != l[i]: nx = max(i, n-i) x = min(x,nx) print(x)
s261019402
p03637
u494209838
2,000
262,144
Wrong Answer
307
23,072
397
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.
# -*- coding: utf-8 -*- import numpy as np N = np.int64(input()) a = np.array([int(x) for x in input().split()]) mod_a = np.mod(a, 4) count4 = (mod_a==0).sum() count2 = (mod_a==2).sum() odd = ((mod_a==1) | (mod_a==3)).sum() if N % 2 == 0: if count4 >= odd: print('yes') else: print('no') else: ...
s824488720
Accepted
363
23,072
397
# -*- coding: utf-8 -*- import numpy as np N = np.int64(input()) a = np.array([int(x) for x in input().split()]) mod_a = np.mod(a, 4) count4 = (mod_a==0).sum() count2 = (mod_a==2).sum() odd = ((mod_a==1) | (mod_a==3)).sum() if N % 2 == 0: if count4 >= odd: print('Yes') else: print('No') else: ...
s060437673
p02747
u854405453
2,000
1,048,576
Wrong Answer
17
2,940
63
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.
s = input() s.replace("hi", "") print("Yes" if s=="" else "No")
s105989124
Accepted
17
2,940
65
s = input() s=s.replace("hi", "") print("Yes" if s=="" else "No")
s652809155
p03545
u543954314
2,000
262,144
Wrong Answer
17
3,064
217
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...
e = (1,-1) a,b,c,d = map(int, list(input())) for i in e: for j in e: for k in e: if a+b*i+c*j+d*k == 7: break dic = {1:"+",-1:"-"} l = [a,dic[i],b,dic[j],c,dic[k],d] print("".join(map(str,l))+"=7")
s747649345
Accepted
18
3,064
231
from itertools import product e = (1,-1) a,b,c,d = map(int, list(input())) for i,j,k in product(e,repeat=3): if a+b*i+c*j+d*k == 7: break dic = {1:"+",-1:"-"} l = [a,dic[i],b,dic[j],c,dic[k],d] print("".join(map(str,l))+"=7")
s343605031
p03699
u769870836
2,000
262,144
Wrong Answer
17
3,060
206
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When...
n=int(input()) l=sorted([int(input()) for i in range(n)]) if sum(l)%10!=0: print(sum(l)) else: ans=sum(l) for i in range(n): ans-=l[-1-i] if ans%10!=0: print(ans) quit() print(0)
s088928685
Accepted
18
3,060
206
n=int(input()) l=sorted([int(input()) for i in range(n)]) if sum(l)%10!=0: print(sum(l)) else: ans=sum(l) for i in range(n): if l[i]%10!=0: ans-=l[i] print(ans) quit() print(0)
s843106658
p02240
u424457654
1,000
131,072
Wrong Answer
30
5,604
778
Write a program which reads relations in a SNS (Social Network Service), and judges that given pairs of users are reachable each other through the network.
def dfs(r, c): global color global g s = [r] color[r] = c while len(s) > 0: u = s.pop() for u in g[u]: v = color[u] if v is None: color[u] = c s.append(u) def assigncolor(): global g global color glo...
s045476713
Accepted
710
23,388
821
def dfs(r, c): global color global g s = [r] color[r] = c while len(s) > 0: u = s.pop() for u in g[u]: v = color[u] if v is None: color[u] = c s.append(u) def assigncolor(): global g global color glo...
s902398302
p03545
u327532412
2,000
262,144
Wrong Answer
19
3,064
282
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, = list(input()) s = ['+', '-'] for i in range(2**3): formula = A[0] for j in range(3): if i >> j & 1: formula += s[0] else: formula += s[1] formula += A[j+1] if eval(formula) == 7: print(formula) exit()
s742159238
Accepted
29
9,064
258
ABCD = list(input()) ope = ['+', '-'] for i in range(2**3): f = ABCD[0] for j in range(3): if i >> j & 1: f += '+' else: f += '-' f += ABCD[j+1] if eval(f) == 7: print(f+"=7") exit()
s756251267
p02406
u299231628
1,000
131,072
Wrong Answer
20
5,584
155
In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ...
n = int(input()) i = 1 a = '' while i <= n: if i % 3 == 0: a += ' ' + str(i) if i % 10 == 3: a += ' ' + str(i) i += 1 print(a)
s881545463
Accepted
30
5,980
326
n = int(input()) i = 1 l = [] while i <= n: x = i if x % 3 == 0: l.append(i) elif x % 10 == 3: l.append(i) else: x /= 10 x = int(x) while x: if x % 10 == 3: l.append(i) break x /= 10 x = int(x) i += 1 print('...
s897914647
p03943
u646336933
2,000
262,144
Wrong Answer
17
2,940
106
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 or b+c==a or c+a==b: print("YES") else: print("NO")
s435364952
Accepted
17
2,940
106
a, b, c = map(int, input().split()) if a+b==c or b+c==a or c+a==b: print("Yes") else: print("No")
s300086778
p03501
u740047492
2,000
262,144
Wrong Answer
18
3,188
79
You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours.
n, a, b = map(int, input().split()) if (n*a) > b: print(n*a) else: print(b)
s421349627
Accepted
17
2,940
79
n, a, b = map(int, input().split()) if (n*a) < b: print(n*a) else: print(b)
s295972450
p03251
u111508936
2,000
1,048,576
Wrong Answer
863
21,524
352
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli...
import numpy as np import math # K = int(input()) # N, K = map(int, input().split()) # A = list(map(int, input().split())) N, M, X, Y = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) maxx = max(x) miny = min(y) if miny > maxx and maxx < Y and miny < X: print('...
s317721934
Accepted
149
12,508
371
import numpy as np import math # K = int(input()) # N, K = map(int, input().split()) # A = list(map(int, input().split())) N, M, X, Y = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) maxx = max(x) miny = min(y) maxxx = max(maxx, X) minyy = min(miny, Y) if maxxx <...
s642667350
p03845
u519939795
2,000
262,144
Wrong Answer
18
2,940
161
Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d...
n = int(input()) T = list(map(int, input().split())) s = sum(T) m = int(input()) for _ in range(m): p, x = map(int, input().split()) sub = -x + T[p - 1]
s367084143
Accepted
18
3,060
179
n = int(input()) T = list(map(int, input().split())) s = sum(T) m = int(input()) for _ in range(m): p, x = map(int, input().split()) sub = -x + T[p - 1] print(s - sub)
s609109006
p02417
u874395007
1,000
131,072
Wrong Answer
20
5,556
211
Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters.
import sys data = sys.stdin.read() letters = 'abcdefghijklmnopqrstuvwxyz' for letter in letters: count = 0 for d in data: if letter == d: count += 1 print(f'{letter} : {count}')
s054347869
Accepted
20
5,564
219
import sys data = sys.stdin.read() letters = 'abcdefghijklmnopqrstuvwxyz' for letter in letters: count = 0 for d in data: if letter == d.lower(): count += 1 print(f'{letter} : {count}')
s561993514
p03836
u480847874
2,000
262,144
Wrong Answer
18
3,064
504
Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ...
def m(): sx, sy, tx, ty = map(int, input().split()) X = tx-sx Y = ty-sy ans = "" for _ in range(X): ans += "R" for _ in range(Y): ans += "U" for _ in range(X): ans += "L" for _ in range(Y): ans += "D" ans += "D" for _ in range(X): ans +...
s591375295
Accepted
17
3,064
455
def m(): sx, sy, tx, ty = map(int, input().split()) X = tx-sx Y = ty-sy ans = "" ans += "U" * Y ans += "R" * X ans += "D" * Y ans += "L" * X ans += "L" ans += "U" * (Y+1) ans += "R" * (X+1) ans += "D" ans += "R" ans += "D" * (Y+1) ans += "L" ...
s028794460
p03485
u564060397
2,000
262,144
Wrong Answer
17
2,940
91
You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer.
a,b=map(int,input().split()) if (a+b)%2==0: print((a+b)/2) else: print((a+b)//2+1)
s160718447
Accepted
17
2,940
49
a,b=map(int,input().split()) print(-(-(a+b)//2))
s340616000
p03486
u420522278
2,000
262,144
Wrong Answer
18
3,064
202
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() sl = sorted(s) tl = sorted(t) out = 'No' for i in range(0,min(len(s), len(t))): if sl[i] < tl[-1*i]: out = 'Yes' break elif sl[i] > tl[-1*i]: break print(out)
s029371668
Accepted
17
2,940
130
s = input() t = input() sl = ''.join(sorted(s)) tl = ''.join(reversed(sorted(t))) if sl < tl: print('Yes') else: print('No')
s312010741
p02602
u996506712
2,000
1,048,576
Wrong Answer
168
31,600
162
M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m...
n,k=map(int,input().split()) a=list(map(int,input().split())) print(a) for i in range(n-k): if a[k+i]>a[i]: print('Yes') else: print('No')
s512842190
Accepted
144
31,524
153
n,k=map(int,input().split()) a=list(map(int,input().split())) for i in range(n-k): if a[k+i]>a[i]: print('Yes') else: print('No')
s399869989
p03433
u725044506
2,000
262,144
Wrong Answer
17
2,940
96
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()) a = N % 500 if a <= A: print('YES') else: print('NO')
s328268044
Accepted
17
2,940
96
N = int(input()) A = int(input()) a = N % 500 if a <= A: print('Yes') else: print('No')
s567573114
p03352
u064408584
2,000
1,048,576
Wrong Answer
17
2,940
126
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()) a=0 for i in range(300): for j in range(11): if i**j>x: break if a<i**j: a=i**j print(a)
s709342699
Accepted
17
2,940
128
x=int(input()) a=0 for i in range(300): for j in range(2,11): if i**j>x: break if a<i**j: a=i**j print(a)
s294888575
p02697
u614875193
2,000
1,048,576
Wrong Answer
69
9,280
66
You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi...
N,M=map(int,input().split()) for i in range(M): print(1+i,N-i)
s599988063
Accepted
102
21,180
393
N,M=map(int,input().split()) ans=[] if N%2==0: N-=1 half=N//2 if half%2==0: for i in range(half//2): ans.append((i+1,half-i)) for j in range(half//2): ans.append((half+1+j,N-j)) else: for i in range(half//2): ans.append((i+1,half-i)) for j in range(half//2+1): ans....
s998721280
p03625
u969708690
2,000
262,144
Wrong Answer
155
33,264
224
We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.
import collections N=int(input()) L=list(map(int,input().split())) c = collections.Counter(L) A=c.keys() B=c.values() R = zip(A,B) R=sorted(R,reverse=True) a, b = zip(*R) if b[0]>=4: print(a[0]**2) else: print(a[0]*a[1])
s022752133
Accepted
111
22,384
353
import collections N=int(input()) L=list(map(int,input().split())) c = collections.Counter(L) A=list(c.keys()) B=list(c.values()) R=list() for i in range(len(A)): if B[i]>=2: R.append([A[i],B[i]]) R=sorted(R,reverse=True) if len(R)==0: print(0) exit() if R[0][1]>=4: print(R[0][0]**2) elif len(R)<2: print(...
s971580559
p02393
u058433718
1,000
131,072
Wrong Answer
20
5,600
229
Write a program which reads three integers, and prints them in ascending order.
data = input() nums = [int(i) for i in data.split()] max_idx = len(nums) for i in range(1, max_idx): for j in range(max_idx-i): if nums[j] > nums[j+1]: nums[j], nums[j+1] = nums[j+1], nums[j] print(nums)
s805199166
Accepted
20
5,608
257
data = input() nums = [int(i) for i in data.split()] max_idx = len(nums) for i in range(1, max_idx): for j in range(max_idx-i): if nums[j] > nums[j+1]: nums[j], nums[j+1] = nums[j+1], nums[j] print(' '.join([str(i) for i in nums]))
s345364312
p03693
u532966492
2,000
262,144
Wrong Answer
17
2,940
57
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...
print("YNEOS"[int("".join(sorted(input()))[2:])%4!=0::2])
s933296393
Accepted
17
2,940
111
def main(): a, b, c = map(int, input().split()) print(['NO', 'YES'][(a*100+b*10+c) % 4 == 0]) main()
s505450425
p02743
u891945807
2,000
1,048,576
Wrong Answer
17
2,940
109
Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold?
a,b,c = map(int,input().split()) res = (c-a-b)**2 - a*b if res > 0 : print('Yes') else: print('No')
s074224975
Accepted
17
2,940
126
a,b,c = map(int,input().split()) res = (c-a-b)**2 - 4* a*b if res > 0 and c-a-b > 0 : print('Yes') else: print('No')
s725771506
p04012
u408620326
2,000
262,144
Wrong Answer
17
2,940
101
Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful.
w=input().split() ans='No' for wd in w: if w.count(wd)%2!=0: break else: ans='Yes' print(ans)
s411309948
Accepted
17
2,940
93
w=input() ans='No' for wd in w: if w.count(wd)%2!=0: break else: ans='Yes' print(ans)
s955672619
p03836
u964299793
2,000
262,144
Wrong Answer
17
3,064
284
Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ...
sx,sy,tx,ty=map(int,input().split()) print('U'*(ty-sy),end='') print('R'*(tx-sx),end='') print('D'*(ty-sy),end='') print('L'*(tx-sx),end='') print('L',end='') print('U'*(ty-sy+1),end='') print('R'*(tx-sx+1),end='') print('D'*(ty-sy+1),end='') print('L'*(tx-sx+1),end='') print('U')
s071814483
Accepted
17
3,064
320
sx,sy,tx,ty=map(int,input().split()) print('U'*(ty-sy),end='') print('R'*(tx-sx),end='') print('D'*(ty-sy),end='') print('L'*(tx-sx),end='') print('L',end='') print('U'*(ty-sy+1),end='') print('R'*(tx-sx+1),end='') print('D',end='') print('R',end='') print('D'*(ty-sy+1),end='') print('L'*(tx-sx+1),end='') print('U')
s412942740
p03547
u626468554
2,000
262,144
Wrong Answer
18
2,940
194
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`,...
#n = int(input()) #n,k = map(int,input().split()) #x = list(map(int,input().split())) a = list(input()) if a[0] > a[1]: print(">") elif a[0] == a[1]: print("=") else: print("<")
s477524012
Accepted
17
2,940
235
#n = int(input()) #n,k = map(int,input().split()) #x = list(map(int,input().split())) a = list(input().split()) li = ["A","B","C","D","E","F"] if a[0] > a[1]: print(">") elif a[0] == a[1]: print("=") else: print("<")
s937807910
p03502
u320098990
2,000
262,144
Wrong Answer
17
3,060
205
An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number.
N = int(input()) f = 0 N_dammy = N while N_dammy>0: f += N_dammy % 10 N_dammy = int(N_dammy/10) print("f:",f) print("N_dammy:",N_dammy) if N%f==0: print("Yes") else: print("No")
s556920348
Accepted
17
2,940
156
N = int(input()) f = 0 N_dammy = N while N_dammy>0: f += N_dammy % 10 N_dammy = int(N_dammy/10) if N%f==0: print("Yes") else: print("No")
s896097873
p04029
u852790844
2,000
262,144
Wrong Answer
17
2,940
33
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?
n = int(input()) print(n*(n+1)/2)
s915580984
Accepted
17
2,940
39
n = int(input()) print(int(n*(n+1)/2))
s473102075
p03569
u539517139
2,000
262,144
Wrong Answer
60
3,316
182
We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly: * Insert a letter `x` to any position in s of his choice, including the beginning and end of s. Snuke's objective is to turn s into a palindrome. Determine whether the objective is achievable. If it is ...
s=input() l=0 r=len(s)-1 x=0 while l<r: if s[l]==s[r]: l+=1 r-=1 elif s[l]=='x': x+=1 l+=1 elif s[l]=='x': x+=1 r-=1 else: x=-1 break print(x)
s571265590
Accepted
62
3,316
182
s=input() l=0 r=len(s)-1 x=0 while l<r: if s[l]==s[r]: l+=1 r-=1 elif s[l]=='x': x+=1 l+=1 elif s[r]=='x': x+=1 r-=1 else: x=-1 break print(x)
s468859289
p03434
u201928947
2,000
262,144
Wrong Answer
17
3,060
181
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 = list(map(int,input().split())) ans1 = 0 ans2 = 0 for i in range(n): if i % 2 == 1: ans1 += a[i] else: ans2 += a[i] print(max(ans1,ans2))
s891212843
Accepted
17
3,060
199
n = int(input()) a = sorted(list(map(int,input().split())),reverse = True) ans1 = 0 ans2 = 0 for i in range(n): if i % 2 == 0: ans1 += a[i] else: ans2 += a[i] print(ans1-ans2)
s221216903
p03721
u146597538
2,000
262,144
Wrong Answer
464
34,320
267
There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2...
n,k = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(n)] s_ab = sorted(ab, key=lambda x: x[0]) cnt = 0 ans = -1 print(s_ab) for i in s_ab: cnt += i[1] if cnt >= k: print(cnt) ans = i[0] break print(ans)
s169700573
Accepted
499
28,640
187
n,k = map(int, input().split()) ab = sorted([list(map(int, input().split())) for _ in range(n)]) cnt = 0 for i in ab: cnt += i[1] if cnt >= k: print(i[0]) exit(0)
s780015286
p03162
u506858457
2,000
1,048,576
Wrong Answer
632
35,660
460
Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain...
N = int(input()) a, b, c = [0] * N, [0] * N, [0] * N for i in range(N): a[i], b[i], c[i] = map(int, input().split()) dp = [[0] * 3 for _ in range(N)] print(dp) dp[0] = [a[0], b[0], c[0]] for i in range(N - 1): dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i + 1], dp[i][2] + a[i + 1]) dp[i + 1][1] = max(dp[i + 1][1],...
s421625946
Accepted
993
47,348
407
n=int(input()) happy=[list(map(int, input().split())) for i in range(n)] dp=[[0 for j in range(3)] for i in range(n+1)] for i in range(1,n+1): for place in range(3): for placeY in range(3): if place==placeY: continue dp[i][place]=max(dp[i][place], dp[i-1][placeY]+happy[...
s882609039
p03574
u011062360
2,000
262,144
Wrong Answer
29
3,444
522
You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con...
h, w = map(int, input().split()) map = a = [ list(input()) for _ in range(h) ] d = [[1, 0], [0, 1], [1, 1], [-1, 0], [0, -1], [-1, -1], [1, -1], [-1, 1]] for i in range(h): for j in range(w): cnt = 0 if map[i][j] == ".": for dx, dy in d: nx = j + dx ny = ...
s202475042
Accepted
28
3,444
529
h, w = map(int, input().split()) map = a = [ list(input()) for _ in range(h) ] d = [[1, 0], [0, 1], [1, 1], [-1, 0], [0, -1], [-1, -1], [1, -1], [-1, 1]] for i in range(h): for j in range(w): cnt = 0 if map[i][j] == ".": for dx, dy in d: nx = j + dx ny = ...
s065777915
p03657
u350093546
2,000
262,144
Wrong Answer
17
2,940
112
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 and b%3!=0 and (a+b)%3!=0: print('Impossible') else: print('Posible')
s723919861
Accepted
17
2,940
114
a,b=map(int,input().split()) if a%3!=0 and b%3!=0 and (a+b)%3!=0: print('Impossible') else: print('Possible')
s093867624
p03110
u810066979
2,000
1,048,576
Wrong Answer
18
3,060
203
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`...
import sys import math import itertools n=input() sum=0 for i in range(int(n)): x,u=list(input().split()) if u=="JPY": sum+=int(x) else : b_money=float(x)*380000.0 sum+=int(b_money) print(sum)
s562329209
Accepted
18
3,060
199
import sys import math import itertools n=input() sum=0 for i in range(int(n)): x,u=list(input().split()) if u=="JPY": sum+=int(x) else : b_money=float(x)*380000.0 sum+=b_money print(sum)
s463192976
p03672
u773686010
2,000
262,144
Wrong Answer
30
9,100
174
We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del...
N = str(input()) cnt = 0 while True: N = N[0:-1] cnt += 1 if len(N) % 2 == 0: if N[0:int(len(N)/2)] == N[int(len(N)/2):]: break print(cnt)
s042673138
Accepted
30
9,060
154
N = str(input()) while True: N = N[0:-1] if len(N) % 2 == 0: if N[0:int(len(N)/2)] == N[int(len(N)/2):]: break print(len(N))
s036456548
p03369
u517152997
2,000
262,144
Wrong Answer
17
3,060
291
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("in") if S == "ooo" : print('1000') elif S == "oox": print('900') elif S == "oxo" : print('900') elif S == "xoo": print('900') elif S == "oxx": print('800') elif S == "xox": print('800') elif S == "xxo": print('800') elif S == "xxx": print('700')
s037311718
Accepted
17
2,940
276
S = input() if S == "ooo" : print('1000') elif S == "oox": print('900') elif S == "oxo" : print('900') elif S == "xoo": print('900') elif S == "oxx": print('800') elif S == "xox": print('800') elif S == "xxo": print('800') else: print('700')
s084328002
p03090
u335278042
2,000
1,048,576
Wrong Answer
20
3,572
323
You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved...
#import collections as c #ip = lambda : map(int, input().split()) ################# N = int(input()) S = N*(N+1)/2 r = [] a = [] b = [] f = 1 for i in range(N,0,-1): if f%4==1 or f%4==0: a.append(i) f += 1 else: b.append(i) f += 1 for ia in a: for ib in b: print(ia,...
s077238722
Accepted
24
3,612
695
#import collections as c #ip = lambda : map(int, input().split()) ################# N = int(input()) if N%2==0: print(N*(N-1)//2-N//2) S = N + 1 for i in range(1,N): for j in range(i+1,N+1): if i!=j and i+j!=S: print(i,j) elif N%2==1: print(N*(N-1)//2-(N-1)//2) ...
s257742278
p03798
u633450100
2,000
262,144
Wrong Answer
20
3,316
45
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() print("WWSSSS")
s654466747
Accepted
236
3,740
4,892
N = int(input()) s = str(input()) A = '' def majikayo(): k = 0 if A[0] == 'S' and s[0] == 'o': if A[-1] == 'S' and s[-1] == 'o': if A[1] == 'S' and A[-2] == 'S': k = 1 elif A[-1] == 'S' and s[-1] == 'x': if A[1] == 'S' and A[-2] == 'W': k ...
s300406007
p03339
u057109575
2,000
1,048,576
Wrong Answer
17
3,060
137
There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the...
S = input() cnt = S.count('E') ans = cnt for v in S: if v == 'E': cnt -= 1 else: cnt += 1 ans = min(ans, cnt) print(ans)
s893479917
Accepted
124
3,676
148
N = input() S = input() cnt = S.count('E') ans = cnt for v in S: if v == 'E': cnt -= 1 else: cnt += 1 ans = min(ans, cnt) print(ans)
s879787974
p03545
u996996256
2,000
262,144
Wrong Answer
18
3,064
343
Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in...
s = input() n= 2**(len(s)-1) ans = 'inf' for i in range(n): total = int(s[0]) str = s[0] for j in range(1,len(s)): if i>>(len(s)-j)&1: total += int(s[j]) str += '+' + s[j] else: total -= int(s[j]) str += '-' + s[j] if total == 7: an...
s736820188
Accepted
17
3,060
318
s = input() for i in range(8): total = int(s[0]) str = s[0] for j in range(1, 4): if i >> (j - 1) & 1: total += int(s[j]) str += '+' + s[j] else: total -= int(s[j]) str += '-' + s[j] if total == 7: print(str + '=7') exit()
s761891555
p03456
u867826040
2,000
262,144
Wrong Answer
18
3,060
99
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.
n = int("".join(input().split())) x = n**(1/2) if x%1 != 0: print("No") else: print(int(x))
s858185467
Accepted
18
3,060
98
n = int("".join(input().split())) x = n**(1/2) if x%1 != 0: print("No") else: print("Yes")
s126917146
p03007
u994988729
2,000
1,048,576
Wrong Answer
259
19,532
355
There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the...
from collections import deque n = int(input()) a = list(map(int, input().split())) a.sort() a = deque(a) left = a.popleft() right = a.pop() ans = [] for i in a: if i > 0: ans.append((left, i)) left -= i else: ans.append((right, i)) right -= i else: ans.append((right, left))...
s229691525
Accepted
261
19,524
373
from collections import deque n = int(input()) a = list(map(int, input().split())) a.sort() a = deque(a) left = a.popleft() right = a.pop() ans = [] for i in a: if i > 0: ans.append((left, i)) left -= i else: ans.append((right, i)) right -= i else: ans.append((right, left))...
s385306064
p02259
u905313459
1,000
131,072
Time Limit Exceeded
40,000
7,376
256
Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in...
import sys x = input() y = input().split() r = sorted(y) c = 0 while y != r: for i, j in enumerate(y[:-1]): if y[i] > y[i+1]: y[i], y[i+1] = y[i+1], y[i] c += 1 else: break print(" ".join(y)) print(c)
s556346758
Accepted
20
7,704
231
x = int(input()) y = input() y = list(map(int, y.split())) r = sorted(y) c = 0 while y != r: for i, j in enumerate(y[:-1]): if y[i] > y[i+1]: y[i], y[i+1] = y[i+1], y[i] c += 1 print(*y) print(c)
s531122085
p03563
u580093517
2,000
262,144
Wrong Answer
17
2,940
37
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...
print(int(input())**2 - int(input()))
s571478375
Accepted
18
2,940
39
print(-(int(input()) - 2*int(input())))
s068035689
p03361
u460468647
2,000
262,144
Wrong Answer
21
3,188
521
We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i...
h,w = map(int,input().split()) array = [] for _ in range(h): array.append(list(map(str,input()))) print(array) for i in range(h): array[i].insert(0,".") array[i].append(".") print(array) array.insert(0,["."]*(w+2)) array.append(["."]*(w+2)) print(array) for i in range(1,h+1): for j in range(1,w+1): if array...
s949220300
Accepted
18
3,064
313
H,W=map(int,input().split()) S=["."+input()+"." for i in range(H)] S=["."*(W+2)]+S+["."*(W+2)] flag=0 for i in range(H): for j in range(W): if S[i][j]=="#": if S[i-1][j]=="." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".": flag=1 print("Yes" if flag==0 else "No")
s404224557
p03827
u214547877
2,000
262,144
Wrong Answer
30
9,160
118
You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri...
N = int(input()) S = input() ans = 0 for i in range(N): if S[i] == "I": ans += 1 else: ans -= 1 print(ans)
s952173437
Accepted
31
9,176
139
N = int(input()) S = input() ans = 0 x = 0 for i in range(N): if S[i] == "I": x += 1 else: x -= 1 ans = max(ans,x) print(ans)
s090412570
p03605
u911612592
2,000
262,144
Wrong Answer
33
9,092
79
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?
s = str(input()) if s[0] == 9 or s[1] == 9: print("Yes") else: print("No")
s582958345
Accepted
29
9,016
53
if "9" in input(): print("Yes") else: print("No")
s958266433
p03659
u099566485
2,000
262,144
Wrong Answer
229
24,948
216
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...
#067-C n=int(input()) a=list(map(int,input().split())) sa=[a[0] for i in range(n)] for i in range(1,n): sa[i]=sa[i-1]+a[i] mm=float("INF") for i in range(n): mm=min(mm,abs(a[i]-(sa[n-1]-a[i]))) print(int(mm))
s495045545
Accepted
231
24,812
220
#067-C n=int(input()) a=list(map(int,input().split())) sa=[a[0] for i in range(n)] for i in range(1,n): sa[i]=sa[i-1]+a[i] mm=float("INF") for i in range(n-1): mm=min(mm,abs(sa[i]-(sa[n-1]-sa[i]))) print(int(mm))
s311130182
p03090
u509911932
2,000
1,048,576
Wrong Answer
45
4,484
878
You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved...
""" 234 23 134 14 124 14 123 23 """ import copy N = 100 initial = [list(range(1, N + 1)) for i in range(N)] for i in range(N): initial[i].pop(i) # print(initial) neighbors = copy.deepcopy(initial) S = sum(neighbors[-1]) while True: # print(S) # print(neighbors) for i, tyouten in enumerate(neighbors...
s891760819
Accepted
43
4,356
887
""" 234 23 134 14 124 14 123 23 """ import copy N = int(input()) initial = [list(range(1, N + 1)) for i in range(N)] for i in range(N): initial[i].pop(i) # print(initial) neighbors = copy.deepcopy(initial) S = sum(neighbors[-1]) while True: # print(S) # print(neighbors) for i, tyouten in enumerate(...
s058053849
p03024
u814986259
2,000
1,048,576
Wrong Answer
28
9,004
68
Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons...
S=input() k=S.count("o") if k>=8: print("YES") else: print("NO")
s984335156
Accepted
31
9,012
87
S=input() l=len(S) k=S.count("o") K=15-l if k+K>=8: print("YES") else: print("NO")
s694052030
p03369
u728498511
2,000
262,144
Wrong Answer
17
2,940
39
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ...
print(700+100*list(input()).count("x"))
s729169628
Accepted
17
2,940
39
print(700+100*list(input()).count("o"))
s878851259
p03455
u082584636
2,000
262,144
Wrong Answer
17
2,940
124
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
int_list = list(map(int, input().split())) if (((int_list[0] + int_list[1]) % 2) == 0): print('Even') else: print('Odd')
s698105848
Accepted
17
2,940
125
int_list = list(map(int, input().split())) if (((int_list[0]*int_list[1]) % 2) == 0): print('Even') else: print('Odd')
s171184664
p03679
u461636820
2,000
262,144
Wrong Answer
17
2,940
137
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot...
X, A, B = map(int, input().split()) if A - B <= X: print('delicious') elif B - A >= X: print('dangerous') else: print('safe')
s810075976
Accepted
18
2,940
133
X, A, B = map(int, input().split()) if A >= B: print('delicious') elif B - A <= X: print('safe') else: print('dangerous')
s741695582
p02690
u606523772
2,000
1,048,576
Time Limit Exceeded
2,248
27,832
196
Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X.
X = int(input()) for i in range(-800, 800): for j in range(-800, 800): print(i**5 - j**5) if i**5 - j**5 == X: ans = [i, j] break print(ans)
s333255655
Accepted
544
9,044
189
X = int(input()) for i in range(-500, 500): for j in range(-500, 500): if i**5 - j**5 == X: ans = [str(i), str(j)] break print(" ".join(ans))
s863268295
p03448
u119983020
2,000
262,144
Wrong Answer
48
3,060
202
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()) cnt = 0 for a in range(A): for b in range(B): for c in range(C): if X == 500*a + 100*b + 50*c: cnt += 1 print(cnt)
s436676476
Accepted
51
3,060
208
A = int(input()) B = int(input()) C = int(input()) X = int(input()) cnt = 0 for a in range(A+1): for b in range(B+1): for c in range(C+1): if X == 500*a + 100*b + 50*c: cnt += 1 print(cnt)
s092883903
p02614
u382407432
1,000
1,048,576
Wrong Answer
27
9,204
361
We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation...
H, W, K = map(int,(input().split())) c=[] for _ in range(H): c.append(input()) ans=0 for maskR in range(H): for maskC in range(W): black=0 for i in range(H): for j in range(W): if ((maskR >> i) & 1) == 0 and ((maskC >> j) & 1) == 0 and c[i][j] == '#': black = black + 1 if bla...
s706687583
Accepted
66
9,208
367
H, W, K = map(int,(input().split())) c = [] for _ in range(H): c.append(input()) ans = 0 for maskR in range((1<<H)-1): for maskC in range((1<<W)-1): black=0 for i in range(H): for j in range(W): if ((maskR >> i) & 1) == 0 and ((maskC >> j) & 1) == 0 and c[i][j] == '#': black += 1...
s139530306
p03711
u320763652
2,000
262,144
Wrong Answer
18
3,060
196
Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.
a,b = map(int, input().split()) listb = [4,6,9,11] tmp = a in listb print(tmp) if (a == 2 and b ==2): print("YES") elif (a in listb and b in listb): print("YES") else: print("NO")
s268120638
Accepted
18
3,064
274
a,b = map(int, input().split()) lista = [1,3,5,7,8,10,12] listb = [4,6,9,11] tmp = a in listb # print(tmp) if (a == 2 and b ==2): print("Yes") elif (a in listb and b in listb): print("Yes") elif (a in lista and b in lista): print("Yes") else: print("No")
s132208432
p04012
u131406102
2,000
262,144
Wrong Answer
17
3,064
351
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.
a = list(input()) a = sorted(a) def count(a): b =[] for i in range(0,len(a)-2): if a[i] != a[i+1]: b.append( i+1) return b b = count(a) b.append(len(a)) for i in reversed(range(0,len(b)-1)): b[i+1] =b[i+1] - b[i] d = 0 for i in range(0,len(b)): d = d +b[i]%2 if d ==0: pri...
s977999972
Accepted
18
3,064
351
a = list(input()) a = sorted(a) def count(a): b =[] for i in range(0,len(a)-2): if a[i] != a[i+1]: b.append( i+1) return b b = count(a) b.append(len(a)) for i in reversed(range(0,len(b)-1)): b[i+1] =b[i+1] - b[i] d = 0 for i in range(0,len(b)): d = d +b[i]%2 if d ==0: pri...
s097319999
p03943
u870841038
2,000
262,144
Wrong Answer
17
2,940
148
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...
li = list(map(int, input().split())) if li[0]+li[1] == li[2] or li[1]+li[2] == li[0] or li[2]+li[0] == li[1]: print('YES') else: print('NO')
s876762461
Accepted
17
2,940
148
li = list(map(int, input().split())) if li[0]+li[1] == li[2] or li[1]+li[2] == li[0] or li[2]+li[0] == li[1]: print('Yes') else: print('No')
s640434774
p02613
u002663801
2,000
1,048,576
Wrong Answer
147
9,216
358
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 for i in range(n): s = input() if s == "AC": ac += 1 if s == "WA": wa += 1 if s == "TLE": tle += 1 if s == "RE": re += 1 a1 = "AC × " + str(ac) a2 = "WA × " + str(wa) a3 = "TLE × " + str(tle) a4 = "RE × " + str(re) print...
s164949046
Accepted
151
9,220
354
n = int(input()) ac = 0 wa = 0 tle = 0 re = 0 for i in range(n): s = input() if s == "AC": ac += 1 if s == "WA": wa += 1 if s == "TLE": tle += 1 if s == "RE": re += 1 a1 = "AC x " + str(ac) a2 = "WA x " + str(wa) a3 = "TLE x " + str(tle) a4 = "RE x " + str(re) print...
s126435944
p03738
u533039576
2,000
262,144
Wrong Answer
17
3,060
253
You are given two positive integers A and B. Compare the magnitudes of these numbers.
a = input() b = input() max_len = 105 if len(a) < max_len: a = '0' * (max_len - len(a)) + a if len(b) < max_len: b = '0' * (max_len - len(b)) + b if a > b: ans = "GRATER" elif a == b: ans = "EQUAL" else: ans = "LESS" print(ans)
s216927799
Accepted
18
3,060
254
a = input() b = input() max_len = 105 if len(a) < max_len: a = '0' * (max_len - len(a)) + a if len(b) < max_len: b = '0' * (max_len - len(b)) + b if a > b: ans = "GREATER" elif a == b: ans = "EQUAL" else: ans = "LESS" print(ans)
s498565793
p03473
u750389519
2,000
262,144
Wrong Answer
28
9,088
27
How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?
M=input() M=int(M) M=48-M
s324034406
Accepted
29
8,836
32
M=input() M=int(M) print(48-M)
s673410077
p03943
u027403702
2,000
262,144
Wrong Answer
19
3,060
105
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 = input().split() if a + b == c or a + c == b or b + c == a: print("Yes") else: print("No")
s293109907
Accepted
18
2,940
115
a,b,c = map(int, input().split()) if a + b == c or a + c == b or b + c == a: print("Yes") else: print("No")
s361958606
p03861
u978510477
2,000
262,144
Wrong Answer
17
2,940
58
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?
a, b, x = map(int, input().split()) print(b // x - a // x)
s060716374
Accepted
17
2,940
64
a, b, x = map(int, input().split()) print(b // x - (a - 1) // x)
s029147917
p03624
u396961814
2,000
262,144
Wrong Answer
60
4,800
158
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 = list(sorted(input())) ans = 'None' for i in range(26): if chr(97 + i) not in s: ans = chr(97 + i) print(ans) break print(ans)
s958961185
Accepted
60
4,800
140
s = list(sorted(input())) ans = 'None' for i in range(26): if chr(97 + i) not in s: ans = chr(97 + i) break print(ans)
s471006461
p02233
u798803522
1,000
131,072
Wrong Answer
20
7,604
220
Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula: \begin{equation*} fib(n)= \left \\{ \begin{array}{ll} 1 & (n = 0) \\\ 1 & (n = 1) \\\ fib(n - 1) + fib(n - 2) & \\\ \end{array} \right. \end{equation*}
target = int(input()) fib = [0 for n in range(target + 1)] for i in range(target): if i == 0: continue elif i == 1: fib[i] = 1 else: fib[i] = fib[i - 1] + fib[i - 2] print(fib[target])
s960290085
Accepted
20
7,768
228
target = int(input()) + 1 fib = [0 for n in range(target + 1)] for i in range(target + 1): if i == 0: continue elif i == 1: fib[i] = 1 else: fib[i] = fib[i - 1] + fib[i - 2] print(fib[target])
s789377090
p00014
u252368621
1,000
131,072
Wrong Answer
40
7,612
83
Write a program which computes the area of a shape represented by the following three lines: $y = x^2$ $y = 0$ $x = 600$ It is clear that the area is $72000000$, if you use an integral you learn in high school. On the other hand, we can obtain an approximative area of the shape by adding up areas of many...
d=int(input()) sum=0 for i in range(int(600/d)): sum+=(((i*d)**2)*d) print(sum)
s876835198
Accepted
30
7,676
171
while(True): try: d=int(input()) sum=0 for i in range(int(600/d)): sum+=(((i*d)**2)*d) print(sum) except: break