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

Fixed submission:
def InnerRating(N, R):
  if N >= 10:
    return R
  else:
    return R + 100 * (10 - N)
  
N, R = map(int, input().split())
print (InnerRating(N, R))

Buggy submission (verdict: Runtime Error):
def InnerRating(N, R):
  if N >= 10:
    return R
  else:
    return R + 100 * (10 - N)
  
N, R = map(int, input())
print (InnerRating(N, R))
Problem p02612 (python)

Fixed submission:
n = input()

money = 0
if int(n)%1000 == 0:
    print(0)
elif 1000 > int(n):
    ans = 1000 - int(n)
    print(ans)
else:
    money = (int(n[:-3]) + 1)*1000
    ans = money - int(n)
    print(ans)

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

money = 0
if int(n)%1000 == 0:
    print(0)
else:
    money = (int(n[:-3]) + 1)*1000 
    ans = money - int(n)
    print(ans)
Problem p02909 (python)

Fixed submission:
import random

w = input()

if w == "Sunny":
    print("Cloudy")
elif w == "Cloudy":
    print("Rainy")
elif w == "Rainy":
    print("Sunny")

Buggy submission (verdict: Runtime Error):
import random

w = input()

if w == "Sunny":
    print("Cloudy")
elif w == "Cloudy":
    print("Rainy")
elif W == "Rainy":
    print("Sunny")
Problem p02922 (python)

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

ans = 0
outlet = 1

while b > outlet:
    ans = ans + 1
    outlet = outlet + (a-1)
print(ans)

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

ans = 0
outlet = 1

while b > outlet:
    ans = ans + 1
    outlet = outlet + (a-1)
print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

ans = 0
outlet = 1

while B > outlet:
    ans = ans + 1
    outlet = outlet + (A-1)
print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

count = 0

while B > 1 + (A-1)*(count):
    count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

total = 1
count = 0

while B > total:
    count = count + 1
    total = total -1 + A

print(count)
Problem p02934 (python)

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

for i in a:
    ans = ans + 1/i
print(1/ans)

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

for i in a:
    s = s * i

x = int((n-1) * sum(a))

print(s/x)

Buggy submission (verdict: Runtime Error):
from decimal import *
getcontext().prec = 16

n = float(input())
a = list(map(float, input().split()))

s = 1
for i in a:
    s = s * i

x = (n-1)*sum(a)
print(Decimal(s)/Decimal(x))

Buggy submission (verdict: Runtime Error):
from decimal import *


n = float(input())
a = list(map(float, input().split()))

s = 1
for i in a:
    s = s * i

x = (n-1)*sum(a)
print(Decimal(s)/Decimal(x))

Buggy submission (verdict: Runtime Error):
import decimal
n = float(input())
a = list(map(float, input().split()))

s = 1
for i in a:
    s = s * i

x = (n-1)*sum(a))
s = decimal.Decimal(7)
x = decimal.Decimal(7)
print(float(s)/x)

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

s = 1
for i in a:
    s = s * i

x = float((n-1)*sum(a))
print(float(s)/x)

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

s = 1
for i in a:
    s = s * i

x = (n-1)*sum(a)
print(s/x)

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

s = 1
for i in a:
    s = s * i

print(float(s/((n-1)*sum(a))))
Problem p02576 (python)

Fixed submission:
from math import ceil
n, x, t = map(int, input().split())
print(ceil(n/x)*t)

Buggy submission (verdict: Runtime Error):
n, x, t = map(int, input().split())
print(ceil(n/x)*t)

Buggy submission (verdict: Runtime Error):
n, x, t = map(int, input().split())
print(ceil(n/x)*t)
Problem p02719 (python)

Fixed submission:
N , K = map(int , input().split())

mini = N % K

if mini < abs(mini - K):
    mini = mini
else:
    mini = abs(mini - K)

print(mini)

Buggy submission (verdict: Runtime Error):
N , K = map(int , input().split())

mini = N % K

if mini < abs(mini - K):
    mini = mini
else:
    mini = abs(mini - k)

print(mini)
Problem p02756 (python)

Fixed submission:
from collections import deque

S = input()
Q = int(input())
q = deque(S)
fg = False
for i in range(Q):
    que = list(map(str , input().split()))
    if que[0] == "1":
        fg = not fg
    elif (que[1] == "1" and fg == False) or (que[1] == "2" and fg == True) :
        q.appendleft(que[2])
    else:
        q.append(que[2])
if fg:
    q.reverse()
print("".join(q))

Buggy submission (verdict: Runtime Error):
from collections import deque

S = input()
Q = int(input())
q = deque(S)
fg = False

for i in range(Q):
    que = list(map(str , input().split()))
    if que[0] == "1":
        fg = not fg
    elif (que[1] == "1" and fg == False) or (que[1] == "2" and fg == True) :
        q.appendleft(que[2])
    else:
        q.append(que[2])

if not fg:
    q.reverse()

print("".join(q))a

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
fg = False
que2 = []
que2.append(S)

for _ in range(Q+1):
    que = list(map(str, input().split()))
    if que[0] == "1":
        que2.reverse()
    elif que[1] == "1":
        que2.insert(0,que[2])
    elif que[1] == "2":
        que2.append(que[2])
        
ans = "".join(que2)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque

S = input()
Q = int(input())
d = deque(S)
fg = False
for i in range(Q):
    que = list(map(str , input().split()))
    if que[0] == "1":
        fg = True
    elif (que[1] == "1" and fg == False) or (que[1] == "2" and fg == True) :
        q.appendleft(que[2])
    else:
        q.append(que[2])
if fg:
    q.reverse()
print("".join(q))

Buggy submission (verdict: Runtime Error):
from collections import deque

S = input()
Q = int(input())
L = ""
R = ""
flag = 0

for i in range(Q):
    q = list(map(str , input().split()))
    if q[0] == "1":
        if flag == 0:
            flag = 1
        else:
            flag = 0
    else:
        if q[1] == "1":
            if flag == 0:
                L.append(q[2])
            else:
                R.append(q[2])
        else:
            if flag == 0:
                R.appned(q[2])
            else:
                L.append(q[2])
K = L[::-1] + R

if flag == 0:
    print("".join(K))
else:
    print("".join(K[::-1]))

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
que2 = []
que2.append(S)

for _ in range(Q):
    que = list(map(str, input().split()))
    if que[0] == "1":
        que2.reverse()
    elif que[1] == "1":
        que2.insert(0,que[2])
    elif que[1] == "2":
        que2.apend(que[2])
print(que2)
Problem p03280 (python)

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

print((A -1) * (B - 1))

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

for i in range(1, n + 1, 2):
    count2 = 0

    for j in range(1, i + 1):
        if i % j == 0:
            count2 += 1

    if count2 == 8:
        count1 += 1

print(count1)
Problem p03308 (python)

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

print(max(A) -  min(A))

Buggy submission (verdict: Runtime Error):
N  = (int(i) for i in input().split())
A = list(int(i) for i in range(input().split(),N))

print(max(A) -  min(A))
Problem p02778 (python)

Fixed submission:
S = input()
print('x'*len(S))

Buggy submission (verdict: Runtime Error):
print('x'*len(input())
Problem p02848 (python)

Fixed submission:
N = int(input())
S = input()
ans =[]
for s in S:
    c = ord(s)+N
    if c > 90:
        c -= 26
    ans.append(chr(c))
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
ans: list =[]
for s in S:
    c = ord(s)+N
    if c > 90:
        c -= 26
    ans.append(chr(c))
print(''.join(ans))
Problem p02658 (python)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
if 0 in a:
    print(0)
else:

    ans = 1
    for i in a:
        ans *= i
        if ans > pow(10,18):
            ans = -1
            break
    print(ans)

Buggy submission (verdict: Runtime Error):
ans = 1
for i in a:
    ans *= i
    if ans > pow(10,18):
        print(-1)
        break
print(ans)
Problem p02683 (python)

Fixed submission:
n,m,x = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(n)]
c = [ca[i][0] for i in range(n)]
a = [ca[i][1:] for i in range(n)]
l = 0
ans = sum(c) 
for i in range(2 ** n):
    get = [0] * m
    kari = 0
    for j in range(n):
        if (i >> j) & 1: #i(ex.5)を2進数(ex.101)に一桁ずつ変換
            get = [x + y for (x, y) in zip(get, a[j])]
            kari += c[j]
    #print(get,kari)
    #print([k >= x for k in get])
    if all([k >= x for k in get]):
        ans = min(ans,kari)
        l += 1
if l == 0:
    ans = -1
    
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(n)]
c = [ca[i][0] for i in range(n)]
a = [ca[i][1:] for i in range(n)]

price = sum(c)
l =0

for i in range(2**m):
    kari = 0
    skill = [0]*m
    for j in range(m):
        if (i>>j) & 1:
            skill = [x + y for(x,y) in zip(skill,a[j]) ]
            kari += c[j]
    if all([z >= x for z in skill]):
        price = min(price, kari)
        l += 1

if l == 0:
    print(-1)
else:
    print(price)

Buggy submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(n)]
c = [ca[i][0] for i in range(n)]
a = [ca[i][1:] for i in range(n)]
l = 0
ans = sum(c) 
for i in range(2 ** n):
    get = [0] * m
    kari = 03 
    for j in range(n):
        if (i >> j) & 1: #i(ex.5)を2進数(ex.101)に一桁ずつ変換
            get = [x + y for (x, y) in zip(get, a[j])]
            kari += c[j]
    #print(get,kari)
    #print([k >= x for k in get])
    if all([k >= x for k in get]):
        ans = min(ans,kari)
        l += 1
if l == 0:
    ans = -1
    
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(n)]
c = [ca[i][0] for i in range(n)]
a = [ca[i][1:] for i in range(n)]
l = 0
for i in range(2 ** n):
    ans = sum(c)
    get = [0] * m
    kari = 0
    for j in range(n):
        if (i >> j) & 1:　#i(ex.5)を2進数(ex.101)に一桁ずつ変換
            get = [x + y for (x, y) in zip(get, a[j])]
            kari += c[j]
    if all([z >= x for z in get]):
        ans = min(ans,kari)
        l += 1
if l == 0:
    ans = -1

print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
ca = [list(input().split()) for _ in range(n)]
c = [ca[i][0] for i in range(n)]
a = [ca[i][1:] for i in range(n)]
l = 0
for i in range(2 ** n):
    get = [0] * m
    kari = 0
    for j in range(n):
        if (i >> j) & 1:
            get = [x + y for (x, y) in zip(ab, a[j])]
            kari += c[j]
    if all([z >= x for z in get]):
        ans = min(ans,kari)
        l += 1
if l == 0:
    ans = -1

print(ans)
Problem p02687 (python)

Fixed submission:
s = input()
if s =="ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
s = imput()
if s =="ABC":
    print("ARC")
else:
    print("ARC")
Problem p02696 (python)

Fixed submission:
import math
a,b,n = map(int,input().split())
if n <= b-1:
    print(math.floor(a*n/b))
else:
    print(math.floor(a*(b-1)/b))

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
m = 100
count = 0
while(m<x):
    m += math.floor(m/100)
    count += 1
print(count)
Problem p02705 (python)

Fixed submission:
import math
r = int(input())
print(2*math.pi*r)

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

ans = n
for i  in range(len(a)):
    ans -= a[i]
    
if ans < 0:
        print(-1)
else:
        print(ans)

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

ans = n
for i  in range(len(a)):
    ans -= a[i]
    
if ans < 0:
        print(-1)
else:
        print(ans)
Problem p02717 (python)

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

print("{} {} {}".format(c,a,b))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print("{}{}{}".format(c,a,b)
Problem p02612 (python)

Fixed submission:
import sys


N = input()
    

N_in = int(N)

if N_in>10000 or N_in<0:
    print('error')
    sys.exit()

N = N_in/1000;

N_f = float(N)

N_i = int(N)


if (N_f - N_i) == 0:
    Ans = 0
    print(Ans)

else:
    N_i = N_i + 1
    Ans = N_i*1000 - N_in
    print(Ans)

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

N = N.splitlines()

N_num = int(N[0])

AC_num = 0
WA_num = 0
TLE_num = 0
RE_num = 0

for i in range(N_num):
    #print(i+1)
    
    if 'AC' == N[i+1]:
        AC_num += 1
        #print(AC_num)
    
    elif 'WA' == N[i+1]:
        WA_num += 1
        #print(WA_num)

    elif 'TLE' == N[i+1]:
        TLE_num += 1
        #print(TLE_num)
    
    else 'RE' == N[i+1]:
        RE_num += 1
        #print(RE_num)


print('AC x {}'.format(AC_num))
print('WA x {}'.format(WA_num))
print('TLE x {}'.format(TLE_num))
print('RE x {}'.format(RE_num))
Problem p02675 (python)

Fixed submission:

N = input()

N = list(N)

if N[len(N)-1] == '3':
    print('bon')

elif N[len(N)-1] == '0' or N[len(N)-1] == '1' or N[len(N)-1] == '6' or N[len(N)-1] == '8':
    print('pon')
    
else:
    print('hon')

Buggy submission (verdict: Runtime Error):
def main():
    
    
    A, B = map(float,input().split())
    
    if A == 0:
        return 0

    else:
        AB = A*(B*100)
        
        if AB > 1e18:
            return -1
        
        else:
            return int(AB/100)
        
    
print(main())
Problem p02690 (python)

Fixed submission:
def resolve():
    X = int(input())
    for a in range(-200, 201):
        for b in range(-200, 201):
            if a**5 - b**5 == X:
                print(a, b)
                return
    assert False


if '__main__' == __name__:
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    X = int(input())
    powered = set()
    for i in range(100):
        powered.add(i**5)
    for b in powered:
        if X+b in powered:
            a = int((b+X)**(1/5))
            b = int(b**(1/5))
            print(a, b)
            return
        if X-b in powered:
            a = int((b+X)**(1/5))
            b = -int(b**(1/5))
            print(a, b)
            return
            
    assert False


if '__main__' == __name__:
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    X = int(input())
    b = 0
    while b < 10**6:
        a = (X-(b**5))**(1/5)
        if a.is_integer():
            print(int(a), b)
            return
        b += 1
    raise Exception("NOT FOUND")


if '__main__' == __name__:
    resolve()
Problem p02882 (python)

Fixed submission:
import math
def resolve():
    a, b, x = list(map(int, input().split()))
    if (a**2)*b/2 > x:
        print(90-math.degrees(math.atan(2*x/((b**2)*a))))
    else:
        if x == (a**2)*b:
            print(0)
        else:
            print(90-math.degrees(math.atan(a**3/(2*(a**2)*b-2*x))))
    

if '__main__' == __name__:
    resolve()

Buggy submission (verdict: Runtime Error):
import math
def resolve():
    a, b, x = list(map(int, input().split()))
    if (a**2)*b/2 > x:
        print(90-math.degrees(math.atan(2*x/((b**2)*a))))
    else:
        print(90-math.degrees(math.atan(a**3/(2*(a**2)*b-2*x))))
    

if '__main__' == __name__:
    resolve()
Problem p02900 (python)

Fixed submission:
def is_prime(n):
    if n == 2 or n == 3: return True
    if n < 2 or n%2 == 0: return False
    if n < 9: return True
    if n%3 == 0: return False
    r = int(n**0.5)
    f = 5
    while f <= r:
        if n%f == 0: return False
        if n%(f+2) == 0: return False
        f +=6
    return True  

def divisors(n):
    lower_divs , upper_divs = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divs.append(i)
            if i != n // i:
                upper_divs.append(n//i)
        i += 1
    return lower_divs + upper_divs[::-1]

def resolve():
    A, B = list(map(int, input().split()))
    divs = divisors(A)
    i = 1
    cnt = 0
    while i < len(divs):
        if B%divs[i]==0 and is_prime(divs[i]):
            cnt += 1
        i += 1
    print(cnt+1)
    

if '__main__' == __name__:
    resolve()

Buggy submission (verdict: Runtime Error):
def is_prime(n):
    if n == 2 or n == 3: return True
    if n < 2 or n%2 == 0: return False
    if n < 9: return True
    if n%3 == 0: return False
    r = int(n**0.5)
    f = 5
    while f <= r:
        if n%f == 0: return False
        if n%(f+2) == 0: return False
        f +=6
    return True  

def resolve():
    A, B = list(map(int, input().split()))
    import sympy
    divs = sympy.divisors(A)
    i = 1
    cnt = 0
    while i < len(divs):
        if B%divs[i]==0 and is_prime(divs[i]):
            cnt += 1
        i += 1
    print(cnt+1)
    

if '__main__' == __name__:
    resolve()
Problem p02924 (python)

Fixed submission:
def resolve():
    N = int(input())
    print(int(N*(N-1)//2))



if '__main__' == __name__:
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    ary = [N] + list(range(1, N))
    print(N*(N-1)//2)



if '__main__' == __name__:
    resolve()
Problem p03005 (python)

Fixed submission:
def resolve():
    (N, K) = list(map(int, input().split(" ")))
    if K == 1:
        print(0)
    else:
        print((N-K))

if '__main__' == __name__:
    resolve()

Buggy submission (verdict: Runtime Error):
from collections import deque
def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    pos = []
    neg = []
    for a in As:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)
    pos = deque(sorted(pos))
    neg = deque(sorted(neg))
    x = 0
    y = 0
    ops = []
    while True:
        if len(pos) > 0 and len(neg) > 0:
            if len(pos) > len(neg):
                x = neg.popleft()
                y = pos.pop()
            else:
                x = pos.pop()
                y = neg.popleft()
        elif len(pos) > 1 and len(neg) == 0:
                x = pos.popleft()
                y = pos.pop()
        elif len(neg) > 1 and len(pos) == 0:
                x = pos.pop()
                y = pos.popleft()
        else:
            raise Exception("Unreachable?")
        
        ops.append("{} {}".format(x, y))
        xmy = x - y

        if len(pos) == 0 and len(neg == 0):
            print(xmy)
            break

        if xmy >= 0:
            pos.append(xmy)
        else:
            neg.appendleft(xmy)
        
    [print(i) for i in ops]

if '__main__' == __name__:
    resolve()
Problem p03014 (python)

Fixed submission:
def resolve():
    (H, W) = list(map(int, input().split(" ")))
    S = [list(input()) for i in range(H)]
    L = [[0 for _ in range(W)] for _ in range(H)]
    R = [[0 for _ in range(W)] for _ in range(H)]
    U = [[0 for _ in range(W)] for _ in range(H)]
    D = [[0 for _ in range(W)] for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if S[i][j] == "#":
                continue
            L[i][j] = L[i][j-1]+1 if j > 0 else 1
    for i in range(H-1, -1, -1):
        for j in range(W-1, -1 ,-1):
            if S[i][j] == "#":
                continue
            R[i][j] = R[i][j+1]+1 if j < W-1 else 1
    for i in range(H-1, -1, -1):
        for j in range(W):
            if S[i][j] == "#":
                continue
            D[i][j] = D[i+1][j]+1 if i < H-1 else 1
    for i in range(H):
        for j in range(W-1, -1 ,-1):
            if S[i][j] == "#":
                continue
            U[i][j] = U[i-1][j]+1 if i > 0 else 1
    ans = 0
    for i in range(H):
        for j in range(W):
            ans = max(ans, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

    print(ans)

if '__main__' == __name__:
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    (N, M) = list(map(int, input().split(" ")))
    As = [int(input()) for i in range(M)]

    cnts = [False] * (N+1)
    for i in range(N+1):
        c = 0
        if i in As:
            c = 0
        elif i == 0:
            c = 1
        elif i == 1:
            c = 1
        elif i == 2:
            c = 2 if 1 not in As else 1
        else:
            c = (cnts[i-2] + cnts[i-1])%1000000007
        cnts[i] = c

    print(cnts[N])

if '__main__' == __name__:
    resolve()
Problem p03061 (python)

Fixed submission:
import math
from fractions import gcd
from functools import reduce
def gcds(*numbers):
    return reduce(gcd, numbers)

def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    
    left = [0] * (N + 1)
    right = [0] * (N + 1)
    for i in range(N):
        left[i + 1] = (gcd(left[i],As[i]))
        right[N - 1 - i] = (gcd(right[(N - 1) - i + 1], As[(N - 1) - i]))

    gcdmax = 0
    for i in range(N):
        gcdmax = max(gcdmax, gcd(left[i], right[i+1]))
    return gcdmax

if '__main__' == __name__:
    print(resolve())

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcds(*numbers):
    return reduce(math.gcd, numbers)

def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    if N == 2:
        return max(As)

    gcdmax = 0
    for i in range(N):
        if i == N-1:
            gcd = gcds(*As[:i])
        else:
            gcd = gcds(*As[:i], *As[i+1:])
        gcdmax = max(gcdmax, gcd)

    return gcdmax

if '__main__' == __name__:
    print(resolve())

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcds(*numbers):
    return reduce(math.gcd, numbers)

def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    if N == 2:
        return max(As)

    gcdmax = 0
    for i in range(N):
        gcd = gcds(*As[:i], *As[i+1:])
        gcdmax = max(gcdmax, gcd)

    return gcdmax

if '__main__' == __name__:
    print(resolve())