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

Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random

nums = list(input())
nums = [int(i) for i in nums]

def make2digits(n):
    digits = []
    for i in range(3):
        if n % 2 == 1:
            digits.append(1)
        else:
            digits.append(0)
        n = n//2
    return digits

for i in range(8):
    count = nums[0]
    choices = make2digits(i)
    # print(choices)
    for j in range(len(choices)):
        if choices[j]==0:
            count -= nums[j+1]
        else:
            count += nums[j+1]
    # print(count)
    if count == 7:
        ans_choice = choices
        break


plusminus = ["-","+"]
ans = ""
nums = [str(i) for i in nums]
for i in range(3):
    ans = ans + nums[i] + plusminus[ans_choice[i]]

ans = ans+nums[-1]+"=7"
print(ans)

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import numpy as np
import random

nums = list(input())
nums = [int(i) for i in nums]

def make2digits(n):
    digits = []
    for i in range(3):
        if n % 2 == 1:
            digits.append(1)
        else:
            digits.append(0)
        n = n//2
    return digits

for i in range(8):
    count = nums[0]
    choices = make2digits(i)
    for j in range(len(choices)):
        if choices[j]==0:
            count = nums[j+1]
        else:
            count += nums[j+1]
    if count == 7:
        ans_choice = choices


plusminus = ["-","+"]
ans = ""
nums = [str(i) for i in nums]
for i in range(3):
    ans = ans + nums[i] + plusminus[ans_choice[i]]

ans = ans+nums[-1]+"=7"
print(ans)
Problem p03599 (python)

Fixed submission:
# encoding:utf-8
import copy
import numpy as np
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

A,B,C,D,E,F = map(int,input().split())

water = []
for ai in range(int(F/(A*100))+1):
    for bi in range(int(F/(B*100))+1):
        if (ai*A+bi*B)*100>F:pass
        else:
            water.append((ai*A+bi*B)*100)

suger = []
for ci in range(int(F/C)+1):
    for di in range(int(F/D)+1):
        if ci*C+di*D > F:
            pass
        else:suger.append(ci*C+di*D)

water = list(set(water))
suger = list(set(suger))
water.remove(0)
pure = 0
ans_s,ans_w = 0,A*100
for wi in range(len(water)):
    for si in range(len(suger)):
        if water[wi]+suger[si]>F:pass
        else:
            if pure<suger[si]/(water[wi]+suger[si])<=(E/(100+E)):
                ans_s = suger[si]
                ans_w = water[wi]
                pure = suger[si]/(water[wi]+suger[si])

print(ans_s+ans_w,end="")
print(" ",end="")
print(ans_s)

Buggy submission (verdict: Runtime Error):
#encoding:utf-8

import math
import sympy

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

facters = sympy.factorint(P)

ans = 1
for key in facters.keys():
    if facters[key]/N >= 1:
        ans *= key**(facters[key]//N)
print(int(ans))
Problem p03633 (python)

Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions

N = int(input())
T = [int(input()) for i in range(N)]


def lcm(a,b):
    return (a * b) // fractions.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

N = int(input())
T = [int(input()) for i in range(N)]


def lcm(a,b):
    return (a * b) // math.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

N = int(input())
T = [0 for i in range(N)]
for i in range(N):
    T[i] = int(input())

def lcm(a,b):
    return (a * b) // math.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

N = int(input())
T = [0 for i in range(N)]
for i in range(N):
    T[i] = int(input())

def lcm(a,b):
    return (a * b) // math.gcd(a,b)

ans = 1
for t in T:
    ans = lcm(ans,t)

print(ans)
Problem p03713 (python)

Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7



H,W = map(int,input().split())
area = H*W

ans = 0
if area % 3 == 0:
    ans = 0
    print(ans)
    exit()

space = area/3

error = 10**5
key = 0
h_cut = False
for i in range(1,H+1):
    if error > abs(i*W-space):
        error = abs(i*W-space)
        edge = i
        h_cut = True

for i in range(1,W+1):
    if error > abs(i*H-space):
        error = abs(i*H-space)
        edge = i
        h_cut = False

if h_cut:
    H -= edge
    areas = [edge*W]
else:
    W -= edge
    areas = [edge*H]

area = H*W
space = area/2

error = 10**5
key = 0
h_cut = False
for i in range(1,H+1):
    if error > abs(i*W-space):
        error = abs(i*W-space)
        edge = i
        h_cut = True

for i in range(1,W+1):
    if error > abs(i*H-space):
        error = abs(i*H-space)
        edge = i
        h_cut = False

if h_cut:
    areas.append(edge*W)
    areas.append((H-edge)*W)
else:
    areas.append(edge*H)
    areas.append((W-edge)*H)
ans = max(areas)-min(areas)
if ans == 65837:
    ans = 46514
print(ans)

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7



H,W = map(int,input().split())
area = H*W

ans = 0
if area % 3 == 0:
    ans = 0
    print(ans)
    exit()

space = area/3

error = 10**5
key = 0
h_cut = False
for i in range(1,H+1):
    if error > abs(i*W-space):
        error = abs(i*W-space)
        edge = i
        h_cut = True

for i in range(1,W+1):
    if error > abs(i*H-space):
        error = abs(i*H-space)
        edge = i
        h_cut = False

if h_cut:
    H -= edge
    areas = [edge*W]
else:
    W -= edge
    areas = [edge*H]

area = H*W
space = area/2

error = 10**5
key = 0
h_cut = False
for i in range(1,H+1):
    if error > abs(i*W-space):
        error = abs(i*W-space)
        edge = i
        h_cut = True

for i in range(1,W+1):
    if error > abs(i*H-space):
        error = abs(i*H-space)
        edge = i
        h_cut = False

if h_cut:
    areas.append(edge*W)
    areas.append((H-edge)*W)
else:
    areas.append(edge*H)
    areas.append((W-edge)*H)
ans = max(areas)-min(areas)
if ans = 65837:
    ans = 46514
print(ans)
Problem p03759 (python)

Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b,c = map(int,input().split())
if b-a == c-b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b,c = map(int,input())
if b-a == c-b:
    print("YES")
else:
    print("NO")
Problem p03777 (python)

Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b = map(str,input().split())

if a == "H" and b == "H":
    tp = True
elif a=="D" and b == "H":
    tp = False
elif a=="D" and b=="D":
    tp = True
else:
    tp = False


if tp:
    print("H")
else:
    print("D")

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b = map(str,input().split())

if a == "H" and b == "H":
    tp == True
elif a=="D" and b == "H"
    tp == False
elif a=="D" and b=="D":
    tp = True
else:
    tp = False


if tp:
    print("H")
else:
    print("D")
Problem p03798 (python)

Fixed submission:
n = int(input())
s = [1 if si == 'o' else 0 for si in list(input())]
t0 = [[1, 1], [1, 0], [0, 1], [0, 0]]
for ti in t0:
    flag = True
    for i in range(1, n - 1):
        if ti[i] * (1 - s[i]) or (1 - ti[i]) * s[i]:
            ti.append(1 - ti[i - 1])
        else:
            ti.append(ti[i - 1])
    for i in range(2):
        if ti[i - 1]:
            if (s[i - 1] and not ti[i - 2] == ti[i]) or (1 - s[i - 1] and ti[i - 2] == ti[i]):
                flag = False
        else:
            if (s[i - 1] and ti[i - 2] == ti[i]) or (1 - s[i - 1] and not ti[i - 2] == ti[i]):
                flag = False
    if flag:
        ans = ['S' if x else 'W' for x in ti]
        print(''.join(ans))
        exit()
print(-1)

Buggy submission (verdict: Runtime Error):
    n = int(input())
    s = [1 if si == 'o' else 0 for si in list(input())]
    t0 = [[1, 1], [1, 0], [0, 1], [0, 0]]
    for ti in t0:
        flag = True
        for i in range(1, n - 1):
            if ti[i] * (1 - s[i]) or (1 - ti[i]) * s[i]:
                ti.append(1 - ti[i - 1])
            else:
                ti.append(ti[i - 1])
        for i in range(2):
            if ti[i - 1]:
                if (s[i - 1] and not ti[i - 2] == ti[i]) or (1 - s[i - 1] and ti[i - 2] == ti[i]):
                    flag = False
            else:
                if (s[i - 1] and ti[i - 2] == ti[i]) or (1 - s[i - 1] and not ti[i - 2] == ti[i]):
                    flag = False
        if flag:
            ans = ['S' if x else 'W' for x in ti]
            print(''.join(ans))
            exit()
    print(-1)

Buggy submission (verdict: Runtime Error):
s = [1 if si == 'o' else 0 for si in list(input())]
t0 = [[1, 1], [1, 0], [0, 1], [0, 0]]
for ti in t0:
    flag = True
    for i in range(1, n - 1):
        if ti[i] * (1 - s[i]) or (1 - ti[i]) * s[i]:
            ti.append(1 - ti[i - 1])
        else:
            ti.append(ti[i - 1])
    for i in range(2):
        if ti[i - 1]:
            if (s[i - 1] and not ti[i - 2] == ti[i]) or (1 - s[i - 1] and ti[i - 2] == ti[i]):
                flag = False
        else:
            if (s[i - 1] and ti[i - 2] == ti[i]) or (1 - s[i - 1] and not ti[i - 2] == ti[i]):
                flag = False
    if flag:
        ans = ['S' if x else 'W' for x in ti]
        print(''.join(ans))
        exit()
print(-1)
Problem p03854 (python)

Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

S = str(input())
S = list(S)
S.reverse()
S = "".join(S)

def check(T):
    if len(S) == 0:
        return 1
    adds = ["maerd","remaerd","esare","resare"]
    q = copy.deepcopy(adds)
    while len(q) > 0:
        t = q.pop()
        if t == S:
            return 1
        for add in adds:
            if S[len(t):len(t+add)] == add:
                q.append(t+add)
    return 0

if check(""):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
# sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

S = str(input())

def check(T,S):
    if T == S:
        return 1
    adds = ["dream","dreamer","erase","eraser"]
    for i,add in enumerate(adds):
        if S[len(T):len(T)+len(add)] == add:
            if check(T+add,S) == 1:
                return 1

if check("",S):
    print("YES")
else:
    print("NO")
Problem p03946 (python)

Fixed submission:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,T = map(int,input().split())
A = [int(i) for i in input().split()]

L_min = [mod for i in range(N)]
L_min[0] = A[0]
for i in range(1,N):
    L_min[i] = min(L_min[i-1],A[i])

A.reverse()
R_max = [0 for i in range(N)]
R_max[0] = A[0]
for i in range(1,N):
    R_max[i] = max(R_max[i-1],A[i])

R_max.reverse()

ans = 0
dif = -mod

for i in range(1,N):
    if dif < R_max[i] - L_min[i] and 0 < R_max[i] - L_min[i]:
        dif = R_max[i] - L_min[i]
        r,l = R_max[i],L_min[i]
        # print(dif)
        ans = 1
    elif dif == R_max[i] - L_min[i]:
        if r == R_max[i]:
            pass
        else:
            r,l = R_max[i],L_min[i]
            ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,T = map(int,input().split())
A = [int(i) for i in input().split()]

L_min = [mod for i in range(N)]
L_min[0] = A[0]
for i in range(1,N):
    L_min[i] = min(L_min[i-1],A[i])

A.reverse()
R_max = [0 for i in range(N)]
R_max[0] = A[0]
for i in range(1,N):
    R_max[i] = max(R_max[i-1],A[i])

R_max.reverse()

ans = 0
dif = 0
# print(R_max)
# print(L_min)
for i in range(1,N):
    if dif < R_max[i] - L_min[i]:
        dif = R_max[i] - L_min[i]
        r,l = R_max[i],L_min[i]
        # print(dif)
        ans = 1
    elif dif == R_max[i] - L_min[i]:
        if r == R_max[i]:
            pass
        else:
            r,l = R_max[i],L_min[i]
            ans += 1

print(ans)
Problem p02582 (python)

Fixed submission:
S=str(input())
 
if S.count('R')==0:
  print(0)
if S.count('R')==1 :
  print(1)
if S.count('R')==2 and not S.count('RR') ==1:
  print(1)
if S.count('RR')==1 and not S.count('RRR')==1:
  print(2)
if S.count('RRR')==1:
  print(3)

Buggy submission (verdict: Runtime Error):
S=str(input())

if S.count('R')==0:
  print(0)
if S.count('R')==1:
  print(1)
if S.count('R')==2 and not moji.count('RR') ==1:
  print(1)
if S.count('RR')==1:
  print(2)
if S.count('RRR')==1:
  print(3)

Buggy submission (verdict: Runtime Error):
S=input()

if S.count('R')==0
  print(0)
if S.count('R')==1
  print(1)
if S.count('R')==2 and not moji.count('RR') ==1
  print(1)
if S.count('RR')==1
  print(2)
if S.count('RRR')==1
  print(3)

Buggy submission (verdict: Runtime Error):
S=str(input())

if S.count('R')==0
  print(0)
if S.count('R')==1
  print(1)
if S.count('R')==2 and not moji.count('RR') ==1
  print(1)
if S.count('RR')==1
  print(2)
if S.count('RRR')==1
  print(3)

Buggy submission (verdict: Runtime Error):
S=str(input())

if S.count('R')==0
  print(0)
if S.count('R')==1
  print(1)
if S.count('R')==2 and moji.count('RR')!=1
  print(1)
if S.count('RR')==1
  print(2)
if S.count('RRR')==1
  print(3)

Buggy submission (verdict: Runtime Error):
S=input()

if S.count('R')==0
  print(0)
if S.count('R')==1
  print(1)
if S.count('R')==2 and moji.count('RR')!=1
  print(1)
if S.count('RR')==1
  print(2)
if S.count('RRR')==1
  print(3)

Buggy submission (verdict: Runtime Error):
moji=input()

if moji.count('R')==0
  print(0)
if moji.count('R')==1
  print(1)
if moji.count('R')==2 and moji.count('RR')!=1
  print(1)
if moji.count('RR')==1
  print(2)
if moji.count('RRR')==1
  print(3)
Problem p02612 (python)

Fixed submission:
n=int(input())

if n%1000==0:
  print(0)
  
else:
  print(1000-n%1000)

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

if n%1000==0:
  print(0)
  
else
  print(1000-n%1000)
Problem p02645 (python)

Fixed submission:
x= input()
print(x[:3])

Buggy submission (verdict: Runtime Error):
a,s,d=input()
 
print(a,s,d)
Problem p02646 (python)

Fixed submission:
a,v=map(int, input().split())
b,w=map(int, input().split())
t=int(input())
 
if a<b:
  if b+w*t<=a+v*t:
    print('YES')
  else:
    print('NO')
if a>b:
  if a-v*t<=b-w*t:
    print('YES')
  else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,v,b,w,t=int(input().split())
 
print('NO')

Buggy submission (verdict: Runtime Error):
a,v,b,w,t=int(input().split())
 
if a<b and (b+w*t)<=(a+v*t):
    print('YES')
if a>b and (a-v*t)<=(b-w*t):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,v,b,w,t=int(input().split())
 
if a<b and b+w*t<=a+v*t:
    print('YES')

if a>b and a-v*t<=b-w*t:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,v,b,w,t=int(input().split())
 
if a<b:
  if b+w*t<=a+v*t:
    print('YES')
  else:
    print('NO')
if a>b:
  if a-v*t<=b-w*t:
    print('YES')
  else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a=int(input())
v=int(input())
b=int(input())
w=int(input())
t=int(input())

if a<b:
  if b+wt<=a+vt:
    print('YES')
  else:
    print('NO')
if a>b:
  if a-vt<=b-wt:
    print('YES')
  else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,v,b,w,t=int(input().split())
 
if a<b:
  if b+wt<=a+vt:
    print('YES')
  else:
    print('NO')
if a>b:
  if a-vt<=b-wt:
    print('YES')
  else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,b,v,w,t=int(input().split())

if a<b:
  if b+wt<=a+vt:
    print('YES')
  else:
    print('NO')

if a>b:
  if a-vt<=b-wt:
    print('YES')
  else:
    print('NO')
Problem p02705 (python)

Fixed submission:
r=int(input())
print(2*3.14*r)

Buggy submission (verdict: Runtime Error):
r=input()
print(2*3.14*r)
Problem p03079 (python)

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

if a==b and b==c:
  print('Yes')
else:
  print('No')

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

if a==b and b==c and c==a:
  print('Yes')
else:
  print('No')

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

if a==b and b==c:
  print('Yes')
else:
  print('No')

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

if a==b and b==c:
  print('Yes')
else:
  print('No')
Problem p03156 (python)

Fixed submission:
pxcount=0
pycount=0
pzcount=0

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

for i in p:
  if i<=a:
    pxcount=pxcount+1
for i in p:
  if a+1<=i and i<=b:
    pycount=pycount+1
for i in p:
  if b+1<=i:
    pzcount=pzcount+1
  
print(min(pxcount,pycount,pzcount))

Buggy submission (verdict: Runtime Error):
int pxcount,pycount,pzcount=0

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

for i in p:
  if i<=a:
    pxcount=pxcount+1
for i in p:
  if a+1<=i and i<=b:
    pycount=pycount+1
for i in p:
  if b+1<=i:
    pzcount=pzcount+1
  
print(min(pxcount,pycount,pzcount))
Problem p03227 (python)

Fixed submission:
s=input()

if len(s)==2:
  print(s)
if len(s)==3:
  ss = s[::-1]
  print(ss)

Buggy submission (verdict: Runtime Error):
s=input()

if len(s)==2:
  print(s)
if len(s)==3:
  s.reverse()
  print(s)
Problem p03407 (python)

Fixed submission:
a,s,d=map(int, input().split())
print('Yes' if a+s>=d else 'No')

Buggy submission (verdict: Runtime Error):
a,s,d=map(int, input().split())
print('Yes' if a+b>=c else 'No')
Problem p03577 (python)

Fixed submission:
s=input()

print(s[:(len(s)-8)])

Buggy submission (verdict: Runtime Error):
s=input()

print(s[::(s.len()-8)])
Problem p03587 (python)

Fixed submission:
s=input()


 
print(s.count('1'))

Buggy submission (verdict: Runtime Error):
a,s,d,f,g,h= map(int, input().split())

print(a+s+d+f+g+h)
Problem p02783 (python)

Fixed submission:
import math

val = input().split(' ')
h = float(val[0])
a = float(val[1])

print(math.ceil(h/a))

Buggy submission (verdict: Runtime Error):
import math
 
h = float(input())
enemies = [h]

count = 0
while len(enemies) > 0:
  temp = []
  for enemy in enemies:
    count+=1
    if enemy > 1:
      temp.append(round(enemy / 2))
      temp.append(round(enemy / 2))
  enemies = temp

print(count)

Buggy submission (verdict: Runtime Error):
import math

h = float(input())
a = float(input())

print(math.ceil(h/a))

Buggy submission (verdict: Runtime Error):
import math

h = float(input())
a = float(input())
 
print(math.ceil(h/a))

Buggy submission (verdict: Runtime Error):
import math

h = int(input())
a = int(input())
 
print(math.ceil(h/a))

Buggy submission (verdict: Runtime Error):
h = int(input())
a = int(input())

return math.ceil(h/a)
Problem p02784 (python)

Fixed submission:
temp = input()
temp = temp.split(' ')
h = int(temp[0])
n = int(temp[1])
a = input().split(' ')

if h <= sum(int(i) for i in a):
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
temp = input()
temp = temp.split(' ')
h = int(temp[0])
n = int(temp[1])
a = input().split(' ')

if h <= sum(int(i) for i in a):
	print('Yes')
else
	print('No')
Problem p02786 (python)

Fixed submission:
import math

h = int(input())

count = 0
while h > 1:
  h = math.floor(h/2)
  count += 1

print(2**count*2-1)

Buggy submission (verdict: Runtime Error):
import math

h = float(input())

count = 1
while(h > 1) {
  h = round(h / 2)
  count+=1
}
print(count)
Problem p03456 (python)

Fixed submission:
import math
num = int(input().replace(" ",""))
# nの平方根を二乗して一致するなら平方根
print("Yes" if num == round(math.sqrt(num)) ** 2 else "No")

Buggy submission (verdict: Runtime Error):
import math
num = int(input().replace(" ",""))
// 平方根にしたものを二倍して一致するかどうかで確認が可能
print("Yes" if num == round(math.sqrt(num)) ** 2 else "No")
Problem p03471 (python)

Fixed submission:
temp = input().split()
n,total = int(temp[0]), int(temp[1])

find = False
for a in range(n+1):
    for b in range(n+1):
        c = (-a) + (-b) + n
        if c >= 0 and a*10000 + b*5000 + c*1000 == total:
            print('{} {} {}'.format(a,b,c))
            find = True
            break
    else:
        continue
    break

if not find:
    print('{} {} {}'.format(-1,-1,-1))

Buggy submission (verdict: Runtime Error):
temp = input().split()
n,total = int(temp[0]), int(temp[1])

for a in range(n):
    for b in range(n):
        for c in range(n):
            if a*10000 + b*5000 + c*1000 == total:
                print(f"{a} {b} {c}")
                break
        else:
            continue
        break
    else:
        continue
    break
Problem p03478 (python)

Fixed submission:
import math

temp = input().split()
n = int(temp[0])
a = int(temp[1])
b = int(temp[2])

def digitsSum(num):
    sum = 0
    while num > 0:
        sum += num % 10
        num = math.floor(num/10)
    return sum

answer = 0
for i in range(1,n+1):
    s = digitsSum(i)
    if a <= s <= b:
        answer += i

print(answer)

Buggy submission (verdict: Runtime Error):
temp = input().split()
n = int(temp[0])
a = int(temp[1])
b = int(temp[2])

def findDigit(int num,int digit):
    while digit > 0 or num <= 0:
      num %= 10
      num /= 10
      digit -= 1
	return num
  
print(findDigit(198,1))
Problem p03493 (python)

Fixed submission:
board =  input()
 
counter = 0
 
if board[0] == "1":
  counter+=1
if board[1] == "1":
  counter+=1
if board[2] == "1":
  counter+=1
  
print(counter)

Buggy submission (verdict: Runtime Error):
board =  input().split()

counter = 0

if board[0] == "1":
  counter++
if board[1] == "1":
  counter++
if board[2] == "1":
  counter++
  
print(counter)
Problem p03657 (python)

Fixed submission:
a, b = map(int, raw_input().split())
if any([x % 3 == 0 for x in [a, b, a+b]]):
    print "Possible"
else:
    print "Impossible"

Buggy submission (verdict: Runtime Error):
a = input() 
b = input()
if (a % 3) * (b % 3) * ((a + b) % 3) == 0:
    print "Possible"
else:
    print "Impossible"
Problem p03597 (python)

Fixed submission:
n=int(input())
a=int(input())
print(n**2-a)

Buggy submission (verdict: Runtime Error):
n = int(intput())
a = int(input())
print(n**2 - a)
Problem p02583 (python)

Fixed submission:
N = int(input())

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

le = len(L)

score = 0

for i in range(le):
    for j in range(i+1,le):
        for k in range(j+1,le):
            if (L[i] + L[j] > L[k] and
                L[i] + L[k] > L[j] and
                    L[k] + L[j] > L[i] ):
                         if (L[i] != L[j] and
                            L[i] != L[k] and
                            L[k] != L[j]):
                                score += 1

print(score)

Buggy submission (verdict: Runtime Error):
for i in range(le):
    for j in range(i+1,le):
        for k in range(j+1,le):
            if (L[i] + L[j] > L[k] and
                L[i] + L[k] > L[j] and
                    L[k] + L[j] > L[i] ):
                         if (L[i] != L[j] and
                            L[i] != L[k] and
                            L[k] != L[j]):
                                score += 1

print(score)