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
OK = "O" BRO = "B" MOD = 1000000007 N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) dp=[0 for i in range(N+1)] dp[0]=1 for i in range(N): for j in range(i+1,min(i+2+1,N+1)): if K[j]==OK: dp[j]+=dp[i] dp[j]%=MOD ...
OK = 0 BRO = 1 MOD = 1000000007 N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] #K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) K = list(0 for i in range(N+1)) for i in range(M): K[Broken[i]] = 1 dp=[0 for i in range(N+1)] dp[0]=1 for i in range(N): for j in range(i+1,mi...
s663165024
s783968940
p03013
python
Time Limit Exceeded
OK = "O" BRO = "B" MOD = 1000000007 N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) dp=[0 for i in range(N+1)] dp[0]=1 for i in range(N): for j in range(i+1,min(i+2+1,N+1)): if K[j]==OK: dp[j]+=dp[i] dp[j]%=MOD ...
OK = 0 BRO = 1 MOD = 1000000007 N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] #K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) K = list(0 for i in range(N+1)) for i in range(M): K[Broken[i]] = 1 dp=[0 for i in range(N+1)] dp[0]=1 for i in range(N): for j in range(i+1,mi...
s957446462
s783968940
p03013
python
Time Limit Exceeded
OK = "O" BRO = "B" N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) if BRO+BRO in K: print(0) else: c=[0 for i in range(N+1)] if K[N-1]==OK: c[1]=1 if K[N-2]==OK and K[N-1]==OK: c[2]=2 if K[N-2]==OK and K[...
OK = 0 BRO = 1 MOD = 1000000007 N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] #K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) K = list(0 for i in range(N+1)) for i in range(M): K[Broken[i]] = 1 dp=[0 for i in range(N+1)] dp[0]=1 for i in range(N): for j in range(i+1,mi...
s718675147
s783968940
p03013
python
Runtime Error
OK = "O" BRO = "B" N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) if BRO+BRO in K: print(0) else: c=[0 for i in range(N+1)] if K[N-1]==OK: c[1]=1 if K[N-2]==OK and K[N-1]==OK: c[2]=2 if K[N-2]==OK and K[...
OK = 0 BRO = 1 MOD = 1000000007 N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] #K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) K = list(0 for i in range(N+1)) for i in range(M): K[Broken[i]] = 1 dp=[0 for i in range(N+1)] dp[0]=1 for i in range(N): for j in range(i+1,mi...
s788909287
s783968940
p03013
python
Runtime Error
OK = "O" BRO = "B" N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] #K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) K = "" for i in range(N+1): if i in Broken: K += BRO else: K += OK if BRO+BRO in K: print(0) else: c=[0 for i in range(N+1)] ...
OK = 0 BRO = 1 MOD = 1000000007 N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] #K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) K = list(0 for i in range(N+1)) for i in range(M): K[Broken[i]] = 1 dp=[0 for i in range(N+1)] dp[0]=1 for i in range(N): for j in range(i+1,mi...
s403678317
s783968940
p03013
python
Runtime Error
OK = "O" BRO = "B" N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) if BRO+BRO in K: print(0) else: c=[0 for i in range(N+1)] if K[N-1]==OK: c[1]=1 if K[N-2]==OK and K[N-1]==OK: c[2]=2 if K[N-2]==OK and K[N-1]==BR...
OK = 0 BRO = 1 MOD = 1000000007 N,M=map(int, input().split()) Broken=[int(input()) for i in range(M)] #K = "".join(list(BRO if i in Broken else OK for i in range(N+1))) K = list(0 for i in range(N+1)) for i in range(M): K[Broken[i]] = 1 dp=[0 for i in range(N+1)] dp[0]=1 for i in range(N): for j in range(i+1,mi...
s768989030
s783968940
p03013
python
Runtime Error
K,S=map(int,input().split()) count=0 for i in range(K+1): for j in range(K+1): for k in range(K+1): if i+j+k==S: count+=1 print(count)
K,S=map(int,input().split()) count=0 for i in range(K+1): for j in range(K+1): k = S-i-j if 0 <= k <= K: count+=1 print(count)
s436557103
s918969334
p03835
python
Time Limit Exceeded
K,S=map(int,input().split()) count=0 for i in range(K+1): for j in range(K+1): for k in range(K+1): if i+j+k==S: count+=1 print(count)
K,S=map(int,input().split()) count=0 for i in range(K+1): for j in range(K+1): k = S-i-j if 0 <= k <= K: count+=1 print(count)
s098401904
s918969334
p03835
python
Time Limit Exceeded
n,w=map(int,input().split()) goods=[list(map(int,input().split())) for _ in range(n)] DP=[[0]*(w+1) for _ in range(n+1)] for i in list(range(n))[::-1]: wi,vi=goods[i][0],goods[i][1] for j in range(w+1): if j<wi: DP[i][j]=DP[i+1][j] else: DP[i][j]=max(DP[i+1][j],DP[i+1][j-wi]+vi) print(DP[0][w])
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s515188047
s040884535
p03163
python
Time Limit Exceeded
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s561881985
s040884535
p03163
python
Time Limit Exceeded
import sys import numpy as np sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[-1] * 100010 for _ in range(110)] def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == n: return 0 if j < a[i][0]: res = rec(i+1, j...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s002753914
s040884535
p03163
python
Time Limit Exceeded
import sys import numpy as np sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = np.full((110, 100010), -1) def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == n: return 0 if j < a[i][0]: res = rec(i+1, j) else:...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s463783620
s040884535
p03163
python
Time Limit Exceeded
import sys import numpy as np n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = np.full((n+1, w+1), -1) def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == n: res = 0 elif j == 0: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: ...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s165908174
s040884535
p03163
python
Runtime Error
import sys import numpy as np sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = np.full((n+1, w+1), -1) def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == n: res = 0 elif j == 0: res = 0 elif j < a[i][0]: ...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s370873048
s040884535
p03163
python
Runtime Error
import sys import numpy as np sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = np.full((n+1, w+1), -1) def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == n: res = 0 elif j == 0: res = 0 elif j < a[i][0]: ...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s541990231
s040884535
p03163
python
Time Limit Exceeded
import sys import numpy as np sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = np.full((n+1, w+1), -1) def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == n: res = 0 dp[i][j] = res return dp[i][j] elif j < a...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s718819487
s040884535
p03163
python
Time Limit Exceeded
import sys import numpy as np sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = np.full((n+1, w+1), -1) def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: ...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s473174449
s040884535
p03163
python
Time Limit Exceeded
import sys import numpy as np sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = np.full((n+1, w+1), -1) def rec(i, j): if dp[i][j] != -1: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: ...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s801384663
s040884535
p03163
python
Time Limit Exceeded
import sys import numpy as np sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = np.zeros((n+1, w+1)) def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: r...
import sys sys.setrecursionlimit(200000) n,w = (int(x) for x in input().split()) a = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0] * (w+1) for _ in range(n+1)] def rec(i, j): if dp[i][j] != 0: return dp[i][j] if i == n: res = 0 elif j < a[i][0]: res = rec(i+1, j) else: res = m...
s790505346
s040884535
p03163
python
Time Limit Exceeded
def findB(tmp): count = 0 for i in tmp: if i == "b": count += 1 return count n, a, b = list(map(int, input().split())) if a != 0: tmp = "b" * a + "r" * b all_str = tmp while True: if len(all_str) >= n: break all_str = all_str + tmp print(find...
n, a, b = list(map(int, input().split())) if a != 0: c1 = n // (a + b) c2 = n - ((a + b) * c1) print(a * c1 + (c2 if c2 < a else a)) else: print("0")
s317323908
s658201165
p02754
python
Runtime Error
import numpy as np from scipy.sparse.csgraph import shortest_path N, M, K = tuple(map(int, input().split())) friends = [list(map(int, input().split())) for _ in range(M)] blocks = [list(map(int, input().split())) for _ in range(K)] friend_matrix = np.zeros((N, N)) for friend in friends: friend_matrix[friend[0]-1, fr...
N = int(input()) if N % 2 == 1: n = N + 1 else: n = N print(int(n / 2))
s578950231
s503743471
p02759
python
Runtime Error
N = input() if N % 2 == 1: n = N + 1 else: n = N print(int(n / 2))
N = int(input()) if N % 2 == 1: n = N + 1 else: n = N print(int(n / 2))
s183937091
s503743471
p02759
python
Runtime Error
N = input() if N % 2 == 1: n = N + 1 else: n = N print(n / 2)
N = int(input()) if N % 2 == 1: n = N + 1 else: n = N print(int(n / 2))
s132451162
s503743471
p02759
python
Runtime Error
N = int(input()) a = [] for x in range(N): i = x + 1 a.append(list(input().split()).extend([i])) print(a) sorted(a, key=lambda x:(x[0],x[1]), reverse=True) for review in a: print(review[2])
N = int(input()) a = [] for x in range(N): i = x + 1 S_i, P_i = input().split() a.append([S_i, int(P_i), i]) # print(a) a = sorted(a, key=lambda x:(x[0],-x[1])) for review in a: print(review[2])
s380991869
s028511078
p03030
python
Runtime Error
N, M = map(int, input().split()) LRs = None for i in range(M): l, r = map(int, input().split()) if(LRs is None): LRs = set(range(l, r+1)) else: LRs = LRs.intersection(set(range(l, r+1))) print(str(len(LRs)))
N, M = map(int, input().split()) l_max = 0 r_min = 10**5+1 for i in range(M): l, r = map(int, input().split()) l_max = max(l, l_max) r_min = min(r, r_min) if(l_max <= r_min): print(str(r_min - l_max + 1)) else: print("0")
s941250985
s428751964
p03037
python
Time Limit Exceeded
a,b = map(int,input()split()) print(a/b)
a,b = map(int,input().split()) print(a/b)
s229755415
s951496404
p03135
python
Runtime Error
N,M = map(int, input().split()) appear_list = [[]for i in range(N)] flag = 0 for i in range(M): s,c = map(int, input().split()) appear_list[s-1].append(str(c)) ans = "" for i in range(len(appear_list)): if len(set(appear_list[i])) > 1: flag = 1 break elif len(set(appear_list[i])) == 1: if appear_l...
N,M = map(int, input().split()) appear_list = [[]for i in range(N)] flag = 0 ans = "" for i in range(M): s,c = map(int, input().split()) if len(appear_list[s-1]) == 0: appear_list[s-1].append(str(c)) if len(appear_list[s-1]) ==1 and appear_list[s-1][0] != str(c): flag = 1 break for i in range(len(ap...
s428604093
s996251039
p02761
python
Runtime Error
N,M = map(int, input().split()) appear_list = [[]for i in range(N)] flag = 0 for i in range(M): s,c = map(int, input().split()) appear_list[s-1].append(str(c)) ans = "" for i in range(len(appear_list)): if len(set(appear_list[i])) > 1: flag = 1 break elif len(set(appear_list[i])) == 1: if appear_l...
N,M = map(int, input().split()) appear_list = [[]for i in range(N)] flag = 0 ans = "" for i in range(M): s,c = map(int, input().split()) if len(appear_list[s-1]) == 0: appear_list[s-1].append(str(c)) if len(appear_list[s-1]) ==1 and appear_list[s-1][0] != str(c): flag = 1 break for i in range(len(ap...
s927426122
s996251039
p02761
python
Runtime Error
N = int(input()) L = list(map(int,input().split())) ans = 0 for i in range(N-2): for j in range(i+1,N): ans += sum([1 for k in L[j+1:] if abs(L[j]-L[i]) < k < L[j]+L[i]]) print(ans)
N = int(input()) L = list(map(int,input().split())) L.sort(reverse = True) ans = 0 def binary(L): left = -1 right = len(L) t = (left+right)//2 while right-left != 1: if L[t] > max_len - next_len: left = t else: right = t t = (left + right) // 2 return left + 1 for i in range(N-2...
s806828433
s110040494
p02888
python
Time Limit Exceeded
import numpy as np N = int(input()) L = list(map(int,input().split())) ans = 0 for i in range(N-2): candidate = L[i+1:] candidate_array = np.array(candidate) ans += sum([np.count_nonzero((candidate_array[k+1:]<L[i]+l)&(candidate_array[k+1:]>abs(l-L[i]))) for k,l in enumerate(candidate)]) print(ans)
N = int(input()) L = list(map(int,input().split())) L.sort(reverse = True) ans = 0 def binary(L): left = -1 right = len(L) t = (left+right)//2 while right-left != 1: if L[t] > max_len - next_len: left = t else: right = t t = (left + right) // 2 return left + 1 for i in range(N-2...
s631106842
s110040494
p02888
python
Time Limit Exceeded
N = int(input()) S = input() sride = 1 count = 0 max_num = 0 for i in range(N-1): for j in range(N-sride): if S[j] == S[j+sride]: count += 1 max_num = max(max_num, count) else: count = 0 if count == sride: max_num = max(max_nuzm, count) break sride += 1 count = 0 print(ma...
N = int(input()) S = input() sride = 1 count = 0 max_num = 0 for i in range(N-1): for j in range(N-sride): if S[j] == S[j+sride]: count += 1 max_num = max(max_num, count) else: count = 0 if count == sride: max_num = max(max_num, count) break sride += 1 count = 0 print(max...
s379194138
s087767310
p02913
python
Runtime Error
N = int(input()) S = input() sride = 1 count = 0 max_num = 0 for i in range(N-1): for j in range(N-sride): if S[j] == S[j+sride]: count += 1 max_num = max(max_num, count) else: count = 0 if count == sride: max_num = max(max_num, count) break sride += 1 count = 0 print(max...
N = int(input()) S = input() sride = 1 count = 0 max_num = 0 for i in range(N-1): for j in range(N-sride): if S[j] == S[j+sride]: count += 1 max_num = max(max_num, count) else: count = 0 if count == sride: max_num = max(max_num, count) break sride += 1 count = 0 print(max...
s650348409
s087767310
p02913
python
Time Limit Exceeded
N = int(input()) S = input() max_range = N//2 count_list = [[0 for j in range 50005] for i in range 5005] print(count_list.shape) print(count_list)
N = int(input()) S = input() sride = 1 count = 0 max_num = 0 for i in range(N-1): for j in range(N-sride): if S[j] == S[j+sride]: count += 1 max_num = max(max_num, count) else: count = 0 if count == sride: max_num = max(max_num, count) break sride += 1 count = 0 print(max...
s229783910
s087767310
p02913
python
Runtime Error
N = int(input()) B = list(map(int,input().split())) ins = 0 count = 0 for i in range(N): if i == 0: count += B[i] if i > 0 and B[i-1] > B[i]: count += B[i] elif i > 0 and B[i-1] <= B[i]: count += B[i-1] print(count)
N = int(input()) B = list(map(int,input().split())) ins = 0 count = 0 for i in range(N-1): if i == 0: count += B[i] if i > 0 and B[i-1] > B[i]: count += B[i] elif i > 0 and B[i-1] <= B[i]: count += B[i-1] count += B[i] print(count)
s864761299
s778657755
p02917
python
Runtime Error
import math N = int(input()) s = [''.join(sorted(input())) for i in range(N)] def count_s(s): count = [] while s != []: moji = s.pop(0) num = s.count(moji) if num > 0: for i in range(num): s.pop(s.index(moji)) count.append(num+1) return count count = count_s(s) ans = 0 if len(count...
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s356008547
s989759737
p02947
python
Runtime Error
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 for i in range(n-1): ans += str_list[i+1:].count(str_list[i]) print(ans)
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s019421523
s989759737
p02947
python
Time Limit Exceeded
from collections import Counter import sys input = sys.stdin.readline n = int(input()) counter_list = [Counter(input().rstrip()) for i in range(n)] ans = 0 for i in range(n-1): if counter_list[i] in counter_list[i+1:]: ans +=counter_list[i+1:].count(counter_list[i]) print(ans)
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s066109890
s989759737
p02947
python
Time Limit Exceeded
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [input() for i in range(n)] counter_list = [Counter[i] for i in str_list] ans = 0 for i in range(n): first = Counter(str_list[i]) for j in range(n-i-1): second = Counter(str_list[j+i+1]) if first == second: ...
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s685472276
s989759737
p02947
python
Runtime Error
from collections import Counter n = int(input()) str_list = [input() for i in range(n)] ans = 0 for i in range(n): first = Counter(str_list[i]) for j in range(n-i-1): second = Counter(str_list[j+i+1]) if first == second: ans +=1 print(ans)
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s729013821
s989759737
p02947
python
Time Limit Exceeded
from collections import Counter n = int(input()) str_list = [input() for i in range(n)] ans = 0 for i in range(n): first = Counter(str_list[i]) for j in range(n-i-1): second = Counter(str_list[j+i+1]) if first == second: ans +=1 print(ans)
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s038092158
s989759737
p02947
python
Time Limit Exceeded
from collections import Counter n = int(input()) str_list = [input() for i in range(n)] ans = 0 for i in range(n): for j in range(n-i-1): if Counter(str_list[i])==Counter(str_list[j+i+1]): ans +=1 print(ans)
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s496726741
s989759737
p02947
python
Time Limit Exceeded
from collections import Counter n = int(input()) str_list = [input() for i in range(n)] ans = 0 for i in range(n): for j in range(n-i-1): if Counter(str_list[i])==Counter(str_list[j+i+1]): ans +=1 print(ans)
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s321150732
s989759737
p02947
python
Time Limit Exceeded
n = int(input()) str_list = [input() for i in range(n)] ans = 0 from collections import Counter def verify_anagrams(first_word, second_word): if Counter(first_word) == Counter(second_word): return 1 else: return 0 for i in range(n): for j in range(n-i-1): ans += verify_anagrams(str_list[i], str_list[j...
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s889150794
s989759737
p02947
python
Time Limit Exceeded
n = int(input()) str_list = [input() for i in range(n)] ans = 0 from collections import Counter def verify_anagrams(first_word, second_word): def get_counter(s): return Counter(s.upper().replace(' ', '')) if get_counter(first_word) == get_counter(second_word): return 1 else: return 0 for...
from collections import Counter import sys input = sys.stdin.readline n = int(input()) str_list = [''.join(sorted(input().rstrip())) for i in range(n)] ans = 0 count_list = list(Counter(str_list).values()) for i in count_list: sum = 0 for j in range(int(i)): sum += j ans +=sum print(ans)
s213783502
s989759737
p02947
python
Time Limit Exceeded
N, M = map(int,input().split()) reward = [0]*N for i in range(N): A,B = map(int,input().split()) reward[i] = [A,B] ans = 0 remain_day = 1 for i in range(M): max = 0 reward_max = [j for j in reward if j[0] <= remain_day] reward_max = sorted(reward_max,key=lambda x:(x[1]),reverse = True) if len(reward_max) > ...
import heapq N, M = map(int,input().split()) reward = [[] for _ in range(M)] for i in range(N): A,B = map(int,input().split()) if A <= M: reward[A-1].append(B) q = [] ans = 0 for day in range(M): for r in reward[day]: heapq.heappush(q,-r) if len(q) >0: ans += -heapq.heappop(q) print(ans) ...
s906895839
s824694895
p02948
python
Time Limit Exceeded
#D問題 import math def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) def permutations_count(n, r): return math.factorial(n) // math.factorial(n - r) N, K = map(int, input().split()) red = N - K for i in range(K): if i+1 ==1: ans = (red+1) pr...
#D問題 import math def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) def permutations_count(n, r): return math.factorial(n) // math.factorial(n - r) N, K = map(int, input().split()) red = N - K for i in range(1,K+1): if N-K+1 < i: print(0) ...
s392684304
s706553287
p02990
python
Runtime Error
#D問題 import math def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) def permutations_count(n, r): return math.factorial(n) // math.factorial(n - r) N, K = map(int, input().split()) red = N - K for i in range(K): if i+1 ==1: ans = (red+1) pr...
#D問題 import math def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) def permutations_count(n, r): return math.factorial(n) // math.factorial(n - r) N, K = map(int, input().split()) red = N - K for i in range(1,K+1): if N-K+1 < i: print(0) ...
s212744965
s706553287
p02990
python
Runtime Error
#D問題 N, M=map(int, input().split()) V = input().split() V_i = [int(i) for i in V] ans = 0 for i in range(M): for j in range(M-i): if i+j >N: break; num = 0 dump_num = [] for k in range(i): num += V_i[k] dump_num.append(V_i[k]) for k in ran...
#D問題 N, M=map(int, input().split()) V = input().split() V_i = [int(i) for i in V] ans = 0 for i in range(M+1): for j in range(M+1-i): if i+j >N: break; num = 0 dump_num = [] for k in range(i): num += V_i[k] dump_num.append(V_i[k]) for k in...
s470992730
s471808987
p03032
python
Runtime Error
#D問題 N, M=map(int, input().split()) V = input().split() V_i = [int(i) for i in V] ans = 0 for i in range(M): for j in range(M-i): if i+j >M: break; num = 0 dump_num = [] for k in range(i): num += V_i[k] dump_num.append(V_i[k]) for k in ran...
#D問題 N, M=map(int, input().split()) V = input().split() V_i = [int(i) for i in V] ans = 0 for i in range(M+1): for j in range(M+1-i): if i+j >N: break; num = 0 dump_num = [] for k in range(i): num += V_i[k] dump_num.append(V_i[k]) for k in...
s333816944
s471808987
p03032
python
Runtime Error
#C問題 N, M = map(int, input().split()) N_list = [] for i in range (N): N_list.append(i+1) L_list = [] R_list = [] for i in range(M): L, R = map(int, input().split()) L_list.append(L) R_list.append(R) N_list= [i for i in N_list if i >= max(L_list) and i<=min(R_list)] print(len(N_list))
#C問題 import numpy as np N, M = map(int, input().split()) L_list = [] R_list = [] for i in range(M): L, R = map(int, input().split()) L_list.append(L) R_list.append(R) if min(R_list) - max(L_list) < 0: print(0) else: print(min(R_list) - max(L_list)+1)
s467980189
s082783081
p03037
python
Time Limit Exceeded
#C問題 N, M = map(int, input().split()) N_list = [] for i in range (N): N_list.append(i+1) for i in range(M): L, R = map(int, input().split()) N_list= [i for i in N_list if i >= L and i<=R] print(len(N_list))
#C問題 import numpy as np N, M = map(int, input().split()) L_list = [] R_list = [] for i in range(M): L, R = map(int, input().split()) L_list.append(L) R_list.append(R) if min(R_list) - max(L_list) < 0: print(0) else: print(min(R_list) - max(L_list)+1)
s591581593
s082783081
p03037
python
Time Limit Exceeded
#D問題 N, M = map(int, input().split()) A = list(map(int, input().split())) for i in range(M): B, C = map(int, input().split()) A.extend([C]*B) A.sort(reverse = True) print(sum(A[:N]))
import heapq as hq N, M = map(int, input().split()) A = list(map(int,input().split())) A = [(-i,1) for i in A] hq.heapify(A) for i in range(M): B, C = map(int, input().split()) hq.heappush(A,(-C,B)) sum_A = 0 for i in range(N): add_num = hq.heappop(A) sum_A += add_num[0]*-1 if add_num[1] > 1: ...
s836595722
s097141534
p03038
python
Time Limit Exceeded
#D問題 N, M = map(int, input().split()) A = list(map(int, input().split())) for i in range(M): B, C = map(int, input().split()) A.extend([C]*B) A.sort() print(sum(A[:n]))
import heapq as hq N, M = map(int, input().split()) A = list(map(int,input().split())) A = [(-i,1) for i in A] hq.heapify(A) for i in range(M): B, C = map(int, input().split()) hq.heappush(A,(-C,B)) sum_A = 0 for i in range(N): add_num = hq.heappop(A) sum_A += add_num[0]*-1 if add_num[1] > 1: ...
s206910015
s097141534
p03038
python
Runtime Error
#D問題 N, M = map(int, input().split()) A = list(map(int, input().split())) for i in range(M): B, C = map(int, input().split()) if min(A) < C: for j in range(B): A.remove(min(A)) A.append(C) if min(A) >= C: break print(sum(A))
import heapq as hq N, M = map(int, input().split()) A = list(map(int,input().split())) A = [(-i,1) for i in A] hq.heapify(A) for i in range(M): B, C = map(int, input().split()) hq.heappush(A,(-C,B)) sum_A = 0 for i in range(N): add_num = hq.heappop(A) sum_A += add_num[0]*-1 if add_num[1] > 1: ...
s732988381
s097141534
p03038
python
Time Limit Exceeded
#D問題 N, M = map(int, input().split()) A = list(map(int, input().split())) for i in range(M): B, C = map(int, input().split()) for j in range(B): if min(A) < C: A.remove(min(A)) A.append(C) print(sum(A))
import heapq as hq N, M = map(int, input().split()) A = list(map(int,input().split())) A = [(-i,1) for i in A] hq.heapify(A) for i in range(M): B, C = map(int, input().split()) hq.heappush(A,(-C,B)) sum_A = 0 for i in range(N): add_num = hq.heappop(A) sum_A += add_num[0]*-1 if add_num[1] > 1: ...
s127045150
s097141534
p03038
python
Time Limit Exceeded
N = input() answer_list = [] answer = 0 for i in range(len(N)): if N[i] == "A" or N[i] == "T" or N[i] == "C" or N[i] == "G": answer += 1 else: answer_list.append(answer) answer = 0 print(max(answer_list))
N = input() answer_list = [] answer = 0 for i in range(len(N)): if N[i] == "A" or N[i] == "T" or N[i] == "C" or N[i] == "G": answer += 1 else: answer_list.append(answer) answer = 0 if i+1 == len(N): answer_list.append(answer) print(max(answer_list))
s256624693
s123739394
p03086
python
Runtime Error
N, Q = map(int, input().split()) S =input() for i in range(Q): l, r = map(int, input().split()) print(S[l-1:r].count('AC'))
N, Q = map(int, input().split()) S =input() AC_list = [0]*N count = 0 for i in range(1,N): if (S[i-1] + S[i]) == "AC": count +=1 AC_list[i] = count for i in range(Q): l, r = map(int, input().split()) print(AC_list[r-1] - AC_list[l-1])
s313547572
s404463408
p03087
python
Time Limit Exceeded
N, Q = map(int, input().split()) S =input() for i in range(Q): l, r = map(int, input().split()) print(S[l-1:r].count('AC'))
N, Q = map(int, input().split()) S =input() AC_list = [0]*N count = 0 for i in range(1,N): if (S[i-1] + S[i]) == "AC": count +=1 AC_list[i] = count for i in range(Q): l, r = map(int, input().split()) print(AC_list[r-1] - AC_list[l-1])
s184579304
s404463408
p03087
python
Time Limit Exceeded
N,K = map(int,input().split()) tree_list = [int(input()) for _ in range(N)] tree_list = sorted(tree_list) ans = 10**9 for i in range(N-K+1): compare = tree_list[i+2]-tree_list[i] if ans > compare: ans = compare print(ans)
N,K = map(int,input().split()) tree_list = [int(input()) for _ in range(N)] tree_list = sorted(tree_list) ans = 10**9 for i in range(N-K+1): compare = tree_list[i+K-1]-tree_list[i] if ans > compare: ans = compare print(ans)
s062627237
s972905552
p03208
python
Runtime Error
N,K = map(int,input().split()) tree_list = [] for i in range(N): tree_list.append(int(input())) tree_list = sorted(tree_list) ans = 10**9 for i in range(N-K+1): compare = tree_list[i+2]-tree_list[i] if ans > compare: ans = compare if ans == 0: break print(ans)
N,K = map(int,input().split()) tree_list = [int(input()) for _ in range(N)] tree_list = sorted(tree_list) ans = 10**9 for i in range(N-K+1): compare = tree_list[i+K-1]-tree_list[i] if ans > compare: ans = compare print(ans)
s162795743
s972905552
p03208
python
Runtime Error
N,K = map(int,input().split()) tree_list = [] for i in range(N): tree_list.append(int(input())) tree_list = sorted(tree_list) ans = 10**9 for i in range(N-K+1): compare = tree_list[i+2]-tree_list[i] if ans > compare: ans = compare print(ans)
N,K = map(int,input().split()) tree_list = [int(input()) for _ in range(N)] tree_list = sorted(tree_list) ans = 10**9 for i in range(N-K+1): compare = tree_list[i+K-1]-tree_list[i] if ans > compare: ans = compare print(ans)
s885516590
s972905552
p03208
python
Runtime Error
N, M = map(int, input().split()) length = [list(map(int,input().split()).append(i)) for _ in range(M)] print(length)
N, M = map(int, input().split()) length = [list(map(int,input().split())) for _ in range(M)] for i in range(M): length[i].insert(2,i) length = sorted(length) ans_list =[0]*M count = 1 for i in range(M): if i == 0: ans = str(length[i][0]).zfill(6) + str(count).zfill(6) ans_list[i] = [length[i][2],ans] el...
s668634580
s501387558
p03221
python
Runtime Error
H, W = map(int,input().split()) map = [input() for i in range(H)] def drow(i,j, map = map): if j > 0 and map[i][j-1] == "#": return "Yes" if j < W-1 and map[i][j+1] == "#": return "Yes" if i > 0 and map[i-1][j] == "#": return "Yes" if i < H -1 and map[i+1][j] == "#": return "Yes" return "No" ...
H, W = map(int,input().split()) map = [input() for i in range(H)] def drow(i,j, map = map): if j > 0 and map[i][j-1] == "#": return "Yes" if j < W-1 and map[i][j+1] == "#": return "Yes" if i > 0 and map[i-1][j] == "#": return "Yes" if i < H -1 and map[i+1][j] == "#": return "Yes" return "No" ...
s113049001
s370080534
p03361
python
Runtime Error
H, W = map(int,input().split()) map = [input() for i in range(H)] def drow(i,j, map = map): if j > 0 and map[i][j-1] == ".": return "No" if j < W-1 and map[i][j+1] == ".": return "No" if i > 0 and map[i-1][j] == ".": return "No" if i < H -1 and map[i+1][j] == ".": return "No" return "Yes" fo...
H, W = map(int,input().split()) map = [input() for i in range(H)] def drow(i,j, map = map): if j > 0 and map[i][j-1] == "#": return "Yes" if j < W-1 and map[i][j+1] == "#": return "Yes" if i > 0 and map[i-1][j] == "#": return "Yes" if i < H -1 and map[i+1][j] == "#": return "Yes" return "No" ...
s098576783
s370080534
p03361
python
Runtime Error
H, W = map(int,input().split()) map = [input() for i in range(H)] def drow(i,j, map = map): if j > 0 and map[i][j-1] == "#": return "Yes" if j < W-1 and map[i][j+1] == "#": return "Yes" if i > 0 and map[i-1][j] == "#": return "Yes" if i < H -1 and map[i+1][j] == "#": return "Yes" return "No" ...
H, W = map(int,input().split()) map = [input() for i in range(H)] def drow(i,j, map = map): if j > 0 and map[i][j-1] == "#": return "Yes" if j < W-1 and map[i][j+1] == "#": return "Yes" if i > 0 and map[i-1][j] == "#": return "Yes" if i < H -1 and map[i+1][j] == "#": return "Yes" return "No" ...
s582996016
s370080534
p03361
python
Runtime Error
H, W = map(int,input().split()) map = [input() for i in range(H)] def drow(i,j, map = map): if j > 0 and map[i][j-1] == "#": return "YES" if j < W-1 and map[i][j+1] == "#": return "YES" if i > 0 and map[i-1][j] == "#": return "YES" if i < H -1 and map[i+1][j] == "#": return "YES" return "NO" ...
H, W = map(int,input().split()) map = [input() for i in range(H)] def drow(i,j, map = map): if j > 0 and map[i][j-1] == "#": return "Yes" if j < W-1 and map[i][j+1] == "#": return "Yes" if i > 0 and map[i-1][j] == "#": return "Yes" if i < H -1 and map[i+1][j] == "#": return "Yes" return "No" ...
s537689055
s370080534
p03361
python
Runtime Error
N = int(input()) button_list =[] for i in range(1,N+1): button_list.append([i,int(input())]) bond_list = [button_list[0][0]] dest = 0 for i in range(N): bond_list.append(button_list[button_list[dest][1]-1][0]) bond_list.append(button_list[button_list[dest][1]-1][1]) dest = button_list[button_list[dest][1]-1][1]...
N = int(input()) button_list =[] for i in range(1,N+1): button_list.append(int(input())) count = 0 dest = 1 for i in range(N): dest = button_list[dest - 1] count +=1 if dest == 2: break; if count == N: print(-1) else: print(count)
s870398943
s812396386
p03680
python
Time Limit Exceeded
S =input() ans_list = [] for i in range(2**(len(S)-1)): comb = bin(i)[2:].zfill(len(S)-1) num_list = [] num = S[0] for i in range(len(comb)): if comb[i] == "1": num_list.append(int(num)) num = S[i+1] else: num += S[i+1] num_list.append(int(num)) ...
S =input() ans_list = [] if len(S) == 1: print(int(S)) else: for i in range(2**(len(S)-1)): comb = bin(i)[2:].zfill(len(S)-1) num_list = [] num = S[0] for i in range(len(comb)): if comb[i] == "1": num_list.append(int(num)) num = S[i+1] ...
s053402547
s963367568
p03999
python
Runtime Error
max = int(input()) orgList = list(map(int, input().split())) result = 0; for i in range(max): assertNo = orgList[i] sliceList = orgList[0:i+1] sliceList.sort() if sliceList[0] >= assertNo: result+= 1 print(result)
max = int(input()) orgList = list(map(int, input().split())) min = 999999999999 result = 0; for i in range(max): assertNo = orgList[i] if min > orgList[i]-1: min = orgList[i] if min >= assertNo: result+= 1 print(result)
s828618208
s813063297
p02791
python
Time Limit Exceeded
def left(text, n): return text[:n] def right(text, n): return text[-n:] def mid(text, n, m): return text[n-1:n+m-1] n = int(input()) rangeSet = [[0]*10 for i in range(10)] # [1,9][9,1]など先頭+最終の組み合わせを設定 for i in range(1,n+1): first = int(left(str(i),1)) end = int(right(str(i),1)) rangeSet[first][end] += 1...
def left(text, n): return text[:n] def right(text, n): return text[-n:] def mid(text, n, m): return text[n-1:n+m-1] n = int(input()) rangeSet = [[0]*10 for i in range(10)] # [1,9][9,1]など先頭+最終の組み合わせを設定 for i in range(1,n+1): first = int(left(str(i),1)) end = int(right(str(i),1)) rangeSet[first][end] += 1...
s049080478
s418906714
p02792
python
Runtime Error
print(chr(ord(input()) + 1))
print(chr(ord(input()) + 1))
s301749744
s929027414
p02801
python
Runtime Error
mondai, kaitou = map(int, input().split()) # 問題ごとの clearNo = [] # 問題ごとのWrong wrong = {} cleard = 0 pena = 0 # 解答数分繰り返す kaitous = [input().split() for _ in range(kaitou)] for i in kaitous: if i[0] in clearNo: continue else: if i[1] == 'WA': if i[0] in wrong: wrong[i[0...
mondai, kaitou = map(int, input().split()) # 問題ごとのクリア管理 clearNo = [0] * (mondai+1) # 問題ごとのWrong wrong = [0] * (mondai+1) cleard = 0 pena = 0 # 解答数分繰り返す kaitous = [input().split() for _ in range(kaitou)] for i in kaitous: qNo = int(i[0]) result = i[1] if clearNo[qNo] == 1: continue else: ...
s987918536
s244604042
p02802
python
Time Limit Exceeded
mondai, kaitou = map(int, input().split()) # 問題ごとの clearNo = [] # 問題ごとのWrong wrong = {} cleard = 0 pena = 0 # 解答数分繰り返す for i in range(kaitou): qNo, kaitou = input().split() qNo = qNo if qNo in clearNo: continue else: if kaitou == 'WA': if qNo in wrong: wrong[...
mondai, kaitou = map(int, input().split()) # 問題ごとのクリア管理 clearNo = [0] * (mondai+1) # 問題ごとのWrong wrong = [0] * (mondai+1) cleard = 0 pena = 0 # 解答数分繰り返す kaitous = [input().split() for _ in range(kaitou)] for i in kaitous: qNo = int(i[0]) result = i[1] if clearNo[qNo] == 1: continue else: ...
s207400456
s244604042
p02802
python
Time Limit Exceeded
n = int(input()) sum = 0 for i in range(n): v,t = input().split() v = int(v) if t = 'BTC': sum+=v*38000 else: sum+=v print(sum)
n = int(input()) sum = 0 for i in range(n): v,t = input().split() v = float(v) if t == 'BTC': sum+=v*380000 else: sum+=v print(sum)
s832810202
s004373828
p03110
python
Runtime Error
def retMax(a,b): if a>=b: return a else: return b n = int(input()) r = [] dpList = [ [0] * 3 for x in range(n)] for i in range(n): r.append(list(map(int,input().split()))) dpList[0][0] = r[0][0] dpList[0][1] = r[0][1] dpList[0][2] = r[0][2] for s in range(1,n): #b->a,c->aの最大値 dpList[s][0] = ...
def retMax(a,b): if a>=b: return a else: return b n = int(input()) r = [] dpList = [ [0] * 3 for x in range(n)] for i in range(n): r.append(list(map(int,input().split()))) dpList[0][0] = r[0][0] dpList[0][1] = r[0][1] dpList[0][2] = r[0][2] for s in range(1,n): #b->a,c->aの最大値 dpList[s][0] = ...
s759809779
s349815222
p03162
python
Runtime Error
import sys n = int(input()) for i in range(n): c =input() if c=='Y': print('Four') sys.exit() else: print('Three')
import sys n = int(input()) cl = input().split() for c in cl: if c=='Y': print('Four') sys.exit() else: print('Three')
s131722487
s165260529
p03424
python
Runtime Error
n = int(input()) cardList = [int(input()) for i in range(n)] cardList = cardList.sort(reverse=True) alice = 0 bob = 0 turn = True for c in cardList: if turn: alice+= c turn = False else: bob +=c turn =True print(alice-bob)
n = int(input()) cardList = map(int,input().split()) cl = list(cardList) cl.sort(reverse=True) alice = 0 bob = 0 turn = True for c in cl: if turn: alice+= c turn = False else: bob +=c turn =True print(alice-bob)
s627423944
s510102648
p03434
python
Runtime Error
n = int(input()) k = int(input()) b = list(map(int, input().split())) sum = 0 for ball in b: sum += ball - 0 if (ball - 0) < k - ball else k - ball print(sum*2)
a = int(input()) b=int(input()) print(a*a - b)
s831062508
s686866865
p03597
python
Runtime Error
a = int(input()) b=int(input()) return a*a - b
a = int(input()) b=int(input()) print(a*a - b)
s741106438
s686866865
p03597
python
Runtime Error
a,b = map(int,input().split) print (a -b if a-b <0 else 0)
a,b = map(int,input().split()) print (a -b if a-b >0 else 0)
s343092888
s050683940
p03609
python
Runtime Error
import sys from io import StringIO import unittest import math def resolve(): s,c= map(int,input().split()) if s>=c/2: print(str(math.floor(c/2))) else: zanc = c - (s * 2) print(str(s + math.floor(zanc/4))) resolve()
n = int(input()) print(n*800-(n//15*200))
s489245843
s244352854
p03795
python
Runtime Error
def resolve(): s,c= map(int,input().split()) if s>=c/2: print(str(math.floor(c/2))) else: zanc = c - (s * 2) print(str(s + math.floor(zanc/4))) resolve()
import sys from io import StringIO import unittest import math def resolve(): s,c= map(int,input().split()) if s>=c/2: print(str(math.floor(c/2))) else: zanc = c - (s * 2) print(str(s + math.floor(zanc/4))) resolve()
s120830974
s309366031
p03797
python
Runtime Error
s = input() if s == 'a' or s == 'i' s == 'u' s == 'e' s == 'o' : print('vowel') else: print('consonant')
s = input() if s == 'a' or s == 'i' or s == 'u' or s == 'e' or s == 'o' : print('vowel') else: print('consonant')
s063998382
s394201995
p03852
python
Runtime Error
a,b,c = map(input().split()) if a == b+c or b == a+c or c == a+b : print("Yes") else: print("No")
a,b,c = map(int,input().split()) if a == b+c or b == a+c or c == a+b : print("Yes") else: print("No")
s179813106
s553381245
p03943
python
Runtime Error
a,b,c = map(input().split()) if a = b+c or b = a+c or c = a+b : print("Yes") else: print("No")
a,b,c = map(int,input().split()) if a == b+c or b == a+c or c == a+b : print("Yes") else: print("No")
s245452069
s553381245
p03943
python
Runtime Error
#!/usr/bin/env python3 import sys def main(): S=input() Q=int(input()) query=[] for i in range(Q): li = input().split(' ') query.append(li) f=True for i in range(Q): if(query[i][0]=='1'): f=not f continue else: F=query[i][1] ...
#!/usr/bin/env python3 import sys from collections import deque def main(): S=input() Q=int(input()) query=[list(input().split()) for _ in range(Q)] d=deque(S) c=0 for q in query: if q[0]=="1": c+=1 elif q[0]=="2": if (c%2==0 and q[1]=="1") or (c%2==...
s171474974
s010738337
p02756
python
Time Limit Exceeded
#!/usr/bin/env python3 import sys def solve(N: int, M: int, s: "List[int]", c: "List[int]"): for i in range(pow(10,N-1)-1,pow(10,N)): f=True for j in range(M): if not(str(i)[s[j]-1]==str(c[j])):f=False if(not f):break if(f): print(i) return ...
#!/usr/bin/env python3 import sys def solve(N: int, M: int, s: "List[int]", c: "List[int]"): if(pow(10,N-1)==1):x=0 else:x=pow(10,N-1) for i in range(x,pow(10,N)): f=True for j in range(M): if not(str(i)[s[j]-1]==str(c[j])):f=False if(not f):break if(f):...
s479958308
s561794104
p02761
python
Runtime Error
n,r=int(input()) ans=0 if n<10: ans=r+r*(10-n) else: ans=r ptinr(ans)
n,r=map(int,input().split()) ans=0 if n<10: ans=r+100*(10-n) else: ans=r print(ans)
s778540896
s758484993
p02765
python
Runtime Error
N,K=map(int,input().split()) P=[int(input()) for _ in range(N)] pp=[0]*N for i in range(N): pp[i]=(p[i]+1)/2 sum=0 for i in range(0,K): sum+=pp[i] for i in range(0,N-K): sum=max(sum,sum-pp[i]+pp[i+K]) print(sum)
from itertools import accumulate N,K=map(int,input().split()) p = list(map(int,input().split())) pp=[0]*N for i in range(N): pp[i]=(p[i]+1)/2 sum=0 temp=0 for i in range(0,K): temp+=pp[i] sum=temp for i in range(0,N-K): temp=temp-pp[i]+pp[i+K] sum=max(sum,temp) print(sum)
s768581376
s998543095
p02780
python
Runtime Error
A,B,C,D=int(input().split()) x=min(C,D)-max(A,B) if x>0: print(x) else: print("0")
A,B,C,D=map(int,input().split()) x=min(B,D)-max(A,C) if x>0: print(x) else: print("0")
s282513947
s573681868
p03632
python
Runtime Error
N,M=[int(i) for i in input().split()] a=[] b=[] c=[] for i in range(M): x,y=[int(i) for i in input().split()] if x==1 : c.append(y) if y==N: c.append(x) if len(c)==len(set(c)): print("IMPOSSIBLE") else: print("POSSIBLE")
N=input() print("ABC"+N)
s360372225
s626399698
p03643
python
Runtime Error
N,M=[int(i) for i in input().split()] a=[] b=[] c=[] flag=False for i in range(M): x,y=map(int,input().split()) a.append(x) b.append(y) if x==1: c.append(y) for i in range(M): if b[i]==N: flag=a[i] in c if flag==False: print("IMPOSSIBLE") else: print("POSSIBLE")
N=input() print("ABC"+N)
s482386043
s626399698
p03643
python
Runtime Error
N,M=[int(i) for i in input().split()] a=[] b=[] c=[] flag=False for i in range(M): x,y=map(int,input().split()) a.append(x) b.append(y) if x==1: c.append(y) for i in range(M): if b[i]==N: flag=a[i] in c if flag==False: print("IMPOSSIBLE") else: print("POSSIBLE")
N,M=[int(i) for i in input().split()] a=[] b=[] c=[] for i in range(M): x,y=[int(i) for i in input().split()] if x==1 : c.append(y) if y==N: c.append(x) if len(c)==len(set(c)): print("IMPOSSIBLE") else: print("POSSIBLE")
s531876232
s572361230
p03645
python
Time Limit Exceeded
N,M=[int(i) for i in input().split()] a=[] b=[] c=[] flag=0 for i in range(M): x,y=map(int,input().split()) a.append(x) b.append(y) if x==1: c.append(y) for i in range(M): if b[i]==N: if a[i] in c: flag=1 if flag==0: print("IMPOSSIBLE") else: print("POSSIBLE")
N,M=[int(i) for i in input().split()] a=[] b=[] c=[] for i in range(M): x,y=[int(i) for i in input().split()] if x==1 : c.append(y) if y==N: c.append(x) if len(c)==len(set(c)): print("IMPOSSIBLE") else: print("POSSIBLE")
s949616293
s572361230
p03645
python
Time Limit Exceeded
N,M=map(int,input().split()) a=[],b=[],c=[] flag=0 for i in range(M): x,y=map(int,input().split()) x.append(a) y.append(b) if x==1: c.append(y) for i in range(M): if b[i]==N: if a[i] in c: flag+=1 if flag==0: print("IMPOSSIBLE") else: print("POSSIBLE")
N,M=[int(i) for i in input().split()] a=[] b=[] c=[] for i in range(M): x,y=[int(i) for i in input().split()] if x==1 : c.append(y) if y==N: c.append(x) if len(c)==len(set(c)): print("IMPOSSIBLE") else: print("POSSIBLE")
s887138540
s572361230
p03645
python
Runtime Error
N,M=map(int,input().split()) a=[] b=[] c=[] flag=0 for i in range(M): x,y=map(int,input().split()) a.append(x) b.append(y) if x==1: c.append(y) for i in range(M): if b[i]==N: if a[i] in c: flag+=1 if flag==0: print("IMPOSSIBLE") else: print("POSSIBLE")
N,M=[int(i) for i in input().split()] a=[] b=[] c=[] for i in range(M): x,y=[int(i) for i in input().split()] if x==1 : c.append(y) if y==N: c.append(x) if len(c)==len(set(c)): print("IMPOSSIBLE") else: print("POSSIBLE")
s273196415
s572361230
p03645
python
Time Limit Exceeded
import sys input = sys.stdin.readline S=input()[:-1] Q=int(input()) r = False for _ in range(Q): qs = input()[:-1].split(' ') if len(qs) == 1: r = not r else: if (qs[1] == '1' and (not r)) or (qs[1] == '2' and r): S = qs[2] + S else: S = S + qs[2] if r: print(S[::-1]) else: print(S)
import sys from collections import deque input = sys.stdin.readline S=deque(input()[:-1]) Q=int(input()) r = False for _ in range(Q): qs = input()[:-1].split(' ') if len(qs) == 1: r = not r else: if (qs[1] == '1' and (not r)) or (qs[1] == '2' and r): S.appendleft(qs[2]) else: S.append(qs[2...
s003572121
s344231363
p02756
python
Time Limit Exceeded
S=input() Q=int(input()) r = False for _ in range(Q): qs = input().split(' ') if len(qs) == 1: r = not r else: if (qs[1] == '1' and (not r)) or (qs[1] == '2' and r): S = qs[2] + S else: S = S + qs[2] if r: print(S[::-1]) else: print(S)
import sys from collections import deque input = sys.stdin.readline S=deque(input()[:-1]) Q=int(input()) r = False for _ in range(Q): qs = input()[:-1].split(' ') if len(qs) == 1: r = not r else: if (qs[1] == '1' and (not r)) or (qs[1] == '2' and r): S.appendleft(qs[2]) else: S.append(qs[2...
s108843541
s344231363
p02756
python
Time Limit Exceeded
S=input() Q=int(input()) for _ in range(Q): qs = input().split(' ') if len(qs) == 1: S = S[::-1] else: if qs[1] == '1': S = qs[2] + S else: S = S + qs[2] print(S)
import sys from collections import deque input = sys.stdin.readline S=deque(input()[:-1]) Q=int(input()) r = False for _ in range(Q): qs = input()[:-1].split(' ') if len(qs) == 1: r = not r else: if (qs[1] == '1' and (not r)) or (qs[1] == '2' and r): S.appendleft(qs[2]) else: S.append(qs[2...
s152650494
s344231363
p02756
python
Time Limit Exceeded
n, m = [int(i) for i in input().split()] sc = [list(map(int, input().split())) for _ in range(m)] ans = -1 for i in range(10**(n-1), 10**n): for s, c in sc: if str(i)[s-1] != str(c): break else: ans = i break if n == 1: if m == 0 or set(sc) == {[1, 0]}: ans = 0 ...
n, m = [int(i) for i in input().split()] sc = [list(map(int, input().split())) for _ in range(m)] ans = -1 for i in range(10**(n-1) if n > 1 else 0, 10**n): for s, c in sc: if str(i)[s-1] != str(c): break else: ans = i break print(ans)
s078355796
s182311253
p02761
python
Runtime Error