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

Fixed submission:
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))



n=input1()

for i in range(int(math.sqrt(n)) +1,-1,-1):
	if n%i==0: #iがnの約数
		print((i-1) + (n//i -1))
		break

Buggy submission (verdict: Runtime Error):
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))



n=input1()

for i in range(int(math.sqrt(n)) +1,-1,-1):
	if n%i==0: #iがnの約数
		print((i-1) + (n//i -1))
Problem p02948 (python)

Fixed submission:
from math import factorial as fact
import math
import sys
from itertools import product
import numpy as np
from collections import Counter
import datetime
from collections import deque
from bisect import bisect_left, bisect_right
import heapq



#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


n,m=input2()
AB=[[] for _ in range(m)]


for i in range(n):
	a,b=input2()
	if a-1 < m: #報酬受取日がmを超える仕事は除外する
		AB[a-1].append(-b) #heapqの仕様のため，-を追加

ans=0
heap=[]
for i in range(m):
	for b in AB[i]:
		heapq.heappush(heap,b)
	#最大値をheapから取り出し
	if len(heap)>0:
		MAX=heapq.heappop(heap)
		ans+= -MAX
print(ans)

Buggy submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

n,m=input2()
AB=[[] for _ in range(m)]


for i in range(n):
	a,b=input2()
	if a-1 < m: #報酬受取日がmを超える仕事は除外する
		AB[a-1].append(-b) #heapqの仕様のため，-を追加

ans=0
heap=[]
for i in range(m):
	for b in AB[i]:
		heapq.heappush(heap,b)
	#最大値をheapから取り出し
	if len(heap)>0:
		MAX=heapq.heappop(heap)
		ans+= -MAX
print(ans)
Problem p02570 (python)

Fixed submission:
d, t, s = map(int, input().split())
if d<=t*s:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
d t s = map(int, input().split())
if d<=t*s:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
d t s = map(int, input().split())
if d<t*s:
  print('Yes')
else:
  print('No')
Problem p02572 (python)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
s=[0]*(n-1)
tmp=0
for i in range(n-1):
    tmp=(tmp+a[(i+1)*-1])%(10**9+7)
    s[(i+1)*-1]=tmp
    
print(int((s*a[:-1]%(10**9+7)).sum()%(10**9+7)))

Buggy submission (verdict: Runtime Error):
a=input()
a = np.array(list(map(int, input().split())))
count=1
tmp=0
for i in a[:-1]:
    tmp=(tmp+i*(a[count:]).sum())%(10**9+7)
    count+=1
print(tmp)
Problem p02688 (python)

Fixed submission:
n,k = list(map(int,input().split()))
a=[]
d=[]
c=0
for i in range(k):
    d+=[int(input())]
    a+=list(map(int,input().split()))
    
for i in range(1,n+1):
    if i in a:
        continue
    else:
        c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n,k = list(map(int,input().split()))
a=[]
d=[]
c=0
for i in range(n-1):
    d+=[int(input())]
    a+=list(map(int,input().split()))
    
for i in range(1,n+1):
    if i not in a:
        c+=1
print(c)
Problem p02707 (python)

Fixed submission:
import collections
a = int(input())
num = list(map(int,input().split()))
c = collections.Counter(num)
list(map(lambda x: print(c[x]), range(1,a+1)))

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
num = np.array(list(map(int,input().split())))
for i in range(1,a+1):
    print(len(num[num==i])
Problem p02725 (python)

Fixed submission:
import numpy as np
 
tmp =list(map(int, input().split()))
num=list(map(int, input().split()))

num.append(num[0]+tmp[0])

print(np.diff(num).sum()-np.diff(num).max())

Buggy submission (verdict: Runtime Error):
import numpy as np
 
tmp =list(map(int, input().split()))
num=list(map(int, input().split()))
 
a[a>int(tmp[0]//2)]=a[a>int(tmp[0]//2)]-int(tmp[0]//2)
print(sum(a))

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

tmp =list(map(int, input().split()))
num=list(map(int, input().split()))

a[a>int(tmp[0]//2)]=np.abs(a[a>int(tmp[0]//2)]-int(tmp[0]//2))

print(sum(a))
Problem p02729 (python)

Fixed submission:
import math

nums = map(int,input().split())

ans=0
for n in nums:
    if n<2:
    	continue
    ans+=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
print(ans)

Buggy submission (verdict: Runtime Error):
import math

nums = map(int,input().split())

ans=0
for n in nums:
    ans+=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
print(ans)
Problem p02754 (python)

Fixed submission:
n,a,b=map(int, input().split())
tmp = n%(a+b)
if tmp>a:
    tmp = a
print((n//(a+b))*a+tmp)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int, input().split())
tmp = 0
if n%a+b>a:
    tmp = a
else
    tmp = n%a+b
print((n//(a+b))*a+tmp)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int, input().split())
tmp = 0
if n%a+b>a:
    tmp = a
else:
    tmp = 0
print((n//(a+b))*a+tmp)
Problem p02759 (python)

Fixed submission:
x = int(input())
div, mod = divmod(x, 2)
if mod:
  div += 1
print(div)

Buggy submission (verdict: Runtime Error):
import math
print(ceil(int(input()) / 2))
Problem p03013 (python)

Fixed submission:
# 1 <= N <= 10 ** 5
# 0 <= M <= N − 1
# 1 <= a <= N - 1
N, M = map(int, input().split())

memo = {1: 1, 0: 1}
for i in range(2, int(10**5) + 1):
  memo[i] = memo[i-1] + memo[i-2]


stairs = [False for _ in range(N + 1)]
pattern = 1
prev = 0
for _ in range(M):
  a = int(input())
  sub = a - prev - 1
  if sub == -1:
    print(0)
    break
  pattern *= memo[sub]
  prev = a + 1
else:
  sub = N - prev
  pattern *= memo[sub]
  print(pattern % 1000000007)

Buggy submission (verdict: Runtime Error):
# 1 <= N <= 10 ** 5
# 0 <= M <= N − 1
# 1 <= a <= N - 1
import sys
sys.setrecursionlimit(100000)
N, M = map(int, input().split())

memo = {1: 1, 0: 1}
def fibo(n):
  if n in memo:
    return memo[n]
  else:
    num = fibo(n - 1) + fibo(n - 2)
    memo[n] = num
    return num


stairs = [False for _ in range(N + 1)]
pattern = 1
prev = 0
for _ in range(M):
  a = int(input())
  sub = a - prev - 1
  if sub == -1:
    print(0)
    break
  pattern *= fibo(sub)
  prev = a + 1
else:
  sub = N - prev
  pattern *= fibo(sub)

  print(pattern % 1000000007)

Buggy submission (verdict: Runtime Error):
# 1 <= N <= 10 ** 5
# 0 <= M <= N − 1
# 1 <= a <= N - 1
import sys
sys.setrecursionlimit(10000)
N, M = map(int, input().split())

memo = {1: 1, 0: 1}
def fibo(n):
  if n in memo:
    return memo[n]
  else:
    num = fibo(n - 1) + fibo(n - 2)
    memo[n] = num
    return num


stairs = [False for _ in range(N + 1)]
pattern = 1
prev = 0
for _ in range(M):
  a = int(input())
  sub = a - prev - 1
  if sub == -1:
    print(0)
    break
  pattern *= fibo(sub)
  prev = a + 1
else:
  sub = N - prev
  pattern *= fibo(sub)

  print(pattern % 1000000007)

Buggy submission (verdict: Runtime Error):
# 1 <= N <= 10 ** 5
# 0 <= M <= N − 1
# 1 <= a <= N - 1
N, M = map(int, input().split())

memo = {1: 1, 0: 1}
def fibo(n):
  if n in memo:
    return memo[n]
  else:
    num = fibo(n - 1) + fibo(n - 2)
    memo[n] = num
    return num


stairs = [False for _ in range(N + 1)]
pattern = 1
prev = 0
for _ in range(M):
  a = int(input())
  sub = a - prev - 1
  if sub == -1:
    print(0)
    break
  pattern *= fibo(sub)
  prev = a + 1
else:
  sub = N - prev
  pattern *= fibo(sub)

  print(pattern % 1000000007)
Problem p02570 (python)

Fixed submission:
d,t,s = map(int, input().split())

if s*t < d :
  print("No")
else :
  print("Yes")

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

sum=0
for i in range(n-1) :
  for j in range(n-i-1) :
    sum += a[i]*a[j+i+1]
    sum = sum%1000000007

print(sum)
Problem p02916 (python)

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

addans=0

for i in range(n-1) :
  if a[i]+1 == a[i+1] :
    addans += c[a[i]-1]
print(sum(b)+addans)

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

addans=0

for i in range(1,n) :
  if a[i-1]+1 == a[i] :
    addans += c[a[i-2]]
    print(addans)
print(sum(b)+addans)
Problem p03774 (python)

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

li=[list(map(int,input().split())) for i in range(n)]
lj=[list(map(int,input().split())) for i in range(m)]

for i in range(n):
    li_distance=[abs(lj[j][0]-li[i][0])+abs(lj[j][1]-li[i][1]) for j in range(m)]
    print(li_distance.index(min(li_distance))+1)

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

li=[list(map(int,input().split())) for i in range(n)]
lj=[list(map(int,input().split())) for i in range(m)]

for i in range(n):
    li_distance=[abs(lj[j][0]-li[i][0])+abs(lj[j][1]-li[i][1]) for j in range(m)]
    print(li_distance.index(min(li_distance)+1))
Problem p02699 (python)

Fixed submission:
A,B=map(int,input().split())
print("safe" if A>B else "unsafe")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print("safe" if S>W else "unsafe")
Problem p02571 (python)

Fixed submission:
s = input()
t = input()

def count_ans(a,b):
    ans = 0
    for c1,c2 in zip(a, b):
        if c1 == c2:
            ans += 1
    return ans

ans = 0
for i in range(len(s)-len(t)+1):
    ans_ = count_ans(s[i:i+len(t)],t)
    if ans < ans_:
        ans = ans_

print(len(t)-ans)

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

ans = 0
for i in range(len(s)-len(t)+1):
    if ans < count_ans(s[i:i+len(t)],t):
        ans = count_ans(s[i:i+len(t)],t)

print(len(t)-ans)
Problem p02596 (python)

Fixed submission:
k = int(input())
if k==1 or k==7:
  print(1)
elif k%2==0:
  print(-1)
else:
  cnt = 1
  pre = 7
  while(True):
    surp = (pre*10+7)%k
    cnt += 1
    if surp==0:
      break
    if cnt>1000000:
      cnt = -1
      break
    pre = surp
  print(cnt)

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

ng = np.array([2,4,5,6,8])

import numpy as np

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = prime_factorize(x)

if len(set(a) & set(ng))>0:
    print(-1)
elif len(set(a))== 1 and len(str(x))>3:
    nana = "7"*(x)
    while True:
        nana = nana[:len(nana)-1]
        if int(nana)%x ==0:
            break
    print(len(nana))
else:
    nana = "7"*(len(str(x)))
    while True:
        nana += "7"
        if int(nana)%x ==0:
            break
    print(len(nana))
Problem p02623 (python)

Fixed submission:
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0]
b = [0]
for i in range(n):
    a.append(a[i] + A[i])
for i in range(m):
    b.append(b[i] + B[i])

ans = 0 
for i in range(n + 1):
    if a[i] > k:
        break
    while  a[i] + b[m] > k:
        m -= 1
    ans = max(ans, i + m)
print(ans)

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

ans = 0

if ab_min > K:
    ans = 0
else:
    while True:
        K = K - min(A[0],B[0])
        if K < 0:
            break
        ans += 1
        if min(A[0],B[0])==A[0]:
            A.pop(0)
            if A == []:
                A.append(10**9+1)
        else:
            B.pop(0)
            if B == []:
                B.append(10**9+1)
print(ans)
Problem p02624 (python)

Fixed submission:
def solve(n):
    ans=0
    for d in range(1,n+1):
        c=n//d
        ans+=(c+1)*c//2*d
    return ans
 
n=int(input())
print(solve(n))

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

ans = 0
for i in range(1,N+1):
    ans +=  i*len(sympy.divisors(i))

print(ans)

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

import sympy
ans = 0
for i in range(1,N+1):
    ans +=  i*len(sympy.divisors(i))

print(ans)
Problem p02659 (python)

Fixed submission:
a, b = input().split()
a = int(a)
b = round(100*float(b))
print(a*b//100)

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

print(int(math.floor(int(B*100) * A /100)))

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

BB = int(B*100)

C = BB * A /100

C =math.floor(C)
print(C)

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

BB = int(B*100)

C = BB * A /100

C =math.floor(C)
Problem p02711 (python)

Fixed submission:
N = input()

if N[-1] == "7" or N[-2] == "7" or N[-3] == "7":
    print("Yes")
else:
    print("No")

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

if N[-1] == 7 or N[-2] == 7 or N[-3] == 7:
    print(Yes)
else:
    print(No)
Problem p02725 (python)

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

A.append(K+A[0])
d = list()
for i in range(0, N):
    d.append(abs(A[i] - A[i+1]))

#print(A)
#print(d)
print(sum(d) - max(d))

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

max_d = 0
for i in range(0, N-1):
    if A[i] == 0:
        pass
    else:
        d = abs(A[i] - A[len(A)-1])
        max_d = max(d, max_d)

print(k - max_d)
Problem p02754 (python)

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

n = N // (A + B)
mod = N % (A + B)
 
if mod >= A:
    print(A * n + A)
else:
    print(A * n + mod)

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

a = "b"*A
b = "r"*B

l = ""
for i in range(1,int(N/(A+B)+1)+1):
    if N - len(l)  > (A+B):
        l = l + a + b
    elif N - len(l) < (A):
        l = l + a[1:(N - len(l)+1)]

l[0:N].count("b")

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

a = "b"*A
b = "r"*B

l = ""
for i in range(1,int(N/(A+B)+1)+1):
    if N - len(l)  > (A+B):
        l = l + a + b
    elif N - len(l) < (A):
        l = l + a

print(l[0:N].count("b"))

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

a = "b"*A
b = "r"*B

l = ""
for i in range(1,int(N/(A+B)+1)+1):
    l = l + a + b

print(l[0:N].count("b"))
Problem p02773 (python)

Fixed submission:
N = int(input())
S = list()
for i in range(N):
    S.append(str(input()))

import collections

counter = collections.Counter(S)

max_cnt = max(counter.values())

names = [n for n,c in counter.items() if c==max_cnt]
names.sort()
print(*names, sep='\n')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list()
for i in range(N):
    S.append(str(input()))

import collections

counter = Counter(S)

max_cnt = max(counter.values())

names = [n for n,c in counter.items() if c==max_cnt]
names.sort()
print(*names, sep='\n')
Problem p02831 (python)

Fixed submission:
from fractions import gcd

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

print(str((A * B) // gcd(A, B)))

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

import math

print(str((A * B)//math.gcd(A, B)))

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

import math

print(str((A * B) // math.gcd(A, B)))

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

import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

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

import math

print(int((A * B )/math.gcd(A, B)))

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

import math

print(int((A * B )//math.gcd(A, B)))

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

import math

print((A * B)//math.gcd(A, B))

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

import math

print((A * B )//math.gcd(A, B))
Problem p02912 (python)

Fixed submission:
from heapq import heapify, heappop, heappush
 
N, M = map(int, input().split())
A = [-1*int(i) for i in input().split()]

heapify(A)

for i in range(M):
    n = -1 * heappop(A)
    heappush(A, -1*(n//2))
    #print(n, A)
 
print(-1*sum(A))

Buggy submission (verdict: Runtime Error):
from heapq import heapify, heappop, heappush
 
N, M = map(int, input().split())
A = [-1*int(i) for i in input().split()]

heapify(A)

for i in range(M):
    n = -1 * heappop(A)
    heappush(A, -1*(n//2))
    print(n, A)
 
print(-1*sum(A))
Problem p02916 (python)

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

t = 1000000000
lis = list()
for i in A:
    lis.append(B[i-1])
    #print(i,t)
    if i == t + 1:
        lis.append(C[i-2])
    t = i

print(sum(lis))

Buggy submission (verdict: Runtime Error):
t = 0
lis = list()
for i in A:
    lis.append(B[i-1])
    #print(i,t)
    if i == t + 1:
        lis.append(C[i-2])
    t = i

print(sum(lis))
Problem p03317 (python)

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

import math
print(math.ceil((N-1)/(K-1)))

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

import math
print(ceil((N-1)/(K-1)))
Problem p02557 (python)

Fixed submission:
import sys
pin=sys.stdin.readline

N=int(pin())
A=list(map(int,pin().split()))
B=list(map(int,pin().split()))
C=list(reversed(B))

for i in range(N):
  if A[i]==C[i]:
    break
else:
  print("Yes")
  for k in C:
    sys.stdout.write(f"{k} ")
  print()
  sys.exit()
D=B[N//2:]+B[:N//2]
for j in range(N):
  if A[j]==D[j]:
    print("No")
    break
else:
  print("Yes")
  for l in D:
    sys.stdout.write(f"{l} ")
  print()
  sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
pin=sys.stdin.readline

N=int(pin())
A=list(map(int,pin().split()))
B=list(map(int,pin().split()))
C=reversed(B)

for i in range(N):
  if A[i]==C[i]:
    break
else:
  print("Yes")
  for k in C:
    sys.stdout.write(f"{k} ")
  print()
  sys.exit()
D=B[N//2:]+B[:N//2]
for j in range(N):
  if A[j]==D[j]:
    print("No")
    break
else:
  print("Yes")
  for l in D:
    sys.stdout.write(f"{l} ")
  print()
  sys.exit()
Problem p02629 (python)

Fixed submission:
'''
Created on 2020/08/31

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N=int(pin())
  ans=""
  while N:
    N-=1
    ans+=chr(97+N%26)
    N=N//26
  print(ans[::-1])
  return
main()
#解説AC

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(2147483647)
N=int(input())
A=[26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134,146813779479510,3817158266467286,95428956661682176]
B=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
a=0
for x in range(12):
  if N<=A[x]:
    a=x
    break
for y in range(a):
  b=N//(26**(a-y))
  print(B[b-1],end="")
  N=N-b*(26**(a-y))
print(B[N-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134,146813779479510,3817158266467286,95428956661682176]
B=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
a=0
for x in range(12):
  if N<=A[x]:
    a=x
    break
for y in range(a):
  b=N//(26**(a-y))
  print(B[b-1],end="")
  N=N-b*(26**(a-y))
print(B[N-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134,146813779479510,3817158266467286]
B=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
a=0
for x in range(11):
  if N<=A[x]:
    a=x
    break
for y in range(a):
  b=N//(26**(a-y))
  print(B[b-1],end="")
  N=N-b*(26**(a-y))
print(B[N-1])
Problem p02659 (python)

Fixed submission:
A,B=input().split()
A = int(A)
B1,B2 = B.split(".")
t = A*(int(B1)*100 + int(B2))
print(int(t//100))

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

A = int (a)
B = int (b)

x = a*b

y = int(x)

print(x)

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

x = a*b

y = int(x)

print(x)
Problem p02549 (python)

Fixed submission:
N,K = map(int,input().split())
L = 998244353
LR = [0] * K
# 累積和をとっていく。累積和の表を予め作っておき、どんどん足しておく
for i in range(K):
    l,r = map(int,input().split())
    LR[i] = [l,r]

AS = [0] * (N+2)
#for l,r in LR:
#    AS[l] += 1
#    AS[r+1] -= 1

A = [0] * (N+2)
A[1] = 1
A[2] = -1
for i in range(1,N+1):
    AS[i] = (AS[i-1] + A[i])%L
    rest = AS[i]
    for l,r in LR:
        if i+l>N:
            continue
        right = min(N+1,i+r+1)
        A[i+l] += rest
        A[right] += -rest

print(sum(A[1:N+1])%L)

Buggy submission (verdict: Runtime Error):
# 明らかにdp、あるマスに乗っているときそれまでの履歴とかが全く意味をなさないから
# dp[i]: マス目iにいるときのそこまでの移動方法の合計
# dp[i+1] = dp[i]
# 最悪N*K掛かりそうな気がするけどnumpyなら早いんかなぁ？だとしたら簡単すぎる問題な気もするけど。。。？

N,K = map(int,input().split())
L = 998244353
LR = [0] * K
for i in range(K):
    l,r = map(int,input().split())
    LR[i] = [l,r]
import numpy as np
dp = np.array([0] * (N+1))

dp[1] = 1
for i in range(1,N+1):
    for l,r in LR:
        dp[i+l:i+r+1] += dp[i]
        dp[i+l:i+r+1] %= L

print(dp[N])
Problem p02624 (python)

Fixed submission:
# (1,2,3,4,5..,N) + (1,2,3,4,...,N/2) * 2 + (1,2,...,N/3) * 3 + ...+(1,) * N
# 累積和を使うことでO(1)でそれぞれの計算をする．N回ループをするので，合計O(N)の計算量で終了する

N = int(input())

S=[0]*(N+1)
for i in range(1,N+1):
    S[i] = S[i-1] + i

ans = 0
for i in range(1,N+1):
    ind = int(N/i)
    ans += S[ind] * i

print(ans)

Buggy submission (verdict: Runtime Error):
# 170Dと同じような方法g使える．ただしN=10^7なので，うまくわからないけどなぁ...
N = int(input())
Res = [0] * (N+1)
import numpy as np
Res = np.array(Res)
for i in range(1,N+1):
    Res[::i] += 1
Range = np.arange(N+1)
Res = Res * Range
print(np.sum(Res))
Problem p02847 (python)

Fixed submission:
S=input()
days = ['SUN','MON','TUE','WED','THU','FRI','SAT']
print(7-days.index(S))

Buggy submission (verdict: Runtime Error):
A,B,X = map(int, input().split())
# 整数Nにたいして値段PはP=A*N + B*d(N), P<Xとなる最大のNを求める.ただしN<10**9以下となる
#d(N)に対して探索してみる
ketasu = 20
while True:
    if ketasu == 0:  # なんにもかえない場合
        n=0
        break
    Bdn = ketasu * B
    min_num = 1*10**(ketasu-1)
    min_P = min_num * A + Bdn
    if min_P > X:
        ketasu -= 1
        continue
    else:  # Xで買える桁数
        n = (X-Bdn) // A
        if n == 10**ketasu:  # 10**ketasu 
            n -= 1
        break
if n>10**9:
    print(10**9)
else:
    print(n)
Problem p02859 (python)

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

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

Fixed submission:
N=int(input())
if N%2 ==0:
    print(0.5)
else:
    print((N//2+1)/N)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(input().split())

shusseki_jun=[' ' for _ in range(N)]
for i in range(N):
    ind = A[i]
    shusseki_jun[int(ind)-1] = str(i+1)

print(' '.join(shusseki_jun))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(input().split())

shusseki_jun=['' for _ in range(N)]
for i in range(N):
    shusseki_jun[i] = str(A.index(str(i+1))+1)
print(' '.join(shusseki_jun))
Problem p02572 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
count = 0
su = sum(a)
for i in range(n-1):
	su -= a[i]
	count += a[i]*su
print(count%(10**9+7))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
count = 0
su = sum[a]
for i in range(n-1):
	su -= a[i]
	count += a[i]*su
print(count%(10**9+7))