Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
s = [input() for _ in range(h)]

d = ((-1, 0), (1, 0), (0, -1), (0, 1))
ans = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            continue
        c = 1
        for dy, dx in d:
            y, x = i, j
            while True:
                y += dy
                x += dx
                if not(0 <= y < h) or not(0 <= x < w):
                    break
                if s[y][x] == '#':
                    break
                c += 1
        ans = max(ans, c)
print(ans)

Fixed submission:
import numpy as np

h, w = map(int, input().split())
s = [input() for _ in range(h)]

t = np.zeros((h, w), dtype=np.int32)
for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            t[i][j] = 1

l = np.zeros((h, w), dtype=np.int32)
r = np.zeros((h, w), dtype=np.int32)
u = np.zeros((h, w), dtype=np.int32)
d = np.zeros((h, w), dtype=np.int32)

for i in range(w):
    if i == 0:
        l[:, i] = t[:, i]
    else:
        l[:, i] = (l[:, i-1] + 1) * t[:, i]

for i in range(w-1, -1, -1):
    if i == w-1:
        r[:, i] = t[:, i]
    else:
        r[:, i] = (r[:, i+1] + 1) * t[:, i]

for i in range(h):
    if i == 0:
        u[i] = t[i]
    else:
        u[i] = (u[i-1] + 1) * t[i]

for i in range(h-1, -1, -1):
    if i == h-1:
        d[i] = t[i]
    else:
        d[i] = (d[i+1] + 1) * t[i]

lrud = l+r+u+d-3
print(np.max(lrud))

Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
s = [input() for _ in range(h)]

d = ((-1, 0), (1, 0), (0, -1), (0, 1))
ans = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            continue
        c = 1
        for dy, dx in d:
            y, x = i, j
            while True:
                y += dy
                x += dx
                if not(0 <= y < h) or not(0 <= x < w):
                    break
                if s[y][x] == '#':
                    break
                c += 1
        ans = max(ans, c)
print(ans)

Fixed submission:
import numpy as np

h, w = map(int, input().split())
s = [input() for _ in range(h)]

t = np.zeros((h, w), dtype=np.int32)
for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            t[i][j] = 1

l = np.zeros((h, w), dtype=np.int32)
r = np.zeros((h, w), dtype=np.int32)
u = np.zeros((h, w), dtype=np.int32)
d = np.zeros((h, w), dtype=np.int32)

for i in range(w):
    if i == 0:
        l[:, i] = t[:, i]
    else:
        l[:, i] = (l[:, i-1] + 1) * t[:, i]

for i in range(w-1, -1, -1):
    if i == w-1:
        r[:, i] = t[:, i]
    else:
        r[:, i] = (r[:, i+1] + 1) * t[:, i]

for i in range(h):
    if i == 0:
        u[i] = t[i]
    else:
        u[i] = (u[i-1] + 1) * t[i]

for i in range(h-1, -1, -1):
    if i == h-1:
        d[i] = t[i]
    else:
        d[i] = (d[i+1] + 1) * t[i]

lrud = l+r+u+d-3
print(np.max(lrud))
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
bc = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: x[1])

for b, c in bc:
    for i in range(b):
        d = heapq.heappop(a)
        if d < c:
            heapq.heappush(a, c)
        else:
            heapq.heappush(a, d)
            break
print(sum(a))

Fixed submission:
import numpy as np

n, m = map(int, input().split())
a = np.array(sorted(list(map(int, input().split()))), dtype=np.int64)
bc = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: -x[1])

p = 0
for b, c  in bc:
    a[p:p+b] = np.maximum(a[p:p+b], c)
    p += b
print(np.sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(1, n+1):
    a = itertools.combinations(range(n), i)
    for j in a:
        x, y = 0, 0
        for k in j:
            x += v[k]
            y += c[k]
        ans = max(ans, x-y)
print(ans)

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

vc = []
for i, j in zip(v, c):
    vc.append(i-j)
vc = sorted(vc, reverse=True)
ans = 0
for i in vc:
    if i <= 0:
        break
    ans += i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
s = input()

s = s[0] + s + str((int(s[-1])+1)%2)
a = []
l = 1
for i in range(1, n+2):
    if s[i] == s[i-1]:
        continue
    a.append(i-l)
    l = i
m = int(s[0])
ans = 0
for i in range(len(a)):
    ans = max(ans, sum(a[i:i+2*k+(m+i)%2]))
print(ans)

Fixed submission:
N, K = map(int, input().split())
S = input()
Nums = []
now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか
for i in range(N):
    if S[i] == str(now):
        cnt += 1
    else:
        Nums.append(cnt)
        now = 1 - now   # 0と1を切り替えるときの計算 now ^= 1
        cnt = 1
if cnt != 0:
    Nums.append(cnt)
# 1-0-1-0-1-0-1 って感じの配列が欲しい
# 1-0-1-0-1-0 みたいに0で終わっていたら適当に1つ足す
if len(Nums) % 2 == 0:
    Nums.append(0)

Add = 2 * K + 1
# 累積和を作る
# 0 1 2 3 4 5 6
#  0 1 2 3 4 5
sum = [0] * (len(Nums) + 1)
for i in range(len(Nums)):
    sum[i + 1] = sum[i] + Nums[i]
ans = 0
# 1-0-1... の1から始めるので、偶数番目だけ見る
for i in range(0, len(Nums), 2):
    # 次のleft, rightを計算する [left, right)
    left = i
    right = min(i + Add, len(Nums))
    tmp = sum[right] - sum[left]
    ans = max(tmp, ans)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
s = np.array([list(input()) for _ in range(n)])

ans = 0
for i in range(n):
    t = np.append(s[i:], s[:i], axis=0)
    for j in range(n):
        u = np.append(t[:, j:], t[:, :j], axis=1)
        if np.array_equal(u, u.T):
            ans += 1
print(ans)

Fixed submission:
import numpy as np
n = int(input())
S = [list(input()) for _ in range(n)]

ss = np.array(S + S)

ans = 0
for i in range(n):
    a = ss[i:i+n]
    if np.array_equal(a, a.T):
      ans += 1
print(ans * n)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

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

ans = [0]*n
d = Counter(a)
k = list(d.keys())[::-1]
for i in range(len(k)-1):
    ind = a.index(k[i])
    ans[ind] += d[k[i]]*(k[i]-k[i+1])
    d[k[i+1]] += d[k[i]]
ans[k[-1]-1] += n
for i in ans:
    print(i)

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

b = sorted([(i+1, a[i]) for i in range(n)], key=lambda x: -x[1])
ans = [0]*(n+1)
m = float('inf')
for i in range(n-1):
    m = min(m, b[i][0])
    if b[i][1] == b[i+1][1]:
        continue
    ans[m] += (i+1)*(b[i][1]-b[i+1][1])
ans[1] += sum(a) - sum(ans)
for i in range(1, n+1):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
#define MOD 1000000007
#define MAX_V 100010
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll junnretu(ll n){
    ll ans=1;
    for (ll i=1;i<=n;i++){
        ans*=i;
    }
    return ans;
}
 
map<ll,ll> prime_factor(ll n){
    map<ll,ll> mp;
    for(ll i=2; i*i<=n; i++){
        while(n % i == 0){
            mp[i]++;
            n /= i;
        }
    }
    if(n != 1) mp[n] = 1;
    return mp;
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll s;
    cin >> s;
    ll x[s];
    for (ll i=0;i<s;i++){
        cin >> x[i];
        for (ll j=0;j<=i;j++){
            if (x[i]==x[j]){
                cout << "NO" << endl;
                return 0;
            }
        }
    }
    cout << "YES" << endl;
    return 0;
}


Fixed submission:
import collections
a=input()
a=int(a)
b=input().split()
c = collections.Counter(b)
        
if (len(c)==a):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=[int(i) for i in input().split()]
ans=n
for i in range(1,n):
    for j in range(i):
        if (p[i]>p[j]):
            ans-=1
            break
        
print(ans)

Fixed submission:
n=int(input())
p=[int(i) for i in input().split()]
flag=p[0]
ans=1
for i in range(1,n):
    if (p[i]<flag):
        flag=p[i]
        ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=n
for i in range(1,n):
    for j in range(i):
        if (p[i]>p[j]):
            ans-=1
            break
print(ans)

Fixed submission:
n=int(input())
p=[int(i) for i in input().split()]
flag=p[0]
ans=1
for i in range(1,n):
    if (p[i]<flag):
        flag=p[i]
        ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=input()
n=int(n)
l=[]
for i in range(n):
    x=input()
    x=int(x)
    l.append(x)
ans=max(l)
for i in range(n):
    
    if l[i]==ans:
        del l[i]
        print(max(l))
        l.append(0)
        continue
    print(ans)
    


Fixed submission:
n=input()
n=int(n)
l=[]
for i in range(n):
    x=input()
    x=int(x)
    l.append(x)
ans=max(l)
x=l.index(ans)
del l[x]
sec=max(l)
for i in range(n):
    if i==x:
        print(sec)
        continue
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=input()
n=int(n)
l=[]
for i in range(n):
    x=input()
    x=int(x)
    l.append(x)
for i in range(n):
    x=l[0]
    del l[0]
    print(max(l))
    l.append(x)
    


Fixed submission:
n=input()
n=int(n)
l=[]
for i in range(n):
    x=input()
    x=int(x)
    l.append(x)
ans=max(l)
x=l.index(ans)
del l[x]
sec=max(l)
for i in range(n):
    if i==x:
        print(sec)
        continue
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b=input().split()
a=int(a)
b=int(b)
ll=[]
for i in range(b):
    c,d=input().split()
    c=int(c)
    d=int(d)
    for j in range(c,d+1):
        ll.append(j)
count=0
for i in range(1,a+1):
    k=ll.count(i)
    if k==b:
        count+=1
print(count)


Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
ll=[]
l2=[]
for i in range(b):
    c,d=input().split()
    c=int(c)
    d=int(d)
    ll.append(c)
    l2.append(d)
x=max(ll)
y=min(l2)
z=y-x
if z>=0:
    print(z+1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
ll=list()
for i in range(3):
    a=input()
    b=a.split()
    ll.append(int(b[0]),int(b[1]))
c1=ll.count(1)
c2=ll.count(2)
c3=ll.count(3)
c4=ll.count(4)
if c1>2 or c2>2 or c3>2 or c4>2:
    print("No")
else:
    print("Yes")

Fixed submission:
ll=list()
for i in range(3):
    a=input()
    b=a.split()
    ll.append(int(b[0]))
    ll.append(int(b[1]))
c1=ll.count(1)
c2=ll.count(2)
c3=ll.count(3)
c4=ll.count(4)
if c1>2 or c2>2 or c3>2 or c4>2:
    print("NO")
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=a.split()
n=int(c[0])
d=b.split()
d=[int(i) for i in d]
d.sort(reverse=True)
count=0
ll=list()
for i in d:
    if count!=0:
        ll.append(c-i)
    c=i
    count+=1
ll.sort()
for i in range(n-1):
    ccc=len(ll)
    if ccc>=1
        del ll[-1]
print(sum(ll))


Fixed submission:
a=input()
b=input()
c=a.split()
n=int(c[0])
d=b.split()
d=[int(i) for i in d]
d.sort(reverse=True)
count=0
ll=list()
for i in d:
    if count!=0:
        ll.append(c-i)
    c=i
    count+=1
ll.sort()
for i in range(n-1):
    ccc=len(ll)
    if ccc>=1:
        del ll[-1]
print(sum(ll))

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=a.split()
n=int(c[0])
d=b.split()
d=[int(i) for i in d]
d.sort(reverse=True)
count=0
ll=list()
for i in d:
    if count!=0:
        ll.append(c-i)
    c=i
    count+=1
ll.sort()
for i in range(n-1):
    del ll[-1]
print(sum(ll))


Fixed submission:
a=input()
b=input()
c=a.split()
n=int(c[0])
d=b.split()
d=[int(i) for i in d]
d.sort(reverse=True)
count=0
ll=list()
for i in d:
    if count!=0:
        ll.append(c-i)
    c=i
    count+=1
ll.sort()
for i in range(n-1):
    ccc=len(ll)
    if ccc>=1:
        del ll[-1]
print(sum(ll))

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=a.split()
n=int(b[0])
m=b[1]
d=b.split()
d=[int(i) for i in d]
d.sort(reverse=True)
count=0
c=0
ll=list()
for i in d:
    if count!=0:
        ll.append(c-i)
    c=i
    count+=1
ll.sort()
for i in range(n):
    del ll[-1]
print(sum(ll))
    


Fixed submission:
a=input()
b=input()
c=a.split()
n=int(c[0])
d=b.split()
d=[int(i) for i in d]
d.sort(reverse=True)
count=0
ll=list()
for i in d:
    if count!=0:
        ll.append(c-i)
    c=i
    count+=1
ll.sort()
for i in range(n-1):
    ccc=len(ll)
    if ccc>=1:
        del ll[-1]
print(sum(ll))
Buggy python submission (verdict: Runtime Error):
n=input()
a=input().split()
a=[int(i) for i in a]
a=a.sorted()
count=0
ans=0
for i in a:
  if count%2==0:
    ans+=i
  count+=1

Fixed submission:
n=input()
a=input().split()
a=[int(i) for i in a]
a.sort()
count=0
ans=0
for i in a:
  if count%2==0:
    ans+=i
  count+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout # only need for big input

MOD = int(1e9+7)

def pow_mod(a , p , m):
    if p < 2:
        ans = 1
        for _ in range(p):
            ans *= a
            if ans >= m:
                ans = ans % m
        return ans
    ans = pow_mod(a , p //2 , m)
    ans = ans * ans

    if ans >= m :
        ans = ans % m
    if p % 2 :
        ans = ans * a 
        if ans >= m :
            ans = ans % m 
    return ans

    

def solve():
    n = int(input())
    A = [int(inp) for inp in input().split()]
    count_1 = [0] * 61 
    pow_2 = [pow_mod(2, i, MOD) for i in range(61)]
    for a in A :
        x = a
        while x :
           for i in range(61):
               if x & 1 :
                   count_1[i] += 1
               x = x >> 1
    # print(count_1)
    # print(pow_2)
    sum = 0
    # print(len(pow_2))
    # print(len(count_1))
    # for a in A:
    #     x = a
    #     while x :
    #         for i in range(61):
    #             # print(i)
    #             if x & 1:
    #                 sum += pow_2[i] * (n - count_1[i])
    #             else:
    #                 sum += pow_2[i] * (count_1[i])

    #             if sum >= MOD:
    #                 sum = sum % MOD
    #             x = x >> 1 
    for i in range(61):
        sum += pow_2[i] * count_1[i] * ( n - count_1[i])
        if sum >= MOD:
            sum = sum % MOD
    # print(sum)
    #sum = (sum * pow_mod(2, MOD - 2, MOD) ) % MOD
    print(sum)


def main():
    solve()


if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin, stdout # only need for big input

MOD = int(1e9+7)

def pow_mod(a , p , m):
    if p < 2:
        ans = 1
        for _ in range(p):
            ans *= a
            if ans >= m:
                ans = ans % m
        return ans
    ans = pow_mod(a , p //2 , m)
    ans = ans * ans

    if ans >= m :
        ans = ans % m
    if p % 2 :
        ans = ans * a 
        if ans >= m :
            ans = ans % m 
    return ans

    

def solve():
    n = int(input())
    A = [int(inp) for inp in input().split()]
    count_1 = [0] * 61 
    pow_2 = [pow_mod(2, i, MOD) for i in range(61)]
    for a in A :
        x = a
        while x :
           for i in range(61):
               if x & 1 :
                   count_1[i] += 1
               x = x >> 1
    # print(count_1)
    # print(pow_2)
    sum = 0
    # print(len(pow_2))
    # print(len(count_1))
    # for a in A:
    #     x = a
    #     while x :
    #         for i in range(61):
    #             # print(i)
    #             if x & 1:
    #                 sum += pow_2[i] * (n - count_1[i])
    #             else:
    #                 sum += pow_2[i] * (count_1[i])

    #             if sum >= MOD:
    #                 sum = sum % MOD
    #             x = x >> 1 
    for i in range(61):
        sum += pow_2[i] * count_1[i] * ( n - count_1[i])
        if sum >= MOD:
            sum = sum % MOD
    # print(sum)
    #sum = (sum * pow_mod(2, MOD - 2, MOD) ) % MOD
    print(sum)


def main():
    solve()


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
h, w, m = map(int, input().split())
h_cnt = [0 for _ in range(h)]
w_cnt = [0 for _ in range(w)]
mat = [[0 for _ in range(w)] for _ in range(h)]
for _ in range(m):
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    h_cnt[y] += 1
    w_cnt[x] += 1
    mat[y][x] += 1
h_dict = {i:v for i, v in enumerate(h_cnt)}
w_dict = {i:v for i, v in enumerate(w_cnt)}
h_max = max(h_dict.values())
w_max = max(w_dict.values())
h_max_induce = [i for i in h_dict.keys() if h_dict[i] == h_max]
w_max_induce = [i for i in w_dict.keys() if w_dict[i] == w_max]

for h_idx in h_max_induce:
    for w_idx in w_max_induce:
        if mat[h_idx][w_idx] == 0:
            print(h_max+w_max)
            exit()

print(h_max+w_max-1)



Fixed submission:
h, w, m = map(int, input().split())
h_cnt = [0 for _ in range(h)]
w_cnt = [0 for _ in range(w)]
xs = []
ys = []
for _ in range(m):
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    h_cnt[y] += 1
    w_cnt[x] += 1
    xs.append(x)
    ys.append(y)
h_max = max(h_cnt)
w_max = max(w_cnt)
h_max_induce = {i: v for i, v in enumerate(h_cnt) if v == h_max}
w_max_induce = {i: v for i, v in enumerate(w_cnt) if v == w_max}

cnt = 0
for i in range(m):
    x = xs[i]
    y = ys[i]
    if x in w_max_induce and y in h_max_induce:
        cnt += 1
if cnt == len(h_max_induce.keys())*len(w_max_induce.keys()):
    print(h_max+w_max-1)
else:
    print(h_max+w_max)

Buggy python submission (verdict: Time Limit Exceeded):
h, w, m = map(int, input().split())
h_cnt = [0 for _ in range(h)]
w_cnt = [0 for _ in range(w)]
mat = [[0 for _ in range(w)] for _ in range(h)]
for _ in range(m):
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    h_cnt[y] += 1
    w_cnt[x] += 1
    mat[y][x] += 1
h_dict = {i:v for i, v in enumerate(h_cnt)}
w_dict = {i:v for i, v in enumerate(w_cnt)}
h_max = max(h_dict.values())
w_max = max(w_dict.values())
h_max_induce = [i for i in h_dict.keys() if h_dict[i] == h_max]
w_max_induce = [i for i in w_dict.keys() if w_dict[i] == w_max]

for h_idx in h_max_induce:
    for w_idx in w_max_induce:
        if mat[h_idx][w_idx] == 0:
            print(h_max+w_max)
            exit()

print(h_max+w_max-1)



Fixed submission:
h, w, m = map(int, input().split())
h_cnt = [0 for _ in range(h)]
w_cnt = [0 for _ in range(w)]
xs = []
ys = []
for _ in range(m):
    y, x = map(int, input().split())
    y -= 1
    x -= 1
    h_cnt[y] += 1
    w_cnt[x] += 1
    xs.append(x)
    ys.append(y)
h_max = max(h_cnt)
w_max = max(w_cnt)
h_max_induce = {i: v for i, v in enumerate(h_cnt) if v == h_max}
w_max_induce = {i: v for i, v in enumerate(w_cnt) if v == w_max}

cnt = 0
for i in range(m):
    x = xs[i]
    y = ys[i]
    if x in w_max_induce and y in h_max_induce:
        cnt += 1
if cnt == len(h_max_induce.keys())*len(w_max_induce.keys()):
    print(h_max+w_max-1)
else:
    print(h_max+w_max)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul

n, k = map(int, input().split())
a = list(map(int, input().split()))

p_score = reduce(mul, a[:k])
answers = []
for i in range(k, n):
    answers.append(a[i-k] < a[i])
for ans in answers:
    if ans:
        print("Yes")
    else:
        print("No")


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

answers = []
for i in range(k, n):
    answers.append(a[i-k] < a[i])
for ans in answers:
    if ans:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul

n, k = map(int, input().split())
a = list(map(int, input().split()))

p_score = reduce(mul, a[:k])
scores = [p_score]
for i in range(k, n):
    score = scores[-1]/a[i-k]*a[i]
    scores.append(score)
for i in range(1, len(scores)):
    if scores[i] > scores[i-1]:
        print("Yes")
    else:
        print("No")


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

answers = []
for i in range(k, n):
    answers.append(a[i-k] < a[i])
for ans in answers:
    if ans:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
MAX = 2*10**5
def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f
s_map = [0 for i in range(MAX+1)]
def solve(n):
    if n == 0:
        return 1
    if s_map[n] > 0:
        return s_map[n]
    s_map[n] = 1 + solve(n % popcount(n))
    return s_map[n]

N = int(input())
X = input()
num_x = int(X, 2)
p_cnt = X.count('1')
for i in range(N):
    c_p_cnt = p_cnt+1 if X[i] == '0' else p_cnt-1
    x = num_x + 2**(N-1-i) if X[i] == '0' else num_x - 2**(N-1-i)
    if x == 0:
        print(0)
    else:
        print(solve(x % c_p_cnt))



Fixed submission:
N = int(input())

ans = [0 for i in range(10**4+1)]
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            n = x*x + y*y + z*z + x*y + y*z + z*x
            if n <= 10**4:
                ans[n] += 1

for i in range(1, N+1):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
m = 10**18

res = reduce(lambda x,y: x*y, a)
res = 1
for n in a:
    res *= a
    if res > m:
        print(-1)
        exit()
    
print(res)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = 10**18
if 0 in a:
    print(0)
    exit()
res = 1
for i in a:
    res *= i
    if res > m:
        print(-1)
        exit()

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
m = 10**18

res = reduce(lambda x,y: x*y, a)
if res > m:
    print(-1)
else:
    print(res)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = 10**18
if 0 in a:
    print(0)
    exit()
res = 1
for i in a:
    res *= i
    if res > m:
        print(-1)
        exit()

print(res)