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

Fixed submission:
import sys
from collections import *
import heapq
import math

import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())

ans=0
# cnt=0
if n==1:
    print(0)
    quit()
for i in range(int(n**0.5)):
    x=(n-(i+1))//(i+1)
    if n//x==n%x:
        ans+=x
    # print(n//cnt,cnt)
print(ans)

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

ans=0
# cnt=0
for i in range(int(n**0.5)):
    x=(n-(i+1))//(i+1)
    if n//x==n%x:
        ans+=x
    # print(n//cnt,cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import *
import heapq
import math

import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())

ans=0
# cnt=0
for i in range(int(n**0.5)):
    x=(n-(i+1))//(i+1)
    if n//x==n%x:
        ans+=x
    # print(n//cnt,cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())

ans=0
# cnt=0
for i in range(int(n**0.5)):
    x=(n-(i+1))//(i+1)
    if n//x==n%x:
        ans+=x
    # print(n//cnt,cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())

ans=0
# cnt=0
for i in range(int(n**0.5)-1):
    if (n-(i+1))%(i+1)==0:
        ans+=(n-(i+1))//(i+1)
    # print(n//cnt,cnt)
print(ans)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
# from functools import reduce
# def gcd_list(numbers):
#     return reduce(math.gcd, numbers)

n=int(input())

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

left=[0]*(n+1)
right=[0]*(n+1)

for i in range(n):
    left[i+1]=gcd(left[i],a[i])
    right[n-i-1]=gcd(right[n-i],a[n-i-1])

# print(left)
# print(right)
last=[0]*n

for i in range(n):
    last[i]=(gcd(left[i],right[i+1]))


print(max(last))

Buggy submission (verdict: Runtime Error):
from fraction import gcd
# from functools import reduce
# def gcd_list(numbers):
#     return reduce(math.gcd, numbers)

n=int(input())

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

left=[0]*(n+1)
right=[0]*(n+1)

for i in range(n):
    left[i+1]=gcd(left[i],a[i])
    right[n-i-1]=gcd(right[n-i],a[n-i-1])

# print(left)
# print(right)
last=[0]*n

for i in range(n):
    last[i]=(gcd(left[i],right[i+1]))


print(max(last))

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

n=int(input())

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

left=[0]*(n+1)
right=[0]*(n+1)

left[1]=a[0]
right[n-1]=a[n-1]

for i in range(1,n):
    left[i+1]=math.gcd(left[i],a[i])
    right[n-1-i]=math.gcd(right[n-i],a[n-i-1])

# print(left)
# print(right)
last=[0]*n
last[0]=right[1]

for i in range(1,n-1):
    last.append(math.gcd(left[i],right[n-i]))

last[n-1]=left[n-1]

print(max(last))

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

n=int(input())

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

left=[0]*(n+1)
right=[0]*(n+1)

left[1]=a[0]
right[n-1]=a[n-1]

for i in range(1,n):
    left[i+1]=math.gcd(left[i],a[i])
    right[n-1-i]=math.gcd(right[n-i],a[n-i-1])

# print(left)
# print(right)
last=[0]*n
last[0]=right[1]

for i in range(1,n-1):
    last.append(math.gcd(left[i],right[n-i]))

last[n-1]=left[n-1]

print(max(last))

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

n=int(input())

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

left=[a[0]]
right=[a[n-1]]
for i in range(n-2):
    left.append(math.gcd(left[i],a[i+1]))
    right.append(math.gcd(right[i],a[n-2-i]))

# print(left)
# print(right)
last=[right[n-2],left[n-2]]

for i in range(n-2):
    last.append(math.gcd(left[i],right[n-3-i]))

print(max(last))
Problem p03081 (python)

Fixed submission:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,q=map(int,input().split())
s=input()
td=[input().split() for i in range(q)]
# print(td)

ll,lr=0,n+1
while lr-ll>1:
    mid=(lr+ll)//2
    for i in range(q):
        if mid==0 or mid==n+1:
            break
        t,d=td[i]
        if s[mid-1]==t:
            if d=="L":
                mid-=1
            else:
                mid+=1
    if mid==0:
        ll=(lr+ll)//2
    else:
        lr=(lr+ll)//2
# print(ll)

ikeru,ikenai=n+1,0
while ikeru-ikenai>1:
    mid=celi(ikeru+ikenai,2)
    for i in range(q):
        if mid==0 or mid==n+1:
            break
        t,d=td[i]
        if s[mid-1]==t:
            if d=="L":
                mid-=1
            else:
                mid+=1
    if mid==n+1:
        ikeru=celi(ikeru+ikenai,2)
    else:
        ikenai=celi(ikeru+ikenai,2)

# print(ikeru)
print(max(0,n-(ll+n+1-ikeru)))

Buggy submission (verdict: Runtime Error):
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,q=map(int,input().split())
s=input()
td=[input().split() for i in range(q)]
# print(td)

ll,lr=0,n+1
while lr-ll>1:
    mid=(lr+ll)//2
    for i in range(q):
        if mid==0:
            break
        t,d=td[i]
        if s[mid-1]==t:
            if d=="L":
                mid-=1
            else:
                mid+=1
    if mid==0:
        ll=(lr+ll)//2
    else:
        lr=(lr+ll)//2
# print(ll)

ikeru,ikenai=n+1,0
while ikeru-ikenai>1:
    mid=celi(ikeru+ikenai,2)
    for i in range(q):
        if mid==n+1:
            break
        t,d=td[i]
        if s[mid-1]==t:
            if d=="L":
                mid-=1
            else:
                mid+=1
    if mid==n+1:
        ikeru=celi(ikeru+ikenai,2)
    else:
        ikenai=celi(ikeru+ikenai,2)

# print(ikeru)
print(max(0,n-(ll+n+1-ikeru)))
Problem p03090 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
inf=float("inf")
n=int(input())
tmp=(n+1)//2*(n-2)
# print(tmp)
if n%2==0:
    print(n*(n-2)//2)
else:
    print(((n-1)*(n-3))//2+n-1)
for i in range(n):
    for j in range(i+1,n):
        if (i+1)+(j+1)!=n+(n+1)%2:
            print(i+1,j+1)

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]
inf=float("inf")
n=int(input())
tmp=(n+1)//2*(n-2)
# print(tmp)
if n%2==0:
    print(N*(N-2)//2)
else:
    print(((N-1)*(N-3))//2+N-1)
for i in range(n):
    for j in range(i+1,n):
        if (i+1)+(j+1)!=n+(n+1)%2:
            print(i+1,j+1)
Problem p03145 (python)

Fixed submission:
abc=list(map(int,input().split()))
abc.sort()
print(abc[0]*abc[1]//2)

Buggy submission (verdict: Runtime Error):
abc=list(map(int,input()))
abc.sort()
print(abc[0]*abc[1])
Problem p03169 (python)

Fixed submission:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
from functools import lru_cache
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

lst=[0]*3
for i in range(n):
    lst[a[i]-1]+=1

dp=[[[0.0]*310 for i in range(310)] for j in range(310)]

for k in range(lst[2]+1):
    for j in range(lst[1]+lst[2]+1-k):
        for i in range(lst[0]+lst[1]+lst[2]+1-k-j):
            if i==j==k==0:
                continue
            tmp=1.0
            if i>0:
                tmp+=dp[i-1][j][k]*i/n
            if j>0:
                tmp+=dp[i+1][j-1][k]*j/n
            if k>0:
                tmp+=dp[i][j+1][k-1]*k/n
            
            tmp*=n/(i+j+k)

            dp[i][j][k]=tmp

print(dp[lst[0]][lst[1]][lst[2]])

Buggy submission (verdict: Runtime Error):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
from functools import lru_cache
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

lst=[0]*3
for i in range(n):
    lst[a[i]-1]+=1

@lru_cache(maxsize=None)
def bfs(one, two, thr):
    if one==two==thr==0:
        return 0
    tmp=1
    if one>0:
        tmp+=bfs(one-1,two,thr)*one/n
    if two>0:
        tmp+=bfs(one+1,two-1,thr)*two/n
    if thr>0:
        tmp+=bfs(one,two+1,thr-1)*thr/n
    
    return tmp*n/(one+two+thr)

print(bfs(lst[0],lst[1],lst[2]))
Problem p03196 (python)

Fixed submission:
n,p=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

lst=factorization(p)
# print(lst)
ans=1
for a,b in lst:
    if b>=n:
        ans*=pow(a,b//n)
print(ans)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
ans=1
for i in range(p+1):
    tmp=pow(i+1,n)
    if tmp>p:
        print(ans)
        break
    if p%tmp==0:
        ans=i+1
Problem p03197 (python)

Fixed submission:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=[int(input()) for i in range(n)]

f="first"
s="second"
for i in range(n):
    if a[i]%2==1:
        print(f)
        break
else:
    print(s)

Buggy submission (verdict: Runtime Error):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=[int(input()) for i in range(n)]

f="first"
s="second"
# print(a)
if sum(a)==n sum(a)==n+1:
    print(f)
    exit()
# print(sum(a)%2)
if sum(a)%2:
    print(f)
else:
    print(s)
Problem p03229 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
a=[int(input()) for i in range(n)]
a.sort()
if n==2:
    print(a[1]-a[0])
    quit()

ans=0
for i in range((n-1)//2):
    ans-=a[i]
for i in range((n-2)//2):
    ans+=a[n-1-i]
ans*=2
if n%2!=0:
    ans+=a[n//2]+a[n//2+1]
else:
    ans+=a[n//2]-a[n//2-1]

ans2=0
for i in range((n-1)//2):
    ans2+=a[n-1-i]
for i in range((n-2)//2):
    ans2-=a[i]
ans2*=2
if n%2!=0:
    ans2-=a[n//2]+a[n//2-1]
else:
    ans2+=a[n//2]-a[n//2+1]

# print(ans)
# print(ans2)

print(max(ans,ans2))

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
a=[int(input()) for i in range(n)]
a.sort()
# b=sorted(a,reverse=True)
c=[0]*n
ans=0
for i in range((n-1)//2):
    ans-=a[i]
for i in range((n-2)//2):
    ans+=a[n-1-i]
ans*=2
if n%2!=0:
    ans+=a[n//2]+a[n//2+1]
else:
    ans+=a[n//2]-a[n//2-1]

ans2=0
for i in range((n-1)//2):
    ans2+=a[n-1-i]
for i in range((n-2)//2):
    ans2-=a[i]
ans2*=2
if n%2!=0:
    ans2-=a[n//2]+a[n//2-1]
else:
    ans2+=a[n//2]-a[n//2+1]

# print(ans)
# print(ans2)

print(max(ans,ans2))
Problem p03238 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
if n==1:
    print("Hello World")
    quit()
a=int(input())
b=int(input())
print(a+b)

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
if n==1:
    print("Hello World")
a=int(input())
b=int(input())
print(a+b)
Problem p03267 (python)

Fixed submission:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

l=int(input())
r=20
while 2**r>l:
    r-=1
anslst=[]
for i in range(2*r):
    lst=[i//2+1, i//2+2, 0]
    if i%2==1:
        lst[2]=2**((i)//2)
    anslst.append(lst)

for i in range(r):
    if l-2**(r-i-1)>=2**r:
        anslst.append([r-i,r+1,l-2**(r-i-1)])
        l-=2**(r-i-1)

print(*[r+1,len(anslst)])
for i in range(len(anslst)):
    print(*anslst[i])

Buggy submission (verdict: Runtime Error):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

l=int(input())
r=20
while 2**r>l:
    r-=1
# print(r)
for i in range(2*r):
    lst=[i//2+1, i//2+2, 0]
    if i%2==1:
        lst[2]=2**((i)//2)
    print(*lst)

for i in range(r):
    if l-2**(r-i-1)>=2**r:
        print(*[r-i,r+1,l-2**(r-i-1)])
    l-=2**(r-i-1)
Problem p03268 (python)

Fixed submission:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
amari=[0]*k
for i in range(n):
    i+=1
    amari[i%k]+=1
# print(amari)

ans=0
for i in range(n):
    i+=1
    am=i%k
    nokori=(k-am)%k
    # print(am,nokori)
    if nokori*2%k==0:
        ans+=amari[nokori]**2
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
amari=[0]*k
for i in range(n):
    i+=1
    amari[i%k]+=1
# print(amari)

ans=0
for i in range(n):
    i+=1
    am=i%k
    nokori=(k-am)%import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
amari=[0]*k
for i in range(n):
    i+=1
    amari[i%k]+=1
# print(amari)

ans=0
for i in range(n):
    i+=1
    am=i%k
    nokori=(k-am)%k
    # print(am,nokori)
    if nokori*2%k==0:
        ans+=amari[nokori]**2
print(ans)
    # print(am,nokori)
    if nokori*2%k==0:
        ans+=amari[nokori]**2
print(ans)
Problem p03280 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
a,b=map(int,input().split())
print((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
vimport sys
def input():
    return sys.stdin.readline()[:-1]
a,b=map(int,input().split())
print((a-1)*(b-1))
Problem p03310 (python)

Fixed submission:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

lst=ruiseki(a)
ans=float('inf')

kirekomi=[1,3]

for i in range(2,n-1):
    while 1:
        if abs(lst[kirekomi[0]]-(lst[i]-lst[kirekomi[0]]))>abs(lst[kirekomi[0]+1]-(lst[i]-lst[kirekomi[0]+1])):
            kirekomi[0]+=1
        else:
            break
    
    while 1:
        if abs((lst[n]-lst[kirekomi[1]])-(lst[kirekomi[1]]-lst[i]))>abs((lst[n]-lst[kirekomi[1]+1])-(lst[kirekomi[1]+1]-lst[i])):
            kirekomi[1]+=1
        else:
            break
    
    # print(kirekomi)
    p=lst[kirekomi[0]]
    q=lst[i]-lst[kirekomi[0]]
    r=lst[kirekomi[1]]-lst[i]
    s=lst[n]-lst[kirekomi[1]]
    anslst=[p,q,r,s]
    ans=min(ans,max(anslst)-min(anslst))
    # print(anslst)
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

lst=ruiseki(a)
ans=float('inf')

kirekomi=[1,3]

for i in range(2,n-1):
    while 1:
        if abs(lst[kirekomi[0]]-(lst[i]-lst[kirekomi[0]]))>abs(lst[kirekomi[0]+1]-(lst[i]-lst[kirekomi[0]+1])):
            kirekomi[0]+=1
        else:
            break
    
    while 1:
        if abs((lst[n]-lst[kirekomi[1]])-(lst[kirekomi[1]]-lst[i]))>abs((lst[n]-lst[kirekomi[1]+1])-(lst[kirekomi[1]+1]-lst[i])):
            kirekomi[1]+=1
        else:
            break
    
    # print(kirekomi)
    p=lst[kirekomi[0]]
    q=lst[i]-lst[kirekomi[0]]
    r=lst[kirekomi[1]]-lst[i]
    s=lst[n]-lst[kirekomi[1]]
    anslst=[p,q,r,s]
    ans=min(ans,max(anslst)-min(anslst))
    # print(anslst)
print(ans)
Problem p03387 (python)

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

if (max(a)-a[0])%2==0 and (max(a)-a[1])%2==0:
    print(int((max(a)*3-sum(a))/2))
elif (a[2]-a[0])%2==1 and (a[2]-a[1])%2==1:
    print(int((max(a)*3-sum(a))/2))
else:
    print(int((max(a)*3-sum(a))/2)+2)

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

if (max(a)-a[0])%2==0 and (max(a)-a[1])%2==0 and (max(a)-a[2])%2==0
    print(int((max(a)*3-sum(a))/2))
else:
    print(int((max(a)*3-sum(a))/2)+2)
Problem p03400 (python)

Fixed submission:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
d,x=map(int,input().split())
a=[int(input()) for i in range(n)]

for i in range(d):
    for j in range(n):
        if i%a[j]==0:
            x+=1

print(x)

Buggy submission (verdict: Runtime Error):
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
from sys import flags
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
from sys import flags
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
d,x=map(int,input().split())
a=[int(input()) for i in range(n)]

for i in range(d):
    for j in range(n):
        if i%a[j]==0:
            x+=1

print(x)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
d,x=map(int,input().split())
a=[int(input()) for i in range(n)]

for i in range(d):
    for j in range(n):
        if i%a[j]==0:
            x+=1

print(x)