Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03000 (python)

Fixed submission:
N, X = [int(x) for x in input().split()]
LN = [int(x) for x in input().split()]
p = 0
c = 1
while True:
  if p + LN[c-1] <= X:
    p += LN[c-1]
    c += 1
    if c > len(LN):
      break
  else:
    break
print(c)

Buggy submission (verdict: Runtime Error):
N, X = [int(x) for x in input().split()]
LN = [int(x) for x in input().split()]
p = 0
c = 1
while True:
  if p + LN[c-1] <= X:
    p += LN[c-1]
    c += 1
  else:
    break
print(c)
Problem p03006 (python)

Fixed submission:
def main():
    import sys
    from collections import defaultdict
    input = sys.stdin.readline
    N = int(input())
    if N == 1:
        print(1)
        exit()
    XY = [0] * N
    for i, (x, y) in enumerate([[int(x) for x in input().strip().split()] for _ in range(N)]):
        XY[i] = (x, y)
    XY.sort(key=lambda x:(x[0], x[1]))

    dic = defaultdict(int)
    for d in range(1, N):
        for i in range(N-d):
            dic[(XY[i+d][0]-XY[i][0], XY[i+d][1]-XY[i][1])] += 1
            dic[(XY[i][0]-XY[i+d][0], XY[i][1]-XY[i+d][1])] += 1

    print(N-max(dic.values()))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    from collections import defaultdict
    input = sys.stdin.readline
    N = int(input())
    XY = sorted([tuple([int(x) for x in input().strip().split()]) for _ in range(N)], key=lambda x: x[0])
    dic = defaultdict(int)
    for d in range(1, N):
        for i in range(N-d):
            if XY[i+d][1] > XY[i][1]:
                dic[(XY[i+d][0]-XY[i][0], XY[i+d][1]-XY[i][1])] += 1

    print(N-max(dic.values()))

if __name__ == '__main__':
    main()
Problem p03032 (python)

Fixed submission:
def main():
    import sys
    import heapq
    from copy import deepcopy
    from collections import deque
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    N, K = [int(x) for x in input().strip().split()]
    V = [int(x) for x in input().strip().split()]
    ans = -float('inf')
    for l in range(min(N, K)+1):
        for r in range(min(N, K)-l+1):
            vt = sorted(V[:l] + V[N-r:])
            c = 0
            i = 0
            for i in range(len(vt)):
                if c == (K-l-r):
                    break
                if vt[i] < 0:
                    vt[i] = 0
                    c += 1
                else:
                    break
            ans = max(ans, sum(vt))

    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    import heapq
    from copy import deepcopy
    from collections import deque
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    _N, K = [int(x) for x in input().strip().split()]
    V = deque([int(x) for x in input().strip().split()])
    max_ans = sum([v for v in V if v > 0])

    def dfs(ans, q, V, k):
        # print(k, q, V)
        ans = max(ans, sum(q))
        if ans == max_ans:
            print(ans)
            eixt()
        if k == K:
            return ans
        if q:
            t = heapq.heappop(q)
            V.appendleft(t)
            ans = max(ans, dfs(ans, q[:], V, k+1))
            V.popleft()
            V.append(t)
            ans = max(ans, dfs(ans, q, V, k+1))
            V.pop()
            heapq.heappush(q, t)
        if V:
            q_l = q[:]
            q_r = q[:]
            t = V.popleft()
            heapq.heappush(q_l, t)
            ans = max(ans, dfs(ans, q_l[:], V, k+1))
            V.appendleft(t)
            t = V.pop()
            heapq.heappush(q_r, t)
            ans = max(ans, dfs(ans, q_r[:], V, k+1))
            V.append(t)
            
        return ans
    print(dfs(-float('inf'), [], V, 0))

if __name__ == '__main__':
    main()
Problem p03044 (python)

Fixed submission:
import sys
from collections import deque
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
N = int(input())
L = [deque([]) for _ in range(N)]
ans = [-1] * N

for n in range(N-1):
    u, v, w = [int(x) for x in input().strip().split()]
    L[u-1].append((v, w))
    L[v-1].append((u, w))

def dfs(x, w):
    if ans[x-1] >= 0:
        return
    ans[x-1] = w % 2
    for nx, w_ in L[x-1]:
        dfs(nx, (w + w_) % 2)
    return

dfs(1, 0)

for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
input = sys.stdin.readline
N = int(input())
L = [deque([]) for _ in range(N)]
ans = [-1] * N

for n in range(N-1):
    u, v, w = [int(x) for x in input().strip().split()]
    L[u-1].append((v, w))
    L[v-1].append((u, w))

def dfs(x, w):
    if ans[x-1] >= 0:
        return
    ans[x-1] = w % 2
    for nx, w_ in L[x-1]:
        dfs(nx, (w + w_) % 2)
    return

dfs(1, 0)

for a in ans:
    print(a)
Problem p03062 (python)

Fixed submission:
N=int(input())
A=[int(x) for x in input().split()]
B=[x for x in A if x<0]
absA=[abs(x) for x in A]
if len(B)%2==0:
  minus=0
else:
  minus=min(absA)
  
print(sum(absA)-minus*2)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(x) for x in input().split()]
B=[x for x in A if x<0]

if len(B)%2==0:
  minus=0
else:
  minus=max(B)
  
print(sum(A)+B)
Problem p03074 (python)

Fixed submission:
import sys,re,copy
input = sys.stdin.readline

N,K=[int(x) for x in input().strip().split()]

f=1
cnt=0
S=[]
r=0
for s in input().strip():
    s=int(s)
    if s==f:
        cnt+=1
    else:
        r+=cnt
        S.append(r)
        cnt=1
        f=1-f
else:
    r+=cnt
    S.append(r)
if len(S)%2==0:
    S.append(r)

Max=0
i=0
if len(S)==1:
    Max=S[0]
else:
    while True:
        if i >=len(S):
            break
        r=i+2*K
        cnt=S[min(r,len(S)-1)]-S[max(i-1,0)]
        if cnt > Max:
            Max = cnt
        i+=2

print(Max)

Buggy submission (verdict: Runtime Error):
import sys,re,copy
input = sys.stdin.readline

N,K=[int(x) for x in input().strip().split()]

f=1
cnt=0
S=[]
r=0
for s in input().strip():
    s=int(s)
    if s==f:
        cnt+=1
    else:
        r+=cnt
        S.append(r)
        cnt=1
        f=1-f
else:
    r+=cnt
    S.append(r)
if len(S)%2==0:
    S.append(r)

Max=0
i=0
if len(S)==1:
    Max=S[0]
else:
    while True:
        r=i+2*K
        cnt=S[min(r,len(S)-1)]-S[max(i-1,0)]
        if cnt > Max:
            Max = cnt
        i+=2

print(Max)
Problem p03095 (python)

Fixed submission:
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))

Buggy submission (verdict: Runtime Error):
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s) for s in set(S)]
cnt = 0
for i in range(len(le)):
    for s in itertools.combinations(le,i+1):
        t=1
        for tt in [x for x in s if x > 1]:
            t*=tt
        cnt+=t
print(cnt%((10**9)+7)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
c = 0
for i, s in enumerate(S):
  if s != '1':
    c = i + 1
    break
  
if K < c:
  print(1)
else:
  print(S[c - 1])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
for i, s in enumerate(S):
  if s != '1':
    c = i + 1
    break
if K < c:
  print(1)
else:
  print(S[c - 1])
Problem p03352 (python)

Fixed submission:
X = int(input())
a = 2
res = 1
while True:
  b = 2
  if a > 33:
    break
  while True:
    t = a ** b
    if t <= X:
      res = max(res, t)
      b += 1
    else:
      break
  a += 1

print(res)

Buggy submission (verdict: Runtime Error):
prin(int(int(input()) ** 0.5))
Problem p03360 (python)

Fixed submission:
A, B, C = [int(x) for x in input().split()]
print(max(A, B, C) * (2 ** int(input())) + sum([A, B, C]) - max(A, B, C))

Buggy submission (verdict: Runtime Error):
A, B, C = [int(x) for x in input().split()]
print(max(A, B, C)　*　(２ **int(input())) + sum(A, B, C) - max(A, B, C))
Problem p03385 (python)

Fixed submission:
print('YNeos'[''.join(sorted(input()))!='abc'::2])

Buggy submission (verdict: Runtime Error):
print('YNeos'[''.join(input().sort())!='abc'::2])
Problem p03452 (python)

Fixed submission:
import sys
from collections import deque
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]
L = [deque([]) for _ in range(N)]

for m in range(M):
    l, r, d = [int(x) for x in input().strip().split()]
    L[l-1].append((r, d))
    L[r-1].append((l, -d))

D = [0] * N
F = [False] * N

def dfs(n, d):
    # print('n = {}, d = {}'.format(n, d))
    if F[n-1]:
        if D[n-1] == d:
            # print('  already passed')
            return True
        else:
            # print('  already passed, but wrong')
            return False
    F[n-1] = True
    D[n-1] = d
    for nn, d_ in L[n-1]:
        # print('  dfs({}, {})'.format(nn, d+d_))
        if not dfs(nn, d+d_):
            return False
    else:
        return True

for n in range(1, N+1):
    if not dfs(n, D[n-1]):
        print('No')
        exit()
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]
L = [deque([]) for _ in range(N)]

for m in range(M):
    l, r, d = [int(x) for x in input().strip().split()]
    L[l-1].append((r, d))
    L[r-1].append((l, -d))

D = [0] * N
F = [False] * N

def dfs(n, d):
    if F[n-1]:
        if D[n-1] == d:
            return True
        else:
            return False
    F[n-1] = True
    D[n-1] = d
    for nn, d_ in L[n-1]:
        if not dfs(nn, d+d_):
            return False
    else:
        return True

for n in range(1, N+1):
    if not dfs(n, D[n-1]):
        print('No')
        exit()
else:
    print('Yes')
Problem p03455 (python)

Fixed submission:
a,b=[int(x) for x in input().split()]
print('EOvdedn'[(a*b)%2==1::2])

Buggy submission (verdict: Runtime Error):
a,b=[int(x) for x in input().split()]
print('EOvdedn'.[(a*b)%2==1::2])
Problem p03463 (python)

Fixed submission:
N, A, B = [int(x) for x in input().strip().split()]
if (A - B) % 2 == 0:
  print('Alice')
else:
  print('Borys')

Buggy submission (verdict: Runtime Error):
N, A, B = [int(x) for x in input().strip().split()]
if (A - B) % 2 == 0:
  print('Alice')
eles:
  print('Borys')
Problem p03470 (python)

Fixed submission:
N=int(input())
l=[0 for _ in range(100)]
for _ in range(N):
  l[int(input())-1]=1
print(sum(l))

Buggy submission (verdict: Runtime Error):
N=int(input())
l=[0 for _ in range(N)]
for _ in range(N):
  l[int(input())-1]=1
print(sum(l))

Buggy submission (verdict: Runtime Error):
N=int(input())
l=[0 for _ in range(N)]
for _ in range(N):
  l[int(input())]=1
print(sum(l))

Buggy submission (verdict: Runtime Error):
N=int(input())
l=[0 for _ in range(N)]
for _ in range(N):
  l[int(input())]=1
print(sum(l))
Problem p03472 (python)

Fixed submission:
import sys
import math
from collections import defaultdict
input = sys.stdin.readline
N, H = [int(x) for x in input().strip().split()]
A = [0] * N
B = [0] * N
a_max = 0

for n in range(N):
    a, b = [int(x) for x in input().strip().split()]
    a_max = max(a_max, a)
    A[n] = a
    B[n] = b

B = sorted([b for b in B if b >= a_max], reverse=True)
ans = 0
damage = 0
if sum(B) >= H:
    while damage < H:
        ans += 1
        damage += B[ans-1]
    print(ans)
else:
    ans = len(B)
    damage = sum(B)
    ans += math.ceil((H - damage) / a_max)
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math
from collections import defaultdict
input = sys.stdin.readline
N, H = [int(x) for x in input().strip().split()]
A = [0] * N
B = [0] * N
a_max = 0

for n in range(N):
    a, b = [int(x) for x in input().strip().split()]
    a_max = max(a_max, a)
    A[n] = a
    B[n] = b

if sum(B) >= H:
    ans = 0
    damage = 0
    while damage < H:
        ans += 1
        damage += B[ans-1]
    print(ans)
else:
    B = [b for b in B if b >= a_max]
    ans = len(B)
    ans += math.ceil((H - sum(B)) / a_max)
    print(ans)
import sys
import math
from collections import defaultdict
input = sys.stdin.readline
N, H = [int(x) for x in input().strip().split()]
A = [0] * N
B = [0] * N
a_max = 0

for n in range(N):
    a, b = [int(x) for x in input().strip().split()]
    a_max = max(a_max, a)
    A[n] = a
    B[n] = b

B = [b for b in B if b >= a_max]
ans = 0
damage = 0
if sum(B) >= H:
    while damage < H:
        ans += 1
        damage += B[ans-1]
    print(ans)
else:
    ans = len(B)
    damage = sum(B)
    ans += math.ceil((H - damage) / a_max)
    print(ans)
Problem p03475 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input().strip())
C = [0] * (N - 1)
ans = [0] * (N)
for n in range(N-1):
    C, S, F = [int(x) for x in input().strip().split()]
    ans[n] = S + C
    for i in range(n):
        if ans[i] <= S:
            ans[i] = S + C
        elif ans[i] % F == 0:
            ans[i] += C
        else:
            ans[i] = (ans[i] // F + 1) * F + C

for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
 import sys
input = sys.stdin.readline
N = int(input().strip())
C = [0] * (N - 1)
S = [0] * (N - 1)
F = [0] * (N - 1)
ans = [0] * (N)
for n in range(N-1):
    C, S, F = [int(x) for x in input().strip().split()]
    ans[n] = S + C
    for i in range(n):
        if ans[i] <= S:
            ans[i] = S + C
        elif ans[i] % F == 0:
            ans[i] += C
        else:
            ans[i] = (ans[i] // F + 1) * F + C

for a in ans:
    print(a)
Problem p03485 (python)

Fixed submission:
import math
print(math.ceil(sum([int(x) for x in input().split()])/2))

Buggy submission (verdict: Runtime Error):
import math
print(math.ceil(sum([int(x for x in input().split())])/2))
Problem p03552 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
N, Z, W = [int(x) for x in input().strip().split()]
a = [int(x) for x in input().strip().split()]
d = {}
def minmax(x, y, c, f):
    # print('x={}, y={}, c={}, f={}'.format(x, y, c, f))
    if (c, f) in d:
        return d[(c, f)]
    if c == N:
        return abs(x - y)
    if f == 0:
        ret = -float('inf')
        for i in range(1, N - c + 1):
            ret = max(ret, minmax(a[c+i-1], y, c+i, f^1))
    else:
        ret = float('inf')
        for i in range(1, N - c + 1):
            ret = min(ret, minmax(x, a[c+i-1], c+i, f^1))
    d[(c, f)] = ret
    return ret

print(minmax(Z, W, 0, 0))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, Z, W = [int(x) for x in input().strip().split()]
a = [int(x) for x in input().strip().split()]
d = {}
def minmax(x, y, c, f):
    # print('x={}, y={}, c={}, f={}'.format(x, y, c, f))
    if (x, y, c, f) in d:
        return d[(x, y, c, f)]
    if c == N:
        return abs(x - y)
    if f == 0:
        ret = -float('inf')
        for i in range(1, N - c + 1):
            ret = max(ret, minmax(a[c+i-1], y, c+i, f^1))
    else:
        ret = float('inf')
        for i in range(1, N - c + 1):
            ret = min(ret, minmax(x, a[c+i-1], c+i, f^1))
    d[(x, y, c, f)] = ret
    return ret

print(minmax(Z, W, 0, 0))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, Z, W = [int(x) for x in input().strip().split()]
a = [int(x) for x in input().strip().split()]

def minmax(x, y, c, f):
    # print('x={}, y={}, c={}, f={}'.format(x, y, c, f))
    if c == N:
        return abs(x - y)
    if f == 0:
        ret = -float('inf')
        for i in range(1, N - c + 1):
            ret = max(ret, minmax(a[c+i-1], y, c+i, f^1))
    else:
        ret = float('inf')
        for i in range(1, N - c + 1):
            ret = min(ret, minmax(x, a[c+i-1], c+i, f^1))
    return ret

print(minmax(Z, W, 0, 0))
Problem p03555 (python)

Fixed submission:
C=[input(),input()]
res='YES'
for i in range(3):
  if C[0][i]!=C[1][2-i]: res='NO'
print(res)

Buggy submission (verdict: Runtime Error):
C=[input().split(),input().split()]
res='YES'
for i in range(3):
  if C[0][i]!=C[1][2-i]: res='NO'
print(res)
Problem p03569 (python)

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    s = input().strip()
    N = len(s)
    l = -1
    r = N
    if len(set(s)) == 1:
        print(0)
        exit()
    while l < r:
        l += 1
        r -= 1
        while s[l] == 'x':
            l += 1
        while s[r] == 'x':
            r -= 1
        if s[l] != s[r]:
            print(-1)
            exit()
    
    ans = 0
    while l != -1 or r != N:
        if l == -1:
            ans += N - r
            break
        if r == N:
            ans += l + 1
            break
        if s[l] == s[r]:
            l -= 1
            r += 1
            continue
        elif s[l] == 'x':
            ans += 1
            l -= 1
        elif s[r] == 'x':
            ans += 1
            r += 1
        
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline
    s = input().strip()
    N = len(s)
    l = -1
    r = N
    while l < r:
        l += 1
        r -= 1
        while s[l] == 'x':
            l += 1
        while s[r] == 'x':
            r -= 1
        if s[l] != s[r]:
            print(-1)
            exit()
    
    ans = 0
    while l != -1 or r != N:
        if l == -1:
            ans += N - r
            break
        if r == N:
            ans += l + 1
            break
        if s[l] == s[r]:
            l -= 1
            r += 1
            continue
        elif s[l] == 'x':
            ans += 1
            l -= 1
        elif s[r] == 'x':
            ans += 1
            r += 1
        
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline
    s = input().strip()
    N = len(s)
    l = -1
    r = N
    while l < r:
        l += 1
        r -= 1
        while s[l] == 'x':
            l += 1
        while s[r] == 'x':
            r -= 1
        if s[l] != s[r]:
            print(-1)
            exit()
    
    ans = 0
    if l > r:
        l, r = r, l
        if r - l % 2 != 0:
            ans += 1
    
    while l != -1 or r != N:
        if l == -1:
            ans += N - r
            break
        if r == N:
            ans += l + 1
            break
        if s[l] == s[r]:
            l -= 1
            r += 1
            continue
        elif s[l] == 'x':
            ans += 1
            l -= 1
        elif s[r] == 'x':
            ans += 1
            r += 1
        
    print(ans)

if __name__ == '__main__':
    main()
Problem p03606 (python)

Fixed submission:
N=int(input())
res=0
for n in range(N):
  l,r=[int(x) for x in input().split()]
  res+=r-l+1
else:
  print(res)

Buggy submission (verdict: Runtime Error):
N=int(input())
res=0
for n in N:
  l,r=[int(x) for x in input().split()]
  res+=r-l+1
else:
  print(res)
Problem p03636 (python)

Fixed submission:
s=input()
print(s[0]+str(len(s)-2)+s[-1])

Buggy submission (verdict: Runtime Error):
s=input()
print(s[0]+str(len(S)-2)+s[-1])
Problem p03644 (python)

Fixed submission:
res=1
maxT=0
for i in range(1,int(input())+1):
  c=i
  t=0
  while c!=1:
    if c%2==0:
      t+=1
    else:
      break
    c//=2
  if t>maxT:
    res=i
    maxT=t
print(res)

Buggy submission (verdict: Runtime Error):
res=0
for i in range(1,int(input())+1):
  t=0
  while i==1:
    t+=1 if i%2==0
    i//=2
  res=max(res,t)
print(res)
Problem p03657 (python)

Fixed submission:
a,b=[int(x) for x in input().split()]
if (a%3==1 and b%3==1) or (a%3==2 and b%3==2):
  print('Impossible')
else:
  print('Possible')

Buggy submission (verdict: Runtime Error):
a,b=[int(x) for x in input().split()]
if (a%3==1 and b%d==1) or (a%3==2 and b%3==2):
  print('Possible')
else:
  print('Impposible')
Problem p03671 (python)

Fixed submission:
a=[int(x) for x in input().split()]
print(sum(a)-max(a))

Buggy submission (verdict: Runtime Error):
print(sum([int(x) for x in input().split()].sort()[0:1]))
Problem p03680 (python)

Fixed submission:
N=int(input())
aN=[int(input()) for _ in range(N)]
c=0
i=1
while True:
  c+=1
  if aN[i-1]==2:
    print(c)
    break
  elif aN[i-1]==0:
    print(-1)
    break
  t=aN[i-1]
  aN[i-1]=0
  i=t

Buggy submission (verdict: Runtime Error):
N=int(input())
aN=[int(input()) for _ in range(N)]
c=0
i=1
while True:
  print(aN)
  c+=1
  if aN[i-1]==2:
    print(c)
    break
  elif aN[i-1]==0:
    print(-1)
    break
  t=aN[i-1]
  aN[i-1]=0
  i=t

Buggy submission (verdict: Runtime Error):
N=int(input())
aN=[int(input()) for _ in range(N)]
c=0
i=1
while True:
  c+=1
  if a[i]==2:
    print(c)
    break
  elif a[i]==0:
    print(-1)
  i=a[i]
  a[i]=0
Problem p03695 (python)

Fixed submission:
N = int(input())
rate = [0] * 9
for a in [int(x) for x in input().split()]:
  rate[min(a, 3200) // 400] += 1

ret = 0
for r in rate[:-1]:
  if r:
    ret += 1

print(max(ret, 1), ret + rate[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
rate = [0] * 9
for a in [int(x) for x in input().split()]:
  rate[a // 400] += 1

ret = 0
for r in rate[:-1]:
  if r:
    ret += 1

print(ret, ret + rate[-1])
Problem p03697 (python)

Fixed submission:
a=sum([int(x) for x in input().split()])
if a>=10:
  a='error'
print(a)

Buggy submission (verdict: Runtime Error):
a=sum[int(x) for x in input().split()]
if a>=10:
  a='error'
print(a)
Problem p03698 (python)

Fixed submission:
S=input()
if len(S)==len(set(list(S))):
  print('yes')
else:
  print('no')

Buggy submission (verdict: Runtime Error):
S=input()
if len(S)==len(set(list(S))):
  print('yes'):
else:
  print('no')
Problem p03720 (python)

Fixed submission:
N,M=[int(x) for x in input().split()]
ans=[0]*N
for m in range(M):
  a,b=[int(x) for x in input().split()]
  ans[a-1]+=1
  ans[b-1]+=1
for a in ans:
  print(a)

Buggy submission (verdict: Runtime Error):
N,M=[int(x) for x in input().split()]
ans=[0]*N
for n in range(N):
  a,b=[int(x) for x in input().split()]
  ans[a-1]+=1
  ans[b-1]+=1
for a in ans:
  print(a)
Problem p03827 (python)

Fixed submission:
N=int(input())
S=input()
x=0
ans=0
for s in S:
  if s=='I':
    x+=1
    ans=max(ans,x)
  else:
    x-=1
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
x=0
ans=0
for s in S:
  if s=='I':
    x+=1
    ans=max(anx,x)
  else:
    x-=1
print(ans)
Problem p03844 (python)

Fixed submission:
AopB=input().split()
if AopB[1]=='+':
  print(int(AopB[0])+int(AopB[2]))
else:
  print(int(AopB[0])-int(AopB[2]))

Buggy submission (verdict: Runtime Error):
AopB=input().split()
if AopB[1]=='+':
  print(int(AopB[0]+int(AopB[2])))
else:
  print(int(AopB[0]-int(AopB[2])))
Problem p04001 (python)

Fixed submission:
import sys
input = sys.stdin.readline
s = input().strip()
n = len(s)
ans = 0
for i in range(1<<(n-1)):
    t = ''
    for j in range(n-1):
        t += s[j]
        if (i >> j) & 1:
            t += '+'
    else:
        t += s[n-1]
    ans += eval(t)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
s = input()
n = len(s)
ans = 0
for i in range(1<<(n-1)):
    t = ''
    for j in range(n-1):
        t += s[j]
        if (i >> j) & 1:
            t += '+'
    else:
        t += s[n-1]
    ans += eval(t)
print(ans)
Problem p04013 (python)

Fixed submission:
N, A = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]
mat = {}
def dp(i: int, x: list) -> int:
  sumx = sum(x)
  lenx = len(x)
  if i == N:
    if lenx and sumx == A * lenx:
      return 1
    else:
      return 0
  if (i, sumx, lenx) in mat:
    return mat[(i, sumx, lenx)]
  ret = dp(i + 1, x[:]) + dp(i + 1, x[:] + [X[i]])
  mat[(i, sumx, lenx)] = ret
  return ret

print(dp(0, []))

Buggy submission (verdict: Runtime Error):
N, A = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]
# mat = {}
def dp(i, x):
  if i == N:
    if len(x) and sum(x) == A * len(x):
      return 1
    else:
      return 0
  elif len(x) and (i, sum(x)/len(x)) in mat:
    return mat[(i, sum(x)/len(x))]
  ret = dp(i + 1, x) + dp(i + 1, x + [X[i]])
  # if len(x):
    # mat[i, sum(x)/len(x)] = ret
  return ret

print(dp(0, []))