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

Fixed submission:
#124
n=input()
def check(n,st_num):
    count=0
    dic={1:1,0:2}
    for i in range(1,-(-len(n)//2)):
        try:
            if n[2*i]+n[2*i+1]==st_num:
                count+=0
            else:
                count+=dic[abs(int(n[2*i])+int(n[2*i+1])-1)]
        except:
            if n[2*i]!=st_num[0]:
                count+=1
    
    return count
    
if '1' not in n:
    print(len(n)//2)
    exit()
if n[:2]=="10":
    print(check(n,"10"))
elif n[:2]=="01":
    print(check(n,"01"))
else:
    print(0 if len(n)==1 else min([check(n,"10")+1,check(n,"01")+1]))

Buggy submission (verdict: Runtime Error):
n=input()
def check(n,st_num):
    count=0
    dic={1:1,0:2}
    for i in range(1,-(-len(n)//2)):
        try:
            if n[2*i]+n[2*i+1]==st_num:
                count+=0
            else:
                count+=dic[abs(int(n[2*i])+int(n[2*i+1])-1)]
        except:
            if n[2*i]!=st_num[0]:
                count+=1
    
    return count
    
if '1' not in n:
    print(n//2)
if n[:2]=="10":
    print(check(n,"10"))
elif n[:2]=="01":
    print(check(n,"01"))
else:
    print(0 if len(n)==1 else check(n,"10")+1)
Problem p02835 (python)

Fixed submission:
A1, A2, A3 = map(int, input().split())
x = A1 + A2 + A3
if x >= 22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
A1, A2, A3 = map(int, input.split())
if A1 + A2 + A3 >= 22:
    print("bust")
else:
    print("win")
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):
a, b, c = map(int, input().spulit())
 
if a <= b * c:
  	print("Yes")
else:
  	print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().spulit())
 
if a <= b * c:
  print("Yes")
else:
  print("No")

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

if a <= b*c:
  print("Yes")
else:
  print("No")

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

if a <= b * c:
  print("Yes")
else:
  print("No")

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

if a <= b * c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().spulit())
if a / c <= b:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().spulit())
if (a / c <= b):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().spulit())
if (a / c) <= b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().spulit())
if (a / b) <= c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().spulit())
if a / b <= c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().spulit())
if a / c <= b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().spulit())
if a / c = b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = list(map(int, input().split()))
if x[0] / x[2] <= x[3]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = list(input().split())
if x[0] / x[2] <= x[3]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = list(input().split())
if x[0] / x[2] <= x[3]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = list(map(int, input().split()))
if x[0] / x[2] <= x[3]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = input().split()
if a / c <= b:
  print("Yes")
else:
  print("No")

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

if a/c<b:
  print("Yes")
else:
  print("No")
Problem p02594 (python)

Fixed submission:
x = int(input())
if x<30:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
x = int(input())
if x < 30:
  print("No")
 else:
  print("Yes")
Problem p02831 (python)

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

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

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

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

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

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

print(lcm(a, b))
Problem p02847 (python)

Fixed submission:
week = { 'SUN': 7, 'MON': 6, 'TUE': 5, 'WED': 4, 'THU': 3, 'FRI': 2, 'SAT': 1 }
print(week[input()])

Buggy submission (verdict: Runtime Error):
s = input()
week = { 'SUN': 7, 'MUN': 6, 'TUE': 5, 'WED': 4, 'THU': 3, 'FRI': 2, 'SAT': 1 }
print(week[s])

Buggy submission (verdict: Runtime Error):
week = {'SUN':7, 'MUN':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1}
print(week[str(input())])

Buggy submission (verdict: Runtime Error):
choise = input()
week = {'SUN':7, 'MUN':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1}
print(week[choise])

Buggy submission (verdict: Runtime Error):
week = {'SUN':7, 'MUN':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1}
print(week[input()])
Problem p02627 (python)

Fixed submission:
value = input()
if value.isupper():
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split())
a.sort()
print(sum(a[:k]))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
print(sum(a[:k]))
Problem p02699 (python)

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

if w >= s:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
A,B,C,D= map(int, input().split())
while (True):
    C = C - B
    if ( C <= 0 ):
        result = "Yes"
        break
    A = A - D
    if ( A <= 0 ) :
        result = "No"
        break
print ( result )
Problem p02723 (python)

Fixed submission:
S = input()
 
if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
https://atcoder.jp/contests/abc160/tasks/abc160_a
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())

print(6 - a - b)

Buggy submission (verdict: Runtime Error):
N = int(input())
S, T = input().split(" ")

for i in range(N):
    print(S[i]+T[i], end="")
Problem p02859 (python)

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

Buggy submission (verdict: Runtime Error):
r = int(input(''))
print (R*R)
Problem p03135 (python)

Fixed submission:
t,x=map(int,input().split())
print(t/x)

Buggy submission (verdict: Runtime Error):
t,x=map(int,input().split()))
print(t/x)

Buggy submission (verdict: Runtime Error):
t,x=map(int,input().split()
print(t/x)
Problem p03834 (python)

Fixed submission:
s1,s2,s3=map(str,input().split(","))
print(s1,s2,s3)

Buggy submission (verdict: Runtime Error):
s1,s2,s3=map(str,input().split(","))
print(S1,S2,S3)
Problem p02578 (python)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    count = 0
    max_height = 0

    for height in A:
        if max_height < height:
            max_height = height
        else:
            count += max_height - height
    print(count)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    count = 0
    max_height = 0

    for height in A:
        if max_height < height:
            max_height = height
        else:
            count += max_height - height
    print(count)


if __name__ == '__
Problem p02754 (python)

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

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
period = a+b
times = n//period
k = n%period
n =  a if k >a else k
print(times*a + n)
---------------------------
a, b = [int(x) for x in input().split()]
 
if (b < a):
    temp = b
    b = a
    a = temp
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
if a > b:
    if a-1 == b and b > 1:
        print(a-b)
    elif a-1 == b:
        print(a+1)
    else:
        print(a-1)
else:
    if b-1 == a and a > 1:
        print(b-a)
    elif b-1 == a:
        print(b+1)
    else:
        print(b-1)

Buggy submission (verdict: Runtime Error):
a = it(input())
b = int(input())
if a > b:
    if a-1 == b and b > 1:
        print(a-b)
    elif a-1 == b:
        print(a+1)
    else:
        print(a-1)
else:
    if b-1 == a and a > 1:
        print(b-a)
    elif b-1 == a:
        print(b+1)
    else:
        print(b-1)
Problem p02629 (python)

Fixed submission:
n = int(input())
ans = ''
while n > 0:
    n -= 1
    ans += chr(ord('a') + n % 26)
    n//= 26
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
n= int(input())
s="abcdefghijklmnopqrstuvwxyz"
def fn(n):
  if(n<=26):
    return s[n-1]
  return f(n-1)//26+s[f(n-1)%26]
  
print(f(n))
Problem p02571 (python)

Fixed submission:
# B
import sys
s = input()
t = input()
length = 0
ans = [0]*(len(s)-len(t)+1)
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i+j] == t[j]:
            ans[i] += 1
print(len(t)-max(ans))

Buggy submission (verdict: Runtime Error):
#B
import sys
s=input()
t=input()
length=0
ans=[0]*(len(s)-len(t))
for i in range(len(s)-len(t)):
    for j in range(len(t)):
        if s[i+j]==t[j]:
            ans[i]+=1
print(len(t)-max(ans))
Problem p02596 (python)

Fixed submission:
#C
import sys
k=int(input())
s=0

for i in range(k):
    s=s*10+7
    if s%k!=0:
        s=s%k
    else:
        print(i+1)
        sys.exit()
print(-1)

Buggy submission (verdict: Runtime Error):
#C
# 7,77,777･･･=7*(1,11,111･･･)
# 7*(10^i)=7*(10^i-1)/10-1 = 7*(10^i-1)/9 がkで割れる
# 10^iを(9k,7の倍数だったら9k/7)で割ってあまりが１だったら良い
import sys
k=int(input())
if k%7==0:
    k/=7
k*=9
a=10%k
for i in range(k):
    a=a%k
    if a==1:
        print(i+1)
        sys.exit()
    a*=10
print(-1)

Buggy submission (verdict: Runtime Error):
#C
# 7,77,777･･･=7*(1,11,111･･･)
# 7*(10^i)=7*(10^i-1)/10-1 = 7*(10^i-1)/9 がkで割れる
# 10^iを(9k,7の倍数だったら9k/7)で割ってあまりが１だったら良い
import sys
k=int(input())
if k%7==0:
    k/=7
k*=9
a=10%k
for i in range(k*9):
    a=a%k
    if a==1:
        print(i+1)
        sys.exit()
    a*=10
print(-1)
Problem p02753 (python)

Fixed submission:
a=list(input())
if a[0]==a[1]==a[2]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
a,b=map(int,input().split())
f=True
for i in range(1,1010):#max_a=1
    if int(i*0.08)==a and int(i*0.1)==b:
        ans=i
        f=False
        break
if f:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys
a,b=map(int,input().split())
for i in range(1,1100):#max_a=1
    if int(i*0.08)==a and int(i*0.1)==b:
        ans=i
        break
    if i==1099:
        ans=-1

print(ans)
Problem p02754 (python)

Fixed submission:
#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
else:
    s=int(n/(a+b))
    if s==0:
        m=n
    else:
        absum=(a+b)*s
        m=n%(absum)#余り
    if m<a:
        print(s*a+m)
    else:
        print((s+1)*a)

Buggy submission (verdict: Runtime Error):
#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
else:
    s=int(n/(a+b))
    absum=(a+b)*s
    m=n%(absum)#余り
    if m<a:
        print(s*a+m)
    else:
        print((s+1)*a)

Buggy submission (verdict: Runtime Error):
#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
else:
    s=int(n/(a+b))
    absum=(a+b)*s
    n=n%(absum)#余り
    if n<a:
        print(s*a+n)
    else:
        print((s+1)*a)

Buggy submission (verdict: Runtime Error):
#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
else:
    s=int(n/(a+b))
    n=n%((a+b)*s)#余り
    if n<a:
        print(s*a+n)
    else:
        print(s*a+a)

Buggy submission (verdict: Runtime Error):
#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
aa=0
s=n//(a+b)
n=n%((a+b)*s)#余り
if n<a:
    print(s*a+n)
else:
    print(s*a+a)

Buggy submission (verdict: Runtime Error):
#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(-1)
    sys.exit()
aa=0
s=n//(a+b)
n=n%((a+b)*s)#余り
if n<a:
    print(s*a+n)
else:
    print(s*a+a)
Problem p02777 (python)

Fixed submission:
import numpy as np

s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
    a-=1
else:
    b-=1
print(a,b)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
smax=0
for i in range(k-1,n):
    if i==k-1:
        sumnow=sum(a[:i+1])
    else:
        sumnow+=a[i]-a[i-k]
    smax=max(smax,sumnow)
print((smax+k)/2)

Buggy submission (verdict: Runtime Error):
def wa(n):
    if n<=1:
        return 1
    else:
        return wa(n-1)+n

n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in a:
    b.append((i+1)/2)
max=0
for i in range(len(b)-k+1):
    sum=0
    for j in range(i,i+k):
        sum+=b[j]
    if max<=sum:
        max=sum
print(max)
Problem p02779 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans='YES'
for i in range(1,len(a)):
    if a[i-1]==a[i]:
        ans="NO"
        break

print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in range(len(a)):
    b.append((a[i]+1)/2)
for i in range(len(a)-k+1):
    sum=0
    for j in range(i,i+k):
        sum+=b[j]
    if max<=sum:
        max=sum
print(max)
Problem p02820 (python)

Fixed submission:
#D
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())

# r=r点 s=s点 p=p点
ans = 0
for i in range(n):
    if t[i] == "r":
        if i >= k and t[i - k] == "r":
            t[i] = 'm'#iの手以外の手
        else:
            ans += p
    if t[i] == "s":
        if i >= k and t[i - k] == "s":
            t[i] = 'm'
        else:
            ans += r
    if t[i] == "p":
        if i >= k and t[i - k] == "p":
            t[i] = 'm'
        else:
            ans += s
print(ans)

Buggy submission (verdict: Runtime Error):
#D
n, k = map(int(), input().split())
r, s, p = map(int(), input().split())
t = list(input())
# g=r点 t=s点 p=p点
ans = 0
for i in range(n):
    if t[i] == "r":
        if i >= k and t[i - k] == "r":
            t[i] = 'm'#iの手以外の手
        else:
            ans += p
    if t[i] == "t":
        if i >= k and t[i - k] == "t":
            t[i] = 'm'
        else:
            ans += r
    if t[i] == "p":
        if i >= k and t[i - k] == "p":
            t[i] = 'm'
        else:
            ans += s
print(ans)
Problem p02831 (python)

Fixed submission:
a,b=map(int,input().split())
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
print(a*b//gcd(a,b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
	return a
print(a*b//gcd(a,b))
Problem p02833 (python)

Fixed submission:
#E
import math
n = int(input())
ans = 0
i = 1
if n % 2 == 0:
    tmp = 5 ** i * 2
    while tmp <= n:
        tmp = 5 ** i * 2
        ans += n //tmp
        i += 1
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(18):
  ans+=int(n/(10**(i+1))*(i+1)
print(ans)
Problem p02859 (python)

Fixed submission:
a=int(input())
a=a*a
print(a)

Buggy submission (verdict: Runtime Error):
import math
def C(n,r,mod):
  #a=math.factorial(n)/(math.factorial(r)*math.factorial(n-r))
  print(n,r)
  r=min(r,n-r)
  numer=1
  for i in range(n,n-r,-1):
    numer*=i
  denom=1
  for i in range(r,1,-1):
    denom*=i
  a=int(numer/denom)
  return int(a%mod)

x,y=map(int,input().split())
mod=1e9+7

if (x+y)%3!=0:
  print(0)
  exit()
n=int((2*x-y)/3)
m=int((2*y-x)/3)
if n<0 and m<0:
  print(0)
  exit()
print(C(n+m,n,mod))

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
n=int(input())
li=[]
a=[]
b=[]
s=0
while True:
    try:
        li.append(list(map(int,input().split())))
    except:
        break;
for x in li:
  a.append(x[0])
  b.append(x[1])

for i in range(0,n):
  for j in range(i,n):
  	s+=np.sqrt(((a[j]-a[i])**2)+((b[j]-b[i])**2))

p=math.factorial(n)
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
li=list(input())
if n%2==0:
  t=int(n/2)
  a=li[:t]
  t=-t
  b=li[t:]
  if a==b:
    print('Yes')
  else:
    print('No')
else:
  print('No')
Problem p02860 (python)

Fixed submission:
n=int(input())
li=list(input())
if n%2==0:
  t=int(n/2)
  a=li[:t]
  b=li[-t:]
  if a==b:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
li=list(input())
t=n/2
if t%1:
  a=li[:t]
  b=li[:-t]
  for (i,j) in zip(a,b):
    if i==j:
    else:
      print('No')
      break
    print('Yes')
else:
  print('No')
Problem p02879 (python)

Fixed submission:
a,b=map(int,input().split())
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)
Problem p02880 (python)

Fixed submission:
n=int(input())
a=0
for i in range(1,10):
  for j in range(1,10):
    if i*j==n:
      a+=1
if a>0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(1,9):
  for j in range(9):
    if i*j==n:
      a+=1
if a>0:
  print("Yes")
else:
  print("No")
Problem p02897 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
  b[a[i]-1]=i+1
print(" ",join(map(str,b)))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
  b[a[i]-1]=i+1
print(" ",join(map(str,b)))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
count=0
for i in h:
    if k<=i:
        count+=1
print(count)
Problem p03012 (python)

Fixed submission:
#B
import math
n = int(input())
w = list(map(int, input().split()))
min=float('inf')
for t in range(1,n):
    a = sum(w[:t])
    b = sum(w[t:])
    # print(a, b)
    if min > abs(a - b):
        min = abs(a - b)
print(min)

Buggy submission (verdict: Runtime Error):
#B
import math
n = int(input())
w = list(map(int, input().split()))
min=math.inf
for t in range(1,n):
    a = sum(w[:t])
    b = sum(w[t:])
    # print(a, b)
    if min > abs(a - b):
        min = abs(a - b)
print(min)
Problem p03038 (python)

Fixed submission:
#D
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
d = []
for i in range(m):
    b, c = map(int, input().split())
    d.append([b, c])
#print(d)
d = sorted(d, key=lambda x: x[1], reverse=True)
#print(d)
k = 0
for i in range(n):
    if d[k][0] == 0:#追加できなくなる
        k += 1
        if k == len(d):  #配列末
            break
    if a[i] >= d[k][1]:  #a>=cなのでこれ以上置き換わっても意味がない
        break
    a[i] = d[k][1]  #cに置き換わった
    d[k][0] -= 1  #dの追加出来る数を１減らす
print(sum(a))

Buggy submission (verdict: Runtime Error):
#D
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = c = []
for _ in range(m):
    tmp = list(map(int, input().split()))
    b.append(tmp[0])
    c.append(tmp[1])
a.sort
for i in range(m):
    a += [c[i]] * b[i]
a=sorted(a,reverse=True)
a = a[n:]
print(sum(a))
Problem p02570 (python)

Fixed submission:

def resolve():
    num = list(map(int, input().split()))
    time = num[0] / num[2]
    if time <= num[1]:
        print("Yes")
    else:
        print("No")
resolve()

Buggy submission (verdict: Runtime Error):
num = list(map(int, input().split()))
time = num[0] / num[2]
if time <= num[1]:
  print("Yes")
  else:
    print("No")

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

time = list[0] / list [2]

if time <= list[1]:
  print("Yes")
 else:
  print("No)
Problem p02984 (python)

Fixed submission:
#coding: utf-8
n = int(input())
water = list(map(int,input().split()))

sum_water = sum(water)
r_1 = sum_water
for i in range(1,int((n-1)/2+1)):
    r_1 -= water[2*i-1]*2
    #print(water[2*i])

ans = [r_1]
for i in range(n-1):
    ans.append(water[i]*2-ans[-1])
    #print(ans)

print(" ".join(map(lambda x:str(int(x)),ans)))

Buggy submission (verdict: Runtime Error):
#coding: utf-8
import numpy as np
n = int(input())
water = list(map(int,input().split()))

A = np.identity(n)
A += np.eye(n, k=1)
A[n-1][0] = 1

ans = np.linalg.solve(0.5*A,water)
print(" ".join(list(map(lambda x:str(int(x)),ans))))
Problem p03805 (python)

Fixed submission:

#入力

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

graph = [ ]
for _ in range(N+1):
    graph.append([])

for _ in range(M):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

visited = []
for _ in range(N+1):
    visited.append(False)


def dfs(dep,cur):
    global N,visited,graph

    if dep == N:
        return 1

    ans = 0

    for dist in graph[cur]:
        if visited[dist] == False:
            visited[dist] = True
            ans += dfs(dep + 1,dist)
            visited[dist] = False
    return ans

visited[1] = True
print(dfs(1,1))

Buggy submission (verdict: Runtime Error):

#入力

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

graph = [ ]
for _ in range(N+1):
    graph.append([])

for _ in range(M):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

visited = []
for _ in range(N+1):
    visited.append(False)


def dfs(dep,cur):
    global N,visited,graph

    if dep == N:
        ans += 1
        return 1

        ans = 0

    for dist in graph[cur]:
        if visited[dist] == False:
            visited[dist] = True
            ans += dfs(dep + 1,dist)
            visited[dist] = False
    return ans

 visited[1] = True
 dfs(1,1)
 print(ans)
Problem p02881 (python)

Fixed submission:
import math as m

n = int(input())
q = int(m.sqrt(n))

for i in range(q,0,-1):
    if n%i == 0:
        k = i
        l = int(n/i)
        break

print(int(k+l-2))

Buggy submission (verdict: Runtime Error):
import math as m

n = int(input())
q = int(m.sqrt(n))

for i in range(q,1,-1):
    if n%i == 0:
        k = i
        l = n/i
        break

print(int(k+l-2))
Problem p02596 (python)

Fixed submission:
K = int(input())
count = 1
mod = 7
answer = -1

for _ in range(K):
    if mod % K == 0:
        answer = count
        break
    count += 1
    mod = (mod * 10 + 7) % K

print(answer)

Buggy submission (verdict: Runtime Error):
K=int(input())
amari_list = []
amari = 7%K
amari_list.append(amari)
for i in range(1,K):
    amari = (amari * 10 + 7)% K
    if amari == 0:
        print(i+1)
        break
    if amari in amari_list:a
        print(-1)
        break
    if i == (K-1):
        print(-1)
    else:
        amari_list.append(amari)
Problem p02597 (python)

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

R_num = s.count("R")
print(s[:R_num].count("W"))

Buggy submission (verdict: Runtime Error):
s = input()
R_num = s.count("R")
print(s[:R_num].count("W")