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

Fixed submission:
#!python3.8
# -*- coding: utf-8 -*-
# abc175/abc175_c
import sys
import math

def s2nn(s): return [int(c) for c in s.split(' ')]
def ss2nn(ss): return [int(s) for s in list(ss)]
def ss2nnn(ss): return [s2nn(s) for s in list(ss)]
def i2s(): return sys.stdin.readline().rstrip()
def i2n(): return int(i2s())
def i2nn(): return s2nn(i2s())
def ii2ss(n): return [i2s() for _ in range(n)]
def ii2nn(n): return ss2nn(ii2ss(n))
def ii2nnn(n): return ss2nnn(ii2ss(n))


def main():
    X, K, D = i2nn()
    absX = abs(X)
    if absX >= K * D:
        print(abs(absX - K * D))
        return
    try:
        a, c = divmod(absX, D)
    except:
        print(X)
        return
    b = K - a
    if b % 2:
        print(abs(c - D))
    else:
        print(abs(c))
    return


main()

Buggy submission (verdict: Runtime Error):
#!python3.8
# -*- coding: utf-8 -*-
# abc175/abc175_c
import sys
import math
 
def s2nn(s): return [int(c) for c in s.split(' ')]
def ss2nn(ss): return [int(s) for s in list(ss)]
def ss2nnn(ss): return [s2nn(s) for s in list(ss)]
def i2s(): return sys.stdin.readline().rstrip()
def i2n(): return int(i2s())
def i2nn(): return s2nn(i2s())
def ii2ss(n): return [i2s() for _ in range(n)]
def ii2nn(n): return ss2nn(ii2ss(n))
def ii2nnn(n): return ss2nnn(ii2ss(n))
 
 
def main():
    X, K, D = i2nn()
    absX = abs(X)
    sign = X // absX
    if absX >= K * D:
        print(abs(absX - K * D))
        return
    a, c = divmod(absX, D)
    b = K - a
    if b % 2:
        print(abs(c - D))
    else:
        print(abs(c))
    return
 
 
main()

Buggy submission (verdict: Runtime Error):
#!python3.8
# -*- coding: utf-8 -*-
# abc175/abc175_c
import sys
import math

def s2nn(s): return [int(c) for c in s.split(' ')]
def ss2nn(ss): return [int(s) for s in list(ss)]
def ss2nnn(ss): return [s2nn(s) for s in list(ss)]
def i2s(): return sys.stdin.readline().rstrip()
def i2n(): return int(i2s())
def i2nn(): return s2nn(i2s())
def ii2ss(n): return [i2s() for _ in range(n)]
def ii2nn(n): return ss2nn(ii2ss(n))
def ii2nnn(n): return ss2nnn(ii2ss(n))


def main():
    X, K, D = i2nn()
    absX = abs(X)
    sign = X // absX
    if absX >= K * D:
        print(abs(absX - K * D))
        return
    a, c = divmod(absX, D)
    b = K - a
    if b % 2:
        print(abs(c - D))
    else:
        print(abs(c))
    return


main()
Problem p02612 (python)

Fixed submission:
#!python3.8
# -*- coding: utf-8 -*-
# abc173/abc173_a
import sys
import math

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    a = math.ceil(N / 1000)
    ans = a * 1000 - N
    print(ans)
    return

main()

Buggy submission (verdict: Runtime Error):
print(''.join([1,2]))
Problem p02645 (python)

Fixed submission:
#!python3.8
# -*- coding: utf-8 -*-
# tokiomarine2020/tokiomarine2020_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S = i2s()
    print(S[:3])
    return

main()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
from numba import njit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
@njit('(i8[::1],)', cache=True)
def update(A):
    N = len(A)
    B = np.zeros_like(A)
    for i, x in enumerate(A):
        l = max(0, i - x)
        r = min(N - 1, i + x)
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1
    B = np.cumsum(B)
    return B
 
N, K = map(int, readline().split())
A = np.array(read().split(), np.int64)
 
K = min(K, 100)
for _ in range(K):
    A = update(A)
print(' '.join(A.astype(str)))
Problem p02797 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# keyence2020/keyence2020_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, K, S = i2nn()
    if S == 10**9:
        print(*([S] * K + [S-1] * (N - K)))
    else:
        print(*([S] * K + [S+1] * (N - K)))
    return

main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# keyence2020/keyence2020_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, K, S = i2nn()
    print(*[S] * K, *[S+1] * (N - K))
    return

main()
Problem p02802 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# abc151/abc151_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    wa_list = [0] * N
    penalty = 0
    ac = 0
    for _ in range(M):
        p, S = i2s().split(' ')
        p = int(p) - 1
        if wa_list[p] >= 0:
            if S == 'WA':
                wa_list[p] += 1
            else:
                penalty += wa_list[p]
                wa_list[p] = -1
                ac += 1
    print(ac, penalty)
    return

main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# abc151/abc151_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    wa_list = [0] * N
    penalty = 0
    ac = 0
    for _ in range(M):
        p, S = i2s().split(' ')
        p = int(p)
        if wa_list[p] >= 0:
            if S == 'WA':
                wa_list[p] += 1
            else:
                penalty += wa_list[p]
                wa_list[p] = -1
                ac += 1
    print(ac, penalty)
    return

main()
Problem p02924 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# abc139/abc139_d
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    n = N - 1
    print((n * (1 + n)) >> 1)
    return

main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# abc139/abc139_d
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    n = N - 1
    print((n * (1+n))　>>　1)
    return

main()
Problem p02952 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# abc136/abc136_b
import sys
from math import log10

N = int(sys.stdin.readline().rstrip())
len_n = int(log10(N)) + 1
s = N - 10**(len_n - 1) + 1 if len_n % 2 else 0
for i in range(1, len_n, 2):
    s += 9 * 10**(i - 1)
print(s)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# abc136/abc136_b
import sys
 
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
 
def main():
    N = i2n()
    str_n = str(N)
    len_n = len(str_n)
    s = N - int('9' * (len_n - 1)) if len_n % 2 else 0
    for i in range(1, len_n, 2):
        s += 9 * 10**(i - 1)
    print(s)
    return
 
main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# abc136/abc136_b
import sys


N = int(sys.stdin.readline().rstrip())
str_n = str(N)
len_n = len(str_n)
s = N - int('9' * (len_n - 1)) if len_n % 2 else 0
for i in range(1, len_n, 2):
    s += 9 * 10**(i - 1)
print(s)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# abc136/abc136_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    str_n = str(N)
    len_n = len(str_n)
    s = N - int('9' * (len_n - 1)) if len_n % 2 else 0
    for i in range(1, len_n, 2):
        s += 9 * 10**(i - 1)
    print(s)
    return

main()
Problem p03030 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    r = {}
    for i in range(N):
        s, p = i2s().split()
        p = int(p)
        if s in r.keys():
            r[s] += [(p, i)]
        else:
            r[s] = [(p, i)]

    rname = list(r.keys())
    rname.sort()
    # print(rname)
    for n in rname:
        out = [x[1] for x in sorted(r[n], reverse=True)]
        for m in out:
            print(m + 1)

main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    L = [0] * N
    for i in range(N):
        s, p = i2s().split()
        L[i] = (s, int(p), i)

    L.sort(key=lambda x: (x[0], -x[1])
    for l in L:
        print(l[2])

main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    L = [0] * N
    for i in range(N):
        s, p = i2s().split()
        L[i] = (s, inr(p), i)

    L.sort(key=lambda x: (x[0], -x[1])
    for l in L:
        print(l[2])

main()
Problem p03035 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# abc127/abc127_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    a,b = i2nn()
    if a >= 13:
        print(b)
    elif a >= 6:
        print(int(b / 2))
    else:
        print(0)

main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# abc127/abc127_d
import sys
from operator import itemgetter

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

      


def main():
    N, M = i2nn()
    A = [(1, x) for x in i2nn()]
    S = [0] * M
    for j in range(M):
        S[j] = tuple(i2nn())
    S.extend(A)
    R = sorted(S, key=itemgetter(1))
    sum = 0
    while True:
        p = R.pop()
        if N - p[0] > 0:
            sum += p[0] * p[1]
            N -= p[0]
        else:
            sum += p[1] * N
            break
    print(sum)
    return

main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# abc127/abc127_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))


def main():
    N, M = i2nn()
    L, R = (0, N)
    for i in range(M):
        Li, Ri = i2nn()
        if L < Li:
            L = Li
        if Ri < R:
            R = Ri
    if L > R:
        print(0)
    else:
        print(R - L + 1)
    return

main()

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a >= 13:
  pria,b=map("int",input().split())
if a >= 13:
  print(b)
elif a >= 6:
  print(b / 2)
else:
  print(0)
Problem p03048 (python)

Fixed submission:
# AtCoder Grand Contest 033
# https://atcoder.jp/contests/agc033
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))



def main():
    R, G, B, N = i2nn()
    #a = []
    cnt = 0
    for r in range(N // R + 1):
        for g in range((N - R * r) // G + 1):
            #print([r, g, 0], N - R * r - G * g)
            if (N - R * r - G * g) % B == 0:
                cnt += 1
                #a.append([r,g,(N - R * r - G * g) // B])
    #print(a)
    print(cnt)
main()

Buggy submission (verdict: Runtime Error):
# AtCoder Grand Contest 033
# https://atcoder.jp/contests/agc033
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))



def main():
    R, G, B, N = i2nn()
    #a = []
    cnt = 0
    R, G, B = sorted((R, G, B), revere=True)
    for r in range(N // R + 1):
        for g in range((N - R * r) // G + 1):
            #print([r, g, 0], N - R * r - G * g)
            if (N - R * r - G * g) % B == 0:
                cnt += 1
                #a.append([r,g,(N - R * r - G * g) // B])
    #print(a)
    print(cnt)
main()
Problem p03059 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import re
import math

[a,b,t] = [int(x) for x in input().split()]

print(math.floor((t+0.5)/a)*b)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

n = int(input())
a = [int(x) for x in input().split()]

r = {}

for j in a:
    for i in range(1, int(j**0.5)+1):
        if j % i == 0:
            if i in r.keys():
                r[i] += 1
            else:
                r[i] = 1
            if i != j // i:
                if j//i in r.keys():
                    r[j//i] += 1
                else:
                    r[j//i] = 1
m = n - 1
r_a = sorted([i[0] for i in r.items() if i[1] >= m], reverse=True)
print(r_a[0])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

n = int(input())
a = [int(x) for x in input().split()]

r = {}

for j in a:
    for i in range(1, int(j**0.5)+1):
        if j % i == 0:
            if i in r.keys():
                r[i] += 1
            else:
                r[i] = 1
            if i != j // i:
                if j//i in r.keys():
                    r[j//i] += 1
                else:
                    r[j//i] = 1
m = n - 1
r_a = sorted([i[0] for i in r.items() if i[1] >= m], reverse=True)
print(r_a[0])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
import collections

n = int(input())
a = [int(x) for x in input().split()]

r = []

for j in a:
    for i in range(1, int(j**0.5)+1):
        if j % i == 0:
            r.append(i)
            if i != j // i:
                r.append(j // i)

c = collections.Counter(r)
m = c.most_common()
mc = m[0][1] - 1
c_a = [i[0] for i in m if i[1] >= mc]
print(sorted(c_a)[-1])
Problem p02663 (python)

Fixed submission:
h,m,h2,m2,k=map(int,input().split())
a=h*60+m
b=h2*60+m2
if a>b:
    b+=60*24
#print(b)

print(((b-a)-k))

Buggy submission (verdict: Runtime Error):
h,m,h2,m2,k=map(int,input().split())
a=h*60+m
b=h2*60+m2
if a>b:
    b+=60*24
#print(b)

print(((b-a)-k)
Problem p02743 (python)

Fixed submission:

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

if c-a-b<0:
    print("No")
elif 4*a*b<(c-a-b)**2:#式変形桁落ちはわかっていたが式変形のかんがえかたがなかった
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
div=2
ac=1
bc=1
cc=1
for i in range(2,10**4):
    if a%(i**2)==0:
        a=a//(i**2)
    ac*=i

for i in range(2,10**4):
    if b%(i**2)==0:
        b=b//(i**2)
    bc*=i

for i in range(2,10**4):
    if c%(i**2)==0:
        c=c//(i**2)
    cc*=i

if ac*(a**0.5)+bc*(b**0.5)<cc*(c**0.5):
    print("Yes")
else:
    print("No")
Problem p02761 (python)

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


a=[]
for i in range(m):
    a.append(list(map(int,input().split())))


if m==0:
    if n==1:
        print(0)
    elif n==2:
        print(10)
    else:
        print(100)
    exit()

for i in range(m-1):
    for j in range(i+1,m):
        if a[i][0]==a[j][0]:
            if a[i][1]!=a[j][1]:
                print(-1)
                exit()

a.sort()
a1=10
a2=10
a3=10
if n==3:
    for i in range(m):
        if a[i][0]==1:
            a1=a[i][1]
        if a[i][0]==2:
            a2=a[i][1]
        if a[i][0]==3:
            a3=a[i][1]
    if a1==0:
        print(-1)
        exit()
    if a1==10:
        a1=1
    if a2==10:
        a2=0
    if a3==10:
        a3=0
    if (a1%10)*100+(a2%10)*10+(a3%10)==0:
        print(-1)
    else:
        print((a1%10)*100+(a2%10)*10+(a3%10))

elif n==2:
    for i in range(m):
        if a[i][0]==1:
            a1=a[i][1]
        if a[i][0]==2:
            a2=a[i][1]
    if a1==0:
        print(-1)
        exit()
    if a1==10:
        a1=1
    if a2==10:
        a2=0

    if (a1%10)*10+(a2%10)==0:
        print(-1)
    else:
        print((a1%10)*10+(a2%10)*1)

else:
    for i in range(m):
        if a[i][0]==1:
            a1=a[i][1]
    
    print(a1%10)

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

if n==3:
    mod=100
elif n==2:
    mod=10
else:
    mod=1

a=[]
for i in range(m):
    a.append(list(map(int,input().split())))


for i in range(m-1):
    for j in range(i+1,m):
        if a[i][0]==a[j][0]:
            if a[i][1]!=a[j][1]:
                print(-1)
                exit()

a.sort()
a1=10
a2=10
a3=10
for i in range(m):
    if a[i][0]==1:
        a1=min(a1,a[i][1])
    if a[i][0]==2:
        a2=min(a2,a[i][1])
    if a[i][0]==3:
        a3=min(a3,a[i][1])
ans=0
if a1!=10:
    ans+=a1*100
if a2!=10:
    ans+=a2*10
if a3!=10:
    ans+=a3


if ans==0:
    print(-1)
else:
    if n==2:
        ans=list(ans)
        for i in range(2):
            print(ans[i],end="")
    elif n==1:
        ans=list(ans)
        print(ans[0])
    else:
        print(ans)
Problem p02802 (python)

Fixed submission:

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

c=[]
for i in range(b):
    d,e=map(str,input().split())
    c.append([int(d),e])

acans=0
waans=0
ac=[0]*(a+1)
wa=[0]*(a+1)
for i in range(b):
    if c[i][1]=="AC":
        if ac[c[i][0]-1]==0:
            acans+=1
            ac[c[i][0]-1]+=1
            waans+=wa[c[i][0]-1]
    else:
        wa[c[i][0]-1]+=1
#print(ac)
#print(wa)
print(acans,waans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=[list(map(str,input().split())) for i in range(b)] 
for i in range(b):
    s[i][0]=int(s[i][0])
if b==0:
    print("0 0")
    exit()
aans=0
wans=0
c1=0
for i in range(b-1,-1,-1):
    if s[i][1]=="AC":
        count=i
        break
for i in range(count):
    if s[i][1]=="WA":
        wans+=1

s= list(map(list, set(map(tuple, s))))
for i in range(len(s)):
    if s[i][1]=="AC":
        aans+=1
print(aans,end=" ")
print(wans)
Problem p02866 (python)

Fixed submission:
import collections
n = int(input())
d = list(map(int, input().split()))
mod = 998244353
f = collections.Counter(d)
# print(f)
if d[0] != 0 or f[0] != 1:  # 0は一個だけ
    print(0)
    exit()
ans = 1
box = 1  # 値自体の個数を保存
maxd = max(d)

for i in range(maxd+1):
    ans = ans*box**f[i]
    ans %= mod
    box = f[i]
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = [int(i) for i in input().split()] 
if a[0]!=0||a[n]==0:
    print (0%998244353)
else:
    a = Counter(a)
    ans = 1
    for i in range(1,len(a)-1): 
        ans*=a[i]**a[i+1]
    print(ans%998244353)

Buggy submission (verdict: Runtime Error):

   from collections import Counter
n = int(input())
a = [int(i) for i in input().split()] 
if a[0]!=0:
    print ("0")
else:
    a = Counter(a)
    ans = 1
    for i in range(1,len(a)):   
        print(a[i])
        ans*=a[i]**a[i+1]
    print(ans)
Problem p02885 (python)

Fixed submission:
a,b=map(int,input().split())
if(a-2*b>0):
    print(a-2*b)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int (input())
if(a-2*b>0):
    print(a-2*b)
else:
    print(0)
Problem p02924 (python)

Fixed submission:
a=int(input())
print(a*(a+1)//2-a)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=[0]*a

for i in range(a):
    b[i]=i+1
print(sum(b)-b[-1])
Problem p02953 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
v = -1
for h in H:
    if v > h:
        if v != h+1:
            print("No")
            exit()
        else:
            v = h+1
    else:
        v = h
print("Yes")

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

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

for i in range(n-2):
    if h[i+1]-h[i]>=2:
        print("No")
        break
    else:
        if h[i]<h[i+i]:
            h[i+1]-=1
else:
    if h[-2]<=h[-1]:
        print("Yes")
    else:
        print("No")

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

h=list(map(int,input()))
if h[-1]==1:
    print("Yes")
else:
    print("No")
Problem p02957 (python)

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

if (a+b)%2==0:
    print((a+b)//2)
else:
    print("IMPOSSIBLE")

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

if a*b%2==0:
    printf(a*b/2)
else:
    print("IMPOSSIBLE")