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

Fixed submission:
N,D = [int(i) for i in input().split()]
lagd = []
for i in range(N):
    lagd.append([int(i) for i in input().split()])
lngs = D - 1
def kyoricac(daone,datwo,d):
    keka = []
    n = 0
    wa = 0
    while n <= d:
        wa = (daone[n] - datwo[n])**2
        keka += [wa]
        n += 1
    wa = sum(keka)
    kaesi = float(wa ** (1/2))
    return kaesi
ans = 0
fst = 1
for i in range(N):
    for n in range(fst,N):
        flag = float(kyoricac(lagd[i],lagd[n],lngs))
        if flag.is_integer() == True:
            ans += 1
    fst += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N,D = [int(i) for i in input().split()]
for i in range(N):
    lagd.append([int(i) for i in input().split()])
lngs = D - 1
def kyoricac(daone,datwo,d):
    keka = []
    n = 0
    wa = 0
    while n <= d:
        wa = (daone[n] - datwo[n])**2
        keka += [wa]
        n += 1
    wa = sum(keka)
    kaesi = float(wa ** (1/2))
    return kaesi
ans = 0
fst = 1
for i in range(N):
    for n in range(fst,N):
        flag = float(kyoricac(lagd[i],lagd[n],lngs))
        if flag.is_integer() == True:
            ans += 1
    fst += 1
print(ans)
Problem p02988 (python)

Fixed submission:
#b.py
n = int(input())
lis = list(map(int,input().split()))
ans = 0
for x,y,z in zip(lis,lis[1:],lis[2:]):
    if x < y < z or z < y < x:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
#b.py
n = int(input())
lis = list(map(int,input()))
ans = 0
for x,y,z in zip(lis,lis[1:],lis[2:]):
    if x < y < z:
        ans += 1
print(ans)
Problem p02995 (python)

Fixed submission:
#c.py
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def lcm(a, b):
    return a * b // gcd(a,b)
a,b,c,d = map(int,input().split())
canC = int(b//c) -int((a-1)//c)
canD = int(b//d) - int((a-1)//d)
dbCD = int(b//lcm(c,d)) -int((a-1)//lcm(c,d))
print((b-a+1) -canC - canD + dbCD)

Buggy submission (verdict: Runtime Error):
#c.py
from math import gcd
def lcm(a, b):
    return a * b // gcd(a,b)
a,b,c,d = map(int,input().split())
canC = b//c -(a-1)//c
canD = b//d - (a-1)//d
dbCD = b//lcm(c,d) -(a-1)//lcm(c,d)
print((b-a+1) -canC - canD + dbCD)

Buggy submission (verdict: Runtime Error):
#c.py
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def lcm(a, b):
    return a * b / gcd(a,b)
a,b,c,d = map(int,input().split())
canC = int(b//c) -int((a-1)//c)
canD = int(b//d) - int((a-1)//d))
dbCD = int(b//lcm(c,d)) -int((a-1)//lcm(c,d))
print((b-a+1) -canC - canD + dbCD)
Problem p03001 (python)

Fixed submission:
#c.py
w,h,x,y = map(int,input().split())
if w/2 == x and h/2 == y:
    print(w*h/2,1)
else:
    print(w*h/2,0)

Buggy submission (verdict: Runtime Error):
#c.py
w,h,x,y = map(int,input().split())
min(w * y,(w*h)-w*y)
min(h * x,(w*h)-h*x)
if x > w//2 and y > h//2:
    m = 
if w//2 == x and h//2 == y:
    print(w*h/2,0)
else:
    ans = max(min(w*y,(w*h)-w*y),min(h*x,(w*h)-h*x))
    print(ans,1)
Problem p03030 (python)

Fixed submission:
#b.py
n = int(input())
lis = [list(input().split())+[x] for x in range(n)]
lis = sorted(lis,key=lambda x:x[0])
now = lis[0][0]
ans_lis = []
sublis = []
for x in lis:
    if x[0] == now:
        sublis.append(x)
    else:
        now = x[0]
        sublis = sorted(sublis,key=lambda x:int(x[1]),reverse=True)
        ans_lis.append(sublis)
        sublis = []
        sublis.append(x)
sublis.sort(key=lambda x:int(x[1]),reverse=True)
ans_lis.append(sublis)
sublis = []
sublis.append(x)       
ans_lis = [item for sublist in ans_lis for item in sublist]
for x in ans_lis:
    print(x[2]+1)

Buggy submission (verdict: Runtime Error):
#b.py
n = int(input())
lis = [list(input().split())+[x] for x in range(n)]
lis = sorted(lis,key=lambda x:x[0])
now = lis[0][0]
ans_lis = []
sublis = []
for x in lis:
    if x[0] == now:
        sublis.append(x)
    else:
        now = x[0]
        sublis = sorted(sublis,key=lambda x:int(x[1]),reverse=True)
        print(int(x[1]))
        ans_lis.append(sublis)
        sublis = []
        sublis.append(x)
for x in ans_lis:
    print(x[2]+1)
Problem p03032 (python)

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

ans = 0

for l in range(n):
    for r in range(n-l+1):
        if l+r >k:
            break
        nv = v[:l] + v[n-r:]
        nv.sort()
        for i in range(k-l-r):
            if not nv or nv[0] >= 0:
                break
            nv.pop(0)
        ans = max(ans,sum(nv))
print(ans)

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

ans = 0

for l in range(n):
    for r in range(n-l+1):
        if l+r >k:
            break
        nv = v[:l] + v[n-r:]
        nv.sort()
        for i in range(k-l-r):
            if not nv or nv[0] >= 0:
                break
            nv.pop(0)
        ans = max(ans,sum(nv))
print(ans)
Problem p03043 (python)

Fixed submission:
n,k=map(int,input().split())
p_lis = []
for x in range(1,n+1):
    if k>x:
        i=1
        while x*2<k:
            x*=2
            i+=1
        p_lis.append(((1/2)**i)*(1/n))
    else:
        p_lis.append(1/n)
print(sum(p_lis))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p_lis = []
import math
for x in range(1,n+1):
    power = -((-math.log2(k//x))//1)
    p_lis.append(((1/2)**power)*(1/n))
print(sum(p_lis))
Problem p03068 (python)

Fixed submission:
N = int(input())
S = input()
K = int(input())
flag = S[K-1]
ans = []
for x in S:
    if x == flag:
        ans.append(x)
    else:
        ans.append('*')
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())
flag = S[K]
ans = []
for x in S:
    if x == flag:
        ans.append(x)
    else:
        ans.append('*')
print(''.join(ans))
Problem p03069 (python)

Fixed submission:
n = int(input())
s = input()
lis = []
ws=s.count('.')
lis.append(ws)
bs = 0
for x in s:
    if x == '#':
        bs += 1
        lis.append(bs+ws)
    else:
        ws -= 1
    lis.append(bs+ws)
print(min(lis))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
bs = 0
ws = s.count('.')
ans = n
for c in s:
    if c == '.':
        ws -= 1
            else:
        bs += 1
    now = ws + bs
    if ans > now:
        ans = now
print(ans)
Problem p03071 (python)

Fixed submission:
A,B = map(int,input().split())
if A == B:
    print(A*2)
elif A > B:
    print(A*2-1)
else:
    print(B*2-1)

Buggy submission (verdict: Runtime Error):
A,B = int(input())
if A == B:
    print(A*2)
elif A > B:
    print(A*2-1)
else:
    print(B*2-1)
Problem p03074 (python)

Fixed submission:
#looked ans

n,k = map(int,input().split())
s = input()
#入力
cnt = 0
if s[0] == '0':
    cnt += 1
for i in range(1,n):
    if s[i-1] == '1' and s[i] == '0':
        cnt += 1
##切り替わるところで＋1
if cnt <= k:
    print(n)
    #切り替わるところが動かす回数より少ない場合n(自明)
else:
    one_left,one_right = [0],[]
    #
    for i in range(1,n):
        if s[i-1] == '0' and s[i] == '1':
            one_left.append(i)
        if s[i-1] == '1' and s[i] == '0':
            one_right.append(i)
    #01 の時右に加える10の時左に加える
    #切り替えの時の配列の番号を加える
    one_right.append(n)
    #nはとりあえず右
    if s[0] == '1':
        one_right.pop(0)
    if s[-1] == '1':
        one_left.pop(-1)
    #最初の人が逆立ちしているなら右の切り替えの最初はなし
    #最後の人が逆立ちしているなら左の切り替えの最後はなし
    #print(one_right,'r')
    #print(one_left,'l')

    ans = 0
    #ans 01,10の切り替えの少ないほうでloopを回す
    for i in range(min(len(one_left),len(one_right)-k+1)):
        ans = max(ans,one_right[i+k-1]-one_left[i])
        #ans は　ある点までの個数-フラグの開始点までの個数の最大値
    print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
#入力
cnt = 0
if s[0] == '0':
    cnt += 1
for i in range(1,n):
    if s[i-1] == '1' and s[i] == '0':
        cnt += 1
##切り替わるところで＋1
if cnt <= k:
    print(n)
    #切り替わるところが動かす回数より少ない場合n(自明)
else:
    one_left,one_right = [0],[]
    #
    for i in range(1,n):
        if s[i-1] == '0' and s[i] == '1':
            one_left.append(i)
        if s[i-1] == '1' and s[i] == '0':
            one_right.append(i)
    #01 の時右に加える10の時左に加える
    #切り替えの時の配列の番号を加える
    one_right.append(n)
    #nはとりあえず右
    if s[0] == '1':
        one_right.pop(0)
    if s[-1] == '1':
        one_left.pop(-1)
    #最初の人が逆立ちしているなら右の切り替えの最初はなし
    #最後の人が逆立ちしているなら左の切り替えの最後はなし
    #print(one_right,'r')
    #print(one_left,'l')

    ans = 0
    #ans 01,10の切り替えの少ないほうでloopを回す
    for i in range(min(len(one_left),len(one_right)-k+1)):
        ans = max(ans,one_right[i+k-1]-one_left[i])
        #ans は　ある点までの個数-フラグの開始点までの個数の最大値
print(ans)
Problem p03086 (python)

Fixed submission:
S = input()
ans = 0
ans_lis = [0]
for x in S:
    if x == 'A' or x == 'C' or x == 'G' or x == 'T':
        ans += 1
    else:
        ans_lis.append(ans)
        ans = 0
ans_lis.append(ans)
print(max(ans_lis))

Buggy submission (verdict: Runtime Error):
S = input()
ans = 0
ans_lis = []
for x in S:
    if x == 'A' or x == 'C'or x == 'G' or x == 'T':
        ans += 1
    else:
        ans_lis.append(ans)
        ans = 0
print(max(ans_lis))
Problem p03109 (python)

Fixed submission:
a,b,c = map(int,input().split("/"))
if a >=2019 and b >= 5:
    print('TBD')
else:
    print('Heisei')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split("/"))
if a >=2019 && b >= 5:
    print('TBD')
else:
    print('Heisei')
Problem p03125 (python)

Fixed submission:
a,b = map(int,input().split())
if b%a == 0:
    print(a+b)
else:
    print(b-a)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
while len(A) > 1:
    a_ = A[0]
    for x in range(1,len(A)):
        A[x] %= a_
    A = [ans for ans in A if ans > 0]
    A.sort()
print(A[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for main_loop in range (0,N):    
    A.sort()
    de = A.count(0)
    del A[:de]
    li = len(A)
    if A[0] == 1:
        break
    for x in range(1,li):
        A[x] = A[x]%A[0]
print(A[0])
Problem p03145 (python)

Fixed submission:
c,a,b = map(int,input().split())

print(int((c*a)/2))

Buggy submission (verdict: Runtime Error):
c,a,b = map(int,inpput().split())

print(c*a/2)
Problem p03436 (python)

Fixed submission:
H,W = map(int,input().split())
field = [input() for x in range(H)]
vx = [0,0,1,-1]
vy = [1,-1,0,0]
reached = [[-1 for x in range(W)]for x in range(H)]
from collections import deque
def bfs(y,x):
    q = deque([[y,x]])
    reached[y][x] = 1

    while q:
        y,x = q.popleft()
        if [y,x] == [H-1,W-1]:
            return reached[y][x]
        for dy,dx in zip(vy,vx):
            ny,nx = y+dy,x+dx
            if not (0<=ny<H and 0<=nx<W):
                continue
            if field[ny][nx] == '.' and reached[ny][nx] == -1:
                q.append([ny,nx])
                reached[ny][nx] = reached[y][x] + 1
    return -1
bk = 0
for x in field:
    for y in x:
        if y == '#':
            bk += 1
ans = bfs(0,0)
if ans==-1:
    print(-1)
else:
    print(H*W-ans-bk)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
field = [input() for x in range(H)]
vx = [0,0,1,-1]
vy = [1,-1,0,0]
reached = [[-1 for x in range(W)]for x in range(H)]
from collections import deque
def bfs(y,x):
    q = deque([[y,x]])
    reached[y][x] = 1
    try:
        while q:
            y,x = q.popleft()
            if [y,x] == [H-1,W-1]:
                return reached[y][x]
            for dy,dx in zip(vy,vx):
                ny,nx = y+dy,x+dx
                if not (0<=ny<H and 0<=nx<W):
                    continue
                if field[ny][nx] == '.' and reached[ny][nx] == -1:
                    q.append([ny,nx])
                    reached[ny][nx] = reached[y][x] + 1
    except:
        return -1
bk = 0
for x in field:
    for y in x:
        if y == '#':
            bk += 1
print(H*W-bfs(0,0)-bk)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
field = [input() for x in range(H)]
vx = [0,0,1,-1]
vy = [1,-1,0,0]
reached = [[-1 for x in range(W)]for x in range(H)]
from collections import deque
def bfs(y,x):
    q = deque([[y,x]])
    reached[y][x] = 1

    while q:
        y,x = q.popleft()
        if [y,x] == [H-1,W-1]:
            return reached[y][x]
        for dy,dx in zip(vy,vx):
            ny,nx = y+dy,x+dx
            if not (0<=ny<H and 0<=nx<W):
                continue
            if field[ny][nx] == '.' and reached[ny][nx] == -1:
                q.append([ny,nx])
                reached[ny][nx] = reached[y][x] + 1
bk = 0
for x in field:
    for y in x:
        if y == '#':
            bk += 1
print(H*W-bfs(0,0)-bk)
Problem p02730 (python)

Fixed submission:
s = input('')
n = len(s)
s1 = s[0:(n-1)//2]
s2 = s[(n+3)//2-1:]

if (s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]):
	print("Yes")
else:
  	print("No")

Buggy submission (verdict: Runtime Error):
s = input("")
s1 = s[0:(n-1)/2]
s2 = s[(n+3)/2-1:]

if (s1 == s1[::-1] and s2 == s2[::-1]):
	print("Yes")
else:
  	print("No")
Problem p02742 (python)

Fixed submission:
from math import *
h, w = map(int, input('').split(' '))

if h > 1 and w > 1:
	print(ceil(w/2) * ceil(h/2) + floor(w/2) * floor(h/2) )
else:
  print(1)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input("").split(''))

print(ceil(w/2) * ceil(h/2) * (floor(w/2) * floor(h/2))
Problem p02702 (python)

Fixed submission:
S = input()[::-1]
 
## 余りを0~2018で総数保持
counts = [0]*2019
## 0桁の余りは0
counts[0] = 1
 
num, d = 0, 1
 
for c in S:
  ## 右から~桁の数字
  num += int(c) * d
  num %= 2019
  
  ## 次の桁
  d *= 10
  d %= 2019
  
  counts[num] += 1
  
ans = 0
for cnt in counts:
  ## nC2の計算
  ans += cnt * (cnt-1) //2
  
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()[::-1]

## 余りを0~2018で総数保持
counts = [0]*2019
## 0桁の余りは0
counts[0] = 1

num, d = 0, 1

for c in s:
  ## 右から~桁の数字
  num += int(c) * d
  num %= 2019
  
  ## 次の桁
  d *= 10
  #d %= 2019
  
  counts[num] += 1
  
ans = 0
for cnt in counts:
  ## nC2の計算
  ans += cnt * (cnt-1) //2
  
print(ans)
Problem p02708 (python)

Fixed submission:
N, K = map(int, input().split())
 
ans = 0
mod = pow(10,9)+7
 
for k in range(K, N+2): ## K個以上で総数(N+1)
  ## 全個数の計算　## k個最大 ## k個最小
  ans += k*((N+1-k)+N)//2 - k*(0+k-1)//2 + 1
  
print(ans % mod)


## sum(range(N-k+1, N+1))
## k*((N+1-k)+N)/2

## sum(range(0, k))
## k*(0+k-1)/2

Buggy submission (verdict: Runtime Error):
import itertools

N, K = map(int, input().split())

ans = 0

for k in range(K, N):
  ans += len(set(map(sum, itertools.combinations(range(N), k))))

print(ans%(10000000000+7)
Problem p03337 (python)

Fixed submission:
def main():
    a, b = map(int, input().split())
    print(max(a+b, max(a-b,a*b)))

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    S = input()

    count = 0
    max_ = 0

    for i in range(N):
        x = set(S[:i])
        y = set(S[i:])

        max_ = max(len(x&y), max_)

    print(max_)


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

Fixed submission:
if __name__=='__main__':
    a, b = map(int, input().split())

    day = int(a)-1
    if b >= a:
        day += 1
    print(day)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

day = int(a)-1
if b >= a:
	day += 1
print(day)

Buggy submission (verdict: Runtime Error):
if __name__=='__main__':
    a = input()
    b = input()

    day = int(a)-1
    if b >= a:
        day += 1
    print(day)
Problem p03423 (python)

Fixed submission:
print(int(input())//3)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = input().split()
l = set(l)
length = len(l)

if length == 4:
    print("Four")
else:
    print("Three")
Problem p03477 (python)

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

if (A+B) > (C+D):
    print("Left")
elif (A+B) < (C+D):
    print("Right")
else:
    print("Balanced")

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
total = 0
for x in range(n+1):
    X = [int(x) for x in list(str(x))]
    sum_x = sum(X)
    if a <= sum_x <= b:
        total += x
print(total)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input())

if (A+B) > (C+D):
    print("Left")
elif (A+B) < (C+D):
    print("Right")
else:
    print("Balanced")
Problem p03693 (python)

Fixed submission:
num = list(input().split())
num = int("".join(num))


if num % 4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
num = list(map(int, input().split()))
num = "".join(num)

if num % 4 == 0:
    print("YES")
else:
    print("NO")
Problem p03760 (python)

Fixed submission:
o = list(input())
e = list(input())
ls = []
for x in range(min(len(o), len(e))):
    ls.append(o[x])
    ls.append(e[x])
else:
    if len(o) < len(e):
        for i in range(x+1, len(e)):
            ls.append(e[i])
    elif len(o) > len(e):
        for i in range(x+1, len(o)):
            ls.append(o[i])
print(''.join(ls))

Buggy submission (verdict: Runtime Error):
o = list(input())
e = list(input())
l = []
for x in range(max(len(o), len(e))):
    l.append(o[x])
    l.append(e[x])
print(''.join(l))
Problem p03861 (python)

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

Buggy submission (verdict: Runtime Error):
1 1000000000000000000 3
Problem p04012 (python)

Fixed submission:
w = list(input())
w_set = set(w)
for s in w_set:
    count_2 = w.count(s)
    if count_2 % 2 == 0:
        result = "Yes"
    else:
        result = "No"
        break
print(result)

Buggy submission (verdict: Runtime Error):
hthth
Problem p03759 (python)

Fixed submission:
a, b, c = map(int, raw_input().split())
print ['NO', 'YES'][b - a == c - b]

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;cin>>a>>b>>c;
	if(b-a==c-b)cout<<"YES";
	else cout<<"NO";
	return 0;
}
Problem p03889 (python)

Fixed submission:
mp={'b':'d','d':'b','p':'q','q':'p'};a=list(input());print("Yes"if a==[mp[x]for x in a[::-1]]else"No");

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
strint s1, s2;
int leng;
int main()
{
    cin >> s1;
    for(int i = s1.size() - 1; i >= 0; i--)
        s2[leng++] = s1[i];
    for(int i = 0; i < leng; i++)
    {
        if(s1[i]=='b') s2[i] = 'd';
        else if (s1[i] == 'd') s2[i] = 'b';
        else if (s1[i] == 'p') s2[i] = 'q';
        else if (s1[i] == 'q') s2[i] = 'p';
    }
    if(!strcmp(s1,s2)) puts("Yes");
    else puts("No");
    return 0;
}
Problem p03957 (python)

Fixed submission:
s = input()
f = False
l = False
for i in range(len(s)):
    if s[i] == 'C':
        for j in range(i, len(s)):
            if s[j] == 'F':
                print('Yes')
                f = True
                l = True
                break
        if f == False:
            print('No')
            l = True
            break
        else:
            l = True
            break
if l == False:
    print('No')

Buggy submission (verdict: Runtime Error):
strstart = input()
for i in strstart:
    if i == 'C':
        wzc = i
    if i == 'F':
        wzf = i
if wzc < wzf:
    print('YES')
else:
    print('NO')
Problem p03970 (python)

Fixed submission:
s1 = 'CODEFESTIVAL2016'
s2 = raw_input()
ans = 0
for i in range(len(s1)):
    ans += [0, 1][s1[i] != s2[i]]
print ans

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
if s[0]=='C':
    ans+=1
if s[1]='O':
    ans+=1
if s[2]='D':
    ans+=1
if s[3]='E':
    ans+=1
if s[4]='F':
    ans+=1
if s[5]='E':
    ans+=1
if s[6]='S':
    ans+=1
if s[7]='T':
    ans+=1
if s[8]='I':
    ans+=1
if s[9]='V':
    ans+=1
if s[10]='A':
    ans+=1
if s[11]='L':
    ans+=1
if s[12]='2':
    ans+=1
if s[13]='0':
    ans+=1
if s[14]='1':
    ans+=1
if s[15]='6':
    ans+=1
print(ans)
Problem p03999 (python)

Fixed submission:
S = input()
ans = 0
 
for i in range(2**(len(S)-1)):
    temp = S[0]
    for j in range(len(S)-1):
        if i & (1<<j) != 0:
            temp += "+"
        temp += S[j+1]
    ans += eval(temp)
print(ans)

Buggy submission (verdict: Runtime Error):
ss=input()
ans=0
 for i in range(2**(len(ss)-1)):
    temp=ss[0]
    for j in range(len(ss)-1):
        if i&(1<<j)!=0:
            temp+="+"
        temp+=ss[j+1]
    ans+=eval(temp)
print(ans)
Problem p04033 (python)

Fixed submission:
a=input().split()
a[0]=int(a[0])
a[1]=int(a[1])
if(a[0]<=0 and a[1]>=0):
    print("Zero")
elif(a[0]<0 and a[1]<0 and (a[1]-a[0])%2==0):
    print("Negative")
else:
    print("Positive")

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
b=1
for i in range(a[0],a[1]+1):
  b*=i
if b>0:
  print('Positive')
elif b<0:
  print('Negative')
elif b=0:
  print('Zero')
Problem p02786 (python)

Fixed submission:
H = int(input())

ans = 0
t = 1
while H > 0:
    ans += t
    H //= 2
    t *= 2
print(ans)

Buggy submission (verdict: Runtime Error):
    H = int(input())

    ans = 0
    t = 1
    while H > 0:
        ans += t
        H //= 2
        t *= 2
    print(ans)
Problem p02882 (python)

Fixed submission:
a,b,x = map(int,input().split())

half = a*a*b/2

from math import atan,pi
if x <= half:
    c = 2*x/a/b
    ans = atan(c/b)
else:
    c = 2*x/a/a - b
    if abs(b-c) < 10**(-7):
        ans = pi / 2
    else: ans = atan(a/(b-c))
print(90-ans*180/pi)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())

half = a*a*b/2

from math import atan,pi
if x <= half:
    c = 2*x/a/b
    ans = atan(c/b)
else:
    c = 2*x/a/a - b
    ans = atan(a/(b-c))
print(90-ans*180/pi)
Problem p02900 (python)

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

from fractions import gcd
g = gcd(A,B)

a = [1]
while g % 2 == 0:
    a.append(2)
    g //= 2
f = 3
while f * f <= g:
    if g % f == 0:
        a.append(f)
        g //= f
    else:
        f += 2
if g != 1:
    a.append(g)

print(len(set(a)))

Buggy submission (verdict: Runtime Error):
from math import sqrt
A,B = map(int,input().split())
dA = set([A])
dB = set([B])
r = int(sqrt(max(A,B))) + 1
for i in range(1,r+1):
    if A % i == 0:
        dA.add(i)
    if B % i == 0:
        dB.add(i)
CD = dA & dB

m = max(CD)
flg = [True] * (m+1)
flg[0] = False
for i in range(2,m+1):
    if i not in CD: flg[i] = False
    if flg[i]:
        t = i
        i += t
        while i <= m:
            flg[i] = False
            i += t

print(sum(flg))

Buggy submission (verdict: Runtime Error):
from math import sqrt
A,B = map(int,input().split())
dA = set()
dB = set()
r = int(sqrt(max(A,B))) + 1
for i in range(1,r):
    if A % i == 0:
        dA.add(i)
        dA.add(A//i)
    if B % i == 0:
        dB.add(i)
        dB.add(B//i)
# print(dA,dB)
CD = dA & dB
#print(CD)
#print(len(CD))

m = max(CD)
flg = [True] * (m+1)
flg[0] = False
for i in range(2,m+1):
    if i not in CD: flg[i] = False
    if flg[i]:
        t = i
        i += t
        while i <= m:
            flg[i] = False
            i += t
# print(flg)
print(sum(flg))
Problem p02936 (python)

Fixed submission:
from queue import deque
N,Q = map(int,input().split())
tree = [[] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    tree[a].append(b)
    tree[b].append(a)

ans = {i+1:0 for i in range(N)}
for i in range(Q):
    p,x = map(int,input().split())
    ans[p] += x

checked = [False for i in range(N+1)]
myq = deque()
myq.append(1)

while myq:
    v = myq.pop()
    checked[v] = True
    for n in tree[v]:
        if not checked[n]:
            ans[n] += ans[v]
            myq.append(n)
print(' '.join(str(ans[i]) for i in range(1,N+1)))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N,Q = map(int,input().split())

tree = defaultdict(list)
for i in range(N-1):
    a,b = map(int,input().split())
    tree[a].append(b)

adds = defaultdict(int)
for q in range(Q):
    p,x = map(int,input().split())
    adds[p] += x

def dig(i,tmp):
    tmp += adds[i]
    ans[i] = tmp
    if tree[i]:
        for v in tree[i]: dig(v,tmp)

ans = defaultdict(int)
tmp = 0
dig(1,tmp)

for i in range(1,N+1):
    print(ans[i], end=' ')
print()