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

Fixed submission:
from collections import deque

h,w=list(map(int,input().split()))
a=[[c for c in input()] for _ in range(h)]
visit=[[0]*w for _ in range(h)]
q=deque()

for i in range(h):
    for j in range(w):
        if a[i][j]=='#':
            deque.appendleft(q,(i,j,0))
            visit[i][j]=1
ans=0
while len(q)>0:
    i,j,cnt=deque.pop(q)

    ans=max(ans,cnt)

    for di,dj in [(-1,0),(1,0),(0,-1),(0,1)]:
        ni=i+di
        nj=j+dj
        if 0<=ni<h and 0<=nj<w and visit[ni][nj]==0:
            visit[ni][nj]=1
            deque.appendleft(q,(ni,nj,cnt+1))

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import heapq
import copy
import numpy as np
from collections import deque

h,w=list(map(int,input().split()))
a=[['.']*w for i in range(h)]
q=deque()
cnt=0
for i in range(h):
    for j,x in enumerate(sys.stdin.readline().strip()):
        if x=='#':
            deque.append(q,[i,j])
            a[i][j]=0

while len(q)>0:
    hh,ww=deque.popleft(q)

    for nh,nw in [[hh+dh,ww+dw] for dh,dw in [[1,0],[-1,0],[0,1],[0,-1]]]:
        
        if 0>nh or nh>=h or 0>nw or nw>=w or a[nh][nw]!='.':
            continue
        
        a[nh][nw]=a[hh][ww]+1
        cnt=max(cnt,a[nh][nw])

        deque.append(q,[nh,nw])

print(cnt)
Problem p03104 (python)

Fixed submission:
A,B=list(map(int,input().split()))

B=[int(c) for c in format(B,'b')]

n=len(B)
dp=[[0,0] for _ in range(n+1)]
dp[0][0]=1

cnt=[0]*(n+1)

s=''

for i in range(1,n+1):
    dp=[[0,0] for _ in range(n+1)]
    dp[0][0]=1
    for j in range(n):
        for k in range(2):
            if i==j+1:
                dp[j+1][k]=0 if B[j]==0 and k==0 else dp[j][k]
            else:
                for l in range(0,2 if k==1 else B[j]+1):
                    dp[j+1][k or l<B[j]]+=dp[j][k]
    
    cnt[i]=dp[n][0]+dp[n][1]

if A>1:
    A-=1
    A=[int(c) for c in format(A,'b')]
    n=len(A)
    
    for i in range(1,n+1):
        dp=[[0,0] for _ in range(n+1)]
        dp[0][0]=1
        for j in range(n):
            for k in range(2):
                if i==j+1:
                    dp[j+1][k]=0 if A[j]==0 and k==0 else dp[j][k]
                else:
                    for l in range(0,2 if k==1 else A[j]+1):
                        dp[j+1][k or l<A[j]]+=dp[j][k]
        
        cnt[i+len(B)-n]-=dp[n][0]+dp[n][1]

for i in range(1,len(B)+1):
    if cnt[i]%2==0:
        s+='0'
    else:
        s+='1'

print(int(s,2))

Buggy submission (verdict: Runtime Error):
A,B=list(map(int,input().split()))
A=A-1
B=[int(c) for c in format(B,'b')]
A=[int(c) for c in format(A,'b')]

n=len(B)
dp=[[0,0] for _ in range(n+1)]
dp[0][0]=1

cnt=[0]*(n+1)

s=''

for i in range(1,n+1):
    dp=[[0,0] for _ in range(n+1)]
    dp[0][0]=1
    for j in range(n):
        for k in range(2):
            if i==j+1:
                dp[j+1][k]=0 if B[j]==0 and k==0 else dp[j][k]
            else:
                for l in range(0,2 if k==1 else B[j]+1):
                    dp[j+1][k or l<B[j]]+=dp[j][k]
    
    cnt[i]=dp[n][0]+dp[n][1]

if sum(A)>=0:
    n=len(A)
    for i in range(1,n+1):
        dp=[[0,0] for _ in range(n+1)]
        dp[0][0]=1
        for j in range(n):
            for k in range(2):
                if i==j+1:
                    dp[j+1][k]=0 if A[j]==0 and k==0 else dp[j][k]
                else:
                    for l in range(0,2 if k==1 else A[j]+1):
                        dp[j+1][k or l<A[j]]+=dp[j][k]
        
        cnt[i+len(B)-n]-=dp[n][0]+dp[n][1]

for i in range(1,len(B)+1):
    if cnt[i]%2==0:
        s+='0'
    else:
        s+='1'

print(int(s,2))
Problem p03108 (python)

Fixed submission:
N,M=list(map(int,input().split()))
edge=[list(map(int,input().split())) for _ in range(M)]

current=N*(N-1)//2
ret=[0]*M

par=list(range(N+1))
cnt=[1]*(N+1)
rank=[0]*(N+1)

def find(x):
    if x==par[x]:
        return x
    else:
        par[x]=find(par[x])
        return par[x]

def same(x,y):
    return find(x)==find(y)

def size(x):
    return cnt[find(x)]

def unite(x,y):
    x=find(x)
    y=find(y)

    if x==y:
        return 0
    
    if rank[x]<rank[y]:
        cnt[y]+=size(x)
        par[x]=y
    else:
        cnt[x]+=size(y)
        par[y]=x
        if rank[x]==rank[y]:rank[x]+=1


for i in range(M-1,-1,-1):
    ret[i]=current

    a,b=edge[i]

    if not same(a,b):
        current-=size(a)*size(b)
        unite(a,b)

for r in ret:
    print(r)

Buggy submission (verdict: Runtime Error):
N,M=list(map(int,input().split()))
edge=[list(map(int,input().split())) for _ in range(M)]

current=N*(N-1)//2
ret=[0]*M

par=list(range(N+1))
cnt=[1]*(N+1)

def find(x):
    if x==par[x]:
        return x
    else:
        par[x]=find(par[x])
        return par[x]

def same(x,y):
    return find(x)==find(y)

def size(x):
    return cnt[find(x)]

def unite(x,y):
    x=find(x)
    y=find(y)

    if x==y:
        return
    
    cnt[x]+=size(y)
    par[y]=x


for i in range(M-1,-1,-1):
    ret[i]=current

    a,b=edge[i]

    if not same(a,b):
        current-=size(a)*size(b)
        unite(a,b)

for r in ret:
    print(r)
Problem p03291 (python)

Fixed submission:
s=input()
n=len(s)
q=s.count('?')

mod=10**9+7

target='ABC'
ans=0
for i in range(2**3):
    bdp=[1]*(n+1)
    cnt=0
    for j in range(2,-1,-1):
        if (i>>j)&1==1:
            c='?'
            cnt+=1
        else:
            c=target[j]
        
        cdp=[0]*(n+1)
        for k in range(n):
            if s[k]==c:
                cdp[k]=bdp[k+1]
        
        for k in range(n,0,-1):
            cdp[k-1]+=cdp[k]
            cdp[k-1]%=mod
        
        bdp=cdp
    
    if q>=cnt:
        ans+=bdp[0]*pow(3,q-cnt,mod)
        ans%=mod

print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
q=s.count('?')

mod=10**9+7

target='ABC'
ans=0
for i in range(2**3):
    bdp=[1]*(n+1)
    cnt=0
    for j in range(2,-1,-1):
        if (i>>j)&1==1:
            c='?'
            cnt+=1
        else:
            c=target[j]
        
        cdp=[0]*(n+1)
        for k in range(n):
            if s[k]==c:
                cdp[k]=bdp[k+1]
        
        for k in range(n,0,-1):
            cdp[k-1]+=cdp[k]
            cdp[k-1]%=mod
        
        bdp=cdp
    
    ans+=bdp[0]*pow(3,q-cnt,mod)
    ans%=mod

print(ans)
Problem p03806 (python)

Fixed submission:
n,ma,mb=map(int,input().split())
abc=[list(map(int,input().split())) for _ in range(n)]

wmax=400
inf=10**10
dp=[[[inf]*(wmax+1) for _ in range(wmax+1)] for _ in range(n+1)]
dp[0][0][0]=0

for i in range(n):
    a,b,c=abc[i]
    for j in range(wmax+1):
        for k in range(wmax+1):
            dp[i+1][j][k]=dp[i][j][k]

            if j>=a and k>=b:
                dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j-a][k-b]+c)

ans=inf

for j in range(1,wmax+1):
    for k in range(1,wmax+1):
        if dp[n][j][k]>=inf:
            continue

        if ma*k==mb*j:
            ans=min(ans,dp[n][j][k])

if ans==inf:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import njit

@njit
def main(n,ma,mb,abc):
    inf=10**5
    cost=inf*np.ones((401,401))
    maxa=np.sum(np.transpose[abc][0])
    maxb=np.sum(np.transpose[abc][1])

    left=4*n//8
    right=n
    cnt=right-left

    for i in range(2**cnt):
        ta=0
        tb=0
        tc=0
        for j in range(cnt):
            if (i>>j)&1==1:
                a,b,c=abc[left+j]
                ta+=a
                tb+=b
                tc+=c
        
        cost[ta,tb]=min(cost[ta,tb],tc)
    
    ans=inf

    for i in range(1,401):
        targeta=ma*i
        targetb=mb*i
        if targeta>maxa or targetb>maxb:
            break

        for j in range(2**left):
            ta=0
            tb=0
            tc=0
            for k in range(left):
                if (j>>k)&1==1:
                    a,b,c=abc[k]
                    ta+=a
                    tb+=b
                    tc+=c
        
            ua=targeta-ta
            ub=targetb-tb

            if 0<=ua<=400 and 0<=ub<=400 and cost[ua,ub]!=inf:
                ans=min(ans,tc+cost[ua,ub])
    
    if ans==inf:
        return -1
    else:
        return int(ans)

n,ma,mb=map(int,input().split())
abc=np.array([list(map(int,input().split())) for _ in range(n)])
print(main(n,ma,mb,abc))
Problem p02779 (python)

Fixed submission:
n = int(input())
A = [int(a) for a in input().split()]
A_set = set(A)
if len(A_set) == n:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for _ in range(n)]
A_set = set(A)
if len(A_set) == n:
    print('YES')
else:
    print('NO')
Problem p02819 (python)

Fixed submission:
x = int(input())
flag = False
for i in range(x, 1000000):
    for j in range(2, i+1):
        #print(i, j)
        if j == i:
            print(i)
            flag = True
            break
        if i % j == 0:
            #print('*', i, j)
            break
    if flag:
        break

Buggy submission (verdict: Runtime Error):
from sympy import sieve
x = int(input())
sosuu = list(sieve.primerange(2, 1000000))
for i in sosuu:
    if i >= x:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
x = int(input())
sosuu = list(sieve.primerange(2, 1000000))
for i in sosuu:
    if i >= x:
        print(i)
        break
Problem p02570 (python)

Fixed submission:
D, T, S  = map(int, input().split())

if D <= T*S:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N, M  = map(int, input().split())
S = []
for i in range(M):
    S.append(set(input().split()))

groups = [S[0]]

for j in range(1,len(S)-1):
    for k in range(len(groups)):
        if S[j] & groups[k] != set():
            groups[k] = S[j] | group
        else:
            groups.append(S[j])
lens = []
for group in groups:
    lens.append(len(group))
print(max(lens))
Problem p02712 (python)

Fixed submission:
n = int(input())
sm = 0
for i in range(1,n+1,1):
  if i%3 and i%5:
    sm+=i
print(sm)

Buggy submission (verdict: Runtime Error):
n = int(iniput())
sm = 0
for i in range(1,n+1,1):
  if i%3 and i%5:
    sm+=i
print(sm)
Problem p02598 (python)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

ok = max(a)
ng = 0
for _ in range(50):
    mid = (ok+ng)//2
    if(mid==0):
        print(1)
        exit()
    cnt = 0
    for ai in a:
        cnt += (ai-1)//mid
    if(cnt <= k):
        ok = mid
    else:
        ng = mid

print(ok)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))

ok = max(a)
ng = 0
for _ in range(50):
    mid = (ok+ng)//2
    cnt = 0
    for ai in a:
        cnt += (ai-1)//mid
    if(cnt <= k):
        ok = mid
    else:
        ng = mid

print(ok)
Problem p02679 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import defaultdict
from math import gcd

n = int(readline())
data = list(map(int,read().split()))
mod = 1000000007

it = iter(data)
a_b = defaultdict(lambda :[0,0])
a0 = 0
b0 = 0
ab0 = 0
ans = 0
for a,b in zip(it,it):
    if(a==b==0):
        ab0 += 1
        continue
    if(a*b==0):
        if(a==0):
            a0 += 1
        if(b==0):
            b0 += 1
    else:
        if(a/b > 0):
            a = abs(a)
            b = abs(b)
            gcd_num = gcd(a,b)
            a_b[(a//gcd_num,b//gcd_num)][0] += 1
        else:
            a = abs(a)
            b = abs(b)
            gcd_num = gcd(a,b)
            a_b[(b//gcd_num,a//gcd_num)][1] += 1

exp2 = [1] * (n+1)
for i in range(n):
    exp2[i+1] = exp2[i] * 2
    exp2[i+1] %= mod


ans += (ans+1) * ( exp2[a0]-1  + exp2[b0]-1)
ans %= mod

for key,val in a_b.items():
    ans += (ans+1) * ( exp2[val[0]]-1  + exp2[val[1]]-1)
    ans %= mod

ans += ab0
ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import defaultdict

n = int(readline())
data = list(map(int,read().split()))
mod = 1000000007

it = iter(data)
a_b = defaultdict(lambda :[0,0])
a0 = 0
b0 = 0
nums = []
ans = 0
for a,b in zip(it,it):
    if(a==b==0):
        ans[i] = 1
        continue
    if(a*b==0):
        if(a==0):
            a0 += 1
        if(b==0):
            b0 += 1
    else:
        if(a/b > 0):
            a_b[a/b][0] += 1
        else:
            a_b[-1*b/a][1] += 1

exp2 = [1] * (n+1)
for i in range(n):
    exp2[i+1] = exp2[i] * 2
    exp2[i+1] %= mod


ans += (ans+1) * ( exp2[a0]-1  + exp2[b0]-1)
ans %= mod

for key,val in a_b.items():
    ans += (ans+1) * ( exp2[val[0]]-1  + exp2[val[1]]-1)
    ans %= mod

print(ans)
Problem p02757 (python)

Fixed submission:
n,p = map(int, input().split())
s = input()

if(p==2)|(p==5):
    ans = 0
    for i in range(n):
        tmp = int(s[i])
        if(tmp%p == 0):
            ans += (i+1)

    print(ans)
    exit()

ans = 0
tmp = 0
rem = [0] * p
rem[0] = 1
for i in range(n):
    tmp = (tmp + int(s[-1 * (i+1)]) * pow(10, i, p)) % p
    ans += rem[tmp]
    rem[tmp] += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n,p = map(int, input().split())
s = input()

ans = 0
p0 = 0
dp = [0] * p
for i in s[::-1]:
    i = int(i)
    p0 = p0*10 % p
    dp[p0 + i] += 1
    ans += dp[p0]

print(ans)

Buggy submission (verdict: Runtime Error):
n,p = map(int, input().split())
s = input()

ans = 0
p0 = 0
dp = [0] * p
for i n range(s[::-1]):
    i = int(i)
    p0 = p0*10 % p
    dp[p0 + i] += 1
    ans += dp[p0]

print(ans)
Problem p02864 (python)

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))

if(n==k):
    print(0)
    exit()

inf = 10**15 * (n+1)
dp = [[inf] * (n-k+1) for _ in range(n+1)]
dp[0][0] = 0

for i in range(1,n+1):
    for j in range(1, n-k+1):
        if(j==1):
            dp[i][j] = h[i-1]
        else:
            tmp = inf
            for l in range(1,i):
                tmp = min(tmp, dp[l][j-1] + max(0, h[i-1]- h[l-1])  )
            dp[i][j] = tmp

ans = inf
for i in range(n+1):
    ans = min(ans, dp[i][-1])

print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))

if(n==k):
    print(0)
    exit()

inf = 10**9 * (n+1)
dp = [[inf] * (n-k+1) for _ in range(n+1)]
dp[0][0] = 0

for i in range(1,n+1):
    dp[i][0] = 0
    tmp = inf
    for j in range(1, n-k+1):
        for k in range(1,i):
            tmp = min(tmp, dp[k][j-1] + max(0, h[i-1]- h[k-1])  )
        dp[i][j] = tmp

print(dp[-1][-1])
Problem p02912 (python)

Fixed submission:
import math
import numpy as np

# n, m = 4,4
# a_list = np.array([1,9,3,5])

n,m = map(int, input().split())
a_list = np.array(list(map(int, input().split())))

a_list = np.sort(a_list)

a_logs = np.log2(a_list).astype('int64')

max_num = max(a_logs)
num = max_num*1

count_num = 0
flag = True
while(flag):
    count_num_temp = sum(a_logs>=num) + count_num
    if(count_num_temp > m):
        flag = False
        remain = m - count_num
    else:
        count_num = count_num_temp
        num -= 1
        if(num == -1):
            print('0')
            exit()

a_list = a_list // 2**((a_logs > num) * (a_logs - num))

if(remain > 0):
    a_list = np.sort(a_list)
    a_list[(n-remain):] = a_list[(n-remain):] //2

ans = sum(a_list)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np

# n, m = 4,4
# a_list = np.array([1,9,3,5])

n,m = map(int, input().split())
a_list = np.array(list(map(int, input().split())))

a_list = np.sort(a_list)

a_logs = np.log2(a_list).astype('int64')

max_num = max(a_logs)
num = max_num*1

count_num = 0
flag = True
while(flag):
    count_num_temp = sum(a_logs>=num) + count_num
    if(count_num_temp > m):
        flag = False
        remain = m - count_num
    else:
        count_num = count_num_temp
        num -= 1
        if(num == -1):
            print('0')
            exit()

a_list = a_list // 2**((a_logs > num) * (a_logs - num))

if(remain > 0):
    a_list = np.sort(a_list)
    a_list[(n-remain):] = a_list[(n-remain):] //2

ans = sum(a_list)
print(ans)
Problem p02948 (python)

Fixed submission:
n,m = map(int,input().split())
db = []

for i in range(n):
    a,b = map(int,input().split())
    if(a<=m):
        db.append([m-a,-1*b])

db.sort(reverse=True)

# ヒープキュー（最小値・最大値の取得）
import heapq
a=[]
heapq.heapify(a)

ans = 0
pnt = 0
day = m-1
while(day>=0):
    if(pnt < len(db)):
        while(db[pnt][0] == day):
            heapq.heappush(a,db[pnt][1])
            pnt += 1
            if(pnt == len(db)):
                break
    day -= 1

    if(len(a) > 0):
        ans -= heapq.heappop(a)

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

n, m = map(int, input().split())

a_list = []
b_list = []

ans_list= []
for i in range(m):
    ans_list.append(0)

for i in range(n):
    a,b = map(int, input().split())

    if ans_list[b] < a:
        ans_list[b]




    a_list.append(a)
    b_list.append(b)



ans = 0
for i in range(m):
    i = i+1
    if min(a_list) <= i:
        # ind = a_list.index(max(b_list[list(map(lambda x : x < i+1,b_list))]))
        max_num = max( map(lambda y: y[0] * (y[1] <=i) ,zip(b_list,a_list)))
        # ind = a_list.index(max(b_list * list(map(lambda x : x <= i,a_list))))
        ind = b_list.index(max_num)
        ans = ans + b_list[ind]
        a_list[ind] = m + 1

print(ans)

# print( list(map(lambda x : x < 3,[1,2,3,4])))
# list(map(lambda x : x < i+1,b_list))

# print( [1,2,3,4] * [True,False,True,False])
# print(1 * False)
Problem p02964 (python)

Fixed submission:
import bisect

n,k = map(int,input().split())
a = list(map(int,input().split()))

ind = [[] for _ in range(2*10**5 + 1)]
for i,num in enumerate(a):
    ind[num].append(i)

for i in range(1,2*10**5 + 1):
    if(ind[i]):
        ind[i].append(ind[i][0] + n)

before = []
cnt = 0
now = a[0]
while(True):
    right = bisect.bisect_right(ind[now], cnt%n)
    cnt += ind[now][right] - ind[now][right-1] + 1
    if(ind[now][right] >= n):
        before.append(ind[now][right-1])
    now = a[cnt%n]
    if(cnt%n == 0):
        break

if(cnt//n==1):
    print('')
    exit()

cyc = k%(cnt//n)

cnt = before[cyc-1]
ans = []
while(cnt < n):
    now = a[cnt]
    right = bisect.bisect_right(ind[now],cnt)
    if(ind[now][right] >= n):
        ans.append(now)
        cnt += 1
    else:
        cnt = ind[now][right] + 1

print(' '.join(map(str,ans)))

Buggy submission (verdict: Runtime Error):
import bisect

n,k = map(int,input().split())
a = list(map(int,input().split()))

ind = [[] for _ in range(2*10**5 + 1)]
for i,num in enumerate(a):
    ind[num].append(i)

for i in range(1,2*10**5 + 1):
    if(ind[i]):
        ind[i].append(ind[i][0] + n)

before = []
cnt = 0
now = a[0]
while(True):
    right = bisect.bisect_right(ind[now], cnt%n)
    cnt += ind[now][right] - ind[now][right-1] + 1
    if(ind[now][right] >= n):
        before.append(ind[now][right-1])
    now = a[cnt%n]
    if(cnt%n == 0):
        break

cyc = k%(cnt//n)

cnt = before[cyc-1]
ans = []
while(cnt < n):
    now = a[cnt]
    right = bisect.bisect_right(ind[now],cnt)
    if(ind[now][right] >= n):
        ans.append(now)
        cnt += 1
    else:
        cnt = ind[now][right] + 1

print(' '.join(map(str,ans)))
print(before)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())

a_list = list(map(int, input().split()))

def print_ans(s):
    if len(s)==0:
        print()
    else:
        ans = str(s[0])
        for val in s[1:]:
            ans = ans + " {}".format(val)
        print(ans)

s = []
count = 0
flag = True
done_list = [[]]
while(flag):
    count += 1
    for a in a_list:
        if a in s:
            s = s[0:s.index(a)]
        else:
            s.append(a)

    if count == k:
        pritn_ans(s)
        exit()

    if s in done_list:
        flag = False
    else:
        done_list.append(s.copy())


loop_num = len(done_list)
s = done_list[ k % loop_num ]
print_ans(s)
Problem p03072 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))

ans = 0
for i in range(n):
    if(h[i] == max(h[:i+1])):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
ans = 0
for i in range(n):
    if(h[i] == max(h[:i+1])):
        ans += 1
print(ans)
Problem p03272 (python)

Fixed submission:
a, b = map(int, input().split())
print(a - b + 1)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a - b + 1)
Problem p03307 (python)

Fixed submission:
n = int(input())
if n % 2 == 0:
  print(n)
else:
  print(n * 2)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 2 == 0:
  print n
else:
  print n * 2
Problem p03315 (python)

Fixed submission:
s = input()
ans = 0
for i in range(len(s)):
  if(s[i] == '+'):
    ans += 1
  else:
    ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
for i in range len(s):
  if(s[i] == '+'):
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
for i in range len(s):
  if(s[i] == '+'):
    ans += 1
  else:
    ans -= 1
print(ans)
Problem p02547 (python)

Fixed submission:
N = int(input())
Flag = False
MAXC = 0
Cout = 0
for TN in range(0,N):
    D1,D2 = (int(T) for T in input().split())
    if Flag==False and D1==D2:
        Flag = True
        Cout = 1
    elif Flag==True and D1==D2:
        Cout += 1
    elif Flag==True and D1!=D2:
        Flag = False
        MAXC = max(MAXC,Cout)
MAXC = [MAXC,max(MAXC,Cout)][Flag]
print(['No','Yes'][MAXC>=3])

Buggy submission (verdict: Runtime Error):
N = int(input())
Flag = False
MAXC = 0
Cont = 0
for TN in range(0,N):
    D1,D2 = (int(T) for T in input().split())
    if Flag==False and D1==D2:
        Flag = True
        Cout = 1
    elif Flag==True and D1==D2:
        Cout += 1
    elif Flag==True and D1!=D2:
        Flag = False
        MAXC = max(MAXC,Cout)
MAXC = [MAXC,max(MAXC,Cout)][Flag]
print(['No','Yes'][MAXC>=3])

Buggy submission (verdict: Runtime Error):
N = int(input())
Flag = False
MAXC = 0
for TN in range(0,N):
    D1,D2 = (int(T) for T in input().split())
    if Flag==False and D1==D2:
        Flag = True
        Cout = 1
    elif Flag==True and D1==D2:
        Cout += 1
    elif Flag==True and D1!=D2:
        Flag = False
        MAXC = max(MAXC,Cout)
MAXC = [MAXC,max(MAXC,Cout)][Flag]
print(['No','Yes'][MAXC>=3])
Problem p02659 (python)

Fixed submission:
A,B  = input().split()

if B[0] == 0:
    BH =      B[2]+B[3]
else:
    BH = B[0]+B[2]+B[3]

ABH = str(int(A)*int(BH))
if len(ABH) <= 2:
    print('0')
else:
    print(ABH[:-2])

Buggy submission (verdict: Runtime Error):
v\A,B  = input().split()
Flag = 1:

if A=='0' || B=='0':
    Flag = 0

if Flag 
    if B[0] == 0:
        BH =      B[2]+B[3]
    else:
        BH = B[0]+B[2]+B[3]

    ABH = str(int(A)*int(BH))
    print(int(ABH[:-2]))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A,B  = input().split()
Flag = 1:

if B == '0':
    Flag = 0

if Flag 
    if B[0] == 0:
        BH =      B[2]+B[3]
    else:
        BH = B[0]+B[2]+B[3]

    ABH = str(int(A)*int(BH))
    print(int(ABH[:-2]))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A,B = input().split()

if B[0] == 0:
    BH =      B[2]+B[3]
else:
    BH = B[0]+B[2]+B[3]

ABH = str(int(A)*int(BH))
print(int(ABH[:-2]))