output_description
stringlengths
15
956
submission_id
stringlengths
10
10
status
stringclasses
3 values
problem_id
stringlengths
6
6
input_description
stringlengths
9
2.55k
attempt
stringlengths
1
13.7k
problem_description
stringlengths
7
5.24k
samples
stringlengths
2
2.72k
Print the minimum positive integer divisible by both 2 and N. * * *
s745166739
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N=int(input()) if N%2==0: print(N) else print(N*2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s715810285
Runtime Error
p03307
Input is given from Standard Input in the following format: N
print(int(input) * 2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s380118879
Wrong Answer
p03307
Input is given from Standard Input in the following format: N
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left from fractions import gcd from heapq import heappush, heappop from functools import reduce def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) def ZIP(n): return zip(*(MAP() for _ in range(n))) sys.setrecursionlimit(10**9) INF = float("inf") mod = 10**9 + 7 N = INT() print(2 * N if N % 2 == 0 else N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s591382810
Runtime Error
p03307
Input is given from Standard Input in the following format: N
def lcm(2, N): return (2 * N) // math.gcd(2, N) N = int(input()) print(lcm(2, N))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s991906535
Runtime Error
p03307
Input is given from Standard Input in the following format: N
# -*- coding: utf-8 -*- N=int(input()) ans=0 if(N%2==0) ans=N else ans=N*2 print(ans)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s692939768
Runtime Error
p03307
Input is given from Standard Input in the following format: N
import math def lcm(2, N): return (2 * N) // math.gcd(2, N) N = int(input()) print(lcm(2, N))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s646374423
Accepted
p03307
Input is given from Standard Input in the following format: N
def gcd(x, y): if y == 0: return x return gcd(y, x % y) def lcm(x, y): if x < y: z = x x = y y = z return x / gcd(x, y) * y print(int(lcm(int(input()), 2)))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s601340055
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n, *l = map(int, open(0).read().split()) a = sum(l[i] - i - 1 for i in range(n)) // n f = lambda x: sum(abs(l[i] - i - 1 - x) for i in range(n)) print(min(f(a - 1), f(a), f(a + 1)))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s520518019
Runtime Error
p03307
Input is given from Standard Input in the following format: N
a=input() a=sorted(map(int,input().split())) print(a[-1]-a[0]) print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("")print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("") print("")
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s662721822
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) A = list(map(int, input().split())) def sunuke(b): ret = 0 sub = 1 for a in A: ret += abs(a - (b + sub)) sub += 1 return ret B = [] sub = 1 for a in A: b = a - sub B.append(b) sub += 1 B.sort() b1 = N // 2 if N < 3: print(sunuke(B[b1])) exit() b2 = b1 + 1 b1_s = sunuke(B[b1]) b2_s = sunuke(B[b2]) if b1_s < b2_s: print(b1_s) else: print(b2_s)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s610663171
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n = int(input()) a = list(map(int, input().split())) b = [] for i in range(1, n + 1): b.append(a[i - 1] - i) b.sort if n % 2 != 0: B = b[int((n - 1) / 2)] ans = 0 for i in range(n): ans += abs(a[i] - i - 1 - B) print(ans) else: big = b[int((n) / 2)] smo = b[int(n - 2 / 2)] smoB = int((big + smo) / 2) bigB = smoB + 1 big = smo = 0 for i in range(n): big += abs(a[i] - i - 1 - bigB) for i in range(n): smo += abs(a[i] - i - 1 - smoB) print(min(big, smo))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s666606437
Runtime Error
p03307
Input is given from Standard Input in the following format: N
# 整数列A # 3箇所で切って、4つに # それぞれの総和の最大値と最小値の差の絶対値の最小値 # 中央を固定することを考える(結局、その固定を全検索するが) # 中央固定後、左側について、両方が同じくらいの値になるのが最適と考えて良いらしい from itertools import accumulate N = int(input()) A = list(map(int, input().split())) SumA = list(accumulate(A)) tmpP = tmpQ = tmpR = tmpS = 0 P = Q = R = S = 0 ans = 10e9 l = 0 r = 2 # midとmid+1の間が中間の切断 for mid in range(1, N - 2): # l,rは、単調増加であるため、全ての中間点を求めるループの間、クリアの必要がないらしい # 次のやつよりも、今のやつの方が大きい限り、継続 # 必ず、それが逆転する時が最小のはず、という考え。。。 while l < mid and abs((SumA[mid] - SumA[l + 1]) - SumA[l + 1]) < abs( (SumA[mid] - SumA[l]) - SumA[l] ): l += 1 # 次のやつよりも、今のやつの方が大きい限り、継続 # 必ず、それが逆転する時が最小のはず、という考え。。。 while r < N - 1 and abs( (SumA[N - 1] - SumA[r + 1]) - (SumA[r + 1] - SumA[mid]) ) < abs((SumA[N - 1] - SumA[r]) - (SumA[r] - SumA[mid])): r += 1 # print("{},{}".format(mid,l)) P = SumA[l] Q = SumA[mid] - SumA[l] R = SumA[r] - SumA[mid] S = SumA[N - 1] - SumA[r] # print(P,Q,R,S) diff = max(P, Q, R, S) - min(P, Q, R, S) diff = abs(diff) ans = min(ans, diff) print(ans)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s841157418
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) if N % 2 == 0: print(N) else: print(2N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s309022590
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n = int(input()) if n % 2 == 0: print(n) elif: print(n * 2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s934117599
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n = int(input()) if n%2 == 0: print (n): else: print (n*2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s772740158
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N=int(input()) if N%2==0: ans=N else: ans=2N print(ans)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s303323559
Runtime Error
p03307
Input is given from Standard Input in the following format: N
# -*-coding=utf-8-*- n = int(input)) if n%2: n *= 2 print(n)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s190720696
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N=int(input()) if N % 2 = 0: print(N) else: print(N*2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s799722533
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N=int(input()) if N%2=0: ans=N else: ans=N*2 print(ans)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s272411596
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n = int(input()) if n % 2 == 0: print(n) else: print(2*n
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s016684676
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) if N%2==0: print(N) else: print(2N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s919787522
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N=int(input()) if N // 2 = 0: print(N) else: print(N*2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s412312964
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) if N % 2 = 0: print(N) else: print(N*2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s140127158
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) if N%2==0: print(N) else: print(2 * N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s719213790
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) if N%2==0: print(N) else: print(2 * N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s121223293
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) if(N%2 == 1): a = 2N else: a = N print(a)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s474003517
Runtime Error
p03307
Input is given from Standard Input in the following format: N
print(2 * N if N % 2 == 0 else N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s692370458
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n = int(input()) if(n %2=1): n *= 2 print(n)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s756582986
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n=int(input()) if(n%2==1)n*=2 print(n)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s301892719
Wrong Answer
p03307
Input is given from Standard Input in the following format: N
d = int(input()) if d % 2 == 0: print(d) print(2 * d)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s907459720
Runtime Error
p03307
Input is given from Standard Input in the following format: N
if N/2%=0 print(N) else print(2N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s307722306
Runtime Error
p03307
Input is given from Standard Input in the following format: N
if(N%2 == 1): print(N*2) else: print(N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s618798225
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n=int(input()) if(n%2==0) print(n) else print(n*2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s119472612
Runtime Error
p03307
Input is given from Standard Input in the following format: N
print(2 * N if N % 2 == 1 else N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s590574192
Runtime Error
p03307
Input is given from Standard Input in the following format: N
print((lambda x: x + x * (x % 2)))(int(input()))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s782817499
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N=int(input()) if N%==0: print(N) else: print(2*N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s486081850
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) if N%2==0: print(N) else: print(2 * N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s517056202
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N, a = input(), sorted(list(map(int, input().split()))) print(a[N - 1] - a[0])
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s874687048
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N, *A = map(int, open(0).read().split()) A = sorted(A) print(A[-1] - A[0])
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s779594630
Runtime Error
p03307
Input is given from Standard Input in the following format: N
import numpy as np if (type(N/2)==int) print (N) else peint (2*N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s510733433
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) if N%2==0: print (N) else: print (2 * N)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s581149106
Wrong Answer
p03307
Input is given from Standard Input in the following format: N
n = int(input()) num = n while num % n != 0 and num % 2 != 0: num += 1 print(num)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s872349355
Wrong Answer
p03307
Input is given from Standard Input in the following format: N
def smaller_divisible_number(num: int) -> int: smaller_divisible_number = num if num % 2 != 0: smaller_divisible_number *= 2 return smaller_divisible_number
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s821536254
Runtime Error
p03307
Input is given from Standard Input in the following format: N
a = int(input()) items = input().split(" ") nums = [] for i in range(a): nums.append(int(items[i])) max_num = max(nums) min_num = min(nums) print(max_num - min_num)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s584896213
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N = int(input()) A = list(map(int, input().split())) A_ = [a - i - 1 for i, a in enumerate(A)] print(A_) A_.sort() print(A_) b = A_[N // 2] print(b) print(sum([abs(ai - b) for ai in A_]))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s483002711
Runtime Error
p03307
Input is given from Standard Input in the following format: N
# -*- coding: utf-8 -*- # 桁数の入力 a = int(input()) # スペース区切りの整数の入力 b = input().split() b.sort() min = b[0] b.reverse() max = b[0] print(int(max) - int(min))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s553125163
Wrong Answer
p03307
Input is given from Standard Input in the following format: N
a = int(input()) b = 2 x = a * b if a < b: tmp = a a = b b = tmp r = a % b while r != 0: a = b b = r r = a % b print(x / b)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s209413967
Accepted
p03307
Input is given from Standard Input in the following format: N
# Author: cr4zjh0bp # Created: Thu Mar 12 07:37:08 UTC 2020 import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf = lambda: float(ns()) nfn = lambda y: [nf() for _ in range(y)] nfa = lambda: list(map(float, stdin.readline().split())) nfan = lambda y: [nfa() for _ in range(y)] ns = lambda: stdin.readline().rstrip() nsn = lambda y: [ns() for _ in range(y)] ncl = lambda y: [list(ns()) for _ in range(y)] nas = lambda: stdin.readline().split() def gcd(m, n): if n == 0: return m else: return gcd(n, m % n) def lcm(m, n): return m * n // gcd(m, n) N = ni() print(lcm(2, N))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s570488062
Runtime Error
p03307
Input is given from Standard Input in the following format: N
def median_low(A): A.sort() b = A n = len(A) if n % 2 == 1: med = b[n // 2] else: x = b[n // 2 - 1] y = b[n // 2] med = (x + y) / 2 if med != int(med): med = x else: med = int(med) return med n = (int)(input()) A = (list)(map(int, input().split())) A = [v - i - 1 for i, v in enumerate(A)] x = median_low(A) print(sum(abs(v - x) for v in A))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s858671582
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n = int(input()) if n % 2==0 print(n) else: print(n*2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s899266485
Wrong Answer
p03307
Input is given from Standard Input in the following format: N
print(str(2 * int(input())))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s919791725
Runtime Error
p03307
Input is given from Standard Input in the following format: N
a=input() if a%2==0: print(a) else print(a*2)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s739160429
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n = int(input()) l = input().split() l.sort() print(abs(int(l[0]) - int(l[-1])))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s873057587
Runtime Error
p03307
Input is given from Standard Input in the following format: N
a=input() a=int(a) d=a if a<2: b=a a=2 else b=2 while c!=0: c=a%b a=b b=c print(d*2/b)
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s080448520
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n = int(input()) A = input().split() for i in range(len(A)): A[i] = int(A[i]) print(max(A) - min(A))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s365639357
Runtime Error
p03307
Input is given from Standard Input in the following format: N
n = int(input()) A = list(map(int, input().split())) q = 0 Z = [] for b in range(max(A) - min(A)): q = 0 for j in range(n): q += abs(A[j] - b - min[A] - j - 1) Z.append(q) print(min(Z))
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the minimum positive integer divisible by both 2 and N. * * *
s059821387
Runtime Error
p03307
Input is given from Standard Input in the following format: N
N=int(input()) for i in range(1,2N): if i%2==0 and i%N==0: print(i) break
Statement You are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.
[{"input": "3", "output": "6\n \n\n6 is divisible by both 2 and 3. Also, there is no positive integer less than 6\nthat is divisible by both 2 and 3. Thus, the answer is 6.\n\n* * *"}, {"input": "10", "output": "10\n \n\n* * *"}, {"input": "999999999", "output": "1999999998"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s326532616
Runtime Error
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
def read(): N = int(input().strip()) A = list(map(int, input().strip().split())) return N, A def next_state(c, a, n_patterns): # c := c[0] >= c[1] >= c[2] idx = c.index(a) n_equals = 1 n_equals += 1 if c[idx % 3] == c[(idx + 1) % 3] else 0 n_equals += 1 if c[idx % 3] == c[(idx + 2) % 3] else 0 c[idx % 3] += 1 n_patterns *= n_equals n_patterns %= 1000000007 return c, n_patterns def solve(N, A): c = [0, 0, 0] n = 1 for a in A: c, n = next_state(c, a, n) return n if __name__ == "__main__": inputs = read() output = solve(*inputs) print("%d" % output)
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s126308517
Accepted
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
import sys bbn = 1000000007 # +++++ def main(): n = int(input()) aal = list(map(int, input().split())) cc = [0, 0, 0] total_count = 1 for nh in aal: nc = cc.count(nh) total_count = (total_count * nc) % bbn if total_count == 0: return 0 ii = cc.index(nh) # pa((cc, total_count,ii,nh,nc)) cc[ii] += 1 print(total_count) # +++++ isTest = False def pa(v): if isTest: print(v) if __name__ == "__main__": if sys.platform == "ios": sys.stdin = open("inputFile.txt") isTest = True else: pass # input = sys.stdin.readline ret = main() if ret is not None: print(ret)
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s095186885
Runtime Error
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
N = int(input()) A = list(map(int, input().split()) r = {} total = 1 for i in range(N): if A[i] in r.keys: r[A[i]] += 1 else: r[A[i]] = 1 if A[i] == 0: total = total * (4-r[A[i]]) else: total = total * (r[A[i] - 1] - r[A[i]] + 1) total = total // (10 ** 9 + 7) print(total)
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s065601876
Wrong Answer
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
print(6)
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s731360663
Wrong Answer
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
N = int(input()) A = list(map(int, input().split())) mod = 1000000007 var = 1 C1 = C2 = C3 = 0 for i in range(0, N - 1): if A[i] == C1: if C1 != C2: var = var % mod elif C1 == C2 != C3: var = var * 2 % mod elif C1 == C2 == C3: var = var * 3 % mod C1 += 1 elif A[i] == C2: if C2 != C3: var = var % mod elif C2 == C3: var = var * 2 % mod C2 += 1 elif A[i] == C3: C3 += 1 print(var)
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s186423115
Runtime Error
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
MOD = 10**9 + 7 class ModInt: def __init__(self, x): self.x = x % MOD def __str__(self): return str(self.x) __repr__ = __str__ def __add__(self, other): return ( ModInt(self.x + other.x) if isinstance(other, ModInt) else ModInt(self.x + other) ) def __sub__(self, other): return ( ModInt(self.x - other.x) if isinstance(other, ModInt) else ModInt(self.x - other) ) def __mul__(self, other): return ( ModInt(self.x * other.x) if isinstance(other, ModInt) else ModInt(self.x * other) ) def __truediv__(self, other): return ( ModInt(self.x * pow(other.x, MOD - 2, MOD)) if isinstance(other, ModInt) else ModInt(self.x * pow(other, MOD - 2, MOD)) ) def __pow__(self, other): return ( ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else ModInt(pow(self.x, other, MOD)) ) __radd__ = __add__ def __rsub__(self, other): return ( ModInt(other.x - self.x) if isinstance(other, ModInt) else ModInt(other - self.x) ) __rmul__ = __mul__ def __rtruediv__(self, other): return ( ModInt(other.x * pow(self.x, MOD - 2, MOD)) if isinstance(other, ModInt) else ModInt(other * pow(self.x, MOD - 2, MOD)) ) def __rpow__(self, other): return ( ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else ModInt(pow(other, self.x, MOD)) ) def cmb(fact, n, r): return fact[n] / fact[n - r] / fact[r] def solve(N, A): ret = ModInt(0) group = [[] for _ in range(3)] for idx, a in enumerate(A): if not a: for idx, g in enumerate(group): if not g: group[idx].append(0) break for idx, g in enumerate(group): if g and g[-1] == a - 1: group[idx].append(a) break fact = [ModInt(1)] for i in range(1, N + 1): fact.append(fact[i - 1] * i) rest = N pattern = 0 for g in group: if not g: break ret += cmb(fact, rest, g[-1] + 1) rest -= g[-1] + 1 pattern += 1 return ret * cmb(fact, 3, pattern) if __name__ == "__main__": N = int(input()) A = list(map(int, input().split())) print(solve(N, A))
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s101495656
Runtime Error
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
import sys input = sys.stdin.readline N = int(input()) A = rbg = [1, 0, 0] ans = 1 for a in [int(a) for a in input().strip().split()]: ans = (ans * rbg.count(a)) % (10 ** 9 + 7) rbg[rbg.index(a)] += 1 print(ans * 3 % (10 ** 9 + 7))
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s083058407
Runtime Error
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
n = int(input()) c = [-1, -1, -1] a = 1 for i in map(int, input().split()): a = a * c.count(i - 1) % 1000000007 c[c.index(i - 1)] = i print(a)
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s132634925
Accepted
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
MOD = 10**9 + 7 class Fp(int): def __new__(self, x=0): return super().__new__(self, x % MOD) def inv(self): return self.__class__(super().__pow__(MOD - 2, MOD)) def __add__(self, value): return self.__class__(super().__add__(value)) def __sub__(self, value): return self.__class__(super().__sub__(value)) def __mul__(self, value): return self.__class__(super().__mul__(value)) def __floordiv__(self, value): return self.__class__(self * self.__class__(value).inv()) def __pow__(self, value): return self.__class__(super().__pow__(value % (MOD - 1), MOD)) __radd__ = __add__ __rmul__ = __mul__ def __rsub__(self, value): return self.__class__(-super().__sub__(value)) def __rfloordiv__(self, value): return self.__class__(self.inv() * value) def __iadd__(self, value): self = self + value return self def __isub__(self, value): self = self - value return self def __imul__(self, value): self = self * value return self def __ifloordiv__(self, value): self = self // value return self def __ipow__(self, value): self = self**value return self def __neg__(self): return self.__class__(super().__neg__()) def main(): N, *A = map(int, open(0).read().split()) C = [0] * (N + 1) C[-1] = 3 ans = Fp(1) for a in A: ans *= C[a - 1] C[a - 1] -= 1 C[a] += 1 print(ans) if __name__ == "__main__": main()
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the number of possible combinations of colors of the N people's hats, modulo 1000000007. * * *
s731657677
Runtime Error
p02845
Input is given from Standard Input in the following format: N A_1 A_2 A_3 ... A_N
p = 1000000007 N = int(input()) A = [int(i) for i in input().split()] n = A.count(0) Num = [0] * N lis = [[0]] ma = -1 for i in A: if ma + 1 == i: lis.append([0]) ma += 1 else: lis[i + 1].append(0) for j in range(len(lis[i])): lis[i][j] += 1 lis.pop(0) n = len(lis[0]) if n == 3: ans = 6 else: ans = 3 for li in lis: if 0 in li: li.remove(0) for i in range(len(li)): li[i] -= 1 if 1 in li: li.remove(1) for i in range(len(li)): li[i] -= 1 if len(li) == 2: if li[0] == li[1] == 2: ans = (ans * 2) % p if len(li) == 3: if li == [3, 3, 3]: ans = (ans * 6) % p elif li == [3, 3, 2]: ans = (ans * 4) % p elif li == [3, 2, 2]: ans = (ans * 2) % p print(ans)
Statement N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats. Since the count can be enormous, compute it modulo 1000000007.
[{"input": "6\n 0 1 2 3 4 5", "output": "3\n \n\nWe have three possible combinations, as follows:\n\n * Red, Red, Red, Red, Red, Red\n * Blue, Blue, Blue, Blue, Blue, Blue\n * Green, Green, Green, Green, Green, Green\n\n* * *"}, {"input": "3\n 0 0 0", "output": "6\n \n\n* * *"}, {"input": "54\n 0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s604257488
Accepted
p03242
Input is given from Standard Input in the following format: n
print(input().replace("9", "2").replace("1", "9").replace("2", "1"))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s902377594
Accepted
p03242
Input is given from Standard Input in the following format: n
print(input().replace("1", "0").replace("9", "1").replace("0", "9"))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s479520157
Accepted
p03242
Input is given from Standard Input in the following format: n
print(input().rstrip().translate(str.maketrans({"9": "1", "1": "9"})))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s452190817
Accepted
p03242
Input is given from Standard Input in the following format: n
print(input().replace("1", " ").replace("9", "1").replace(" ", "9"))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s250982987
Accepted
p03242
Input is given from Standard Input in the following format: n
print(input().replace("1", "5").replace("9", "1").replace("5", "9"))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s934887281
Accepted
p03242
Input is given from Standard Input in the following format: n
print(int(input().replace("1", "-").replace("9", "1").replace("-", "9")))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s947235399
Accepted
p03242
Input is given from Standard Input in the following format: n
print(input().replace("1", "-").replace("9", "1").replace("-", "9"))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s955486258
Wrong Answer
p03242
Input is given from Standard Input in the following format: n
input().replace("1", "@").replace("9", "1").replace("@", "9")
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s148494293
Wrong Answer
p03242
Input is given from Standard Input in the following format: n
l = input() x = l[0] print(x * 3 if int(l) <= int(x * 3) else str(int(x) + 1) * 3)
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s927832904
Runtime Error
p03242
Input is given from Standard Input in the following format: n
# 111a print(input().replace(1, x).replace(9.1).replace(x, 9))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s762163706
Runtime Error
p03242
Input is given from Standard Input in the following format: n
print(int(input()) - N)
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s738536294
Accepted
p03242
Input is given from Standard Input in the following format: n
n = int(input()) num = [] while n != 0: num.append(n % 10) n -= n % 10 n /= 10 a = num[2] b = num[1] c = num[0] d = 0 e = 0 f = 0 if a == 9: d = 1 elif a == 1: d = 9 else: d = a if b == 9: e = 1 elif b == 1: e = 9 else: e = b if c == 9: f = 1 elif c == 1: f = 9 else: f = c print(int(100 * d + 10 * e + f))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s334110302
Accepted
p03242
Input is given from Standard Input in the following format: n
############################################################################### import sys from bisect import bisect_left as binl from copy import copy, deepcopy def intin(): input_tuple = input().split() if len(input_tuple) <= 1: return int(input_tuple[0]) return tuple(map(int, input_tuple)) def intina(): return [int(i) for i in input().split()] def intinl(count): return [intin() for _ in range(count)] def modadd(x, y): global mod return (x + y) % mod def modmlt(x, y): global mod return (x * y) % mod def lcm(x, y): while y != 0: z = x % y x = y y = z return x def get_divisors(x): retlist = [] for i in range(1, int(x**0.5) + 3): if x % i == 0: retlist.append(i) retlist.append(x // i) return retlist def make_linklist(xylist): linklist = {} for a, b in xylist: linklist.setdefault(a, []) linklist.setdefault(b, []) linklist[a].append(b) linklist[b].append(a) return linklist def calc_longest_distance(linklist, v=1): distance_list = {} distance_count = 0 distance = 0 vlist_previous = [] vlist = [v] nodecount = len(linklist) while distance_count < nodecount: vlist_next = [] for v in vlist: distance_list[v] = distance distance_count += 1 vlist_next.extend(linklist[v]) distance += 1 vlist_to_del = vlist_previous vlist_previous = vlist vlist = list(set(vlist_next) - set(vlist_to_del)) max_distance = -1 max_v = None for v, distance in distance_list.items(): if distance > max_distance: max_distance = distance max_v = v return (max_distance, max_v) def calc_tree_diameter(linklist, v=1): _, u = calc_longest_distance(linklist, v) distance, _ = calc_longest_distance(linklist, u) return distance ############################################################################### def main(): n = input() for i in n: if i == "1": sys.stdout.write("9") if i == "9": sys.stdout.write("1") print() if __name__ == "__main__": main()
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s985626568
Accepted
p03242
Input is given from Standard Input in the following format: n
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys # {{{ import os import time import re from pydoc import help import string import math from operator import itemgetter from collections import Counter from collections import deque from collections import defaultdict as dd import fractions from heapq import heappop, heappush, heapify import array from bisect import bisect_left, bisect_right, insort_left, insort_right from copy import deepcopy as dcopy import itertools # }}} # pre-defined{{{ sys.setrecursionlimit(10**7) INF = 10**20 GOSA = 1.0 / 10**10 MOD = 10**9 + 7 ALPHABETS = [ chr(i) for i in range(ord("a"), ord("z") + 1) ] # can also use string module def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def DP(N, M, first): return [[first] * M for n in range(N)] def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)] from inspect import currentframe def dump(*args): names = {id(v): k for k, v in currentframe().f_back.f_locals.items()} print( ", ".join(names.get(id(arg), "???") + " => " + repr(arg) for arg in args), file=sys.stderr, ) # }}} def local_input(): # {{{ from pcm.utils import set_stdin import sys if len(sys.argv) == 1: set_stdin(os.path.dirname(__file__) + "/test/" + "sample-1.in") # }}} def solve(): s = input() res = "" for c in s: if c == "9": res += "1" else: res += "9" print(res) return 0 if __name__ == "__main__": # {{{ try: local_input() except: pass solve() # vim: set foldmethod=marker:}}}
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s160973576
Runtime Error
p03242
Input is given from Standard Input in the following format: n
import collections num = int(input()) values = [int(i) for i in input().split()] odd = [] # kisuu even = [] # gusu for n, i in enumerate(values): if (n + 1) % 2 == 0: even.append(i) else: odd.append(i) odd_counts = collections.Counter(odd) even_counts = collections.Counter(even) # print(odd_counts.most_common()) # print(even_counts.most_common()) odd_most_common = odd_counts.most_common() even_most_common = even_counts.most_common() half_num = int(num / 2) if odd_most_common[0][0] != even_most_common[0][0]: odd_replace_num = half_num - odd_most_common[0][1] even_replace_num = half_num - even_most_common[0][1] print(odd_replace_num + even_replace_num) else: answers = [] odd_replace_num = half_num - odd_most_common[0][1] if len(even_most_common) == 1: even_replace_num = half_num else: even_replace_num = half_num - even_most_common[1][1] answers.append(odd_replace_num + even_replace_num) if len(odd_most_common) == 1: odd_replace_num = half_num else: odd_replace_num = half_num - odd_most_common[1][1] even_replace_num = half_num - even_most_common[0][1] answers.append(odd_replace_num + even_replace_num) print(min(answers))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s510362920
Runtime Error
p03242
Input is given from Standard Input in the following format: n
import collections n = input() line = input().split() odd = line[::2] even = line[1::2] o = collections.Counter(odd) e = collections.Counter(even) maxoddcnt = o.most_common()[0][1] maxevencnt = e.most_common()[0][1] # すべての値が同じときは半分を置換する if odd == even: print(len(odd)) exit(0) # 奇数列,偶数列それぞれの最頻の文字が同じ場合は,いずれかを2番目に多い文字に置換しなければならない if o.most_common()[0][0] == e.most_common()[0][0]: if ( o.most_common()[1][1] + e.most_common()[0][1] > o.most_common()[0][1] + e.most_common()[1][1] ): maxoddcnt = o.most_common()[1][1] else: # if o.most_common()[1][1] + e.most_common()[0][1] <= o.most_common()[0][1] + e.most_common()[1][1] : maxevencnt = e.most_common()[1][1] print(len(odd) - maxoddcnt + len(even) - maxevencnt)
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s045549781
Wrong Answer
p03242
Input is given from Standard Input in the following format: n
a = int(input()) if (a // 100) % 9 == 0: b = 100 else: b = 900 if ((a - (a // 100) * 100) // 10) % 9 == 0: c = 10 else: c = 90 if (a - (a // 100) * 100 - (a // 10) * 10) % 9 == 0: d = 1 else: d = 9 print(b + c + d)
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s511721309
Runtime Error
p03242
Input is given from Standard Input in the following format: n
N=int(input()) *V,=map(int,input().split()) import collections import Counter c1=Counter(V[0::2]).most_common()+[(0,0)] c2=Counter(V[1::2]).most_common()+[(0,0)] if c1[0][0]!=c2[0][0]: print(N-c1[0][1]-c2[0][1]) else: print(min(N-c1[0][1]-c2[1][1],N-c1[1][1]-c2[0][1]))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s329372122
Runtime Error
p03242
Input is given from Standard Input in the following format: n
n=input() ans="" if n[0]=="1": ans=ans+"9" else: ans=ans+"1" if n[1]=="1": ans=ans+"9" else: ans=ans+"1" if n[2]=="1": ans=ans+"9" else: ans=ans+"1" print(ans)
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s215449433
Runtime Error
p03242
Input is given from Standard Input in the following format: n
import sys, re from math import ceil, floor, sqrt, pi, factorial, gcd from copy import deepcopy from collections import Counter, deque from heapq import heapify, heappop, heappush from itertools import accumulate, product, combinations, combinations_with_replacement from bisect import bisect, bisect_left from functools import reduce from decimal import Decimal, getcontext # input = sys.stdin.readline def i_input(): return int(input()) def i_map(): return map(int, input().split()) def i_list(): return list(i_map()) def i_row(N): return [i_input() for _ in range(N)] def i_row_list(N): return [i_list() for _ in range(N)] def s_input(): return input() def s_map(): return input().split() def s_list(): return list(s_map()) def s_row(N): return [s_input for _ in range(N)] def s_row_list(N): return [s_list() for _ in range(N)] def Yes(): print("Yes") def No(): print("No") def YES(): print("YES") def NO(): print("NO") def lcm(a, b): return a * b // gcd(a, b) sys.setrecursionlimit(10**6) INF = float("inf") MOD = 10**9 + 7 def main(): n = i_input() str_n = str(n) for i in range(3): if str_n[i] == "1": print(9, end="") else: print(1, end="") print() if __name__ == "__main__": main()
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s959321937
Runtime Error
p03242
Input is given from Standard Input in the following format: n
s=list(input()) for c in s: if c == "1": print("9",end="") elif c = "9": print("1",end="") else: print(c) print()
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s490621640
Runtime Error
p03242
Input is given from Standard Input in the following format: n
a=input() if a[0]=="1": a[0]="9": else: a[0]=="1" if a[1]=="1": a[1]="9" else: a[1]="1" if a[2]=="1": a[2]="9" else: a[2]="1" print(a)
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s710297486
Accepted
p03242
Input is given from Standard Input in the following format: n
x = input().replace("1", "X").replace("9", "Y") print(int(x.replace("X", "9").replace("Y", "1")))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s854799503
Accepted
p03242
Input is given from Standard Input in the following format: n
print(input().replace("1", "x").replace("9", "y").replace("x", "9").replace("y", "1"))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s633658057
Accepted
p03242
Input is given from Standard Input in the following format: n
print("".join(["9" if i == "1" else "1" for i in input()]))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s343504725
Accepted
p03242
Input is given from Standard Input in the following format: n
print(input().replace("9", "t").replace("1", "9").replace("t", "1"))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s604067694
Accepted
p03242
Input is given from Standard Input in the following format: n
print("".join([str(int(i) * 9 % 10) for i in input()]))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s427050637
Runtime Error
p03242
Input is given from Standard Input in the following format: n
n = input() print(n.translate(str.maketrans({"1":"9", "9":"1"}))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s214158611
Wrong Answer
p03242
Input is given from Standard Input in the following format: n
print(input().replace("9", "1"))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s318043659
Runtime Error
p03242
Input is given from Standard Input in the following format: n
num = str(input()) for i in range(3): if num[i] == '1': num[i] = '9' else: num[i] = '1': answer = num[0]+num[1]+num[2] print(int(answer))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s117047080
Accepted
p03242
Input is given from Standard Input in the following format: n
print(input().rstrip().replace("1", "a").replace("9", "1").replace("a", "9"))
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s896861491
Accepted
p03242
Input is given from Standard Input in the following format: n
for c in input(): print(9 if c == "1" else 1, end="")
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]
Print the integer obtained by replacing each occurrence of `1` with `9` and each occurrence of `9` with `1` in n. * * *
s818001610
Accepted
p03242
Input is given from Standard Input in the following format: n
n = int(input()) n_100 = n // 100 n_10 = (n - n_100 * 100) // 10 n_1 = n - n_100 * 100 - n_10 * 10 if n_100 == 1: ans_100 = 9 elif n_100 == 9: ans_100 = 1 else: ans_100 = n_100 if n_10 == 1: ans_10 = 9 elif n_10 == 9: ans_10 = 1 else: ans_10 = n_10 if n_1 == 1: ans_1 = 9 elif n_1 == 9: ans_1 = 1 else: ans_1 = n_1 ans = ans_100 * 100 + ans_10 * 10 + ans_1 print(ans)
Statement Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n.
[{"input": "119", "output": "991\n \n\nReplace the `9` in the ones place with `1`, the `1` in the tens place with `9`\nand the `1` in the hundreds place with `9`. The answer is `991`.\n\n* * *"}, {"input": "999", "output": "111"}]