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

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n=INT()
    p = [INT() for _ in range(n)]

    p_max = max(p)

    print(sum(p) - int((p_max/2)))

if  __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n,x = MAP()
    L = [1]*n
    P = [1]*n

    for  i in range(1,n):
        L[i] = 2* L[i-1] +3
        P[i] = 2* P[i-1] + 1

    def func(N, X):
        if N==0:
            return 0 if X <= 0 else 1

        elif X<= L[N-1] + 1:
            return func(N-1, X-1)

        else:
            return P[N-1] + 1 + func(N-1, X-L[N-1] -2)

    print(func(n,x))

if  __name__=='__main__':
    main()
Problem p03252 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s = list(input())
    t = list(input())
    n = len(s)
    s_dict = defaultdict(int)
    t_dict = defaultdict(int)
    for i in range(n):
        s_dict[s[i]] += 1
        t_dict[t[i]] += 1

    #print(s_dict)
    #print(t_dict)

    if sorted(list(s_dict.values()))== sorted(list(t_dict.values())):
        print('Yes')
    else:
        print('No')
        

if  __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s = list(input())
    t = list(input())
    n = len(s)
    s_dict = defaultdict(int)
    t_dict = defaultdict(int)
    for i in range(n):
        s_dict[s[i]] += 1
        t_dict[t[i]] += 1

    print(s_dict)
    print(t_dict)

    if list(s_dict.values().sort()) == list(t_dict.values().sort()):
        print('Yes')
    else:
        print('No')
        

if  __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
azzel
apple
Problem p02623 (python)

Fixed submission:
from sys import stdin, stdout
input = stdin.readline
print = stdout.write 
n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
for i in range(1, n + 1):
    a[i] += a[i - 1]
for i in range(1, m + 1):
    b[i] += b[i - 1]
i, j, z = 0, m, 0
while i <= n and a[i] <= k:
    while b[j] > k - a[i]:
        j -= 1
    z = max(z, i + j)
    i += 1
print(str(z))

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
input = stdin.readline
print = stdout.write
n, m, k = map(int, input().split())
a, b = [0], [0]
a += list(map(int, input().split())),
b += list(map(int, input().split())),
for i in range(1, n + 1):
    a[i] += a[i - 1]
for i in range(1, m + 1):
    b[i] += b[i - 1]
i, j, z = 0, m, 0
while i <= n and a[i] <= k:
    while b[j] > k - a[i]:
        j -= 1
    z = max(z, i + j)
    i += 1
print(str(z))
Problem p02629 (python)

Fixed submission:
n = int(input())
d = ['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 = ''
while n:
  n -= 1
  a = d[n % 26] + a
  n //= 26
print(a)

Buggy submission (verdict: Runtime Error):
for _ in range(int(input())):
    n = int(input())
    d = ['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 = ''
    while n:
        n -= 1
        a = d[n % 26] + a
        n //= 26
    print(a)

Buggy submission (verdict: Runtime Error):
for _ in range(int(input())):
    n = int(input())
    d = ['z', '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 = ''
    f = 0
    if n % 26 == 0:
        f = 1
    while n > f:
        a = d[n % 26] + a
        n //= 26
    print(a)
Problem p02847 (python)

Fixed submission:
s = input()

if s == "SUN":
  print("7")
elif s == "MON":
  print("6")
elif s == "TUE":
  print("5")
elif s == "WED":
  print("4")
elif s == "THU":
  print("3")
elif s == "FRI":
  print("2")
else:
  print("1")

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

if s == "SUN":
  print("7")
elif s == "MON":
  print("6")
elif s == "TUE":
  print("5")
elif s == "WED":
  print("4")
elif s == "THU":
  print("3")
elif s == "FRI":
  print("2")
else
  print("1")
Problem p02880 (python)

Fixed submission:
N = input()
list = [str(x*y) for x in range(1,10) for y in range(1,10)]
result = str(N) in list

if result == True:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
list = [str(x*y) for x in range(1,10) for y in range(1,10)]
result = str(N) in list

if reuslt == "True":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
list = [str(x*y) for x in range(1,10) for y in range(1,10)]
result = str(N) in list

if reuslt == "True":
  print("Yes")
else:
  print("No")
Problem p02951 (python)

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

Buggy submission (verdict: Runtime Error):
A,B, C= list(map(int,input().split()))
if C - (A - B) >= 0
    print(C - (A - B))
else
    print(0)
Problem p03209 (python)

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

pate, slice = [1], [1]
for _ in range(n + 1):
    pate.append(2 * pate[-1] + 1)
    slice.append(2 * slice[-1] + 3)

ans = 0
while n > 0:
    if x >= slice[n - 1] + 2:
        ans += pate[n - 1] + 1
        x -= slice[n - 1] + 2
    elif x < slice[n - 1] + 2:
        x -= 1
    n -= 1
print(ans + (x > 0))

Buggy submission (verdict: Runtime Error):
    n, x = map(int, input().split())
     
    pate, slice = [1], [1]
    for _ in range(n + 1):
        pate.append(2 * pate[-1] + 1)
        slice.append(2 * slice[-1] + 3)
     
    ans = 0
    while n > 0:
        if x >= slice[n - 1] + 2:
            ans += pate[n - 1] + 1
            x -= slice[n - 1] + 2
        elif x < slice[n - 1] + 2:
            x -= 1
        n -= 1
    print(ans + (x > 0))
Problem p03275 (python)

Fixed submission:

def f(n, a):
    x = sorted(set(a))
    n_sub_half = (n * (n + 1)) // 2 // 2
    n1 = n * 2 + 1
    li = 0
    ri = len(x)
    while ri > li + 1:
        i = (li + ri) // 2
        xi = x[i]
        cnt = [0] * n1
        cs = 0
        cnt[cs] = 1
        judge = 0
        s = 0
        for ak in a:
            if ak >= xi:
                cs += 1
                s += cnt[cs] + 1
            else:
                cs -= 1
                s -= cnt[cs + 1] - 1
            cnt[cs] += 1
            judge += s
            if judge >= n_sub_half:
                li = i
                break
        else:
            ri = i
    return x[li]

n = int(input())
ar = [int(i) for i in input().strip().split(" ")]
print(f(n,ar))

Buggy submission (verdict: Runtime Error):

def f(n, a):
    x = sorted(set(a))
    n_sub_half = (n * (n + 1)) // 2 // 2
    n1 = n * 2 + 1
    li = 0
    ri = len(x)
    while ri > li + 1:
        i = (li + ri) // 2
        xi = x[i]
        cnt = [0] * n1
        cs = 0
        cnt[cs] = 1
        judge = 0
        s = 0
        for ak in a:
            if ak >= xi:
                cs += 1
                s += cnt[cs] + 1
            else:
                cs -= 1
                s -= cnt[cs + 1] - 1
            cnt[cs] += 1
            judge += s
            if judge >= n_sub_half:
                li = i
                break
        else:
            ri = i
    return x[ri]

n = int(input())
ar = [int(i) for i in input().strip().split(" ")]
print(f(n,ar))
Problem p02547 (python)

Fixed submission:
N = int(input())
D = []
count, temp = 0, 0

for n in range(N):
    input_line = input().split()
    if (int(input_line[0]) == int(input_line[1])):
        count += 1
        if count == 3:
            temp = 1
    elif(temp ==1):
        break
    else:
        count = 0

if count >= 3:
        print('Yes')

else:
        print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
D = []
count = 0

for n in range(N):
    input_line = input().split()
    if (int(input_line[0]) == int(input_line[1])):
        count += 1
        if count == 3:
            temp = 1
    elif(temp ==1):
        break
    else:
        count = 0

if count >= 3:
        print('Yes')

else:
        print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
D = []
count = 0

for n in range(N):
    input_line = input().split()
    if (int(input_line[0]) == int(input_line[1])):
        count += 1
    else:
        pass

if count >= 3:
        print(Yes)

else:
        print(No)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = []
count = 0

for n in range(N):
    input_line = input().split()
    if (int(input_line[0] == int(input_line[1])):
        count += 1
    else:
        pass

if count >= 3:
        print(Yes)

else:
        print(No)
Problem p02682 (python)

Fixed submission:
a,b,c,k = (map(int,input().split()))
if k<=a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(2*a+b-k)

Buggy submission (verdict: Runtime Error):
a,b,c,k = list(map(int,input().split()))
A = [1]*a
B = [0]*b
C = [-1]*c
new =A+B+C
print(sum(new[:k]))
Problem p02711 (python)

Fixed submission:
if "7" in input():
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
Source Code 

Copy
Copy
i = input()
if '7' in i:
  print("Yes")
else:
  print("No")
Problem p02753 (python)

Fixed submission:
txt = input()
a,b,c = list(txt)
if a == b:
  if b == c:
    print('No')
  else:
    print('Yes')
else :
  print('Yes')

Buggy submission (verdict: Runtime Error):
str = input()
a,b,c = str.split()
if a == b:
  if b == c:
    print ('No')
  else print ('Yes')
else print ('Yes')
Problem p02577 (python)

Fixed submission:
n = list(input())
x = 0
for i in n:
    x += int(i)
if x%9 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = list(input())
x = 0
for i in n:
    x += int(i)
if i%9 == 0:
    print('Yes')
else:
    print('No')
Problem p02682 (python)

Fixed submission:
a, b, c, k = map(int, input().split())
if a+b >= k:
    print(min(a, k))
else:
    print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
l = [1]*a
l.extend([0]*b)
l.extend([-1]*c)
print(sum(l[:k]))

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
l = [1]*a + [0]*b + [-1]*c
print(sum(l[:k]))
Problem p03011 (python)

Fixed submission:
p, q, r = map(int, input().split())
ans = min(p+q, q+r, r+p)
print(ans)

Buggy submission (verdict: Runtime Error):
p, q, r = map(int, input().split())
ans = min(a+b, b+c, c+a)
print(ans)
Problem p03252 (python)

Fixed submission:
S=input()
T=input()
R=[-1]*26
R2=[-1]*26
flag=1

for i in range(len(S)):
    a=ord(S[i])-97
    b=ord(T[i])-97
    if R[a]!=-1 or R2[b]!=-1:
        if R[a]!=b or R2[b]!=a:
            flag=0
            break
    else:
        R[a]=b
        R2[b]=a
if flag==0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
N=[i in range(len(S))]
visited=[]

for i in N:
    if (S[i] not in visited) and S[i]!=T[i]:
        visited.append(T[i])
        x=S[i]
        S=S.replace(T[i],'_')
        S=S.replace(S[i],T[i])
        S=S.replace('_',x)
    elif S[i] in visited and S[i]!=T[i]:
        break
    else:
        visited.append(T[i])
print('No') if S!=T else print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
visited=[]

for i in range(len(S)):
    if (S[i] not in visited) and S[i]!=T[i]:
        visited.append(T[i])
        x=S[i]
        S=S.replace(T[i],'_')
        S=S.replace(S[i],T[i])
        S=S.replace('_',x)
    elif (S[i] in visited) and S[i]!=T[i]:
        break
    else:
        visited.append(T[i])
    print(S)
print('No') if S!=T else print('Yes')
Problem p02951 (python)

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

if x > 0:
	print(x)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n < 10:
	print(n)
elif n < 100:
	print(9)
elif n < 1000:
	print(9 + n - 99)
elif n == 1000:
	print(909)
elif n < 10_000:
	print(909)
elif n == 10_000:
	print(910)
elif n < 100_000:
	print(909 + n-9999)
elif n == 100_000:
	print(90909)
Problem p02959 (python)

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

cnt = 0

for i in range(-1,-1*len(yshabl)-1,-1):
	y = yshabl[i]
	m = mnstr[i]+mnstr[i-1]
	if m >= y:
		cnt += y
		if mnstr[i] >= y:
			pass
		else:
			mnstr[i-1] -= y - mnstr[i]
	else:
		cnt += m
		mnstr[i-1] = 0

print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
data = sys.stdin.readline().split('\n')
twn = int(data[0]) + 1
ysh = int(data[0])
yshabl = list(map(int,data[2].split()))
mnstr = list(map(int,data[1].split()))

cnt = 0

for i in range(-1,-1*len(yshabl)-1,-1):
	y = yshabl[i]
	m = mnstr[i]+mnstr[i-1]
	if m >= y:
		cnt += y
		mnstr[i-1] -= y - mnstr[i]
	else:
		cnt += m
		mnstr[i-1] = 0

print(cnt)
Problem p02984 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
x1 = sum([a[h] if h%2==0 else -a[h] for h in range(n)])
print(x1,end = ' ')

for i in range(n-1):
	if i == 0:
		b = a[i]*2 - x1
		print(b,end=' ')
	else:
		print(a[i]*2 - b,end=' ')
		b = a[i]*2 - b

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
x1 = sum([a[h] if h%2==0 else -a[h] for h in range(n)])
print(x1,end = ' ')

for i in range(n-1):
	if i == 0:
		b = a[i]*2 - x1
		print(b,end=' ')
	else:
		print(a[i]*2 - b,end=' ')
		b = a[i]*2 - b
Problem p03137 (python)

Fixed submission:
N,M=map(int,input().split())
X = list(map(int,input().split()))
X.sort()
xdelta = []

for i in range(len(X)-1):
	xdelta.append(abs(X[i+1]-X[i]))

xdelta.sort()

if N < M:
	if N == 1:
		print(sum(xdelta))
	else:
		for i in range(N-1):
			xdelta.pop(-1)
		print(sum(xdelta))
else:
	print(0)

Buggy submission (verdict: Runtime Error):
M,N=map(int,input().split())
X = list(map(int,input().split()))
X.sort()
xdelta = []

for i in range(len(X)-1):
	xdelta.append(abs(X[i+1]-X[i]))

xdelta.sort()

if M > N:
	if N == 1:
		print(sum(xdelta))
	else:
		for i in range(M-1):
			xdelta.pop(-1)
		print(sum(xdelta))
else:
	print(0)

Buggy submission (verdict: Runtime Error):
M,N=map(int,input().split())
X = list(map(int,input().split()))
X.sort()
xdelta = []

for i in range(len(X)-1):
	xdelta.append(abs(X[i+1]-X[i]))

xdelta.sort()
#print(xdelta)

if M == 1:
	print(0)
elif N == 1:
	print(sum(xdelta))
elif M <= N:
	print(0)
else:
	for i in range(M-1):
		xdelta.pop(-1)
	print(sum(xdelta))

Buggy submission (verdict: Runtime Error):
M,N=map(int,input().split())
X = list(map(int,input().split()))
X.sort()
xdelta = []

for i in range(len(X)-1):
	xdelta.append(abs(X[i+1]-X[i]))

xdelta.sort()
#print(xdelta)

if M == 1:
	print(0)
elif N == 1:
	print(sum(xdelta))
else:
	for i in range(M-1):
		xdelta.pop(-1)
	print(sum(xdelta))

Buggy submission (verdict: Runtime Error):
M,N=map(int,input().split())
X = list(map(int,input().split()))
X.sort()
xdelta = []

for i in range(len(X)-1):
	xdelta.append(abs(X[i+1]-X[i]))

xdelta.sort()
#print(xdelta)

if xdelta == [] or N == 1:
	print(int(sum(map(abs,X))))
else:
	for i in range(M-1):
		xdelta.pop(-1)
	print(sum(xdelta))

Buggy submission (verdict: Runtime Error):
M,N=map(int,input().split())
X = list(map(int,input().split()))
X.sort()
xdelta = []

for i in range(len(X)-1):
	xdelta.append(abs(X[i+1]-X[i]))

xdelta.sort()
#print(xdelta)

if xdelta == []:
	print(int(sum(map(abs,X))))
else:
	for i in range(M-1):
		xdelta.pop(-1)
	print(sum(xdelta))

Buggy submission (verdict: Runtime Error):
M,N=map(int,input().split())
X = list(map(int,input().split()))
X.sort()
xdelta = []

for i in range(len(X)-1):
	xdelta.append(abs(X[i+1]-X[i]))

if xdelta == []:
	print(int(sum(map(abs,X))))
else:
	for i in range(M-1):
		xdelta.pop(-1)
	print(sum(xdelta))

Buggy submission (verdict: Runtime Error):
M,N=map(int,input().split())
X = list(map(int,input().split()))
X.sort()
xdelta = []

for i in range(len(X)-1):
	xdelta.append(X[i+1]-X[i])

xdelta.sort()

if xdelta == []:
	print(int(sum(map(abs,X))))
else:
	for i in range(M-1):
		xdelta.pop(-1)
	print(sum(xdelta))

Buggy submission (verdict: Runtime Error):
M,N=map(int,input().split())
X = list(map(int,input().split()))
X.sort()
xdelta = []

for i in range(len(X)-1):
	xdelta.append(X[i+1]-X[i])

xdelta.sort()

for i in range(M-1):
	xdelta.pop(-1)
	
print(sum(xdelta))
Problem p02699 (python)

Fixed submission:
s, w = map(int, input().split())
if (s <= w):
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):
s, w = map(int, input().split())
if (s <= w):
  print('unsafe')
 else:
  print('safe')
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):
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
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

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

Fixed submission:
x, y = map(int, input().split())

from operator import mul
from functools import reduce

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


mod = 10**9+7 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル

if (x+y) % 3 != 0:
    ans = 0

else:
    a = (x + y)//3
    b = x-a

    if x-a <0 or y-a <0:
        ans = 0
    else:
        mod = 10**9+7 #出力の制限
        N = a+b
        g1 = [1, 1] # 元テーブル
        g2 = [1, 1] #逆元テーブル
        inverse = [0, 1] #逆元テーブル計算用テーブル

        for i in range( 2, N + 1 ):
            g1.append( ( g1[-1] * i ) % mod )
            inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
            g2.append( (g2[-1] * inverse[-1]) % mod )

        ans = cmb(a, b, mod)

print(int(ans))

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

if (x+y) % 3 != 0:
    ans = 0

else:
    a = (x + y)//3
    b = x-a

    if b <0:
        ans = 0
    else:
        import math 
        val = math.factorial(a)//(math.factorial(b)*math.factorial(a-b))

        ans = val % (10**9+7)

print(int(ans))
Problem p02984 (python)

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

ans = []
ans += [sum(a) - 2*sum(a[1::2])]
for i in range(0, n-1):
    ans += [2*a[i]-ans[i]]

print(' '.join(map(str, ans)))

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

from sympy import Indexed, IndexedBase, Tuple, sqrt, solve

A = IndexedBase('A')
eqs = Tuple()
for i in range(n-1):
    eqs += Tuple(A[i]+A[i+1]-2*a[i])
eqs += Tuple(A[n-1]+A[0]-2*a[n-1])

ans = solve(eqs, eqs.atoms(Indexed))

ans = [x for x in ans.values()]

print(' '.join(map(str, ans)))

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

from sympy import Indexed, IndexedBase, Tuple, sqrt, solve

A = IndexedBase('A')
eqs = Tuple()
for i in range(n-1):
    eqs += Tuple(A[i]+A[i+1]-2*a[i])
eqs += Tuple(A[n-1]+A[0]-2*a[n-1])

ans = solve(eqs, eqs.atoms(Indexed))

ans = [x for x in ans.values()]

print(' '.join(map(str, ans)))
Problem p03017 (python)

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

ans = 'Yes'
if '##' in s[a-1:c] or '##' in s[b-1:d]:
    ans = 'No'

if ans == 'Yes':
    if c<d:
        pass
    else:
        if '...' in s[b-2:d+1]:
            pass
        else:
            ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b, c, d = map(int,input().split())
s = str(input())
s = s[a:max(c,d)]

l_s = []
for i in range(len(s)):
    l_s += [0 if s[i] == '.' else 1]

ans = 'Yes'
if i in range(len(s)-1):
    if sum(l_s[i:i+2])==2:
        ans = 'No'

if ans == 'Yes':
    if d>c:
        pass
    else:
        ans = 'No'
        for j in range(b-a,d-1-a):
            if sum(l_s[j:3+j]) == 0:
                ans = 'Yes'
            else:
                pass
        if ans == 'No':
            if sum(l_s[d-1-a,d-a])==0:
                ans = 'Yes'

print(ans)
Problem p03072 (python)

Fixed submission:
N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x in input().split()]
for i in range(len(list_num)):
	if max_num <= list_num[i]:
		cnt += 1
		max_num = list_num[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x in input().split()]
for i in range(len(list_num)):
	if max_num <= a:
		cnt += 1
		max_num = list_num[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x input().split()]
for i in range(len(list_num)):
	if max_num <= a:
		cnt += 1
		max_num = list_num[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x input().split()]
for x in list_num:
	if max_num <= a:
		cnt += 1
		max_num = a
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x input().split()]
for x in list_num:
  if max_num <= a:
	cnt += 1
	max_num = a
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x input().split()]
for x in list_num:
  if max_num <= a:
   	cnt += 1
    max_num = a
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x input().split()]
for x in list_num:
  if max_num <= a:
   	cnt += 1
    max1 = a
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
max1 = 1
cnt = 0
for i in range(N):
  b = int(input())
  if max1 <= b:
   	cnt += 1
    max1 = b
print(cnt)