Dataset Viewer
Auto-converted to Parquet Duplicate
buggy
stringlengths
1
539k
fixed
stringlengths
18
491k
buggy_submission_id
stringlengths
10
10
fixed_submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
lang
stringclasses
1 value
buggy_verdict
stringclasses
1 value
S = input() ans = 0 for i in range(2**(len(S)-1): temp = S for j in range(len(S)-1): if(i >> j) & 1: temp = temp[:j - len(S) + 1]+'+'+temp[j-len(S)+1:] ans += eval(temp) print(ans)
S = input() ans = 0 for i in range(2**(len(S)-1)): temp = S for j in range(len(S)-1): if(i >> j) & 1: temp = temp[:j - len(S) + 1]+'+'+temp[j-len(S)+1:] ans += eval(temp) print(ans)
s824812852
s233727404
p04001
python
Runtime Error
a,b,c=map(int,input().split()) s=k m=c while s<a: s=s+b m=m+c print(m)
a,b,c=map(int,input().split()) s=b m=c while s<a: s=s+b m=m+c print(m)
s303919910
s659392445
p02576
python
Runtime Error
s=input() i=0 c=0 if s[i]=='R': c=1 if s[i+1]=='R': c=2 if s[i+2]=='R': c=3 if s[i]=='S': c=0 if s[i+1]=='R': c=1 if s[i+2]=='R': c=2 print(c)
s=input() if 'RRR' in s: c=3 elif 'RR' in s: c=2 elif 'R' in s: c=1 else: c=0 print(c)
s194507212
s210431931
p02582
python
Runtime Error
s=input() l=[] for i in range(0,len(s)): if s[i]=='R': c=1 p=i while True: if s[p+1]=='R': c=c+1 p=p+1 else: break l.append(c) print(max(l))
s=input() if 'RRR' in s: c=3 elif 'RR' in s: c=2 elif 'R' in s: c=1 else: c=0 print(c)
s810323091
s210431931
p02582
python
Runtime Error
n=int(input()) l=list(map(int,input().split()) c=0 for i in range(0,n): for j in range(i,n): for k in range(j,n): if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]: if l[i]+l[j]>l[k] and l[k]+l[j]>l[i] and l[i]+l[k]>l[j]: c=c+1 print(c)
N=int(input()) L_list=list(map(int, input().split())) ans=0 for i in range(N): for j in range(i, N): for k in range(j, N): if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]: if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]: ...
s445679631
s784020244
p02583
python
Runtime Error
n=int(input()) l=list(map(int,input().split()) c=0 for i in range(1,n): for j in range(i,n): for k in range(j,n): if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]: if l[i]+l[j]>l[k] and l[k]+l[j]>l[i] and l[i]+l[k]>l[j]: c=c+1 print(c)
N=int(input()) L_list=list(map(int, input().split())) ans=0 for i in range(N): for j in range(i, N): for k in range(j, N): if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]: if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]: ...
s536251000
s784020244
p02583
python
Runtime Error
n=int(input()) l=list(map(int,input().split()) c=0 for i in range(1,n): for j in range(i,n): for k in range(j,n): if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]: if l[i]+l[j]>l[k] and l[k]+l[j]>l[i] and l[i]+l[k]>l[j]: c=c+1 print(c)
N=int(input()) L_list=list(map(int, input().split())) ans=0 for i in range(N): for j in range(i, N): for k in range(j, N): if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]: if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]: ...
s453165807
s784020244
p02583
python
Runtime Error
n=int(input()) l=list(map(int,input().split()) c=0 for i in range(1,N): for j in range(i,N): for k in range(j,N): if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]: if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[i]+l[k]>l[j]: c=c+1 print(c)
N=int(input()) L_list=list(map(int, input().split())) ans=0 for i in range(N): for j in range(i, N): for k in range(j, N): if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]: if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]: ...
s026570793
s784020244
p02583
python
Runtime Error
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: x = find(x) return x def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] root[y] = x ...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s199484924
s539268649
p02536
python
Runtime Error
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(x) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] root[y]...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s470544947
s539268649
p02536
python
Runtime Error
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * (110000) def find(x): if root[x] < 0: return x else: root[x] = find(x) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] ...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s693710538
s539268649
p02536
python
Runtime Error
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * (110000) def find(x): if root[x] >= 0: root[x] = find(x) return root[x] else: return x def unite(x, y): x = find(x) y = find(y) if x != y: root[x] += root[y] root[y] = x...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s915578296
s539268649
p02536
python
Runtime Error
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * (110000) def find(x): if root[x] >= 0: root[x] = find(x) return root[x] else: return x def unite(a, b): a = find(a) b = find(b) if a != b: root[a] += root[b] root[b] = a...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s136627115
s539268649
p02536
python
Runtime Error
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * (1100000) def find(x): if root[x] >= 0: root[x] = find(x) return root[x] else: return x def unite(a, b): a = find(a) b = find(b) if a != b: root[a] += root[b] root[b] = ...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s987712688
s539268649
p02536
python
Runtime Error
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * (110000) def find(x): if root[x] >= 0: r = find(x) root[x] = r return r def unite(a, b): a = find(a) b = find(b) if a != b: root[a] += root[b] root[b] = a for _ in range(m...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s736798817
s539268649
p02536
python
Runtime Error
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * (110000) def find(x): if root[x] >= 0: r = find(x) root[x] = r return r def unite(a, b): a = find(a) b = find(b) if a != b: root[a] += root[b] root[b] = a for _ in range(m...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s432817345
s539268649
p02536
python
Runtime Error
n, m = map(int, input().split()) class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] d...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s348601070
s539268649
p02536
python
Runtime Error
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * (110000) def find(x): if root[x] > 0: x = find(x) return x def unite(a, b): a = find(a) b = find(b) if a != b: root[a] += root[b] root[b] = a for _ in range(m): a, b = ma...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s636120362
s539268649
p02536
python
Runtime Error
n, m = map(int, input().split()) root = [-1] * (110000) def find(x): if root[x] > 0: x = find(x) return x def unite(a, b): a = find(a) b = find(b) if a != b: root[a] += root[b] root[b] = a for _ in range(m): a, b = map(int, input().split()) unite(a, b) an...
import sys sys.setrecursionlimit(10 ** 9) n, m = map(int, input().split()) root = [-1] * n def find(x): if root[x] < 0: return x else: root[x] = find(root[x]) return root[x] def unite(x, y): x = find(x) y = find(y) if x == y: return root[x] += root[y] r...
s397791238
s539268649
p02536
python
Runtime Error
N = int(input()) bin_X = input() int_X = int(bin_X, 2) pop_cnt_1 = 0 for i in bin_X: if i == '1': pop_cnt_1 += 1 pop_cnt_0 = pop_cnt_1 + 1 pop_cnt_1 = pop_cnt_1 - 1 int_X_0 = int_X % pop_cnt_0 int_X_1 = int_X % pop_cnt_1 def pop_cnt(n): c = 0 for i in bin(n): if i == '1': c +=...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def pop_cnt(n): return bin(n).count('1') def f(n): cnt = 0 while n != 0: n = n % pop_cnt(n) cnt += 1 return cnt n = int(readline()) x2 = list(readline().decode().rstr...
s599596778
s722384791
p02609
python
Runtime Error
N = int(input()) bin_X = input() int_X = int(bin_X, 2) pop_cnt_1 = 0 for i in bin_X: if i == '1': pop_cnt_1 += 1 pop_cnt_0 = pop_cnt_1 + 1 pop_cnt_1 = pop_cnt_1 - 1 int_X_0 = int_X % pop_cnt_0 int_X_1 = int_X % pop_cnt_1 def pop_cnt(n): c = 0 for i in bin(n): if i == '1': c +=...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def pop_cnt(n): return bin(n).count('1') def f(n): cnt = 0 while n != 0: n = n % pop_cnt(n) cnt += 1 return cnt n = int(readline()) x2 = list(readline().decode().rstr...
s920260795
s722384791
p02609
python
Runtime Error
from collections import Counter N = int(input()) X = input() if X == '1': print(1) exit() elif X == '0': print(0) exit() x1 = 0 for i in X: if i == '1': x1 += 1 for i in range(N): if X[i] == '1': tmp = - (1<<(N-i-1)) tmp2 = -1 else: tmp = (1<<(N-i-1)) ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def pop_cnt(n): return bin(n).count('1') def f(n): cnt = 0 while n != 0: n = n % pop_cnt(n) cnt += 1 return cnt n = int(readline()) x2 = list(readline().decode().rstr...
s804753729
s722384791
p02609
python
Runtime Error
from collections import Counter N = int(input()) X = input() x1 = 0 for i in X: if i == '1': x1 += 1 for i in range(N): if X[i] == '1': tmp = - (1<<(N-i-1)) tmp2 = -1 else: tmp = (1<<(N-i-1)) tmp2 = 1 n = int(X, 2) + tmp n %= x1 + tmp2 cnt = 1 ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def pop_cnt(n): return bin(n).count('1') def f(n): cnt = 0 while n != 0: n = n % pop_cnt(n) cnt += 1 return cnt n = int(readline()) x2 = list(readline().decode().rstr...
s781087649
s722384791
p02609
python
Runtime Error
""" E. """ from functools import reduce from collections import deque def prod(x, y): return x * y % MOD N, K = map(int, input().split()) a_list = list(map(int, input().split())) a_list.sort(reverse=True) # abs_a_list = sorted(a_list, key=abs, reverse=True) MOD = 10**9 + 7 if K%2 == 1: flg = True f...
""" E. """ from functools import reduce from collections import deque def prod(x, y): return x * y % MOD N, K = map(int, input().split()) a_list = list(map(int, input().split())) a_list.sort(reverse=True) # abs_a_list = sorted(a_list, key=abs, reverse=True) MOD = 10**9 + 7 if K%2 == 1: flg = True f...
s114360120
s927022576
p02616
python
Runtime Error
""" E. """ from functools import reduce from collections import deque def prod(x, y): return x * y % MOD N, K = map(int, input().split()) a_list = list(map(int, input().split())) a_list.sort(reverse=True) # abs_a_list = sorted(a_list, key=abs, reverse=True) MOD = 10**9 + 7 if K%2 == 1: flg = True f...
""" E. """ from functools import reduce from collections import deque def prod(x, y): return x * y % MOD N, K = map(int, input().split()) a_list = list(map(int, input().split())) a_list.sort(reverse=True) # abs_a_list = sorted(a_list, key=abs, reverse=True) MOD = 10**9 + 7 if K%2 == 1: flg = True f...
s688310409
s927022576
p02616
python
Runtime Error
""" E. """ from functools import reduce from collections import deque def prod(x, y): return x * y % MOD N, K = map(int, input().split()) a_list = list(map(int, input().split())) a_list.sort(reverse=True) abs_a_list = sorted(a_list, key=abs, reverse=True) MOD = 10**9 + 7 if K%2 == 1: flg = True for...
""" E. """ from functools import reduce from collections import deque def prod(x, y): return x * y % MOD N, K = map(int, input().split()) a_list = list(map(int, input().split())) a_list.sort(reverse=True) # abs_a_list = sorted(a_list, key=abs, reverse=True) MOD = 10**9 + 7 if K%2 == 1: flg = True f...
s522691211
s927022576
p02616
python
Runtime Error
from collections import deque N, K = map(int, input().split()) a_list = list(map(int, input().split())) a_list = deque(sorted(a_list)) MOD = 10**9 + 7 def choose1(): l = 1 if a_list[-1]*a_list[-2] >= a_list[0]*a_list[1]: l *= a_list.popleft() l *= a_list.popleft() else: l *= a_l...
""" E. """ from functools import reduce from collections import deque def prod(x, y): return x * y % MOD N, K = map(int, input().split()) a_list = list(map(int, input().split())) a_list.sort(reverse=True) # abs_a_list = sorted(a_list, key=abs, reverse=True) MOD = 10**9 + 7 if K%2 == 1: flg = True f...
s656086453
s927022576
p02616
python
Runtime Error
N = int(input()) a_list = list(map(int, input().split())) Q = int(input()) r = [0] * (10^5) for a in a_list: r[a-1] += a for i in range(Q): b, c = map(int, input().split()) tmp = r[b-1] // b r[b-1] = 0 r[c-1] += tmp * c print(sum(r))
from collections import Counter N = int(input()) a = Counter(map(int, input().split())) Q = int(input()) sum_a = sum(a.elements()) for i in range(Q): b, c = map(int, input().split()) a[c] += a[b] sum_a += (c-b) * a[b] a[b] = 0 print(sum_a)
s269810279
s496381690
p02630
python
Runtime Error
import numpy as np N = int(input()) a = np.array(list(map(int, input().split()))) Q = int(input()) bc = [list(map(int, input().split())) for _ in range(Q)] for i in range(Q): b, c = bc[i] a[a == b] = c print(np.sum(a))
from collections import Counter N = int(input()) a = Counter(map(int, input().split())) Q = int(input()) sum_a = sum(a.elements()) for i in range(Q): b, c = map(int, input().split()) a[c] += a[b] sum_a += (c-b) * a[b] a[b] = 0 print(sum_a)
s597977855
s496381690
p02630
python
Runtime Error
import numpy as np X, N = list(map(int, input().split())) if N == 0: print(X) exit() p_list = list(map(int, input().split())) num_list = list(set([*range(1,101)]) - set(p_list)) diff = np.abs(np.array(num_list)-X) diff_arg_min = np.argmin(diff) print(num_list[diff_arg_min])
import numpy as np X, N = list(map(int, input().split())) p_list = set(sorted(list(map(int, input().split())))) if N == 0: print(X) exit() i = sorted(list(set(range(X-N, X+1)) - p_list))[-1] j = sorted(list(set(range(X, X+N+1)) - p_list))[0] if X-i <= j-X: print(i) else: print(j)
s704012304
s133195326
p02641
python
Runtime Error
import numpy as np X, N = list(map(int, input().split())) p_list = list(map(int, input().split())) num_list = list(set([*range(1,101)]) - set(p_list)) diff = np.abs(np.array(num_list)-X) diff_arg_min = np.argmin(diff) print(num_list[diff_arg_min])
import numpy as np X, N = list(map(int, input().split())) p_list = set(sorted(list(map(int, input().split())))) if N == 0: print(X) exit() i = sorted(list(set(range(X-N, X+1)) - p_list))[-1] j = sorted(list(set(range(X, X+N+1)) - p_list))[0] if X-i <= j-X: print(i) else: print(j)
s306782513
s133195326
p02641
python
Runtime Error
import numpy as np N = int(input()) a_list = list(map(int, input().split())) num_array = np.zeros(max(a_list), dtype=np.int8) for a in a_list: num_array[a::a] += 1 count = 0 for a in a_list: if num_array[a] == 1: count += 1 print(count)
N = int(input()) a_list = sorted(list(map(int, input().split()))) a_max = a_list[-1] count = [0] * (a_max+1) for a in a_list: for j in range(a, a_max+1, a): count[j] += 1 ans = 0 for a in a_list: if count[a] == 1: ans += 1 print(ans)
s160666796
s817968745
p02642
python
Runtime Error
import numpy as np N = int(input()) x_list = np.array(list(map(int, input().split()))).reshape(1,N) count = np.sum(x_list%x_list.reshape(N,1)==0, axis=0)==1 print(np.sum(count))
N = int(input()) a_list = sorted(list(map(int, input().split()))) a_max = a_list[-1] count = [0] * (a_max+1) for a in a_list: for j in range(a, a_max+1, a): count[j] += 1 ans = 0 for a in a_list: if count[a] == 1: ans += 1 print(ans)
s784220968
s817968745
p02642
python
Runtime Error
import numpy as np N = int(input()) x_list = np.array(list(map(int, input().split()))).reshape(1,N) print(np.sum(np.sum(x_list%x_list.reshape(N,1)==0, axis=0)==1))
N = int(input()) a_list = sorted(list(map(int, input().split()))) a_max = a_list[-1] count = [0] * (a_max+1) for a in a_list: for j in range(a, a_max+1, a): count[j] += 1 ans = 0 for a in a_list: if count[a] == 1: ans += 1 print(ans)
s604617992
s817968745
p02642
python
Runtime Error
import numpy as np N = int(input()) x_list = np.repeat(list(map(int, input().split())), N).reshape(N,N) print(np.sum(np.sum(x_list%x_list[:,0]==0, axis=1)==1))
N = int(input()) a_list = sorted(list(map(int, input().split()))) a_max = a_list[-1] count = [0] * (a_max+1) for a in a_list: for j in range(a, a_max+1, a): count[j] += 1 ans = 0 for a in a_list: if count[a] == 1: ans += 1 print(ans)
s526100284
s817968745
p02642
python
Runtime Error
import numpy as np N = int(input()) x_list = np.repeat(list(map(int, input().split())), N).reshape(N,N) print(np.sum(np.sum(x_list%x_list[:,0]==0, axis=1)==1))
N = int(input()) a_list = sorted(list(map(int, input().split()))) a_max = a_list[-1] count = [0] * (a_max+1) for a in a_list: for j in range(a, a_max+1, a): count[j] += 1 ans = 0 for a in a_list: if count[a] == 1: ans += 1 print(ans)
s709680974
s817968745
p02642
python
Runtime Error
import numpy as np N = int(input()) x_list = np.array(list(map(int, input().split())), reverse=True) count = 0 for xi in x_list: if np.sum(xi%x_list==0) == 1: count += 1 print(count)
N = int(input()) a_list = sorted(list(map(int, input().split()))) a_max = a_list[-1] count = [0] * (a_max+1) for a in a_list: for j in range(a, a_max+1, a): count[j] += 1 ans = 0 for a in a_list: if count[a] == 1: ans += 1 print(ans)
s077530581
s817968745
p02642
python
Runtime Error
import math N = int(input()) num_list = [0] + [0] * int(math.sqrt(N)) # 0~N pn_list = [] for i in range(2, int(math.sqrt(N))+2): if num_list[i] == 0: pn_list.append(i) num_list[i::i] = [1] * len(num_list[i::i]) count = 0 for pn in pn_list: e = 1 while N%(pn**e)==0 and N//(pn**e)>...
N = int(input()) div_counts = [] for i in range(2, int(N**0.5)+1): count = 0 while N%i == 0: count += 1 N //= i if N == 1: break div_counts.append(count) if N != 1: div_counts.append(1) ans = 0 for count in div_counts: for i in range(1, count+1): if count >= i: ans += 1 ...
s773353994
s869589301
p02660
python
Runtime Error
import math N = int(input()) num_list = [0] + [0] * math.sqrt(N) # 0~sqrt(N) pn_list = [] for i in range(2, int(math.sqrt(N))+2): if num_list[i] == 0: pn_list.append(i) num_list[i::i] = [1] * len(num_list[i::i]) count = 0 for pn in pn_list: e = 1 while N%(pn**e)==0 and N>=(pn**e): ...
N = int(input()) div_counts = [] for i in range(2, int(N**0.5)+1): count = 0 while N%i == 0: count += 1 N //= i if N == 1: break div_counts.append(count) if N != 1: div_counts.append(1) ans = 0 for count in div_counts: for i in range(1, count+1): if count >= i: ans += 1 ...
s380128394
s869589301
p02660
python
Runtime Error
import math N = int(input()) num_list = [0] + [0] * N # 0~N pn_list = [] for i in range(2, int(math.sqrt(N))+1): if num_list[i] == 0: pn_list.append(i) num_list[i::i] = [1] * len(num_list[i::i]) count = 0 for pn in pn_list: e = 1 while N%(pn**e)==0 and N//(pn**e)>=1: N //= (pn**e)...
N = int(input()) div_counts = [] for i in range(2, int(N**0.5)+1): count = 0 while N%i == 0: count += 1 N //= i if N == 1: break div_counts.append(count) if N != 1: div_counts.append(1) ans = 0 for count in div_counts: for i in range(1, count+1): if count >= i: ans += 1 ...
s190126256
s869589301
p02660
python
Runtime Error
import math N = int(input()) num_list = [0] + [0] * N # 0~N pn_list = [] for i in range(2, N+1): if num_list[i] == 0: pn_list.append(i) num_list[i::i] = [1] * len(num_list[i::i]) count = 0 for pn in pn_list: e = 1 while N%(pn**e)==0 and N//(pn**e)>=1: N //= (pn**e) e += 1 ...
N = int(input()) div_counts = [] for i in range(2, int(N**0.5)+1): count = 0 while N%i == 0: count += 1 N //= i if N == 1: break div_counts.append(count) if N != 1: div_counts.append(1) ans = 0 for count in div_counts: for i in range(1, count+1): if count >= i: ans += 1 ...
s934012755
s869589301
p02660
python
Runtime Error
N, M = list(map(int, input().split())) paths = [list(map(int, input().split())) for _ in range(M)] result = [] passed_room = [1] depth = 1 while paths and depth<N: tmp_passed = passed_room.copy() for i, path in enumerate(paths): if path[0] in passed_room: if path[1] in passed_room: del pa...
last_num = input()[-1] if last_num in ['2', '4', '5', '7', '9']: print('hon') elif last_num in ['0', '1', '6', '8']: print('pon') elif last_num in ['3']: print('bon')
s408197545
s868659405
p02675
python
Runtime Error
from itertools import combinations_with_replacement def euclidean(num_list: list): a, b = sorted(num_list) while b % a != 0: redi = b % a b = a a = redi return a K = int(input()) k_range = list(range(1, K+1)) result = 0 for comb in combinations_with_replacement(k_range, 3): ...
from itertools import combinations_with_replacement K = int(input()) k_range = list(range(1, K+1)) result = 0 for comb in combinations_with_replacement(k_range, 3): min_abc = min(comb) for i in range(min_abc, 0, -1): if (comb[0]%i == 0 and comb[1]%i == 0) and comb[2]%i == 0: if comb[0]==co...
s956382240
s977189707
p02713
python
Runtime Error
x, y, z = list(map(int, input())) x, y = y, x x, z = z, x print(x, y, z)
x, y, z = list(map(int, input().split())) x, y = y, x x, z = z, x print(x, y, z)
s027900877
s434355485
p02717
python
Runtime Error
n, m = map(int, input().split()) a = list(map(int, input().split())) sum_a = sum(a) a = a.sort() cnt = 0 for i in a: if i >= 1 / (4*sum_a): cnt += 1 if cnt >= M: print('Yes') else: print('No')
n, m = map(int, input().split()) a = list(map(int, input().split())) sum_a = sum(a) a = sorted(a) cnt = 0 for i in a: if i >= sum_a / (4*m): cnt += 1 if cnt >= m: print('Yes') else: print('No')
s919405072
s895575228
p02718
python
Runtime Error
a = [list(map(int, input().split())) for _ in range(3)] n = int(input()) b_list = [int(input()) for _ in range(n)] card = [[0] * 3 for _ in range(3)] for i in range(3): for j in range(3): if a[i][j] == b_list: card[i][j] = 1 for i in range(3): if card[i][:] == [1,1,1] or card[:][i] == [1,1...
a = [list(map(int, input().split())) for _ in range(3)] n = int(input()) b_list = [int(input()) for _ in range(n)] card = [[0] * 3 for _ in range(3)] for i in range(3): for j in range(3): if a[i][j] in b_list: card[i][j] = 1 for i in range(3): if sum(card[i]) == 3 or sum([card[0][i], card[...
s767528708
s041882017
p02760
python
Runtime Error
n, m = map(int, input().split()) sc = [list(map(int, input().split())) for _ in range(m)] for i in range(10**(n-1), 10**n): for j, (s, c) in enumerate(sc, 1): if not str(i)[s-1] == str(c): break if j == m: print(i) exit() print(-1n, m = map(int, input().split()) ...
n, m = map(int, input().split()) sc = [list(map(int, input().split())) for _ in range(m)] if n == 1: num_list = list(range(10)) else: num_list = list(range(10**(n-1), 10**n)) for i in num_list: flg = True for s, c in sc: if str(i)[s-1] != str(c): flg = False bre...
s949770034
s147066205
p02761
python
Runtime Error
n, a, b = map(int, input().split()) MOD = 10**9 + 7 fact = [0] * (n+1) inv_fact = [0] * (n+1) fact[0] = 1 for i in range(1, n+1): fact[i] = fact[i-1] * i % MOD inv_fact[n] = pow(fact[n], MOD-2, MOD) for i in range(n, 0, -1): inv_fact[i-1] = inv_fact[i] * i % MOD def nCk(n, k): return (fact[n] * inv_fac...
n, a, b = map(int, input().split()) MOD = 10**9 + 7 u = [1] d = [1] c = [1] for i in range(1, b+1): u.append(u[-1] * (n-i+1) % MOD) d.append(d[-1] * i % MOD) # c.append(u[-1] // d[-1] % MOD) c.append(u[-1] * pow(d[-1], MOD-2, MOD) % MOD) print((pow(2, n, MOD) - c[a] - c[b] - 1) % MOD)
s179366686
s936162997
p02768
python
Runtime Error
cnt = 0 i = 0 while H > 0: H //= 2 cnt += 2 ** i i += 1 print(cnt)
H = int(input()) cnt = 0 i = 0 while H > 0: H //= 2 cnt += 2 ** i i += 1 print(cnt)
s510073675
s003801555
p02786
python
Runtime Error
N, M = map(int, input().split()) ps = [input().split() for _ in range(M)] correct = [0] * N penalty = [0] * N for p, s in ps: p = int(p) if correct[p-1] == 1: continue if s == 'AC': correct[p-1] = 1 else: penalty[p-1] += 1 print(sum(correct), sum([p*c for p, c in zip(penalty, co...
N, M = map(int, input().split()) ps = [input().split() for _ in range(M)] correct = [0] * N penalty = [0] * N for p, s in ps: p = int(p) if correct[p-1] == 1: continue if s == 'AC': correct[p-1] = 1 else: penalty[p-1] += 1 print(sum(correct), sum([p*c for p, c in zip(penalty, co...
s514009277
s963643872
p02802
python
Runtime Error
N = int(input()) S = input() def z_algo(S): N = len(S) A = [0] * N i = 1 j = 0 l = len(S) A[0] = l while i < l: while i+j < l and S[j] == S[i+j]: j += 1 if not j: i += 1 continue k = 1 while min(l-i, j-A[k]) > k: ...
n = int(input()) s = input() max_len = 0 j = 0 for i in range(n): while j < n and s[i:j] in s[j:]: j += 1 max_len = max(max_len,j-i-1) print(max_len)
s737769029
s740676762
p02913
python
Runtime Error
N = int(input()) v = list(map(int, input().split())) c = list(map(int, input().split())) ans = 0 for _ in range(N): if v[i] > c[i]: ans += v[i] - c[i] print(ans)
N = int(input()) v = list(map(int, input().split())) c = list(map(int, input().split())) ans = 0 for i in range(N): if v[i] > c[i]: ans += v[i] - c[i] print(ans)
s954296970
s570947496
p03060
python
Runtime Error
N, K = map(int, input().split()) h = list(map(int, input().split())) dp = [10**9+5] * N dp[0] = 0 for i in range(1, N): for j in range(1, min(i, K)+1): dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]) print(dp[N-1])
N, K = map(int, input().split()) h = list(map(int, input().split())) dp = [1e10] * N dp[0] = 0 for i in range(N): for j in range(i+1, i+K+1): if j >= N: break dp[j] = min([dp[j], dp[i]+abs(h[j]-h[i])]) print(dp[N-1])
s482562422
s000459121
p03161
python
Runtime Error
from collections import defaultdict N, M = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(M)] g = {i:[] for i in range(1, 110000)} g2 = {i:[] for i in range(1, 110000)} done = [0] * (N+1) memo = [0] * (N+1) for x, y in xy: g[x].append(y) g2[y].append(x) def dp2(v): max_len...
from collections import defaultdict, deque def topological_sort(vertex:list, edge:list): graph = {i: [] for i in vertex} for i, j in edge: graph[i].append(j) inp_cnt = defaultdict(int) outs = defaultdict(list) for inp, out in edge: inp_cnt[out] += 1 outs[inp].append...
s081244044
s146536072
p03166
python
Runtime Error
from collections import defaultdict N, M = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(M)] g = {i:[] for i in range(110000)} g2 = {i:[] for i in range(110000)} done = [0] * (N+1) memo = [0] * (N+1) for x, y in xy: g[x].append(y) g2[y].append(x) def dp_2(v): max_len = 0 ...
from collections import defaultdict, deque def topological_sort(vertex:list, edge:list): graph = {i: [] for i in vertex} for i, j in edge: graph[i].append(j) inp_cnt = defaultdict(int) outs = defaultdict(list) for inp, out in edge: inp_cnt[out] += 1 outs[inp].append...
s042182437
s146536072
p03166
python
Runtime Error
from collections import defaultdict N, M = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(M)] g = defaultdict(list) g2 = defaultdict(list) done = [0] * (N+1) memo = [0] * (N+1) for x, y in xy: g[x].append(y) g2[y].append(x) def dp2(v): max_len = 0 if done[v] == 1: ...
from collections import defaultdict, deque def topological_sort(vertex:list, edge:list): graph = {i: [] for i in vertex} for i, j in edge: graph[i].append(j) inp_cnt = defaultdict(int) outs = defaultdict(list) for inp, out in edge: inp_cnt[out] += 1 outs[inp].append...
s911523809
s146536072
p03166
python
Runtime Error
from collections import defaultdict N, M = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(M)] g = defaultdict(list) g2 = defaultdict(list) done = [0] * (N+1) memo = [0] * (N+1) for x, y in xy: g[x].append(y) g2[y].append(x) def dp_2(v): max_len = 0 if done[v] == 1: ...
from collections import defaultdict, deque def topological_sort(vertex:list, edge:list): graph = {i: [] for i in vertex} for i, j in edge: graph[i].append(j) inp_cnt = defaultdict(int) outs = defaultdict(list) for inp, out in edge: inp_cnt[out] += 1 outs[inp].append...
s313988459
s146536072
p03166
python
Runtime Error
from collections import defaultdict N, M = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(M)] g = defaultdict(list) done = [0] * (N+50) memo = [0] * (N+50) for x, y in xy: g[x].append(y) def dp(v): max_len = 0 if done[v] == 1: return memo[v] else: for t...
from collections import defaultdict, deque def topological_sort(vertex:list, edge:list): graph = {i: [] for i in vertex} for i, j in edge: graph[i].append(j) inp_cnt = defaultdict(int) outs = defaultdict(list) for inp, out in edge: inp_cnt[out] += 1 outs[inp].append...
s930818692
s146536072
p03166
python
Runtime Error
from collections import defaultdict N, M = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(M)] g = defaultdict(list) done = [0] * (N+1) memo = [0] * (N+1) for x, y in xy: g[x].append(y) def dp(v): max_len = 0 if done[v] == 1: return memo[v] else: for to ...
from collections import defaultdict, deque def topological_sort(vertex:list, edge:list): graph = {i: [] for i in vertex} for i, j in edge: graph[i].append(j) inp_cnt = defaultdict(int) outs = defaultdict(list) for inp, out in edge: inp_cnt[out] += 1 outs[inp].append...
s157155538
s146536072
p03166
python
Runtime Error
from collections import defaultdict N, M = map(int, input().split()) xy = [list(map(int, input().split())) for _ in range(M)] g = defaultdict(list) done = [0] * (N+1) memo = [0] * (N+1) for x, y in xy: g[x].append(y) def dp(v): max_len = 0 if done[v] == 1: return memo[v] else: for to...
from collections import defaultdict, deque def topological_sort(vertex:list, edge:list): graph = {i: [] for i in vertex} for i, j in edge: graph[i].append(j) inp_cnt = defaultdict(int) outs = defaultdict(list) for inp, out in edge: inp_cnt[out] += 1 outs[inp].append...
s590293132
s146536072
p03166
python
Runtime Error
N = int(input()) p_list = list(map(float, input().split())) dp = [[0]*(N+1) for _ in range(N+1)] dp[0][0] = 1 for i in range(1, N+1): for j in range(N+1): dp[i][j] += dp[i-1][j] * (1-p_list[i-1]) if j > 0: dp[i][j] += dp[i-1][j-1] * p_list[i-1] start = N//2 + 1 for p in dp[...
N = int(input()) p = list(map(float, input().split())) dp = [[0.] * (N+1) for _ in range(N+1)] dp[0][0] = 1. for i in range(1, N+1): for j in range(i+1): prob = dp[i-1][j-1]*p[i-1] if i > 0: prob += dp[i-1][j]*(1.-p[i-1]) dp[i][j] = max(dp[i][j], prob) print(sum(dp[-1][N//2+1:]...
s401081857
s282282427
p03168
python
Runtime Error
a,b=map(int,input().split()) b=input() if b%a==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)
s294303576
s042377849
p03125
python
Runtime Error
a=input() b=input() if b%a==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)
s010909435
s042377849
p03125
python
Runtime Error
n,m=map(int(input().split())) a=list(map(int,input().split())) print(max(-1,n-sum(a)))
n,m=map(int,input().split()) print(max(-1,n-sum(list(map(int,input().split())))))
s551115619
s916808780
p02706
python
Runtime Error
n,m=map(int(input().split())) print(max(-1,n-sum(list(map(int,input().split())))))
n,m=map(int,input().split()) print(max(-1,n-sum(list(map(int,input().split())))))
s819085694
s916808780
p02706
python
Runtime Error
a,b,m=map(int,input().split()) al=list(map(int,input().split())) bl=list(map(int,input().split())) x=min(al)+min(bl) for i in range(m): x,y,c=map(int,input().split()) t=a[x-1]+b[y-1]-c x=min(x,t) print(x)
a,b,m=map(int,input().split()) al=list(map(int,input().split())) bl=list(map(int,input().split())) z=min(al)+min(bl) for i in range(m): x,y,c=map(int,input().split()) t=al[x-1]+bl[y-1]-c z=min(z,t) print(z)
s890515000
s167230387
p02748
python
Runtime Error
n=int(input()) a=[list(map(int,input().split())) for _ in range(n)] x=input() s=0 for i in range(n): if a[i][0]==x: p=i break for i in range(p+1,n): s+=a[i][1] print(s)
n=int(input()) a=[list(input().split()) for _ in range(n)] x=input() s=0 for i in range(n): if a[i][0]==x: p=i break for i in range(p+1,n): s+=int(a[i][1]) print(s)
s027941075
s250943491
p02806
python
Runtime Error
h,w,k=map(int,input().split()) x=[list(input()) for i in range(h)] a=[[1]*w]+[[0]*w for i in range(h)] n=0 for i in range(1,h+1): f=False if '#' in x[i-1]: n+=1 for j in range(w): if x[i-1][j]=='#': if f: n+=1 else: f=True a[i][j]=n else: for j in range(...
h,w,k=map(int,input().split()) x=[list(input()) for i in range(h)] a=[['*']*w]+[[0]*w for i in range(h)] n=0 for i in range(1,h+1): f=False if '#' in x[i-1]: n+=1 for j in range(w): if x[i-1][j]=='#': if f: n+=1 else: f=True a[i][j]=n else: for j in rang...
s315763263
s546183074
p02855
python
Runtime Error
a,b,x=map(int,input().split()) import math if a*a*b/2==x: c=math.pi/2 elif a*a*b/2>=x: c=math.atan((2*x)/(a*b*b)) else: c=math.atan(a**3/(2*a*a*b-2*x)) d=math.degrees(c) print(90-d)
a,b,x=map(int,input().split()) import math if a*a*b==x: c=math.pi/2 elif a*a*b/2>=x: c=math.atan((2*x)/(a*b*b)) else: c=math.atan(a**3/(2*a*a*b-2*x)) d=math.degrees(c) print(90-d)
s544566559
s915333625
p02882
python
Runtime Error
a,b,x=map(int,input().split()) import math if a*a*b/2>=x: c=math.atan((2*x)/(a*b*b)) else: c=math.atan(a**3/(2*a*a*b-2*x)) d=math.degrees(c) print(90-d)
a,b,x=map(int,input().split()) import math if a*a*b==x: c=math.pi/2 elif a*a*b/2>=x: c=math.atan((2*x)/(a*b*b)) else: c=math.atan(a**3/(2*a*a*b-2*x)) d=math.degrees(c) print(90-d)
s759326267
s915333625
p02882
python
Runtime Error
n=int(input()) h=list(map(int,input().split())) a=[0] i=0 while i<n-1: c=0 while i<n-1: if h[i]>=h[i+1]: c+=1 i+=1 else: a.append(c) i+=1 break a.append(c) print(max(a))
n=int(input()) h=list(map(int,input().split())) a=[0] i=0 c=0 while i<n-1: c=0 while i<n-1: if h[i]>=h[i+1]: c+=1 i+=1 else: a.append(c) i+=1 break a.append(c) print(max(a))
s765594896
s867493127
p02923
python
Runtime Error
n,q=map(int,input().split()) k=[[] for _ in range(n)] for i in range(n-1): a,b=map(int,input().split()) k[a-1].append(b-1) for i in range(q): p,x=map(int,input().split()) s[p-1]+=x from collections import deque d=deque() d.append(0) v=[False]*n v[0]=True while d: g=d.popleft() for i in k[g]: if v[i]: ...
n,q=map(int,input().split()) k=[[] for _ in range(n)] for i in range(n-1): a,b=map(int,input().split()) k[a-1].append(b-1) k[b-1].append(a-1) s=[0]*n for i in range(q): p,x=map(int,input().split()) s[p-1]+=x from collections import deque d=deque() d.append(0) v=[False]*n v[0]=True while d: g=d.popleft() f...
s844092716
s198934052
p02936
python
Runtime Error
k,x=map(int,input().split()) for i in range(x-k+1,x+K): print(i)
k,x=map(int,input().split()) for i in range(x-k+1,x+k): print(i)
s502548308
s647696659
p02946
python
Runtime Error
n=int(input()) d={} for i in range(n): a=sorted(input()) if a in d.keys(): d[a]+=1 else: d[a]=1 l=list(d.values()) c=0 for i in l: c+=(i*(i-1))//2 print(c)
from collections import Counter as co n=int(input()) a=[str(sorted(input())) for _ in range(n)] d=co(a) l=d.values() c=0 for i in l: c+=(i*(i-1))//2 print(c)
s922453894
s138122000
p02947
python
Runtime Error
n,d=map(int,input().split()) x=[list(map(int,input().split())) for _ in range(n)] p=0 def c(i,j): global x s=0 for k in range(d): s+=(x[i][d]-x[j][d])**2 if s**(1/2).is_integer()==True: return 1 else: return 0 for i in range(n): for j in range(i+1,n): p+=c(i,j) print(p)
n,d=map(int,input().split()) x=[list(map(int,input().split())) for _ in range(n)] p=0 def c(i,j): global x s=0 for k in range(d): s+=(x[i][k]-x[j][k])**2 if (s**(1/2)).is_integer()==True: return 1 else: return 0 for i in range(n): for j in range(i+1,n): p+=c(i,j) print(p)
s720580257
s491990679
p02982
python
Runtime Error
n=int(input()) l=[list(map(int,input().split())) for _ in range(n)] d=[] for i in range(n): for j in range(n): if i!=j: d.append((l[i][0]-l[j][0],l[i][1]-l[j][1])) from collections import Counter as c print(n-c(d).most_common()[0][1])
n=int(input()) if n==1: print(1) exit() l=[list(map(int,input().split())) for _ in range(n)] d=[] for i in range(n): for j in range(n): if i!=j: d.append((l[i][0]-l[j][0],l[i][1]-l[j][1])) from collections import Counter as c print(n-c(d).most_common()[0][1])
s316013881
s568850960
p03006
python
Runtime Error
import math as m n,k=map(int,input().split()) p=0 for i in range(1,k): r=m.ceil(m.log(k/i,2)) p+=1/(2**r) for _ in range(K,n+1): p+=1 print(p/n)
import math as m n,k=map(int,input().split()) p=0 for i in range(1,min(n+1,k)): r=m.ceil(m.log(k/i,2)) p+=1/(2**r) for _ in range(k,n+1): p+=1 print(p/n)
s172905931
s760830610
p03043
python
Runtime Error
import math as m n,k=map(int,input().split()) p=0 for i in range(1,k): r=m.ceil(m.log(k/i,2)) p+=1/(2**r) for _ in range(K,N+1): p+=1 print(p/n)
import math as m n,k=map(int,input().split()) p=0 for i in range(1,min(n+1,k)): r=m.ceil(m.log(k/i,2)) p+=1/(2**r) for _ in range(k,n+1): p+=1 print(p/n)
s391841744
s760830610
p03043
python
Runtime Error
import fractions n=int(input()) v=list(map(int,input().split())) def g(a,b): if a==0:return b if b==0:return a return fractions.gcd(a,b) l=[0]*(n+1) r=[0]*(n+1) for i in range(1,n+1): l[i]=g(l[i-1],v[i-1]) for i in range(n)[::-1]: r[i]=g(r[i+1],v[i]) x=0 for i in range(n): c=g(l[i],r[i+1]) x=max(c,x) prin...
import fractions n=int(input()) v=list(map(int,input().split())) def g(a,b): if a==0:return b if b==0:return a return fractions.gcd(a,b) l=[0]*(n+1) r=[0]*(n+1) for i in range(1,n+1): l[i]=g(l[i-1],v[i-1]) for i in range(n)[::-1]: r[i]=g(r[i+1],v[i]) x=0 for i in range(n): c=g(l[i],r[i+1]) x=max(c,x) prin...
s396915757
s022249825
p03061
python
Runtime Error
n=int(input()) a=list(map(int,input().split())) b=[] for _ in range(n): if a[_]<0: b.append(a.pop(_)*(-1)) if 0 in a or len(b)%2==0: print(sum(a)+sum(b)) else: b.sort() print(sum(a)+sum(b)-(b[0]*2))
n=int(input()) a=list(map(int,input().split())) c=0 for i in range(n): if a[i]<0: c+=1 a[i]=a[i]*-1 if c%2==0 or 0 in a: print(sum(a)) else: a.sort() print(sum(a[1:])-a[0])
s036217758
s270620317
p03062
python
Runtime Error
n=int(input()) a=list(map(int,input().split())) b=[] for _ in range(n): if a[_]<0: b.append(a.pop(_)*(-1)) if 0 in a or len(b)%2==0: print(sum(a)+sum(b)) else: b.sort() print(sum(a)+sum(b[1:])-b[0])
n=int(input()) a=list(map(int,input().split())) c=0 for i in range(n): if a[i]<0: c+=1 a[i]=a[i]*-1 if c%2==0 or 0 in a: print(sum(a)) else: a.sort() print(sum(a[1:])-a[0])
s726312696
s270620317
p03062
python
Runtime Error
x=[int(input()) for _ in range(5)] y=[x[_]%10 for _ in range(5)] y.sort() s=0 for _ in range(5): if y[_]!=0: a=y[_] s=-1 break for _ in range(5): s=s-(-x[_] // 10) print((s)*10+a)
x=[int(input()) for _ in range(5)] y=[x[_]%10 for _ in range(5)] y.sort() s=0 a=0 for _ in range(5): if y[_]!=0: a=y[_] s=-1 break for _ in range(5): s=s-(-x[_] // 10) print((s)*10+a)
s902801275
s732261783
p03076
python
Runtime Error
x,y,z,k=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) d=[] for i in range(x): for j in range(y): d.append(a[i]+b[j]) d.sort() d=d[x*y-k:] e=[] for i in range(z): for j in range(k): e.append(c[i]+d[j]) e.sort() e=e[z*k-k:] for i in...
x,y,z,k=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) if [2,2,2,8]==[x,y,z,k]: e=[8,10,12,13,14,15,17,19] else: d=[] for i in range(x): for j in range(y): d.append(a[i]+b[j]) d.sort() d=d[x*y-k:] e=[] for i in range(z)...
s737995820
s808221565
p03078
python
Runtime Error
x,y,z,k=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) d=[] for i in range(x): for j in range(y): d.append(a[i]+b[j]) d.sort() d=d[x*y-k:] e=[] for i in range(z): for j in range(k): e.append(c[i]+d[j]) e.sort() for i in range(k)[::...
x,y,z,k=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) if [2,2,2,8]==[x,y,z,k]: e=[8,10,12,13,14,15,17,19] else: d=[] for i in range(x): for j in range(y): d.append(a[i]+b[j]) d.sort() d=d[x*y-k:] e=[] for i in range(z)...
s715967266
s808221565
p03078
python
Runtime Error
x,y,z,k=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) d=[] for i in range(x): for j in range(y): d.append(a[i]+b[j]) d.sort() d=d[x*y-k:] e=[] for i in range(z): for j in range(k): e.append(c[z]+d[j]) e.sort() for i in range(k)[::...
x,y,z,k=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) if [2,2,2,8]==[x,y,z,k]: e=[8,10,12,13,14,15,17,19] else: d=[] for i in range(x): for j in range(y): d.append(a[i]+b[j]) d.sort() d=d[x*y-k:] e=[] for i in range(z)...
s917789365
s808221565
p03078
python
Runtime Error
s=input() x=['A','T','C','G'] a=[0]*len(s) a[0]=1 if s[0] in x for i in range(1,len(s)): if s[i] in x: a[i]=a[i-1]+1 print(max(a))
s=input() x=['A','T','C','G'] a=[0]*len(s) if s[0] in x: a[0]=1 for i in range(1,len(s)): if s[i] in x: a[i]=a[i-1]+1 print(max(a))
s067703259
s276685031
p03086
python
Runtime Error
n=int(input()) b=list(map(int,input().split())) l=len(b) a=[] f=0 for _ in range(n): for i in range(l-1,-1,-1): if b[i]==i+1: a.append(b.pop(i)) break if i==0: f=1 if f==0: for i in range(l-1,-1,-1): print(a[i]) else: print(-1)
n=int(input()) b=list(map(int,input().split())) a=[] f=0 for _ in range(n): for i in range(len(b)-1,-1,-1): if b[i]==i+1: a.append(b.pop(i)) break if i==0: f=1 if f==0: for i in range(n-1,-1,-1): print(a[i]) else: print(-1)
s308910069
s088556284
p03089
python
Runtime Error
n=int(input()) a,b,c=input().split() ab=0;bc=0;ca=0 for i in range(n): if a[i]!=b[i]: ab+=1 if b[i]!=c[i]: bc+=1 if c[i]!=a[i]: ca+=1 print(min(ab,bc,ca))
n=int(input()) a=input();b=input();c=input() x=0 for i in range(n): x+=len(list(set([a[i],b[i],c[i]])))-1 print(x)
s921128928
s146882882
p03140
python
Runtime Error
n=int(input()) a,b,c=input().split() ab,bc,ca=0,0,0 for i in range(n): if a[i]!=b[i]: ab+=1 if b[i]!=c[i]: bc+=1 if c[i]!=a[i]: ca+=1 print(min(ab,bc,ca))
n=int(input()) a=input();b=input();c=input() x=0 for i in range(n): x+=len(list(set([a[i],b[i],c[i]])))-1 print(x)
s744360745
s146882882
p03140
python
Runtime Error
print('Christmas'+' Eve'*(25-int(input)))
print('Christmas'+' Eve'*(25-int(input())))
s631390411
s541454244
p03206
python
Runtime Error
n=int(input()) t,a=map(int,input().split()) h=list(map(int,input().split())) for i in range(n): h[i]=t-h[i]*0.006 d=abs(a-h[0]) c=1 for i in range(1,n): if d>abs(a-h[i]): c=i+1 d=abs(a-h[i]) print(c)
x,y=map(int,input().split()) print(x+int(y/2))
s383004116
s318750269
p03219
python
Runtime Error
n=int(input()) l=[list(map(int,input().split())) for _ in range(n)] a=[] for x in range(101): for y in range(101): c=[] for t in l: if t[2]: c.append(t[2]+abs(x-t[0])+abs(y-t[1])) f=0 if len(set(c))==1: f=1 h=c[0] for t in l: if l[2]==0: if h-abs(x-t[0...
n=int(input()) l=[list(map(int,input().split())) for _ in range(n)] a=[] for x in range(101): for y in range(101): c=[] for t in l: if t[2]: c.append(t[2]+abs(x-t[0])+abs(y-t[1])) f=0 if len(set(c))==1: f=1 h=c[0] for t in l: if t[2]==0: if h-abs(x-t[0...
s292629706
s204646938
p03240
python
Runtime Error
n=int(input()) l=[list(map(int,input().split())) for _ in range(n)] a=[] for x in range(101): for y in range(101): c=[] for t in l: if l[2]: c.append(t[2]+abs(x-t[0])+abs(y-t[1])) f=0 if len(set(c))==1: f=1 h=c[0] for t in l: if l[2]==0: if h-abs(x-t[0...
n=int(input()) l=[list(map(int,input().split())) for _ in range(n)] a=[] for x in range(101): for y in range(101): c=[] for t in l: if t[2]: c.append(t[2]+abs(x-t[0])+abs(y-t[1])) f=0 if len(set(c))==1: f=1 h=c[0] for t in l: if t[2]==0: if h-abs(x-t[0...
s947424573
s204646938
p03240
python
Runtime Error
n=int(input()) a=list(map(int,input().split())) o=[] e=[] for i in range(n): if i%2==0: o.append(a[i]) else: e.append(a[i]) from collections import Counter as co o=co(o) e=co(e) o['x']=0 e['x']=0 ov=o.values()+[0] ev=e.values()+[0] mo=max(ov) me=max(ev) if n==2: if a[0]==a[1]: print(1) else: pri...
n=int(input()) a=list(map(int,input().split())) o=[] e=[] for i in range(n): if i%2==0: o.append(a[i]) else: e.append(a[i]) from collections import Counter as co o=co(o) e=co(e) o['x']=0 e['x']=0 ov=o.values() ev=e.values() mo=max(ov) me=max(ev) if n==2: if a[0]==a[1]: print(1) else: print(0) el...
s744215483
s149962165
p03244
python
Runtime Error
n=int(input()) a=list(map(int,input().split())) o=[] e=[] for i in range(n): if i%2==0: o.append(a[i]) else: e.append(a[i]) from collections import Counter as co o=co(o) e=co(e) ov=o.values()+[0] ev=e.values()+[0] mo=max(ov) me=max(ev) if n==2: if a[0]==a[1]: print(1) else: print(0) else: if m...
n=int(input()) a=list(map(int,input().split())) o=[] e=[] for i in range(n): if i%2==0: o.append(a[i]) else: e.append(a[i]) from collections import Counter as co o=co(o) e=co(e) o['x']=0 e['x']=0 ov=o.values() ev=e.values() mo=max(ov) me=max(ev) if n==2: if a[0]==a[1]: print(1) else: print(0) el...
s880526241
s149962165
p03244
python
Runtime Error
n=int(input()) a=list(map(int,input().split())) o=[] e=[] for i in range(n): if i%2==0: o.append(a[i]) else: e.append(a[i]) from collections import Counter as co o=co(o) e=co(e) ov=o.values() ev=e.values() mo=max(ov) me=max(ev) if n==2: if a[0]==a[1]: print(1) else: print(0) else: if max(o,key...
n=int(input()) a=list(map(int,input().split())) o=[] e=[] for i in range(n): if i%2==0: o.append(a[i]) else: e.append(a[i]) from collections import Counter as co o=co(o) e=co(e) o['x']=0 e['x']=0 ov=o.values() ev=e.values() mo=max(ov) me=max(ev) if n==2: if a[0]==a[1]: print(1) else: print(0) el...
s238709227
s149962165
p03244
python
Runtime Error
n=int(input()) a=list(map(int,input().split())) o=[] e=[] for i in range(n): if i%2==0: o.append(a[i]) else: e.append(a[i]) from collections import Counter as co o=co(o) e=co(e) ov=o.values() ev=e.values() mo=max(ov) me=max(ev) if max(o,key=o.get)==max(e,key=e.get): if mo>me: me=sorted(ev)[n//2-2] e...
n=int(input()) a=list(map(int,input().split())) o=[] e=[] for i in range(n): if i%2==0: o.append(a[i]) else: e.append(a[i]) from collections import Counter as co o=co(o) e=co(e) o['x']=0 e['x']=0 ov=o.values() ev=e.values() mo=max(ov) me=max(ev) if n==2: if a[0]==a[1]: print(1) else: print(0) el...
s749599055
s149962165
p03244
python
Runtime Error
n,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) s=a[0] i=0 while s<=x and i<n: i+=1 s+=a[i] print(i)
n,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) for i in range(n): x=x-a[i] if x<0: break if i==n-1 and x==0: i+=1 print(i)
s880134145
s825922455
p03254
python
Runtime Error
n,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) s=a[0] i=0 while s<=x: i+=1 s+=a[i] print(i)
n,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) for i in range(n): x=x-a[i] if x<0: break if i==n-1 and x==0: i+=1 print(i)
s934251258
s825922455
p03254
python
Runtime Error
n,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) s=a[0] i=0 while s<x: i+=1 s+=a[i] print(i)
n,x=map(int,input().split()) a=sorted(list(map(int,input().split()))) for i in range(n): x=x-a[i] if x<0: break if i==n-1 and x==0: i+=1 print(i)
s271262404
s825922455
p03254
python
Runtime Error
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
9