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

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

from collections import Counter
l1 = Counter(l[0::2])
mostl1 = l1.most_common()[0]
#semimostl1 = l1.most_common()[1]

l2 = Counter(l[1::2])
mostl2 = l2.most_common()[0]
#semimostl2 = l2.most_common()[1]

if mostl1[0] != mostl2[0]:
    print(n-mostl1[1]-mostl2[1])
elif len(l1.keys()) == 1 and len(l2.keys()) == 1:
    print(int(n/2))

else:
    semimostl1 = l1.most_common()[1]
    semimostl2 = l2.most_common()[1]
    print(min(n - mostl1[1] - semimostl2[1], n - semimostl1[1] - mostl2[1]))


#elif print(min(n-mostl1[1]-mostl2[1],n-mostl1[1]-mostl2[1]))

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

from collections import Counter
l1 = Counter(l[0::2])
mostl1 = l1.most_common()[0]
#semimostl1 = l1.most_common()[1]

l2 = Counter(l[1::2])
mostl2 = l2.most_common()[0]
#semimostl2 = l2.most_common()[1]

if mostl1[0] != mostl2[0]:
    print(n-mostl1[1]-mostl2[1])
else:
    semimostl1 = l1.most_common()[1]
    semimostl2 = l2.most_common()[1]
    print(min(n - mostl1[1] - semimostl2[1], n - semimostl1[1] - mostl2[1]))
    
    
#elif print(min(n-mostl1[1]-mostl2[1],n-mostl1[1]-mostl2[1]))

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

from collections import Counter
l1 = Counter(l[0::2])
mostl1 = l1.most_common()[0]
semimostl1 = l1.most_common()[1]

l2 = Counter(l[1::2])
mostl2 = l2.most_common()[0]
semimostl2 = l2.most_common()[1]

if mostl1[0] != mostl2[0]:
    print(n-mostl1[1]-mostl2[1])
#elif print(min(n-mostl1[1]-mostl2[1],n-mostl1[1]-mostl2[1]))
Problem p03260 (python)

Fixed submission:
a,b = map(int,input().split())
if (a*b)%2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    while b!=0:
        a,b = b,b%a
    return a
def lcm(a,b):
    return (a*b)//gcd(a,b)

N,X = map(int,input().split())
x = list(map(int,input().split()))
x = list(map(lambda q:abs(q-X),x))
ans = 1
for xx in x:
    ans = gcd(ans,xx)
print(ans)
Problem p03387 (python)

Fixed submission:
n = list(map(int,input().split()))
d = max(n)
s = sum(n)
if (3*d-s)%2 == 0:
    print(int((3*d-s)/2))
else:print(int((3*(d+1)-s)/2))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
d = max(a,b,c)
s = sum(a,b,c)
if (3*d-s)%2 == 0:
    print(d)
else:print(d+1)
Problem p03399 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
print(min(a,b)+min(c,d))
Problem p03436 (python)

Fixed submission:
from collections import deque
H, W = map(int,input().split())
grid = [list(input()) for _ in range(H)]
w_cnt = 0
for i in range(H):
    w_cnt += grid[i].count('.')


inf = float('inf')
d = [[inf]*W for _ in range(H)]
dx = [0,1,0,-1]
dy = [1,0,-1,0]


d[0][0] = 0
que = deque()
que.append([0,0])
while len(que) != 0:
    p = que.popleft()
    if p[0] == W-1 and p[1] == H-1:break
    for i in range(4):
        nx = p[0] + dx[i]
        ny = p[1] + dy[i]
        #print(nx,ny)
        if 0 <= nx <= W-1 and 0 <= ny <= H-1 and grid[ny][nx] == '.' and d[ny][nx] == inf:
            que.append([nx,ny])
            d[ny][nx] = d[p[1]][p[0]] + 1

# print(d)
# print(d[H-1][W-1])
if d[H-1][W-1] == inf:
    print(-1)
else:
    print(w_cnt-d[H-1][W-1]-1)

Buggy submission (verdict: Runtime Error):
from collections import deque
H, W = map(int,input().split())
grid = [list(input()) for _ in range(H)]
w_cnt = 0
for i in range(H):
    w_cnt += grid[i].count('.')


inf = float('inf')
d = [[inf]*W for _ in range(H)]
dx = [0,1,0,-1]
dy = [1,0,-1,0]


d[0][0] = 0
que = deque()
que.append([0,0])
while len(que) != 0:
    p = que.popleft()
    if p[0] == H-1 and p[1] == W-1:break
    for i in range(4):
        nx = p[0] + dx[i]
        ny = p[1] + dy[i]
        if 0 <= nx <= W-1 and 0 <= ny <= H-1:
            #print(nx,ny)
            if grid[nx][ny] != '#' and d[nx][ny] == inf:
                que.append([nx,ny])
                d[nx][ny] = d[p[0]][p[1]] + 1

# print(d)
# print(d[H-1][W-1])
if d[H-1][W-1] == inf:
    print(-1)
else:
    print(w_cnt-d[H-1][W-1]-1)
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*(a)+100*(b)+50*(c) == X:
                ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in A:
    for b in B:
        for c in C:
            if 500*(a+1)+100*(b+1)+50*(c+1) == X:
                ans += 1
print(ans)
Problem p03457 (python)

Fixed submission:
N = int(input())
prevt,prevx,prevy = 0,0,0
for i in range(N):
    t, x, y = map(int,input().split())
    dt,dx,dy = t-prevt,x-prevx,y-prevy
    if dt < dx+dy or (dt-dx-dy)%2 != 0:
        print('No')
        exit()
    prevt,prevx,prevy = t,x,y
print('Yes')

Buggy submission (verdict: Runtime Error):
/home/hiroya/.pyenv/versions/anaconda3-5.3.1/bin/python /home/hiroya/06_coding/aa.py
2
5 1 1
100 1 1No

Process finished with exit code 0
Problem p03501 (python)

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

Buggy submission (verdict: Runtime Error):
# bit全探索
N = int(input())
F = [list(map(int,input().split())) for _ in range(N)]
P = [list(map(int,input().split())) for _ in range(N)]
ans = -float('inf')
for i in range(2**10):
    if i == 0: # 全く営業しないパターン
        continue
    profit = 0
    pattern = [0]*10
    for j in range(10):
        if 1 << j & i:
            pattern[j] = 1
    #print(pattern)

    for k in range(N):
        l = sum([pattern[m] == F[k][m] == 1 for m in range(10)])
        # l = 0
        # for m in range(10):
        #     if pattern[m] == F[k][m] == 1:
        #         l += 1

        #print(l)
        profit += P[k][l]
    ans = max(ans,profit)
print(ans)
Problem p03543 (python)

Fixed submission:
S = input()
cnt = 0
temp = S[0]
for s in S[1:]:
    if s == temp:
        cnt += 1
    else:
        cnt = 0
        temp = s
    if cnt >= 2:
        print("Yes")
        exit()
print("No")

Buggy submission (verdict: Runtime Error):
S = input()
cnt = 0
temp = S[0]
for s in S:
    if s == temp:
        cnt += 1
    else:
        cnt = 0
        temp = s
    if s >= 3:
        print("Yes")
        exit()
print("No")
Problem p03544 (python)

Fixed submission:
N = int(input())
memo = [0]*(N+1)
memo[0] = 2
memo[1] = 1
for n in range(2,N+1):
    memo[n] = memo[n-1]+memo[n-2]
print(memo[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
memo = [0]*N
memo[0] = 2
memo[1] = 1
for n in range(2,N):
    memo[n] = memo[n-1]+memo[n-2]
print(memo[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
memo = [0]*N
memo[0] = 2
memo[1] = 1
for n in range(2,N):
    memo[n] = memo[n-1]+memo[n-2]
print(memo[N])
Problem p03646 (python)

Fixed submission:
K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += K//N
r = K%N
for i in range(r):
    num[i] += N
    for j in range(N):
        if j != i:
            num[j] -= 1
print(N)
print(*num)

Buggy submission (verdict: Runtime Error):
K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += N//K
r = N%K
for i in range(r):
    num[i] += N
    for j in range(N):
        if j != i:
            num[j] -= 1
print(N)
print(*num)

Buggy submission (verdict: Runtime Error):
K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += N//K
r = N%K
for _ in range(r):
    head = num.pop(0)
    for i in range(N-1):
        num[i] += 1
    num.append(head+N)
print(N)
print(*num)
Problem p03681 (python)

Fixed submission:
import math
n,m=map(int,input().split())
mod=10**9+7
if abs(n-m)>1:
    print(0)
elif abs(n-m)==1:
    print(math.factorial(n)*math.factorial(m)%mod)
else:
    print(2*math.factorial(n)*math.factorial(m)%mod)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5)

def my_factorial(n):
    if n == 0:
        return 1

    else:
        return n * my_factorial(n-1)

N,M = map(int,input().split())
if abs(N-M) >= 2:
    print(0)
elif abs(N-M) == 1:
    print(my_factorial(N) * my_factorial(M))
else:
    print(2*my_factorial(N)*my_factorial(M))

Buggy submission (verdict: Runtime Error):
/home/hiroya/.pyenv/versions/anaconda3-5.3.1/bin/python /home/hiroya/06_coding/aaa.py
4 4
1152

Process finished with exit code 0
Problem p03695 (python)

Fixed submission:
N = int(input())
color = [0]*8
free = 0
A = list(map(int,input().split()))
for a in A:
    if 1<=a<=399:
        color[0] = 1
    elif 400<=a<=799:
        color[1] = 1
    elif 800<=a<=1199:
        color[2] = 1
    elif 1200<=a<=1599:
        color[3] = 1
    elif 1600<=a<=1999:
        color[4] = 1
    elif 2000<=a<=2399:
        color[5] = 1
    elif 2400<=a<=2799:
        color[6] = 1
    elif 2800<=a<=3199:
        color[7] = 1
    else:
        free += 1
maxcolor = sum(color)+free
mincolor = max(sum(color),1)
print(mincolor,maxcolor)

Buggy submission (verdict: Runtime Error):
N = int(input())
color = [0]*8
free = 0
for _ in range(N):
    a  = int(input())
    if 1<=a<=399:
        color[0] = 1
    elif 400<=a<=799:
        color += 1
    elif 800<=a<=1199:
        color += 1
    elif 1200<=a<=1599:
        color += 1
    elif 1600<=a<=1999:
        color += 1
    elif 2000<=a<=2399:
        color += 1
    elif 2400<=a<=2799:
        color += 1
    elif 2800<=a<=3199:
        color += 1
    else:
        free += 1
maxcolor = sum(color)+free
mincolor = sum(color)
print(mincolor,maxcolor)

Buggy submission (verdict: Runtime Error):
N = int(input())
color = [0]*8
free = 0
for _ in range(N):
    a  = int(input())
    if 1<=a<=399:
        color[0] = 1
    elif 400<=a<=799:
        color += 1
    elif 800<=a<=1199:
        color += 1
    elif 1200<=a<=1599:
        color += 1
    elif 1600<=a<=1999:
        color += 1
    elif 2000<=a<=2399:
        color += 1
    elif 2400<=a<=2799:
        color += 1
    elif 2800<=a<=3199:
        color += 1
    else:
        free += 1
maxcolor = sum(color)+free
mincolor = sum(color)
print(mincolor,maxcolorx)
Problem p03697 (python)

Fixed submission:
a,b = map(int,input().split())
if a+b >= 10:print("error")
else:print(a+b)

Buggy submission (verdict: Runtime Error):
import math
N,A,B = map(int,input().split())
H = [int(input()) for _ in range(N)]


def enough(T):
    temp = 0
    ch = H[:]
    for h in ch:
        left = h - B*T
        if left > 0:
            temp += (left + A-B-1)//(A-B)
            #temp += math.ceil(left/(A-B))
            #print(temp)

    if temp > T:
        return False
    else:
        return True

#print(enough(2))
ok = 10**15
ng = 0

while ok - ng > 1:
    mid = (ok + ng)//2
    if enough(mid):
        ok = mid
    else:
        ng = mid
    #print(ok,ng)
print(ok)
Problem p03698 (python)

Fixed submission:
from collections import Counter
l = list(input())
c = Counter(l)
if max(c.values()) >= 2:
    print('no')
else:
    print('yes')

Buggy submission (verdict: Runtime Error):
from collections import Counter
l = list(input())
c = Counter(l)
if max(c) >= 2:
    print('yes')
else:
    print('no')
Problem p04000 (python)

Fixed submission:
H,W,N = map(int,input().split())
d = {}
for _ in range(N):
    a,b = list(map(int,input().split()))
    for dy in range(-1,2):
        for dx in range(-1,2):
            cy = a + dy
            cx = b + dx
            if 2 <= cy <= H-1 and 2 <= cx <= W-1:
                if (cy,cx) not in d:
                    d[(cy,cx)] = 1
                else:
                    d[(cy, cx)] += 1
ans = [0]*10
for v in d.values():
    ans[v] += 1
ans[0] = (H-2)*(W-2) - sum(ans[1:])

for i in range(10):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
H,W,N = map(int,input().split())
g = [[0]*(W+2) for _ in range(H+2)] # 0:white 1:black
a = [0]*N
b = [0]*N
seen = [[False]*(W+2) for _ in range(H+2)]
ans = [0]*10
for i in range(N):
    a[i], b[i] = map(int,input().split())
    g[a[i]][b[i]] = 1
# 黒マスの周り9領域を探索する
for y,x in zip(a,b):
    for dy in range(-1,2):
        for dx in range(-1,2):
            if 2 <= x + dx <= W-1 and 2 <= y + dy <= H-1:
                cy = y+dy # 中心を決める
                cx = x+dx
                if seen[cy][cx]:
                    continue
                seen[cy][cx] = True
                black_cnt = 0
                for ddx in range(-1,2):
                    for ddy in range(-1,2):
                        black_cnt += g[cy+ddy][cx+ddx]
                ans[black_cnt] += 1
ans[0] = (H-2)*(W-2) - sum(ans[1:])

# for i in range(H+2):
#     print(g[i])
for i in range(10):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
H,W,N = map(int,input().split())
g = [[0]*(W+2) for _ in range(H+2)] # 0:white 1:black
a = [0]*N
b = [0]*N
seen = [[False]*(W+2) for _ in range(H+2)]
ans = [0]*10
for i in range(N):
    a[i], b[i] = map(int,input().split())
    g[a[i]][b[i]] = 1
# 黒マスの周り9領域を探索する
for y,x in zip(a,b):
    for dy in range(-1,2):
        for dx in range(-1,2):
            if 2 <= x + dx <= W-1 and 2 <= y + dy <= H-1:
                cy = y+dy # 中心を決める
                cx = x+dx
                if seen[cy][cx]:
                    continue
                seen[cy][cx] = True
                black_cnt = 0
                for ddx in range(-1,2):
                    for ddy in range(-1,2):
                        black_cnt += g[cy+ddy][cx+ddx]
                ans[black_cnt] += 1
ans[0] = (H-2)*(W-2) - sum(ans[1:])

# for i in range(H+2):
#     print(g[i])
for i in range(10):
    print(ans[i])
Problem p04030 (python)

Fixed submission:
s = list(input())
w =[]
for i in s:
    if i == "B":
        if len(w) !=0:
            w.pop(-1)
    else:
        w.append(i)
print("".join(w))

Buggy submission (verdict: Runtime Error):
s = list(input())
w =[]
for i in s:
    if i == "B":
        w.pop(-1)
    else:
        w.append(i)
print("".join(w))
Problem p04043 (python)

Fixed submission:
#wlist = list(map(int,input().split()))
nlist = list(input().split())
if nlist.count("5") ==2 and nlist.count("7")==1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
#wlist = list(map(int,input().split()))
nlist = list(input().split())
if nlist.couunt("5") ==2 and nlist.count("7")==1:
    print("YES")
else:
    print("NO")
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
import numpy as np
AB = np.prod(np.array(list(map(int,input()))))
print(AB)
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
  int a,b,c;
  cin >>a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << " " << b << " " << c << endl;
}
Problem p02783 (python)

Fixed submission:
h,a=map(int, input().split())
print((h-1)//a+1)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  // string s; cin >> s;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  // ll ans = 0;
  // bool ok = false;

  // cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}
Problem p02609 (python)

Fixed submission:
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    X = input()

    popcount_X = X.count("1")
    if popcount_X == 0:
        ans = [1] * N
    elif popcount_X == 1:
        ans = [1] * N
        ans[-1] = 2
        ans[X.index("1")] = 0
    else:
        X_mod_popcount_X_p = int(X, 2) % (popcount_X + 1)
        X_mod_popcount_X_m = int(X, 2) % (popcount_X - 1)
        ans = [0] * N
        for i in range(N):
            if X[i] == "0":
                Y = X_mod_popcount_X_p + pow(2, N - 1 - i, mod=popcount_X + 1)
                Y = Y % (popcount_X + 1)
            else:
                Y = X_mod_popcount_X_m - pow(2, N - 1 - i, mod=popcount_X - 1)
                Y = Y + (popcount_X - 1)
                Y = Y % (popcount_X - 1)
            count = 1
            while Y > 0:
                popcount = bin(Y).count("1")
                Y = Y % popcount
                count += 1
            ans[i] = count

    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys

import numba as nb
import numpy as np

input = sys.stdin.readline


@nb.njit("i8[:](i8,unicode_type,i8)", cache=True)
def solve(N, X, X_int):
    popcount_X = X.count("1")
    if popcount_X == 0:
        ans = np.ones(N, dtype=np.int64)
    elif popcount_X == 1:
        ans = np.ones(N, dtype=np.int64)
        ans[-1] = 2
        ans[int(X.index("1"))] = 0
    else:
        X_mod_popcount_X_p = X_int % (popcount_X + 1)
        X_mod_popcount_X_m = X_int % (popcount_X - 1)
        ans = np.zeros(N, dtype=np.int64)
        for i in range(N):
            if X[i] == "0":
                Y = X_mod_popcount_X_p + (2 ** (N - 1 - i)) % (popcount_X + 1)
                Y = Y % (popcount_X + 1)
            else:
                Y = X_mod_popcount_X_m - (2 ** (N - 1 - i)) % (popcount_X - 1)
                Y = Y + (popcount_X - 1)
                Y = Y % (popcount_X - 1)
            count = 1
            while Y > 0:
                popcount = 0
                tmp = Y
                while tmp > 0:
                    if tmp & 1:
                        popcount += 1
                    tmp >>= 1
                Y = Y % popcount
                count += 1
            ans[i] = count

    return ans


def main():
    N = int(input())
    X = input()

    ans = solve(N, X, int(X, 2))
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()
Problem p02744 (python)

Fixed submission:
import sys
from collections import deque

input = sys.stdin.readline


def dfs(N):
    alphabet = "abcdefghij"
    stack = deque(["a"])
    while stack:
        s = stack.pop()
        if len(s) == N:
            print(s)
            continue
        suffixes = []
        for al in alphabet:
            suffixes.append(al)
            if al not in s:
                break
        for suffix in reversed(suffixes):
            stack.append("".join((s, suffix)))


def main():
    N = int(input())

    dfs(N)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math

al = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]

N = int(input())
S = [[""] * math.factorial(i+1) for i in range(N-1)]

S[0][0] = al[0]
for i in range(1, N-1):
  prev_S = S[i-1]
  al_use = al[:i+1]
  S[i] = [s + a for s in prev_S for a in al_use]

prev_S = S[N-2]
al_use = al[:N]
for s in prev_S:
  for a in al_use:
    print(s + a)
Problem p02761 (python)

Fixed submission:
N, M = [int(i) for i in input().split()]
s = [0] * M
c = [0] * M
for i in range(M):
  s[i], c[i] = map(int, input().split())

ans = 1000
for i in range(1000):
  S = str(i)
  if len(S) != N:
    continue
  
  is_ok = True
  for j in range(M):
    if S[s[j]-1] != str(c[j]):
      is_ok = False
      
  if is_ok:
    ans = min(ans, i)

if ans == 1000:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]
s = [0] * M
c = [0] * M
for i in range(M):
  s[i], c[i] = map(int, input().split())

ans = 1000
for i in range(1000):
  S = str(i)
  if len(S) != N:
    continue
  
  is_ok = True
  for j in range(M):
    if S[s[j]] != c[j]:
      is_ok = False
      
  if is_ok:
    ans = min(ans, i)

if ans == 1000:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]
s = [0] * M
c = [0] * M
for i in range(N):
  s[i], c[i] = map(int, input().split())

ans = 1000
for i in range(1000):
  S = str(i)
  if len(S) != N:
    continue
  
  is_ok = True
  for j in range(M):
    if S[s[j]] != c[j]:
      is_ok = False
      
  if is_ok:
    ans = min(ans, i)

if ans == 1000:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]
s = [0] * M
c = [0] * M
for i in range(N):
  s[i], c[i] = map(int, input().split())

ans = 1000
for i in range(1000):
  S = str(i)
  if len(S) != N:
    continue
  
  is_ok = True
  for j in range(N):
    if S[s[j]] != c[j]:
      is_ok = False
      
  if is_ok:
    ans = min(ans, i)

if ans == 1000:
  print(-1)
else:
  print(ans)
Problem p02778 (python)

Fixed submission:
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    N = len(S)
    ans = "x" * N

    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
S = input()
N = len(N)
ans = "x" * N
print(ans)
Problem p02801 (python)

Fixed submission:
import string

AL = string.ascii_lowercase

C = input()
idx = AL.find(C)
idy = (idx + 1) % 26
print(AL[idy])

Buggy submission (verdict: Runtime Error):
import string

AL = string.lowercase

C = input()
idx = AL.find(C)
idy = (idx + 1) % 26
print(AL[idy])
Problem p02899 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

res = [""] * N
for i in range(N):
  res[A[i]-1] = str(i+1)

print(" ".join(res))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]

res = [""] * N
for i in range(N):
  res[A[i]-1] = i+1

print(" ".join(res))
Problem p02917 (python)

Fixed submission:
N = int(input())
B = [int(i) for i in input().split()]

res = B[0]
for i in range(N-2):
  res += min(B[i], B[i+1])
res += B[-1]

print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
B = [int(i) for i in input().split()]

res = 0
for i in range(N-1):
  res += min(B[i], B[i+1])
res += B[-1]

print(res)