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

Fixed submission:
#i文字目を見て，それより前のAの個数，ABの個数，ABCの個数を持っておく

S=input()
N=len(S)
dp=[0,0,0]

mod=10**9+7

p=[1]*(N+1)
for i in range(N):
    p[i+1]=(p[i]*3)%mod


count=0#?の数
for i in range(N):
    if S[i]=="A":
        dp[0]=(dp[0]+p[count]) %mod
    elif S[i]=="B":
        dp[1]=(dp[1]+dp[0])%mod
    elif S[i]=="C":
        dp[2]=(dp[2]+dp[1])%mod
    else:
        dp[2]=(dp[2]*3+dp[1])%mod
        dp[1]=(dp[1]*3+dp[0])%mod
        dp[0]=(dp[0]*3+p[count])%mod
        count+=1
        
print(dp[2]%mod)

Buggy submission (verdict: Runtime Error):
#i文字目を見て，それより前のAの個数，ABの個数，ABCの個数を持っておく

S=input()
N=len(S)
dp=[0,0,0]

mod=10**9+7


count=0#?の数
for i in range(N):
    if S[i]=="A":
        dp[0]=(dp[0]+p[count]) %mod
    elif S[i]=="B":
        dp[1]=(dp[1]+dp[0])%mod
    elif S[i]=="C":
        dp[2]=(dp[2]+dp[1])%mod
    else:
        dp[2]=(dp[2]*3+dp[1])%mod
        dp[1]=(dp[1]*3+dp[0])%mod
        dp[0]=(dp[0]*3+pow(3,count))%mod
        count+=1
        
print(dp[2]%mod)
Problem p03307 (python)

Fixed submission:
from fractions import gcd

n=int(input())
g=gcd(2,n)
print(2*n//g)

Buggy submission (verdict: Runtime Error):
ソースコード
from fractions import gcd
n=int(input())
g=gcd(2,n)
print(2*n//g)
Problem p03426 (python)

Fixed submission:
H,W,D=map(int,input().split())
A=[[] for _ in range(H)]

for i in range(H):
    A[i]=list(map(int,input().split()))
    
index=[[-1,-1] for _ in range(H*W+1)]

for i in range(H):
    for j in range(W):
        index[A[i][j]]=[i,j]
        
    
S=[[0]*(H*W//D+1) for _ in range(D+1)]
for start in range(1,D+1):
    for j in range(H*W//D):
        prev=start+j*D
        nxt=prev+D
        if nxt>H*W:
            break
        diff=abs(index[nxt][0] - index[prev][0]) + abs(index[nxt][1] - index[prev][1])
        S[start][j+1]=S[start][j]+diff
        
Q=int(input())
        
for i in range(Q):
    L,R=map(int,input().split())
    start=L%D
    if start==0:
        start=D
    print(S[start][(R-start)//D] - S[start][(L-start)//D])

Buggy submission (verdict: Runtime Error):
H,W,D=map(int,input().split())
A=[[] for _ in range(H)]

for i in range(H):
    A[i]=list(map(int,input().split()))
    
index=[[-1,-1] for _ in range(H*W+1)]

for i in range(H):
    for j in range(W):
        index[A[i][j]]=[i,j]
   
        
    
S=[[0]*(H*W//D) for _ in range(D+1)]
for start in range(1,D+1):
    for j in range(H*W//D-1):
        prev=start+j*D
        nxt=prev+D
        diff=abs(index[nxt][0] - index[prev][0]) + abs(index[nxt][1] - index[prev][1])
        S[start][j+1]=S[start][j]+diff
        
Q=int(input())
        
for i in range(Q):
    L,R=map(int,input().split())
    start=L%D
    if start==0:
        start=D
    print(S[start][(R-start)//D] - S[start][(L-start)//D])
Problem p02832 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
n,m = 1,0
if 1 not in A: print(-1)
else:
  for i in range(N):
    if A[i] == n: n += 1
    else: m += 1
  print(m)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
n,m = 1,0
if 1 not in A: print(-1)
else:
  for i in range(N):
    if A[i] == n: n += 1
    else: m += 1
  print(m)
Problem p02550 (python)

Fixed submission:
n, x, m = map(int, input().split())
mn = min(n, m)
P = []
sum_p = 0
X = [-1] * m
for i in range(mn):
    if X[x] > -1:
        cyc_len = len(P) - X[x]
        remain = P[X[x]]
        cyc = (sum_p - remain) * ((n - X[x]) // cyc_len)
        remain += P[X[x] + (n - X[x]) % cyc_len] - P[X[x]]
        print(cyc + remain)
        exit()
    P.append(sum_p)
    sum_p += x
    X[x] = i
    x = x*x % m
print(sum_p)

Buggy submission (verdict: Runtime Error):
N,X,M = map(int,input().split())
rt = 0
for i in range(2,N+1):
  dps[i] = (dps[i-1]**2)%M
  rt+=dps[i]
print(rt)
Problem p02570 (python)

Fixed submission:

D,T,S = map(int, input().split())

print("Yes" if D/(S*T)<=1 else "No")

Buggy submission (verdict: Runtime Error):

D,T,S = map(int, input.split())

print("Yes" if D/(S*T)<=1 else "No")
Problem p02595 (python)

Fixed submission:
N,D=map(int,input().split())
d2 = D**2
rt = 0
for i in range(N):
  x,y = map(int,input().split())
  
  if x**2 + y**2 <= d2:
    rt+=1
print(rt)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split())
d2 = D**2
rt = 0
for i in range(n):
  x,y = map(int,input().split())
  
  if x**2 + y**2 < d2:
    rt+=1
print(rt)
Problem p02771 (python)

Fixed submission:
a=list(map(int,input().split()))
if(a[0]==a[1]==a[2]):
  print("No")
else:
  if (a[0]==a[1])|(a[1]==a[2])|(a[2]==a[0]):
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
d=input()
a=list(map(int,input().split()))
rt=0
for i in a:
  if i % 2 == 1:
    pass
  else:
    if i%3==0 or i%5==0:
      rt=1
    else:
      rt=0
      print("DENIED")
      break
if rt==1:
  print("APPROVED")

Buggy submission (verdict: Runtime Error):
d=input()
a=list(map(int,input().split()))
rt=0
print(a)
for i in a:
  if i % 2 == 1:
    pass
  else:
    if i%3==0 or i%5==0:
      rt=1
    else:
      rt=0
      print("DENIED")
      break
if rt==1:
  print("APPROVED")
Problem p02987 (python)

Fixed submission:
from collections import Counter
a = Counter(input()).most_common()
if len(a)==2:
  if a[1][1]==2:
    print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
a = Counter(input()).most_common()

print("Yes" if a[1][1]==2 else "No")
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
As = list(map(int, input().split()))
BCs = [tuple(map(int, input().split())) for _ in range(M)]

As.sort()
BCs.sort(key=lambda x: x[1], reverse=True)

iA = 0
for B, C in BCs:
    for j in range(B):
        if As[iA] < C:
            As[iA] = C
            iA += 1
            if iA >= N:
                break
        else:
            break
    else:
        continue
    break

print(sum(As))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
As = list(map(int, input().split()))
BCs = [tuple(map(int, input().split())) for _ in range(M)]

As.sort()
BCs.sort(reverse=True, key=lambda x: x[1])

i = 0
for B, C in BCs:
    num = min(N-i, B)
    for j in range(i, i+B):
        if As[j] >= C:
            break
        As[j] = C
    else:
        i += B
        continue
    break
#print('As:', As)

print(sum(As))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
As = list(map(int, input().split()))
BCs = [tuple(map(int, input().split())) for _ in range(M)]

As.sort()
BCs.sort(key=lambda x: x[1], reverse=True)

iA = 0
for B, C in BCs:
    for j in range(B):
        if As[iA] < C:
            As[iA] = C
            iA += 1
        else:
            break
    else:
        continue
    break

print(sum(As))
Problem p03253 (python)

Fixed submission:
from math import floor, sqrt
from collections import Counter

MOD = 10 ** 9 + 7

# xを素因数分解する
def getPrimeFactor(x):
    ans = []
    for d in range(2, floor(sqrt(x)) + 1):
        while x % d == 0:
            ans.append(d)
            x //= d

    if x != 1:
        ans.append(x)

    return ans

# xのn乗（二分累乗法）
def power(x, n):
    ans = 1
    while n:
        if n % 2 == 1:
            ans = (ans * x) % MOD
        x = (x * x) % MOD
        n //= 2
    return ans


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

PFs = getPrimeFactor(M)
cnt = Counter(PFs)

N2 = N
if len(cnt):
    N2 += max(cnt.values())

# facts[x]: xの階乗
facts = [1] + [0] * N2
for x in range(1, N2 + 1):
    facts[x] = (facts[x - 1] * x) % MOD

# invFs[x]: xの階乗の逆元
invFs = [0] * N2 + [power(facts[N2], MOD - 2)]
for x in reversed(range(N2)):
    invFs[x] = (invFs[x + 1] * (x + 1)) % MOD

def comb(n, k):
    return ((facts[n] * invFs[k]) % MOD * invFs[n - k]) % MOD


ans = 1
for num in cnt.values():
    ans = (ans * comb(N + num - 1, num)) % MOD
print(ans)

Buggy submission (verdict: Runtime Error):
from math import floor, sqrt
from collections import Counter

MOD = 10 ** 9 + 7

# xを素因数分解する
def getPrimeFactor(x):
    ans = []
    for d in range(2, floor(sqrt(x)) + 1):
        while x % d == 0:
            ans.append(d)
            x //= d

    if x != 1:
        ans.append(x)

    return ans

# xのn乗（二分累乗法）
def power(x, n):
    ans = 1
    while n:
        if n % 2 == 1:
            ans = (ans * x) % MOD
        x = (x * x) % MOD
        n //= 2
    return ans


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

PFs = getPrimeFactor(M)
cnt = Counter(PFs)

maxNum = max(cnt.values())
N2 = N + maxNum

# facts[x]: xの階乗
facts = [1] + [0] * N2
for x in range(1, N2 + 1):
    facts[x] = (facts[x - 1] * x) % MOD

# invFs[x]: xの階乗の逆元
invFs = [0] * N2 + [power(facts[N2], MOD - 2)]
for x in reversed(range(N2)):
    invFs[x] = (invFs[x + 1] * (x + 1)) % MOD

def comb(n, k):
    return ((facts[n] * invFs[k]) % MOD * invFs[n - k]) % MOD


ans = 1
for num in cnt.values():
    ans = (ans * comb(N + num - 1, num)) % MOD
print(ans)
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N = int(input())

adj = [[] for i in range(N)]
for i in range(N - 1):
    a, b, c = map(int, input().split())
    adj[-a].append((b, c))
    adj[-b].append((a, c))

Q, K = map(int, input().split())
query = [tuple(map(int, input().split())) for i in range(Q)]

# dist[-i]:頂点Kから頂点iまでの距離
dist = [0 for i in range(N)]

def dfs(v, prv, ds):
    dist[-v] = ds
    for nxt, c in adj[-v]:
        if nxt != prv:
            dfs(nxt, v, ds + c)

dfs(K, None, 0)

for x, y in query:
    print(dist[-x] + dist[-y])

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

adj = [[] for i in range(N)]
for i in range(N - 1):
    a, b, c = map(int, input().split())
    adj[-a].append((b, c))
    adj[-b].append((a, c))

Q, K = map(int, input().split())
query = [tuple(map(int, input().split())) for i in range(Q)]

# dist[-i]:頂点Kから頂点iまでの距離
dist = [0 for i in range(N)]

def dfs(v, prv, ds):
    dist[-v] = ds
    for nxt, c in adj[-v]:
        if nxt != prv:
            dfs(nxt, v, ds + c)

dfs(K, None, 0)

for x, y in query:
    print(dist[-x] + dist[-y])

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

adj = [set() for i in range(N)]
for i in range(N - 1):
    a, b, c = map(int, input().split())
    adj[-a].add((b, c))
    adj[-b].add((a, c))

Q, K = map(int, input().split())
query = [tuple(map(int, input().split())) for i in range(Q)]

# dist[-i]:頂点Kから頂点iまでの距離
dist = [0 for i in range(N)]

def dfs(v, prv, ds):
    dist[-v] = ds
    for nxt, c in adj[-v]:
        if nxt != prv:
            dfs(nxt, v, ds + c)

dfs(K, None, 0)

for x, y in query:
    print(dist[-x] + dist[-y])
Problem p02570 (python)

Fixed submission:
import sys

def main():
    input = sys.stdin.read()
    data = list(map(int, input.split()))

    a, b, c = data

    if b*c >= a:
        print('Yes')
    else:
        print('No')



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
d=int(input())
t=int(input())
s=int(input())

if d == 0:
    print ('error')
    
elif t == 0:
    print ('error')
        
elif s == 0:
    print ('error')

else:
    
    if (s*t) >= d :
        print ('Yes')
    
    else:
        print ('No')

Buggy submission (verdict: Runtime Error):
d=int(input())
t=int(input())
s=int(input())

    
    if s*t >= d:
        print ('Yes')
    
    else:
        print ('No')

Buggy submission (verdict: Runtime Error):
d=float(input())
t=float(input())
s=float(input())


if (d/t) <= s:
    print ('Yes')
    
else:
    print ('No')
Problem p02577 (python)

Fixed submission:
str = input()
sum = 0
for ch in str:
    sum += ord(ch) - ord('0')
if sum % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
/*
ID: sstfmsc1
TASK: milk2
LANG: C++
*/
#include <bits/stdc++.h>
 
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define forin(i, n) for ( int i = 0; i < (int)n; ++i )
#define MAXN 50000
#define INF 1000000
typedef long long ll;
const char nl = '\n';
ll MOD = (ll)(1e9 + 7);
 
void solve()
{
    string num; 
    cin >> num;

    int suma = 0;
    for(auto x : num) suma += (int)( x - '0' );

    cout << ( ( suma % 9 == 0 ) ? "Yes" : "No" ) << nl;
    return;
}
 
int main()
{
    //freopen("milk2.in", "r", stdin);
    //freopen("milk2.out", "w", stdout);
    //IOS
    //int q; cin >> q;
    //while(q--) 
    solve();
        
    return 0;
}
Problem p02594 (python)

Fixed submission:
n = int(input())
if n>= 30:print('Yes')
else:print('No')

Buggy submission (verdict: Runtime Error):
def main():
    line=stdin.readline()
    parts=line.split()
    a=int(parts[0])
    if a>=30:
        stdout.write("Yes")
    else:
        stdout.write("N")
main()
Problem p02629 (python)

Fixed submission:
a = int(input())
s = []
ret = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
       'w', 'x', 'y', 'z',
       ]
while a > 0:
    a -= 1  # 为甚么减去1？
    shang = int(a / 26)
    yushu = int(a % 26)
    # print(shang, yushu)
    s.append(yushu)  # 上面减去的1，加在了这里，由此可以得到1-26，位置信息
    a = shang

s.reverse()
# print(s)
v = ''
for i in range(len(s)):
    v += ret[s[i]]
print(v)

Buggy submission (verdict: Runtime Error):

local t = {"a", "b", "c", "d", "e","f", "g", "h", "i","j", "k", "l", "m", "n","o", "p", "q", "r","s", "t ", "u", "v", "w","x", "y", "z"}
local N = io.read()
local N = 123456789
local x = string.byte("a") - 1
local aa = ""
local function a(N)
    local n = math.floor(N / 26)
    local m = N % 26
    if n > 26 then
       a(n)
    else
        if m ~= 0 then
            aa = aa..t[n]
        end
    end
    if m == 0 then
        aa = aa..t[26]
    else
        aa = aa..t[m]
    end
end
a(N)
print(aa)
Problem p02659 (python)

Fixed submission:
A, B = map(str, input().split()) # take the input in one line
A = int(A) # convert A into integer
C = B[0]+B[2]+B[3]
C = int(C)
print(A*C//100) # printing the output

# time complixity O(1)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split(' '))
result = int(A*B)
print(result)

Buggy submission (verdict: Runtime Error):
m = eval(input(""))
n = eval(input(""))
num = m*n
num = int(num)
print(num)

Buggy submission (verdict: Runtime Error):
import math

num1= str(input()) #take input as a string
num2= str(input())

num1=str(num1)
num2=str(num2)

result= int(num1)*float(num2) #calculate the multiplication of inputs as integer and float
result= math.floor(result) #rounding down the output using floor function

print(result)

Buggy submission (verdict: Runtime Error):

A = float(input("Enter A: "))
B= float(input("Enter B: "))

print(int(A*B))
Problem p02676 (python)

Fixed submission:
# Take the input K
# Take the inpus S

#Compare the length of S with K and put in in length
#If length<=K... print all
#If length>K... print some of the character

K = int(input()) # 0(1)
S = input() #0(1)
second_answer = [] #0(1)
x = 0 #0(1)

length = len(S) #0(1)

if length <= K : 
    print(S) #0(1)
else:
    while x<K : #0(K)
        print(S[x], end= (""))
        x += 1
    print("...")

Buggy submission (verdict: Runtime Error):
string=input()
number=int(input())
characters=len(string)
empty=""
if characters<=number:
    print(string)
else:
   i=0
   while i<=number-1:
       empty+=string[i]
       i=i+1
   print(f"{empty}...")

Buggy submission (verdict: Runtime Error):
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 lens(s)>k:
    print(S[ :K ] + "...")
else:
    print(s)
S[]
S[5:]

Buggy submission (verdict: Runtime Error):
#input an interget
k=int(input())
#input an string
str1=str(input())
#get the length of the string
x=int(len(str1))
#get the difference in length between k and s
i=x-k
#initialise y
y=0
#make a second string for the appending
str2="..."

#if statement about how the string will function
#if the string is the same length as k then print it
if i==0:
    print(str1)
#if not, delete the last character of the string and then print it
else:
    while y<k:
        print(str1[y],end=(""))
        y+=1
    print(str2)

Buggy submission (verdict: Runtime Error):
#input an interget
K=int(input())
#input an string
S=str(input())
#get the length of the string
x=int(len(str1))
#get the difference in length between k and s
i=x-k

#make a second string for the appending
S2="..."

#if statement about how the string will function
#if the string is the same length as k then print it
if i==0:
    print(S)
#if not, delete the last character of the string
else:
    for i in range(x):
        S=S[i]
#and then join the two strings together
    newstr="".join((S,S2))
    print(newstr)

Buggy submission (verdict: Runtime Error):
# program to print the new string after performing append operation in the string s "..." 
# if only the character s is more than k but if the character s is at most k
# the output will not change
#first we will define the new string

k =int(input())
s = input()

str = s
dots = "..."
if len(s) == k:
print(s)
elif len(s) > k:
print (str[0:k],"...")
Problem p02699 (python)

Fixed submission:
a,b=map(int,input().split(' '))
if(a>b):
    print('safe')
else:
    print('unsafe')

Buggy submission (verdict: Runtime Error):
for i in range(2):
    S, W = [int(x) for x in input().split()]
if W >= S:
    print('unsafe')
else:
    print('safe')
Problem p02729 (python)

Fixed submission:
inp=input().split()
n=int(inp[0])
m=int(inp[1])
arr=[]
pares=0
impares=0
count=1
nums=0

def binary(arr, menor, mayor, x): 
    if mayor >= menor: 
        med = (mayor + menor) // 2
        if arr[med] == x: 
            return med 

        elif arr[med] > x: 
            return binary(arr, menor, med - 1, x) 
  
        else: 
            return binary(arr, med + 1, mayor, x) 
    else: 
        return -1

while len(arr)<(m+n):
    if count%2==0 and pares<n:
        arr.append(count)
        pares+=1
    elif count%2!=0 and impares<m:
        arr.append(count)
        impares+=1
    count+=1
sums=[]


for x in arr:
   for y in arr:
        if(x+y)%2==0 and binary(sums, 0, len(sums)-1, [y,x])==-1 and x!=y:
            sums.append([x,y])
            nums+=1
print(nums)

Buggy submission (verdict: Runtime Error):
import math


def f(xxx):
    return math.factorial(xxx)


arr = list(map(int, input().split()))
n = arr[0]
m = arr[1]
cnt = 0
cnt += int(f(n) / (2 * f(n - 2)))
if m > 1:
    cnt += int(f(m) / (2 * f(m - 2)))
print(int(cnt))
Problem p02754 (python)

Fixed submission:
N,A,B= input().split()
if int(N)%(int(A)+int(B))>=int(A):
    ans=int(N)//(int(A)+int(B))*int(A)+int(A)
    print(ans)
else:
    ans=int(N)//(int(A)+int(B))*int(A)+int(N)%(int(A)+int(B))
    print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
list_num = S.split(' ')
list_num = map(int, list_num)
N, A, B = list_num[0], list_num[1], list_num[2]

if A+B>N:
  print(N-A-B)
elif A+B=N:
  print(A)
Problem p02771 (python)

Fixed submission:
def main():
    a, b, c = map(int, input().split())
    if (a == b and a != c) or (a == c and b != c) or (b == c and a != b):
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())

if A==B and B==C:
    print("No")
elif A != B and B != C:
    print("No")
else:
    print("Yes")
Problem p02790 (python)

Fixed submission:
from sys import stdin

def main():
    N,M  = map(int,stdin.readline().split())
    if(N < M):
        res = str(N)
        print(res*M)
    else:
        res = str(M)
        print(res*N)
        
main()

Buggy submission (verdict: Runtime Error):
for k in range (10):
    n = list(map(int,input().split()))
    a,b = n
    fb = 0
    fa = 0
    for i in range (a):
        tmp = b * (10 ** i)
        fb += tmp

    for i in range (b):
        tmp = a * (10 ** i)
        fa += tmp
    if fa > fb:
        print (fb)
    else:
        print (fa)
Problem p02833 (python)

Fixed submission:
# v=[]
# num=251
# for i in range(num):
#     if i==0 or i==1:
#         v.append(1)
#     else:
#         v.append(i*v[i-2])
        
# for i in range(0,num,2):
#     print(i,v[i],end=' ')
#     print()

n=int(input())
if n%2!=0:
    print(0)
else:
    ans=n//10
    n=n//10
    i=1
    while(1):
        ans+=n//(5**i)
        if n//(5**i)==0:
            break
        i+=1
        
        
    print(ans)

Buggy submission (verdict: Runtime Error):

def s(l):
    if l<2:
        return 1
    else:
        return s(l-2)
ab=int(input())
ll=s(ab)
a=0
b=1
while(b):
    if(ll%10!=0):
        b=0
    else:
        a=a+1
print(a)

Buggy submission (verdict: Runtime Error):
import sys

def double_factorial(args):
    for n in args:
        if n % 2 == 0 or n < 1:
            error = 'Must enter an odd number greater than or equal to one.'
            raise ValueError(error)

    max_arg = max(args)
    total = 1
    results = []
    for arg in args:
        for i in [x for x in range(1, max_arg + 1) if x % 2 != 0]:
            if i <= arg:
                total *= i
        results.append(total)
        total = 1
    return results


if __name__ == '__main__':
    if len(sys.argv) > 1:
        if sys.argv[1] == '-n':
            arg = int(sys.argv[2])
            args = []
            for i in range(1, arg + 1):
                args.append(2 * i - 1)
            results = double_factorial(args)
        else:
            args = [int(x) for x in sys.argv[1:]]
            results = double_factorial(args)
        for result in results:
            print result
    else:
        Exception('At least one integer is expected.')

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

def fact(n):
    if n == 0:
        return 1
    return n * fact(n - 2)


s = list(str(fact(n)))
print(s)
c = 0
i = len(s) - 1
while s[i] == "0":
    c += 1
    i -= 1
print(c)
Problem p02836 (python)

Fixed submission:
given = input()
a = len(given) // 2
count = 0
for i in range(1, a + 1):
    last = given[-i]
    first = given[i - 1]
    if last != first:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
cnt=0
for i in range(s.len()):
if(s[i]!=s[-1-i]):
cnt=cnt+1


print(cnt)
Problem p02851 (python)

Fixed submission:
from collections import defaultdict 
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    
    ans = 0
    ruiseki = [0]
    d = defaultdict(int)
    d[0]=1
    for i in range(n):
        if i - k + 1>= 0:
            d[ruiseki[i - k+1]]-=1
        ruiseki.append((ruiseki[i] + a[i] - 1)%k)
        ans += d[ruiseki[i+1]]
        d[ruiseki[i + 1]] += 1
    print(ans)
 
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
 
 
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    
    ans = 0
    ruiseki = [0]
    d = defaultdict(int)
    d[0]=1
    for i in range(n):
        if i - k + 1>= 0:
            d[ruiseki[i - k+1]]-=1
        ruiseki.append((ruiseki[i] + a[i] - 1)%k)
        ans += d[ruiseki[i+1]]
        d[ruiseki[i + 1]] += 1
    print(ans)
 
 
if __name__ == '__main__':
    main()
Problem p02860 (python)

Fixed submission:
N=int(input())
S=input()
if (N%2!=0):
    print('No')
else:
    a1=S[:int(N/2)]
    a2=S[int(N/2):]
    if (a1==a2):
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
if n%2==0:
  s1=s[:n/2]
  s2=s[n/2:]
  if s1==s2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
if (N%2!=0):
    print('No')
else:
    a1=S[:N/2]
    a2=S[N/2:]
    if (a1==a2):
        print('Yes')
    else:
        print('No')
Problem p02879 (python)

Fixed submission:
inp = input().split()

A = int(inp[0])
B = int(inp[1])

C=A*B
if A <= 9 and B <= 9:
	print(C)
else:
	print(-1)

Buggy submission (verdict: Runtime Error):
while True:
    try:
        a = int(input())
        b = int(input())
    except EOFError:
        break
    if a <= 9 and b <= 9:
        print(a * b)
    else:
        print(-1)

Buggy submission (verdict: Runtime Error):
a=variable
b=variable_2
a=9
b=9
if a*b=81 then;
	print("81")
else;
	print(-1)