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

Fixed submission:
import numpy as np

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

A = np.arange(N)+L

if A[0] <= 0 and A[N-1] >= 0:
    print(np.sum(A))
elif A[0] < 0 and A[N-1] < 0:
    print(np.sum(A)-A[N-1])
else:
    print(np.sum(A)-A[0])

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

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

A = np.arange(N)+L

if A[0] <= 0 and A[N] => 0:
    print(np.sum(A))
elif A[0] < 0 and A[N] < 0:
    print(np.sum(A)-A[N])
else:
    print(np.sum(A)-A[0])

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

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

A = np.arange(N)+L
if A[0] < 0 and A[N] > 0:
    print(np.sum(A))
elif A[0] < 0 and A[N] < 0:
    print(np.sum(A)-A[N])
else:
    print(np.sum(A)-A[0])
Problem p02995 (python)

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

Ans = []

for i in [B,A-1]:
  N = i
  E = (C * D) // gcd(C,D)
  modC = N//C
  modD = N//D
  modE = N//E
  Ans += [N - modC - modD + modE]
  
print(Ans[0]-Ans[1])

Buggy submission (verdict: Runtime Error):
from fractions import gcd
A,B,C,D = map(int,input())
N=B-A+1
print(N-(N//C)-(N//D)+(N//(gcd(C,D))))
Problem p03086 (python)

Fixed submission:
S_list = list(input()) 
S_list = ['1' if i == 'A' or i == 'C' or  i == 'G' or i == 'T' else '0' for i in S_list]
S = ''.join(S_list)
S = S.split('0')
X = 0
for i in range(len(S)):
    if len(S[i]) > X:
        X = len(S[i])
print(X)

Buggy submission (verdict: Runtime Error):
L = ['A','C','G','T']
S = list(input()) 
S = ['1' if ((i in L) == True) else '0' for i in S]
S = ''.join(S_list)
S = S.split('0')
S = [len(i) for i in S]
print(max(S))
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(input())
A = input().split()
print(max(A)-min(A))
Problem p03609 (python)

Fixed submission:
X, t = map(int, input().split())
print(X-t if X > t else 0)

Buggy submission (verdict: Runtime Error):
print(int(input())-int(input()))
Problem p03795 (python)

Fixed submission:
N = int(input())
print(N * 800 - N // 15 * 200)

Buggy submission (verdict: Runtime Error):
#include <stdio.h>

int main(void) {
  int N;
  scanf("%d", &N);
  int x = 800 * N;
  int y = N / 15 *200;
  int ans = x - y;
  printf("%d\n", ans);
  return 0;
}
Problem p02584 (python)

Fixed submission:
X,K,D=(int(x) for x in input().split())
x=abs(X)
a=x//D

b=x-a*D
B=abs(x-(a+1)*D)

if b>B:
  a=a+1

if a>=K:
  print(abs(x-K*D))

else:
  c=K-a
  if c%2 == 0:
    print(abs(x-a*D))
  else:
    d=abs(x-(a-1)*D)
    e=abs(x-(a+1)*D)
    print(min(d,e))

Buggy submission (verdict: Runtime Error):
X,K,D=(int(x) for x in input().split())
x=abs(X)
a=x//D

b=x-a*D
B=abs(x-(a+1)*D)

if b>B:
  a=a+1

if a>=K:
  print(abs(x-K*D))

else:
  c=K-a
  if c%2 == 0:
    print(abs(x-a*D))
  elif:
    d=abs(x-(a-1)*D)
    e=abs(x-(a+1)*D)
    print(min(d,e))
Problem p02621 (python)

Fixed submission:
N=int(input())
print(N+N**2+N**3)

Buggy submission (verdict: Runtime Error):
N=int(input())
print(a+a*a+a*a*a)
Problem p02741 (python)

Fixed submission:
N=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(N[K-1])

Buggy submission (verdict: Runtime Error):
N=list[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(N[K-1])
Problem p02743 (python)

Fixed submission:
import math
a,b,c=(int(x) for x in input().split())

x=c-a-b
if x>0:
  if x*x-4*a*b>0:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import math
a,b,c=(int(x) for x in input().split())

x=c-a-b
if x>0:
  if x*x-4*a*b>0:
    print('Yes')
  else:
    primt('No')
else:
  print('No')
Problem p02838 (python)

Fixed submission:
N = int(input())
 
lis = [0]*60
 
for a in input().split():
    a = int(a)
    for i in range(60):
        lis[i] += a % 2
        a = a//2
ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)
 
print(ans)

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

lis = [0]*60

for a in input().split():
    a = int(a)
    for i,j in range(60):
        lis[i] += a % 2
        a = a//2
ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)

print(ans)
Problem p02900 (python)

Fixed submission:

A,B = map(int,input().split())

#素数列挙
def searchPrimeNum(N):
    max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum



#素因数分解(素数列挙が必要)
def pfact(N):
    plis = searchPrimeNum(int(N**0.5+1))
    ans = 1
    for p in plis:
        if N%p == 0:
            ans += 1
            N = N//p
        while N%p == 0:
            N = N//p
        if N == 1:
            break
    if N != 1:
        ans += 1
    return ans

#互除法(最大公約数)
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

print(pfact(gcd(A,B)))

Buggy submission (verdict: Runtime Error):
https://atcoder.jp/contests/abc142/custom_test
def sieve(n):
    nums = [i+1 for i in range(2, n, 2) if (i+1) % 3 != 0 and (i+1) % 5 !=0] # リスト内包表記で3,5の倍数をはじく
    ans = [2,3,5] # 3,5は素数なので加えてしまう
    while nums[0] <= n**0.5:
        for i in range(nums[0]**2, nums[-1]+1, nums[0]):
            if i in nums: nums.remove(i)
            ans.append(nums.pop(0))
            ans += nums
    return ans


A,B =map(int,input().split())
if A<B:
    A,B =B,A
foo = 1
while foo != 0:
    A,B = B, A%B
    #print(A,B)
    foo = B

foo =A

plis = sieve(1000)
ans = 1
for p in plis:
    if foo%p==0:
        ans += 1
        foo = foo//p
    while foo%p ==0:
        foo = foo//p



plis = sieve(max(7,foo))

for p in plis:
    if  foo % p ==0:
        ans += 1
        foo = foo//p
        if foo < 1:
            break
print(ans)
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(max([a+b,a-b,a*b])
Problem p02947 (python)

Fixed submission:
N = int(input())
dic = {}
plis = [2]
for i in range(3,150):
    s =True
    for p in plis:
        if i%p==0:
            s = False
    if s:
        plis.append(i)
for i in range(N):
    foo = 1
    for j in input():
        j = ord(j) - ord("a")
        foo *= plis[j]
    try:
        dic[foo] += 1
    except:
        dic[foo] = 1
ans = 0
for n in dic.values():
    ans += n*(n-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
dic = {}
plis = [2]
for i in range(3,100):
    s =True
    for p in plis:
        if i%p==0:
            s = False
    if s:
        plis.append(i)
for i in range(N):
    foo = 1
    for j in input():
        j = ord(j) - ord("a")
        foo *= plis[j]
    try:
        dic[foo] += 1
    except:
        dic[foo] = 1
ans = 0
for n in dic.values():
    ans += n*(n-1)//2
print(ans)
Problem p02969 (python)

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

Buggy submission (verdict: Runtime Error):
r = int(input())
print(3*(a**2))
Problem p02995 (python)

Fixed submission:

def gcd(x,y): #x<y
    if x==0:
        return y
    else:
        return gcd(y%x,x)



C,D,A,B =map(int,input().split())
la =[D//A,(C-1)//A]
lb =[D//B,(C-1)//B]
lcm = A*B //gcd(A,B)
lab =[D//lcm,(C-1)//lcm]

ans = la[0] +lb[0] -la[1] -lb[1] -(lab[0]-lab[1])
print(D-C+1-ans)

Buggy submission (verdict: Runtime Error):

import math
C,D,A,B =map(int,input().split())
la =[D//A,(C-1)//A]
lb =[D//B,(C-1)//B]
lcm = A*B //math.gcd(A,B)
lab =[D//lcm,(C-1)//lcm]

ans = la[0] +lb[0] -la[1] -lb[1] -(lab[0]-lab[1])
print(D-C+1-ans)
Problem p03074 (python)

Fixed submission:
N,K =map(int,input().split())
S =input()
lis = [[],[]]
if S[0]=="0":
    lis[1].append(0)
j = S[0]
su = 0
for i in S:
    if i ==j:
        su += 1
    else:
        lis[int(j)].append(su)
        j = i
        su = 1
lis[int(j)].append(su)
if j=="0":
    lis[1].append(0)
if len(lis[0])<=K:
    print(N)
else:
    ans = 0

    ans = sum(lis[0][0:K]) + sum(lis[1][0:K+1])
    foo = ans
    for i in range(len(lis[0])-K):
        foo += lis[0][K+i] -lis[0][i] +lis[1][K+1+i] -lis[1][i]
        if ans < foo:
            ans = foo
    print(ans)

Buggy submission (verdict: Runtime Error):
N,K =map(int,input().split())
S =input()
lis = [[],[]]
if S[0]=="0":
    lis[1].append(0)
j = S[0]
su = 0
for i in S:
    if i ==j:
        su += 1
    else:
        lis[int(j)].append(su)
        j = i
        su = 1
lis[int(j)].append(su)
if j=="0":
    lis[1].append(0)
if len(lis[0])<=K:
    print(N)
else:
    ans = 0

    foo = sum(lis[0][0:K]) + sum(lis[1][0:K+1])
    for i in range(len(lis[0])+1-K):
        foo += lis[0][K+i] -lis[0][i] +lis[1][K+1+i] -lis[1][i]
        if ans < foo:
            ans = foo
    print(ans)
Problem p03106 (python)

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

def euclid(p,q):
  if q == 0:
    return p
  else:
    return euclid(q,p%q)
  
n = euclid(a,b)
count = 0
for i in range(n):
  if n % (n-i)==0:
    count += 1
  if count == k:
    print(n-i)
    break

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

def euclid(p,q):
  if q == 0:
    return p
  else:
    return euclid(q,p//q)
  
n = euclid(a,b)
count = 0
for i in range(n):
  if n % (n-i)==0:
    count += 1
  if count == k:
    print(n-i)
    break
Problem p03129 (python)

Fixed submission:
N,K =[int(i)for i in input().split()]
if 2*K-1 <= N:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N,K =[int(i)for input().split()]
if 2*K-1 <= N:
  print("YES")
else:
  print("NO")
Problem p03142 (python)

Fixed submission:
import queue
N,M =[int(i)for i in input().split()]
adlist =[[]for i in range(N)] #隣接リスト
oyalist =[[]for i in range(N)] #親ノードリスト
for _ in range(N+M-1):
    A,B =[int(i)-1 for i in input().split()]
    adlist[A].append(B)
    oyalist[B].append(A)

iri =[0]*N #入次数のリスト
for i in range(N):
    iri[i] =len(oyalist[i])

topo =[0]*N #トポロジカルソートの番号
tyouten =oyalist.index([]) #頂点
num = 0 #ソート番号
q =queue.Queue()
q.put(tyouten)
topo[tyouten]=num

while num != N-1:
    now = q.get()
    for i in adlist[now]:
        iri[i] -=1
        if iri[i] == 0:
            q.put(i)
            num += 1
            topo[i] =num

#出力
oyalist[tyouten].append(-1)
for i in range(N):
    oyalist[i] =sorted(oyalist[i],key=lambda x:topo[x],reverse=True)
    print(oyalist[i][0]+1)

Buggy submission (verdict: Runtime Error):
N,M =[int(i)for i in input().split()]
oya =[[]for i in range(N)]
ko =[[] for i in range(N)]
for _ in range(N+M-1):
    A,B = [int(i)for i in input().split()]
    oya[B-1].append(A-1)
    ko[A-1].append(B-1)
tyouten =oya.index([])
rank =[[-1,-1]for _ in range(N)]
def keisan(num,no,bef):
    if rank[num][0] < no:
        rank[num]=[no,bef]
    for i in ko[num]:
        keisan(i,no+1,num)

keisan(tyouten,0,-1)
for i in rank:
    print(i[1]+1)

Buggy submission (verdict: Runtime Error):
N,M =[int(i)for i in input().split()]
oya =[[]for i in range(N)]
ko =[[] for i in range(N)]
for _ in range(N+M-1):
    A,B = [int(i)for i in input().split()]
    oya[B-1].append(A-1)
    ko[A-1].append(B-1)
tyouten =oya.index([])
rank =[-1]*N
def keisan(num,no):
    rank[num] =max(rank[num],no)
    for i in ko[num]:
        keisan(i,no+1)

keisan(tyouten,0)

for k,i in enumerate(oya):
    if i ==[]:
        print(0)
    else:
        for j in i:
            if rank[k]==rank[j]+1:
                print(j+1)

Buggy submission (verdict: Runtime Error):
N,M =[int(i)for i in input().split()]
oya =[[]for i in range(N)]
ko =[[] for i in range(N)]
dabu =set()
for i in range(N+M-1):
    A,B = [int(i)for i in input().split()]
    oya[B-1].append(A-1)
    ko[A-1].append(B-1)
    if len(oya[B-1]) > 1:
        dabu.add(B-1)
print(oya,ko)
tyouten =oya.index([])
rank =[-1]*N
def keisan(num,no):
    rank[num] =max(rank[num],no)
    for i in ko[num]:
        keisan(i,no+1)

keisan(tyouten,0)
for k,i in enumerate(oya):
    if i ==[]:
        print(0)
    else:
        for j in i:
            if rank[k]==rank[j]+1:
                print(j+1)
Problem p03241 (python)

Fixed submission:
N,M =[int(i)for i in input().split()]
l=[]
for i in range(1,int(M**0.5+2)):
    if M%i==0:
        if M/i >= N:
            l.append(i)
        if i >= N:
            l.append(M/i)
print(int(max(l)))

Buggy submission (verdict: Runtime Error):
N,M =[int(i)for i in input().split()]
l=[]
for i in range(2,int(M**0.5+1)):
    if M%i==0:
        if M/i >= N:
            l.append(i)
        if i >= N:
            l.append(M/i)
print(max(l))
Problem p02573 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
N, M = map(int, input().split())
ki = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    ki[a-1].append(b-1)
    ki[b-1].append(a-1)
tf = [False for _ in range(N)]

# DFS
def dfs(v):
    global eda
    tf[v] = True
    eda += 1
    for nv in set(ki[v]):
        if not tf[nv]:
            dfs(nv)

ans = 0
for i in range(N):
    if not tf[i]:
        eda = 0
        dfs(i)
        ans = max(ans, eda)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ki = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    ki[a-1].append(b-1)
    ki[b-1].append(a-1)
tf = [False for _ in range(N)]

# DFS
def dfs(v):
    global eda
    tf[v] = True
    eda += 1
    for nv in set(ki[v]):
        if not tf[nv]:
            dfs(nv)

ans = 0
for i in range(N):
    if not tf[i]:
        eda = 0
        dfs(i)
        ans = max(ans, eda)
print(ans)
Problem p02609 (python)

Fixed submission:
# 数のbitに含まれる1の数をカウント
def bitsoncount(x):
    return bin(x).count('1')

def solve(x):
    global ans
    bx = bitsoncount(x)
    if bx == 0:
        return ans
    else:
        ans += 1
        x = x % bx
        solve(x)


N = int(input())
X = input()

Xb = bitsoncount(int(X, 2))
if (Xb - 1) != 0:
    X0 = int(X, 2) % (Xb-1)
X1 = int(X, 2) % (Xb+1)

for x, i in zip(X, reversed(range(N))):
    x = int(x)
    if x == 0:
        temp = (X1 + pow(2, i, Xb+1)) % (Xb+1)
        ans = 1
    else:
        if Xb - 1 == 0:
            print(0)
            continue
        temp = (X0 - pow(2, i, Xb-1)) % (Xb-1)
        ans = 1
    
    solve(temp)
    print(ans)

Buggy submission (verdict: Runtime Error):
# 数のbitに含まれる1の数をカウント
def bitsoncount(x):
    return bin(x).count('1')

def solve(x):
    global ans
    bx = bitsoncount(x)
    if bx == 0:
        return ans
    else:
        ans += 1
        x = x % bx
        solve(x)


N = int(input())
X = input()

Xb = bitsoncount(int(X, 2))
X0 = int(X, 2) % (Xb-1)
X1 = int(X, 2) % (Xb+1)

for x, i in zip(X, reversed(range(N))):
    x = int(x)
    if x == 0:
        temp = (X1 + pow(2, i, Xb+1)) % (Xb+1)
        ans = 1
    else:
        if Xb - 1 == 0:
            print(0)
            continue
        temp = (X0 - pow(2, i, Xb-1)) % (Xb-1)
        ans = 1
    
    solve(temp)
    print(ans)

Buggy submission (verdict: Runtime Error):
# 数のbitに含まれる1の数をカウント
def bitsoncount(x):
    return bin(x).count('1')

def solve(x):
    global ans
    bx = bitsoncount(x)
    if bx == 0:
        return ans
    else:
        ans += 1
        x = x % bx
        solve(x)


N = int(input())
X = input()

Xb = bitsoncount(int(X, 2))
X0 = int(X, 2) % (Xb-1)
X1 = int(X, 2) % (Xb+1)

for x, i in zip(X, reversed(range(N))):
    x = int(x)
    if x == 0:
        temp = (X1 + pow(2, i, Xb+1))
        ans = 1
    else:
        if Xb - 1 == 0:
            print(0)
            continue
        temp = (X0 - pow(2, i, Xb-1))
        ans = 1
    
    solve(temp)
    print(ans)
Problem p02647 (python)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
for _ in range(min(K, 50)):
    B = [0 for k in range(N)]
    for i in range(N):
        l = max(0, i - A[i])
        r = min(N - 1, i + A[i])
        B[l] += 1
        if r + 1 < N:
            B[r+1] -= 1
    # 累積和
    for i in range(1, N):
        B[i] += B[i-1]
    A = B.copy()
   
for b in B:
    print(b, end=" ")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
for _ in range(min(K, 50)):
    for i in range(N):
        l = max(0, i - A[i])
        r = min(N - 1, i + A[i])
        B[l] += 1
        if r + 1 < N:
            B[r+1] -= 1
    # 累積和
    for i in range(1, N):
        B[i] += B[i-1]
    A = B.copy()
   
for b in B:
    print(b, end=" ")
Problem p02683 (python)

Fixed submission:
from itertools import combinations

N, M, X = map(int, input().split())
box = [list(map(int, input().split())) for _ in range(N)]

ans = -1

for j in range(1, N+1):
    for i in combinations(box, j):
        kakaku = 0
        rika = [0 for _ in range(M)]
        for el in i:
            kakaku += el[0]
            for n, k in enumerate(el[1:]):
                rika[n] += k

        if all(p >= X for p in rika):
            if ans == -1:
                ans = kakaku
            else:
                ans = min(kakaku, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [False for _ in range(N)]

i = 1
c = 0
jun = []

if K <= N:
    while True:
        K -= 1
        i = A[i-1]
        if K == 0:
            print(i)
            exit()


while True:
    if i == A[i-1]:
        print(i)
        exit()
    if visited[i-1]:
        lp = i
        break
    else:
        visited[i - 1] = True
        jun.append(i)
        i = A[i-1]
        c += 1
ji = jun.index(lp)
K -= len(jun[:ji])
jun = jun[lp:]

kai = K % c

if kai == len(jun) + 1:
    print(jun[0])
else:
    print(jun[kai-1])
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [False for _ in range(N)]

i = 1
c = 0
jun = []

if K <= N:
    while True:
        K -= 1
        i = A[i-1]
        if K == 0:
            print(i)
            exit()


while True:
    if i == A[i-1]:
        print(i)
        exit()
    if visited[i-1]:
        lp = i
        break
    else:
        visited[i - 1] = True
        jun.append(i)
        i = A[i-1]
        c += 1
ji = jun.index(lp)
K -= len(jun[:ji])
jun = jun[ji:]

kai = K % len(jun)
if kai == len(jun):
    print(jun[0])
else:
    print(jun[kai])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [False for _ in range(N)]

i = 1
c = 0
jun = []

if K <= N:
    while True:
        K -= 1
        i = A[i-1]
        if K == 0:
            print(i)
            exit()


while True:
    if i == A[i-1]:
        print(i)
        exit()
    if visited[i-1]:
        lp = i
        break
    else:
        visited[i - 1] = True
        jun.append(i)
        i = A[i-1]
        c += 1
ji = jun.index(lp)
K -= len(jun[:ji])
jun = jun[lp:]

kai = K % c

if kai == len(jun) + 1:
    print(jun[0])
else:
    print(jun[kai-1])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [False for _ in range(N)]

i = 1
c = 0
jun = []
while True:
    if i == A[i-1]:
        print(i)
        exit()
    if visited[i-1]:
        lp = i
        break
    else:
        visited[i - 1] = True
        jun.append(i)
        i = A[i-1]
        c += 1
ji = jun.index(lp)
K -= len(jun[:ji])
jun = jun[lp:]

kai = K % c

if kai == len(jun) + 1:
    print(jun[0])
else:
    print(jun[kai-1])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [False for _ in range(N)]

i = 1
c = 0
jun = []
while True:
    if visited[i-1]:
        lp = i
        break
    else:
        visited[i - 1] = True
        jun.append(i)
        i = A[i-1]
        c += 1
ji = jun.index(lp)
K -= len(jun[:ji+1])
jun = jun[lp:]

kai = K % c

if len(jun) == 0:
    print(1)
    exit()

if kai == len(jun):
    print(jun[0])
else:
    print(jun[kai])
Problem p02690 (python)

Fixed submission:
X = int(input())

for i in range(1000):
    for j in range(-1000, i):
        if i**5 - j**5 == X:
            print(i, j)
            exit()

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

for i in range(100000):
    A5 = X - i**5
    if (A5**(1/5)).is_integer():
        print(i, -int(A5**(1/5)))
        break
Problem p02882 (python)

Fixed submission:
import math
import sys

a, b, x = map(int, input().split())
maxv = a**2 * b

if maxv == x:
    print(0)
    sys.exit()

if x >= maxv / 2:
    t = 2*b - (2 * x) / a**2
    tan = a / t
    print(90 - math.degrees(math.atan(tan)))
else:
    t = 2*x / (a * b)
    tan = 1 / (b / t)
    print(90 - math.degrees(math.atan(tan)))

Buggy submission (verdict: Runtime Error):
import math

a, b, x = map(int, input().split())
maxv = a**2 * b
if x >= maxv / 2:
    t = 2*b - (2 * x) / a**2
    tan = a / t
    print(90 - math.degrees(math.atan(tan)))
else:
    t = 2*x / (a * b)
    tan = 1 / (b / t)
    print(90 - math.degrees(math.atan(tan)))
Problem p03031 (python)

Fixed submission:
# ABC128 C-Switches

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

k = []
s = []
for _ in range(m):
    ks = list(map(int, input().split()))
    k.append(ks[0])
    s.append(ks[1:])
p = list(map(int, input().split()))

ans = 0
for bits in range(2**n):
    flag = True
    for i in range(m):
        on_sum = 0
        for switch in s[i]:
            on_sum += ((bits >> (switch - 1)) & 1)
        flag = flag and ((on_sum % 2) == p[i])
    if flag:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
# N:スイッチの数、M：電球の数
s = [[] for _ in range(M)]
for i in range(M):
    temp = list(map(int, input().split()))
    s[i] = temp[1:]
p = list(map(int, input().split()))
ans = 0

# bit全探索
for i in range(2 ** N):
    on = [0 for _ in range(N)]
    for j in range(N): 
        if (i >> j) & 1:
            for k in range(N):
                if j+1 in s[k]:
                    on[k] += 1
    tf = []
    for on_n, p_n in zip(on, p):
        if on_n % 2 == p_n:
            tf.append(True)
        else:
            tf.append(False)
    if all(flg for flg in tf):
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
# N:スイッチの数、M：電球の数
s = [[] for _ in range(N)]
for i in range(M):
    temp = list(map(int, input().split()))
    s[i] = temp[1:]
p = list(map(int, input().split()))
ans = 0

# bit全探索
for i in range(2 ** N):
    on = [0 for _ in range(N)]
    for j in range(N): 
        if (i >> j) & 1:
            for k in range(N):
                if j+1 in s[k]:
                    on[k] += 1
    tf = []
    for on_n, p_n in zip(on, p):
        if on_n % 2 == p_n:
            tf.append(True)
        else:
            tf.append(False)
    if all(flg for flg in tf):
        ans += 1

print(ans)