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

Fixed submission:
n = int(input()) #waiting_for_pudging
a = list(map(int, input().split())) #waiting_for_pudging
b = list(map(int, input().split())) #waiting_for_pudging
c = list(map(int, input().split())) #waiting_for_pudging
summ = 0 #waiting_for_pudging
for i in range(n-1): #pudging
    if a[i] + 1 == a[i + 1]: #pudging
        summ += c[a[i]-1] #pudging
        summ += b[a[i]-1] #pudging
    else: #pudging
        summ += b[a[i]-1] #pudging
print(summ + b[a[n-1]-1]) #pudging
#accepted

Buggy submission (verdict: Runtime Error):
n = int(input()) #waiting_for_pudging
a = list(map(int, input().split())) #waiting_for_pudging
b = list(map(int, input().split())) #waiting_for_pudging
c = list(map(int, input().split())) #waiting_for_pudging
summ = 0 #waiting_for_pudging
for i in range(n-1): #pudging
    if a[i] + 1 == a[i + 1]: #pudging
        summ += c[a[i]] #pudging
        summ += b[a[i]] #pudging
    else: #pudging
        summ += b[a[i-1]] #pudging
print(summ) #pudging
#accepted
Problem p02935 (python)

Fixed submission:

# Solution: sort and then combine result of mixing first and second with the third, etc. so that most valuable are weighted heighest

input() # N
ingredients = [int(x) for x in input().split()]

ingredients.sort()
value = ingredients[0]
for ingredient in ingredients:
    value = (value+ingredient) / 2
print(value)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
#define ld long double

int main() {
    ll n;
    cin >> n;
    vector<ll> numbers(n);
    for(auto &i: numbers) cin >> i ;
    sort(numbers.begin(), numbers.end());
    ld ans = numbers[0];
    for(auto i: numbers) {
        ans = (ans + i)/2;
    }
    cout << ans << endl;
    return 0;
}
Problem p02987 (python)

Fixed submission:
s = input()
a = set()
for i in s: a.add(i)
if len(a) == 2 and s.count(s[0]) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] == s[1] and s[2] == s[3] or s[1] == s[2] and s[0] == s[3] or s[0] == s[2] and s[1] == s[3] and (a[0] != a[1] and a[1] != a[2] and a[2] != a[3]):
    print("Yes")
else:
    print("No")
Problem p03011 (python)

Fixed submission:
# your code goes here
p,q,r = map(int,input().split())
print(min(p+q,q+r,r+p))

Buggy submission (verdict: Runtime Error):
d12=int(input())
d13=int(input())
d23=int(input())
dt1=d12+d23
dt2=d23+d13
dt3=d13+d12
if (dt1<dt2 and dt1<dt3):
    print(dt1)
elif (dt2<dt1 and dt2<dt3):
    print(dt2)
else:
    print(dt3)
Problem p03013 (python)

Fixed submission:
I=lambda : list(map(int,input().split()))

n,m = I();md=10**9+7;p=0;a=1
dp=[0,1];l=[0]*(10**5+2)
for _ in range(m):
    x=int(input())
    l[x]=1
for i in range(1,n+1):
    if l[i]:
        dp.append(0)
    else:
        dp.append((dp[-1]+dp[-2])%md)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N,m=map(int,input().split())
s = set()
for i in range(m):
    s.add(int(input()))
memo={0:1}
mod=1000000007
def climb_stairs(n):
    if memo.__contains__(n):
        return memo[n]
    else:
        if s.__contains__(n):
            return 0
        elif n==1:
            return 1
        else:
            memo[n]=((climb_stairs(n-1)%mod + (climb_stairs(n-2) %mod)%mod
            return memo[n]
print(climb_stairs(N))
Problem p03075 (python)

Fixed submission:
arr = [int(input()) for _ in range(6)]
arr, k = sorted(arr[:-1]), arr[-1]
print('Yay!' if arr[-1]-arr[0] <= k else ':(')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if 0 < a <= 123:
    if 0 < b <= 123:
        if 0 < c <= 123:
            if 0 < d <= 123:
                if 0 < e <= 123:
                    if 0 < k <= 123:
                        if a < b:
                            if b < c:
                                if c < d:
                                    if d < e:
                                        ab = b - a
                                        ac = c - a
                                        ad = d - a
                                        ae = e - a
                                        bc = c - b
                                        bd = d - b
                                        be = e - b
                                        cd = d - c
                                        ce = e - c
                                        de = e - d

                                        lista = [ab, ac, ad, ae, bc, bd, be, cd, ce, de]
                                        x = max(lista)
if x <= 15:
     print("Yay!")
else:
    print(":(")
Problem p03107 (python)

Fixed submission:
s = input()
print(2*(min(s.count("0"), s.count("1"))))

Buggy submission (verdict: Runtime Error):
for a in Str:
    Codigo.append(a)

lenMax=len(Codigo)-1
k=0

while i < len(Codigo)-1:
    try:
        lenAnterior = len(Codigo)-1
    
        if Codigo[i] == "0" and Codigo[i+1]=="1":
            contador+=2
            Codigo.pop(i)
            Codigo.pop(i)
        elif Codigo[i] == "1" and Codigo[i+1]=="0":
            contador+=2
            Codigo.pop(i)
            Codigo.pop(i)
        
        if lenAnterior != len(Codigo)-1:
            i=i-1
        else:
            i=i+1

        k+=1

        if k >= lenMax:
            break
    except:
        break
    
print(contador)
Problem p03272 (python)

Fixed submission:
N, i = [int(x) for x in input().split()]
print(N - i + 1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a+1-b)
//Source code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 characters

Buggy submission (verdict: Runtime Error):
N,I=map(int,input().split())
x = N -I
x+=1
print(x)

Buggy submission (verdict: Runtime Error):
s=list(map(int,input().split()))
    print(s[0]-s[1]+1)

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

j=N-i+1

print (j)
Problem p03705 (python)

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

Buggy submission (verdict: Runtime Error):
line = input().split()
N = line[0]
A = line[1]
B = line[2]

if A > B:
    cnt = 0
elif N == 1:
    cnt = 0
elif A == B:
    cnt = 1
else:
    cnt=(2-N)*A+(N-2)*B+1

print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
if n == 1 and a == b:
    print(1)
elif n<2 or a>b:
    print(0)
else:
    print((n-2)*(b-a)+1)
Problem p02571 (python)

Fixed submission:
S=input()
T=input()
a=len(S)
b=len(T)
m=a-b
ans=b
if m!=0:
    for i in range(m):
        cnt=b
        for j in range(b):
            if S[i+j]==T[j]:
                cnt-=1
        ans=min(cnt,ans)
else:
    cnt=b
    for i in range(a):
        if S[i]==T[i]:
            cnt-=1
    ans=min(cnt,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
a=len(S)
b=len(T)
m=a-b
A=[]
for i in range(m):
    cnt=b
    for j in range(b):
        if S[i+j]==T[j]:
            cnt-=1
    A.append(cnt)
print(min(A))
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a,b=input().split()
a=int(a)
b=Decimal(b)
print(int(a*b))

Buggy submission (verdict: Runtime Error):
a,b=input()
a=int(a)
b=float(b)
print(int(a*b))
Problem p02773 (python)

Fixed submission:
N=int(input())
S=[input() for i in range(N)]
S=sorted(S)
cnt=1
max_cnt=1
ans=[S[0]]
for i in range(N-1):
    if S[i]==S[i+1]:
        cnt+=1
    else:
        cnt=1
    if cnt==max_cnt:
        ans.append(S[i+1])
    if cnt>max_cnt:
        max_cnt=cnt
        ans=[S[i+1]]
ans=sorted(ans)
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=['x']*N
for i in range(N):
    S[i]=input()
poll=[]
S_set=list(set(S))
for i in range(len(S_set)):
    poll.append((S.count(S_set[i]),S_set[i]))
poll=sorted(poll)[::-1]
x=poll[0][0]
i=0
ans=[]
while True:
    if x==poll[i][0]:
        ans.append(poll[i][1])
        i+=1
    else:
        break
ans=sorted(ans)
for i in range(len(ans)):
    print(ans[i])
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
a=set(a)
A=[0]*(n+1)
A[0]=1
for i in range(1,n+1):
  if i in a:
    A[i]==0
  else:
    A[i]=A[i-1]+A[i-2]
print(A[n]%(10**9+7))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
A=[]
count=[]
for i in range(m):
  a=int(input())
  if a-1 in A:
    print(0)
    break
  A.append(a)
A=sorted(list(set(A)))
c=1
d=1
for i in range(A[0]-1):
  c=d%(10**9+7)
  d=(c+d)%(10**9+7)
count.append(c)
if m>1:
  for i in range(1,len(A)-1):
    e=1
    f=1
    for j in range(A[i+1]-A[i]-2):
      e=f%(10**9+7)
      f=(e+f)%(10**9+7)
    count.append(e)
a=1
b=1
for i in range(n-A[-1]-1):
  a=b%(10**9+7)
  b=(a+b)%(10**9+7)
count.append(a)
Total=1
for i in range(len(count)):
  Total*=count[i]%(10**9+7)
print(Total%(10**9+7))
Problem p03775 (python)

Fixed submission:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
nn = int(math.sqrt(n))
while n%i != 0: i-=1
print(len(str(n//i)))
Problem p02659 (python)

Fixed submission:
line = input()
line = line.split()
a = int(line[0])
b = float(line[1]) + 0.001
c = int(b * 100)
print((a * c) // 100)

Buggy submission (verdict: Runtime Error):
/* *>>>>>Anshit_Bhardwaj<<<<<* */
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << ' ' << y << endl
#define dbg3(x, y, z) cout << x << ' ' << y << ' ' << z << endl
#define mod 1000000007
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a, b;
    double d;
    cin >> a >> d;
    b = d * 100;
    a *= b;
    cout << a / 100 << endl;
}
Problem p02688 (python)

Fixed submission:
N, K = map(int, input().split())
ans = [0]*N
for i in range(K):
  d = int(input())
  for j in list(map(int, input().split())):
    ans[j-1] = 1
print(ans.count(0))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
list0 = [list(map(int, input().split())) for i in range(2*K-1)]
listd = list0[1::2]
listf = listd[0]
count = 0
for i in range(1, K-1):
  listf = listf + listd[i]

for i in range(1, N):
  if i not in listf:
    count = count + 1

print(count)
Problem p02959 (python)

Fixed submission:
N = int( input() )
A, B = list( map(lambda x: int(x), input().split(" ")) ), list( map(lambda x: int(x), input().split(" ")) )
#A = monsters. B = number of to be able to kill monsters.殺せる数

 
def kill_monsters(Ai, Bi):

    Ai -= Bi
    Bi = 0

    if Ai < 0:
        Bi += -1*Ai
        Ai = 0

    return (Ai, Bi)
 
def main(local_A, local_B, lim):
 
    for i in range(lim):
        local_A[i], local_B[i] = kill_monsters(local_A[i], local_B[i])
 
        if 0 < local_B[i]:
            local_A[i+1], local_B[i] = kill_monsters(local_A[i+1], local_B[i])
 
    return [local_A, local_B]

print( sum(A) - sum(main(A, B, N)[0]) )

Buggy submission (verdict: Runtime Error):
N = int( input() )
A, B = list( map(lambda x: int(x), input().split(" ")) ), list( map(lambda x: int(x), input().split(" ")) )
#A = monsters. B = number of to be able to kill monsters.殺せる数

def kill_monsters(Ai, Bi):

    if Ai <= 0 or Bi <= 0:
        return (Ai, Bi)
    else:
        return kill_monsters(Ai-1, Bi-1)


def main(local_A, local_B, lim):

    for i in range(lim):
        local_A[i], local_B[i] = kill_monsters(local_A[i], local_B[i])

        if 0 < local_B[i]:
            local_A[i+1], local_B[i] = kill_monsters(local_A[i+1], local_B[i])

    return [local_A, local_B]


print( sum(A) - sum(main(A, B, N)[0]) )

Buggy submission (verdict: Runtime Error):
N = int( input() )
A, B = list( map(lambda x: int(x), input().split(" ")) ), list( map(lambda x: int(x), input().split(" ")) )
#A = monsters. B = number of to be able to kill monsters.殺せる数

def kill_monsters(Ai, Bi):

    if Ai <= 0 or Bi <= 0:
        return (Ai, Bi)
    else:
        return kill_monsters(Ai-1, Bi-1)


def main(local_A, local_B, i, lim):
    local_A[i], local_B[i] = kill_monsters(local_A[i], local_B[i])

    if 0 < local_B[i]:
        local_A[i+1], local_B[i] = kill_monsters(local_A[i+1], local_B[i])

    if lim <= i:
        return [local_A, local_B]

    return main(local_A, local_B, i+1, lim)

print( sum(A) - sum(main(A, B, 0, N-1)[0]) )
Problem p02597 (python)

Fixed submission:
N = int(input())
S = list(input().strip())

l = 0
r = N-1
ans = 0
while l < r:
    if S[l] == 'W' and S[r] == 'R':
        ans += 1
        l += 1
        r -= 1
    while l < N and S[l] != 'W':
        l += 1
    while r >= 0 and S[r] != 'R':
        r -= 1

print(ans)

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

r = S.count('R')
w = S.count('W')

ans = min(r, w)

ri = S.index('R')
r2 = S[:ri].count('R')
w2 = S[ri:].count('W')

ans = min(ans, r2+w2)
print(ans)

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

r = S.count('R')
w = S.count('W')

ans = min(r, w)

ri = S.index('R')
r2 = S[:ri+1].count('W')

ans = min(ans, r2)
print(ans)

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

r = S.count('R')
w = S.count('W')

ans = min(r, w)

ri = S.index('R')
r2 = S[ri:].count('W')

ans = min(ans, r2)
print(ans)
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
count=0
if k<=a:
    count=1*k
elif a<k and k<=(a+b):
    count=1*a
elif (a+b)<k and k<=(a+b+c):
    count=1*a+(-1)*(k-a-b)
print(count)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
count=0
s=a+b
t=a+b+c
if k<=a:
    for i in k:
        count+=1
elif a<k and k<=s:
    count=1*a
elif k<t:
    p=(-1)*c
    count=1*a+p
print(count)
Problem p02707 (python)

Fixed submission:
N=int(input())
L=[0]*N
A=list(map(int,input().split()))
for i in range(0,len(A)):
    L[A[i]-1]+=1
for i in range(0,N):
    print(L[i])

Buggy submission (verdict: Runtime Error):
N=int(input())
arr=[0]*N
for i in range(1,N):
    A=int(input())
    arr[A-1]+=1
for i in range(0,N):
    print(arr[i])
Problem p02622 (python)

Fixed submission:
m=input()
n=input()
count=0
for i in range(len(m)):
   if m[i]!=n[i]:
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
try:
  s = input()
  t = input()
  count = 0
  for i in range(len(s)):
  if not s[i] == t[i]:
    count += 1
  print(count)
except EOFError:
  print('EOFError')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
count = 0
for i in range(len(a)):
  if not s[i] == t[i]:
    count += 1
print(count)
Problem p02627 (python)

Fixed submission:
x = input()

ans = x.islower()

#大文字 false
if ans == False:
  print('A')
else:
  print('a')

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

ans = x.islower()

#大文字 false
if ans == false:
  print('A')
else:
  print('a')
Problem p02594 (python)

Fixed submission:
x=int(input())
if x>=30:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
X = int(input())
if X>=30:
    print(Yes)
else:
    print(No)

Buggy submission (verdict: Runtime Error):
X = int(input())
if X<=30:
    print(Yes)
else:
    print(No)
Problem p02711 (python)

Fixed submission:
N=input()
if N[0]=='7' or N[1]=='7' or N[2]=='7':
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c=input()
if a=='7' or b=='7' or c=='7':
    print(Yes)
else:
    print(No)

Buggy submission (verdict: Runtime Error):
a,b,c=input()
if a=='7' or b=='7' or c=='7':
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
a,b,c=input()
if a=='7' or b=='7' or c=='7';
  print(Yes)
else;
  print(No)

Buggy submission (verdict: Runtime Error):
N=input()
if N[0]==7 or N[1]==7 or N[2]==7:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
N=input().split()
if N[0]==7 or N[1]==7 or N[2]==7;
  print(Yes)
else;
  print(No)

Buggy submission (verdict: Runtime Error):
N=input().split()
if N[0]==7 or N[1]==7 or N[2]==7:
    print(Yes)
else:
    print(No)

Buggy submission (verdict: Runtime Error):
N=input().split()
if N[0]==7 or N[1]==7 or N[2]==7:
  print(Yes)
else:
  print(No)
Problem p02723 (python)

Fixed submission:
string = input()

if string[2] == string[3] and string[4] == string[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

input1 = [int(x) for x in input().split()]
lake = input1[0]
homes = input1[1]
input2 = [int(x) for x in input().split()]

result = 1000000
last = homes - 1
for x in range(homes):
    forward = 0
    backward = 0
    start = input2[x]

    # forward
    if x == 0:
        forward = input2[last] - start
    else:
        forward = (lake - start) + input2[x - 1]
    
    # backward
    if x == last:
        backward = (start) - input2[0]
    else:
        backward = (start) + lake - (input2[x + 1])

    #print("forward: {}, backward: {}".format(forward, backward))
    result = min(result, forward, backward)

print(result)
Problem p02622 (python)

Fixed submission:
S=input()
T=input()

res=0
for i in range(len(S)):
	if not S[i]==T[i]:
		res+=1
print(res)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
res=0
for x in p[:K]:
	res+=x

print(res)
Problem p02729 (python)

Fixed submission:
import math

def resolve():

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

    nc=0
    mc=0
    if n >=2:
        nc=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
    if m>=2:
        mc=math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))

    print(nc+mc)

resolve()

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

nc=0
mc=0
if n >=2:
    nc=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
if m>=2:
    mc=math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))

print(nc+mc)
Problem p02753 (python)

Fixed submission:
S = input()

if S == "AAA" or S == "BBB":
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
    n,a, b = map(int, input().split())
    ans = n //(a+b) *a
    ans += min(n%(a+b),a)
    print(ans)

Buggy submission (verdict: Runtime Error):
n,a, b = map(int, input().split())
l = []
for i in range(10 ^100):
    l.extend([1]*a)
    l.extend([0]*b)

print(sum(l[:n]))
Problem p02754 (python)

Fixed submission:
n,a, b = map(int, input().split())
ans = n //(a+b) *a
tmp = n%(a+b)
ans += min(tmp,a)
print(ans)

Buggy submission (verdict: Runtime Error):
    n,a, b = map(int, input().split())
    ans = n //(a+b) *a
    tmp = n%(a+b)
    ans += min(tmp,a)
    print(ans)

Buggy submission (verdict: Runtime Error):
 n,a, b = map(int, input().split())
    ans = n //(a+b) *a
    ans += min(n%(a+b),a)
    print(ans)

Buggy submission (verdict: Runtime Error):
n,a, b = map(int, input().split())
l = []
for i in range(10 ^100):
    l.extend([1]*a)
    l.extend([0]*b)

print(sum(l[:n]))

Buggy submission (verdict: Runtime Error):
n,a, b = map(int, input().split())
l = []
for i in range(10 ^100):
    l.extend([1]*a)
    l.extend([0]*b)

print(sum(l[:n]))

Buggy submission (verdict: Runtime Error):
    n,a, b = map(int, input().split())
    l = []
    for i in range(10 ^100):
        l.extend([1]*a)
        l.extend([0]*b)
    
    print(sum(l[:n]))

Buggy submission (verdict: Runtime Error):
    n,a, b = map(int, input().split())
    l = []
    for i in range(10 ^100):
        l.extend([1]*a)
        l.extend([0]*b)
    
    print(sum(l[:n]))
Problem p02916 (python)

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

m=0
at=-1
for i,ai in enumerate(a):
    m+=b[ai-1]
    if ai == at+1:
        m+=c[at-1]
    at=ai
print(m)

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

m=0
# 0で初期化すると最初が1の時にだめ
at0
for i,ai in enumerate(a):
    m+=b[ai-1]
    if ai == at+1:
        m+=c[at-1]
    at=ai
print(m)
Problem p02595 (python)

Fixed submission:
N,D = map(int,input().split())
i = 0
k = 0
while N != i :
    x,y = map(int,input().split()) 
    if (x**2+y**2) <= D**2 :
        k += 1
    i +=1
print(k)

Buggy submission (verdict: Runtime Error):
N,D = map(int,input().split())
i = 0
k = 0
while N != i :
    x,y = map(int,input().split()) 
    d = (x**2+y**2) / D**2
    if d <= 1 :
        k += 1
    i +=1
print(k)
Problem p02676 (python)

Fixed submission:
k=int(input())
s=input()
if len(s)<=k:
  print(s)
else:
  print(s[:k]+"...")

Buggy submission (verdict: Runtime Error):
k=int(input())
s=input()
if len(s)<=k:
  print(k)
else:
  print(s[:k]&"...")

Buggy submission (verdict: Runtime Error):
k=int(input())
s=input()
if len(s)<=k:
  print(k)
else:
  print(k[:k]&"...")
Problem p02711 (python)

Fixed submission:
from collections import deque
d=deque(input())
if "7" in d:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
lst=list(s)
r=[i for i,j in enumerate(lst) if j=="R"]
g=[i for i,j in enumerate(lst) if j=="G"]
b=[i for i,j in enumerate(lst) if j=="B"]
comb=len(r)*len(g)*len(b)
out=0
for i in r:
  for j in g:
    for k in b:
      if (i+j)==2*k or (j+k)==2*i or (k+i)==2*j:
        out+=1
print(comb-out)
Problem p02729 (python)

Fixed submission:
from math import factorial as f
n,m=map(int,input().split())
comb_n=f(n)//(f(2)*f(n-2)) if n>1 else 0
comb_m=f(m)//(f(2)*f(m-2)) if m>1 else 0
print(comb_n+comb_m)

Buggy submission (verdict: Runtime Error):
from math import factorial as f
n,m=map(int,input().split())
print(f(n)//(f(2)*f(n-2))+f(m)//(f(2)*f(m-2)))
Problem p02759 (python)

Fixed submission:
print((int(input())+1)//2)

Buggy submission (verdict: Runtime Error):
print(int(input()+1//2)
Problem p02766 (python)

Fixed submission:
n,k=map(int,input().split())
ans=0
while n>0:
  ans+=1
  n=n//k
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input())
ans=0
while n>0:
  ans+=1
  n=n//k
print(ans)
Problem p02729 (python)

Fixed submission:
import math
 
N, M = map(int, input().split())
 
def comb(n, r):
    if n == 0:
        return 0
    if r == 0:
        return 0
    if n < 2:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
if N + M < 2:
    print(0)
elif N == 1 and M == 1:
    print(0)
else:
    ans = comb(N, 2) + comb(M, 2)
    print(ans)

Buggy submission (verdict: Runtime Error):
import math

N, M = map(int, input().split())

def comb(n, r):
    if n == 0:
        return 0
    if r == 0:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if N + M < 2:
    print(0)
elif N == 1 and M == 1:
    print(0)
else:
    ans = comb(N, 2) + comb(M, 2)
    print(ans)

Buggy submission (verdict: Runtime Error):
import math

N, M = map(int, input().split())

def comb(n, r):
    if n == 0:
        return 0
    if r == 0:
        return 0

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if N == 1 and M == 1:
    print(0)
else:
    ans = comb(N, 2) + comb(M, 2)
    print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

def comb(n, r):
    if n == 0:
        return 0
    if r == 0:
        return 0
    if n < r: 
        return 0

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans = comb(N, 2) + comb(M, 2)

print(ans)