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

Fixed submission:
N = int(input())
a_list = [int(x) for x in input().split()]
cnt = 0
b_list = set()
for i in range(len(a_list), 0, -1):
    tmp = 0
    for j in range(i*2, N+1, i):
        tmp ^= (j in b_list)
    if (tmp != a_list[i-1]):
        b_list.add(i)
M = len(b_list)
print(M)
if (M>0):
    print(" ".join([str(b) for b in b_list]))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
a_list = [int(x) for x in input().split()]
b_list = [0] * N
for i in range(len(a_list), 0, -1):
    if (a_list[i-1] != b_list[i-1]):
        b_list[i-1] ^= 1
        if (i >= 2):
            b_list[0] ^= 1
            for j in range(2, int(math.sqrt(i)+1)):
                if i % j == 0:
                    b_list[j-1] ^= 1
                    b_list[i//j-1] ^= 1
ans = []
cnt = 0
for i, b in enumerate(b_list):
    if (b):
        cnt += 1
        ans.append(str(b))
print(cnt)
if (cnt):
    print(" ".split(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
a_list = [int(x) for x in input().split()]
b_list = [0] * N
for i in range(len(a_list), 0, -1):
    if (a_list[i-1] != b_list[i-1]):
        b_list[i-1] ^= 1
        if (i >= 2):
            b_list[0] ^= 1
            for j in range(2, int(math.sqrt(i)+1)):
                if i % j == 0:
                    b_list[j-1] ^= 1
                    b_list[i//j-1] ^= 1
ans = []
cnt = 0
for i, b in enumerate(b_list):
    if (b):
        cnt += 1
        ans.append(str(b))
print(cnt)
if (cnt):
    print(" ".split(ans))
Problem p02973 (python)

Fixed submission:
from collections import deque
from bisect import bisect_left
N = int(input())
A = [int(input()) for _ in range(N)]
queue = deque()
for a in A:
    pos = bisect_left(queue, a)
    if (pos == 0):
        queue.appendleft(a)
    else:
        queue[pos-1] = a
print(len(queue))

Buggy submission (verdict: Runtime Error):
lst = []
for A in A_list:
    next = -1
    for l in lst:
        if (l < A):
            next += 1
    if (next == -1):
        tmp = lst
        lst = [A]
        lst.extend(tmp)
    elif (next == len(lst)):
        lst.append(A)
    else:
        lst[next] = A
print(len(lst))
Problem p03044 (python)

Fixed submission:
N=int(input())
to = [[] for _ in range(N)]
for _ in range(N-1):
    u, v, w = [int(x) for x in input().split()]
    u -= 1
    v -= 1
    to[u].append([v, w])
    to[v].append([u, w])
ans = [-1] * N
ans[0] = 0
q = [0]
while(len(q) != 0):
    v = q.pop()
    for u, w in to[v]:
        if (ans[u] != -1): continue
        ans[u] = (ans[v]+w) % 2
        q.append(u)
for v in ans:
    print(v)

Buggy submission (verdict: Runtime Error):
N=int(input())
to = [[] for _ in range(N)]
for _ in range(N-1):
    u, v, w = [int(x) for x in input().split()]
    u -= 1
    v -= 1
    to[u].append([v, w])
    to[v].append([u, w])
ans = [-1] * N
ans[0] = 0
def dfs(v, p=-1, c=0):
    for u, w in to[v]:
        if u == p: continue
        if (w%2 != 0):
            c ^= 1
        ans[u] = c
        dfs(u, v, c)
dfs(0)
for v in ans:
    print(v)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
N=int(input())
a_list = list(map(int, input().split()))
gcd_l = [0] * (N+1) 
gcd_r = [0] * (N+1) 
for i, a in enumerate(a_list):
    gcd_l[i+1] = gcd(gcd_l[i], a)
for i in range(N, 0, -1):
    a = a_list[i-1]
    gcd_r[i-1] = gcd(gcd_r[i], a)
ans = 1
# print(gcd_l, gcd_r)
for i in range(N):
    tmp = gcd(gcd_l[i], gcd_r[i+1])
    if (ans < tmp):
        ans = tmp
print(ans)

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

N=int(input())
a_list = list(map(int, input().split()))
lst = []
for i, a in enumerate(a_list):
    tmp = a_list[:i] + a_list[i+1:]
    lst.append(reduce(math.gcd, tmp))
print(max(lst))

Buggy submission (verdict: Runtime Error):
N=int(input())
a_list = list(map(int, input().split()))
lst = []
for i, a in enumerate(a_list):
    tmp = a_list[:i] + a_list[i+1:]
    lst.append(reduce(math.gcd, tmp))
print(max(lst))
Problem p03087 (python)

Fixed submission:
N, Q = [int(x) for x in input().split()]
S = input()
lr = [[int(x)-1 for x in input().split()] for _ in range(Q)]
lst = [0] * N
for i in range(N-1):
    lst[i+1] = lst[i] + (S[i] == 'A' and S[i+1] == 'C')
for l, r in lr:
    print(lst[r]-lst[l])

Buggy submission (verdict: Runtime Error):
    N, Q = [int(x) for x in input().split()]
    S = input()
    lr = [[int(x) for x in input().split()] for _ in range(Q)]
    for l, r in lr:
        cnt = 0
        for i in range(r-l):
            cnt += (S[l-1+i] == 'A' and S[l+i] == 'C')
        print(cnt)
Problem p03125 (python)

Fixed submission:
A, B = [int(x) for x in input().split()]
print(A+B if (B%A == 0) else B-A)

Buggy submission (verdict: Runtime Error):
A, B = [int(x) for x in input().split('/')]
print(A+B if (B%A == 0) else B-A)
Problem p03138 (python)

Fixed submission:
N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
MAX_DIGIT = 50
dp = [[-1, -1] for _ in range(MAX_DIGIT+1)]
dp[MAX_DIGIT][0] = 0
# print(dp)
# print([bin(a) for a in A])
for d in range(MAX_DIGIT-1, -1, -1):
    # print([(a>>d)%2 for a in A])
    cnt = sum([(a>>d)%2 for a in A])
    c0 = cnt << d
    c1 = (N - cnt) << d
    # print(1 << d+1, c0, c1)
    if (dp[d+1][1] != -1):
        dp[d][1] = max(dp[d][1], dp[d+1][1] + max(c0, c1))
    if (dp[d+1][0] != -1 and (K>>d)%2 == 1):  
        dp[d][1] = max(dp[d][1], dp[d+1][0] + c0)
    if (dp[d+1][0] != -1):
        if (K>>d)%2 == 1:
            dp[d][0] = max(dp[d][0], dp[d+1][0] + c1)
        else:
            dp[d][0] = max(dp[d][0], dp[d+1][0] + c0)
    # print(dp)
print(max(dp[0][0], dp[0][1]))

Buggy submission (verdict: Runtime Error):
N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
i = 0
ans = 0
if (K == 0):
    return print(sum(A))
while((1<<i) <= K):
    tmp = [(a>>i)%2 for a in A]
    cnt = sum(tmp)
    ans += (max(cnt, N-cnt) << i)
    i += 1
i -= 1
if (1 << i == K):
    print(ans)
else:
    for j in range(1<<i+1, K+1):
        ans = max(ans, sum([j ^ a for a in A]))
    print(ans)

Buggy submission (verdict: Runtime Error):
N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
i = 0
ans = 0
if (K == 0):
    return print(sum(A))
while((1<<i) <= K):
    tmp = [(a>>i)%2 for a in A]
    cnt = sum(tmp)
    ans += (max(cnt, N-cnt) << i)
    i += 1
i -= 1
if (1 << i == K):
    print(ans)
else:
    for j in range(1<<i+1, K+1):
        ans = max(ans, [j ^ a for a in A])
    print(ans)
Problem p03287 (python)

Fixed submission:
from collections import defaultdict
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
S = [0] * (N+1)
m = defaultdict(int)
ans = 0
for i in range(N):
    S[i+1] = (S[i] + A[i]) % M
for s in S:
    ans += m[s]
    m[s] += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
S = [0] * (N+1)
m = [0] * (M+1)
ans = 0
for i in range(N):
    S[i+1] = (S[i] + A[i]) % M
for s in S:
    ans += m[s]
    m[s] += 1
print(ans)
Problem p03293 (python)

Fixed submission:
S = input()
T = input() * 2
for i in range(len(S)):
    for j in range(len(S)):
        s, e = [i+j, i+j+len(S)]
        if (T[s:e] == S):
            print('Yes')
            exit()
print('No')

Buggy submission (verdict: Runtime Error):
print('Yes' if (sorted(input()) == sorted(input()) else 'No'))
Problem p03485 (python)

Fixed submission:
import math

A, B=list(map(int, input().split()))
# A = 5
# B = 5
print(math.ceil((A+B)/2))

Buggy submission (verdict: Runtime Error):
A, B=list(map(int, input().split()))
print(math.ceil((A+B)/2))
Problem p03486 (python)

Fixed submission:
S = input()
T = input()
# S = "cd"
# T = "abc"
sS = "".join(sorted(S))
sT = "".join(sorted(T, reverse = True))
if (sS < sT):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
# S = "cd"
# T = "abc"
sS = "".join(sorted(S))
sT = "".join(sorted(T, reverse = True))
if (sS < sT):
  print("Yes")
  else:
    print("No")
Problem p03814 (python)

Fixed submission:
input_str=input()
# input_str="QWERTYASDFZXCV"
# input_str="ZABCZ"
# input_str="HASFJGHOGAKZZFEGA"
b=0
e=0
length=len(input_str)
for i, s in enumerate(input_str):
	if s=="A":
		b=i
		# print(b)
		break
for i, s in enumerate(input_str[::-1]):
	if s=="Z":
		e=length-i
		# print(e)
		break
print(e-b)

Buggy submission (verdict: Runtime Error):
	input_str=input()
	# input_str="QWERTYASDFZXCV"
	# input_str="ZABCZ"
	# input_str="HASFJGHOGAKZZFEGA"
	b=0
	e=0
	length=len(input_str)
	for i, s in enumerate(input_str):
		if s=="A":
			b=i
			# print(b)
			break
	for i, s in enumerate(input_str[::-1]):
		if s=="Z":
			e=length-i
			# print(e)
			break
	print(e-b)
Problem p02658 (python)

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

if 0 in A :
    print("0")
    exit()
result = 1
for i in range(N) :
    result *= A[i]
    if result > 10**18 :
        print("-1")
        exit()

print(result)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    ll result = 1;
    for(int i=0;i<N;i++) {
        cin >> A.at(i);
    }

    if(find(A.begin(),A.end(),0) != A.end()) {
        cout << "0" << endl;
        exit(0);
    }
    for(int i=0;i<N;i++) {
        result = result * A.at(i);
        if (result > (ll)pow(10,18)) {
            cout << "-1" << endl;
            exit(0);
        }
    }
    cout << result << endl;
}
Problem p02802 (python)

Fixed submission:
from operator import itemgetter

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

for i in range(M) :
    PS[i][0] = int(PS[i][0])

submits = [["null"] for i in range(N)]
for i in range(M) :
    submits[PS[i][0]-1][0] = PS[i][0]-1
    submits[PS[i][0]-1].append(PS[i][1])

ac = 0
pena = 0
for i in range(len(submits)) :
    if submits[i][0] == "null" :
        continue

    flag = False
    wabuf1 = 0
    for j in range(1,len(submits[i])) :
        if submits[i][j] == "AC" :
            ac += 1
            flag = True
            break
        else :
            wabuf1 += 1
    if flag == True :
        pena += wabuf1

print(ac,pena)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

int main() {
    int N,M;
    cin >> N >> M;
    vector<int> p(M);
    vector<string> S(M);
    for(int i=0;i<M;i++) {
        cin >> p.at(i) >> S.at(i);
    }
    vector<vector<int>> submits(N,vector<int>(2,0));
    for(int i=0;i<M;i++) {
        if(submits.at(p.at(i)-1).at(0) != 0) {
            continue;
        }
        if(S.at(i) == "WA") {
            submits.at(p.at(i)-1).at(1)++;
        }else{
            submits.at(p.at(i)-1).at(0)++;
        }
    }
    int ac = 0;
    int pena = 0;

    for(int i=0;i<N;i++) {
        ac += submits.at(i).at(0);
        pena += submits.at(i).at(1);
    }
    cout << ac <<" " << pena << endl;
}
Problem p02813 (python)

Fixed submission:
import itertools

N = int(input())
P = [int(x) for x in input().split()]
Q = [int(x) for x in input().split()]

a = 0
b = 0
j = 0
for i in itertools.permutations([int(x+1) for x in range(N)]):
    j += 1
    if(list(i) == P) :
        a = j
    if(list(i) == Q) :
        b = j

print(abs(a-b))

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

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}
int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    vector<int> nums(N);
    int a=0,b=0,j=0;
    for(int i=0;i<N;i++) {
        cin >> P.at(i);
    }
    for(int i=0;i<N;i++) {
        cin >> Q.at(i);
    }
    for(int i=0;i<N;i++) {
        nums.at(i) = i+1;
    }
    do{
        j++;
        if(nums == P) {
            a = j;
        }
        if(nums == Q) {
            b = j;
        }
    }while(next_permutation(nums.begin(), nums.end()));
    cout << abs(b-a) << endl;
}
Problem p02555 (python)

Fixed submission:
import math
s = int(input())
if s < 3:
    print("0")
else:
    bar = (s // 3) - 1
    ans = 0
    for i in range(bar+1):
        if i == 0:
            ans += 1
        else:
            val = s - 3 * (i+1)
            count = math.factorial(val+i) // (math.factorial(val) * math.factorial(i))
            ans += count % (10**9+7)
    print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
s = int(input())
if s < 6:
    print("0")
else:
    bar = (s // 3) - 1
    ans = 0
    for i in range(bar+1):
        if i == 0:
            ans += 1
        else:
            val = s - 3 * (i+1)
            count = math.factorial(val+i) // (math.factorial(val) * math.factorial(i))
            ans += count % (10**9+7)
print(ans%(10**9+7))
Problem p02583 (python)

Fixed submission:
from math import factorial
n = int(input())
l = list(map(int, input().split()))
l.sort()
disabled = 0
for i in range(n-2):
    for j in range(i+1,n-1):
            for k in range(j+1,n):
                if (l[i] + l[j]) <= l[k] or l[i] == l[j] or l[j] == l[k]:
                    disabled += 1
if n >= 3:
    print(int(factorial(n) / factorial(3) / factorial(n-3) - disabled))
else:
    print("0")

Buggy submission (verdict: Runtime Error):
from math import factorial
n = int(input())
l = list(map(int, input().split()))
l.sort()
disabled = 0
for i in range(n-2):
    for j in range(i+1,n-1):
            for k in range(j+1,n):
                if (l[i] + l[j]) <= l[k] or l[i] == l[j] or l[j] == l[k]:
                    disabled += 1
print(int(factorial(n) / factorial(3) / factorial(n-3) - disabled))
Problem p02658 (python)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
ans = x[0]
if 0 in x:
	ans = 0
else:
	for i in range(1,n):
		ans = ans * x[i]
		if ans > 10 ** 18:
			ans = -1
			break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
ans = x[0]
if 0 in x:
	ans = 0
else:
	for i in range(1,n):
		ans = ans * x[i]
		if ans > 10 ** 18:
			ans = -1
            break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
ans = x[0]
if 0 in x:
	ans = 0
	break
else:
	for i in range(1,n):
		ans = ans * x[i]
		if ans > 10 ** 18:
			ans = -1
			break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
ans = x[0]
for i in range(1,n):
	ans = ans * x[i]
	if ans > 10 ** 18 and x not in 0:
		ans = -1
		break
print(ans)
Problem p02730 (python)

Fixed submission:
import math
s = str(input())
m = (len(s) - 1) / 2
c = True
for i in range(math.floor(m / 2)):
    if s[i] != s[int(m-1-i)]:
        c = False
for i in range(math.floor(m / 2)):
    if s[int(m+1+i)] != s[int(len(s)-1-i)]:
        c = False
for i in range(math.floor(m)):
    if s[i] != s[int(math.floor(len(s)-1-i))]:
        c = False
if c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
s = str(input())
m = (len(s) - 1) / 2
c = True
for i in range(math.floor(m / 2)):
    if s[i] != s[int(m-1-i)]:
        c = False
for i in range(math.floor(m / 2)):
    if s[int(m+1+i)] != s[int(len(s)-1-i)]:
        c = False
for i in range(math.floor(m)):
    if s[i] != s[int(math.floor(len(s)-i))]:
        c = False
if c:
    print("Yes")
else:
    print("No")
Problem p02909 (python)

Fixed submission:
list = ["Sunny","Cloudy","Rainy"]
s = str(input())
a = list.index(s)
if a == 2:
    a = -1
print(list[a+1])

Buggy submission (verdict: Runtime Error):
list = ["Sunny","Cloudy","Rainy"]
s = str(input())
a = list.index(s)
if a == 2:
    a == -1
print(list[a+1])
Problem p02993 (python)

Fixed submission:
s = input()
if s[0] != s[1] != s[2] != s[3]:
    print("Good")
else:
    print("Bad")

Buggy submission (verdict: Runtime Error):
s = input()
if len(set(s.sort())) == 4:
    print("Good")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if len(set(sort(s))) == 4:
    print("Good")
else:
    print("No")
Problem p02999 (python)

Fixed submission:
x,a = map(int,input().split())
if x < a:
    print("0")
else:
    print("10")

Buggy submission (verdict: Runtime Error):
x,a = map(int,input.split())
if x < a:
    print("0")
else:
    print("10")
Problem p03845 (python)

Fixed submission:
n = int(input())
t = list(map(int,input().split()))
m = int(input())
a,b = 0,0
for _ in range(m):
  a,b = map(int,input().split())
  print(sum(t) - t[a-1] + b)

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int,input().split()))
m = int(input())
a,b = 0,0
for _ in range(m):
  a,b = map(int,input().split())
  print(sum(t) - t[a] + b)
Problem p02760 (python)

Fixed submission:
card = [[int(x) for x in input().split()] for y in range(3)]
bools = [[0,0,0],[0,0,0],[0,0,0]]
n = int(input())
for _ in range(n):
  x = int(input())
  for i in range(3):
    for j in range(3):
      if x == card[i][j]:
        bools[i][j] = 1
ok = False
for i in range(3):
  if (bools[i][0], bools[i][1], bools[i][2]) == (1,1,1) or (bools[0][i], bools[1][i], bools[2][i]) == (1,1,1):
    ok = True
if (bools[0][0],bools[1][1],bools[2][2]) == (1,1,1) or (bools[0][2], bools[1][1], bools[2][0]) == (1,1,1):
  ok = True
print("Yes" if ok else "No")

Buggy submission (verdict: Runtime Error):
card = [[int(x) for x in input().split()] for y in range(3)]
bools = [[0,0,0],[0,0,0],[0,0,0]]
n = int(input())
for _ in range(n):
  x = int(input())
  for i in range(3):
    for j in range(3):
      if x == card[i][j]:
        bools[i][j] = 1
ok = False
for i in range(3):
  if (bools[i][0], bools[i][1], bools[i][2]) == (1,1,1) or 
  (bools[0][i], bools[1][i], bools[2][i]) == (1,1,1):
    ok = True
if (bools[0][0],bools[1][1],bools[2][2]) == (1,1,1) or (bools[0][2], bools[1][1], bools[2][0]) == (1,1,1):
  ok = True
print("Yes" if ok else "No")
Problem p02778 (python)

Fixed submission:
s = input()
for _ in range(len(s)):
  print('x',end='')

Buggy submission (verdict: Runtime Error):
s = input()
for _ in range(len(s)):
  print(x,end='')
Problem p02945 (python)

Fixed submission:
a,b = map(int,input().split())
print(max(a+b,a*b,a-b))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(max([a+b,a*b,a-b])
Problem p03103 (python)

Fixed submission:
n,k = map(int, input().split())
a = sorted(tuple(map(int,input().split())) for i in range(n))
ans = 0
for x in a:
  temp = min(x[1],k)
  ans += temp*x[0]
  k = max(0,k-temp)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = sorted([tuple(input().split()) for i in range(n)])
ans = 0
for x in a:
  temp = min(x[1],k)
  ans += temp*x[0]
  k = max(0,k-temp)
print(ans)
Problem p03109 (python)

Fixed submission:
y,m,d = input().split('/')
print("Heisei" if int(y+m+d) <= 20190430 else "TBD")

Buggy submission (verdict: Runtime Error):
y,m,d = input().split()
print("Heisei" if int(y+m+d) <= 20190430 else "TBD")

Buggy submission (verdict: Runtime Error):
s = tuple(map(int,input().split('/')))
t = tuple(2019,4,30)
print("Heisei" if s <= t else "TBD")
Problem p03110 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(n):
  x,y = input().split()
  ans += (float(x) if y == "JPY" else float(x)*380000)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(n):
  x,y = input().split()
  ans += (int(x) if y == "JPY" else int(x)*48000)
print(ans)
Problem p03211 (python)

Fixed submission:
s = input()
ans = 104206969
for i in range(len(s)-2):
  ans = min(ans, abs(753-int(s[i:i+3])))
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 104206969
for i in range(len(s)-2):
  ans = min(ans, abs(753-int(s[i:i+2])))
print ans

Buggy submission (verdict: Runtime Error):
s = input()
ans = 104206969
for i in range(len(s)-2):
  ans = min(ans, abs(753-int(s[i:i+3])))
print ans

Buggy submission (verdict: Runtime Error):
s = input()
ans = 104206969
for i in range(len(s)-3):
  ans = min(ans, abs(753-int(s[i:i+3])))
print ans
Problem p03294 (python)

Fixed submission:
n = int(input())
v = [int(x) for x in input().split()]
running = 0
for x in v:
  running += x-1
print(running)

Buggy submission (verdict: Runtime Error):
import math

def lcm(a,b):
  return a//math.gcd(a,b)*b

n = int(input())
v = [int(x) for x in input().split()]
running = 1
for x in v:
  running = lcm(running,x)
print(x-1)
Problem p03337 (python)

Fixed submission:
a,b = map(int,input().split())
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(max([a+b,a-b,a*b])
Problem p03657 (python)

Fixed submission:
a,b = [int(x) for x in input().split()]
print('Possible' if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0 else 'Impossible')

Buggy submission (verdict: Runtime Error):
a,b = [int(x) for x in input().split()]
print('Possible' (a+b)%3 == 0 else 'Impossible')
Problem p02573 (python)

Fixed submission:
def main():

    n,m = map(int,input().split())
    ary = []
    for i in range(m):
        aa, bb = map(int,input().split())

        ary.append((aa-1,bb-1))
    ary_s = list(set(ary))
    a = []
    # b = []
    # Union-Find作る
    uf = UnionFind(n)

    for i in range(len(ary_s)):
        a.append(ary_s[i][0])
        a.append(ary_s[i][1])
        uf.union(ary_s[i][0], ary_s[i][1])
    ans = 1
    for i in a:
        ans = max(ans, uf.size(i))
    print(ans)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():

    n,m = map(int,input().split())
    ary = []
    for i in range(m):
        aa, bb = map(int,input().split())
        l = min(aa,bb)
        r = max(aa,bb)
        ary.append((l,r))
    ary_s = list(set(ary))
    a = []
    # b = []
    for i in range(len(ary_s)):
        a.append(ary_s[i][0])
        a.append(ary_s[i][1])

    import collections
    c_a = collections.Counter(a).most_common()[0][1]
    print(c_a+1)
if __name__=='__main__':
    main()
Problem p02664 (python)

Fixed submission:
def main():
    s = list(input())
    now = 0
    for i in range(len(s)):
        if s[i] == '?':
            if i == 0 or s[i-1] == 'P' or s[i-1] == '?':
                s[i] = 'D'
                continue
            if i+1 < len(s)  and( s[i+1] == 'D' or s[i+1] == '?'):
                s[i] ='P'
                continue
            s[i] = 'D'
    print(''.join(s))

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = list(input())
    now = 0
    for i in range(len(s)):
        if s[i] == '?':
            if i == 0 or s[i-1] == 'P' or s[i-1] == '?':
                s[i] = 'D'
                continue
            if i != len(s) -1 or s[i+1] == 'D' or s[i+1] == '?':
                s[i] ='P'
                continue
    print(''.join(s))

if __name__=='__main__':
    main()