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

Fixed submission:
n=input()
if n[-1]=="3":
    print("bon")
elif (n[-1]=="0")|(n[-1]=="1")|(n[-1]=="6")|(n[-1]=="8"):
    print("pon")
else:
    print("hon")

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

n,m=map(int,input().split())
graph=[[] for _ in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    graph[a-1].append(b-1)#aにはbがつながってる
    graph[b-1].append(a-1)#bにはaがつながってる
#print(graph)

res=[-1]*n
que=deque()
que.append(0)

while len(que)>0:
    i=que.popleft();
    for j in graph[i]:
        if res[j]==-1:
            res[j]=i
            que.append(j)
    #print(que)

print("Yes")
for l in res[1:]:
    print(l+1)
Problem p02684 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
visited={}
for i in range(1,n+1):
    visited[i]=-1
l=[1]
visited[1]=0
i=1
while True:
    if visited[a[l[i-1]-1]]==0:
        roop_start=l.index(a[l[i-1]-1])
        break
    visited[a[l[i-1]-1]]=0
    l.append(a[l[i-1]-1])
    i+=1
roop_dif=i-roop_start

if k<roop_start:
    print(l[k])
else:
    k-=roop_start
    k%=roop_dif
    print(l[roop_start+k])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.insert(0,0)
#print(a)
count=[0,a[1]]
#print(count)
for i in range(2,k+1):
    if a[count[i-1]] in count:
        count.append(a[count[i-1]])
        break
    count.append(a[count[i-1]])
count.pop(0)
#print(count)
f=count.index(count[-1])
d=len(count)-1-f
#print(f,d)
k-=f
k%=d
#print(k)
#print(count[f+k])
if k!=0:
    print(count[f+k-1])
else:
    print(count[f+d-1])
Problem p02714 (python)

Fixed submission:
n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b

for i in range(n):
    for d in range(n):
        j=i+d
        k=j+d
        if k>=n:
            break
        if (s[i]!=s[j]) & (s[j]!=s[k]) & (s[k]!=s[i]):
            ans-=1

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b

for i in range(n):
    for d in range(n):
        j=i+d
        k=j+d
        if k>=n:
            break
        if s[i]!=s[j] & s[j]!=s[k] & s[k]!=s[i]:
            ans-=1

print(ans)
Problem p02761 (python)

Fixed submission:
#https://atcoder.jp/contests/abc157/tasks/abc157_c
n,m=map(int,input().split())
s=[0]*m
c=[0]*m
for i in range(m):
    s[i],c[i]=map(int, input().split())

for num in range(1000):
    if len(str(num))==n:
        digit=[0]*n
        l=n
        k=num
        while l>0:
            digit[l-1]=k%10
            k=k//10
            l-=1
        flag=0
        for j in range(m):
            if digit[s[j]-1]==c[j]:
                flag+=1
        if flag==m:
            print(num)
            exit()
print("-1")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[0]*m
c=[0]*m
for i in range(m):
    s[i],c[i]=map(int, input().split())

for num in range(1000):
    if len(str(num))==n:
        #print(num)
        digit=[0,str(num)[0],str(num)[1],str(num)[2]]
        digit[1]=int(digit[1])
        digit[2]=int(digit[2])
        digit[3]=int(digit[3])
        flag=0
        #print(100*int(digit[1])+10*int(digit[2])+int(digit[3]))
        #print(digit)
        for i in range(m):
            if digit[s[i]]==c[i]:
                flag+=1
        if flag==m:
            print(100*digit[1]+10*digit[2]+digit[3])
            exit()
print("-1")
Problem p02658 (python)

Fixed submission:
import sys

number = int(input())
box = list(map(int,input().split()))

for var in box:
    if var == 0:
        print("0")
        sys.exit()

overflow = 1e18
ans = 1
for var in box:
    if overflow/var < ans:
        print("-1")
        sys.exit()
    ans *= var

if ans <= overflow:
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
numa, numb = input().strip().split()
numa, numb = [int(numa), float(numb)]

numb *= 100
numb = int(numb)
ans = int((numa*numb)/100)
print(ans)

Buggy submission (verdict: Runtime Error):
numa, numb = input().strip().split()
numa, numb = [int(numa), float(numb)]

numb *= 100
numb = int(numb)
ans = int((numa*numb)/100)
print(ans)
Problem p02660 (python)

Fixed submission:
num  = int(input())
#prime number counter
ans = 0
prime_check = [1]*1000100
count = 2
while num>1:
    if prime_check[count]==1: #countが素数だった場合
        tmp = 0
        while num % count == 0: #numの因数にcountが何個含まれているか
            num/= count
            tmp += 1
        tmp2 =1
        while tmp>=tmp2: #ansに加える
            ans += 1
            tmp -= tmp2
            tmp2 += 1
        tmp = count
        while tmp*count<=1e6:
            prime_check[tmp*count] = 0
            tmp += 1
    count += 1
    if(count>1e6):
        num = 0
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
num  = int(input())
#prime number counter
ans = 0
prime_check = [1]*1000100
count = 2
while num>1:
    if prime_check[count]==1: #countが素数だった場合
        tmp = 0
        while num % count == 0: #numの因数にcountが何個含まれているか
            num/= count
            tmp += 1
        tmp2 =1
        while tmp>=tmp2: #ansに加える
            ans += 1
            tmp -= tmp2
            tmp2 += 1
        tmp = count
        while tmp*count<=1e6:
            prime_check[tmp*count] = 0
            tmp += 1
    count += 1

print(ans)
Problem p02641 (python)

Fixed submission:
x, n = map(int,input().split())
p = list(map(int,input().split()))
p_list = [0 for i in range(100)]
n_abs = 1000
ans = 100000

for i in p:
    p_list[i-1] = 1

for i in range(0, 102):
    if i == 0 or i == 101:
        temp_abs = abs(x-i)
        if n_abs > temp_abs:
            n_abs = temp_abs
            ans = i
    else:
        temp_abs = abs(x-i)
        if n_abs > temp_abs and p_list[i-1] != 1:
            n_abs = temp_abs
            ans = i
        elif n_abs == temp_abs and i < ans and p_lsit[i-1] != 1:
            n_abs = temp_abs
            ans = i

print(ans)

Buggy submission (verdict: Runtime Error):
x, n = map(int,input().split())
p = list(map(int,input().split()))
p_list = [0 for i in range(100)]
n_abs = 1000
ans = 100000

for i in p:
    p_list[i-1] = 1

for i in range(0, 102):
    if i == 0:
        temp_abs = abs(x-i)
        if n_abs > temp_abs:
            n_abs = temp_abs
            ans = i
    else:
        temp_abs = abs(x-i)
        if n_abs > temp_abs and p_list[i-1] != 1:
            n_abs = temp_abs
            ans = i
        elif n_abs == temp_abs and i < ans and p_lsit[i-1] != 1:
            n_abs = temp_abs
            ans = i

print(ans)
Problem p02678 (python)

Fixed submission:
import queue

n,m = map(int,input().split())
hen = [[] for i in range(n)]
ans = [0 for i in range(n)]
a,b = 0,0



for i in range(m):
    a,b = map(int,input().split())
    hen[a-1].append(b)
    hen[b-1].append(a)

q = queue.Queue()
q.put(1)

while q.empty() == False:
    head = q.get()
    for h in hen[head-1]:
        if h != 1 and ans[h-1] == 0:
            ans[h-1] = head
            q.put(h)

flag = 0

for i in range(n):
    if i != 0 and ans[i] == 0:
        flag = 1

if flag == 0:
    print('Yes')
    for i in range(n-1):
        print(ans[i+1])
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import queue

n,m = map(int,input().split())
hen = [[] for i in range(m)]
ans = [0 for i in range(n)]
a,b = 0,0

for i in range(m):
    a,b = map(int,input().split())
    hen[a-1].append(b)
    hen[b-1].append(a)

q = queue.Queue()
q.put(1)

while q.empty() == False:
    head = q.get()
    for h in hen[head-1]:
        if h != 1 and ans[h-1] == 0:
            ans[h-1] = head
            q.put(h)

flag = 0

for i in range(n):
    if i != 0 and ans[i] == 0:
        flag = 1

if flag == 0:
    print('Yes')
    for i in range(n-1):
        print(ans[i+1])
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import queue

n,m = map(int,input().split())
hen = [[] for i in range(m)]
ans = [0 for i in range(n)]
a,b = 0,0
max = 0

for i in range(m):
    a,b = map(int,input().split())
    hen[a-1].append(b)
    hen[b-1].append(a)

q = queue.Queue()
q.put(1)

while q.empty() == False:
    head = q.get()
    for h in hen[head-1]:
        if h != 1 and ans[h-1] == 0:
            ans[h-1] = head
            q.put(h)

flag = 0

for i in range(n):
    if i != 0 and ans[i] == 0:
        flag = 1

if flag == 0:
    print('Yes')
    for i in range(max-1):
        print(ans[i+1])
else:
    print('No')
Problem p02744 (python)

Fixed submission:
from collections import deque

q = deque()

q.append('a')

n = int(input())

ans_list = []
flag = 0

if n != 1:
    while flag == 0:
        s = q.pop()
        if len(s) > n:
            flag = 1
        a = list(s)
        x = chr(ord('a')-1)
        a = map(ord,a)
        max_a = max(a)
        while ord(x) != max_a+1:
            x = chr(ord(x)+1)
            y = s + x
            q.appendleft(y)
            if len(y) == n:
                ans_list.append(y)
else:
    ans_list = ['a']

ans_list = sorted(ans_list)

for i in range(len(ans_list)):
    print(ans_list[i])

Buggy submission (verdict: Runtime Error):
q = deque()

q.append('a')

n = int(input())

ans_list = []

if n != 1:
    for i in range(n-1):
        for j in range(2**i):
            s = q.pop()
            a = list(s)
            b = s + chr(ord(a[len(a)-1]))
            q.appendleft(b)
            if i == n-2:
                ans_list.append(b)
            c = s + chr(ord(a[len(a)-1])+1)
            q.appendleft(c)
            if i == n-2:
                ans_list.append(c)
else:
    ans_list = ['a']

ans_list = sorted(ans_list)

for i in range(len(ans_list)):
    print(ans_list[i])
Problem p03029 (python)

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

p1=p+(3*a)

print(p1//2)

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

lamp=[]
switches=[]
temp=[]

for i in range(m):
    temp=list(map(int,input().split()))
    lamp.append(temp.pop(0))
    switches.append(temp)
    temp=[]

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

bit_list=[]

for i in range(2**(n)):
    bit_list.append(bin(i)[2:].zfill(n))

ans = 0

for b in bit_list:
    flag = 0
    sum  = 0
    for s,p in zip(switches,modul):
        for k in range(len(s)):
            sum=sum+int(b[s[k]-1])
        if sum%2 != p:
            flag = 1
            break
    if flag == 0:
        ans=ans+1

print(ans)
Problem p03043 (python)

Fixed submission:
n,k = map(int, input().split())
x=0
i=0
pro=0.0
ans=0.0

for i in range(1,n+1):
    x=i
    j=0
    while x<k:
        j=j+1
        x=x*2
    pro=(1/n)*((1/2)**j)
    ans=ans+pro

print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l_list=[]
r_list=[]

for i in range(m):
    l,r=map(int,input().split())
    l_list.append(l)
    r_list.append(r)

n_card=min(r_list)-max(l_list)+1

if n_card<=0:
    print(0)
else:
    print(n_card)
Problem p03047 (python)

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

print(n-k+1)

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

r_max=n//r
g_max=n//g

sum=0

for i in range((n//r)+1):
    for j in range((n-(i*r)//g)+1):
        if (n-(i*r)-(j*g))%b==0 and (n-(i*r)-(j*g))//b>=0:
            sum=sum+1
        #    print(i*r,j*g,(n-(i*r)-(j*g))%b)

print(sum)
Problem p03074 (python)

Fixed submission:
n, k = map(int,input().split())
s = input()
sento = 0
ketu = 0
tmp = '1'
zeroichi = []
cnt = 0

for i in range(n):
    if tmp == s[i]:
        cnt += 1
    else:
        zeroichi.append(cnt)
        cnt = 1
        tmp = s[i]

zeroichi.append(cnt)

if len(zeroichi)%2 == 0:
    zeroichi.append(0)

if len(zeroichi) == 1:
    zeroichi.append(0)
    zeroichi.append(0)

i = 0
ans = 0
ans_list = []
j = 0
right = min(1+k*2,len(zeroichi))
left = 0

while i != right:
    ans += zeroichi[i]
    i += 1

ans_list.append(ans)

while right != len(zeroichi):
    ans -= zeroichi[left]
    ans -= zeroichi[left+1]
    ans += zeroichi[right]
    ans += zeroichi[right+1]
    ans_list.append(ans)
    left += 2
    right += 2

print(max(ans_list))

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
s = input()
sento = 0
ketu = 0
tmp = '1'
zeroichi = []
cnt = 0

for i in range(n):
    if tmp == s[i]:
        cnt += 1
    else:
        zeroichi.append(cnt)
        cnt = 1
        tmp = s[i]

zeroichi.append(cnt)

if len(zeroichi)%2 == 0:
    zeroichi.append(0)

if len(zeroichi) == 1:
    zeroichi.append(0)
    zeroichi.append(0)

i = 0
ans = 0
ans_list = []
j = 0
right = 1+k*2
left = 0

while i != right:
    ans += zeroichi[i]
    i += 1

ans_list.append(ans)

while right != len(zeroichi):
    ans -= zeroichi[left]
    ans -= zeroichi[left+1]
    ans += zeroichi[right]
    ans += zeroichi[right+1]
    ans_list.append(ans)
    left += 2
    right += 2

print(max(ans_list))
Problem p03085 (python)

Fixed submission:
a = input()

if a == 'A':
    print('T')
elif a == 'T':
    print('A')
elif a == 'C':
    print('G')
elif a == 'G':
    print('C')

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(input())
value=[0]*n
ans_list=[]
length=[]
     
for i in range(len(s)-1):
  value[i+1]=value[i]+(1 if s[i]=='A' and s[i+1]=='C' else 0)
  
for i in range(q):
  l,r=map(int,input().split())
  print(value[r-1]-value[l-1])
Problem p03087 (python)

Fixed submission:
N, Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i : i+2]== 'AC' else 0)
for i in range(Q):
  l, r=map(int,input().split())
  print(t[r-1]-t[l-1])

Buggy submission (verdict: Runtime Error):
N, Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i : i+2]== AC else 0)
for i in range(Q):
  l, r=map(int,input().split())
  print(t[r-1]-t[l-1])
Problem p03448 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k == x:
        ans = ans+1
        
print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(len(a)):
  for j in range(len(b)):
    for k in range(len(c)):
      if a+b+c == x:
        ans = ans+1
        
print(ans)
Problem p03943 (python)

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

if a+b==max(a,b,c) or b+c==max(a,b,c) or c+a==max(a,b,c):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
w,h,n=(int (i) for i in input().split())

w1=0
w2=w
h3=0
h4=h

for i in range(n):
    x,y,a=(int (i) for i in input().split())
    if a==1 and x>w1:
        w1=x
    elif a==2 and x<w2:
        w2=x
    elif a==3 and y>h3:
        h3=y
    elif a==4 and y<h4:
        h4=y

s=(w-w1-(w-w2))*(h-h3-(h-h4))

if s<=0:
    print(0)
else:
    print(s)
Problem p04030 (python)

Fixed submission:
s=input()

output=[]

for i in range(len(s)):
    if s[i]=='0':
        output.append('0')
    elif s[i]=='1':
        output.append('1')
    elif s[i]=='B':
        if len(output)!=0:
            del output[len(output)-1]

for i in range(len(output)):
    print(output[i],end="")

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

output=[]

for i in range(len(s)):
    if s[i]=='0':
        output.append('0')
    elif s[i]=='1':
        output.append('1')
    elif s[i]=='B':
        if len(output)!=0:
            del output[i-1]

for i in range(len(output)):
    print(output[i],end="")
Problem p04044 (python)

Fixed submission:
n,l=(int(x) for x in input().split())

mojil=[]

for i in range(n):
    mojil.append(input())

mojil.sort()

for i in range(n):
    print(mojil[i],end="")

Buggy submission (verdict: Runtime Error):
n,l=(int(x) for x in input().split())

mojil=[]

for i in range(l):
    mojil.append(input())

mojil.sort()

for i in range(l):
    print(mojil[i],end="")
Problem p03136 (python)

Fixed submission:
i=input;i();l=list(map(int,i().split()));print(["No","Yes"][max(l)*2<sum(l)])

Buggy submission (verdict: Runtime Error):
i=input;i();l=i().split();print(max(l)*2<sum(l)and"Yes"or"No")
Problem p02690 (python)

Fixed submission:
X=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
L=make_divisors(X)
Y=False
ans=[]
for x in L:
    a=0
    while True:
        tmp=a**5-(a-x)**5
        if tmp==X:
            Y=True
            ans=[a,a-x]
            break
        if tmp>X and a>int(X**0.2)+1:
            break
        a+=1
        
    if Y:
        break
print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
X=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
L=make_divisors(X)
#print(L)
Y=False
ans=[]
for x in L:
    a=0
    while True:
        tmp=a**5-(a-x)**5
        if tmp==X:
            Y=True
            ans=[a,a-x]
            break
        if tmp>X:
            break
        a+=1
        #print(tmp)
    if Y:
        break
print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
X=int(input())
def PrimeFactor(n):
    ret=[]
    for i in range(2,int(-(-n**0.5//1))+1):
        if i!=2 and i%2==0:
            continue
        cnt=0
        while n%i==0:
            cnt+=1
            n//=i
        if cnt!=0:
            ret.append([i,cnt])
    if n!=1:
        ret.append([n,1])
    return ret
L=PrimeFactor(X)
L.append([1,1])
Y=False
ans=[]
for l in L:
    x=l[0]
    b=-1*x-1
    while True:
        tmp=(b+x)**5-b**5
        if tmp==X:
            Y=True
            ans=[b+x,b]
            break
        if tmp>X and b>0 and b+x>0:
            break
        b+=1
    if Y:
        break
print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
X=int(input())
def PrimeFactor(n):
    ret=[]
    for i in range(2,int(-(-n**0.5//1))+1):
        if i!=2 and i%2==0:
            continue
        cnt=0
        while n%i==0:
            cnt+=1
            n//=i
        if cnt!=0:
            ret.append([i,cnt])
    if n!=1:
        ret.append([n,1])
    return ret
L=PrimeFactor(X)
L.append([1,1])
Y=False
ans=[]
for l in L:
    x=l[0]
    b=-1*x-1
    while True:
        tmp=(b+x)**5-b**5
        if tmp==X:
            Y=True
            ans=[b+x,b]
            break
        if tmp>X and b+x>0:
            break
        b+=1
    if Y:
        break
print(ans[0],ans[1])
Problem p02995 (python)

Fixed submission:
A,B,C,D=map(int,input().split())
E=B-A
import fractions
CD=C*D//fractions.gcd(C, D)
b=B-B//C-B//D+B//CD
A-=1
a=A-A//C-A//D+A//CD
print(b-a)

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
E=B-A
import math
CD=C*D//math.gcd(C, D)
b=B-B//C-B//D+B//CD
A-=1
a=A-A//C-A//D+A//CD
print(b-a)
Problem p02999 (python)

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

Buggy submission (verdict: Runtime Error):
X, A = (int, input().split())
print(10 if X>=A else 0)
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
N=int(input())
G=[[] for i in range(N)]
for _ in range(N-1):
    u,v,w=map(int,input().split())
    G[u-1].append([v-1,w%2])
    G[v-1].append([u-1,w%2])
color=[0 for i in range(N)]
seen=[False for i in range(N)]
color[0]=1
def dps(i):
    seen[i]=True
    for g in G[i]:
        if seen[g[0]]:
            continue
        else:
            if g[1]==0:
                color[g[0]]=color[i]
            else:
                color[g[0]]=color[i]*-1
            dps(g[0])
dps(0)
for i in range(N):
    print(1 if color[i]==1 else 0)

Buggy submission (verdict: Runtime Error):
N=int(input())
G=[[] for i in range(N)]
for _ in range(N-1):
    u,v,w=map(int,input().split())
    G[u-1].append([v-1,w%2])
    G[v-1].append([u-1,w%2])
color=[0 for i in range(N)]
seen=[False for i in range(N)]
color[0]=1
def dps(i):
    seen[i]=True
    for g in G[i]:
        if seen[g[0]]:
            continue
        else:
            if g[1]==0:
                color[g[0]]=color[i]
            else:
                color[g[0]]=color[i]*-1
            dps(g[0])
dps(0)
for i in range(N):
    print(1 if color[i]==1 else 0)
Problem p02641 (python)

Fixed submission:
[x,n] = list(map(int, input().split()))
pList = list(map(int, input().split()))
pSet = set(pList)
step = 0
small = False
big = False
while True:
    if x - step not in pSet:
        small = True
        break
    if x + step not in pSet:
        big = True
        break
    step += 1
if small:
    print(x-step)
else:
    print(x+step)

Buggy submission (verdict: Runtime Error):
import copy
[x,n] = list(map(int, input().split()))
pList = list(map(int, input().split()))
dict = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0,21:0,22:0,23:0,24:0,25:0,26:0,27:0,28:0,29:0,30:0,31:0,32:0,33:0,34:0,35:0,36:0,37:0,38:0,39:0,40:0,41:0,42:0,43:0,44:0,45:0,46:0,47:0,48:0,49:0,50:0,51:0,52:0,53:0,54:0,55:0,56:0,57:0,58:0,59:0,60:0,61:0,62:0,63:0,64:0,65:0,66:0,67:0,68:0,69:0,70:0,71:0,72:0,73:0,74:0,75:0,76:0,77:0,78:0,79:0,80:0,81:0,82:0,83:0,84:0,85:0,86:0,87:0,88:0,89:0,90:0,91:0,92:0,93:0,94:0,95:0,96:0,97:0,98:0,99:0,100:0}
for i in pList:
    dict[i] = 1
goUp = True
goDown = True
run = True
upTar = copy.copy(x)
lowTar = copy.copy(x)
theAns = copy.copy(x)
while run:
    if dict[lowTar] == 0:
        theAns = lowTar
        break
    if dict[upTar] == 0:
        theAns = upTar
        break
    if goUp:
        upTar += 1
    if goDown:
        lowTar -= 1
    if upTar == 100:
        goUp = False
    if lowTar:
        goDown = False
print(theAns)
Problem p02706 (python)

Fixed submission:
NM = list(map(int, input().split()))
N = NM[0]
M = NM[1]
Alist = list(map(int, input().split()))
daysNeeded = sum(Alist)
if daysNeeded>N:
    print(-1)
else:
    print(N - daysNeeded)

Buggy submission (verdict: Runtime Error):
NM = list(map(int, input().split()))
N = NM[0]
M = NM[1]
Alist = []
for i in range(M):
    Alist.append(int(input()))
daysNeeded = sum(Alist)
if daysNeeded>N:
    print(-1)
else:
    print(M - daysNeeded)
Problem p02708 (python)

Fixed submission:
NK = list(map(int, input().split()))
N = NK[0]
K = NK[1]
sumOfAll = 0
for howManyWeChoose in range(K, N+2):
    until = int(N*(N+1)/2 - (N-howManyWeChoose)*(N-howManyWeChoose+1)/2)
    start = int(howManyWeChoose*(howManyWeChoose-1)/2)
    sumOfAll += until-start+1
print(sumOfAll%(7+10**9))

Buggy submission (verdict: Runtime Error):
import operator as op
from functools import reduce
def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return int(numer / denom)
NK = list(map(int, input().split()))
N = NK[0]
K = NK[1]
sumOfAll = 0
oneToNSum = int((N)*(N+1)/2 - 1)
for k in range(K,N+1):
    NCKm1 = ncr(N, K - 1)
    sumOfAll += N * NCKm1 * 10 ^ 100 + NCKm1 * oneToNSum
print(sumOfAll%(7+10^9))
Problem p02910 (python)

Fixed submission:
import numpy as np
S = input()
l = len(S)
oddArr = np.arange(1,l+1,2)
evenArr = np.arange(2,l+1,2)
playable = True
for i in oddArr:
    if S[i-1]=='R' or S[i-1]=='U' or S[i-1]=='D':
        continue
    else:
        playable = False
        break
if playable:
    for i in evenArr:
        if S[i-1] == 'L' or S[i-1] == 'U' or S[i-1] == 'D':
            continue
        else:
            playable = False
            break
if playable:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
S = input()
l = len(S)
oddArr = np.arange(0,l+1,2)
evenArr = np.arange(1,l,2)
playable = True
for i in oddArr:
    if S[i]=='R' or S[i]=='U' or S[i]=='D':
        continue
    else:
        playable = False
        break
if playable:
    for i in evenArr:
        if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
            continue
        else:
            playable = False
            break
if playable:
    print('Yes')
else:
    print('No')