buggy
stringlengths
1
618k
fixed
stringlengths
16
618k
buggy_submission_id
stringlengths
10
10
fixed_submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
lang
stringclasses
1 value
buggy_verdict
stringclasses
2 values
a, b = map(str, input().split()) c = a + b c = int(c) for i in range(400)[1:]: if c = i**2: print('Yes') exit() print('No')
a, b = map(str, input().split()) c = a + b c = int(c) for i in range(400)[1:]: if c == i**2: print('Yes') exit() print('No')
s375134397
s564383114
p03456
python
Runtime Error
a, b = map(str, input().split()) c = a + b c = int(c) for i in range(400)[1:]: if c = i**2: print('Yes') break print('No')
a, b = map(str, input().split()) c = a + b c = int(c) for i in range(400)[1:]: if c == i**2: print('Yes') exit() print('No')
s503397089
s564383114
p03456
python
Runtime Error
N, A, B = map(int, input().split()) S = str(input()) total = 0 kaigai = 0 for i in range(0, len(S)): if L[i] == 'a': if total < A+B: print('Yes') total += 1 else: print('No') elif L[i] == 'b': if total < A+B & kaigai <B: print('Yes') ...
N, A, B = map(int, input().split()) L = str(input()) total = 0 kaigai = 0 for i in range(0, len(L)): if L[i] == 'a': if total < A + B: print('Yes') total += 1 else: print('No') elif L[i] == 'b': if total < A + B and kaigai < B: print('Yes') total += 1 kaigai += 1 else: print('No') else...
s876423145
s869323250
p03971
python
Runtime Error
input() print(min(sum((x-p)**2 for x in map(int, input().split())) for p in range(101)))
def cal_cost(X, P): cost = 0 for x in X: cost += (x - P) ** 2 return cost def main(N, X): return min(cal_cost(X, p) for p in range(max(X) + 1)) if __name__ == "__main__": N = int(input()) X = list(map(int, input().split())) ans = main(N, X) print(ans)
s116127431
s794896066
p02767
python
Runtime Error
N = int(input()) X = list(map(int, input().split())) print(min(lambda p: sum((x-p)**2 for x in X) for i in range(max(X)+1)))
def cal_cost(X, P): cost = 0 for x in X: cost += (x - P) ** 2 return cost def main(N, X): return min(cal_cost(X, p) for p in range(max(X) + 1)) if __name__ == "__main__": N = int(input()) X = list(map(int, input().split())) ans = main(N, X) print(ans)
s423769282
s794896066
p02767
python
Runtime Error
N = int(input()) A = [int(input()) for _ in range(N)] m1, m2 = sorted(A, reversed=True)[0:2] for a in A: print(m2 if a == m1 else m1)
N = int(input()) A = [int(input()) for _ in range(N)] mls = [-1 for _ in range(N+1)] for i, a in enumerate(A, 1): mls[i] = max(mls[i-1], a) mrs = [-1 for _ in range(N+1)] for i, a in enumerate(A[::-1], 1): mrs[i] = max(mrs[i-1], a) mrs = mrs[::-1] for i in range(N): print(max(mls[i], mrs[i+1]))
s668124630
s346102656
p02971
python
Runtime Error
N = int(input()) A = [int(input()) for _ in range(N)] for i, a in enumerate(A): print(max(A[:i] + A[i+1:]))
N = int(input()) A = [int(input()) for _ in range(N)] mls = [-1 for _ in range(N+1)] for i, a in enumerate(A, 1): mls[i] = max(mls[i-1], a) mrs = [-1 for _ in range(N+1)] for i, a in enumerate(A[::-1], 1): mrs[i] = max(mrs[i-1], a) mrs = mrs[::-1] for i in range(N): print(max(mls[i], mrs[i+1]))
s199631794
s346102656
p02971
python
Time Limit Exceeded
import bisect N = int(input()) A = list(map(int, input().split())) A.sort() ans = 0 while(len(A) > 0): a = A.pop() b = (1 << a.bit_length()) - a i = bisect.bisect_left(A, b) if i < len(A) and A[i] == b: ans += 1 A.pop(i) print(ans)
from collections import Counter N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) c = Counter(A) ans = 0 for a in A: b = (1 << a.bit_length()) - a if a == b and c[a] > 1: c[a] -= 2 ans += 1 elif a != b and c[a] > 0 and c[b] > 0: c[a] -= 1 c[b] -= 1 ...
s879851483
s030444184
p03201
python
Time Limit Exceeded
import math N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) ans = 0 while(len(A) > 0): a = A[0] A.pop(0) for i in range(len(A)): if math.log2(A[i] + a).is_integer(): ans += 1 A.pop(i) break print(ans)
from collections import Counter N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) c = Counter(A) ans = 0 for a in A: b = (1 << a.bit_length()) - a if a == b and c[a] > 1: c[a] -= 2 ans += 1 elif a != b and c[a] > 0 and c[b] > 0: c[a] -= 1 c[b] -= 1 ...
s730706095
s030444184
p03201
python
Time Limit Exceeded
import math N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) ans = 0 while(len(A) > 0): a = A[0] A = A[1:] for i in range(len(A)): if math.log2(A[i] + a).is_integer(): ans += 1 A.pop(i) break print(ans)
from collections import Counter N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) c = Counter(A) ans = 0 for a in A: b = (1 << a.bit_length()) - a if a == b and c[a] > 1: c[a] -= 2 ans += 1 elif a != b and c[a] > 0 and c[b] > 0: c[a] -= 1 c[b] -= 1 ...
s594076769
s030444184
p03201
python
Time Limit Exceeded
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) def check_pow_two(n): while(n > 0): if n % 2 == 0: n //= 2 elif n == 1: return True else: return False ans = 0 while(len(A) > 0): a = A[0] A = A[1:] for i in range(len(...
from collections import Counter N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) c = Counter(A) ans = 0 for a in A: b = (1 << a.bit_length()) - a if a == b and c[a] > 1: c[a] -= 2 ans += 1 elif a != b and c[a] > 0 and c[b] > 0: c[a] -= 1 c[b] -= 1 ...
s644240924
s030444184
p03201
python
Time Limit Exceeded
N = int(input()) A = [int(input()) for _ in range(N)] A.sort() s = int((N - 1) / 2) m = A[0:s+1] M = A[s+1:][::-1] n = N-1 if N % 2 == 1 else N ans = [0 for _ in range(n)] li = s ri = s + 1 for i, (a, b) in enumerate(zip(m, M)): if i % 2 == 1: a, b = b, a ans[li] = a ans[ri] = b li -= 1 ...
N = int(input()) A = [int(input()) for _ in range(N)] A.sort() if N % 2 == 0: c = N // 2 S = -2 * sum(A[:c]) + 2 * sum(A[c:]) + A[c-1] - A[c] else: c = (N-1) // 2 tmp1 = -2 * sum(A[:c]) + 2 * sum(A[c+2:]) + A[c] + A[c+1] tmp2 = -2 * sum(A[:c-1]) + 2 * sum(A[c+1:]) - A[c-1] - A[c] S = max(tmp1, ...
s433883757
s284608877
p03229
python
Runtime Error
N = int(input()) A = [int(input()) for _ in range(N)] A.sort() s = int((N - 1) / 2) m = A[0:s+1] M = A[s+1:][::-1] if N % 2 == 1: N -= 1 ans = [0 for _ in range(N)] li = s ri = s + 1 for i, (a, b) in enumerate(zip(m, M)): if i % 2 == 1: a, b = b, a ans[li] = a ans[ri] = b li -= 1 ri ...
N = int(input()) A = [int(input()) for _ in range(N)] A.sort() if N % 2 == 0: c = N // 2 S = -2 * sum(A[:c]) + 2 * sum(A[c:]) + A[c-1] - A[c] else: c = (N-1) // 2 tmp1 = -2 * sum(A[:c]) + 2 * sum(A[c+2:]) + A[c] + A[c+1] tmp2 = -2 * sum(A[:c-1]) + 2 * sum(A[c+1:]) - A[c-1] - A[c] S = max(tmp1, ...
s442114799
s284608877
p03229
python
Runtime Error
N = int(input()) A = [int(input()) for _ in range(N)] A.sort() s = int((N - 1) / 2) m = A[0:s+1] M = A[s+1:][::-1] ans = [0 for _ in range(N)] if (N - 7) % 4 == 0: flag = True if (flag): li = s - 1 ri = s + 1 else: li = s ri = s + 1 for i, (a, b) in enumerate(zip(m, M)): if i % 2 == 1: ...
N = int(input()) A = [int(input()) for _ in range(N)] A.sort() if N % 2 == 0: c = N // 2 S = -2 * sum(A[:c]) + 2 * sum(A[c:]) + A[c-1] - A[c] else: c = (N-1) // 2 tmp1 = -2 * sum(A[:c]) + 2 * sum(A[c+2:]) + A[c] + A[c+1] tmp2 = -2 * sum(A[:c-1]) + 2 * sum(A[c+1:]) - A[c-1] - A[c] S = max(tmp1, ...
s835038128
s284608877
p03229
python
Runtime Error
border = 101 def manhattan_distance(Cx, Cy, H, X, Y): return max(H - abs(X - Cx) - abs(Y - Cy), 0) def judge_center(Cx, Cy, cords): for x, y, h in cords: if h > 0: H = abs(cords[0][0] - Cx) + abs(cords[0][1] - Cy) + cords[0][2] break for x, y, h in cords: tmp = ma...
N = int(input()) if N == 1: print("Hello World") else: A = int(input()) B = int(input()) print(A+B)
s180082968
s952669536
p03238
python
Runtime Error
N = int(input()) A = int(input()) B = int(input()) if N == 1: print("Hello World") else: print(A+B)
N = int(input()) if N == 1: print("Hello World") else: A = int(input()) B = int(input()) print(A+B)
s512482882
s952669536
p03238
python
Runtime Error
import fraction N, X = map(int, input().split()) x = list(map(int, input().split())) min_distance = abs(x[0] - X) for i in x: min_distance = fraction.gcd(abs(i - X), min_distance) print(min_distance)
import fractions N, X = map(int, input().split()) x = list(map(int, input().split())) min_distance = abs(x[0] - X) for i in x: min_distance = fractions.gcd(abs(i - X), min_distance) print(min_distance)
s219942979
s066506906
p03262
python
Runtime Error
import math N, X = map(int, input().split()) x = list(map(int, input().split())) min_distance = abs(x[0] - X) for i in x: min_distance = math.gcd(abs(i - X), min_distance) print(min_distance)
import fractions N, X = map(int, input().split()) x = list(map(int, input().split())) min_distance = abs(x[0] - X) for i in x: min_distance = fractions.gcd(abs(i - X), min_distance) print(min_distance)
s720550505
s066506906
p03262
python
Runtime Error
import math N, X = map(int, input().split()) x = list(map(int, input().split())) min_distance = abs(x[0] - X) for i in x[1:]: min_distance = math.gcd(abs(i - X), min_distance) print(min_distance)
import fractions N, X = map(int, input().split()) x = list(map(int, input().split())) min_distance = abs(x[0] - X) for i in x: min_distance = fractions.gcd(abs(i - X), min_distance) print(min_distance)
s180673882
s066506906
p03262
python
Runtime Error
S = input() K = int(input()) s = '' for i in S: s += i if i != '1': break if K > len(s): print(s[-1]) else: print(s[K])
S = input() K = int(input()) s = '' for i in S: s += i if i != '1': break if K < len(s): print(s[K-1]) else: print(s[-1])
s349337113
s661117673
p03282
python
Runtime Error
N = input() if N % sum([int(i) for i in str(N)]) == 0: print('Yes') else: print('No')
N = int(input()) S = sum((int(i) for i in str(N))) if N % S == 0: print('Yes') else: print('No')
s017378563
s532113093
p03316
python
Runtime Error
N = int(input()) S = input() score = N + 1 a = [S[:i].count('W') + S[i+1:].count('E') for i in range(N)] print(min(a))
N = int(input()) S = input() w = 0 e = S[1:].count('E') score = w + e for i in range(1, N): if S[i] == 'E': e -= 1 if S[i-1] == 'W': w += 1 score = min(score, w + e) print(score)
s798039845
s784564294
p03339
python
Time Limit Exceeded
N = int(input()) S = input() score = N + 1 for i in range(N): l = S[:i] r = S[i+1:] score = min(score, l.count('W') + r.count('E')) print(score)
N = int(input()) S = input() w = 0 e = S[1:].count('E') score = w + e for i in range(1, N): if S[i] == 'E': e -= 1 if S[i-1] == 'W': w += 1 score = min(score, w + e) print(score)
s409888955
s784564294
p03339
python
Time Limit Exceeded
H, W = map(int, input().split(' ')) matrix = [] for _ in range(W): tmp = [0 if j == '.' else 1 for j in input()] matrix.append(tmp) flag = 'Yes' for i, row in enumerate(matrix): for j, s in enumerate(row): if s == 1: if j > 0 and row[j-1] == 0: if j < W - 1 and row[j+1] ...
H, W = map(int, input().split(' ')) matrix = [] for _ in range(H): tmp = [0 if j == '.' else 1 for j in input()] matrix.append(tmp) flag = 'Yes' for i, row in enumerate(matrix): for j, s in enumerate(row): if s == 1: if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0): ...
s051891668
s897341856
p03361
python
Runtime Error
H, W = map(int, input().split(' ')) matrix = [] for _ in range(W): tmp = [0 if j == '.' else 1 for j in input()] matrix.append(tmp) flag = 'Yes' for i, row in enumerate(matrix): for j, s in enumerate(row): if s == 1: if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0): ...
H, W = map(int, input().split(' ')) matrix = [] for _ in range(H): tmp = [0 if j == '.' else 1 for j in input()] matrix.append(tmp) flag = 'Yes' for i, row in enumerate(matrix): for j, s in enumerate(row): if s == 1: if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0): ...
s699354311
s897341856
p03361
python
Runtime Error
#!/usr/bin/env python3 H, W = map(int, input().split(' ')) matrix = [] for _ in range(W): tmp = [0 if j == '.' else 1 for j in input()] matrix.append(tmp) for i, row in enumerate(matrix): for j, s in enumerate(row): flag = True if s == 1: if (j > 0 and row[j-1] == 0) and (j < W...
H, W = map(int, input().split(' ')) matrix = [] for _ in range(H): tmp = [0 if j == '.' else 1 for j in input()] matrix.append(tmp) flag = 'Yes' for i, row in enumerate(matrix): for j, s in enumerate(row): if s == 1: if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0): ...
s719364707
s897341856
p03361
python
Runtime Error
H, W = map(int, input().split(' ')) matrix = [] for _ in range(W): tmp = [0 if j == '.' else 1 for j in input()] matrix.append(tmp) for i, row in enumerate(matrix): for j, s in enumerate(row): flag = True if s == 1: if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):...
H, W = map(int, input().split(' ')) matrix = [] for _ in range(H): tmp = [0 if j == '.' else 1 for j in input()] matrix.append(tmp) flag = 'Yes' for i, row in enumerate(matrix): for j, s in enumerate(row): if s == 1: if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0): ...
s124602274
s897341856
p03361
python
Runtime Error
A, B, C, X, Y = map(int, input().split()) if A + B > 2 * C: if A < B: ans = 2 * C * Y + min(A, 2 * C) * max((X - Y), 0) else: ans = 2 * C * X + min(B, 2 * C) * max((Y - X), 0) else: ans = A * X + B * Y print(ans)
S = input() ans = 700 + S.count('o') * 100 print(ans)
s778588727
s224705642
p03369
python
Runtime Error
print('Yes' len(set(input())) == 3 else 'No')
S = sorted(input()) if S[0] == 'a' and S[1] == 'b' and S[2] == 'c': print('Yes') else: print('No')
s825117134
s930203053
p03385
python
Runtime Error
A, B, K = map(int, input().split()) tmp = [i for i in range(A, B+1)] for i in sorted(set(tmp[:K] + tmp[B-A-K+1:])): print(i)
A, B, K = map(int, input().split()) ans = set() i = 0 tmp = A while i < K and tmp <= B: ans.add(tmp) tmp += 1 i += 1 i = 0 tmp = B while i < K and A <= tmp: ans.add(tmp) tmp -= 1 i += 1 for i in sorted(ans): print(i)
s537362829
s562892883
p03386
python
Time Limit Exceeded
def main(): A, B, K = map(int, input().split(' ')) l = B + 1 - A for i, x in enumerate(range(A, B+1), 1): if i <= K or l - i < K: print(x) if __name__ == '__main__': main()
A, B, K = map(int, input().split()) ans = set() i = 0 tmp = A while i < K and tmp <= B: ans.add(tmp) tmp += 1 i += 1 i = 0 tmp = B while i < K and A <= tmp: ans.add(tmp) tmp -= 1 i += 1 for i in sorted(ans): print(i)
s046603839
s562892883
p03386
python
Time Limit Exceeded
import sys def main(): N = int(sys.stdin.readline()) a = list(map(int, input().split())) n = [0 for i in range(0, max(a)+1)] for i in a: n[i] += 1 if len(a) < 2: print(sum(n)) else: print(max([i+j+k for i, j, k in zip(n[:-2], n[1:-1], n[2:])])) if __name__ == '__main__'...
import sys def main(): N = int(sys.stdin.readline()) a = list(map(int, input().split())) n = [0 for i in range(0, max(a)+1)] for i in a: n[i] += 1 if len(n) < 3: print(sum(n)) else: print(max([i+j+k for i, j, k in zip(n[:-2], n[1:-1], n[2:])])) if __name__ == '__main__'...
s107147822
s605990958
p03611
python
Runtime Error
import sys def main(): N = int(sys.stdin.readline()) a = list(map(int, input().split())) n = [0 for i in range(0, max(a)+1)] for i in a: n[i] += 1 print(max([i+j+k for i, j, k in zip(n[:-2], n[1:-1], n[2:])])) if __name__ == '__main__': main()
import sys def main(): N = int(sys.stdin.readline()) a = list(map(int, input().split())) n = [0 for i in range(0, max(a)+1)] for i in a: n[i] += 1 if len(n) < 3: print(sum(n)) else: print(max([i+j+k for i, j, k in zip(n[:-2], n[1:-1], n[2:])])) if __name__ == '__main__'...
s763443616
s605990958
p03611
python
Runtime Error
import sys def main(): N = int(sys.stdin.readline()) a = list(map(int, input().split())) n = [0 for i in range(0, max(a)+1)] for i in a: n[i] += 1 print(max([i+j+k for i, j, k in zip(n, n[1:], n[2:])])) if __name__ == '__main__': main()
import sys def main(): N = int(sys.stdin.readline()) a = list(map(int, input().split())) n = [0 for i in range(0, max(a)+1)] for i in a: n[i] += 1 if len(n) < 3: print(sum(n)) else: print(max([i+j+k for i, j, k in zip(n[:-2], n[1:-1], n[2:])])) if __name__ == '__main__'...
s505210008
s605990958
p03611
python
Runtime Error
import sys def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: try: count += 1 p[i - 1], p[i] = p[i], p[i - 1] except: break print(count) if __...
import sys def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: count += 1 if len(p) != i: p[i - 1], p[i] = p[i], p[i - 1] print(count) if __name__ == '__main__': main()
s118134710
s338900471
p03612
python
Runtime Error
def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if len(p) == i: continue if i == n: p[i - 1], p[i] = p[i], p[i - 1] count += 1 print(count) if __name__ == '__main__': main()
import sys def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: count += 1 if len(p) != i: p[i - 1], p[i] = p[i], p[i - 1] print(count) if __name__ == '__main__': main()
s021199153
s338900471
p03612
python
Runtime Error
def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: try: p[i - 1], p[i] = p[i], p[i - 1] count += 1 except: break print(count) if __name__ == '...
import sys def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: count += 1 if len(p) != i: p[i - 1], p[i] = p[i], p[i - 1] print(count) if __name__ == '__main__': main()
s729262548
s338900471
p03612
python
Runtime Error
def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: try: p[i], p[i] = p[i], p[i - 1] count += 1 except: break print(count) if __name__ == '__ma...
import sys def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: count += 1 if len(p) != i: p[i - 1], p[i] = p[i], p[i - 1] print(count) if __name__ == '__main__': main()
s542251946
s338900471
p03612
python
Runtime Error
def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: try: p[i], p[i] = p[i], p[i - 1] count += 1 except: break print(count) if __name__ == '__main__': ...
import sys def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: count += 1 if len(p) != i: p[i - 1], p[i] = p[i], p[i - 1] print(count) if __name__ == '__main__': main()
s188427057
s338900471
p03612
python
Runtime Error
def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: try: p[i], p[i] = p[i], p[i - 1] count += 1 except: break print(count) if __name__ == '__main__': ...
import sys def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: count += 1 if len(p) != i: p[i - 1], p[i] = p[i], p[i - 1] print(count) if __name__ == '__main__': main()
s931221989
s338900471
p03612
python
Runtime Error
def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: p[i - 1], p[i] = p[i], p[i - 1] count += 1 print(count) if __name__ == '__main__': main()
import sys def main(): N = int(sys.stdin.readline()) p = list(map(int, input().split())) count = 0 for i, n in enumerate(p, 1): if i == n: count += 1 if len(p) != i: p[i - 1], p[i] = p[i], p[i - 1] print(count) if __name__ == '__main__': main()
s868359542
s338900471
p03612
python
Runtime Error
def gcd(a, b): if a < b: a, b = b ,a while b > 0: a, b = b, a % b return a def lcm(a, b): return int((a * b) / gcd(a, b)) N = int(input()) T = [int(input()) for i in range(N)] ans = T[0] for t in T[1:]: ans = lcm(ans, t) print(ans)
def gcd(a, b): if a < b: a, b = b, a while b > 0: a, b = b, a % b return a def lcm(a, b): return (a * b) // gcd(a, b) N = int(input()) T = [int(input()) for i in range(N)] ans = T[0] for t in T[1:]: ans = lcm(ans, t) print(ans)
s947723839
s022341575
p03633
python
Runtime Error
def gcd(a, b): while b > 0: a, b = b, a % b return a def lcm(a, b): return int((a * b) / gcd(a, b)) N = int(input()) T = [int(input()) for i in range(N)] ans = T[0] for t in T[1:]: ans = lcm(ans, t) print(ans)
def gcd(a, b): if a < b: a, b = b, a while b > 0: a, b = b, a % b return a def lcm(a, b): return (a * b) // gcd(a, b) N = int(input()) T = [int(input()) for i in range(N)] ans = T[0] for t in T[1:]: ans = lcm(ans, t) print(ans)
s746600670
s022341575
p03633
python
Runtime Error
def gcd(a, b): while b > 0: a, b = b, a % b return a def lcm(a, b): return int((a * b) / gcd(a, b)) N = int(input()) T = [int(input()) for i in range(N)] ans = T[0] for t in T[1:]: ans = lcm(t, ans) print(ans)
def gcd(a, b): if a < b: a, b = b, a while b > 0: a, b = b, a % b return a def lcm(a, b): return (a * b) // gcd(a, b) N = int(input()) T = [int(input()) for i in range(N)] ans = T[0] for t in T[1:]: ans = lcm(ans, t) print(ans)
s545252332
s022341575
p03633
python
Runtime Error
def gcd(a, b): while b > 0: a, b = b, a % b return a def lcm(a, b): return int((a * b) / gcd(a, b)) N = int(input()) T = [int(input()) for i in range(N)] a = T[0] for b in T[1:]: a = lcm(a, b) print(a)
def gcd(a, b): if a < b: a, b = b, a while b > 0: a, b = b, a % b return a def lcm(a, b): return (a * b) // gcd(a, b) N = int(input()) T = [int(input()) for i in range(N)] ans = T[0] for t in T[1:]: ans = lcm(ans, t) print(ans)
s566554840
s022341575
p03633
python
Runtime Error
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = list(set(list1) ...
N = raw_input() print('ABC{0}'.format(N))
s235553982
s957327293
p03643
python
Runtime Error
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = list(set(list1) ...
N = raw_input() print('ABC{0}'.format(N))
s486010185
s957327293
p03643
python
Runtime Error
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] flag = True for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = list...
N = raw_input() print('ABC{0}'.format(N))
s864158455
s957327293
p03643
python
Runtime Error
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = list(set(list1) ...
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = list(set(list1) ...
s063856056
s751802406
p03645
python
Runtime Error
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] flag = True for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = [] ...
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = list(set(list1) ...
s908337759
s751802406
p03645
python
Runtime Error
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] flag = True for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = lis...
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = list(set(list1) ...
s417905881
s751802406
p03645
python
Runtime Error
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] flag = True for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if b == N: nlist.append(a) if a == 1: list1.append(b) for i in list1: if i in nlist: print('POS...
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = list(set(list1) ...
s565362629
s751802406
p03645
python
Time Limit Exceeded
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] flag = True for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if b == N: nlist.append(a) if a == 1: list1.append(b) for i in list1: if i in nlist: print('POS...
import sys l = raw_input().split() N = int(l[0]) M = int(l[1]) nlist = [] list1 = [] for i in range(0, M): tmp = raw_input().split() a = int(tmp[0]) b = int(tmp[1]) if a == 1: list1.append(b) continue if b == N: nlist.append(a) continue matched_list = list(set(list1) ...
s545339561
s751802406
p03645
python
Time Limit Exceeded
n = int(input()) a = list(map(int, input().split())) b = [0 for _ in range(n)] i = 0 j = n - 1 while(j > 0): b[i] = a[j] i += 1 j -= 2 j = 1 if j == 0 else 0 while(i < n): b[i] = a[j] i += 1 j += 2 ans = ' '.join(map(str, b)) print(ans)
n = int(input()) a = list(map(int, input().split())) b = [0 for _ in range(n)] i = 0 j = n - 1 while(j >= 0): b[i] = a[j] i += 1 j -= 2 j = 0 if j == -1 else 1 while(i < n): b[i] = a[j] i += 1 j += 2 ans = ' '.join(map(str, b)) print(ans)
s920480020
s317210260
p03673
python
Runtime Error
S = input() s = '' for i in S: if i != s[-1]: s += i print(len(s) - 1)
S = input() s = S[0] if len(S) > 1: for i in S[1:]: if i != s[-1]: s += i print(len(s) - 1)
s158477239
s648521282
p03945
python
Runtime Error
from collections import deque class Edge: def __init__(self, t, w): self.to = t self.ew = w class Graph: def __init__(self, N): self.nw = [-1] * N self.al = [[] for i in range(N)] def add_edge(self, fr, to, weight): self.al[fr].append(Edge(to, weight)) self.al[to].append(Edge(fr, -weight)) def dfs(s...
import sys sys.setrecursionlimit(100000) N, M = map(int, input().split()) union = list(range(N + 1)) dist = [0] * (N + 1) rec = [0] * (N + 1) def ascend(anc): count = 0 while anc != union[anc]: rec[count] = anc anc = union[anc] count += 1 rec[count] = anc for i in range(count - 1, -1, -1): dist[rec[i]] += ...
s315964478
s965013779
p03452
python
Time Limit Exceeded
import sys sys.setrecursionlimit(100000) N, M = map(int, input().split()) union = list(range(N + 1)) dist = [0] * (N + 1) def ascend(anc): tmp_d = dist[anc] if union[anc] == anc: return anc, tmp_d else: union[anc], d_sum = ascend(union[anc]) dist[anc] = tmp_d + d_sum return union[anc], dist[anc] def connect...
import sys sys.setrecursionlimit(100000) N, M = map(int, input().split()) union = list(range(N + 1)) dist = [0] * (N + 1) rec = [0] * (N + 1) def ascend(anc): count = 0 while anc != union[anc]: rec[count] = anc anc = union[anc] count += 1 rec[count] = anc for i in range(count - 1, -1, -1): dist[rec[i]] += ...
s110274087
s965013779
p03452
python
Time Limit Exceeded
import numpy as np N, K = map(int, input().split()) ub = K * 2 bw = {"B": np.zeros((ub, ub), int), "W": np.zeros((ub, ub), int)} for i in range(N): x, y, c = input().split() bw[c][int(x) % ub][int(y) % ub] += 1 def accum_arr(arr): acc_h = np.zeros((ub, ub), int) acc_v = np.zeros((ub, ub), int) acc = np.zeros((ub...
a, b = map(int, input().split()) print("Odd" if a * b % 2 else "Even")
s568495432
s171500826
p03455
python
Runtime Error
import numpy as np N, K = map(int, input().split()) ub = K * 2 b = np.zeros((ub + 1, ub + 1), int) def create_bound(p): if p - K + 1 >= 0: return [(p - K + 1, p + 1)] else: return [(0, p + 1), ((p - K + 1) % ub, ub)] for i in range(N): x, y, c = input().split() nx = int(x) % ub ny = (int(y) + (K if c == "W"...
N, K = map(int, input().split()) ub = K * 2 b = [[0 for j in range(ub + 1)] for i in range(ub + 1)] def create_bound(p): if p - K + 1 >= 0: return [(p - K + 1, p + 1)] else: return [(0, p + 1), ((p - K + 1) % ub, ub)] for i in range(N): x, y, c = input().split() nx = int(x) % ub ny = (int(y) + (K if c == "W"...
s913977045
s796235995
p03458
python
Time Limit Exceeded
import numpy as np N, K = map(int, input().split()) ub = K * 2 bw = {"B": np.zeros((ub, ub), int), "W": np.zeros((ub, ub), int)} for i in range(N): x, y, c = input().split() bw[c][int(x) % ub][int(y) % ub] += 1 def accum_arr(arr): acc_h = np.zeros((ub, ub), int) acc_v = np.zeros((ub, ub), int) acc = np.zeros((ub...
N, K = map(int, input().split()) ub = K * 2 b = [[0 for j in range(ub + 1)] for i in range(ub + 1)] def create_bound(p): if p - K + 1 >= 0: return [(p - K + 1, p + 1)] else: return [(0, p + 1), ((p - K + 1) % ub, ub)] for i in range(N): x, y, c = input().split() nx = int(x) % ub ny = (int(y) + (K if c == "W"...
s692508752
s796235995
p03458
python
Runtime Error
import numpy as np N, K = map(int, input().split()) ub = K * 2 bw = {"B": np.full((ub, ub), 0), "W": np.full((ub, ub), 0)} for i in range(N): x, y, c = input().split() bw[c][int(x) % ub][int(y) % ub] += 1 def accum_arr(arr): acc_h = np.full((ub, ub), 0) acc_v = np.full((ub, ub), 0) acc = np.full((ub, ub), 0) ac...
N, K = map(int, input().split()) ub = K * 2 b = [[0 for j in range(ub + 1)] for i in range(ub + 1)] def create_bound(p): if p - K + 1 >= 0: return [(p - K + 1, p + 1)] else: return [(0, p + 1), ((p - K + 1) % ub, ub)] for i in range(N): x, y, c = input().split() nx = int(x) % ub ny = (int(y) + (K if c == "W"...
s569859522
s796235995
p03458
python
Runtime Error
S = list(input()) S[3] = "8" print("".join(S))
S = list(input()) S[3] = "8" print("".join(S))
s190927774
s738126267
p03469
python
Runtime Error
N = int(input()) l_im2, l_im1 = 2, 1 for i in range(2, N + 1): l_i = l_im1 + l_im2 l_im1, l_im2 = l_i, l_im1 print(l_i)
N = int(input()) l_im2, l_im1, l_i = 2, 1, 1 for i in range(2, N + 1): l_i = l_im1 + l_im2 l_im1, l_im2 = l_i, l_im1 print(l_i)
s495496751
s963290043
p03544
python
Runtime Error
import numpy as np ans = ["<", "=", ">"] m = np.full((6, 6), 1, mp.int64) m[np.tri(6) == 0] = 2 m[np.tri(6).T == 0] = 0 X, Y = map(lambda x: ord(x) - 65, input().split()) print(ans[m[X][Y]])
import numpy as np ans = ["<", "=", ">"] m = np.full((6, 6), 1, np.int64) m[np.tri(6) == 0] = 0 m[np.tri(6).T == 0] = 2 X, Y = map(lambda x: ord(x) - 65, input().split()) print(ans[m[X][Y]])
s418268022
s793573568
p03547
python
Runtime Error
import numpy as np ans = np.full((6, 6), "=") ans[np.tri(6) == 0] = "<" ans[np.tri(6).T == 0] = ">" X, Y = map(lambda x: ord(x) - 65, input().split()) print(ans[X][Y])
import numpy as np ans = ["<", "=", ">"] m = np.full((6, 6), 1, np.int64) m[np.tri(6) == 0] = 0 m[np.tri(6).T == 0] = 2 X, Y = map(lambda x: ord(x) - 65, input().split()) print(ans[m[X][Y]])
s613687289
s793573568
p03547
python
Runtime Error
from itertools import combinations as comb import numpy as np N, K = map(int, input().split()) ans = 10 ** 18 + 1 choice = min(K, 4) ps = np.array([list(map(int, input().split())) for i in range(N)]) for idxs in comb(range(N), choice): rep_ps = ps[idxs, :] x_max = rep_ps[:, 0].max() y_max = rep_ps[:, 1].max() x_min...
A, B, C = map(int, input().split()) if A == B: print(C) elif B == C: print(A) else: print(B)
s951622582
s455475543
p03573
python
Runtime Error
from itertools import combinations as comb import numpy as np N, K = map(int, input().split()) ans = 10 ** 18 + 1 choice = min(K, 4) ps = np.array([list(map(int, input().split())) for i in range(N)]) for idxs in comb(range(N), choice): rep_ps = ps[idxs, :] x_max = rep_ps[:, 0].max() y_max = rep_ps[:, 1].max() x_min...
from itertools import combinations as comb N, K = map(int, input().split()) ans = (2 * 10 ** 9) ** 2 + 1 choice = min(K, 4) xs = [0] * N ys = [0] * N for i in range(N): xs[i], ys[i] = map(int, input().split()) for idxs in comb(range(N), choice): x_mx = y_mx = - 10 ** 9 x_mn = y_mn = 10 ** 9 for i in idxs: x_mx =...
s194716931
s231444254
p03576
python
Runtime Error
from collections import defaultdict from itertools import product from sys import stdin def gen_b(x,B): if x < 3: lb = 2 else: lb = x - 1 if x > B-2: ub = B-1 else: ub = x + 1 return xrange(lb,ub+1) def solve(): count = defaultdict(int) ans = [0]*10 L = map(lambda x:map(int,x.split()),stdin.readlines()) H,W,N ...
from itertools import permutations as perm S = raw_input() n = len(S) dp = [[] for i in xrange(n)] dp[0].append(int(S[0])) for i in xrange(1,n): dp[i].append(int(S[:i+1])) for j in xrange(i): for k in dp[j]: dp[i].append(k+int(S[j+1:i+1])) print sum(dp[n-1])
s695728664
s539864298
p04001
python
Runtime Error
from collections import defaultdict from sys import stdin def gen_bound(x,B): if x < 3: lb = 2 else: lb = x - 1 if x > B-2: ub = B-1 else: ub = x + 1 return lb,ub+1 def solve(): count = defaultdict(int) ans = [0]*10 L = map(lambda x:map(int,x.split()),stdin.readlines()) H,W,N = L[0] for i in xrange(1,N+1): ...
from itertools import permutations as perm S = raw_input() n = len(S) dp = [[] for i in xrange(n)] dp[0].append(int(S[0])) for i in xrange(1,n): dp[i].append(int(S[:i+1])) for j in xrange(i): for k in dp[j]: dp[i].append(k+int(S[j+1:i+1])) print sum(dp[n-1])
s961680043
s539864298
p04001
python
Runtime Error
from collections import defaultdict def enum(n,x,A): D = defaultdict(int) D[0] = 1 L = [None]*(1<<n) L[0] = 0 for k in xrange(1<<n): for j in xrange(n): jbit = 1<<j if (k&jbit): continue nbit = k + jbit if L[nbit] is None: nv = L[k] + x[j] L[nbit] = nv cnt = bin(nbit).count("1") D[nv...
from collections import defaultdict def solve(): N,A = map(int,raw_input().split()) x = map(int,raw_input().split()) DP = [defaultdict(int) for i in xrange(N+1)] DP[0][0] = 1 for i in xrange(N): for k,v in DP[i].iteritems(): DP[i+1][k+x[i]-A] += v DP[i+1][k] += v print DP[N][0] - 1 solve()
s350724229
s210189610
p04015
python
Time Limit Exceeded
from collections import deque S = [ord(a)-97 for a in raw_input()] N = len(S) for c in xrange(26): ls = deque() for i in xrange(N-1): if S[i] == c: l = i break else: continue cnt = 1 for r in xrange(l+1,N): if S[r] == c: cnt += 1 ls.append(r) if cnt * 2 > r - l + 1: print l+1,r+1 quit(...
from collections import deque S = [ord(a)-97 for a in raw_input()] N = len(S) for c in xrange(26): L = deque() for i in xrange(N-1): if S[i] == c: l = i break else: continue cnt = 1 lenL = 0 for r in xrange(l+1,N): if S[r] == c: cnt += 1 L.append(r) lenL += 1 if cnt * 2 > r - l + 1: pr...
s295566105
s001050230
p04026
python
Runtime Error
from sys import setrecursionlimit setrecursionlimit(100000) def rad_reach(b,h,dist,E,rad): cnt = 1 if dist < rad: for nxt in E[h]: if nxt == b: continue cnt += rad_reach(h,nxt,dist+1,E,rad) return cnt def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xra...
from sys import setrecursionlimit setrecursionlimit(1000000) def calc_dist(b,h,dist,E,D,ne): D[dist] += 1 for nxt in E[h]: if nxt == b or nxt == ne: continue calc_dist(h,nxt,dist+1,E,D,ne) def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xrange(N-1): a,b =...
s057601498
s477256091
p04049
python
Time Limit Exceeded
from sys import setrecursionlimit setrecursionlimit(100000) def rad_reach(b,h,dist,E,rad): cnt = 1 if dist < rad: for nxt in E[h]: if nxt == b: continue cnt += rad_reach(h,nxt,dist+1,E,rad) return cnt def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xra...
from sys import setrecursionlimit setrecursionlimit(1000000) def calc_dist(b,h,dist,E,D,ne): D[dist] += 1 for nxt in E[h]: if nxt == b or nxt == ne: continue calc_dist(h,nxt,dist+1,E,D,ne) def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xrange(N-1): a,b =...
s200933405
s477256091
p04049
python
Time Limit Exceeded
from sys import setrecursionlimit setrecursionlimit(100000) def rad_reach(bfr,h,dist,E,rad,ne): cnt = 1 if dist < rad: for nxt in E[h]: if nxt == bfr: continue cnt += rad_reach(h,nxt,dist+1,E,rad,ne) return cnt def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [set() for i in xrange(N)] for...
from sys import setrecursionlimit setrecursionlimit(1000000) def calc_dist(b,h,dist,E,D,ne): D[dist] += 1 for nxt in E[h]: if nxt == b or nxt == ne: continue calc_dist(h,nxt,dist+1,E,D,ne) def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xrange(N-1): a,b =...
s823772579
s477256091
p04049
python
Time Limit Exceeded
from sys import setrecursionlimit setrecursionlimit(100000) def rad_reach(b,h,dist,E,rad,ne): cnt = 1 if dist < rad: for nxt in E[h]: if nxt == b or nxt == ne: continue cnt += rad_reach(h,nxt,dist+1,E,rad,ne) return cnt def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrang...
from sys import setrecursionlimit setrecursionlimit(1000000) def calc_dist(b,h,dist,E,D,ne): D[dist] += 1 for nxt in E[h]: if nxt == b or nxt == ne: continue calc_dist(h,nxt,dist+1,E,D,ne) def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xrange(N-1): a,b =...
s916871810
s477256091
p04049
python
Time Limit Exceeded
def calc_dist(b,h,dist,E,D,ne): D[dist] += 1 for nxt in E[h]: if nxt == b or nxt == ne: continue calc_dist(h,nxt,dist+1,E,D,ne) def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xrange(N-1): a,b = map(lambda x:int(x)-1,raw_input().split()) E[a].append(b) ...
from sys import setrecursionlimit setrecursionlimit(1000000) def calc_dist(b,h,dist,E,D,ne): D[dist] += 1 for nxt in E[h]: if nxt == b or nxt == ne: continue calc_dist(h,nxt,dist+1,E,D,ne) def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xrange(N-1): a,b =...
s671156005
s477256091
p04049
python
Runtime Error
def calc_dist(b,h,dist,E,D,ne): D[dist] += 1 for nxt in E[h]: if nxt == b or nxt == ne: continue calc_dist(h,nxt,dist+1,E,D,ne) def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xrange(N-1): a,b = map(lambda x:int(x)-1,raw_input().split()) E[a].append(b) ...
from sys import setrecursionlimit setrecursionlimit(1000000) def calc_dist(b,h,dist,E,D,ne): D[dist] += 1 for nxt in E[h]: if nxt == b or nxt == ne: continue calc_dist(h,nxt,dist+1,E,D,ne) def solve(): N,K = map(int,raw_input().split()) pairs = [] E = [[] for i in xrange(N)] for i in xrange(N-1): a,b =...
s986115216
s477256091
p04049
python
Time Limit Exceeded
from collections import defaultdict def solve(): Base = 2000 MAX = Base*2 p = 10**9+7 F = [1]; Finv = [0]*(MAX*2+1) for i in xrange(MAX*2): F.append(F[i]*(i+1)%p) Finv[MAX] = pow(F[MAX],p-2,p) for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p N = int(raw_input()) A_MAX = B_MAX = 0 dp = [[0]*(MAX+2) for i in ...
from collections import defaultdict def solve(): Base = 2000 MAX = Base*2 p = 10**9+7 F = [1]; Finv = [0]*(MAX*2+1) for i in xrange(MAX*2): F.append(F[i]*(i+1)%p) Finv[MAX] = pow(F[MAX],p-2,p) for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p N = int(raw_input()) dup = A_MAX = B_MAX = 0 dp = [[0]*(MAX+2) for...
s394431474
s186603920
p04051
python
Time Limit Exceeded
from collections import defaultdict def solve(): Base = 2000 MAX = Base*2 p = 10**9+7 F = [1]; Finv = [0]*(MAX*2+1) for i in xrange(MAX*2): F.append(F[i]*(i+1)%p) Finv[MAX] = pow(F[MAX],p-2,p) for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p N = int(raw_input()) dup = A_MAX = B_MAX = 0 dp = [[0]*(MAX+2) for...
from collections import defaultdict def solve(): Base = 2000 MAX = Base*2 p = 10**9+7 F = [1]; Finv = [0]*(MAX*2+1) for i in xrange(MAX*2): F.append(F[i]*(i+1)%p) Finv[MAX] = pow(F[MAX],p-2,p) for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p N = int(raw_input()) dup = A_MAX = B_MAX = 0 dp = [[0]*(MAX+2) for...
s438313939
s186603920
p04051
python
Time Limit Exceeded
from collections import defaultdict def solve(): Base = 2000 MAX = Base*2 p = 10**9+7 F = [1]; Finv = [0]*(MAX*2+1) for i in xrange(MAX*2): F.append(F[i]*(i+1)%p) Finv[MAX*2] = pow(F[MAX*2],p-2,p) for i in xrange(MAX*2,0,-1): Finv[i-1] = Finv[i]*i%p N = int(raw_input()) dup = A_MAX = B_MAX = 0 dp = [[0]*(MAX+...
from collections import defaultdict def solve(): Base = 2000 MAX = Base*2 p = 10**9+7 F = [1]; Finv = [0]*(MAX*2+1) for i in xrange(MAX*2): F.append(F[i]*(i+1)%p) Finv[MAX] = pow(F[MAX],p-2,p) for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p N = int(raw_input()) dup = A_MAX = B_MAX = 0 dp = [[0]*(MAX+2) for...
s313470683
s186603920
p04051
python
Time Limit Exceeded
from collections import defaultdict def solve(): Base = 2000 MAX = Base*2 p = 10**9+7 F = [1]; Finv = [0]*(MAX+1) for i in xrange(MAX*2): F.append(F[i]*(i+1)%p) Finv[MAX] = pow(F[MAX],p-2,p) for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p N = int(raw_input()) dup = 0 dp = [[0]*(MAX+2) for i in xrange(MAX+2...
from collections import defaultdict def solve(): Base = 2000 MAX = Base*2 p = 10**9+7 F = [1]; Finv = [0]*(MAX*2+1) for i in xrange(MAX*2): F.append(F[i]*(i+1)%p) Finv[MAX] = pow(F[MAX],p-2,p) for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p N = int(raw_input()) dup = A_MAX = B_MAX = 0 dp = [[0]*(MAX+2) for...
s498436523
s186603920
p04051
python
Time Limit Exceeded
# -*- coding: utf-8 -*- a, b, c, d = map(int, input().split()) if(c < b): if(d <= b): if(d <= a): time = 0 else if(c < a): time = d - a else: time = d - c else: time = b - c else: time = 0 print(time)
# -*- coding: utf-8 -*- a, b, c, d = map(int, input().split()) if(c < b): if(d <= b): if(d <= a): time = 0 elif(c < a): time = d - a else: time = d - c elif (c < a): time = b - a else: time = b - c else: time = 0 print(time)
s704360148
s762758831
p03632
python
Runtime Error
# from .myutil import Combination class Combination: mod = 0 N = 0 g1 = [1, 1] g2 = [1, 1] inverse = [0, 1] def __init__(self, mod=10 ** 9 + 7, N=10 ** 9): self.mod = mod self.N = N for i in range(2, self.N + 1): self.g1.append((self.g1[-1] * i) % self.mod)...
# from .myutil import Combination from math import factorial MOD = 10 ** 9 + 7 def Combination2(n, r): ret = 1 for i in range(r): ret = ret * (n - i) % MOD return ret * pow(factorial(r), MOD - 2, MOD) % MOD n, a, b = map(int, input().split()) total = pow(2, n, MOD) - Combination2(n, a) - Combinat...
s324716116
s294068905
p02768
python
Time Limit Exceeded
# from .myutil import Combination class Combination: mod = 0 N = 0 g1 = [1, 1] g2 = [1, 1] inverse = [0, 1] def __init__(self, mod=10 ** 9 + 7, N=10 ** 6): self.mod = mod self.N = N for i in range(2, self.N + 1): self.g1.append((self.g1[-1] * i) % self.mod)...
# from .myutil import Combination from math import factorial MOD = 10 ** 9 + 7 def Combination2(n, r): ret = 1 for i in range(r): ret = ret * (n - i) % MOD return ret * pow(factorial(r), MOD - 2, MOD) % MOD n, a, b = map(int, input().split()) total = pow(2, n, MOD) - Combination2(n, a) - Combinat...
s619595373
s294068905
p02768
python
Runtime Error
N = int(input()) V = [int(n) for n in input().split(" ")] C = [int(n) for n in input().split(" ")] ret = 0 for i in range(N): if V[i] - C[i] > 0: ret += V[i] - C[i] print(ret)
input = input() sp_input = input.split(" ") A = int(sp_input[0]) B = int(sp_input[1]) T = int(sp_input[2]) + 0.5 a = A ret = 0 i = B while a <= T: ret += B a += A print(ret)
s361585415
s169698435
p03059
python
Runtime Error
A, B = map(int, input().split()) if A % B == 0: print(A+B) else: print(A-B) A, B = map(int, input().split()) if A % B == 0: print(A+B) else: print(B-A)
A, B = map(int, input().split()) if B % A == 0: print(A+B) else: print(B-A)
s884033026
s555952611
p03125
python
Runtime Error
K, A, B = map(int, input().split()) if A + 2 > B: print(K+1) exit() bis = 0 K = K - (A+1) bis = B if B - A >= 2: if K > 1: k = K//2 bis += (B-A)*k if K % 2 == 1: bis += 1 print(bis)
N, K = map(int, input().split()) if N%2 == 1: N += 1 cnt = int(N/2) if cnt >= K: print("YES") else: print("NO")
s313745425
s394395640
p03129
python
Runtime Error
import numpy as np N = int(input()) num = list(map(int, input().split())) num = np.array(num) count = 0 judge = 0 for i in range(N): if (num[i] % 2) == 1: judge = 1 while judge == 0: num = num/2 count += 1 for i in range(N): if (num[i] % 2) == 1: judge = 1 print(count)
s1s2s3 = input() s = str(s1s2s3) count = 0 for i in range(3): if int(s[i]) == 1: count +=1 print(count)
s108312095
s619983676
p03493
python
Runtime Error
K, S = map(int, input().split()) cnt = 0 for i in range(K+1): for j in range(K+1): for k in range(K+1): if i+j+k == S: cnt += 1 print(cnt)
K, S = map(int, input().split()) cnt = 0 for i in range(K+1): for j in range(K+1): Z = S - (i + j) if 0 <= Z <= K: cnt += 1 print(cnt)
s893509892
s012757542
p03835
python
Time Limit Exceeded
N = int(input()) X_double = N / 1.08 if (X_double % 1) == 0: print(int(X_duoble)) else: X_ceil = ceil(X_double) if floor(X_ceil * 1.08) == N: print(X_ceil) else: print(':(')
import math N = int(input()) X_double = N / 1.08 if (X_double % 1) == 0: print(int(X_double)) else: X_ceil = math.ceil(X_double) if math.floor(X_ceil * 1.08) == N: print(X_ceil) else: print(':(')
s650115994
s038691874
p02842
python
Runtime Error
import sys sys.setrecursionlimit(10**7) 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 II(): return int(sys.stdin.read...
import sys sys.setrecursionlimit(10**7) 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 II(): return int(sys.stdin.read...
s453813867
s754716479
p02883
python
Time Limit Exceeded
import sys sys.setrecursionlimit(10**7) 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 II(): return int(sys.stdin.read...
import sys sys.setrecursionlimit(10**7) 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 II(): return int(sys.stdin.read...
s707067983
s769366662
p02888
python
Time Limit Exceeded
import sys sys.setrecursionlimit(10 ** 7) debug = True debug = False def dprint(*objects): if debug == True: print(*objects) def matdprint(mat): if debug == True: for i in range(len(mat)): for j in range(len(mat[i])): print(mat[i][j], end=', ') print()...
import sys sys.setrecursionlimit(10 ** 7) debug = True debug = False def dprint(*objects): if debug == True: print(*objects) def matdprint(mat): if debug == True: for i in range(len(mat)): for j in range(len(mat[i])): print(mat[i][j], end=', ') print()...
s481094095
s807589539
p02901
python
Time Limit Exceeded
import sys sys.setrecursionlimit(10 ** 7) debug = True debug = False def dprint(*objects): if debug == True: print(*objects) def matdprint(mat): if debug == True: for i in range(len(mat)): for j in range(len(mat[i])): print(mat[i][j], end=', ') print()...
import sys sys.setrecursionlimit(10 ** 7) debug = True debug = False def dprint(*objects): if debug == True: print(*objects) def matdprint(mat): if debug == True: for i in range(len(mat)): for j in range(len(mat[i])): print(mat[i][j], end=', ') print()...
s046516686
s807589539
p02901
python
Time Limit Exceeded
import sys sys.setrecursionlimit(10 ** 7) debug = True debug = False def dprint(*objects): if debug == True: print(*objects) 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....
import sys sys.setrecursionlimit(10 ** 7) debug = True debug = False def dprint(*objects): if debug == True: print(*objects) 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....
s155711257
s224857556
p02913
python
Time Limit Exceeded
import sys def LI(): return [int(x) for x in sys.stdin.readline().split()] def II(): return int(sys.stdin.readline()) from collections import deque def main(): N = II() a_mat = [] for i in range(N): a_mat.append(deque(LI())) cnt = 0 first_list = [a_list.popleft() for a_list in a_mat] ...
import sys def LI(): return [int(x) for x in sys.stdin.readline().split()] def II(): return int(sys.stdin.readline()) from collections import deque from copy import copy #debug = True debug = False def dprint(*objects): if debug == True: print(*objects) def main(): N = II() a_mat = [] for i ...
s907167466
s859926694
p02925
python
Time Limit Exceeded
import sys sys.setrecursionlimit(10**7) 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 II(): return int(sys.stdin.read...
import sys def LI(): return [int(x) for x in sys.stdin.readline().split()] def II(): return int(sys.stdin.readline()) from collections import deque from copy import copy #debug = True debug = False def dprint(*objects): if debug == True: print(*objects) def main(): N = II() a_mat = [] for i ...
s036046907
s859926694
p02925
python
Time Limit Exceeded
import sys sys.setrecursionlimit(10**7) 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 II(): return int(sys.stdin.read...
import sys def LI(): return [int(x) for x in sys.stdin.readline().split()] def II(): return int(sys.stdin.readline()) from collections import deque from copy import copy #debug = True debug = False def dprint(*objects): if debug == True: print(*objects) def main(): N = II() a_mat = [] for i ...
s791961049
s859926694
p02925
python
Time Limit Exceeded
import sys sys.setrecursionlimit(10**7) 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 II(): return int(sys.stdin.read...
import sys def LI(): return [int(x) for x in sys.stdin.readline().split()] def II(): return int(sys.stdin.readline()) from collections import deque from copy import copy #debug = True debug = False def dprint(*objects): if debug == True: print(*objects) def main(): N = II() a_mat = [] for i ...
s093180156
s859926694
p02925
python
Time Limit Exceeded
import sys def SI(): return sys.stdin.readline().strip() def main(): s = SI() t = SI() import collections didx = collections.defaultdict(int) d = collections.defaultdict(list) for i, c in enumerate(s): d[c].append(i) # keys = d.keys() # for c in set(t): # if c not in ...
import sys def SI(): return sys.stdin.readline().strip() def main(): s = SI() t = SI() import collections d = collections.defaultdict(list) for i, c in enumerate(s): d[c].append(i) keys = d.keys() for c in set(t): if c not in keys: print(-1) return ...
s681238088
s317295092
p02937
python
Runtime Error