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

Fixed submission:
import math

cnt = 0

N, D = map(int, input().split())
X = []
for l in range(N):
    X.append(list(map(int, input().strip().split())))

for i in range(0, N - 1):
    for j in range(i + 1, N):
        sum = 0
        for k in range(0, D):
            sum += (X[i][k] - X[j][k])**2
        if math.sqrt(sum) == int(math.sqrt(sum)):
            cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
cnt = 0

N, D = map(int, input().split())
X = []
for l in range(N):
    X.append(list(map(int, input().strip().split())))

for i in range(0, N - 1):
    for j in range(i + 1, N):
        sum = 0
        for k in range(0, D):
            sum += (X[i][k] - X[j][k])**2
        if math.sqrt(sum) == int(math.sqrt(sum)):
            cnt += 1
print(cnt)
Problem p02995 (python)

Fixed submission:
import math

a, b, c, d = map(int, input().split())
cd = (c * d) // math.gcd(c, d)
u = b//c + b//d - b//cd
l = (a-1)//c + (a-1)//d - (a-1)//cd

print(b - a + 1 - u + l)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
# print(b - a + 1)
e = c * d // math.gcd(c, d)
cMax = math.ceil(a / c)
cMin = math.floor(b / c)
# print(cMin - cMax + 1)
dMax = math.ceil(a / d)
dMin = math.floor(b / d)
# print(dMin - dMax + 1)
eMax = math.ceil(a / e)
eMin = math.floor(b / e)
# print(eMin - eMax + 1)

print(b - a + 1 + eMin - eMax + 1 - (cMin - cMax + 1) - (dMin - dMax + 1))
Problem p03103 (python)

Fixed submission:
n, m = map(int, input().split())
abList = sorted([list(map(int, input().split())) for _ in range(n)])
abSum = 0
abNum = m
for i in range(n):
    ab = abList[i]
    a, b = ab[0], ab[1]
    if b >= abNum:
        abSum += abNum * a
        break
    else:
        abSum += b * a
        abNum -= b
print(abSum)

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

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

A.append(a)
B.append(b)

if N != 1:
    for n in range(N-1):
        a, b = map(int, input().split())
        swi = 0
        BSum = 0
        for j in range(len(A)):
            if BSum > M:
                swi = 1
                break
            else:
                if A[j] > a:
                    A.insert(j, a)
                    B.insert(j, b)
                    swi = 1
                    break
                elif A[j] == a:
                    B[j] += b
                    swi = 1
                    break
            BSum += b
        if swi == 0:
            A.append(a)
            B.append(b)

cntSum = 0
moneySum = 0

print(A, B)

for n in range(N):
    if cntSum + B[n] > M:
        moneySum += A[n] * (M - cntSum)
        cntSum += M - cntSum
        break
    else:
        cntSum += B[n]
        moneySum += A[n] * B[n]

print(moneySum)
Problem p03147 (python)

Fixed submission:
def main():
    n = int(input())
    h = list(map(int, input().split()))
    ans = h[0]
    for i in range(n-1):
        if h[i+1] > h[i]:
            ans += h[i + 1]-h[i]
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    h = [list(map(int, input().split()))]
    ans = h[0]
    for i in range(n-1):
        if h[i+1] > h[i]:
            ans += h[i + 1]-h[i]
    print(ans)


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

Fixed submission:
print("Christmas" + " Eve" * (25 - int(input())))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = sorted([int(input()) for _ in range(n)])
print(min(h[k + i - 1]-h[i] for i in range(n - k + 1)))
Problem p03281 (python)

Fixed submission:
n = int(input())
nSum = 0
for i in range(n):
    cnt = 0
    for j in range(i + 1):
        if (i + 1) % (j + 1) == 0:
            cnt += 1
    if cnt == 8 and (i + 1) % 2 != 0:
        nSum += 1

print(nSum)

Buggy submission (verdict: Runtime Error):
n = int(input())
nSum = 0
for i in range(n):
    cnt = 0
    for j in range(i + 1):
        if (i + 1) % (j + 1) == 0:
            cnt += 1
    if cnt == 8 and (i + 1) % 2 != 0:
        nSum += 1
        a.append(i + 1)

print(nSum)
Problem p03285 (python)

Fixed submission:
n = int(input())
swi = "No"
for a in range(100):
    if (n - 4*a) % 7 == 0 and n - 4*a >= 0:
        swi = "Yes"
        break
print(swi)

Buggy submission (verdict: Runtime Error):
n=int(input())
swi = "No"
for a in range(100)：
  if (n - 4＊a) % 7 == 0 and n - 4＊a >= 0:
    swi="Yes"
    break
print(swi)

Buggy submission (verdict: Runtime Error):
n=int(input())
swi = "No"
for a in range(100)
  if (n - 4＊a) % 7 == 0 and n - 4＊a >= 0:
    swi="Yes"
    break
print(swi)

Buggy submission (verdict: Runtime Error):
n=int(input())
swi = "No"
for a in range(n//4 +1)
  if (n - 4＊a) % 7 == 0 and n - 4＊a >= 0:
    swi="Yes"
    break
print(swi)
Problem p03408 (python)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
yenMax = 0

for i in s:
    cnt = s.count(i) - t.count(i)
    if yenMax < cnt:
        yenMax = cnt
print(yenMax)

Buggy submission (verdict: Runtime Error):
s = [input() for _ in range(int(input()))]
t = [input() for _ in range(int(input()))]
yMax = 0
c = count

for i in s:
    cnt = s.c(i) - t.c(i)
    if yMax < cnt:
        yMax = cnt
print(yMax)
Problem p03423 (python)

Fixed submission:
print(int(input()) // 3)

Buggy submission (verdict: Runtime Error):
print(n / 3)
Problem p03563 (python)

Fixed submission:
r, g = [int(input()) for _ in range(2)]
print(2*g - r)

Buggy submission (verdict: Runtime Error):
r, g = map(int, input().split())
print((r + g) / 2)
Problem p03625 (python)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
swi = 0
s = [0, 0]
i = 0
while i < len(a) - 1:
    if a[i] == a[i + 1]:
        s[swi] = a[i]
        i += 1
        swi += 1
        if swi == 2:
            break
    i += 1

print(s[0] * s[1])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
swi = 0
s = [0, 0]
i = 0
while i < len(a):
    if a[i] == a[i + 1]:
        s[swi] = a[i]
        i += 1
        swi += 1
        if swi == 2:
            break
    i += 1

print(s[0] * s[1])
Problem p03633 (python)

Fixed submission:
import fractions

n = int(input())
a = 1

for b in range(n):
    b = int(input())
    a = a*b//fractions.gcd(a, b)
print(a)

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

for b in range(n):
    b = int(input())
    a = a*b//gcd(a, b)

print(a)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = 1

for b in range(n):
    b = int(input())
    a = a*b//math.gcd(a, b)

print(a)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


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


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
t = list(set([int(input()) for _ in range(n)]))

print(lcm(*t))
Problem p03657 (python)

Fixed submission:
a, b = map(int, input().split())
sign = a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0
print("Possible" if sign else "Impossible")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print("Possible" if(a % 3 == 0 and b % 3 == 0 (a+b) % 3 == 0) else "Impossible")
Problem p03673 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = a[0::2][::-1]
c = a[1::2]

b.extend(c)
if n % 2 == 0:
    b = b[::-1]
print(*b)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = a[0::2][::-1]
c = a[1::2]

b.extend(c)
print(*b[::-1] if n % 2 == 0 else *b)
Problem p03738 (python)

Fixed submission:
a, b = [int(input()) for _ in range(2)]
print("GREATER" if a > b else "LESS" if a < b else "EQUAL")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print("GREATER" if a > b else "LESS" if a < b else "EQUAL")
Problem p03813 (python)

Fixed submission:
x = int(input())
if x < 1200:
    print('ABC')
else:
    print('ARC')

Buggy submission (verdict: Runtime Error):
def start(l):
    for i in range(1, l-1):
        if S_list[i] == "A":
            return i + 1


def finish(l):
    for i in range(1, l-1):
        if S_list[l - i] == "Z":
            return l - i + 1


S_list = list(input())
l = len(S_list)
print(finish(l) - start(l) + 1)
Problem p03814 (python)

Fixed submission:
S_list = list(input())
l = len(S_list)
for i in range(l):
    if S_list[i] == "A":
        start = i
        break
for i in range(l):
    if S_list[i] == "Z":
        finish = i


print(finish - start + 1)

Buggy submission (verdict: Runtime Error):
def start(l):
    for i in range(1, l-1):
        if S_list[i] == "A":
            return i + 1


def finish(l):
    for i in range(1, l-1):
        if S_list[l - i] == "Z":
            return l - i + 1


S_list = list(input())
l = len(S_list)
print(finish(l) - start(l) + 1)

Buggy submission (verdict: Runtime Error):
def start(l):
    for i in range(1, l):
        if S_list[i] == "A":
            return i


def finish(l):
    for i in range(1, l):
        if S_list[l - i] == "Z":
            return l - i


S_list = list(input())
l = len(S_list)
start(l)
finish(l)
print(finish(l) - start(l) + 1)
Problem p03844 (python)

Fixed submission:
A, op, B = map(str, input().split())

if op == "+":
    print(int(A) + int(B))

if op == "-":
    print(int(A) - int(B))

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

if op == "+":
    print(A + B)

if op == "-":
    print(A - B)
Problem p03957 (python)

Fixed submission:
import collections


def main():
    s = list(input())
    if s.count("C") == 0 or s.count("F") == 0:
        print("No")
        return

    clen, flen = 0, 0
    for i in range(len(s)):
        if clen == 0:
            if s[i] == "C":
                clen = i
        if s[i] == "F":
            flen = i
    print("Yes" if flen > clen else "No")


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import collections


def main():
    s = list(input())
    if s.count("C") == 0 or s.count("F") == 0:
        print("No")
        return

    if s.index("C") == len(s) - 1:
        print("No")
        return

    print("Yes" if s.index("C") < s.index("F", s.index("C")) else "No")


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

Fixed submission:
width, height, x, y = map(float,input().split())

center_x = width/2
center_y = height/2

s = width * height/2
label = 0
if x == center_x and y == center_y:
    label = 1

print(s, label)

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

center_x = width/2
center_y = height/2

label = 0
if x === center_x && y === center_y:
    s = width * height/2
    label = 1

print(s, label)
Problem p03029 (python)

Fixed submission:
a, p = map(int,input().split())
print((3*a+p)//2)

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

if c<d:
    s = list(s)
    h = s[b:d]
    for i in range(1,len(h)):
        if "##" in h:
            print("No")
            break
    else:
        hh = s[a:c]
        for i in range(1,len(hh)):
            if "##" in hh:
                print("No")
                break
        else:
            print("Yes")
else:
    if "..." in s[a:d]:
        h = s[a:c]
        for i in range(1,len(h)):
            if h[i]==h[i-1] and h[i]=="#":
                print("No")
                break
        else:
            hh = s[b:d]
            for i in range(1,len(hh)):
                if hh[i]==hh[i-1] and hh[i]=="#":
                    print("No")
                    break
            else:
                print("Yes")
    else:
        s = list(s)
        h = s[b:d]
        for i in range(1,len(h)):
            if h[i]==h[i-1] and h[i]=="#":
                print("No")
                break
        else:
            print("No")
Problem p03043 (python)

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

import math
x=0

for i in range(n):
    if i+1<k:
        e = math.ceil(math.log2(k/(i+1)))
        
        x += 1/(n*(2**e))
    else:
        x+= 1/n
print(x)

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

import math
import decimal

x = decimal.Decimal(0)

for i in range(n):
    e = math.floor(math.log2(k//(i+1)))+1
    print(e)
    x += decimal.Decimal(1/(n*(2**e)))
print(x)
Problem p03047 (python)

Fixed submission:
n, k = map(int,input().split())
print(n-k+1)

Buggy submission (verdict: Runtime Error):
n k = map(int,input().split())
print(n-k+1)
Problem p03059 (python)

Fixed submission:
a,b,t = map(int,input().split())
print((t//a)*b)

Buggy submission (verdict: Runtime Error):
a, b, t = map(int()input())
print((t//a)*b)
Problem p03238 (python)

Fixed submission:
n = int(input())

if n ==1:
	print("Hello World")
else:
	a = int(input())
	b = int(input())
	print(a+b)

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

x=0

for i in range(m//n):
	if m%(i+1)==0 and m//(i+1)>n-1:
		x=max(x,i+1)
print(x)
Problem p03241 (python)

Fixed submission:
import math

n,m = map(int,input().split())

x=0

s = []
for i in range(math.floor(math.sqrt(m))+3):
	if m%(i+1)==0:
		s.append(i+1)
		s.append(m//(i+1))




for i in s:
	if m%(i)==0 and m//(i)>n-1:
		x=max(x,i)
print(x)

Buggy submission (verdict: Runtime Error):
import math

n,m = map(int,input().split())

x=0

s = []
for i in range(math.sqrt(m)):
	if m%i==0:
		s.append(i)



for i in s:
	if m%(i+1)==0 and m//(i+1)>n-1:
		x=max(x,i+1)
print(x)

Buggy submission (verdict: Runtime Error):
import math

n,m = map(int,input().split())

x=0

s = []
for i in range(math.floor(math.sqrt(m)))
	if m%i==0:
		s.append(i)



for i in s
	if m%(i+1)==0 and m//(i+1)>n-1:
		x=max(x,i+1)
print(x)

Buggy submission (verdict: Runtime Error):
import math

n,m = map(int,input().split())

x=0

s = []
for i in range(math.sqrt(m))
	if m%i==0:
		s.append(i)



for i in s
	if m%(i+1)==0 and m//(i+1)>n-1:
		x=max(x,i+1)
print(x)

Buggy submission (verdict: Runtime Error):
import math

n,m = map(int,input().split())

x=0
if n<math.sqrt(m):
	for i in range(m//n):
		if m%(i+1)==0 and m//(i+1)>n-1:
			x=max(x,i+1)
	print(x)
else:
	for i in range(math.floor(math,sqrt(m))):
		if m%(i+1)==0 and m//(i+1)>n-1:
			x=max(x,i+1)
	print(x)
Problem p03244 (python)

Fixed submission:
import collections

n = int(input())
v = list(map(int,input().split()))
a = [v[i] for i in range(n) if i%2==0]
b = [v[i] for i in range(n) if i%2==1]

a = collections.Counter(a)
b = collections.Counter(b)

A = a.most_common()[:2]
A.append(("x",0))
B = b.most_common()[:2]
B.append(("x",0))
if A[0][0]==B[0][0]:
    print(n-max(A[0][1]+B[1][1],A[1][1]+B[0][1]))
else:
    print(n-A[0][1]-B[0][1])

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
v = list(map(int,input().split()))
a = [v[i] for i in range(n) if i%2==0]
b = [v[i] for i in range(n) if i%2==1]

a = collections.Counter(a)
b = collections.Counter(b)

A = a.most_common()[:2]
B = b.most_common()[:2]
if A[0][0]==B[0][0]:
    print(n-max(A[0][1]+B[1][1],A[1][1]+B[0][1]))
else:
    print(n-A[0][1]-B[0][1])

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

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

s = []
t = []


import collections

for i in range(0,n//2,2):
	s.append(v[i])
for i in range(1,n//2,2):
	t.append(v[i])

S = Counter(s)
	
T = Counter(t)

x = S.most_common()[0][0]  #sの最頻値

y = S.most_common()[1][0]  #sの2番目に多いやつ

z = T.most_common()[0][0]　

w = T.most_common()[1][0]

if x!=z:
	print(n-S.most_common()[0][1]-T.most_common()[0][1])
elif y>w:
	print(n-S.most_common()[0][1]-S.most_common()[1][1])
else:
	print(n-S.most_common()[0][1]-T.most_common()[1][1])

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

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

s = []
t = []


import collections

for i in range(0,n,2):
	s.append(v[i])
for i in range(1,n,2):
	t.append(v[i])

S = Counter(s)
	
T = Counter(t)

x = S.most_common()[0][0]  #sの最頻値

y = S.most_common()[1][0]  #sの2番目に多いやつ

z = T.most_common()[0][0]　

w = T.most_common()[1][0]

if x!=z:
	print(n-S.most_common()[0][1]-T.most_common()[0][1])
elif y>w:
	print(n-S.most_common()[0][1]-S.most_common()[1][1])
else:
	print(n-S.most_common()[0][1]-T.most_common()[1][1])
Problem p03264 (python)

Fixed submission:
k = int(input())

if k % 2 == 0:
    print((k//2)**2)
else:
    print((k//2)*((k//2)+1))

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

if k % 2 == 0:
     print((k//2)**2)
else:
     print((k//2)*((k//2)+1)

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


if k % 2 == 0:
     print((k//2)**2)
else:
     print((k//2)*((k//2)+1)

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


if K % 2 == 0:
     print((K//2)**2)
else:
     print((K//2)*((K//2)+1)

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


if K % 2 == 0:
	print((K//2)**2)
else:
	print((K//2)*((K//2)+1)

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

if K%2 == 0:
	print ((K//2)**2)
else:
	print ((K//2)*((K//2)+1)

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

if K%2 == 0:
	print ((K//2)**2)
else:
	print (((K//2)*((K//2)+1))

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


if K%2 == 0:
	print ((K//2)**2)
else:
	print ((K//2)*((K//2)+1)

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


if K%2 == 0:
	print(K//2)*(K//2)
else:
	print(K*K-1)//4

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


if K%2 == 0:
	print(K/2)*(K/2)
else:
	print(K*K-1)/4

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


if K%2 = 0:
	print(K/2)*(K/2)
else:
	print(K*K-1)/4

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

ans=0

if K%2 = 0:
	ans=(K/2)*(K/2)
else:
	ans=(K*K-1)/4

print(ans)
Problem p03282 (python)

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

t = 0
u = s[0]

for i in range(len(s)):
	t +=1
	u = s[i]
	if s[i] !="1":
		break
if t<k+1:
	print(u)
else:
	print(1)

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

t = 0
u = s[0]

for i in range(len(s)):
	t +=1
	u = s[i]
	if s[i] !="1":
		break
if t<k+1:
	print(u)
else:
	print(1

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

t = 0
u = s[0]

for i in range(len(s)):
	t +=1
	u = s[i]
	if s[i] !="1":
		break
if t<k+1:
	print(u)
else:
	print(1
Problem p03284 (python)

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

if N%K==0:
   print(0)
else:
   print(1)

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

for i in range(n//7+1):
	if n%4==0:
		print("Yes")
		break
	n -=7
else:
	print("No")

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

if N%K=0:
   print(0)
else:
   print(1)
Problem p03288 (python)

Fixed submission:
R = int(input())

if R <1200:
	print('ABC')

elif R<2800:
	print('ARC')

else :
	print('AGC')

Buggy submission (verdict: Runtime Error):
R = int(raw_input())

if R <1200:
	print('ABC')
elif 1200<=R<2800:
	print('ARC')
else :
	print('AGC')
Problem p03293 (python)

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

for i in range(len(S)):
	if T==S:
		print("Yes")
		break
	S = S[-1]+ S[0:-1]
else:
	print("No")

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

for i in range(len(S)):
	if T==S
		print("Yes")
		break
	S = S[-1]+ S[:-1]
else:
	print("No")

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

for i in range(len(S)):
	if T==S
		print("Yes")
		break
	S = S[-1]+ S[0:-1]
else:
	print("No")

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

for i in range(len(S)):
	if S==T
		print("Yes")
		break
	S = S[-1]+ S[:-1]
else:
	print("No")

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

for i in range(len(S)):
	s = S[-1]
	S'= S[0:-1]
	if S==T
		print("Yes")
		break
	S = s + S'
else:
	print("No")

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

for i in range(len(S)):
	s = S[len(S)]
	S'= S[0:-1]
	if S==T
		print("Yes")
		break
	S = s + S'
else:
	print("No")
Problem p03308 (python)

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
S = sorted(S)
print(S[-1] - S[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split())
A = sorted(A)
x = A[-1]-A[0]
print(x)

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

a=soretd(S)
print(a[-1]-a[1])

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

a=soretd(S)
print(max(a)-min(a))
Problem p03323 (python)

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

if A<9 and B<9:
	print('Yay!')
else:
	print(':(')

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

if A<9 AND B<9:
	print('Yay!')
else:
	print(':(')
Problem p03359 (python)

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

if a<b+1:
     print (a)
else:
     print (a-1)

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

if a < b-1:
print(a)

else:
print(a-1)

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

if a<b-1:
print(a)

else:
print(a-1)

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

if a<b-1:
print(a)

else:
print(a-1)
Problem p03363 (python)

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

s = []
p = 0

for i in range(n):
    p+=a[i]
    s.append(p)
s.append(0)

x = 0
import collections
s = collections.Counter(s)

y,z = zip(*s.most_common())

for i in range(len(z)):
    x += (z[i]*(z[i]-1))//2
print(x)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    a.append(input())

for i in range(n):
    a.append(a[i])


x = 0

for i in range(n):
    for j in range(n):
        for k in range(j+1):
            if a[i+j][k]==a[i+k][j]:
                continue
            else:
                break
        else:
            continue
        break
    else:
        x += 1

print(n*x)

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

s = []
p = 0

for i in range(n):
    p+=a[i]
    s.append(p)
s.append(0)

x = 0
import collections
s = collections.Counter(s)


for i in range(len(s)):
    x += (s[i][1]*(z[i][1]-1))//2
print(x)

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

s = []
p = 0

for i in range(n):
    p+=a[i]
    s.append(p)
s.append(0)

x = 0

s = collections.Counter(s)


for i in range(len(s)):
    x += (s[i][1]*(z[i][1]-1))//2
print(x)
Problem p03364 (python)

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

def check(S, A, B):
    for i in range(N):
        for j in range(i+1, N):
            if S[i][j] != S[j][i]:
                return 0
    return 1

cnt = 0
for i in range(N):
    cnt += check(S[i:] + S[:i], 0, 0)
print(cnt * N)

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

def check(S, A, B):
    for i in range(N):
        for j in range(i+1, N):
            if S[i][j] != S[j][i]:
                return 0
    else return 1

cnt = 0
for i in range(N):
    cnt += check(S[i:] + S[:i], 0, i)
print(cnt * N)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    a.append(input())
for i in range(n):
    a[i].extend(a[i])
for i in range(n):
    a.append(a[i])


x = 0

for i in range(n):
    for j in range(n):
        for k in range(j+1):
            if a[i+j][k]==a[i+k][j]:
                continue
            else:
                break
        else:
            continue
        break
    else:
        x += 1

print(n*x)