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

Fixed submission:
# -*- coding: utf-8 -*-
import fractions
a,b,c,d = list(map(int,input().split()))

lcm_cd = c*d//fractions.gcd(c,d)

a_div_c = a//c
ac_mod = a%c
bc = b//c

a_div_d = a//d
ad_mod = a%d
bd = b//d

a_div_lcm_cd = a//lcm_cd
alcm_cd_mod = a%lcm_cd
blcm_cd = b//lcm_cd

cnt_c = 0
cnt_d = 0
cnt_lcmcd = 0

cnt_c = (bc-a_div_c)
if not ac_mod:
    cnt_c+=1

cnt_d = (bd-a_div_d)
if not ad_mod:
    cnt_d+=1

cnt_lcmcd = (blcm_cd-a_div_lcm_cd)
if not alcm_cd_mod:
    cnt_lcmcd+=1
print(b-a+1-(cnt_c+cnt_d-cnt_lcmcd))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
a,b,c,d = list(map(int,input().split()))

lcm_cd = c*d//math.gcd(c,d)

a_div_c = a//c
ac_mod = a%c
bc = b//c

a_div_d = a//d
ad_mod = a%d
bd = b//d

a_div_lcm_cd = a//lcm_cd
alcm_cd_mod = a%lcm_cd
blcm_cd = b//lcm_cd

cnt_c = 0
cnt_d = 0
cnt_lcmcd = 0

cnt_c = (bc-a_div_c)
if not ac_mod:
    cnt_c+=1

cnt_d = (bd-a_div_d)
if not ad_mod:
    cnt_d+=1

cnt_lcmcd = (blcm_cd-a_div_lcm_cd)
if not alcm_cd_mod:
    cnt_lcmcd+=1
print(b-a+1-(cnt_c+cnt_d-cnt_lcmcd))
Problem p03061 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

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

from fractions import gcd

l_gcd = [0 for _ in range(n)]
r_gcd = [0 for _ in range(n)]

for i in range(n):
    l_gcd[i]=gcd(l_gcd[i-1],a[i])
for i in range(n-1,-1,-1):
    if i == n-1:
        r_gcd[i]=a[i]
    else:
        r_gcd[i]=gcd(r_gcd[i+1],a[i])
ret = 1

for i in range(n):
    if i==0:
        ret = max(ret,gcd(0,r_gcd[i+1]))
    elif i==n-1:
        ret = max(ret,gcd(l_gcd[i-1],0))
    else:
        ret = max(ret,gcd(l_gcd[i-1],r_gcd[i+1]))
print(ret)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int,input().split()))

from math import gcd

#L_i は、a_0~a_iまでの最大公約数
#R_i は、a_n~a_iまでの最大公約数
#M_i は、a_iを消した場合の最大公約数
L,R,M = [[0 for i in range(n)] for j in range(3)]
L[0] = a[0]
R[n-1] = a[n-1]
for i in range(1,n):
    L[i] = gcd(L[i-1],a[i])
for i in range(n-2,-1,-1):
    R[i] = gcd(R[i+1],a[i])
M[0] = R[1]
M[n-1] = L[n-1]
for i in range(1,n-1):
    M[i] = gcd(L[i-1],R[i+1])
print(max(M))
Problem p03109 (python)

Fixed submission:
a = input()
if a <= "2019/04/30":
  print("Heisei")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a <= "2019/04/30":
  print("Heisei")
else:
  print("TBD")
Problem p03110 (python)

Fixed submission:
a = int(input())
total = 0
for _ in range(a):
    i = input()
    v,c = i.split()
    v = float(v)
    if(c=="BTC"):
        v *= 380000
    total += v
print(total)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
total = 0
for _ in range(a):
    i = input()
    v,c = i.split()
    v = int(v)
    if(c=="BTC"):
        v *= 380000
    total += v
print(total)

Buggy submission (verdict: Runtime Error):
a = int(input())
total = 0
for i in range(a):
    v,c = i.split()
    v = int(v)
    if(c=="BTC"):
        v *= 380000
    total += v
print(total)

Buggy submission (verdict: Runtime Error):
a = int(input())
total = 0
for i in range(a):
    v,c = i.split()[0]
    v = int(v)
    if(c=="BTC"):
        v *= 380000
    total += v
print(total)
Problem p03695 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
an = list(map(int,input().split()))
rate_bucket = [0] * 9
ret = 0
for a in an:
    rate_bucket[min(a//400,8)]+=1
for i in rate_bucket[0:-1:]:
    if i > 0:
        ret+=1
print("{} {}".format(max(ret,1),ret+rate_bucket[-1]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
an = list(map(int,input().split()))
rate_bucket = [0] * 9
ret = 0
for a in an:
    rate_bucket[a//400]+=1
for i in rate_bucket[0:-1:]:
    if i > 0:
        ret+=1
print("{} {}".format(ret,ret+rate_bucket[-1]))
Problem p03828 (python)

Fixed submission:
n = int(input())
#k(2~n)について、2~kの素数までで割り切れる回数をカウント

if n==1:
    print(1)
    import sys
    sys.exit()

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(n)
prime_cnt = dict([(k,0) for k in prime_list])
from decimal import Decimal

for k in range(2,n+1):
    k = Decimal(k)
    for j in prime_list:
        j=Decimal(j)
        while k%j==0:
            prime_cnt[j]+=1
            k = k/j
        if k==1:
            break

import functools
import operator


print(functools.reduce(operator.mul, [v+1 for v in prime_cnt.values()])%(10**9+7))

Buggy submission (verdict: Runtime Error):
n = int(input())
#k(2~n)について、2~kの素数までで割り切れる回数をカウント

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(n)
prime_cnt = dict([(k,0) for k in prime_list])
from decimal import Decimal

for k in range(2,n+1):
    k = Decimal(k)
    for j in prime_list:
        j=Decimal(j)
        while k%j==0:
            prime_cnt[j]+=1
            k = k/j
        if k==1:
            break

import functools
import operator

print(functools.reduce(operator.mul, [v+1 for v in prime_cnt.values()])%(10**9+7))
Problem p03964 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
ta = [list(map(int,input().split())) for i in range(n)]

cur_t = 1
cur_a = 1


def ceil(a, b):
    return a // b + int(a % b != 0)

for t,a in ta:
    if cur_t > t or cur_a > a:
        rate = max([ceil(cur_t,t),ceil(cur_a,a)])
        cur_t = t*rate
        cur_a = a*rate
    else:
        cur_t=t
        cur_a=a
print(cur_t+cur_a)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
ta = [list(map(int,input().split())) for i in range(n)]

cur_t = 1
cur_a = 1


def ceil(a, b):
    return a // b + int(a % b != 0)

for t,a in ta:
    if cur_t > t or cur_a > a:
        rate = ceil(max([cur_t/t,cur_a/a]))
        cur_t = t*rate
        cur_a = a*rate
    else:
        cur_t=t
        cur_a=a
print(cur_t+cur_a)
Problem p02727 (python)

Fixed submission:
X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

red = P[:X]
green = Q[:Y]
ans = sum(red + green)
rg = sorted(red + green)

for i in range(min(C, X+Y)):
    if rg[i] < R[i]:
        ans += R[i] - rg[i]

print(ans)

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

red = P[:X]
green = Q[:Y]
ans = sum(red) + sum(green)

ridx = 0
redidx = -1
greenidx = -1

for i in range(X+Y):
    if (red[redidx] < green[greenidx] and abs(redidx) <= len(red)) or abs(greenidx) > len(green):
        if red[redidx] < R[ridx]:
            ans -= red[redidx]
            ans += R[ridx]
            ridx += 1
            redidx -= 1
    elif (red[redidx] > green[greenidx] and abs(greenidx) <= len(green)) or abs(redidx) > len(red):
        if green[greenidx] < R[ridx]:
            ans -= green[greenidx]
            ans += R[ridx]
            ridx += 1
            greenidx -= 1

    if ridx == len(R):
        break

print(ans)

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

red = P[:X]
green = Q[:Y]
ans = sum(red) + sum(green)

ridx = 0
redidx = -1
greenidx = -1

for i in range(X+Y):
    if red[redidx] < green[greenidx] and abs(redidx) <= len(red):
        if red[redidx] < R[ridx]:
            ans -= red[redidx]
            ans += R[ridx]
            ridx += 1
            redidx -= 1
    elif red[redidx] > green[greenidx] and abs(greenidx) <= len(green):
        if green[greenidx] < R[ridx]:
            ans -= green[greenidx]
            ans += R[ridx]
            ridx += 1
            greenidx -= 1

    if ridx == len(R):
        break

print(ans)
Problem p03106 (python)

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

ans = [i for i in range(1, min(A, B) + 1) if A % i == 0 and B % i == 0]
print(ans[-K])

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

ans = [i for i in range(1, A+1) if A % i == 0 and B % i == 0]
print(ans[K])

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

ans = [i for i in range(1, A+1) if A % i == 0 and B % i == 0]
print(ans[1])
Problem p02952 (python)

Fixed submission:
n=int(input())
c=0
for i in range(1,n+1):
    if len(str(i))%2==1:
        c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
c=0
for i in range(1,n+1):
    if str(i)%2==1:
        c+=1
print(c)
Problem p02603 (python)

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

ans=1000
kabu=0
flag=0

for i in range(n-1):
    if a[i]<a[i+1]:
        if flag <=0:
            kabu=int(ans/a[i])
            ans-=(kabu*a[i])
            #print(a[i],ans,kabu)
        flag=1
    elif a[i]>a[i+1]:
        if flag >0:
            ans+=(kabu*a[i])
            #print(ans)
        flag=-1
    else:
        if flag>0:
            flag=2
        else:
            flag=-2
    if i==(n-2) and flag>0:
        ans+=(kabu*a[i+1])
        #print(a[i+1],ans)

print(ans)

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

ans=1000
kabu=0
flag=0

for i in range(n-1):
    if a[i]<a[i+1]:
        if flag <=0:
            kabu=int(ans/a[i])
            ans-=(kabu*a[i])
            #print(a[i],ans,kabu)
        flag=1
    elif a[i]>a[i+1]:
        if flag >0:
            ans+=(kabu*a[i])
            #print(ans)
        flag=-1
    else:
        if flag>0:
            flag=2
        else:
            flag=-2
    if i==(n-2) and flag>0:
        ans+=(kabu*a[i+1])
        #print(a[i+1],ans)

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

ans=1000
kabu=0
flag=0

for i in range(n-1):
    if a[i]<a[i+1]:
        if flag <=0:
            kabu=int(ans/a[i])
            ans-=(kabu*a[i])
            #print(a[i],ans,kabu)
        flag=1
    elif a[i]>a[i+1]:
        if flag >0:
            ans+=(kabu*a[i])
            #print(ans)
        flag=-1
    else:
        if flag>0:
            flag=2
        else:
            flag=-2
    if i==(n-2) and flag>0:
        ans+=(kabu*a[i+1])
        #print(a[i+1],ans)

print(ans)
Problem p02642 (python)

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

l=[0]*(10**6+1)
ans=0
#print(l)
for i in a:
    if l[i]==0:
        for j in range(i,10**6+1,i):
            l[j]+=1
    else:
        l[i]+=1
for i in a:
    if l[i]==1:
        ans+=1
print(ans)

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

l=[0]*(10**6)
ans=0
#print(l)
for i in a:
    if l[i]==0:
        for j in range(i,10**6,i):
            l[j]+=1
    else:
        l[i]+=1
for i in a:
    if l[i]==1:
        ans+=1
print(ans)

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

a=sorted(a)
cnt=0
for i in range(n):
    if i == 0:
        if a[i] == a[i+1]:
            cnt+=1
        continue
    for j in range(i):
        if i == j:
            continue
        else:
            if (a[i]%a[j])==0:
                cnt+=1
                break
ans=n-cnt
print(ans)
Problem p02660 (python)

Fixed submission:
n=int(input())

import math

def factorization(n): #nを素因数分解する
    arr = []
    temp = n
    for i in range(2, int(math.sqrt(n))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)

    if temp!=1:
        arr.append(1)

#    if arr==[]:
#        arr.append([n, 1])  #n=1でarr=[1,1]としたいとき

    return arr

z=factorization(n)

ans=0
for i in range(len(z)):
    for j in range(1,z[i]+1):
        if (z[i]-j)>=0:
            z[i]-=j
            ans+=1
        else:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy
n=int(input())
cnt=0
a=sympy.divisors(n)

for i in range(1,len(a)):
    if n%a[i]==0:
        cnt+=1
        n=n/a[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
import sympy
n=int(input())
cnt=0
a=sympy.divisors(n)


for i in range(1,len(a)):
    if n%a[i]==0:
        cnt+=1
        n=n/a[i]
print(cnt)
Problem p02681 (python)

Fixed submission:
S=input()
T=input()

t=T[:len(S)]

if(S==t and len(S)<=10 and len(S)>=1 and len(T)==len(S)+1):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n,m,x=(int(i) for i in input().split())
a=[]
c=[]
for i in range(n):
  a.append(list(map(int,input().split())))
  c.append(a[i][0])
  del a[i][0]
  
INF=1001001001
ans=INF

for s in range(1<<n):
  cost=0
  d=[0]*m
  for i in range(n):
    if(s>>i&1):
      cost+=c[i]
      for j in range(m):
        d[j]+=a[i][j]
  ok=True
  for j in range(m):
    if(d[j]<x):
      ok=False
  if ok:
    ans=min(ans,cost)
if ans==INF:
  print(-1)
else:
  print(ans)
Problem p02683 (python)

Fixed submission:
n,m,x=(int(i) for i in input().split())
a=[]
c=[]
for i in range(n):
  a.append(list(map(int,input().split())))
  c.append(a[i][0])
  del a[i][0]
  
INF=1001001001
ans=INF

for s in range(1<<n):
  cost=0
  d=[0]*m
  for i in range(n):
    if(s>>i&1):
      cost+=c[i]
      for j in range(m):
        d[j]+=a[i][j]
  ok=True
  for j in range(m):
    if(d[j]<x):
      ok=False
  if ok:
    ans=min(ans,cost)
if ans==INF:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
A,B,C,K=(int(x) for x in input().split())

if(K<=A+B):
    print(A)
if(K>A+B):
    print(A-(K-A-B))
Problem p02684 (python)

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

s=[]
ordn=[]
for i in range(n+1):
    ordn.append(-1)

v=1
while(ordn[v] == -1):
    ordn[v]=len(s)
    s.append(v)
    v=a[v-1]

c=len(s)-ordn[v]
l=ordn[v]

if k<l:
    print(s[k])
else:
    k -= l
    k%=c
    print(s[l+k])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
town=[1]
cnt=0
loop=0
index=0
while(len(town) <= k):
    town.append(a[town[-1]-1])
    cnt+=1
    index=len(town)-1
    if cnt != index:
        loop = cnt - index
        town.pop(-1)
        break

if k<index:
    print(town[k])
else:
    k-=index
    k%=loop
    print(town[index+k])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
town=[1]
cnt=0
loop=0
index=0
while(len(town) <= k):
    town.append(a[town[-1]-1])
    cnt+=1
    index=town.index(town[-1])
    if cnt != index:
        loop = cnt - index
        town.pop(-1)
        break

if k<index:
    print(town[k])
else:
    k-=index
    k%=loop
    print(town[index+k])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
town=[1]
cnt=0
loop=0
index=0
while(len(town) <= k):
    town.append(a[town[-1]-1])
    cnt+=1
    index=town.index(town[-1])
    if cnt != index:
        loop = cnt - index
        town.pop(-1)
        break

if k<index:
    print(town[k])
else:
    for i in range(0,index):
        town.pop(0)
    print(town[(k-index)%loop])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
town=[1]
cnt=0
loop=0
index=0
while(len(town) <= k):
    town.append(a[town[-1]-1])
    cnt+=1
    index=town.index(town[-1])
    if cnt != index:
        loop = cnt - index
        town.pop(-1)
        break
town2=[]
if k<index:
    print(town[k])
else:
    for i in range(index,len(town)):
        town2.append(town[i])
    print(town2[(k-index)%loop])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
town=[1]
cnt=0
loop=0
index=0
while(len(town) <= 10):
    town.append(a[town[-1]-1])
    cnt+=1
    index=town.index(town[-1])
    if cnt != index:
        loop = cnt - index
        town.pop(-1)
        break
town2=[]
if k<index:
    print(town[k])
else:
    for i in range(index,len(town)):
        town2.append(town[i])
    print(town2[(k-index)%loop])
Problem p03476 (python)

Fixed submission:
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

q=int(input())
l=[]
r=[]
for i in range(q):
    ll,rr=map(int,input().split())
    l.append(ll)
    r.append(rr)

similar=[]
cnt=0
for i in range(10**5+2):
    if i<=2:
        similar.append(0)
    else:
        if is_prime(i)==True and (is_prime((i+1)/2))==True:
            cnt+=1
        similar.append(cnt)

for i in range(q):
    print(similar[r[i]]-similar[l[i]-1])

Buggy submission (verdict: Runtime Error):
q=int(input())
l=[]
r=[]
for i in range(q):
    ll,rr=map(int,input().split())
    l.append(ll)
    r.append(rr)

similar=[]
cnt=0
for i in range(10**5+2):
    if i<=2:
        similar.append(0)
    else:
        if is_prime(i)==True and (is_prime((i+1)/2))==True:
            cnt+=1
        similar.append(cnt)

for i in range(q):
    print(similar[r[i]]-similar[l[i]-1])
Problem p03611 (python)

Fixed submission:
import collections

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

aa=[]

for i in range(n):
    aa.append(a[i]-1)
    aa.append(a[i])
    aa.append(a[i]+1)
ans_list=collections.Counter(aa)
print(ans_list.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
from statistics import mode

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

aa=[]

for i in range(n):
    aa.append(a[i]-1)
    aa.append(a[i])
    aa.append(a[i]+1)

print(aa.count(mode(aa)))
Problem p02641 (python)

Fixed submission:
a = list(map(int,input().split()))
x =a[0]
n =a[1]
if n==0:
  print(x)
else:
  p = list(map(int,input().split()))
  p.sort()
  out_p = []
  for i in range(p[n-1]-p[0]+1):
    if not i+p[0] in p:
      out_p.append(i+p[0])
  if min(p)>x or max(p)<x:
    print(x)
  else:
    re_p =[]
    for j in range(len(out_p)):
      re_p.append(abs(out_p[j]-x))
    if re_p:
      print(out_p[re_p.index(min(re_p))])
    else:
      if abs(max(p)-x)>=abs(min(p)-x):
        print(min(p)-1)
      else:
        print(max(p)+1)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
x =a[0]
n =a[1]
if n==0:
  print(x)
else:
  p = list(map(int,input().split()))
  p.sort()
  out_p = []
  for i in range(p[n-1]-p[0]+1):
    if not i+p[0] in p:
      out_p.append(i+p[0])
  if min(p)>x or max(p)<x:
    print(x)
  else:
    re_p =[]
    for j in range(len(out_p)):
      re_p.append(abs(out_p[j]-x))
    print(out_p[re_p.index(min(re_p))])
Problem p02658 (python)

Fixed submission:
import numpy
n = int(input())
m = list(map(int,input().split()))
s = 1
a = 0
if 0 in m:
  print(0)
  a =1
else:
  for i in range(n):
    s=s*m[i-1]
    if s>10**18:
      print(-1)
      a = 1
      break
if a == 0:
  print(s)

Buggy submission (verdict: Runtime Error):
スコード
m
1
import numpy
2
n = int(input())
3
m = list(map(int,input().split()))
4
s = 1
5
a = 0
6
if 0 in m:
7
  print(0)
8
  a =1
9
else:
10
  for i in range(n):
11
    s=s*m[i-1]
12
    if s>10**18:
13
      print(-1)
14
      a = 1
15
      break
16
if a == 0:
17
  print(s)
※ 512 KiB まで
Problem p02713 (python)

Fixed submission:
import math
k=int(input())
s=0
for p in range(k):
  for q in range(k):
    g=math.gcd(p+1,q+1)
    for i in range(k):
      r=math.gcd(g,i+1)
      s=s+r
print(s)

Buggy submission (verdict: Runtime Error):
import math
k=input()
a=1
b=1
c=1
s=0
for p in range(k):
  b=1
  for q in range(k):
    c=1
    for i in range(k):
      g=math.gcd(a,b)
      g=math.gcd(g,c)
      s=s+g
      c=c+1
    b=b+1
  a=a+1
print(s)
Problem p02882 (python)

Fixed submission:
import math
data = list(map(int,input().split()))
a = data[0]
b = data[1]
x = data[2]

c = a*a*b/2
d = a*a*b-x
if d==0:
  print(0)
else:
  if x>c:
    e = ((d/a)*2)/a
    t = a/e
    print(90-math.degrees(math.atan(t)))
  else:
    f = ((x/a)*2)/b
    t = f/b
    print(90-math.degrees(math.atan(t)))

Buggy submission (verdict: Runtime Error):
import math
data = list(map(int,input().split()))
a = data[0]
b = data[1]
x = data[2]

c = a*a*b/2
d = a*a*b-x
if d=0:
  print(0)
else:
  if x>c:
    e = ((d/a)*2)/a
    t = a/e
    print(90-math.degrees(math.atan(t)))
  else:
    f = ((x/a)*2)/b
    t = f/b
    print(90-math.degrees(math.atan(t)))

Buggy submission (verdict: Runtime Error):
import math
data = list(map(int,input().split()))
a = data[0]
b = data[1]
x = data[2]

c = a*a*b/2
d = a*a*b-x
if x>c:
  e = ((d/a)*2)/a
  t = a/e
  print(90-math.degrees(math.atan(t)))
else:
  f = ((x/a)*2)/b
  t = f/b
  print(90-math.degrees(math.atan(t)))

Buggy submission (verdict: Runtime Error):
import math
data = list(map(int,input().split()))
a = data[0]
b = data[1]
x = data[2]

c = a*a*b/2
d = a*a*b-x
if x>c:
  e = ((d/a)*2)/a
  t = a/e
  print(math.degrees(math.atan(t)))
else:
  f = ((x/a)*2)/b
  t = f/b
  print(90-math.degrees(math.atan(t)))
Problem p02658 (python)

Fixed submission:
import sys
import numpy as np
import functools
import operator
def II(): return int(input())
def LII(): return double(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    #A = [0]*N
    ans = 1
    A= LI()
    
    if A.count(0)>0:
        print(0)
    else:
        for i in range(N):
            ans = ans*int(A[i])
            if ans-1000000000000000000>0:
                print(-1)
                break


        if ans-1000000000000000000<=0:
            print(ans)
    


    


if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import functools
import operator
def II(): return int(input())
def LII(): return double(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    #A = [0]*N
    ans = 1
    A= LI()
    
    if A.count(0)>0:
        print(0)
    else:
        for i in range(N):
            ans = ans*int(A[i])
            if ans/1e+18>1:
                print(-1)
                break


        if ans/1e+18<=1:
            print(ans)
    


    


if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import functools
import operator
def II(): return int(input())
def LII(): return double(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    #A = [0]*N
    ans = 1
    A= LI()
    
    if A.count(0)>0:
        print(0)
    else:
        for i in range(N):
            ans = ans*int(A[i])
            print(ans)
            if ans/1e+18>1:
                print(-1)
                break


        if ans/1e+18<=1:
            print(ans)
    


    


if __name__ == "__main__":
	main()
Problem p02718 (python)

Fixed submission:

NM = input("").split()
A = list(map(int, input().strip().split()))

N = int(NM[0])
M = int(NM[1])
ALL = sum(A)
k = 0
c = ALL/(4*M)

for Ai in A:
    if Ai>=c:
        k += 1

if k >= M:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(NM[0])
M = int(NM[1])
ALL = sum(A)
k = 0
c = ALL/(4*M)

print(N, M, ALL, c)
for Ai in A:
    if Ai>=c:
        k += 1

if k >= M:
    print("Yes")
else:
    print("No")