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

Fixed submission:
[l, r] = [int(i) for i in input().split()]

if (r - l >= 673):
    print(0)
else:
    a = 2018
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            b = i % 2019
            c = j % 2019
            d = (b * c) % 2019
            a = min(a, d)
    print(a)

Buggy submission (verdict: Runtime Error):
[l, r] = [int(i) for i in input().split()]

if (r - l >= 672):
    print(0)
else:
    a = 2018
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            a = min(a, ((i % 2019) * (j % 2019)) % 2019)

print(a)
Problem p02814 (python)

Fixed submission:
import sys
import math
INF=1e9
mod=1e9+7

def gcd(a,b):
    if (b==0):
        return a
    return gcd(b,a%b)
 
def lcm(a,b):
    return (a//gcd(a,b))*b
 

n,m=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
g=1
init=0
for i in range(n):
    a[i]//=2
num=a[0]
while(num%2==0):
    num/=2
    init+=1
for i in range(1,n):
    num=a[i]
    cnt=0
    while(num%2==0):
        num/=2
        cnt+=1
    if(cnt!=init):
        print(0)
        sys.exit()
for i in range(n):
    g=lcm(g,a[i])
#print(g)
ans=(m//g)
if(ans%2==1):
    print(ans//2+1)
else:
    print(ans//2)

Buggy submission (verdict: Runtime Error):
import sys
import math
INF=1e9
mod=1e9+7
n,m=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
g=1
init=0
num=a[0]
while(num%2==0):
    num/=2
    init+=1
for i in range(1,n):
    num=a[i]
    cnt=0
    while(num%2==0):
        num/=2
        cnt+=1
    if(cnt!=init):
        print(0)
        sys.exit()
for i in range(n):
    a[i]//=2
    g=g*a[i]//math.gcd(g,a[i])
#print(g)
ans=(m//g)
if(ans%2==1):
    print(ans//2+1)
else:
    print(ans//2)

Buggy submission (verdict: Runtime Error):
import sys
import math
INF=1e9
mod=1e9+7
n,m=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
g=1
for i in range(n):
    a[i]//=2
    g=g*a[i]//math.gcd(g,a[i])
#print(g)
ans=(m//g)
if(ans%2==1):
    print(ans//2+1)
else:
    print(ans//2)

Buggy submission (verdict: Runtime Error):
import sys
import math
INF=1e9
mod=1e9+7
n,m=map(int,input().split())
a=list(map(int,input().split()))
g=1
for i in range(n):
    a[i]//=2
    g=g*a[i]//math.gcd(g,a[i])
#print(g)
ans=(m//g)
if(ans%2==1):
    print(ans//2+1)
else:
    print(ans//2)
Problem p03160 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200000) #追加
S = [-1]*(101010)
def opt_S(h,n):
    if(n == 0):return 0
    elif(n == 1):return abs(h[1]-h[0])
    else :
        if(S[n] != -1):return S[n]
        s1 = opt_S(h,n-1) + abs(h[n-1]-h[n])
        s2 = opt_S(h,n-2) + abs(h[n-2]-h[n])
        S[n] = min(s1,s2)
        return S[n]



N = int(input())
h = list(map(int,input().split()))
print(opt_S(h,N-1))

Buggy submission (verdict: Runtime Error):
resource.setrlimit(resource.RLIMIT_STACK, (-1, -1))
S = [-1]*(101010)
def opt_S(h,n):
    if(n == 0):return 0
    elif(n == 1):return abs(h[1]-h[0])
    else :
        if(S[n] != -1):return S[n]
        s1 = opt_S(h,n-1) + abs(h[n-1]-h[n])
        s2 = opt_S(h,n-2) + abs(h[n-2]-h[n])
        S[n] = min(s1,s2)
        return S[n]



N = int(input())
h = list(map(int,input().split()))
print(opt_S(h,N-1))

Buggy submission (verdict: Runtime Error):
sys.setrecursionlimit(200000)
S = [-1]*(101010)
def opt_S(h,n):
    if(n == 0):return 0
    elif(n == 1):return abs(h[1]-h[0])
    else :
        if(S[n] != -1):return S[n]
        s1 = opt_S(h,n-1) + abs(h[n-1]-h[n])
        s2 = opt_S(h,n-2) + abs(h[n-2]-h[n])
        S[n] = min(s1,s2)
        return S[n]



N = int(input())
h = list(map(int,input().split()))
print(opt_S(h,N-1))

Buggy submission (verdict: Runtime Error):
sys.setrecursionlimit(2000000)
S = [-1]*(101010)
def opt_S(h,n):
    if(n == 0):return 0
    elif(n == 1):return abs(h[1]-h[0])
    else :
        if(S[n] != -1):return S[n]
        s1 = opt_S(h,n-1) + abs(h[n-1]-h[n])
        s2 = opt_S(h,n-2) + abs(h[n-2]-h[n])
        S[n] = min(s1,s2)
        return S[n]



N = int(input())
h = list(map(int,input().split()))
print(opt_S(h,N-1))

Buggy submission (verdict: Runtime Error):
S = [-1]*(101010)
def opt_S(h,n):
    if(n == 0):return 0
    elif(n == 1):return abs(h[1]-h[0])
    else :
        if(S[n] != -1):return S[n]
        s1 = opt_S(h,n-1) + abs(h[n-1]-h[n])
        s2 = opt_S(h,n-2) + abs(h[n-2]-h[n])
        S[n] = min(s1,s2)
        return S[n]



N = int(input())
h = list(map(int,input().split()))
print(opt_S(h,N-1))
Problem p02743 (python)

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

if c-a-b>0:
    if 4*a*b<(c-a-b)**2:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from decimal import *
import math
a,b,c = map(int,input().split())
a2 = Decimal(str(math.sqrt(Decimal(str(a))))
b2 = Decimal(str(math.sqrt(Decimal(str(b))))
c2 = Decimal(str(math.sqrt(Decimal(str(c))))

if a2 + b2 < c2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math
from decimal import *
a,b,c = map(int,input().split())
if a+b >= c:
    print('No')
else:
    sq = Decimal(((a*b)**(1/2))*2)
    if (a+b+sqin) <c:
        print('Yes')
    else:
        print('No')
Problem p02924 (python)

Fixed submission:
n = int(input())
sum = (n*(n-1))//2
print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(range(1,n+1))
sum = (n*(n-1))//2
print(sum)
Problem p02936 (python)

Fixed submission:
n, q = map(int,input().split())
tree = [[] for i in range(n)]
v = [0]*n
for i in range(n-1):
    a1,b1 = [int(i) for i in input().split()]
    tree[a1-1].append(b1)
for i in range(q):
    p1,x1 = [int(i) for i in input().split()]
    v[p1 - 1] += x1
for i in range(n):
    for j in range(len(tree[i])):
        v[tree[i][j]-1] += v[i]
for i in range(n):
    print(str(v[i]) +" ",end="")

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
using namespace std;
using P=pair<int,int>;
using G=vector<vector<int>>;
using ll=long long;
ll N;
vector<ll> H, S;
vector<bool> seen;
vector<ll>sum;
vector<int> pl;

bool isYes(ll mid)
{
	vector<ll> count(N, 0);
	for (ll i = 0; i < N; ++i)
	{
		if (mid - H[i] < 0) return false;
		++count[min(N-1, (mid - H[i]) / S[i])];
	}
	for (ll i = 0; i < N-1; ++i)
		count[i+1] += count[i];
	for (ll i = 0; i < N; ++i)
		if (count[i] > i+1)
			return false;
	return true;
}
//普通の深さ優先探索seenを返す感じ
void dfs2(const G &G,int v){
    seen[v] = true; //v探索済み
	sum[v]+=pl[v];

    for(auto next_v :G[v]){
        if(seen[next_v])continue;//もう探索していた
		sum[next_v]+=sum[v];
        dfs2(G,next_v);
    }
}

void dfs(const G &G, int v, int p) {
	sum[v]+=pl[v];

    for (auto nv : G[v]) {
        if (nv == p) continue; // nv が親 p だったらダメ
		sum[nv]+=sum[v];
        dfs(G, nv, v); // v は新たに nv の親になります
    }
}

int main(int argc, char **argv){
	ll n,q; cin>>n>>q;
	G graph(n);
	sum.assign(n,0);
	pl.assign(n,0);

	rep(i,0,n-1){
		int a,b; cin>>a>>b;
		graph[a-1].push_back(b-1);
	}
	rep(i,0,q){
		int p,x; cin>>p>>x;
		pl[p-1]+=x;
	}

	seen.assign(n,false);
	rep(i,0,n){
		dfs2(graph,i);
	}

	rep(i,0,n){
		cout<<sum[i]<<" ";
	}

}
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
cd = (c*d) // fractions.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)
result = b-a+1 -(c_sum+d_sum-cd_sum)
print(result)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // math.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)
result = b-a+1 -(c_sum+d_sum-cd_sum)
print(result)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // (max(math.gcd(c,d),1))
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)

result = b-a+1 -(c_sum+d_sum-cd_sum)
print(result)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // (math.gcd(c,d))
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)

result = b-a+1 -(c_sum+d_sum-cd_sum)
print(result)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // math.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)
 
result = b-a+1 -(c_sum+d_sum-cd_sum)
print((result))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // math.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)

result = b-a+1 -(c_sum+d_sum-cd_sum)
print((result))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // math.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)

result = b-a+1 -(c_sum+d_sum-cd_sum)
print((result))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // math.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)

result = b-a+1 -(c_sum+d_sum-cd_sum)
print((result)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // math.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)

result = b-a+1 -(c_sum+d_sum-cd_sum)
print((result)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // math.gcd(c,d)
print(cd)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)

result = b-a+1 -(c_sum+d_sum-cd_sum)
print((result))
Problem p03074 (python)

Fixed submission:
n,k = map(int,input().split())
s = list(input())
 
l0 = []
l1 = []
pred = s[0]
if s[0] == "0":
    l0.append(1)
    l1.append(0)
else:
    l1.append(1)
 
for i in range(1,n):
    if pred == s[i]:
        if s[i] == "0":
            l0[-1] += 1
        else:
            l1[-1] += 1
    else:
        if s[i] == "0":
            l0.append(1)
        else:
            l1.append(1)
    pred = s[i]
if s[-1] == "0":    
    l1.append(0)
 
ans = sum(l0[:k])+sum(l1[:k+1])
tmp = ans
for i in range(k,min(len(l0),len(l1))):
    tmp -= l0[i-k]
    tmp -= l1[i-k]
    tmp += l0[i]
    tmp += l1[i+1]
    ans = max(ans, tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())
s = list(input())
 
l0 = []
l1 = []
pred = s[0]
if s[0] == "0":
    l0.append(1)
    l1.append(0)
else:
    l1.append(1)
 
for i in range(1,n):
    if pred == s[i]:
        if s[i] == "0":
            l0[-1] += 1
        else:
            l1[-1] += 1
    else:
        if s[i] == "0":
            l0.append(1)
        else:
            l1.append(1)
    pred = s[i]
if s[-1] == "0":    
    l1.append(0)

ans = 0
if k >= len(l0):
    print(n)
else:
    nl1 = len(l1)
    for i in range(nl1-k):
        ans = max(ans,(sum(l0[i:i+k])+sum(l1[i:i+k+1])))
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())
s = list(input())

l0 = []
l1 = []
pred = s[0]
if s[0] == "0":
    l0.append(1)
    l1.append(0)
else:
    l1.append(1)

for i in range(1,n):
    if pred == s[i]:
        if s[i] == "0":
            l0[-1] += 1
        else:
            l1[-1] += 1
    else:
        if s[i] == "0":
            l0.append(1)
        else:
            l1.append(1)
    pred = s[i]
if s[-1] == "0":    
    l1.append(0)

if k >= len(l0):
    print(n)
else:
    while (k>0 and len(l0)>0):
        n0 = len(l0)
        nl0 = []
        for i in range(n0):
            nl0.append(l0[i]+l1[i]+l1[i+1])
        nl0 = np.array(nl0)
        key = np.argmax(nl0)
        l1[key] += l0[key] + l1[key+1]
        del l0[key]
        del l1[key+1]
        k -= 1
    print(max(l1))

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())
s = list(input())

l0 = []
l1 = []
pred = s[0]
if s[0] == "0":
    l0.append(1)
    l1.append(0)
else:
    l1.append(1)

for i in range(1,n):
    if pred == s[i]:
        if s[i] == "0":
            l0[-1] += 1
        else:
            l1[-1] += 1
    else:
        if s[i] == "0":
            l0.append(1)
        else:
            l1.append(1)
    pred = s[i]
if s[-1] == "0":    
    l1.append(0)

if k >= len(l0):
    print(n)
else:
    while (k>0 and len(l0)>0):
        n0 = len(l0)
        nl0 = []
        for i in range(n0):
            nl0.append(l0[i]+l1[i]+l1[i+1])
        nl0 = np.array(nl0)
        key = np.argmax(nl0)
        l1[key] += l0[key] + l1[key+1]
        del l0[key]
        del l1[key+1]
        k -= 1
    print(max(l1))
Problem p03156 (python)

Fixed submission:
n = int(input())
a, b = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
key1 = 0
key2 = n-1
for i in range(n):
    if p[i] > a:
        key1 = i-1
        break
for i in range(key1+1,n):
    if p[i] > b:
        key2 = i-1
        break
print(min(key1+1,key2-key1,len(p)-1-key2))

Buggy submission (verdict: Runtime Error):
n = int(input())
a, b = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
for i in range(n):
    if p[i] > a:
        key1 = i-1
        break
for i in range(key1+1,n):
    if p[i] > b:
        key2 = i-1
        break
print(min(key1+1,key2-key1,len(p)-1-key2))
Problem p03281 (python)

Fixed submission:
n = int(input())
result = 0
l = list(range(1,n+1,2))
for i in l:
    s = 1
    for j in range(1,i,2):
        if i % j == 0:
            s += 1
    if s == 8:
        result += 1
print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n < 105:
    print(0)
elif n >= 105 and n < 165:
    print(1)
elif 10n >= 165 and n < 195:
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n < 105:
    print(0)
elif n >= 105 and n < 165:
    print(1)
elif 10n >= 165 and n < 195:
    print(2)
else:
    print(3)
Problem p03487 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
v = a[0]
count = 1
result = 0
for i in range(1,n):
    if v == a[i]:
        count += 1
    else:
        if v == count:
            v = a[i]
            count = 1
        else:
            if count > v:
                result += count -v
                v = a[i]
                count = 1
            else:
                result += count
                v = a[i]
                count = 1
if v != count:
    if count > v:
        result += count -v
    else:
        result += count
print(result)

Buggy submission (verdict: Runtime Error):
from astropy.units import count
n = int(input())
a = list(map(int,input().split()))
a.sort()
v = a[0]
count = 1
result = 0
for i in range(1,n):
    if v == a[i]:
        count += 1
    else:
        if v == count:
            v = a[i]
            count = 1
        else:
            if count > v:
                result += count -v
                v = a[i]
                count = 1
            else:
                result += count
                v = a[i]
                count = 1
if v != count:
    if count > v:
        result += count -v
    else:
        result += count
print(result)
Problem p02843 (python)

Fixed submission:
X = int(input())
for i in range(1, X + 1):
    if X >= 100 * i and X <= 105 * i:
        print(1)
        exit()
print(0)

Buggy submission (verdict: Runtime Error):
XMAX = 10**5
X = int(input())
dp = [False] * XMAX
dp[0] = True

for i in range(0, X + 1):
    for p in range(100, 106):
        if i - p >= 0 and dp[i - p]:
            dp[i] = True
            next
if dp[X]:
    print(1)
else:
    print(0)
Problem p02855 (python)

Fixed submission:
H, W, K = map(int, input().split())
c = []
cnt = [0] * H
num = 0
A = [[0] * W for _ in range(H)]

for i in range(H):
    row = list(input())
    c.append(row)
    cnt[i] = row.count("#")


def solve(cl, cr):
    global num
    P = []
    for i in range(cl, cr + 1):
        for j in range(W):
            if c[i][j] == "#":
                P.append(j)
    P = sorted(P)
    for i in range(len(P)):
        v1 = 0
        v2 = W - 1
        if (i >= 1):
            v1 = P[i - 1] + 1
        if (i < len(P) - 1):
            v2 = P[i]
        num += 1
        for j in range(cl, cr + 1):
            for k in range(v1, v2 + 1):
                A[j][k] = num


vec = []
for i in range(H):
    if cnt[i] >= 1:
        vec.append(i)
for i in range(len(vec)):
    v1 = 0
    v2 = H - 1
    if (i >= 1):
        v1 = vec[i - 1] + 1
    if (i < len(vec) - 1):
        v2 = vec[i]
    solve(v1, v2)
for i in range(H):
    print(*A[i])

Buggy submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
c = []
cnt = [0] * W
num = 0
A = [[0] * W for _ in range(H)]

for i in range(H):
    row = list(input())
    c.append(row)
    cnt[i] = row.count("#")


def solve(cl, cr):
    global num
    P = []
    for i in range(cl, cr + 1):
        for j in range(W):
            if c[i][j] == "#":
                P.append(j)
    P = sorted(P)
    for i in range(len(P)):
        v1 = 0
        v2 = W - 1
        if (i >= 1):
            v1 = P[i - 1] + 1
        if (i < len(P) - 1):
            v2 = P[i]
        num += 1
        for j in range(cl, cr + 1):
            for k in range(v1, v2 + 1):
                A[j][k] = num


vec = []
for i in range(H):
    if cnt[i] >= 1:
        vec.append(i)
for i in range(len(vec)):
    v1 = 0
    v2 = H - 1
    if (i >= 1):
        v1 = vec[i - 1] + 1
    if (i < len(vec) - 1):
        v2 = vec[i]
    solve(v1, v2)
for i in range(H):
    print(*A[i])
Problem p02917 (python)

Fixed submission:
n = int(input())
B = list(map(int, input().split()))
ans = 0
ans += B[0]
for i in range(n - 2):
    if B[i] > B[i + 1]:
        ans += B[i + 1]
    else:
        ans += B[i]
ans += B[-1]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
B = list(map(int, input().split()))
ans = 0
ans += B[0]
for i in range(n - 2):
    if B[i] > B[i + 1]:
        ans += B[i + i]
    else:
        ans += B[i]
ans += B[-1]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
B = list(map(int, input().split()))
A = [0] * (n)
A[0] = B[0]
for i in range(n - 2):
    if B[i] > B[i + 1]:
        A[i + 1] = B[i + i]
    else:
        A[i + 1] = B[i]
A[-1] = B[-1]
print(sum(A))
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
ans = 0
for i in range(3):
  if S[i] == T[i]:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
ans = 0
for i in range(3):
  is S[i] == T[i]:
    ans += 1
print(ans)
Problem p03085 (python)

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "G":
  print("C")
elif b == "C":
  print("G")
else:
  print("A")

Buggy submission (verdict: Runtime Error):
b = input()
if b == "A":
  print("T")
elif b == "G":
  print("C")
elif b == "C":
  print("G")
else b == "T":
  print("A")
Problem p03292 (python)

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

Buggy submission (verdict: Runtime Error):
a = map(int, input().split())
print(max(a) - min(a))
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
l = range(a, b + 1)
a = sorted(set(l[:k]) | set(l[-k:]))
print(*a, sep="\n")

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b + 1))
a = sorted(set(l[:k] + l[(b - a + 1 - k):]))
print(*a, sep="\n")
Problem p03485 (python)

Fixed submission:
import math
a, b = map(int, input().split(" "))
print(math.ceil((a + b) / 2))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, iniput().split(" "))
print(math.ceil((a + b) / 2))
Problem p03671 (python)

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

print(min(a + b, b + c, c + a))

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

print(sum(a, b, c) - max(a, b, c))
Problem p03694 (python)

Fixed submission:
n = int(input())
a = sorted(map(int, input().split()))
print(a[-1] - a[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]
print(sorted(set(a))[-2])
Problem p02642 (python)

Fixed submission:
# エラトステネスの篩

N = int(input())
A = sorted(map(int, input().split()))
maxA = A[N - 1]
dp = [0] * (maxA + 1)

for i in range(len(A)):
    cursor = A[i]
    while cursor <= maxA:
        dp[cursor] += 1
        cursor += A[i]

ans = 0
for a in A:
    if dp[a] == 1:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import sympy

N = int(input())
A = list(map(int, input().split()))
setA = set(A)

count = 0
for i in range(len(A)):
    flag = False
    for div in sympy.divisors(A[i]):
        if div <= 1:
            continue
        if div == A[i]:
            if div in A[:i]:
                flag = True
                break
            if div in A[i+1:]:
                flag = True
                break
        else:
            if div in setA:
                flag = True
                break
    if not flag:
        count += 1

print(count)
Problem p02844 (python)

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            fi = S.find(str(i))
            if fi < 0:
                continue
            fj = S[fi+1:].find(str(j))
            if fj < 0:
                continue
            fk = S[fi+fj+2:].find(str(k))
            if fk < 0:
                continue
            ans += 1

print(ans)

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

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            fi = S.find(S[i])
            fj = S.find(S[j])
            fk = S.find(S[k])
            if fi >= 0 and fj >= 0 and fk >= 0 and fi < fj and fj < fk:
                ans += 1

print(ans)

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

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            fi = S.find(S[i])
            fj = S.find(S[j])
            fk = S.find(S[k])
            if fi >= 0 and fj >= 0 and fk >= 0 and fi <= fj and fj <= fk:
                ans += 1

print(ans)
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3 * r ** 2)

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

ans = [A[0]]
for i in range(1, N):
    index = bisect.bisect_left(ans, A[i])
    if index > 0:
        ans[index - 1] = A[i]
    else:
        ans = [A[i]] + ans

print(len(ans))
Problem p02973 (python)

Fixed submission:
import bisect
from collections import deque

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

ans = deque([A[0]])
for i in range(1, N):
    index = bisect.bisect_left(ans, A[i])
    if index > 0:
        ans[index - 1] = A[i]
    else:
        ans.appendleft(A[i])

print(len(ans))

Buggy submission (verdict: Runtime Error):
import bisect
from collections import deque

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

ans = deque([A[0]])
for i in range(1, N):
    index = bisect.bisect_left(ans, A[i])
    if index > 0:
        ans[index - 1] = A[i]
    else:
        ans = [A[i]] + ans

print(len(ans))

Buggy submission (verdict: Runtime Error):
import bisect
from collections import deque

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

ans = deque([A[0]])
for i in range(1, N):
    index = bisect.bisect_left(ans, A[i])
    if index > 0:
        ans[index - 1] = A[i]
    else:
        ans.appendLeft(A[i])

print(len(ans))

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

ans = [A[0]]
for i in range(1, N):
    index = bisect.bisect_left(ans, A[i])
    if index > 0:
        ans[index] = A[i]
    else:
        ans.insert(0, A[i])

print(len(ans))