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

Fixed submission:
if __name__ == '__main__':

    n,k = map(int,input().split())
    A = [0]
    AA= list(map(int,input().split()))
    A = A + AA

    B = set()
    cnt = 0
    ind = 1
    startind = 0
    D = []
    while True:
        if A[ind] not in B:
            B.add(ind)
            D.append(ind)
            cnt += 1
            ind = A[ind]
        else:
            B.add(ind)
            D.append(ind)
            cnt += 1
            startind = A[ind]
            break

    C = set()
    ind = startind
    ANS = []
    while True:
        if A[ind] not in C:
            C.add(ind)
            ind = A[ind]
            ANS.append(ind)
        else:
            C.add(ind)
            ANS.append(A[ind])
            break

    if k >= cnt:
        tmp = k - cnt
        tmp = tmp % (len(C))
        print(ANS[tmp-1])
    else:
        print(D[k])

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':

    n,k = map(int,input().split())
    A = [0]
    AA= list(map(int,input().split()))
    A = A + AA

    B = set()
    cnt = 0
    ind = 1
    startind = 0
    D = []
    while True:
        if A[ind] not in B:
            B.add(ind)
            D.append(ind)
            cnt += 1
            ind = A[ind]
        else:
            B.add(ind)
            D.append(ind)
            cnt += 1
            startind = A[ind]
            break

    C = set()
    ind = startind
    ANS = []
    while True:
        if A[ind] not in C:
            C.add(ind)
            ind = A[ind]
            ANS.append(ind)
        else:
            C.add(ind)
            ANS.append(A[ind])
            break

    if k > cnt:
        tmp = k - cnt
        tmp = tmp % (len(C))
        print(ANS[tmp-1])
    else:
        print(D[k])
Problem p02732 (python)

Fixed submission:
from collections import Counter

if __name__ == '__main__':

    n = int(input())
    A = list(map(int,input().split()))

    #全体の数
    d = Counter(A)
    
    d2 = dict()
    #この時の組み合わせの合計
    for k,v in d.items():
        d2[k] = (v*(v-1)) // 2
    ans_sum = sum(d2.values())

    #結果表示
    for i in A:
        ans = 0
        if i in d2:
            #あるならば
            tmp = d[i] - 1
            before= d2[i]
            after = (tmp*(tmp-1)) //2
            ans = ans_sum - (before-after)
            print(ans)
        else:
            #ないならば
            print(ans_sum)

Buggy submission (verdict: Runtime Error):

if __name__ == '__main__':

    n = int(input())
    A = list(map(int,input().split()))

    #全体の数
    d = Counter(A)
    
    d2 = dict()
    #この時の組み合わせの合計
    for k,v in d.items():
        d2[k] = (v*(v-1)) // 2
    ans_sum = sum(d2.values())

    #結果表示
    for i in A:
        ans = 0
        if i in d2:
            #あるならば
            tmp = d[i] - 1
            before= d2[i]
            after = (tmp*(tmp-1)) //2
            ans = ans_sum - (before-after)
            print(ans)
        else:
            #ないならば
            print(ans_sum)
Problem p02761 (python)

Fixed submission:
if __name__ == '__main__':

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

	A = [-1 for _ in range(n)]
	B = []
	for i in range(m):
		x,y = map(int,input().split())
		B.append([x,y])

	flg = True
	
	for a in B:
		x = a[0]
		y = a[1]

		if A[x-1] == -1:
			A[x-1] = y
		else:
			if A[x-1] != y:
				flg = False
				break

	ans = 0
	if flg:
		#穴埋め
		for i,j in enumerate(A):
			if j == -1:
				if i == 0 and len(A) != 1:
					A[i] = 1
				else:
					A[i] = 0

		tmp = ""
		for k in range(n):
			tmp += str(A[k])
		tmp = str(int(tmp))
		if len(tmp) == n :
			ans = int(tmp)
		else:
			ans = -1
	else:
		ans = -1

	print(ans)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':

	n,m = map(int,input().split())
	
	A = [0 for _ in range(m)]

	for i in range(m):
		s,c = map(int,input().split())
		if A[s-1] != 0:
			A[s-1] = min(A[s-1],c)
		else:
			A[s-1] = c
	
	ans = ""
	if A[0] == 0:
		print(-1)
	else:
		for j in range(m):
			ans += str(A[j])
		print(int(ans))
Problem p02813 (python)

Fixed submission:
import itertools

if __name__ == '__main__':

	n = int(input())

	A = tuple(map(int,input().split()))
	B = tuple(map(int,input().split()))

	C  = [i for i in range(1,n+1)]
	D = [v for v in itertools.permutations(C, n)]

	a = D.index(A)
	b = D.index(B)

	print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import itertools

if __name__ == '__main__':

	n = int(input())

	A = tuple(map(int,input().split()))
	B = tuple(map(int,input().split()))

    C  = [i for i in range(1,n+1)]
	D = [v for v in itertools.permutations(C, n)]

	a = D.index(A)
	b = D.index(B)

	print(abs(a-b))
Problem p03251 (python)

Fixed submission:
if __name__ == '__main__':
	n,m,X,Y = map(int,input().split())
	x = list(map(int,input().split()))
	y = list(map(int,input().split()))
 
	x_max = max(x)
	y_min = min(y)

	flg = False
	for Z in range(X+1,Y+1):
		if x_max < Z <= y_min:
			flg = True
			break

	if flg:
		print("No War")
	else:
		print("War")

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
	n,m,x,y = map(int,input().split())
	X = list(map(int,input().split()))
	Y = list(map(int,input().split()))
 
	x_max = max(X)
	y_min = min(Y)
 
 	flg = False
	for Z in range(x+1,y+1):
		if x_max < Z and Z <= y_min:
			flg = True
			break

	if flg :
		print("No war")
	else:
		print("War")

Buggy submission (verdict: Runtime Error):

if __name__ == '__main__':
	n,m,x,y = map(int,input().split())
	X = list(map(int,input().split()))
	Y = list(map(int,input().split()))

	x_max = max(X)
	y_min = min(Y)

	for Z in range(x,y):
		if y_max < Z <= y_min:
			print("No war")
			break
	else:
		print("War")
Problem p03325 (python)

Fixed submission:
import sys

if __name__ == '__main__':
	input()
	A = list(map(int,sys.stdin.readline().split()))

	cnt = 0
	EVE = [i for i in A if i % 2 == 0]

	for j in EVE:
		while True:
			j = j // 2
			if j % 2 == 1:
				cnt += 1
				break
			cnt += 1

	print(cnt)

Buggy submission (verdict: Runtime Error):

if __name__ == '__main__':

	n = int(input())
	A = list(map(int,input().split()))

	cnt = 0
	ODD = []
	EVE = []

	#奇数と偶数に分類
	for i in A:
		if i % 2 == 1:
			ODD.append(i)
		else:
			EVE.append(i)

	while True:

		#全部奇数なら終了
		if len(ODD) == n:
			print(cnt)
			break
		else:
			#奇数は全部３倍する
			for i in range(len(ODD)):
				ODD[i] = ODD[i] * 3

			#偶数はMAX値を２で割る
			#それ以外は３倍する
			chg = False
			mval = max(EVE)
			ind = EVE.index(mval)
			for j in range(len(EVE)):
				if j == ind:
					EVE[j] = int(EVE[j] / 2)
					if ( mval / 2 ) % 2 == 1:
						chg = True
				else:
					EVE[j] = EVE[j] * 3

			#２で割った値が奇数になったらODDに移動
			if chg == True:
				ODD.append(EVE.pop(ind))

			cnt += 1
Problem p02715 (python)

Fixed submission:
n,k=[int(x) for x in input().split()]
ans=0
l=[0]*(k+1)
i=k
mod=1000000007
while i>0:
    l[i]=pow(k//i,n,mod)
    j=2*i
    while j<=k:
        l[i]=(l[i]-l[j]+mod)%mod
        j+=i
    i-=1
for i in range(1,k+1):
    ans+=(l[i]*i)%mod
print(ans%mod)

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

typedef long long ll;
#define endl "\n"
#define deb(x) cerr << #x << ":" << x << "\n"

ll n,k,mod=1e9+7,ans=0;

ll fastMod(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b&1)res=(res*a)%mod;
        b/=2;
        a=(a*a)%mod;
    }
    return res;
}

void solve(){    
    cin>>n>>k;
    vector<ll> v(k+1);
    for(int i=k;i>0;i--){
        v[i]=fastMod(k/i,n);
        for(int j=2*i;j<=k;j+=i){
            v[i]=(v[i]-v[j]+mod)%mod;
        }
    }
    for(int i=1;i<=k;i++){
        ll val=(v[i]*i)%mod;
        ans=(ans+val)%mod;
    }
    cout<<ans%mod;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem p02730 (python)

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

if N == 3:
    if S[0] == S[2]:
        print('Yes')
    else:
        print('No')
    exit()

def is_circular(string):
    reverse = string[::-1]
    if string == reverse:
        return True
    else:
        return False

if is_circular(S) and is_circular(S[:(N)//2]) and is_circular(S[(N+3)//2]):
    print('Yes')
else:
    print('No')

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

def is_circular(string):
    reverse = string[::-1]
    if string == reverse:
        return True
    else:
        return False

if is_circular(S) and is_circular(S[:(N)//2]) and is_circular(S[(N+3)//2]):
    print('Yes')
else:
    print('No')
Problem p02898 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
list = list(map(int, input().split()))
ans = 0
for n_i in range(0, n):
    if list[n_i] >= k:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, k, *h = map(int,open(0).read().split());
print(sum(h>=k for h_i in h))

Buggy submission (verdict: Runtime Error):
n, k, *h = map(int,open(0).read().split())
print(sum(h>=k for h_i in h))
Problem p04001 (python)

Fixed submission:
def add_or_do_nothing(s, i, pos):
    if i == len(s):
        pre_i = 0
        ans = 0
        for i, pos_i in enumerate(pos, 1):
            if pos_i == '1':
                ans += int(s[pre_i:i])
                pre_i = i

        ans += int(s[pre_i:len(s)])
        return ans

    f_ans = add_or_do_nothing(s, i+1, pos+'0')
    s_ans = add_or_do_nothing(s, i+1, pos+'1')
    return f_ans + s_ans

s = input()

pos = ''
ans = add_or_do_nothing(s, 1, pos)

print(ans)

Buggy submission (verdict: Runtime Error):
def add_or_do_nothing(s, i, pos):
    if i == len(s):
        pre_i = 0
        ans = 0
        for pos_i in pos:
            print(s[pre_i:pos_i], pre_i, pos_i)
            ans += int(s[pre_i:pos_i])
            pre_i = pos_i
        
        if pre_i == 0:
            ans = int(s)
        else:
            ans += int(s[pre_i:len(s)] if pre_i != len(s) else '0')
        return ans

    f_ans = add_or_do_nothing(s, i+1, pos)
    
    pos.append(i)
    s_ans = add_or_do_nothing(s, i+1, pos)
    
    return f_ans + s_ans

s = input()

pos = []
ans = add_or_do_nothing(s, 1, pos)

print(ans)
Problem p02708 (python)

Fixed submission:
n,k = (int(x) for x in input().split())
res = 0
for i in range(k,n+2):
    base = n*i -(i*(i-1)) +1
    res = res+ base
resu = res%1000000007
print(resu)

Buggy submission (verdict: Runtime Error):
n,k = (int(x) for x in input().split())
for i in range(k,n+2):
    base = n*i -(i*(i-1)) +1
#    print(base)
    res = res+ base

resu = res%1000000007

print(resu)
Problem p03112 (python)

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

s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]

import bisect

for i in range(q):
    s2 = 10**12
    t2 = 10**12
    qq = int(input())
    sp = bisect.bisect(s,qq)
    tp = bisect.bisect(t,qq)
    s1 = s[sp-1]
    if sp <a:
        s2 = s[sp]

    t1 = t[tp-1]
    if tp <b:
        t2 = t[tp]
    print(min(abs(qq-s1)+abs(s1-t1),abs(qq-s1)+abs(s1-t2),
              abs(qq-s2)+abs(s2-t1),abs(qq-s2)+abs(s2-t2),
              abs(qq-t1)+abs(t1-s1),abs(qq-t1)+abs(t1-s2),
              abs(qq-t2)+abs(t2-s1),abs(qq-t2)+abs(t2-s2)))

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

s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]

import bisect

for i in range(q):
    qq = int(input())
    sp = bisect.bisect(s,qq)
    tp = bisect.bisect(t,qq)
    s1 = s[sp-1]
    if sp <a:
        s2 = s[sp]

    t1 = t[tp-1]
    if tp <b:
        t2 = t[tp]
    print(min(abs(qq-s1)+abs(s1-t1),abs(qq-s1)+abs(s1-t2),
              abs(qq-s2)+abs(s2-t1),abs(qq-s2)+abs(s2-t2),
              abs(qq-t1)+abs(t1-s1),abs(qq-t1)+abs(t1-s2),
              abs(qq-t2)+abs(t2-s1),abs(qq-t2)+abs(t2-s2)))
Problem p03138 (python)

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

dp = [n]*41

for i in range(n):
    i_bit = bin(al[i])[2:]
    lenb = len(i_bit)
    for j in range(lenb-1,-1,-1):
        dp[lenb-1-j] -= int(i_bit[j])

temp = k
res = 0
m = n//2

for i in range(40,-1,-1):
    if dp[i] > m and 2**i <= temp:
        temp -= 2**i
        res += (2**i)*(dp[i]) 
    else:
        res += (2**i)*(n-dp[i])

print(res)

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

import math
keta = math.log(k,2)
keta_i = int(keta)+2

dp = [n]*(keta_i)

for i in range(n):
    i_bit = bin(al[i])[2:]
    lenb = len(i_bit)
    for j in range(lenb-1,-1,-1):
        dp[lenb-1-j] -= int(i_bit[j])

temp = k
res = 0
m = n//2

for i in range(keta_i-1,-1,-1):
    if dp[i] > m and 2**i <= k:
        temp -= 2**i
        res += (2**i)*(dp[i]) 
    else:
        res += (2**i)*(n-dp[i])

print(res)
Problem p03450 (python)

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

if m <=1:
    print("Yes")
    exit()

from collections import defaultdict
V = defaultdict(list)
 
for _ in range(m):
    a, b,c = map(int, input().split())
    V[a].append([b,c])
    V[b].append([a,-c])

inf  = float("inf") 
dist = [inf]*(n+1)

def dfs(source):
    dist[source] = 0
    q = [source]
    while q:
        a = q.pop()
        for b in V[a]:
            if dist[b[0]]!=inf:
                if dist[b[0]] != dist[a] +b[1]:
                    print("No")
                    exit()
            else:
                dist[b[0]] = dist[a] + b[1]
                q.append(b[0])

for i in range(n):
    if dist[i] ==inf:
        dfs(i)

print("Yes")

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

from collections import defaultdict
V = defaultdict(list)
 
for _ in range(m):
    a, b,c = map(int, input().split())
    V[a].append([b,c])
    V[b].append([a,-c])

inf  = float("inf") 

def dfs(source):
    dist = [inf]*(n+1)
    dist[source] = 0
    q = [source]
    while q:
        a = q.pop()
        for b in V[a]:
            if dist[b[0]]!=inf:
                if dist[b[0]] != dist[a] +b[1]:
                    print("No")
                    exit()
            else:
                dist[b[0]] = dist[a] + b[1]
                q.append(b[0])
    return dist

dfs(min(V))

print("Yes")
Problem p03479 (python)

Fixed submission:
x,y = map(int, input().split())

z = y//x 

temp = 1
for i in range(10000):
    temp *= 2
    if z < temp:
        print(i+1)
        exit()

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

res = 0

for i in range(1,n+1):
    x5 = i//10000
    x4 = (i-x5*10000)//1000
    x3 = (i-x5*10000-x4*1000)//100
    x2 = (i-x5*10000-x4*1000-x3*100)//10
    x1 = i % 10
    
    xx = x5+x4+x3+x2+x1
    if b >= xx >= a:
        res += i

print(res)
Problem p03480 (python)

Fixed submission:
s = input()

sl = list(s)
sl.append("2")

n = len(sl)
res=[]

temp =1
for i  in range(n-1):
    if sl[i+1] == sl[i]:
        temp +=1
    else:
        res.append(temp)
        temp = 1

resu = n-1
m = n-1

while len(res) >1:
    resu = min(resu,max(res[0],m-res[0]))
    x = res.pop(1)
    res[0]  = res[0]+x    
    
print(resu)

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

sl = list(s)
sl.append("2")

n = len(sl)
res=[]

temp =1
for i  in range(n-1):
    if sl[i+1] == sl[i]:
        temp +=1
    else:
        res.append(temp)
        temp = 1

resu = n-1

while len(res) >1:
    resu = min(resu,max(res[0],res[1:]))
    x = res.pop(1)
    res[0]  = res[0]+x    
"""
    if res[0] > sum(res[1:]):
        resu = min(resu,res[0])
        x = res.pop(1)
        res[0] = res[0]+x
    else:
        resu = min(resu,sum(res[1:]))
        x = res.pop(1)
        res[0] =res[0]+x
"""
print(resu)
Problem p03597 (python)

Fixed submission:
n = int(input())
k = int(input())

print(n*n -k)

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

print(a*a -b )
Problem p03609 (python)

Fixed submission:
x,t = map(int, input().split())

print(max(x-t,0))

Buggy submission (verdict: Runtime Error):
x,t = map(int, input().split())

print((max(x-t),0))
Problem p03632 (python)

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

print(max((min(b,d)-max(a,c)),0))

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

print(max((min(b,d)-max(a,c)),0))
Problem p03645 (python)

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

from collections import defaultdict 
V = defaultdict(list)

for _ in range(m):
    a,b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

from collections import deque

def bfs(u):
    queue = deque([u])
    d = [None] * (n+1) # uからの距離の初期化
    d[u] = 0 # 自分との距離は0
    while queue:
        v = queue.popleft()
        for i in V[v]:
            if d[i] is None:
                d[i] = d[v] + 1
                queue.append(i)
    return d

b1 = bfs(1)
if b1[n] ==2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

from collections import defaultdict 
V = defaultdict(list)

for _ in range(m):
    a,b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

def dfs(source):
    dist = [-1]*(n+1)
    dist[source] = 0
    q = [source]
    while q and cur <3:
        a = q.pop()
        for b in V[a]:
            if dist[b]!=-1:
                continue
            dist[b] = dist[a] + 1
            q.append(b)
        cur = dist[b]
    return dist

d1 = dfs(1)
if d1[n] ==2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

from collections import defaultdict 
V = defaultdict(list)

for _ in range(m):
    a,b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

def dfs(source):
    dist = [-1]*(n+1)
    dist[source] = 0
    q = [source]
    while q:
        a = q.pop()
        for b in V[a]:
            if dist[b]!=-1:
                continue
            dist[b] = dist[a] + 1
            q.append(b)
    return dist

d1 = dfs(1)
if dfs(n) <=2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Problem p03681 (python)

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

if abs(n-m) >1:
    print(0)
    exit()

p = 10**9+7
fact =[1,1]
for i in range(2, max(n,m) + 1):
    fact.append((fact[-1] * i) % p)
    
if n ==m:
    res = fact[n]*fact[m]*2

else:
    res = fact[n]*fact[m]

print(res%p)

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

if abs(n-m) >1:
    print(0)
    exit()

p = 10**9+7
fact =[1,1]
for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    
if n ==m:
    res = fact[n]*fact[m]*2

else:
    res = fact[n]*fact[m]

print(res%p)
Problem p03721 (python)

Fixed submission:
n,k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

abb = sorted(ab)
temp =0

for i in range(n+1):
    if temp < k:
        temp += abb[i][1]
    else:
        print(abb[i-1][0])
        exit()

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)] 

abb = ab.sort()

temp =0

for i in range(n):
    if temp < k:
        temp += abb[i][1]
    else:
        print(abb[i-1][0])
        exit()
Problem p03762 (python)

Fixed submission:
n,m = map(int, input().split())
xl = list(map(int, input().split())) 
yl = list(map(int, input().split())) 

xl = list(map(lambda x: x-xl[0],xl))
yl = list(map(lambda x: x-yl[0],yl))

xi=0
yi=0
mod = 10**9+7
xsum = sum(xl)
ysum = sum(yl)
for i in range(n):
    xi += (xsum - xl[i]*(n-i)) % mod
    xsum -= xl[i] 
    
for j in range(m):
    yi += (ysum - yl[j]*(m-j)) % mod
    ysum -= yl[j]

print(xi*yi % mod)

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

xsum = sum(xl)
ysum = sum(yl)
for i in range(n):
    xi += xsum - xl[i]*(n-i)
    xsum -= xl[i] 
    
for j in range(m):
    yi += ysum - yl[j]*(m-j)
    ysum -= yl[j]

print(xi*yi)

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

xsum = sum(xl)
ysum = sum(yl)
for i in range(n):
    xi += xsum - xl[i]*(n-i)
    xsum -= xl[i] 
    
for j in range(m):
    yi += ysum - yl[j]*(m-j)
    ysum -= yl[j]

print(xi*yi)
Problem p03797 (python)

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

if n*2 <= m:
    ma = m-n*2
    ans = n+(ma//4)
    
else:
    ans = m//2

print(ans)

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

if n*2 <= m:
    ma = m-n*2
    ans = n+(ma//4)
    
else:
    ans = ma//2

print(ans)
Problem p03828 (python)

Fixed submission:
n = int(input())
import math

nn = math.factorial(n)

if n ==1:
    print(1)
    
elif n ==2:
    print(2)
else:
    sosu =[2]  
   
    for i in range(3,n+1,2):
        judge = 0
        for j in range(2,i):
            if i % j == 0:
                judge = 1
        if judge ==0:
            sosu.append(i)
    
    slist =[0]*len(sosu)
    for k in range(0,len(sosu)):
        m = nn
        count = 0
        while m % sosu[k] ==0:
            m = m //sosu[k]
            count +=1
        slist[k] = count
    
    res = 1
    for l in range(0,len(slist)):
        res =res*(slist[l]+1) % 1000000007

    print(res)

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

nn = math.factorial(n)

if n ==1:
    print("1")

elif n ==2:
    print("2")
else:
    sosu =[2]  
   
    for i in range(3,n+1,2):
        judge = 0
        for j in range(2,i):
            if i % j == 0:
                judge = 1
        if judge ==0:
            sosu.append(i)
    
    slist =[0]*len(sosu)
    for k in range(0,len(sosu)):
        m = nn
        count = 0
        while m % sosu[k] ==0:
            m = m //sosu[k]
            count +=1
        slist[k] = count
    
    res = 1
    for l in range(0,len(slist)):
        res =res*(slist[l]+1) % 1000000007

print(res)

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

nn = math.factorial(n)

if n ==1:
    print(1)

elif n ==2:
    print(2)
else:
    sosu =[2]  
   
    for i in range(3,n+1,2):
        judge = 0
        for j in range(2,i):
            if i % j == 0:
                judge = 1
        if judge ==0:
            sosu.append(i)
    
    slist =[0]*len(sosu)
    for k in range(0,len(sosu)):
        m = nn
        count = 0
        while m % sosu[k] ==0:
            m = m //sosu[k]
            count +=1
        slist[k] = count
    
    res = 1
    for l in range(0,len(slist)):
        res =res*(slist[l]+1) % 1000000007

print(res)
Problem p03846 (python)

Fixed submission:
from collections import Counter

N= int(input())
Alist = list(map(int, input().split())) 

count = Counter(Alist)
res = 1
if N % 2 ==0:
    for i in range(1,N,2):
        if count[i] != 2:
            print(0)
            exit()
else:
    if count[0] != 1:
        print(0)
        exit()
    else:
        for i in range(2,N,2):
            if count[i] != 2:
                print(0)
                exit()
print(2**(N//2) % (10**9+7))

Buggy submission (verdict: Runtime Error):
from collections import Counter

N= int(input())
Alist = list(map(int, input().split())) 

count = Counter(Alist)
res = 1
if N % 2 ==0:
    for i in range(1,N,2):
        if count[i] != 2:
            print(0)
            exit()
else:
    if count[0] != 1:
        print(0)
        exit()
    else:
        for i in range(2,N,2):
            if count[i] != 2
                print(0)
                exit()
print(2**(N//2) % (10**9+7))
Problem p03861 (python)

Fixed submission:
a,b,x= map(int, input().split())
tx =0
xb = b//x
xa = a//x
if a % x ==0:
    tx = 1

print(int(xb-xa+tx))

Buggy submission (verdict: Runtime Error):
a,b,x= map(int, input().split())
xb = b//x
xa = a//x
if a % x ==0:
    tx = 1

print(int(xb-xa+tx))