akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;
const ll INF = (1LL << 62);

ll books[100005][15];
ll prices[100005];

ll N, M, X;

ll base = 2;
ll bits[15];

ll calc() {
  ll spent = 0;

  ll learn[15];
  fill_n(learn, 15, 0);

  for (ll n = 0; n < N; n++) {
    if (bits[n]) {
      spent += prices[n];
      for (ll m = M - 1; m >= 0; m--) {
        ll plus = books[n][m];

        // cout << "plus:" << plus << endl;
        learn[m] += plus;
      }
    }
  }

  bool ok = true;

  // cout << "learn:";
  // for (ll m = 0; m < M; m++) {
  //   cout << learn[m] << " ";
  // }
  // cout << "" << endl;

  for (ll m = 0; m < M; m++) {
    if (learn[m] < X) {
      ok = false;
      break;
    }
  }

  if (ok) {
    return spent;
  } else {
    return INF;
  }
}

int main() {
  scanf("%lld %lld %lld", &N, &M, &X);

  for (ll i = 0; i < N; i++) {
    ll c;
    scanf("%lld", &c);

    prices[i] = c;

    for (ll m = 0; m < M; m++) {
      ll a;
      scanf("%lld", &a);
      books[i][m] = a;
    }
  }

  fill_n(bits, 15, 0);

  ll ans = INF;

  for (;;) {
    bool finish = false;
    // for (ll i = N - 1; i >= 0; i--) {
    //   cout << bits[i];
    // }
    // cout << "" << endl;

    ans = min(ans, calc());

    for (ll i = 0; i < N; i++) {
      // cout << "i:" << i << endl;
      if (bits[i] + 1 < base) {
        bits[i] += 1;
        break;
      } else {
        bits[i] = 0;

        if (i == N - 1) {
          finish = true;
          break;
        }
      }
    }
    if (finish) {
      break;
    }
  }

  if (ans == INF) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}


Measured memory_bytes: 3668
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div
# endregion

N = ri()
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = ri_()
A.sort()
B.sort()
if N % 2 == 1:
    ans = B[(N - 1) // 2] - A[(N - 1) // 2] + 1
else:
    ans = (B[N // 2 - 1] + B[N // 2]) - (A[N // 2 - 1] + A[N // 2]) + 1
print(ans)

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll N;
    string S;
    cin >> N;
    vector<ll> A(N);

    REP(i,N){
        cin >> A.at(i);
    }

    vector<ll> ans(9);

    REP(i,9){
        ans.at(i) = 0;
    }

    REP(i,N){
        if (A.at(i) <= 399)
        {
            if (ans.at(0) == 0)
            {
                ans.at(0)++;
            }
        }
        else if (A.at(i) <= 799 && A.at(i) >= 400)
        {
            if (ans.at(1) == 0)
            {
                ans.at(1)++;
            }
        }
        else if (A.at(i) <= 1199 && A.at(i) >= 800)
        {
            if (ans.at(2) == 0)
            {
                ans.at(2)++;
            }
        }
        else if (A.at(i) <= 1599 && A.at(i) >= 1200)
        {
            if (ans.at(3) == 0)
            {
                ans.at(3)++;
            }
        }
        else if (A.at(i) <= 1999 && A.at(i) >= 1600)
        {
            if (ans.at(4) == 0)
            {
                ans.at(4)++;
            }
        }
        else if (A.at(i) <= 2399 && A.at(i) >= 2000)
        {
            if (ans.at(5) == 0)
            {
                ans.at(5)++;
            }
        }
        else if (A.at(i) <= 2799 && A.at(i) >= 2400)
        {
            if (ans.at(6) == 0)
            {
                ans.at(6)++;
            }
        }
        else if (A.at(i) <= 3199 && A.at(i) >= 2800)
        {
            if (ans.at(7) == 0)
            {
                ans.at(7)++;
            }
        }
        else if (A.at(i) >= 3200)
        {
                ans.at(8)++;
        }
    }

    ll ans_min = 0;
    ll ans_max = 0;

    REP(i,8){
        ans_min += ans.at(i);
        ans_max += ans.at(i);
    }
    if(ans_min==0){
        ans_min++;
    }
    if(ans.at(8)>0){
        ans_max += ans.at(8);
    }

    cout << ans_min << " " << ans_max << endl;
}


Measured memory_bytes: 256
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#endif

const double PI = acos(-1);
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

template<typename T>
void floyd_warshal(vector<vector<T>> &d, int n) {
	for (int k = 0; k < n; ++k) {
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

#define idx(p) (p.first * m + p.second)

const int INF = 1e9;
void solve() {
	cini(n);
	cini(m);
	vs s(n);
	for (int i = 0; i < n; i++)
		cin >> s[i];

	vvi dm(n * m, vi(n * m, INF));

	const vector<pii> offs = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (s[i][j] == '#')
				continue;
			pii p = { i, j };
			dm[idx(p)][idx(p)] = 0;

			for (pii off : offs) {
				pii np = { i + off.first, j + off.second };
				if (np.first < 0 || np.first >= n || np.second < 0 || np.second >= m)
					continue;
				if (s[np.first][np.second] == '#')
					continue;

				dm[idx(p)][idx(np)] = 1;
			}
		}
	}

	floyd_warshal(dm, n * m);

	int ans = 0;
	for (int i = 0; i < n * m; i++) {
		for (int j = 0; j < n * m; j++) {
			if (dm[i][j] < INF)
				ans = max(ans, dm[i][j]);
		}
	}
	cout << ans << endl;
}

int main() {
	cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	solve();
}



Measured memory_bytes: 896
X,N = map(int,input().split())

if N == 0:
  print(X)
elif N == 100:
  if X > 50:  
    print(101)
  else:
    print(0)
else:
  List = list(map(int,input().split()))
  List.sort()

  c = 10 ** 10
  ans = 1000

  for i in range(-100,200):
    if not i in List:
      if abs(i - X) < c:
        c = abs(i-X)
        ans = i
      
  print(int(ans))

Measured memory_bytes: 9200
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#define REP(i, N) for(int i=0; i<N; i++)
using namespace std;

//#include "atcoder.hpp"

long long gcd(long long a, long long b) {
    if (a>b) swap(a,b);
    
    auto r = b % a;
    
    return (r ? gcd(r, a) : a);
}

int main() {
    int N, max = 0, r = 0;
    vector<int> H;
    
    cin >> N;
    H.resize(N);
    for (auto& i : H) {
        cin >> i;
        
        if (i >= max) {
            r++;
            max = i;
        }
    }
    
    

    cout << r << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<complex>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
#define EPS (long double) 1e-8
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

int main(void) {
	while(1) {
		int n;
		cin>>n;
		if(n == 0) break;
		P d = P(0, 0);
		int res = 0;
		int b = 0;
		REP(i, n) {
			string buf;
			cin>>buf;
			if(buf == "lu") d.first = 1;
			if(buf == "ru") d.second = 1;
			if(buf == "ld") d.first = 0;
			if(buf == "rd") d.second = 0;
			if(d == P(1, 1) && !b) {
				++res;
				b = 1;
			}
			if(d == P(0, 0) && b) {
				++res;
				b = 0;
			}
		}
		cout<<res<<endl;
	}
}

Measured memory_bytes: 3148
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;

int main()
{
	int N, C;
	cin >> N >> C;
	vector<int> s(N), t(N), c(N);

	vector<int> u(200000 + 10);
	for (int i = 0; i < N; ++i) {
		cin >> s[i] >> t[i] >> c[i];
		s[i] *= 2;
		t[i] *= 2;
		c[i] -= 1;
		for (int x = s[i] - 1; x < t[i]; ++x) {
			u[x] |= 1 << c[i];
		}
	}

	size_t ans = numeric_limits<size_t>::min();
	for (auto x : u) {
		ans = max(ans, bitset<32>(x).count());
	}
	cout << ans << endl;
}


Measured memory_bytes: 2176
#include <iostream>
using namespace std ;
int main(){
    int a;
    cin >> a ;
    string s[a];
    for(int i=0;i<a;i++){
        cin >> s[i] ;
    }
    int AC =0,WA = 0,TLE = 0,RE = 0 ;
    for(int i=0;i<a;i++){
        if (s[i]=="AC")AC++;
        else if (s[i]=="WA")WA++;
        else if (s[i]=="TLE")TLE++;
        else if (s[i]=="RE")RE++;
        }
        cout << "AC x " << AC <<endl ;
        cout << "WA x " << WA <<endl ;
        cout << "TLE x "<< TLE <<endl ;
        cout << "RE x " << RE << endl ;

    }


Measured memory_bytes: 6728
#include<bits/stdc++.h>
using namespace std;
char n;
int main()
{
cin>>n;
if(n=='A')cout<<"T"<<endl;
if(n=='T')cout<<"A"<<endl;
if(n=='G')cout<<"C"<<endl;
if(n=='C')cout<<"G"<<endl;
return 0;
}

Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)
cnt = 0
rtmp = 0
abtmp = 0
N.times do |l| 
  ret = true
  r = rtmp
  a,b = abtmp,abtmp
  while ret && r < N
    a ^= A[r]
    b += A[r]
    ret = a == b
    abtmp = b if ret
    r += 1 if ret
  end
  rtmp = r
  cnt += rtmp - l
  abtmp -= A[l]
end

puts cnt

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

int main() {
  int s[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << s[K-1] << endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let _: usize = sc.cin();
    let mut xs: Vec<_> = (0..n).map(|_| sc.cin::<String>()).collect();
    xs.sort();
    for x in xs.iter() { print!("{}", x); }
    println!("");
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

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; }



string s;

int main () {
  cin >> s;

  int ans;
  if (s == "SUN") {
    ans = 7;
  } else if (s == "MON") {
    ans = 6;
  } else if (s == "TUE") {
    ans = 5;
  } else if (s == "WED") {
    ans = 4;
  } else if (s == "THU") {
    ans = 3;
  } else if (s == "FRI") {
    ans = 2;
  } else {
    ans = 1;
  }
   

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(){
    long long i,j,k,l,r=0,a=0;
    long long q,x,y;
    long long mem[131072]={0};
    char s[131072];
    s[0]='*';
    scanf("%lld%lld%s",&l,&q,&s[1]);
    for(i=1;i<=l;i++){
        mem[i]=mem[i-1];
        if(s[i-1]=='A'&&s[i]=='C'){mem[i]++;}
    }
    for(i=0;i<q;i++){
        scanf("%lld%lld",&x,&y);
        printf("%lld\n",mem[y]-mem[x]);
    }
    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int s;
    cin >> s;
    for (int i = 0; i < s; i++) {
        vector<int> vi;
        for (int j = 0; j < 9; j++) {
            int n;
            scanf("%x", &n);
            vi.push_back(n);
        }
        int b = 1;
        for (int j = 0; j < 0xffffffff; j+=b) {
            int total = 0;
            for (int k = 0; k < 8; k++) {
                total += (vi[k]^j);
            }
            if (total == (vi[8]^j)) {
                printf("%x\n", j);
                break;
            }
            if ((total&b) == ((vi[8]^j)&b)) {
                b = b << 1;
            }
        }
    }
    return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) {
        cin >> A[i];
        A[i]--;
    }

    int ans = 0;
    rep(i, N) {
        if (A[A[i]] == i) ans++;
    }

    cout << ans/2 << endl;
}



Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;
 
int main() {
    int n;
    cin >> n;
    int a[n], b[n];
    rep(i, n) {
        cin >> a[i];
        b[i] = a[i];
    }

    sort(b, b+n);
    reverse(b, b+n);
    int max1 = b[0];
    int max2 = b[1];

    rep(i, n) {
        if(a[i] == max1) {
            cout << max2;
        }
        else {
            cout << max1;
        }

        cout << "\n";
    }
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  float s=0.0;
  int i,n;
  cin>>n;
  float a[n];
  for(i=0;i<n;i++)
  {
    cin>>a[i];
    s+=(1.0/a[i]);
  }
  cout<<(1.0/s);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    String S = sc.next();

    if (S.length() <= K) {
      System.out.println(S);
    } else {
      System.out.println(S.substring(0, K) + "...");
    }
  }
}


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

int main() {
  long long N, M, sum=0;
  cin >> N >> M;
  vector<long long> A(M);
  for(int i=0; i<M; i++){
    cin >> A.at(i);
    sum += A.at(i);
  }
  if(sum > N)
    cout << -1 << endl;
  else
    cout << N - sum << endl;
}

Measured memory_bytes: 3676
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  string S;
  cin >> S;
  
  int64_t p = 1, now = 0,  result = 0;
  vector<int64_t> mod(2019);
  mod[0] = 1;
  for (int64_t i = S.size() - 1; i >= 0; --i) {
    now = (now + (S[i] - '0') * p) % 2019;
    result += mod[now]++;
    p = p * 10 % 2019;
  }
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 3748
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int count = 0;
			int n = sc.nextInt();
			for (int i = 0; i <= 9; i++) {
				for (int j = 0; j <= 9; j++) {
					for (int k = 0; k <= 9; k++) {
						for (int l = 0; l <= 9; l++) {
							if (i + j + k + l == n) {
								count++;
							}
						}
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 18852
import java.util.*;
import java.io.*;
import java.time.chrono.MinguoDate;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    static int dx[]={-1,0,1,0};
    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        
        int n=sc.nextInt();
        char c[]=sc.nextString().toCharArray();
        int q=sc.nextInt();
        long m[]=new long[c.length+1];
        
        for (int i = 0; i < c.length; i++) {
			m[i+1]+=m[i]+(c[i]=='M'?1:0);
		}
        
//        db(m);

        for (int i = 0; i < q; i++) {
			int d=sc.nextInt();
			long s=0,cs=0,cn=0;
			for (int t = 0; t < d-1; t++) {
				int w=n-t-1;
				if(c[w]=='C') {
					cs+=m[w+1];
					cn++;
				}
				if(c[w]=='D') {
					s+=cs;
					s-=cn*m[w+1];
				}
			}
//			db(d,cs,cn,s);

			for (int t = c.length-d; -1 < t; t--) {
				if(c[t]=='D') {
					s+=cs;
					s-=cn*m[t+1];
				}
				else if(c[t]=='C') {
					cn++;
					cs+=m[t+1];
				}
				if(c[t+d-1]=='C') {
					cn--;;
					cs-=m[t+d];
				}
//				db(d,s,cs,cn);
			}
	        out.println(s);
		}

//        out.println();
        out.flush();
    }

    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P implements Comparable<P>{
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//    public int compareTo(P p){
//        return d-p.d; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int n, a, b;
    cin >> n >> a >> b;

    int x = min(a, b);
    cout << x << endl;

    if(n >= a + b) {
        cout << 0 << endl;
    }else{
        cout << abs(n-a-b) << endl;
    }

    return 0;
}



Measured memory_bytes: 256
import math
n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]

count = 0
for i in range(n):
    for j in range(i + 1, n):
        dist = math.sqrt(sum([(x[i][k] - x[j][k]) * (x[i][k] - x[j][k]) for k in range(d)]))
        if dist % 1 == 0.0:
            count += 1
print(count)

Measured memory_bytes: 3064
// AOJ 0222: Prime Quadruplet
// 2017.8.7 bal@4u
// 2017.10.29

#include <stdio.h>
#include <stdlib.h>

#define MAX  10000000
#define SQRT 3162     // sqrt(MAX)
char prime[MAX+5], *pmax = prime + MAX, *p, *q;
char buf[10];

typedef struct { int id, k, ans; } T;
T in[2002]; int n;

int cmp1(T *a, T *b) { return a->k - b->k; }
int cmp2(T *a, T *b) { return a->id - b->id; }
int main()
{
	int k, pre, x;

	for (k = 3, p = prime + 3; k <= SQRT; k += 2, p += 2) {
		if (!*p) {
			for (q = p + k; q <= pmax; q += k) *q = 1;
		}
	}
	for (n = 0; ; n++) {
		fgets(buf, 10, stdin); if ((k = atoi(buf)) == 0) break;
		in[n].id = n;
		in[n].k  = (k & 1) ? k : k-1;
	}

	qsort(in, n, sizeof(T), cmp1);
	for (pre = 0, k = 0; k < n; pre = in[k].k, k++) {
		x = in[k].k;
		for ( ; ; x -= 2) {
			if (x <= pre) { in[k].ans = in[k-1].ans; break; }
			if (!prime[x] && !prime[x-2] && !prime[x-6] && !prime[x-8]) { in[k].ans = x; break; }
		}
	}
	qsort(in, n, sizeof(T), cmp2);
	for (k = 0; k < n; k++) printf("%d\n", in[k].ans);
	return 0;
}

Measured memory_bytes: 11504
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
const int MAXN=1e5+7;
int seg[4*MAXN];
int arr[MAXN];
int  gcd( int a, int b )
{
	if(b==0)
	{
		return a;
	}
	else
	{
		return gcd( b, a%b );
	}
}

void build(int n,int s,int e){
	if(s==e) {
		seg[n]=arr[s];
		return;
	}
	int mid=(s+e)/2;
	build(2*n,s,mid);
	build(2*n+1,mid+1,e);
	seg[n]=gcd(seg[2*n],seg[2*n+1]);
}

int  get(int n,int s,int e,int l,int r){
	if(s>r||e<l) {
		return 0;
	}
	if(s>=l&&e<=r) {
		return seg[n];
	}
	int mid=(s+e)/2;
	return gcd(get(2*n,s,mid,l,r),get(2*n+1,mid+1,e,l,r));
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	for(int i=1; i<=n; i++) {
		cin>>arr[i];
	}
	int ans=0;
	build(1,1,n);
	for(int i=2; i<n; i++) {
		int one=get(1,1,n,i+1,n);
		int two=get(1,1,n,1,i-1);
		ans=max(ans,gcd(one,two));
	}
	ans=max(ans,get(1,1,n,2,n));
	ans=max(ans,get(1,1,n,1,n-1));
	cout<<ans<<endl;
	return 0;
}


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

int main(){
  int n;
  cin >> n;
  bool ok = false;
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      if(n==i*j) ok = true;
    }
  }
  if(ok) puts("Yes"); else puts("No");
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

int main()
{
    string S,T;
    cin>>S>>T;
    int ans=0;
    for(int i=0;i<S.size();i++){
        if(S.at(i)!=T.at(i)){
            ans++;
        }

    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3828
S = input()
Q = int(input())
Query = [input().split() for _ in range(Q)]

rev = False
S1 = ''
S2 = ''

for TFC in Query:
    if TFC[0] == '1':
        rev = not rev
    else:
        if TFC[1] == '1':
            if rev:
                S2 += TFC[2]
            else:
                S1 = TFC[2] + S1
        else:
            if rev:
                S1 = TFC[2] + S1
            else:
                S2 += TFC[2]

if rev:
    print(S2[::-1] + S[::-1] + S1[::-1])
else:
    print(S1 + S + S2)

Measured memory_bytes: 40660
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}

il ll gcd(ll a,ll b){ return b==0 ? a:gcd(b,a%b) ; }

template<typename T>
il bool chk_max(T&x,const T&y){
	if( x<y ){ x=y; return 1; }
	return 0;
}
const int mod = 1e9+7;

il ll qpow(ll a,ll b){
	ll ans= 1;
	for(; b; b>>=1,a=a*a%mod) if ( b&1 ) {
		ans= ans*a%mod;
	} return ans;
}
il ll inv(ll x){ return qpow(x,mod-2); }

#define Primes map<ll,int>
il Primes primes(ll n){
	int ed = sqrt(n);
	Primes ans;
	rep(i,2,ed) if( n%i==0 ){
		int cnt=0;
		while( n%i==0 ) cnt++, n/=i;
		ans[i]=cnt;
	}
	if( n!=1 ) ans[n]=1;
	return ans;
}

enum{N=10003};

ll a[N],b[N];
Primes mx,p[N];

int main(){
	int n=ci();
	rep(i,1,n) a[i] = ci();
	rep(i,1,n){
		p[i] = primes(a[i]);
		for(Primes::iterator it=p[i].begin();it!=p[i].end();it++)
			chk_max(mx[it->first],it->second);
	}
	rep(i,1,n){
		b[i] = 1;
		for(Primes::iterator it=p[i].begin();it!=p[i].end();it++){
			if( mx[it->first]==it->second ){
				b[i] *= qpow(it->first,it->second);
				mx[it->first] = -1;
			}
		}
	}
//	rep(i,1,n) printf("%lld ",b[i]); pt('\n');
	ll pro=1, ans=0;
	rep(i,1,n) pro=pro*b[i]%mod;
	rep(i,1,n) ans=(ans+pro*inv(a[i]))%mod;
	printf("%lld\n",(ans+mod)%mod);
	return 0;
}


Measured memory_bytes: 3968
using System;

public class hello
{
    public static int p, q, a, n, ans;
    public static void Main()
    {
        while (true)
        {
            ans = 0;
            string[] line = Console.ReadLine().Trim().Split(' ');
            p = int.Parse(line[0]);
            q = int.Parse(line[1]);
            a = int.Parse(line[2]);
            n = int.Parse(line[3]);
            if (p == 0 && q == 0 && a == 0 && n == 0) break;
            Rec(0, 1, 1, 1, 0);
            Console.WriteLine(ans);
        }
    }
    static void Rec(int bs, int bb, int c, int mu, int mk)
    {
        if (p * bb == q * bs) { ans++; return; }
        if (mk == n) return;
        if (p * bb < q * bs) return;
        for (int i = c; mu * i <= a; i++)
        {
            Rec(bs * i + bb, bb * i, i, mu * i, mk + 1);
        }
    }
}



Measured memory_bytes: 13848
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<cmath>
using namespace std;

int main(void)
{
	int N;
	cin >> N;

	vector<bool> prime(N+1, true);
	prime[0] = prime[1] = false;
	for(int i=2; i<sqrt(N+1); i++)
		if(prime[i] == true)
			for(int j=2; i*j<N+1; j++)
				prime[i*j] = false;

	vector<vector<int>> table(N+1, vector<int>(N+1, 0));
	for(int i=2; i<N+1; i++)
	{
		int n = i;
		for(int j=2; j<=n; j++)
		{
			if(prime[j] != true)
				continue;

			if(n%j != 0)
				continue;

			table[i][j] = table[n/j][j] + 1;
			n /= pow(j, table[i][j]);
		}
	}

	vector<int> sum(N+1, 0);
	for(int i=2; i<N+1; i++)
		for(int j=2; j<N+1; j++)
			sum[j] += table[i][j];

	const long long mod = 1E9 + 7;
	long long ret = 1;
	for(int i=0; i<N+1; i++)
	{
		if(prime[i] != true)
			continue;

		ret *= (sum[i] + 1)%mod;
		ret %= mod;
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 4224
while True:
    H, W = [int(x) for x in input().split() if x.isdigit()]
    if H ==0 and W == 0:
        break
    for i in range(H):
        if i == 0 or i == H-1:
            print("#"*W)
        else:
            print("#"+"."*(W-2)+"#")
    print("")

Measured memory_bytes: 7596
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define stp setprecision(15)
#define eps 0.000001
#define endl '\n'
#define mod2 998244353
#define ll lli

using namespace std ;

#define N 200000+5 

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

int main() 
{
/////////////////////////////////////
    
    fastio;

    lli n,x;
    cin>>n>>x;

    lli l[n];

    loopl(i,0,n) cin>>l[i];

    lli c=0,cnt=1;

    loopl(i,0,n)
    {
        c = c+l[i];

        if(c<= x) cnt++;

        if(c>x) 
        {
            cout<<cnt;
            return 0;
        }
    }

    cout<<cnt;
    
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a[10];
    int i,x,y,z,i1,i2,i3;
    x=0;y=0;z=0;
    for(i=0;i<10;i++) scanf("%d",&a[i]);
    for(i=0;i<10;i++)
                      if(x<a[i]) {x=a[i];i1=i;}
    for(i=0;i<10;i++)
                      if((y<a[i])&&(i!=i1)) {y=a[i];i2=i;};
                      
    for(i=0;i<10;i++)
                      if((z<a[i])&&(i!=i1)&&(i!=i2)) {z=a[i];i3=i;};
                      
    printf("%d\n",x);
    printf("%d\n",y);
    printf("%d\n",z);
    return 0;
}

Measured memory_bytes: 596
# -*- coding: utf-8 -*-

s = input()


if s == 'SAT':
    print(1)
elif s == 'FRI':
    print(2)
elif s == 'THU':
    print(3)
elif s == 'WED':
    print(4)
elif s == 'TUE':
    print(5)
elif s == 'MON':
    print(6)
elif s == 'SUN':
    print(7)


Measured memory_bytes: 8884
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a) memset(a, 0, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back
#define inf (1<<29)

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

int main(){
        _ios;
        int n,m; cin>>n>>m;
        int a[n];
        rep(i,n)cin>>a[i];
        int ans = 0;
        double sum = 0;
        for(int i=0;i<n;i++)
        sum += a[i];
        sum = sum /(4*m);
        for(int i=0;i<n;i++){
            if(a[i]>=sum)
            ans++;
        }
        if(ans >= m)cout<<"Yes";
        else cout<<"No";


return 0;
}








Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
//const ll mod=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
V<int> z_algo(const string &s){
    int n=s.size();
    V<int> prefix(n);
    for(int i=1,j=0;i<n;i++){
        if(i+prefix[i-j]<j+prefix[j]){
            //すでに計算済みの場所である
            prefix[i]=prefix[i-j];
        }else{
            // わからないところを愚直に調べる
            int k=max(0,j+prefix[j]-i);
            while(i+k<n&&s[k]==s[i+k])k++;
            prefix[i]=k;
            j=i;
        }
    }
    prefix[0]=n;
    return prefix;
}
V<int> res[5005];
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<n;i++){
        string t=s.substr(i,n-i);
       res[i]=z_algo(t);
    }
    int ans=0;
    for(int i=0;i<n;i++){
    for(int j=1;j<res[i].size();j++){
       if(j<res[i][j])continue;
       else chmax(ans,res[i][j]);
    }
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 49280
#define P(x) cout << #x " = " << x << endl
#define PP(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define PPP(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl

#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
#include<string>
using namespace std;


template <typename T>
class BIT {
private:
    vector<T> v;
    const int n;

public:
    BIT(int _n) : v(_n + 1, 0), n(_n) {}

    // a[0] + a[1] + ... + a[i - 1]
    // O(log n)
    T sum (int i) {
        assert(0 <= i && i < n + 1);
        T s = 0;
        while(i > 0) {
            s += v[i - 1];
            i -= i & -i;
        }
        return s;
    }

    // a[i] + a[i + 1] + ... + a[j - 1]
    // O(log n)
    T sum (int i, int j) {
        return sum(j) - sum(i);
    }

    // a[i] += x
    // O(log n)
    void add(int i, T x) {
        assert(0 <= i && i < n);
        i++;
        while (i <= n) {
            v[i - 1] += x;
            i += i & -i;
        }
    }

};

int n, k;
string s;
vector<int> rl;
vector<int> cumsum;

int main()
{
    cin >> n >> k >> s;
    char last = '1';
    int len = 0;
    for (char c : s) {
        if (c != last) {
            rl.push_back(len);
            len = 0;
        }
        len++;
        last = c;
    }
    rl.push_back(len);
    int m = rl.size();
    BIT<int> bit(rl.size());

    for (int i = 0; i < rl.size(); ++i) {
        bit.add(i, rl[i]);
        // cout << bit.sum(i, i + 1) << endl;
    }
    int ans = 0;
    int i = 0;
    while(true) {
        int right = min(m, i + k * 2 + 1);
        // P(bit.sum(i, right));
        ans = max(ans, bit.sum(i, right));
        if (right == m) break;
        i += 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1272
import numpy as np

def ii():
    return int(input())


def lii():
    return list(map(int, input().split(' ')))


def lvi(N):
    l = []
    for _ in range(N):
        l.append(ii())
    return l


def lv(N):
    l = []
    for _ in range(N):
        l.append(input())
    return l


def main():
    N = ii()
    A = lii()
    for i in range(N):
        A[i] -= (i + 1)

    A = np.array(sorted(A))
    offset = A[0]
    A = A - offset
    s1 = A.sum()
    mins = s1
    s2 = 0
    nowv = 0

    for i, v in enumerate(A):
        if nowv < v:
            s1 -= (v - nowv) * (N - i)
            s2 += (v - nowv) * i
            nowv = v
            if s1 + s2 < mins:
                mins = s1 + s2

    return mins

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 34220
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 1000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

signed main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int s; cin >> s;
  if(s<=1e9){
    cout << 0 << ' ' << 0 << ' ' << 1 << ' ' << 0 << ' ' << 0 << ' ' << s << endl;
  } else {
    int b = s / 1000000000ll;
    s %= 1000000000ll;
    if(s != 0){
      cout << 0 << ' ' << s << ' ' << b << ' ' << 0 << ' ' << b+1 << ' ' << 1000000000 << endl; 
    } else{
      cout << 0 << ' ' << s << ' ' << b << ' ' << 0 << ' ' << b << ' ' << 1000000000 << endl;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;

    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (n == i * j) {
                cout << "Yes" << "\n";
                return 0;
            }
        }
    }
    cout << "No" << "\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

vector<ll> getdv(ll x) {
	vector<ll> ret;
	ll i;
	for(i = 2; i * i < x; i++) {
		if(x % i) continue;
		ret.push_back(i), ret.push_back(x / i);
	}
	if(i * i == x) ret.push_back(i);
	return ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	ll n;
	cin >> n;
	ll ans = getdv(n - 1).size() + 1;
	if(n > 2) ans++;
	auto cr = getdv(n);
	for(auto el: cr) {
		ll x;
		for(x = n; x % el == 0; x /= el);
		if(x % el == 1) ans++;
	}
	cout << ans << '\n';
}



Measured memory_bytes: 384
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
d=""
if max(b)<min(c):
    for i in range(min(c)-max(b)):
        if a[2]<max(b)+i+1<=a[3]:
            d="No War"
            break
        else:
            d="War"
else:
    d="War"
print(d)

Measured memory_bytes: 3060
package main

import "fmt"

func main() {
  var a, b int
  fmt.Scanf("%d %d", &a, &b)
  plus := a + b
  minus := a -b
  multi := a * b
  var max int
  if (plus > minus) {
    if (plus > multi) {
      max = plus
    } else {
      max = multi
    }
  } else {
    if (minus > multi) {
    	max = minus
    } else {
      max = multi
    }
  }
  fmt.Printf("%d\n", max)
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdint>
#include <algorithm>
#include <string>
int main()
{
    std::uint_fast16_t a, b;
    std::cin >> a >> b;
    std::cout << std::string(std::max(a, b), '0' + std::min(a, b)) << std::endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

ll solve(){
    ll N;
    cin >> N;
    vector<ll>v(N), cnt(N, 0);
    rep(i, N){
        cin >> v[i];
        cnt[v[i]]++;
    }
    sort(v.begin(), v.end(), greater<ll>());
    if(v[0] == 1 && N > 2)return 0;
    for(ll i = v[0]; i >= (v[0] + 1) / 2; i--){
        N -= cnt[i];
        if(i + i == v[0]){
            if(cnt[i] != 1)return 0;
        }
        else if(i == (v[0] + 1) / 2){
            if(cnt[i] != 2)return 0;
        }
        else if(cnt[i] < 2)return 0;
    }
    if(N)return 0;
    return 1;
}

int main(){

    if(solve())cout << "Possible" << endl;
    else cout << "Impossible" << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;

const int mod = 1e9+7;
struct mint {
  ll x; // typedef ll 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*(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;
  }
};

vector<pair<int, int>> prime_factorize(int N) {
  vector<pair<int, int>> res;
  for (int a = 2; a * a <= N; ++a) {
    if (N % a != 0) continue;
    int ex = 0;

    while (N % a == 0) {
      ++ex;
      N /= a;
    }

    res.push_back({a, ex});
  }

  if (N != 1) res.push_back({N, 1});
  return res;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N; cin >> N;

  vector<int> A(N);
  map<int, int> nums;

  rep(i, N) {
    cin >> A[i];
    auto pfs = prime_factorize(A[i]);
    for(auto pf : pfs) {
      nums[pf.first] = max(nums[pf.first], pf.second);
    }
  }

  mint lcm = 1;
  for(auto num : nums) {
    rep(i, num.second) lcm *= num.first;
  }

  mint ans = 0;
  rep(i, N) {
    mint b = lcm / A[i];
    ans += b;
  }

  cout << ans.x << endl;
}


Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int q = sc.nextInt();
		int[] f = calc();
		for (int i = 0; i < q; i++) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			if (l == 1) {
				System.out.println(f[r]);
			} else {
				System.out.println(f[r] - f[l - 2]);
			}
		}
		sc.close();
	}

	static int[] calc() {
		int[] ret = new int[100001];
		for (int i = 3; i < ret.length; i+=2) {
			ret[i] = ret[i - 2];
			if (isSosuu(i) && isSosuu((i + 1) / 2)) {
				ret[i]++;
			}
		}
		return ret;
	}

	static boolean isSosuu(long n) {
		if (n < 2) return false;
		if (n == 2) return true;
		long end = (int) Math.sqrt(n) + 1;
		for (int i = 2; i <= end; i++) {
			if (n % i == 0) {
				return false;
			}
		}
		return true;
	}
}


Measured memory_bytes: 64112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	int ans = 0, mi = 0;
	rep(i,n){
		if(mi <= a.at(i)){
			ans++;
			mi = a.at(i);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int N = sc.nextInt();
	    int K = sc.nextInt();
	    int count = 0;
	    for(int i = 0; i < N; i++) {
	        int h = sc.nextInt();
	        if(h >= K) {
	            count++;
	        }
	    }
	    System.out.println(count);
	}
}

Measured memory_bytes: 47708