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

Fixed submission:
def solve(x, y):
    if (x + y) % 3 != 0:
        return 0
    n = (x + y) // 3
    r = min((2 * y - x) // 3, (2 * x - y) // 3)
    return cmb(n, r, mod)

_x, _y = map(int, input().split())

mod = 10 ** 9 + 7
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル

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

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

print(solve(_x, _y))

Buggy submission (verdict: Runtime Error):

mod = 10 ** 9 + 7
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] # 逆元テーブル計算用テーブル

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

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

def solve(x, y):
    if (x + y) % 3 != 0:
        return 0
    n = (x + y) // 3
    r = min((2 * y - x) // 3, (2 * x - y) // 3)
    return cmb(n, r, mod)

_x, _y = map(int, input().split())
print(solve(_x, _y))
Problem p02948 (python)

Fixed submission:
import heapq

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

cands = [[] for _ in range(m)]
for _ in range(n):
    a, b = map(int, input().split())
    if a <= m:
        cands[a - 1].append(-b)

heapq.heapify(cands[0])
total = 0
for i in range(m):
    if len(cands[0]) > 0:
        total -= heapq.heappop(cands[0])
    if i < m - 1:
        for c in cands[i + 1]:
            heapq.heappush(cands[0], c)

print(total)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
AB = [None] * n
maxa = 0
for i in range(n):
    AB[i] = tuple(map(int, input().split()))
    if AB[i][0] > maxa:
        maxa = AB[i][0]
AB.sort(key=lambda ab: -ab[1])
cands = [AB[i][1] for i in range(m - maxa)]
counts = [0] * m
for i in range(m - maxa, n):
    if AB[i][0] <= m and sum(counts[AB[i][0] - 1:]) <= m - AB[i][0]:
        cands.append(AB[i][1])
        counts[AB[i][0] - 1] += 1
print(sum(cands[:m]))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
cands = [[] for _ in range(m)]
counts = [0] * m
for _ in range(n):
    a, b = map(int, input().split())
    if a <= m:
        cands[a - 1].append(b)
        counts[a - 1] += 1
for i in range(m):
    if cands[i]:
        cands[i].sort()
score = 0
total = 0
for i in range(m):
    maxv = 0
    idx = -1
    for j in range(i + 1):
        if counts[j] and maxv < cands[counts[j] - 1]:
            maxv = cands[counts[j] - 1]
            idx = j
    if idx >= 0:
        score += maxv
        counts[idx] -= 1
    total += 1
    if total >= n:
        break
print(score)
Problem p03038 (python)

Fixed submission:
def solve(n, m, A, BC):
    # https://atcoder.jp/contests/abc127/tasks/abc127_d
    A.sort()
    BC.sort(key=lambda bc: -bc[1])
    i = 0
    finished = False
    for b, c in BC:
        for j in range(b):
            if i + j >= n:
                finished = True
                break
            if A[i + j] < c:
                A[i + j] = c
            else:
                finished = True
                break
        if finished:
            break
        i += b
    return sum(A)

_n, _m = map(int, input().split())
_A = list(map(int, input().split()))
_BC = [list(map(int, input().split())) for _ in range(_m)]
print(solve(_n, _m, _A, _BC))

Buggy submission (verdict: Runtime Error):
def solve(n, m, A, BC):
    A.sort()
    BC.sort(key=lambda bc: -bc[1])
    i = 0
    finished = False
    for b, c in BC:
        for j in range(b):
            if A[i + j] < c:
                A[i + j] = c
            else:
                finished = True
                break
        if finished:
            break
        i += b
        if i >= n:
            break
    return sum(A)

_n, _m = map(int, input().split())
_A = list(map(int, input().split()))
_BC = [list(map(int, input().split())) for _ in range(_m)]
print(solve(_n, _m, _A, _BC))

Buggy submission (verdict: Runtime Error):
def solve(n, m, A, BC):
    A.sort()
    BC.sort(key=lambda bc: -bc[1])
    i = 0
    finished = False
    for b, c in BC:
        for j in range(b):
            if A[i + j] < c:
                A[i + j] = c
            else:
                finished = True
                break
        if finished:
            break
        i += b
    return sum(A)

_n, _m = map(int, input().split())
_A = list(map(int, input().split()))
_BC = [list(map(int, input().split())) for _ in range(_m)]
print(solve(_n, _m, _A, _BC))
Problem p03073 (python)

Fixed submission:
s = input()
c0 = 0
c1 = 0
for i in range(len(s)):
  if i % 2 == 0:
    if s[i] != '0':
      c0 += 1
    if s[i] != '1':
      c1 += 1
  else:
    if s[i] != '1':
      c0 += 1
    if s[i] != '0':
      c1 += 1
print(min(c0, c1))

Buggy submission (verdict: Runtime Error):
s = input()
c0 = 0
c1 = 0
for i in range(s):
  if i % 2 == 0:
    if s[i] != '0':
      c0 += 1
    if s[i] != '1':
      c1 += 1
  else:
    if s[i] != '1':
      c0 += 1
    if s[i] != '0':
      c1 += 1
print(min(c0, c1))
Problem p03107 (python)

Fixed submission:
from collections import Counter
c = Counter(list(input())).values()
print(0 if len(c) == 1 else 2 * min(c))

Buggy submission (verdict: Runtime Error):
from collections import Counter
c = Counter(list(input())).values()
print(2 * min(c))
from collections import Counter
c = Counter(list(input())).values()
print(0 if len(c) == 1 else 2 * min(c))
Problem p02881 (python)

Fixed submission:
import math

N = int(input())
for i in range(math.floor(N**0.5),0,-1):
    if N % i == 0:
        x,y = i, N//i
        break
print(x+y-2)

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

for i in range(math.floor(N**0.5),0,-1):
    if N % i == 0:
        x,y = i, N//i
        break
print(x+y-2)
Problem p02912 (python)

Fixed submission:
from heapq import heappush, heappop
import math

N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]
heap = []

for i in itemList:
    heappush(heap, -i)

for _ in range(M):
    heappush(heap, math.ceil(heappop(heap)/2))
print(-sum(heap))

Buggy submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]
heap = []

for i in itemList:
    heappush(heap, -i)

for _ in range(M):
    heappush(heap, math.ceil(heappop(heap)/2))
print(-sum(heap))

Buggy submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split(' ')]
itemList = np.array([int(i) for i in input().split(' ')])

for _ in range(M):
    itemList[np.argmax(itemList)] //= 2        

print(sum(itemList))
Problem p03038 (python)

Fixed submission:
def check():
    N, M = map(int, input().split())
    A = sorted([int(i) for i in input().split()])
    sousa = sorted([[int(i) for i in input().split()] for i in range(M)],
                   reverse=True, key=lambda x:x[1])
    index = 0
    for cnt, value in sousa:
        for i in range(cnt):
            if index == N:
                break
            if A[index] < value:
                A[index] = value
            else:
                return(sum(A))
            index += 1
    return(sum(A))
print(check())

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
sousa = sorted([[int(i) for i in input().split()] for i in range(M)], reverse=True, key=lambda x:x[1])
for cnt, value in sousa:
    for i in range(cnt):
        if min(A) < value:
            A[A.index(min(A))] = value
        else:
            return(sum(A))
return(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
sousa = sorted([[int(i) for i in input().split()] for i in range(M)],
               reverse=True, key=lambda x:x[1])
print(sousa)
for cnt, v in sousa:
    for i in range(cnt):
        if min(A) < v:
            A[A.index(min(A))] = v
        else:
            return(sum(A))
return(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
sousa = sorted([[int(i) for i in input().split()] for i in range(M)],
               reverse=True, key=lambda x:x[1])
print(sousa)
for cnt, value in sousa:
    for i in range(cnt):
        if min(A) < value:
            A[A.index(min(A))] = value
        else:
            return(sum(A))
return(sum(A))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
A = sorted([int(i) for i in input().split()])
C = sorted([[int(i) for i in input().split()] for _ in range(M)],
           reverse=True, key=lambda x: x[1])
index, flag = 0, False

for cnt, value in C:
    for _ in range(cnt):
        if A[index] >= value:
            flag = True
            break
        A[index] = value
        index += 1
    if flag: break
print(sum(A))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
A = sorted([int(i) for i in input().split()])
C = sorted([[int(i) for i in input().split()] for _ in range(M)],
           reverse=True, key=lambda x: x[1])
index = 0

for cnt, value in C:
    for _ in range(cnt):
        if A[index] >= value:
            break
        A[index] = value
        index += 1
print(sum(A))
Problem p03127 (python)

Fixed submission:
from functools import reduce
import fractions


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


N =int(input())
monster = [int(i) for i in input().split()]
print(gcd_list(monster))

Buggy submission (verdict: Runtime Error):
import math

N =int(input())
monster = sorted([int(i) for i in input().split()])

print(math.gcd(monster[0], monster[1]))
Problem p03723 (python)

Fixed submission:
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy


def odd(n): return n & 1


def even(n): return not odd(n)


A, B, C = map(int, input().split())
ans = 0
a, b, c = A, B, C
while True:
    dump(a, b, c)
    if odd(a) or odd(b) or odd(c):
        print(ans)
        exit()
    if ans > 0 and a == A and b == B and c == C:
        print(-1)
        exit()
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    ans += 1

Buggy submission (verdict: Runtime Error):
a

Buggy submission (verdict: Runtime Error):
a
Problem p02659 (python)

Fixed submission:
from decimal import Decimal

a, b = map(Decimal, input().split())
print(int(a * b))

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<string>

using namespace std;
int main(){
    int ans;
    float a,b ;
    cin>>a ;
    cin>>b;
    ans = a*b;
    cout<<ans;
    return 0 ;
}
Problem p03207 (python)

Fixed submission:
n = int(input())
p = [int(input()) for _ in range(n)]
print(sum(p) - max(p)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(input()) for _ in range(n)]
print(p.sum() - p.max()//2)
Problem p03326 (python)

Fixed submission:
n, m = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

if m == 0:
    ans = 0
else:
    ans = 0
    for i in range(8):
        a = []
        for z in x:
            r = 0
            for j in range(3):
                r += z[j] * (1 if i&1<<j == 0 else -1)
            a.append(r)
        a.sort(reverse=True)
        ans = max(ans, sum(a[:m]))
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

if m == 0:
    print(0)
else:
    ans = 0
    for i in range(8):
        a = []
        for z in x:
            r = 0
            for j in range(3):
                r += z[j] * (1 if i&2**j == 0 else -1)
            a.append(r)
        a.sort(reverse=True)
        ans = max(ans, sum(a[:m]))
print(ans)
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

n = int(input())
tree = [[] for _ in range(n+1)]

for _ in range(n-1):
    a, b, c = map(int,input().split())
    tree[a].append([b, c])
    tree[b].append([a, c])

q, k = map(int, input().split())
d = [0] * (n+1)

def dfs(x, c, p):
    global tree
    d[x] = c
    for l, c_ in tree[x]:
        if l == p:
            continue
        else:
            dfs(l, c_+c, x)

dfs(k, 0, -1)
for i in range(q):
    a, b = map(int, input().split())
    print(d[a]+d[b])

Buggy submission (verdict: Runtime Error):
n = int(input())
tree = [[] for _ in range(n+1)]

for _ in range(n-1):
    a, b, c = map(int,input().split())
    a -= 1
    b -= 1
    tree[a].append([b, c])
    tree[b].append([a, c])

q, k = map(int, input().split())
k -= 1
d = [0] * (n+1)

def dfs(x, c, p):
    global tree
    d[x] = c
    for leaf in tree[x]:
        if leaf[0] == p:
            continue
        else:
            dfs(leaf[0], leaf[1]+c, x)

dfs(k, 0, -1)
for i in range(q):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    print(d[a]+d[b])

Buggy submission (verdict: Runtime Error):
n = int(input())
tree = [[] for _ in range(n+1)]

for _ in range(n-1):
    a, b, c = map(int,input().split())
    tree[a].append([b, c])
    tree[b].append([a, c])

q, k = map(int, input().split())

d = [0] * (n+1)

def dfs(x, c, p):
    global tree
    d[x] = c
    for leaf in tree[x]:
        if leaf[0] == p:
            continue
        else:
            dfs(leaf[0], leaf[1]+c, x)

dfs(k, 0, -1)
for i in range(q):
    a, b = map(int, input().split())
    print(d[a]+d[b])
Problem p03745 (python)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n):
    if a[-1] != b[i]:
        a.append(b[i])

ans = 1
inc = a[0] < a[min(1, n-1)]

n = len(a)
i = 1
while i < n:
    if (a[i-1] < a[i]) ^ inc:
        ans += 1
        inc = a[i] < a[min(i+1, n-1)]
        i += 2
    else:
        i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n):
    if a[-1] != b[i]:
        a.append(b[i])

ans = 1
inc = a[0] < a[1]

n = len(a)
i = 1
while i < n:
    if (a[i-1] < a[i]) ^ inc:
        ans += 1
        inc = a[i] < a[min(i+1, n-1)]
        i += 2
    else:
        i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n):
    if a[-1] != b[i]:
        a.append(b[i])

ans = 1
inc = a[0] < a[1]

n = len(a)
for i in range(1, n):
    if (a[i-1] > a[i]) ^ inc:
        pass
    else:
        ans += 1
        inc = not inc
print(ans)

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

a.sort(reverse=True)

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

print(ans)
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())
print((N // (A + B) * A) + min(A, N % (A + B)))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
blue = 'b' * A
red = 'r' * B
str = ''

while len(str) < N:
  str += blue
  str += red

print(str[:N].count('b'))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
blue = 'b' * A
red = 'r' * B
str = ''

while len(str) < N:
  str += blue
  if len(str) < N:
    str += red

print(str[:N].count('b'))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
blue = 'b' * A
red = 'r' * B
str = ''

for _ in range(N):
  for i in range(A):
    if len(str) < N:
      str += blue
  for j in range(B):
    if len(str) < N:
      str += red

print(str.count('b'))
Problem p02933 (python)

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

if a >= 3200:
	print(s)
else:
	print('red')

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

if a => 3200:
	print(s)
else:
	print('red')
Problem p02989 (python)

Fixed submission:
# ans

import sys
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
d.sort()

print(d[N // 2] - d[N // 2 - 1])

Buggy submission (verdict: Runtime Error):
# ans

import sys
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
d.sort()

print(d[N//2 + 1] - (d[N//2] - 1))

Buggy submission (verdict: Runtime Error):
# ans

import sys
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
d.sort()

print(d[N//2 + 1] - (d[N//2] - 1))

Buggy submission (verdict: Runtime Error):
# ans

import sys
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
d.sort()

print(d[N/2] - (d[N/2] - 1))
Problem p03631 (python)

Fixed submission:
N = input()

if N[0] == N[2]:
  print('Yes')
else:
  print('No')

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

if N[0] =- N[2]:
  print('Yes')
else:
  print('No')
Problem p02699 (python)

Fixed submission:
S,W = list(map(int,input().split()))
if W >= S:print('unsafe')
else: print('safe')

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

print(len(d))

Buggy submission (verdict: Runtime Error):
if W >= S:print('unsafe')
else: print('safe')
Problem p02707 (python)

Fixed submission:
import numpy as np

N = int(input())
A = np.array(input().split()).astype(int)

# res = np.sum(A == np.arange(1,N+1).reshape(N,1), axis= 1)
res = np.zeros(N).astype(int)
for i in range(N-1):
    res[A[i]-1] += 1
for i in range(N):
    print(res[i])

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

N = int(input())
A = np.array(input().split()).astype(float)

res = np.sum(A == np.arange(1,N+1).reshape(N,1), axis= 1)
for i in range(N):
    print(res[i])

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

N = int(input())
A = np.array(input().split()).astype(int)

res = np.sum(A == np.arange(1,N+1).reshape(N,1), axis= 1)
for i in range(N):
    print(res[i])

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

N = int(input())
A = np.array(input().split()).astype(int)

res = np.sum(A == np.arange(1,N+1).reshape(N,1), axis= 1)
for i in range(N):
    print(res[i])
Problem p02779 (python)

Fixed submission:
n = int(input())
if n == len(set(input().split())):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
if n = len(set(input().split())):
    print('YES')
else:
    print('NO')
Problem p02831 (python)

Fixed submission:
from fractions import gcd
def lcm(a, b):
    return a * b / gcd(a,b)
a, b = map(int, input().split())
print(int(lcm(a, b)))

Buggy submission (verdict: Runtime Error):
from math import gcd
def lcm(a, b):
    return a * b / gcd(a,b)
a, b = map(int, input().split())
print(int(lcm(a, b)))
Problem p02862 (python)

Fixed submission:
x, y = map(int, input().split())
if (x + y) % 3 != 0:
    print(0)
    exit()
a = (x + y) // 3
x -= a
y -= a
if x < 0 or y < 0:
    print(0)
    exit()
mod = 10 ** 9 + 7
def combination(n, r):
    x = 1
    y = 1
    for i in range(r):
        x = x * (n - i) % mod
        y = y * (r - i) % mod
    return (x * pow(y, mod-2, mod)) % mod
print(combination(x+y, min(x, y)))

Buggy submission (verdict: Runtime Error):
999999 999999x, y = map(int, input().split())
if (x + y) % 3 != 0:
    print(0)
    exit()
a = (x + y) // 3
x -= a
y -= a
mod = 10 ** 9 + 7
def combination(n, r):
    x = 1
    y = 1
    for i in range(r):
        x = x * (n - i) % mod
        y = y * (r - i) % mod
    return (x * pow(y, mod-2, mod)) % mod
print(combination(x+y, min(x, y)))
Problem p02954 (python)

Fixed submission:
from math import ceil
s = input()
n = len(s)
rslt = [0] * n
dic = {0:0, 1:0}
cnt = 0
for i in range(0, n):
    if s[i] == 'R':
        cnt += 1
    else:
        rslt[i] += cnt//2
        rslt[i-1] += ceil(cnt/2)
        cnt = 0
for i in range(n-1, -1, -1):
    if s[i] == 'L':
        cnt += 1
    else:
        rslt[i] += cnt//2
        rslt[i+1] += ceil(cnt/2)
        cnt = 0
print(' '.join(list(map(str, rslt))))

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
rslt = [0] * n
dic = {0:0, 1:1}
for i in range(1, n):
    if s[i] == 'L':
        rslt[i] += dic[(i+1)%2]
        rslt[i-1] += dic[i%2]
        dic[1] = 0
        dic[0] = 0
    else:
        dic[(i+1)%2] += 1
for i in range(n-1, 0, -1):
    if s[i] == 'R':
        rslt[i] += dic[(i+1)%2]
        rslt[i+1] += dic[i%2]
        dic[1] = 0
        dic[0] = 0
    else:
        dic[(i+1)%2] += 1
print(' '.join(rslt))
Problem p03286 (python)

Fixed submission:
n = int(input())
s = ''
value = 0
count = 0
while value != n:
    r = n % 2**(count+1)
    if (value + (-2)**count)%(2**(count+1)) == r:
        s += '1'
        value += (-2)**count
    else:
        s += '0'
    count += 1
if n == 0:
    print(0)
else:
    print(int(s[::-1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = ''
value = 0
count = 0
while value != n:
    r = n % 2**(count+1)
    if (value + (-2)**count)%(2**(count+1)) == r:
        s += '1'
        value += (-2)**count
    else:
        s += '0'
    count += 1
print(int(s[::-1]))
Problem p02915 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int):
    print(N ** 3)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n=int(input())
print(n＊＊3)
Problem p03221 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
import bisect

def solve(N: int, M: int, P: "List[int]", Y: "List[int]"):
    # もとの値
    val = [[] for i in range(N+1)]
    for pi, yi in [[P[i], Y[i]] for i in range(M)]:
        val[pi].append(yi)

    for i in val:
        i.sort()


    a = sorted([[P[i], Y[i]] for i in range(M)], key=lambda x:(x[0],x[1]))

    for p, y in [[P[i], Y[i]] for i in range(M)]:
        c_id = bisect.bisect_left(val[p], y)
        print(str(p).zfill(6)+str(c_id+1).zfill(6))
    
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    P = [int()] * (M)  # type: "List[int]" 
    Y = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        P[i] = int(next(tokens))
        Y[i] = int(next(tokens))
    solve(N, M, P, Y)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n, m = (int(_) for _ in input().split())
e = [[int(i) for i in input().split()] for i in range(m)]

a_dict = {}
for pi,yi in e:
    if(pi not in a_dict):
        a_dict[pi] = [yj]
    else:
        a_dict[pi] +=[yj]

for pi,yi in e:
    print('{0:06d}'.format(pi)+'{0:06d}'.format(a_dict[pi].index(yi)+1))
Problem p03242 (python)

Fixed submission:
n = input()
ln = list(n)
 
for i in range(len(ln)):
    if ln[i] == '1':
        ln[i] = '9'
    elif ln[i] == '9':
        ln[i] = '1'
        
n = ''.join(ln)
print(int(n))

Buggy submission (verdict: Runtime Error):
n = input()
ln = list(n)

for i in range(len(ln)):
    if ln[i] == '1':
        ln[i] = '9'
    elif ln[i] == '9':
        ln[i] = '1'
        
n = ''.join(ln)
print(n = ''.join(ln))