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

Fixed submission:
n, m = map(int, input().split())
num = ["A"] * n
for i in range(m):
    s, c = map(int, input().split())
    if n>1 and s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s - 1] != "A" and num[s - 1] != c:
        print(-1)
        exit()
    num[s - 1] = c

for j in range(n):
    if num[j] == "A":
        num[j] = 0
    if n>1 and num[0] == 0:
        num[0] = 1
print(int("".join(map(str, num))))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
num = ["A"] * n
for i in range(m):
    s, c = map(int, input().split())
    if n == 1 and s == 1 and c == 0:
        print(0)
        exit()
    elif s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] == "A":
        num[s-1] = c
    elif num[s-1] != "A" and num[s-1] != c:
        print(-1)
        exit()
for j in range(3):
    if num[j] == "A":
        num[j] = 0
    if num[0] == 0:
        num[0] = 1
print(int("".join(map(str, num))))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
num = ["A"] * n
for i in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] == "A":
        num[s-1] = c
    elif num[s-1] != "A" and num[s-1] != c:
        print(-1)
        exit()

for j in range(3):
    if num[j] == "A":
        num[j] = 0
    if num[0] == 0:
        num[0] = 1
print(int("".join(map(str, num))))
Problem p03478 (python)

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

total = 0
for i in range(1, n+1):
    if a <= sum(list(map(int, str(i)))) <= b:
        total += i

print(total)

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

sum = 0
for i in range(1, N+1):
    if A <= sum(list(map(int, str(i)))) <= B:
        sum += i

print(sum)

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

sum = 0
for i in range(1,N+1):
    s = sum(list(map(int, str(i))))
    if A <= s <= B:
        sum += i

print(sum)

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

list1 = []
for i in range(N+1):
    s = i//1000 + i//100-1000*(i//1000) + i//10-100*(i//100) +  i-10*(i//10)
    if A <= s <= B:
        list1.append(i)

sum = 0
for j in list1:
    sum += j

print(sum)

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

list1 = []
for i in range(N+1):
    s = i//1000 + i//100-1000*(i//1000) + i//10-100*(i//100) +  i-10*(i//10)
    print("i =",i,"s =",s)
    if A <= s <= B:
        list1.append(i)
print(list1)
sum = 0
for j in list1:
    sum += j

print(sum)
Problem p02534 (python)

Fixed submission:
K=int(input())
print("ACL"*K)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N,M=map(int,input().split())
AB=list()
memo=[False]*N
G=defaultdict(list)
def dfs(G,i):
    memo[i]=True
    for j in G[i]:
        if memo[j]==False:
            dfs(G,j)
count=0
for i in range(M):
    AB=list(map(int,input().split()))
    G[AB[1]-1].append(AB[0]-1)
    G[AB[0]-1].append(AB[1]-1)
for i in range(N):
    if memo[i]==False:
        dfs(G,i)
        count+=1
print(count-1)
Problem p03106 (python)

Fixed submission:
import math
A,B,K=map(int,input().split())
anslist=[]
for i in range(1,max(A,B)+1):
    if (A%i==0)&(B%i==0):
        anslist.append(i)
print(anslist[0-K])

Buggy submission (verdict: Runtime Error):
import math
A,B,K=map(int,input().split())
anslist=[]
for i in range(1,max(A,B)):
    if (A%i==0)&(B%i==0):
        anslist.append(i)
print(anslist[0-K])
Problem p03160 (python)

Fixed submission:
N=int(input())
h=list(map(int,input().split()))
dp=[0]*N
dp[1]=abs(h[1]-h[0])
for i in range(2,N):
    dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[1000000000000000]*N
dp[0]=0
for i in range(N-1):
    for j in range(1,K+1):
        try:
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
        except:
            break
print(dp[N-1])
Problem p02606 (python)

Fixed submission:
L,R,d = map(int,input().split())
count = 0
for i in range(L,R+1):
    if i % d == 0:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):

N = int(input())
X = int(input(), 2)
m = [-1]
p = [-1]
# したからi番目を反転
def reverse_x(i,x):
    a = 1<<i
    b = x^a
    return b
def f(n):
    def popcount(n):
        c = bin(n).count("1")
        return c
    count = 0
    if n % popcount(n) in m:
        count = p[m.index(n%popcount(n))]
        n = 0
    else:
        m.append(n % popcount(n))
    while n != 0:
        n = n % popcount(n)
        count += 1
    p.append(count)
    return count
for i in range(N):
    print(f(reverse_x(N-i-1,X)))
Problem p02618 (python)

Fixed submission:
import random
D = int(input())
c = list(map(int,input().split()))
s = []
for i in range(D):
    s.append(list(map(int,input().split())))
t = [1]*D
def my_index(l,x,d,default=False):
    if x in l:
        return l.index(x)
    else:
        return d
def last(d,i):
    a= t[:d]
    a.reverse()
    day = -1*(my_index(a,i,d))+d
    return day
score = 0
for i in range(40):
    score_v=0
    t_old = t
    d_change = random.randint(0,D-1)
    q_change = random.randint(1,26)
    t[d_change]=q_change
    for d in range(1,D+1):
        score_v += s[d-1][t[d-1]-1]
        for i in range(1,27):
            score_v -= c[i-1]*(d-last(d,i))
    if score_v>score:
        score=score_v
    else:
        t = t_old
for i in range(D):
    print(t[i])

Buggy submission (verdict: Runtime Error):
import random
D = int(input())
c = list(map(int,input().split()))
s = []
for i in range(D):
    s.append(list(map(int,input().split())))
t = [0]*D
def my_index(l,x,d,default=False):
    if x in l:
        return l.index(x)
    else:
        return d
def last(d,i):
    a= t[:d]
    a.reverse()
    day = -1*(my_index(a,i,d))+d
    return day
score = 0
score_v=0
for i in range(50):
    t_old = t
    d_change = random.randint(1,D)
    q_change = random.randint(1,26)
    t[d_change]=q_change
    for d in range(1,D+1):
        score_v += s[d-1][t[d-1]-1]
        for i in range(1,27):
            score_v -= c[i-1]*(d-last(d,i))
            if score_v>score:
                score=score_v
            else:
                t = t_old
for i in range(D):
    print(t[i])
Problem p02718 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A, reverse=True)
if A[M-1]<(sum(A)/(4*M)):
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A, reverse=True)
if A[M-1]<(Sum(A)/(4*M)):
  print("No")
else:
  print("Yes")
Problem p02534 (python)

Fixed submission:
K = input()
ALC = ""
for i in range(int(K)):
    ALC += "ACL"
print(ALC)

Buggy submission (verdict: Runtime Error):
N, K = input().split()
K = int(K)
count = 1  # 最初は必ず含む
l = []
l_true = []
S = 0
S1 = 1
for i in range(int(N)):
    l.append(int(input()))
for S1 in range(int(N)):
   for i in range(int(N)):
       if abs(l[S] - l[S1]) <= K:
            l_true.append(A2)
            count += 1
            S += 1
            S1 += 1
        else:
            pass


print(count)
Problem p03844 (python)

Fixed submission:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == "+":
    print(a + b)
elif op == "-":
    print(a - b)
else:
    pass

Buggy submission (verdict: Runtime Error):
a, op, b = input().split()
a, b = map(int())
if op = "+":
  print(a + b)
elif op = "-":
  print(a - b)
else:
  pass
Problem p02727 (python)

Fixed submission:
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort()
q.sort()
r.sort()

ans = 0

cnt = 0

while x+y-cnt > 0:
    if x > 0:
        p1 = p[-1]
    else:
        p1 = 0
    if y > 0:
        p2 = q[-1]
    else:
        p2 = 0
    if cnt < c:
        p3 = r[-1]
    else:
        p3 = 0
    eat = max(p1,p2,p3)
    ans += eat
    if x > 0 and p[-1] == eat:
        x -= 1
        p.pop()
    elif y > 0 and q[-1] == eat:
        y -= 1
        q.pop()
    else:
        cnt += 1
        r.pop()
print(ans)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort()
q.sort()
r.sort()

ans = 0

cnt = 0

while x+y-cnt > 0:
    if x > 0:
        p1 = p[-1]
    else:
        p1 = 0
    if y > 0:
        p2 = q[-1]
    else:
        p2 = 0
    p3 = r[-1]
    eat = max(p1,p2,p3)
    ans += eat
    if x > 0 and p[-1] == eat:
        x -= 1
        p.pop()
    elif y > 0 and q[-1] == eat:
        y -= 1
        q.pop()
    else:
        cnt += 1
        r.pop()
print(ans)
Problem p02787 (python)

Fixed submission:
H,N = map(int,input().split())
magic = [list(map(int,input().split())) for i in range(N)]

INF = 10**10
#print(magic)

AM = 0
for i in range(N):
    AM = max(AM,magic[i][0])
#print(AM)


dp = [INF for i in range(H+AM+1)]
dp[0] = 0

for i in range(1,H+AM+1):
    for j in range(N):
        if magic[j][0] > i:
            dp[i] = min(dp[i],magic[j][1])
        else:
            dp[i] = min(dp[i-magic[j][0]]+magic[j][1],dp[i])
ans = INF
for i in range(H,H+AM+1):
    ans = min(ans,dp[i])
print(ans)

Buggy submission (verdict: Runtime Error):
H,N = map(int,input().split())
magic = [list(map(int,input().split())) for i in range(N)]

INF = 10**10
#print(magic)

dp = [INF for i in range(H+AM+1)]
dp[0] = 0

for i in range(1,H+1):
    for j in range(N):
        if magic[j][0] > i:
            dp[i] = min(dp[i],magic[j][1])
        else:
            dp[i] = min(dp[i-magic[j][0]]+magic[j][1],dp[i])
ans = INF
print(dp[H])
Problem p02807 (python)

Fixed submission:
def modinv2(a,m):
    return pow(a,m-2,m)

def f(n,m):
    a = 1
    for i in range(2,n+1):
        a = a*i%m
    return a

N = int(input())
x = list(map(int,input().split()))

ans = 0
P = 10**9+7

b = f(N-1,P)

invlist = [1]

for i in range(1,N-1):
    inv = (invlist[-1]+modinv2(i+1,P))%P
    invlist.append(inv)
#print(invlist)

for i in range(N-1):
    l = x[i+1]-x[i]
    ans += (l*invlist[i]%P)*b%P

print(ans%P)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def modinv2(a,m):
    return pow(a,m-2,m)

def f(n,m):
    a = 1
    for i in range(2,n+1):
        a = a*i%m
    return a

N = int(input())
x = list(map(int,readline().split()))

ans = 0
P = 10**9+7

b = f(N-1,P)
#print(b)

for i in range(N-1):
    l = 0
    c = modinv2(N-1-i,P)
    #print(c)
    for j in range(i+1,N):
        l += x[j]-x[i]
        l %= P
    #print(l)
    l = l*b%P
    l = l*c%P
    ans += l

print(ans%P)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def modinv2(a,m):
    return pow(a,m-2,m)

def f(n,m):
    a = 1
    for i in range(2,n+1):
        a = a*i
    return a

N = int(input())
x = list(map(int,readline().split()))

ans = 0
P = 10**9+7

b = f(N-1,P)
#print(b)

for i in range(N-1):
    l = 0
    c = modinv2(N-1-i,P)
    #print(c)
    for j in range(i+1,N):
        l += x[j]-x[i]
        l %= P
    #print(l)
    l = l*b%P
    l = l*c%P
    ans += l

print(ans%P)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def modinv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m #負の値を返さないように

def f(n,m):
    a = 1
    for i in range(2,n+1):
        a = a*i
    return a

N = int(input())
x = list(map(int,readline().split()))

ans = 0
P = 10**9+7

b = f(N-1,P)
#print(b)

for i in range(N-1):
    l = 0
    c = modinv(N-1-i,P)
    for j in range(i,N):
        l += x[j]-x[i]
        l %= P
    #print(l)
    l = l*b%P
    l = l*c%P
    ans += l

print(ans%P)
Problem p02838 (python)

Fixed submission:
# 入力
N = int(input())
A = list(map(int,input().split()))

ans = 0
P = 10**9+7
bit = [0 for i in range(70)]

# 各bit独立に1が何個あるか数える
for i in range(N):
    S = bin(A[i])
    for j in range(1,len(S)-1):
        if S[-1*j] == '1':
            bit[j-1] += 1

# 各bitの1の個数と0の個数の積が、XOR和が1になる数字の個数と一致
for i in range(70):
    ans += (2**i)*bit[i]*(N-bit[i])
    ans %= P

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7

for i in range(60):
    c = sum([1 for ai in a if (a >> i) & 1])
    ans += (1 << i) * c * (n-c)
    ans % = mod
print(ans)
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int,input().split())
if a*a*b<=2*x:
    c=(b-x/(a**2))*2/a
    ans=math.degrees(math.atan(c))
else:
    c=a*b*b/(2*x)
    ans=math.degrees(math.atan(c))
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

if a*a*b < 2*x:
    print(90-math.degrees(math.atan(a**3/(2*(a*a*b-x)))))
else:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))

Buggy submission (verdict: Runtime Error):
import math

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

if a*a*b <= 2*x:
    print(90-math.degrees(math.atan(a**3/(2*(a*a*b-x)))))
else:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
Problem p02909 (python)

Fixed submission:
S=input()
if S=='Sunny':
    print('Cloudy')
elif S=='Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
S=input()
if S=='Sunny':
    print('Cloudy')
elif:
    print('Rainy')
else:
    print('Sunny')
Problem p02918 (python)

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

ch = 0
ans = 0

if N != 1:
    for i in range(N):
        if i == 0:
            if S[i] != S[i+1]:
                ch += 1
            if S[i] == S[i+1] == 'R':
                ans += 1
        elif i == N-1:
            if S[i] == S[i-1] == 'L':
                ans += 1
        else:
            if S[i] != S[i+1]:
                ch += 1
            if S[i] == S[i+1] == 'R' or S[i] == S[i-1] == 'L':
                ans += 1

print(ans+min(K*2,ch))

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

ch = 0
ans = 0

if N != 0:
    for i in range(N):
        if i == 0:
            if S[i] != S[i+1]:
                ch += 1
            if S[i] == S[i+1] == 'R':
                ans += 1
        elif i == N-1:
            if S[i] == S[i-1] == 'L':
                ans += 1
        else:
            if S[i] != S[i+1]:
                ch += 1
            if S[i] == S[i+1] == 'R' or S[i] == S[i-1] == 'L':
                ans += 1

print(ans+min(K*2,ch))

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

ch = 0
ans = 0
for i in range(N):
    if i == 0:
        if S[i] != S[i+1]:
            ch += 1
        if S[i] == S[i+1] == 'R':
            ans += 1
    elif i == N-1:
        if S[i] == S[i-1] == 'L':
            ans += 1
    else:
        if S[i] != S[i+1]:
            ch += 1
        if S[i] == S[i+1] == 'R' or S[i] == S[i-1] == 'L':
            ans += 1

print(ans+min(K*2,ch))
Problem p03006 (python)

Fixed submission:
import collections
import sys

N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]

if N == 1:
    print(1)
    sys.exit()

pq = []
for i in range(N):
    for j in range(N):
        if i != j:
            pq.append((xy[i][0]-xy[j][0], xy[i][1]-xy[j][1]))
#print(pq)
pqc = collections.Counter(pq)
x = pqc.most_common()[0][1]
print(N-x)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
pq = []
for i in range(N):
    for j in range(N):
        if i != j:
            pq.append((xy[i][0]-xy[j][0], xy[i][1]-xy[j][1]))
#print(pq)
pqc = collections.Counter(pq)
x = pqc.most_common()[0][1]
print(N-x)
Problem p03014 (python)

Fixed submission:
H,W = map(int,input().split())
g = [list(input()) for i in range(H)]

c = [[0 for w in range(W)] for h in range(H)]

hs = [0 for i in range(W)]

for h in range(H):
    ws = 0
    for w in range(W):
        if g[h][w] == '#':
            for i in range(ws,w):
                c[h][i] += w-ws-1
            ws = w+1
            for j in range(hs[w],h):
                c[j][w] += h-hs[w]
            hs[w] = h+1
    w2 = w+1
    for i in range(ws,w2):
        c[h][i] += w2-ws-1
h2 = h+1
for w in range(W):
    for j in range(hs[w],h2):
        c[j][w] += h2-hs[w]

#print(c)

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,c[h][w])

print(ans)
'''
横方向と縦方向に分けてプログラムを作成してまとめた
横方向
for h in range(H):
    ws = 0
    for w in range(W):
        if g[h][w] == '#':
            for i in range(ws,w):
                c[h][i] += w-ws-1
            ws = w+1
    w2 = w+1
    for i in range(ws,w2):
        c[h][i] += w2-ws-1

縦方向
hs = [0 for i in range(W)]
for h in range(H):
    for w in range(W):
        if g[h][w] == '#':
            for j in range(hs[w],h):
                c[j][w] += h-hs[w]
            hs[w] = h+1
h2 = h+1
for w in range(W):
    for j in range(hs[w],h2):
        c[j][w] += h2-hs[w]
'''

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
g = []
for i in range(N):
    g.append(list(input()))

c = []
l = []
for w in range(W):
    l.append(0)
for h in range(H):
    c.append(l)

hs = []
for i in range(W):
    hs.append(0)

for h in range(H):
    ws = 0
    for w in range(W):
        if g[h][w] == '#':
            for i in range(ws,w):
                c[h][i] += w-ws-1
            ws = w+1
            for j in range(hs[w],h):
                c[j][w] += h-hs[w]
            hs[w] = h+1
    w2 = w+1
    for i in range(ws,w2):
        c[h][i] += w2-ws-1
h2 = h+1
for w in range(W):
    for j in range(hs[w],h2):
        c[j][w] += h2-hs[w]

#print(c)

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,c[h][w])

print(ans)
'''
横方向と縦方向に分けてプログラムを作成してまとめた
横方向
for h in range(H):
    ws = 0
    for w in range(W):
        if g[h][w] == '#':
            for i in range(ws,w):
                c[h][i] += w-ws-1
            ws = w+1
    w2 = w+1
    for i in range(ws,w2):
        c[h][i] += w2-ws-1

縦方向
hs = [0 for i in range(W)]
for h in range(H):
    for w in range(W):
        if g[h][w] == '#':
            for j in range(hs[w],h):
                c[j][w] += h-hs[w]
            hs[w] = h+1
h2 = h+1
for w in range(W):
    for j in range(hs[w],h2):
        c[j][w] += h2-hs[w]
'''
Problem p03048 (python)

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

li = [R,G,B]
li.sort(reverse=True)
R = li[0]
G = li[1]
B = li[2]
#print(R,G,B)

ans = 0
for b in range(N//B+1):
    for g in range((N-B*b)//G+1):
        if N-B*b-G*g >= 0 and (N-B*b-G*g)%R == 0:
            ans += 1
print(ans)

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

ans = 0
for b in range(N+1):
    for g in range((N+1):
        if N-B*b-G*g >= 0 and (N-B*b-G*g)%R == 0:
            ans += 1
print(ans)
Problem p03071 (python)

Fixed submission:
A,B=map(int,input().split())
print(max(A+(A-1),A+B,B+(B-1)))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input()split())
print(max(A*(A-1),A*B,B*(B-1)))
Problem p03095 (python)

Fixed submission:
from collections import Counter
n = int(input())
s = input()

mod = 10**9+7

scnt = Counter(s).most_common()
ans = 1

for i in range(len(scnt)):
    ans = ans*(scnt[i][1]+1)%mod
ans = (ans - 1 + mod)%mod
print(ans)

Buggy submission (verdict: Runtime Error):
from collection import Counter
n = int(input())
s = input()

mod = 10**9+7

scnt = Counter(s).most_common()
ans = 1

for i in range(len(scnt)):
    ans = ans*scnt[i][1]%p
ans = (ans - 1 + p)%p
print(ans)
Problem p03230 (python)

Fixed submission:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(readline())

for i in range(1,1000):
    if i*(i-1)//2 == N:
        k = i
        print('Yes')
        break
    if i == 999:
        print('No')
        exit()

print(k)
ans = [[] for i in range(k)]

now = 1

import itertools
L = [i for i in range(k)]
for v in itertools.combinations(L,2):
    ans[v[0]].append(now)
    ans[v[1]].append(now)
    now += 1
for aaa in ans:
    print(len(aaa),' '.join(map(str,aaa)))

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(readline())
k = -1
for i in range(1,1000):
    if i*(i-1)//2 == N:
        k = i
        print('Yes')
        break
if k == -1:
    print('No')
    exit()

print(k)
ans = [[] for i in range(k)]

import itertools

for i,(a,b) in enemurate(itertools.combinations(range(k),2),1):
    ans[a].append(i)
    ans[b].append(i)

for aaa in ans:
    print(len(aaa),' '.join(map(str,aaa)))
Problem p03262 (python)

Fixed submission:
import fractions
 
N,X = map(int,input().split())
x = list(map(int,input().split()))
 
for n in range(N):
    x[n] = abs(x[n]-X)

if N == 1:
    ans = x[0]

else:
    ans = fractions.gcd(x[0],x[1])
    for n in range(2,N):
        ans = fractions.gcd(ans,x[n])

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions

N,X = map(int,input().split())
x = list(map(int,input().split()))

for n in range(N):
    x[n] = abs(x[n]-X)
ans = fractions.gcd(x[0],x[1])
for n in range(2,N):
    ans = fractions.gcd(ans,x[n])
print(ans)
Problem p03311 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = [A[i]-i-1 for i in range(N)]
B.sort()

ave1,ave2 = B[N//2],B[N//2-1]
ans1,ans2 = 0,0
for i in range(N):
    ans1 += abs(B[i]-ave1)
    ans2 += abs(B[i]-ave2)
print(min(ans1,ans2))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = [A[i]-i-1 for i in range(N)]
B.sort()

ave = B[N//2]
ans = 0
for i in range(N):
    ans1 += abs(B[i]-ave)
print(ans)