Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
submit = []
for i in range(m):
    p, s = map(str, input().split())
    p = int(p)
    submit.append([p, s])

ACed = set()
for p, s in submit:
    if p in ACed:
        continue
    else:
        if s == "AC":
            ACed.add(p)

A = len(ACed)
P = 0

for i in range(1, n+1):
    if i in ACed:
        count = 0
        for p, s in submit:
            if p == i and s == "WA":
                count += 1
            elif p != i:
                continue
            else:
                break
        P += count

print(A, P)

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

tasks = []
for i in range(n):
    tasks.append([0, 0])

A = 0
P = 0

for i in range(m):
    p, s = map(str, input().split())
    p = int(p)

    if tasks[p-1][0] == 0:
        if s == "AC":
            A += 1
            tasks[p-1][0] = 1
            P += tasks[p-1][1]
        else:
            tasks[p-1][1] += 1
    else:
        continue

print(A, P)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
for i in range(k):
    if a > 0:
        a -= 1
    elif b > 0:
        b -= 1
    else:
        break

print(a, b)

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

if a <= k:
    k -= a
    a = 0
    if b <= k:
        b = 0
        print(a, b)
    else:
        b -= k
        print(a, b)
else:
    a -= k
    print(a, b)
Buggy python submission (verdict: Runtime Error):
from math import gcd

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

print(n * m // gcd(n, m))



Fixed submission:
import fractions

a, b = map(int, input().split())
c = fractions.gcd(a, b)


print(a * b // c)
Buggy python submission (verdict: Runtime Error):
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

if (mi != m2):
    print("1")
else:
    print("0")

Fixed submission:
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

if (m1 != m2):
    print("1")
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
s = input()
if s == 'MAN':
    print(6)
if s == 'TUE':
    print(5)
if s == 'WED':
    print(4)
if s == 'THU':
    print(3）
if s == 'FRI':
    print(2)
if s == 'SAT':
    print(1)
if s == 'SUN':
    print(7)

Fixed submission:
s = input()
if s == 'MON':
    print(6)
if s == 'TUE':
    print(5)
if s == 'WED':
    print(4)
if s == 'THU':
    print(3)
if s == 'FRI':
    print(2)
if s == 'SAT':
    print(1)
if s == 'SUN':
    print(7)
Buggy python submission (verdict: Runtime Error):
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split())))

import math
lsum = 0
for i in range(n):
    for j in range(n):
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum /(n)

Fixed submission:
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split())))

import math
lsum = 0
for i in range(n):
    for j in range(n):
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum /(n))

Buggy python submission (verdict: Runtime Error):
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split())))

import math
lsum = 0
for i in range(n):
    for j in range(n):
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum /(2 * n)

Fixed submission:
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split())))

import math
lsum = 0
for i in range(n):
    for j in range(n):
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum /(n))

Buggy python submission (verdict: Runtime Error):
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split(()))))

import math
lsum = 0
for i in range(n):
    for j in range(n): 
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum / 4 * math.factorial(n) * 2 / 3)

Fixed submission:
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split())))

import math
lsum = 0
for i in range(n):
    for j in range(n):
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum /(n))
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n % 2 == 1:
    print((int(n - 1) / 2))
else:
    printint((n / 2 - 1))
    

Fixed submission:
n = int(input())
if n % 2 == 1:
    print(int((n - 1) / 2))
else:
    print(int(n / 2 - 1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
f = [i for i in range(1, n+1)]

for i in f:
    print(a.index(i)+1, end=' ')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
z = list(range(1, n+1))
az = list(zip(a, z))
az.sort()
for i in az:
    print(i[1], end=' ')
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
a_factorization = set()
b_factorization = set()

while a != 1:
    for i in range(2, a+1):
        if a % i == 0:
            a //= i
            a_factorization.add(i)

while b != 1:
    for i in range(2, b+1):
        if b % i == 0:
            b //= i
            b_factorization.add(i)

a_factorization &= b_factorization
ans = len(a_factorization) + 1
print(ans)

Fixed submission:

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a, b = map(int, input().split())

s1 = set(prime_factorize(a))
s2 = set(prime_factorize(b))

ans = len(s1 & s2) + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = int(input())
if a >= 3200:
    print(s)
else:
    print('red')

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ss = [[""]]*n
for i in range(n):
    s = list(input())
    s.sort()
    ss[i] = s

ss.sort()

ans = 0
while len(ss) != 0:
    f = ss.pop(0)
    c = 1
    while len(ss) > 0:
        d = ss[0]
        if f == d:
            ss.pop(0)
            ans += c
            c += 1
        else:
            break

print(ans)

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
ss = [[""]]*n
for i in range(n):
    s = list(input())
    s.sort()
    ss[i] = s

ss.sort()

ans = 0
while len(ss) != 0:
    f = ss.pop(0)
    c = 1
    while len(ss) > 0:
        d = ss[0]
        if f == d:
            ss.pop(0)
            ans += c
            c += 1
        else:
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ss = [[""]]*n
for i in range(n):
    s = list(input())
    s.sort()
    ss[i] = s

def annagram(s1, s2):
    for i in range(10):
        if s1[i] != s2[i]:
            return False
    return True


ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        if annagram(ss[i], ss[j]):
            ans += 1

print(ans)

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
ss = [[""]]*n
for i in range(n):
    s = list(input())
    s.sort()
    ss[i] = s

ss.sort()

ans = 0
while len(ss) != 0:
    f = ss.pop(0)
    c = 1
    while len(ss) > 0:
        d = ss[0]
        if f == d:
            ss.pop(0)
            ans += c
            c += 1
        else:
            break

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ss = [[""]]*n
for i in range(n):
    s = list(input())
    s.sort()
    ss[i] = s

def annagram(s1: str, s2: str) -> bool:
    for i in range(10):
        if s1[i] != s2[i]:
            return False
    return True


ans: int = 0
for i in range(n-1):
    for j in range(i+1, n):
        if annagram(ss[i], ss[j]):
            ans += 1

print(ans)

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
ss = [[""]]*n
for i in range(n):
    s = list(input())
    s.sort()
    ss[i] = s

ss.sort()

ans = 0
while len(ss) != 0:
    f = ss.pop(0)
    c = 1
    while len(ss) > 0:
        d = ss[0]
        if f == d:
            ss.pop(0)
            ans += c
            c += 1
        else:
            break

print(ans)
Buggy python submission (verdict: Runtime Error):
(n, l) = map(int, input().split())
d = [l + i for i in range(n)]
c = [abs(i) for i in d.copy()]
nearest0 = c.index(min(c))
d.remove(d[nearest0])
ans = sum(d)
print(ans)

Fixed submission:
(n, l) = map(int, input().split())
d = [l + i for i in range(n)]
c = [abs(i) for i in d.copy()]
nearest0 = c.index(min(c))
d.remove(d[nearest0])
ans = sum(d)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int,input().split( ))
if a >= 13:
    b = b
elif 6 <= a <= 12:
    int(b = b / 2)
else:
   b = 0
print(b)

Fixed submission:
a, b = map(int,input().split( ))
if a >= 13:
    b = b
elif 6 <= a <= 12:
    b = b / 2
else:
   b = 0
print(int(b))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
coin = 0
coin += max(a, b)
max(a, b) -= 1
coin += max(a, b)
print(coin)

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

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
coin = 0
coin += max(a, b)
max(a, b) -= 1
coin = max(a, b)
print(coin)

Fixed submission:
(a, b) = map(int, input().split())
buttons = [a, b]
ans = 0
for i in range(2):
    if a >= b:
        ans += a
        a -= 1
    else:
        ans += b
        b -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()

acgt = ['A', 'C', 'G', 'T']


ans = []
count = 0
for i in range(len(s)):
    for j in s[i:]:
        if j in acgt:
            count += 1
        else:
            ans.append(count)
            count = 0
            break
            
print(max(ans))

Fixed submission:
s = input()
acgt = ['A', 'C', 'G', 'T']

ans = [0]
count = 0

for i in s:
    if i in acgt:
        count += 1
    else:
        ans.append(count)
        count = 0
ans.append(count)

print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
lr = [0] * q
for i in range(q):
    lr[i] = list(map(int, input().split()))

for i in lr:
    si = s[i[0]-1:i[1]]
    count = 0
    for j in range(len(si)-1):
        if si[j] == 'A' and si[j+1] == 'C':
            count += 1
    print(count)



Fixed submission:
n, q = map(int, input().split())
s = input()
lr = [0] * q

def inp(l: list) -> list:
    return [int(l[0]) - 1, int(l[1]) - 1]

for i in range(q):
    lr[i] = tuple(inp(input().split()))

count = [0]*n
for i in range(1, n):
    if s[i-1] == 'A' and s[i] == 'C':
        count[i] = count[i-1] + 1
    else:
        count[i] = count[i-1]

# print(count)

for l, r in lr:
    print(count[r] - count[l])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
lr = [0] * q
for i in range(q):
    lr[i] = list(map(int, input().split()))

for i in lr:
    si = s[i[0]-1:i[1]]
    count = 0
    for j in range(len(si)-1):
        if si[j] == 'A' and si[j+1] == 'C':
            count += 1
    print(count)



Fixed submission:
n, q = map(int, input().split())
s = input()
lr = [0] * q

def inp(l: list) -> list:
    return [int(l[0]) - 1, int(l[1]) - 1]

for i in range(q):
    lr[i] = tuple(inp(input().split()))

count = [0]*n
for i in range(1, n):
    if s[i-1] == 'A' and s[i] == 'C':
        count[i] = count[i-1] + 1
    else:
        count[i] = count[i-1]

# print(count)

for l, r in lr:
    print(count[r] - count[l])
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

common_factors = []
for i in range(1, a):
    if a % i == 0 and b % i == 0:
        common_factors.append(i)
print(common_factors[-k])


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

common_factors = []
for i in range(1, a+1):
    if a % i == 0 and b % i == 0:
        common_factors.append(i)
print(common_factors[-k])
Buggy python submission (verdict: Runtime Error):
s = map(int,input().split("/"))
if s[1] < 5:
    print('Heisei')
else:
    print('TBD')

Fixed submission:
s = list(map(int,input().split("/")))
if s[1] < 5:
    print('Heisei')
else:
    print('TBD')
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x = (3 or 5 or 7):
    print("YES")
else:
    print("NO")


Fixed submission:
x = int(input())
if x == 3 or x == 5 or x == 7:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
import math

n, x = map(int, input().split())
x = list(map(int, input().split()))
m = min(x)
xr = [e - m for e in x]
if n == 1:
    gcd = xr[0]
    print(gcd)
    exit()
gcd = math.gcd(xr[0], xr[1])
for i in xr[2:]:
    gcd = math.gcd(gcd, i)
print(gcd)

Fixed submission:
import fractions

n, s = map(int, input().split())
x = list(map(int, input().split()))
x.append(s)
m = min(x)
xr = [e - m for e in x]
ans = xr[0]
for i in range(1, n+1):
    ans = fractions.gcd(ans, xr[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
n = 0
for o in s:
    if o == '+':
        ans += 1
    else:
        ans -= 1
print(ans)

Fixed submission:
s = input()
p = s.count("+")
print(2 * p - 4)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = sum([i for i in str(n)])

if n % s == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())
s = sum([int(i) for i in str(n)])

if n % s == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
l = []
for i in range(2, n-1):
    head = set(s[:i])
    back = set(s[i:])
    l.append(len(head & back))
ans = max(l)
print(ans)


Fixed submission:
n = int(input())
s = input()
l = [0]
for i in range(2, n-1):
    head = set(s[:i])
    back = set(s[i:])
    l.append(len(head & back))
ans = max(l)
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
l = []
for i in range(2, n-1):
    head = set(s[:i])
    back = set(s[i:])
    l.append(len(head & back))
ans = max(l)
print(ans)


Fixed submission:
n = int(input())
s = input()
l = [0]
for i in range(2, n-1):
    head = set(s[:i])
    back = set(s[i:])
    l.append(len(head & back))
ans = max(l)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())

sum = (a + b + c) * (2 ** k)

ans = b - a if k % 2 == 1 else a - b

print(ans if ans <= 10**18 else "Unfair")


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

ans = b - a if k % 2 == 1 else a - b

print(ans if ans <= 10**18 else "Unfair")
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
ans = min(a, b) + min(c, d)
print(ans)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print((a if a <= b else b) + (c if c <= d else d))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = sum(a[1:2*(n+1):2])
print(ans)


Fixed submission:
x = int(input())
x += 1

ans = 9 * (len(str(x))-1) + int(str(x)[0])-1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = sum(a[1:2*n+1:2])
print(ans)


Fixed submission:
x = int(input())
x += 1

ans = 9 * (len(str(x))-1) + int(str(x)[0])-1
print(ans)
Buggy python submission (verdict: Runtime Error):
fn main() {
    let v: Vec<i32> = read_vec();
    if v[0] == v[1] {
        println!("{}", v[2]);
    } else if v[1] == v[2] {
        println!("{}", v[0]);
    } else {
        println!("{}", v[1]);
    }
}

// ######################################################################## //

// 標準入力から一行を読み取り、指定の型に変換する関数
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

// 10進数での各桁の和
pub fn sum_dights(x: isize) -> isize {
    if x % 10 == 0 {
        return 0;
    }
    let m = x % 10;
    m + sum_dights((x - m) / 10)
}


Fixed submission:
a, b, c = map(int, input().split())
if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)
Buggy python submission (verdict: Runtime Error):
n = int(input())

print('ABC' + n)

Fixed submission:
n = str(input())

print('ABC' + n)

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

print('ABC' + N)

Fixed submission:
n = str(input())

print('ABC' + n)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
power = 1
for i in range(1, n+1):
    power *= i

ans = power % 1000000007
print(ans)

Fixed submission:
n = int(input())
power = 1
for i in range(1, n+1):
    power *= i
    power %= 1000000007

print(power)
Buggy python submission (verdict: Runtime Error):
s = set(map(int, input().split()))
print(len(set))

Fixed submission:
s = set(map(int, input().split()))
n = len(list(s))
print(n)

Buggy python submission (verdict: Runtime Error):
int(input(a, b, c))
set(pennki) = (a, b, c)
len(set(pennki))

Fixed submission:
s = set(map(int, input().split()))
n = len(list(s))
print(n)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

like = {}
ans = 0

for i, r in enumerate(a):
    like[i] = r
    if like.get(r, default=0) == i:
        ans += 1

print(ans)


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

like = {}
ans = 0

for i, r in enumerate(a):
    like[i+1] = r
    if r in like and like[r] == i+1:
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):

use std::io::stdin;
use std::collections::BTreeMap;

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).ok();
    let n: usize = buf.trim().parse().ok().unwrap();

    let mut buf = String::new();
    stdin().read_line(&mut buf).ok();
    let a =  buf.split_whitespace().map(|x| x.parse().ok().unwrap()).collect::<Vec<usize>>();

    let mut like = BTreeMap::new();

    let mut ans = 0usize;

    for (i, t) in a.iter().enumerate() {
        let handle = like.entry(i+1).or_insert(0);
        *handle = *t;
        if like.get(t) == Some(&(i+1)) {
            ans += 1;
        }
    }

    println!("{}", ans);
}



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

like = {}
ans = 0

for i, r in enumerate(a):
    like[i+1] = r
    if r in like and like[r] == i+1:
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list_A = list(map(int, input().split()))

threshold = 1000000007
ans = 0
for i in range(N-1):
    count = 0
    for j in range(i+1, N):
        count += list_A[j]
    count = count % threshold
    ans += (list_A[i] * count % threshold)
ans = ans % threshold
print(ans)

Fixed submission:
N = int(input())
list_A = list(map(int, input().split()))

threshold = 1000000007
tmp = sum(list_A[1:])
ans = 0
for i in range(N-1):
    if i == 0:
        ans += list_A[i] * tmp % threshold
    else:
        tmp = tmp - list_A[i]
        ans += (list_A[i] * tmp % threshold)
ans = ans % threshold
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list_A = list(map(int, input().split()))

threshold = 1000000007
ans = 0
for i in range(N-1):
    count = 0
    for j in range(i+1, N):
        count += list_A[j]
    ans += (list_A[i] * count % threshold)
ans = ans % threshold
print(ans)

Fixed submission:
N = int(input())
list_A = list(map(int, input().split()))

threshold = 1000000007
tmp = sum(list_A[1:])
ans = 0
for i in range(N-1):
    if i == 0:
        ans += list_A[i] * tmp % threshold
    else:
        tmp = tmp - list_A[i]
        ans += (list_A[i] * tmp % threshold)
ans = ans % threshold
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list_A = list(map(int, input().split()))

threshold = 1000000007

ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        ans += (list_A[i] * list_A[j] % threshold)
ans = ans % threshold
print(ans)

Fixed submission:
N = int(input())
list_A = list(map(int, input().split()))

threshold = 1000000007
tmp = sum(list_A[1:])
ans = 0
for i in range(N-1):
    if i == 0:
        ans += list_A[i] * tmp % threshold
    else:
        tmp = tmp - list_A[i]
        ans += (list_A[i] * tmp % threshold)
ans = ans % threshold
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list_A = list(map(int, input().split()))

ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        ans += list_A[i] * list_A[j]
ans = ans % 1000000007
print(ans)

Fixed submission:
N = int(input())
list_A = list(map(int, input().split()))

threshold = 1000000007
tmp = sum(list_A[1:])
ans = 0
for i in range(N-1):
    if i == 0:
        ans += list_A[i] * tmp % threshold
    else:
        tmp = tmp - list_A[i]
        ans += (list_A[i] * tmp % threshold)
ans = ans % threshold
print(ans)
Buggy python submission (verdict: Runtime Error):
num = 0

for i in range(len(N)):
    num += int(N[i])
if num % 9 == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
N = input()
num = 0

for i in range(len(N)):
    num += int(N[i])
if num % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
num = 0

while(N != 0):
    num += N % 10
    N = N // 10
if num % 9 == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
N = input()
num = 0

for i in range(len(N)):
    num += int(N[i])
if num % 9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
list_A = list(map(int, input().split()))
results = []
for i in range(N - K + 1):
    result = 1
    for j in range(K):
        result *= list_A[j + i]
    results.append(result)

for i in range(N - K):
    if results[i] < results[i + 1]:
        print("Yes")
    else:
        print("No")

Fixed submission:
N, K = map(int, input().split())
list_A = list(map(int, input().split()))

for i in range(N - K):
    if list_A[i] < list_A[i + K]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())

counts = [0] * 10001
for i in range(1, 311):
    for j in range(1, i + 1):
        for k in range(1, j + 1):
            result = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if result > 10000:
                continue
            if i == j and j == k:
                counts[result] += 1
            elif i == j or j == k:
                counts[result] += 3
            else:
                counts[result] += 6

for n in range(1, N + 1):
    print(counts[n])

Fixed submission:
L, R, d = map(int, input().split())

a = L // d
b = R // d
ans = b - a

if (L % d == 0) and (R % d == 0):
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n  = int(input())
print(a+a*a+a*a*a)

Fixed submission:
a = int(input())
print(a+a*a+a*a*a)
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n%2:
  print(int(n/2)+1)
else:
  print(int(n/2)

Fixed submission:
n=int(input())
if n%2:
	print(int(n/2)+1)
else:	
	print(int(n/2))