akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF = 1e9;
const long long INFL = 1LL<<60;

bool is_digit(char c) {
  char a = c - '0';

  if (0 <= a && a <= 9) {
    return true;
  } else {
    return false;
  }
}


int main() {
  int a, b;
  cin >> a >> b;
  string s;
  cin >> s;

  for (int i = 0; i < a; i++) {
    if (!is_digit(s[i])) {
      cout << "No" << endl;
      return 0;
    }
  }

  if (s[a] != '-') {
    cout << "No" << endl;
    return 0;
  }

  for (int i = a+1; i < s.size(); i++) {
    if (!is_digit(s[i])) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
 public static void main(String[] args) {
   Scanner scan = new Scanner(System.in);
   int n = scan.nextInt();
   int m = scan.nextInt();
   int l = scan.nextInt();

   int [][] a = new int [n][m];
   int [][] b = new int [m][l];
   long [][] c = new long [n][l];

   for (int i = 0 ; i < n ; i++ ) {
        for (int j = 0 ; j < m ; j++ ) {
          a[i][j] = scan.nextInt();
        }
   }
   for (int i = 0 ; i < m ; i++ ) {
        for (int j = 0 ; j < l ; j++ ) {
          b[i][j] = scan.nextInt();
        }
   }
   for (int i = 0 ; i < n ; i++ ) {
        for (int j = 0 ; j < l ; j++ ) {
          for (int k = 0; k < m ; k++ ) {
            c[i][j] += a[i][k] * b[k][j] ;
          }
     }
   }
   for (int i = 0 ; i < n ; i++ ) {
        for (int j = 0 ; j < l ; j++ ) {
          if (j != l-1) {
            System.out.print(c[i][j] + " ");
          }
          else{
            System.out.println(c[i][j]);
          }
        }

   }
   }
 }

Measured memory_bytes: 52624
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 111
#define MAX_K 30
int main()
{
	while(true){
		int N;
		int A[MAX_N];
		scanf("%d",&N);
		if(N==0){break;}
		for(int i=0;i<N;i++){
			string S;
			cin >> S;
			A[i]=S[0]-'A';
		}
		int cou[MAX_K];
		for(int i=0;i<26;i++){cou[i]=0;}
		bool flag=true;
		for(int i=0;i<N;i++){
			cou[A[i]]++;
			int max1=0,max11,max2=0,max21;
			for(int j=0;j<26;j++){
				if(max1<cou[j]){
					max2=max1;max21=max11;
					max1=cou[j];max11=j;
				}
				else if(max2<cou[j]){
					max2=cou[j];max21=j;
				}
			}
			if(flag&&(max1-max2)>N-1-i){
				printf("%c %d\n",max11+'A',i+1);
				flag=false;
			}
		}
		if(flag){
			printf("TIE\n");
		}
	}
	return 0;
}



Measured memory_bytes: 3184
import itertools

lst = []
for _ in range(3):
    a, b = [int(_) for _ in input().split()]
    lst.append((a, b))

for li in itertools.permutations(lst, 3):
    for i in range(8):
        t = []
        if i & 1:
            t.append((li[0][1], li[0][0]))
        else:
            t.append(li[0])
        if i & 2:
            t.append((li[1][1], li[1][0]))
        else:
            t.append(li[1])
        if i & 4:
            t.append((li[2][1], li[2][0]))
        else:
            t.append(li[2])

        pre = t[0][1]
        for j in range(1, 3):
            if pre != t[j][0]:
                break
            pre = t[j][1]
        else:
            print("YES")
            exit()

else:
    print("NO")

Measured memory_bytes: 3064
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
using ll = long long;
const char E = '\n';
const int N = 3005;

int n;
double a[N], dp[N][N];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i=1; i<=n; i++) {
        cin >> a[i];
	}
	dp[0][0] = 1;
	double ans = 0.0;
	for (int i=1; i<=n; i++) {
        for (int j=0; j<=i; j++) {
            dp[i][j] += (dp[i-1][j]*(1-a[i]));
            dp[i][j] += (dp[i-1][j-1]*(a[i]));
        }
	}
	for (int i=(n+1)/2; i<=n; i++) {
        ans += dp[n][i];
	}
	cout << fixed << setprecision(10) << ans;
    return 0;
}


Measured memory_bytes: 69120
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

typedef pair<int, int>P;

int main(){

    for(int n, m;cin>>n>>m, n;){
        vector<int>mn(n, 0), mx(n, 0);
        for(int i=0;i<m;i++){
            int s, k;
            cin>>s>>k;
            for(int j=0;j<k;j++){
                int c;
                cin>>c;
                c--;
                mx[c]+=s;
                if(k==1)mn[c]+=s;
            }
        }
        vector<P>vec;
        for(int i=0;i<n;i++){
            vec.push_back(P(mx[i], i));
        }
        sort(vec.begin(), vec.end());
        reverse(vec.begin(), vec.end());
        int ans = 0;
        for(int i=0;i<n;i++){
            for(int j=0;;j++){
                if(vec[j].second==i)continue;
                ans = max(ans, vec[j].first - mn[i]);
                break;
            }
        }
        cout<<ans+1<<endl;
    }

    return 0;
}


Measured memory_bytes: 3152
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>

int main()
{
  int N;
  std::cin >> N;
  std::vector<int> X(N);
  for(int i=0; i<N; i++) {
    std::cin >> X[i];
  }

  // argmin in real number
  float sum = std::accumulate(X.begin(), X.end(), 0);
  float argmin_f = sum / N;
  int c = std::floor(argmin_f);
  int argmin = argmin_f - c < c + 1 - argmin_f ? c : c+1;

  int min = 0;
  for(auto x : X) {
    min += (x - argmin) * (x - argmin);
  }

  std::cout << min << std::endl;

  return 0;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio (false) ;cin.tie(NULL);
#define tc  int t;cin>>t;for(int i=0;i<t;i++)
#define ll long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define um(a,b) unordered_map<a,b>
#define vv(a) vector<a>
#define pp(a,b) pair<a,b>
ll power(ll a,ll b,ll mod){  ll ans=1;  while(b>0){
  if(b&1){ ans=(ans*a)%mod;} a=(a*a)%mod;  b=b/2; } return ans;}
#define imax 100
int main(){
FIO
    ll a;
    cin>>a;
    ll ans=a+a*a+a*a*a;
    cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sc(x) scanf("%lld",&(x));
#define pb push_back
#define fi first
#define se second
#define P pair<int,int>
#define endl '\n'
int A[100005],B[100005],M[100006];

priority_queue<int,vector<int>,greater<int> > pq;
signed main()
{
int n,m,k;int x,y;
    sc(n)sc(m)sc(k)
    for(int i=1;i<=n;i++){
        sc(A[i])
    }
    for(int i=1;i<=m;i++)sc(B[i])
    for(int i=1;i<=k;i++){sc(x)sc(y)sc(M[i])pq.push(A[x]+B[y]-M[i]);}
    sort(A+1,A+n+1);
    sort(B+1,B+1+m);
    pq.push(A[1]+B[1]);
    cout<<pq.top()<<'\n';


}


Measured memory_bytes: 3448
#include <bits/stdc++.h>

using namespace std;

namespace {

#define VEVE(i, a, b) for (ll i = a, __##i = b; i < __##i; ++i)
#define DYDY(i, a, b) for (ll i = a, __##i = b; i > __##i; --i)
#define RARA(x, seq) for (auto &x : seq)
#define SIZE(x) ((ll)(x.size()))
#define ALL(x) x.begin(), x.end()

typedef int64_t ll;
typedef double dd;

void Solve(ll) {
  ll n;
  string str;
  cin >> n >> str;
  map<pair<string, string>, int> cnt;
  string r, b;
  VEVE(mask, 0, 1 << n) {
    r.clear();
    b.clear();
    VEVE(i, 0, n) {
      if (mask >> i & 1)
        r.push_back(str[i]);
      else
        b.push_back(str[i]);
    }
    ++cnt[{r, b}];
  }
  str.substr(n);
  reverse(ALL(str));
  ll res = 0;
  VEVE(mask, 0, 1 << n) {
    r.clear();
    b.clear();
    VEVE(i, 0, n) {
      if (mask >> i & 1)
        r.push_back(str[i]);
      else
        b.push_back(str[i]);
    }
    auto it = cnt.find({b, r});
    if (it != cnt.end())
      res += it->second;
  }
  cout << res << endl;
}

void Init() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
}

int32_t main() {
#ifdef AZN
  freopen("input.txt", "r", stdin);
#endif
  Init();
  ll tests = 1;
//  cin >> tests;
  VEVE(test, 1, tests + 1) Solve(test);
  return 0;
}


Measured memory_bytes: 46080
#include<algorithm>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<iostream>
#include<istream>
#include<map>
#include<math.h>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
using namespace std;
long long k,a,b;
int main(){
	cin>>k>>a>>b;
	if (a>=b||k-a+1<2||b-a==1)
		cout<<k+1<<endl;
	else
        cout<<a+((k-a+1)/2)*(b-a)+((k-a+1)%2)<<endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
def get_ln_inputs():
    return input().split()


def map_list(fn, xs):
    return list(map(fn, xs))


def get_ln_int_inputs():
    return map_list(int, get_ln_inputs())


def main():
    N = get_ln_int_inputs()[0]
    K = get_ln_int_inputs()[0]

    m = 1
    for _ in range(N):
        if m > K:
            m += K
        else:
            m = m * 2

    print(m)
    return


main()

Measured memory_bytes: 3060
N = int(input())
A_list = list(map(int, input().split()))
count = 0

while (True):
    exist_odd = False
    for i in range(N):
        if (A_list[i] % 2) != 0:
            exist_odd = True

    if exist_odd:
        break
    
    for i in range(N):
        A_list[i] = A_list[i] / 2

    count = count + 1

print(count)

Measured memory_bytes: 3060
n=int(input())
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
a=0
for i in range(n-2):
    if l[i][0]==l[i][1]:
        if l[i+1][0]==l[i+1][1]:
            if l[i+2][0]==l[i+2][1]:
                print("Yes")
                a+=1 
                break

if a==0:
    
    print("No")               

Measured memory_bytes: 9196
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>
#include<boost/multiprecision/cpp_int.hpp>


using namespace std;
using namespace boost::multiprecision;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", v)
#define PRIY PRI("Yes")
#define PRIN PRI("No")
template<typename A, typename B>
void mins(A & a, const B & b) { a = min(a, (A)b); };
template<typename A, typename B>
void maxs(A & a, const B & b) { a = max(a, (A)b); };


int main() {
	ll N;
	cin >> N;
	int cnt = 0;
	bool ok = false;
	REP(i, 0, N) {
		int a, b;
		cin >> a >> b;
		if (a != b) cnt = 0;
		else ++cnt;
		if (cnt == 3) {
			ok = true;
		}
	}
	if (ok) PRIY;
	else PRIN;
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>

int main(){

    while(true){
        size_t h, w;
        std::cin >> h >> w;

        if(h == 0 && w == 0) break;

        for(size_t i = 0; i < h; i++){
            for(size_t j = 0; j < w; j++){
                if(i % 2 == j % 2){
                    std::cout << '#';
                }else{
                    std::cout << '.';
                }
            }std::cout << std::endl;
        }std::cout << std::endl;
    }

    return 0;
}



Measured memory_bytes: 3036
S = input()
flag = True
cflag = False
for i, c in enumerate(S):
    if i == 0:
        if c == "A":
            continue
        else:
            flag = False
            break

    if c == "C" and 2 <= i < len(S)-1:
        if cflag:
            flag = False
        cflag = True

    elif not (97 <= ord(c) <= 122):
        flag = False


if flag and cflag:
    print("AC")
else:
    print("WA")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iostream>
using namespace  std;
int arr[102];
int main() {
    double n,m;
cin>>n>>m;
int mini=1e9;
for(int i=1;i<=1250;i++)
{
if(floor((double )i*0.08)==n   && floor(double(i*0.1)) ==m){cout<<i;
    return  0;}

}
cout<<-1;



//cout<<25*.08 <<"   " <<25*0.1;
    return 0;
}

Measured memory_bytes: 256
import heapq

X, Y, A, B, C = map(int, input().split())

p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()), reverse=True)

red = p[:X]
green = q[:Y]
nocolor = r

heapq.heapify(red)
heapq.heapify(green)

for nc in nocolor:
    R = red[0]
    G = green[0]
    if R > nc and G > nc:
        break
    elif nc > R and nc > G:
        if R > G:
            q = heapq.heappop(green)
            heapq.heappush(green, nc)
        else:
            q = heapq.heappop(red)
            heapq.heappush(red, nc)
    elif nc > R:
        q = heapq.heappop(red)
        heapq.heappush(red, nc)
    elif nc > G:
        q = heapq.heappop(green)
        heapq.heappush(green, nc)

print(sum(red) + sum(green))


Measured memory_bytes: 23360
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long A,B,K;
    cin >> A >> B >>K;

    if(A+B<K){
        A=0;
        B=0;
    }    
    else if(A>=K){
        A-=K;
    }else{
        B=B-(K-A);
        A=0;
    }


    cout << A << " " << B << endl;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
from decimal import *
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
from pprint import pprint



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.readline())
def FI(): return float(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()
D = defaultdict(lambda:defaultdict(int))
for j in range(n):
    a = input()
    r = len(a) - a.find(".") - 1 if "." in a else 0
    a = a.replace(".", "")
    cnt1 = -r
    cnt2 = -r
    a = int(a)
    while a % 2 == 0:
        a //= 2
        cnt1 += 1
    while a % 5 == 0:
        a //= 5
        cnt2 += 1
    D[cnt1][cnt2] += 1

ans = 0
for i in range(-20, 30):
    for k in range(-10, 15):
        for j in range(-20, 30):
            for l in range(-10, 15):
                if i + j >= 0 and k + l >= 0:
                    if i == j and k == l:
                        ans += D[i][k] * (D[j][l] - 1)
                    else:
                        ans += D[i][k] * D[j][l]

print(ans // 2)


Measured memory_bytes: 88128
// By Shreehari Bodas

#include <bits/stdc++.h>

using namespace std;

const int MOD=1e9+7;

int search(int b[], int m, int s){
	int start=0,end=m-1;
	bool flag=false;
	while(start<=end){
		int mid=(start+end)/2;
		if(b[mid]==s){
			flag=true;
			return mid;
		}
		else if(b[mid]>s) end=mid-1;
		else if(b[mid]<s) start=mid+1;
	}
	if(flag==false) return m;
}

long long int pow(long long int a, long long int b){
	if(b==0) return 1;
	long long int res=pow(a,b/2);
	if(b%2 ==1) return res*res*a;
	else if(b%2 ==0) return res*res;
}

int main(){

	int k; cin>>k;
	int a,b; cin>>a>>b;

	bool flag=false;

	for(int i=a;i<=b;i++){
		if(i%k==0){
			flag=true;
			break;
		}
	}

	if(flag==true) cout<<"OK"<<endl;
	else cout<<"NG"<<endl;

	return 0;
} 

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ull N;
    ull ans = 0;
    cin >> N;
    map<ull, ull> count;
    for (ull i = 0; i < N; ++i)
    {
        ull a;
        cin >> a;
        ++count[a];
    }
    for (auto i = count.begin(); i != count.end(); ++i)
    {
        if (i->second % 2 == 1)
        {
            ++ans;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 9724
loop do
    s = gets.chomp
    break if s == "0"
    r = s[1..2].hex
    g = s[3..4].hex
    b = s[5..6].hex
    if r < 128 && g < 128 && b < 128
        puts "black"
    elsif r < 128 && g < 128 && b >= 128
        puts "blue"
    elsif r < 128 && g >= 128 && b < 128
        puts "lime"
    elsif r < 128 && g >= 128 && b >= 128
        puts "aqua"
    elsif r >= 128 && g < 128 && b < 128
        puts "red"
    elsif r >= 128 && g < 128 && b >= 128
        puts "fuchsia"
    elsif r >= 128 && g >= 128 && b < 128
        puts "yellow"
    else
        puts "white"
    end
end


Measured memory_bytes: 8872
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
using lint = int64_t;

vector<int> A, B;
vector<vector<int>> C, D;

void dfs_X(int m, int now) {
    if (C[m][now]) return;
    C[m][now] = 1;
    if (m < A.size()) {
        dfs_X(m + 1, now + A[m]);
        if (m > 0) dfs_X(m + 1, now - A[m]);
    }
}

void dfs_Y(int m, int now) {
    if (D[m][now]) return;
    D[m][now] = 1;
    if (m < B.size()) {
        dfs_Y(m + 1, now + B[m]);
        dfs_Y(m + 1, now - B[m]);
    }
}

int main() {
    string s;
    int x, y;
    cin >> s >> x >> y;
    int cnt = 0;
    int t = 0;
    rep(i, s.size()) {
        if (s[i] == 'T') {
            if (t) B.push_back(cnt);
            else A.push_back(cnt);
            t ^= 1;
            cnt = 0;
        } else {
            ++cnt;
        }
    }
    if (t) B.push_back(cnt);
    else A.push_back(cnt);
    
    C = vector<vector<int>>(A.size() + 1, vector<int>(16001, 0));
    dfs_X(0, 8000);
    D = vector<vector<int>>(B.size() + 1, vector<int>(16001, 0));
    dfs_Y(0, 8000);
    if (C[A.size()][x + 8000] && D[B.size()][y + 8000]) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 496896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int N, A, B, C;
int l[8];
int ans = inf;
void dfs(int depth, int a, int b, int c, int cost) {
    if(depth == N) {
        if(a && b && c) ans = min(ans, cost + abs(A - a) + abs(B - b) + abs(C - c));
    } else {
        dfs(depth + 1, a + l[depth], b, c, cost + 10);
        dfs(depth + 1, a, b + l[depth], c, cost + 10);
        dfs(depth + 1, a, b, c + l[depth], cost + 10);
        dfs(depth + 1, a, b, c, cost);
    }
}
int main() {
    cin >> N >> A >> B >> C;
    for(int i = 0; i < N; i++) cin >> l[i];
    dfs(0, 0, 0, 0, 0);
    cout << ans - 30 << "\n";
    return 0;
}

Measured memory_bytes: 256
// 3N Numbers
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a[300000],ans=-1e18,sumx[100009],sumy[100009];
signed main(){
    cin>>n;
    priority_queue<int> y;
    priority_queue<int,vector<int>,greater<int>> x;
    for(int i=0;i<3*n;i++){
        cin>>a[i];
        if(i<n)sumx[0]+=a[i],x.push(a[i]);
        if(2*n<=i)sumy[0]+=a[i],y.push(a[i]);
    }
    for(int i=0;i<n;i++){
        x.push(a[i+n]);
        sumx[i+1]=sumx[i]+a[i+n]-x.top();
        x.pop();
        y.push(a[2*n-i-1]);
        sumy[i+1]=sumy[i]+a[2*n-i-1]-y.top();
        y.pop();
    }
    for(int i=0;i<=n;i++)ans=max(sumx[i]-sumy[n-i],ans);
    cout<<ans<<endl;
}

Measured memory_bytes: 5876
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long       ll;
#define pb                emplace_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define fore(i, b, e)	  for (int i = (int)b; i < (int)e; i++)
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef pair<ll, ll>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int INF = int(1e9 + 7);
const double EPS = 1e-9;
const double PI = acos(-1);

const int tam = 200010;

ll BIT[tam];

void update(ll pos, ll val)
{
  pos++;
  while(pos < tam)
  {
    BIT[pos] += val;
    pos += (pos & -pos);
  }
}

ll query(ll pos)
{
  pos++;
  ll res = 0;
  while(pos > 0)
  {
    res += BIT[pos];
    pos -= (pos & -pos);
  }
  return res;
}

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    ll n, d, a;
    cin >> n >> d >> a;
    vii v(n);
    fore(i, 0, n)
    {
    	cin >> v[i].F >> v[i].S;
    }
    sort( all(v) );
    set<ii> activeBombs; // pos, str
    ll ans = 0;
    fore(i, 0, n)
    {
    	ll actP = query(i);
    	if (v[i].S -actP <= 0) continue;
    	int lo = i, hi = n-1, mid, res = i;
    	while (lo <= hi)
    	{
    		mid = (lo + hi) / 2;
    		if (v[mid].F <= v[i].F + 2*d)
    		{
    			res = mid;
    			lo = mid+1;
    		}
    		else
    			hi = mid-1;
    	}
    	ll bombs = (v[i].S -actP) / a + ((v[i].S -actP)%a > 0);
    	//cout << bombs << " bombas en [" << v[i].F << "," << v[res].F << "]" << endl;
    	ans += bombs;
    	update(i, bombs*a);
    	update(res+1, -(bombs*a));
    }
    cout << ans << '\n';
    return 0;
}
// PLUS ULTRA!

Measured memory_bytes: 4992
import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    int[] arr = Arrays.stream(sc.nextLine().split(" "))
      .mapToInt(Integer::parseInt)
      .toArray();
    int cnt = 0;
    out: while (true) {
      for (int i = 0; i < n; i++) {
        if (arr[i] % Math.pow(2, cnt + 1) != 0) {
          System.out.println(cnt);
          break out;
        }
      }
      cnt += 1;
    }
  }
}


Measured memory_bytes: 26964
#include <bits/stdc++.h>
using namespace std;

int main(){
  int64_t N,C,K;
  cin >> N >> C >> K;
  priority_queue<int64_t, vector<int64_t>, greater<int64_t> > pq;
  for(int i=0;i<N;i++){
    int64_t T;
    cin >> T;
    pq.push(T);
  }
  int64_t ans=0;
  while(!pq.empty()){
    ans++;
    int64_t x=pq.top();
    pq.pop();
    if(pq.empty()){
      break;
    }
    for(int i=1;i<C;i++){
      if((x<=pq.top())&&(x+K>=pq.top())){
        pq.pop();
        if(pq.empty()){
          break;
        }
      }else{
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include<cstdlib>
#include<vector>
#include<cctype>

using namespace std;

int main() {
	string str;
	int a, b;
	cin >> a >> b;
	cin >> str;
	str[b - 1] = tolower(str[b - 1]);
	cout << str;

	return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <queue>
# include <climits>
using namespace std;
 
int H;
int W;
char A[1005][1005];
int counter=0;
int shortestpath[1005][1005];
bool visited[1005][1005];
int maximum=INT_MIN;
int dr[4]={1, -1, 0, 0};
int dc[4]={0, 0, -1, 1};
queue< pair<int, int> > starting;

bool inside (int row, int column)
{
    if (row<0 || row>H || column<0 || column>W)
    {
        return false;
    }

    return true;
}

void bfs (queue< pair<int, int> > starting)
{
    queue< pair<int, int> > q;

    while (!starting.empty())
    {
        q.push(make_pair(starting.front().first, starting.front().second));
        visited[starting.front().first][starting.front().second]=true;
        starting.pop();
    }

    while (!q.empty())
    {
        pair<int, int> u=q.front();
        q.pop();

        for (int i=0; i<4; i++)
        {
            int nextrow=u.first+dr[i];
            int nextcolumn=u.second+dc[i];

            if (inside(nextrow, nextcolumn) && !visited[nextrow][nextcolumn])
            {
                shortestpath[nextrow][nextcolumn]=shortestpath[u.first][u.second]+1;
                q.push(make_pair(nextrow, nextcolumn));
                visited[nextrow][nextcolumn]=true;
            }
        }

    }
}

int main()
{
    cin>>H>>W;

    for (int i=1; i<=H; i++)
    {
        for (int j=1; j<=W; j++)
        {
            cin>>A[i][j];

            if (A[i][j]=='#')
            {
                starting.push(make_pair(i, j));
            }
        }
    }

    bfs(starting);

    for (int i=1; i<=H; i++)
    {
        for (int j=1; j<=W; j++)
        {
            if (shortestpath[i][j]>maximum)
            {
                maximum=shortestpath[i][j];
            }
        }
    }

    cout<<maximum<<endl;
}

Measured memory_bytes: 25804
n, m, c = gets.chomp.split(' ').map(&:to_i)
bs = gets.chomp.split(' ').map(&:to_i)
answer = 0

n_arr = Array.new(n)
m_arr = Array.new(m)
minus_c = c * -1

n_arr.each do |i|
  result = 0
  as = gets.chomp.split(' ').map(&:to_i)
  m_arr.each_with_index do |j, index|
    result += as[index] * bs[index]
  end
  answer+= 1 if result > minus_c
end

puts answer


Measured memory_bytes: 1788
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
#define rep(i, s, n) for(int i = s;i<n;i++)

int main(void) {
    string s;
    cin >> s;
    int min_val = stoi(s.substr(0, 3)) - 753;
    rep(i, 0, s.size() - 2) {
        char _x[3] = {s[i], s[i + 1], s[i + 2]};
        int x = atoi(_x);
        min_val = min(abs(x - 753), abs(min_val));
    }
    cout << min_val << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pl;

int const N = 1e5 + 1;

ll dp[101][N];
int main()
{
	fastio;

	memset(dp, -1, sizeof(dp));
	dp[0][0] = 0;

	int n, W;
	cin >> n >> W;

	int v, w;
	for (int i = 1; i <= n; ++i)
	{
		cin >> w >> v;
		for (int j = 0; j < N; ++j)
		{
			if (dp[i-1][j] != -1)
			{
				if (dp[i][j] == -1) dp[i][j] = dp[i-1][j];
				else dp[i][j] = min(dp[i][j], dp[i-1][j]);

				dp[i][j+v] = w + dp[i-1][j];
			}
		}
	}


	for (int i = N-1; i >= 0; --i)
	{
		if (dp[n][i] <= W && dp[n][i] != -1)
		{
			cout << i << '\n';
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 82496
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	D = inputInt()
	C = inputList()
	S = []
	ans = []
	for i in range(D):
		s = inputList()
		S.append(s)

	minC = max(C)
	minCn = 0
	for i,val in enumerate(C):
		if val == minC:
			minCn = i+1

	for i,val in enumerate(S):
		tmp = max(val)
		mins = 0
		for j,vol in enumerate(val):
			if tmp == vol:
				mins = j+1
				break
		aaa = random.randint(0, 100)
		if aaa >= 25:
			ans.append(mins)
		else:
			ans.append(minCn)

	for i in range(D):
		print(ans[i])

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 78816
N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 1

if A[0] == 0:
    ans = 0
else:
    for i in range(N):
        ans = ans * A[N-1-i]
        if ans > 10**18:
            ans = -1
            break

print(ans)


Measured memory_bytes: 21664
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;

int main(){
    int n; cin >> n;
    vector<int> d(n);
    int sum=0;
    rep(i,n){
        cin >> d[i];
        sum += d[i];
    } 
    int ans=0;
    rep(i,n){
        ans += (sum-d[i])*d[i];
    }

cout << ans/2 << endl;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
template< int id > struct CompTupleBy
{
  template<class T> 
  bool operator()( const T& a, const T& b ) const {
    return std::get<id>(a) < std::get<id>(b);
  }
};

using namespace std;

int main(){
    int k,x;
    cin >> k >> x;
    for(int i=x-k+1;i<=k+x-1;i++){
        cout << i << " ";
    }
    cout << endl;
}

Measured memory_bytes: 256
//	-*- mode: C++ -*-
//	Standard Deviation
//
//		You have final scores of an examination for n students. Calculate standard deviation of the scores s1, s2 ... sn.
//
//		The variance α2 is defined by
//
//		α2 = (∑ni=1(si - m)2)/n
//
//		where m is an average of si. The standard deviation of the scores is the square root of their variance.
//
//	Input
//		The input consists of multiple datasets. Each dataset is given in the following format:
//
//		n
//		s1 s2 ... sn
//		The input ends with single zero for n.
//
//	Output
//		For each dataset, print the standard deviation in a line. The output should not contain an absolute error greater than 10-4.
//
//	Constraints
//		n ≤ 1000
//		0 ≤ si ≤ 100
//	Sample Input
//		5
//		70 80 100 90 20
//		3
//		80 80 80
//		0
//	Sample Output
//		27.85677655
//		0.00000000

#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <cmath>

typedef std::pair<std::vector<unsigned int>, double>	score_t;

int	main(int	argc,
		 char*	argv[])
{
    std::vector<score_t>	scores;

	while(true){
		unsigned int	n	{0};

		std::cin >> n;
		if(n == 0){
			break;
		}

		double	sum	{0};
		score_t			score	{};
		for(unsigned int i = 0; i < n; i++){
			unsigned int	si	{0};

			std::cin >> si;
			sum	+= si;
			score.first.push_back(si);
		}
		score.second	= static_cast<double>(sum / n);

		scores.push_back(score);
	}

	for(auto x : scores){
		unsigned int	n	{0};
		double			p	{0};

		for(auto si : x.first){
			double	y	= si - x.second;
			p	+= (y * y);
			++n;
		}

		std::cout << std::fixed << std::setprecision(6) << sqrt(p / n) << "\n";
	}

    return 0;
}



Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
long long xsum(int x, int y, int z){
	return x*x+y*y+z*z+x*y+y*z+z*x;
}
int main(){
	int n;
	cin >> n; 

	int mx=sqrt(n)+1;
	vector<int> f(n+1,0);
	for(int x=1; x<=mx; ++x){
		for(int y=1; y<=mx; ++y){
			for(int z=1; z<=mx; ++z){
				int tmp=xsum(x,y,z);
				if(tmp<=n) ++f[tmp];
				else break;
			}
		}
	}
	
	for(int i=1; i<=n; ++i) cout << f[i] << endl;
}

Measured memory_bytes: 3512
#include<bits/stdc++.h>
#include<cstdlib>
#include<cmath>
using namespace std;
int main(){
  int N; int K; cin>>N>>K;
  int L=1;
  while(N/K!=0){
    L++;
    N/=K;
  }
  cout<<L<<endl;
}

Measured memory_bytes: 3564
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        m: usize,
        k: usize,
    }

    if k >= 1 << m {
        println!("-1");
        return;
    }

    if m == 1 {
        if k == 0 {
            println!("0 0 1 1");
        } else {
            println!("-1");
        }
        return;
    }

    let mut v = vec![];

    for i in 0..1 << m {
        if i == k {
            continue;
        }
        v.push(i);
    }
    v.push(k);
    for i in (0..1 << m).rev() {
        if i == k {
            continue;
        }
        v.push(i);
    }
    v.push(k);

    println!(
        "{}",
        v.iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    );
}


Measured memory_bytes: 18172
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,p,m=0,ans=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>p;
    ans+=p;
    if(m<p) m=p;
  }
  cout<<ans-m/2<<endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

int main(){
    vector<vector<int>> A(3, vector<int>(3));
    vector<vector<bool>> AA(3, vector<bool>(3, false));
    rep(i, 3){
        rep(j, 3){
            cin>>A[i][j];
        }
    }
    int N;
    cin>>N;
    vector<int> B(N);
    rep(i, N){
        cin>>B[i];
        
        rep(j, 3){
            rep(k, 3){
                if(A[j][k]==B[i]){
                    AA[j][k]=true;
                }
            }
        }
    }
    bool Ans=false;
    rep(i, 3){
        if(AA[i][0]&&AA[i][1]&&AA[i][2]){
            Ans=true;
        }
        if(AA[0][i]&&AA[1][i]&&AA[2][i]){
            Ans=true;
        }
    
    }
    if(AA[0][0]&&AA[1][1]&&AA[2][2]){
        Ans=true;
    }
    if(AA[0][2]&&AA[1][1]&&AA[2][0]){
        Ans=true;
    }
    Yes(Ans);
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
//const int mod = 100000;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<int> count(61, 0);
  rep(i, 61) {
    rep(j, n) if((a[j]>>i)&1) ++count[i];
  }
  mint ans = 0;
  rep(i, 60) {
    mint add = 1ll<<i;
    add *= count[i];
    add *= n-count[i];
    ans += add;
  }
  cout << ans.x << endl;
}


Measured memory_bytes: 5628
#include <stdio.h>

int main(void){
    int n,m,i,j;
    scanf("%d %d",&n,&m);
    int matrix[n][m];
    int vector[m];
    int ans[n];
    for(i = 0;i<n;i++){
      ans[i]  = 0;
    }
    for(i = 0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&matrix[i][j]);
        }
    }
    for(i = 0;i<m;i++){
        scanf("%d",&vector[i]);
    }
    for(i = 0;i<n;i++){
        for(j = 0;j<m;j++){
            ans[i] += matrix[i][j] * vector[j];
        }
        printf("%d\n",ans[i]);
    }
    return 0;
}

Measured memory_bytes: 636
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			int t = cin.Int();
			var ab = new Tuple<int, int>[n];
			for (int i = 0; i < n; i++) {
				int a = cin.Int();
				int b = cin.Int();
				ab[i] = new Tuple<int, int>(a, b);
			}
 
			Array.Sort(ab, (x, y) => x.Item1.CompareTo(y.Item1));
 
			int[,] dp = new int[n + 1, t + 1];
 
			for (int i = 0; i < n; i++) {
				for (int j = 0; j <= t; j++) {
					if (j + ab[i].Item1 > t) {
						if (j != t) {
							dp[i + 1, j] = Math.Max(dp[i + 1, j], dp[i, j]);
							dp[i + 1, t] = Math.Max(dp[i + 1, t], dp[i, j] + ab[i].Item2);
						} else {
							dp[i + 1, j] = Math.Max(dp[i + 1, j], dp[i, j]);
						}
					} else {
						dp[i + 1, j] = Math.Max(dp[i + 1, j], dp[i, j]);
						dp[i + 1, j + ab[i].Item1] = Math.Max(dp[i + 1, j + ab[i].Item1] , dp[i, j] + ab[i].Item2);
					}
				}
			}
 
			int ans = 0;
			int temp1 = dp[n, t];
			int temp2 = dp[n, t - 1];
			int temp = Math.Max(temp1, temp2);
 
			ans = Math.Max(ans, temp);
 
			Console.WriteLine(ans);
		}
	}
 
 
 
	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;
 
		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}
 
		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}
 
			string st = reader_();
			while (st == "") {
				st = reader_();
			}
 
			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}
 
			index_ = 0;
			return buf_[index_++];
		}
 
		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());
 
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}
 
		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}
 
		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
 
		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}
 
			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 48224
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <functional>
#include <queue>
#include <cmath>
#include <utility>

using namespace std;

#define int long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rep1(i,n) for(int i=1;i<=(int)n;++i)

signed main()
{
	int A, B; cin >> A >> B;

	int ans = 0;

	while (ans < 10000000) {
		if (100*A <= 8*ans and 8*ans < 100*(A+1) and 100*B <= 10*ans and 10*ans < 100*(B+1)) {
			cout << ans << endl;
			return 0;
		}
		ans++;
	}

	cout << -1 << endl;
}


Measured memory_bytes: 256
n, m, c = map(int, input().split())

base_list = list(map(int, input().split()))

ans = 0
for i in range(n):
    cal = 0
    source_list = list(map(int, input().split()))

    for j in range(m):
        cal += base_list[j] * source_list[j]

    if cal + c > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define PI acos(-1)
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int modpow(int x, int n, int m) {
	x %= m;
	int res = 1;
	while(n > 0) {
		if(n & 1)
			res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());
	#ifndef ONLINE_JUDGE
		// freopen("input.txt", "r", stdin);
		// freopen("output.txt", "w", stdout);
	#endif

	int n, k;
	cin >> n >> k;
	int h[n];
	for(int i = 0; i < n; i++) {
		cin >> h[i];
	}
	sort(h, h + n);
	reverse(h, h + n);
	int ans = 0;
	for(int i = k; i < n; i++) {
		ans += h[i];
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 1792
#include"bits/stdc++.h"

#define rep(i, N) for(int i = 0;i < N;i++)

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;



int main(void) {
	int N; cin >> N;
	vector<ll> L(N);
	rep(i, N)cin >> L[i];

	sort(L.begin(), L.end());

	int ans = 0;
	rep(i, N)rep(j, i)rep(k, j) {
		if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i])continue;
		if (L[j] + L[k] <= L[i])continue;
		ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
import java.util.*;

class Main {
	public static void main(String[] args) {
        //ArrayList<Integer> array = new ArrayList<Integer>();
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int ans[] = new int[N+1];
        int sum = 0;
        for(int i=0; i<K; i++) {
            int d = sc.nextInt();
            int[] A = new int[d];
            for(int j=0;j<d; j++) {
                A[j] = sc.nextInt();
                ans[A[j]]++;
            }
            //array.add(A[i]);
        }
        //System.out.println(N-array.size());
        for(int i=1;i<N+1;i++) {
            if(ans[i] == 0) sum++;
        }
        System.out.println(sum);
	}
}

Measured memory_bytes: 46276
#include <stdio.h>

int main() {
    int n = 0, m = 0;
    scanf("%d %d", &n, & m);
    int dig1 = -1, dig10 = -1, dig100 = -1;
    int s, c;
    for (int i = 0; i < m; i++){
        scanf("%d %d", &s, &c);
        if (s == n && (dig1 == -1 || dig1 == c))
            dig1 = c;
        else if (s == n - 1 && (dig10 == -1 || dig10 == c))
            dig10 = c;
        else if (s == n - 2 && (dig100 == -1 || dig100 == c))
            dig100 = c;
        else {
            printf("-1\n");
            return 0;
        }
    }
    if (n == 1) {
        if (dig1 == -1)
            dig1 = 0;
        printf("%d\n", dig1);
    }
    else if (n == 2) {
        if (dig10 == 0) {
            printf("-1\n");
            return 0;
        }
        if (dig1 == -1)
            dig1 = 0;
        if (dig10 == -1)
            dig10 = 1;
        printf("%d%d\n", dig10, dig1);
    }
    else if (n == 3) {
        if (dig100 == 0) {
            printf("-1\n");
            return 0;
        }
        if (dig1 == -1)
            dig1 = 0;
        if (dig10 == -1)
            dig10 = 0;
        if (dig100 == -1)
            dig100 = 1;
        printf("%d%d%d\n",dig100, dig10, dig1);
    }
    
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;

int main() {
	int i;
	std::string n;

	std::cin >> n;

	for (i = 0; i < 3; i++) {
		if (n[i] == '1'){
			std::cout << '9';
		}
		else {
			std::cout << '1';
		}
	}

	return 0;
}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
A = [[0] * W for _ in range(H)]
for i in range(K):
    y, x, v = map(int, input().split())
    A[y - 1][x - 1] = v
dp = [[0] * 4 for i in range(W)]
pre = []
dp[0][1] = A[0][0]
for i in range(H):
    for j in range(W):
        if i:
            dp[j][0] = max(dp[j][0], max(pre[j]))
            dp[j][1] = max(dp[j][1], max(pre[j]) + A[i][j])
        for k in range(4):
            if j:
                if 0 < k:
                    dp[j][k] = max(dp[j][k], dp[j - 1][k - 1] + A[i][j])
                dp[j][k] = max(dp[j][k], dp[j - 1][k])
    pre = dp
ans = 0
for j in range(W):
    ans = max(ans, max(dp[j]))
print(ans)


Measured memory_bytes: 147032