akhauriyash/Code-Regression huggingface dataset:
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

const P: i64 = 998244353;

fn main() {
    let N = read!(usize);
    let A = read![usize; N];
    let S = A.iter().sum::<usize>();
    let M = A.iter().cloned().max().unwrap();

    // dp1[k][r] = x : 前から k 個の整数を塗り分けて、赤の総和が r になる塗りかたの個数が x
    let mut dp1 = vec![vec![0; M * (N + 1) + 1]; N + 1];
    // dp2[k][r] = x : ある1色を塗らない場合
    let mut dp2 = vec![vec![0; M * (N + 1) + 1]; N + 1];
    dp1[0][0] = 1;
    dp2[0][0] = 1;

    for k in 0..N {
        let a = A[k];
        for r in 0..M * N + 1 {
            // この整数を赤に塗るケース
            dp1[k + 1][r + a] += dp1[k][r];
            dp1[k + 1][r] %= P;
            dp2[k + 1][r + a] += dp2[k][r];
            dp2[k + 1][r] %= P;

            // 緑か青に塗るケース
            dp1[k + 1][r] += 2 * dp1[k][r];
            dp1[k + 1][r] %= P;
            dp2[k + 1][r] += 1 * dp2[k][r];
            dp2[k + 1][r] %= P;
        }
    }

    let mut u = 0;
    for r in (S + 1) / 2..M * N + 1 {
        u += dp1[N][r];
        u %= P;
    }
    u *= 3;
    u %= P;

    let mut v = if S % 2 == 0 { dp2[N][S / 2] } else { 0 };
    v *= 3;
    v %= P;

    let mut p = 1;
    for _ in 0..N {
        p *= 3;
        p %= P;
    }

    let n = ((p + (P - u)) % P + v) % P;
    debug!(p, u, v);

    println!("{}", n)
}


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

template<typename T>
struct BIT {
    int n;
    vector<T> dat;

    BIT(int n=0){
        initialize(n);
    }

    void initialize(int nin){
        n = nin;
        dat.resize(n, 0);
    }

    T sum(int i){
        T s = 0;
        while(i >= 0){
            s += dat[i];
            i = (i & (i+1)) - 1;
        }
        return s;
    }

    T sum_between(int i, int j){
        return sum(j) - sum(i-1);
    }

    void plus(int i, T x){
        while(i < n){
            dat[i] += x;
            i |= i+1;
        }
    }

    // a[0]+...+a[ret] >= x
    int lower_bound(T x){
        int ret = -1;
        int k = 1;
        while(2*k <= n) k <<= 1;
        for( ;k>0; k>>=1){
            if(ret+k < n && dat[ret+k] < x){
                x -= dat[ret+k];
                ret += k;
            }
        }
        return ret + 1;
    }
};

int N, A[100000];

bool check(int X){
    BIT<int> bit(2*N+1);
    int64_t res = 0, s = N;
    bit.plus(s, 1);
    for(int i=0; i<N; i++){
        s += (A[i] <= X ? -1 : 1);
        res += bit.sum_between(s+1, 2*N);
        bit.plus(s, 1);
    }
    int64_t need = int64_t(N) * (N+1) / 4 + 1;
    return (res >= need);
}

int main(){
    cin >> N;
    for(int i=0; i<N; i++) cin >> A[i];
    int ok = 1e9, ng = 0;
    while(ok-ng>1){
        int mid = (ok+ng)/2;
        (check(mid) ? ok : ng) = mid;
    }
    cout << ok << endl;
}

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

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ok cout<<"ok"<<endl
#define dbg(x) cout<<(#x)<<" is "<<x<<endl
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}

typedef long long ll;
typedef pair<int,int> pii;

const int N=100009;

vector<int> p,q,s;
int main()
{
   fastio;
   int x,y,a,b,c,i,r; 
   cin>>x>>y>>a>>b>>c;
   for(i=1; i<=a; i++)
   {
     cin>>r;
     p.push_back(r);
   }
   
   for(i=1; i<=b; i++)
   {
     cin>>r;
     q.push_back(r);
   }

   for(i=1; i<=c; i++)
   {
     cin>>r;
     s.push_back(r);
   }
   
   sort(rall(p));
   sort(rall(q));

   while(p.size()>x) p.pop_back();
   while(q.size()>y) q.pop_back();

   for(i=0; i<p.size(); i++) s.push_back(p[i]);
   for(i=0; i<q.size(); i++) s.push_back(q[i]);

   sort(rall(s));
   ll sum=0;
   for(i=0; i<x+y; i++)
   {
   	 sum+=s[i];
   } 
   cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3188
//sieu nhan
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inp "test.inp"
#define out "test.out"
#define oo 3004
#define inf 1e15
#define mod 1000000007
#define pii pair<int,int>
#define reset(x,y) memset(x,y,sizeof(x))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define y1 hungdzno1
int n;
double res,p[oo],f[oo];
void nhap(){
  cin>>n;
  for(int i=1;i<=n;++i) cin>>p[i];
}
void xuly(){
  f[0]=double(1);
  for(int i=1;i<=n;++i) for(int j=n+1;j>=0;--j) f[j]=(j==0 ? double(0) : f[j-1]*p[i])+f[j]*(1-p[i]);
  for(int i=n/2+1;i<=n;++i) res+=f[i];
  cout<<fixed<<setprecision(10)<<res;
}
main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  //freopen(inp,"r",stdin);
  //freopen(out,"w",stdout);
  nhap();
  xuly();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

class dice{
    int d[7], tmp[7];

public:
    dice(int* a) {
        erep(i, 1, 6) d[i] = a[i];
    }

public:
    void rotate(string direct) {
        if (direct == "N")
            tmp[1] = d[2], tmp[2] = d[6], tmp[3] = d[3], tmp[4] = d[4], tmp[5] = d[1], tmp[6] = d[5];
        else if (direct == "S")
            tmp[1] = d[5], tmp[2] = d[1], tmp[3] = d[3], tmp[4] = d[4], tmp[5] = d[6], tmp[6] = d[2];
        else if (direct == "W")
            tmp[1] = d[3], tmp[2] = d[2], tmp[3] = d[6], tmp[4] = d[1], tmp[5] = d[5], tmp[6] = d[4];
        else if (direct == "E")
            tmp[1] = d[4], tmp[2] = d[2], tmp[3] = d[1], tmp[4] = d[6], tmp[5] = d[5], tmp[6] = d[3];
        erep(i, 1, 6) d[i] = tmp[i];
    }
    
    int top() {
        return d[1];
    }
};


int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    int n = 6, a[7];
    erep(i, 1, n) cin >> a[i];
    string s; cin >> s;
    dice D = dice(a);
    rep(i, 0, s.size()) {
        string sub = s.substr(i, 1);
        D.rotate(sub);
    }
    cout << D.top() << endl;
    return 0;
}


Measured memory_bytes: 3224
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */
//codeforces
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp make_pair
#define pb push_back
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
void parseArray(ll* A,ll n){ for ( ll K = 0; K < n; K++){ cin >> A[K]; } }
ll modInverse(ll a, ll b){ return 1<a ? b - modInverse(b%a, a)*b/a : 1; }
ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; }
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); }
ld dist(ld x, ld y, ld a, ld b){ return sqrt((x-a)*(x-a) + (y-b)*(y-b)); }
void debug(ll* a, ll n) { for ( ll k = 0; k < n; k++ ){ cerr << a[k] << " ";} cout << "\n"; }
#define PI 3.14159265358979323846

int main(){
	FASTIO;
	ll n; cin >> n; ++n;
	ll ans = 0;
	for ( int k = 1; k < n; k++ ){
		for ( int j = 1; j < n; j++ ){
			for ( int i = 1; i < n; i++ ){
				ans += gcd(k, gcd(i, j));
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3700
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=1010000;
const int P=1000000007;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }
int n,k;
char s[N];
bool check (int x,int y)//x< y
{
	for (int i=1; i<=n; i++)
		if (s[x+i-1]!=s[y+i-1]) return s[x+i-1]< s[y+i-1];
	return 0;
}
int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	sc(n),sc(k);
	scanf ("%s",s+1);
	for (int i=1; i<=n; i++)
		s[n*2-i+1]=s[i];
	int p=1;
	for (int i=2; i<=n+1; i++)
		if (check (i,p)) p=i;
	int len=1,f=1<<(k-1);
	while (len< n&&s[p+len]==s[p]) ++len;
	if (k>=15||len*f>=n) { for (int i=1; i<=n; i++) putchar(s[p]); return 0; }
	for (int i=1; i<=len*f; i++)
		putchar(s[p]);
	int las=n-len*f;
	for (int i=1; i<=las; i++)
		putchar(s[p+len+i-1]);

    return 0;
}

Measured memory_bytes: 128
# coding: utf-8

num = input().rstrip().split(" ")

ishow = int(num[0]) // int(num[1])
amari = int(num[0]) % int(num[1])
fshow = float(int(num[0])) / int(num[1])

print(str(ishow) + " " + str(amari) + " " + str("{0:.5f}".format(fshow)))

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


int main() {
 
  int64_t n;
  cin>>n;

  vector<int64_t> a(n);
  int64_t sum=0;
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    sum+=a.at(i);
  }

  int64_t half = sum/2;

  int64_t left_sum=0;
  for(int i=0;i<n;i++){
    left_sum+=a.at(i);
    if(left_sum>=half)
        break;
    }

  int64_t right_sum = sum-left_sum;
  int64_t out1 = abs(right_sum-half)+abs(left_sum-half);

  right_sum=0;
  for(int i=n-1;i>=0;i--){
    right_sum+=a.at(i);
    if(right_sum>=half)
        break;
    }

  left_sum=sum-right_sum;
  int64_t out2 = abs(right_sum-half)+abs(left_sum-half);


  cout<<min(out1,out2)<<endl;


	return 0;
}



Measured memory_bytes: 4804
#include<bits/stdc++.h>
using namespace std;
const int N = 305, inf = 1e9;

int n, k;
char a[N];

int dt[N][N][N];
bool vis[N][N][N];

int solve (int S, int E, int X) {
	if(X < 0) return -inf;
	if(S > E) return 0;
	if(vis[S][E][X]) return dt[S][E][X];
	vis[S][E][X] = true;
	dt[S][E][X] = max({solve(S+1, E, X), solve(S, E-1, X), solve(S+1, E-1, X - (a[S] != a[E])) + 1 + (S != E)});
	return dt[S][E][X];
}

int main()
{
	scanf("%s%d",a+1,&k);
	n = strlen(a+1);
	printf("%d\n",solve(1, n, k));
}


Measured memory_bytes: 137344
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	double a;
	while(cin >> a)
	{
		double num[10]; num[0] = a;
		REP(i, 1, 10)
			num[i] = i % 2 ? num[i-1] * 2 : num[i-1] / 3;

		double res = 0;
		rep(i, 10)
			res += num[i];

		printf("%.10f\n", res);
	}
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

int main()
{
	int a, b, c, x;
	cin >> a >> b >> c >> x;

	int res = 0;
	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= b; j++)
		{
			for (int k = 0; k <= c; k++)
			{
				if (x == 500 * i + 100 * j + 50 * k)
				{
					res++;
				}
			}
		}
	}

	cout << res << endl;
}


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

using namespace std;

typedef long long int ll;

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

  int a;
  cin >> a;
  int b = a + (a * a) + (a * a * a);
  cout << b << '\n';
}

Measured memory_bytes: 3648
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	s := scanString()
	ans := 0
	for i := 0; i < n; i++ {
		t := 0
		for j := 0; j < 26; j++ {
			
			if strings.Contains(s[:i], string('a'+j)) && strings.Contains(s[i:], string('a'+j)) {
				t++
			}
		}
		ans = max(ans, t)
	}
	fmt.Fprintln(wr, ans)
}


Measured memory_bytes: 1780
#include<bits/stdc++.h>
using namespace std;
int n,k,v[55],ans;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>v[i];
	for(int l=0;l<=min(n,k);l++)
		for(int r=0;r<=min(n-l,k-l);r++)
		{
			if(l==0&&r==0) continue;
			int res=0;
			vector<int> vec;
			for(int i=1;i<1+l;i++)
			{
				vec.push_back(v[i]);
				res+=v[i];
			}
			for(int i=n;i>n-r;i--)
			{
				vec.push_back(v[i]);
				res+=v[i];
			}
			sort(vec.begin(),vec.end());
			for(int i=0;i<min((int)vec.size(),k-l-r);i++)
			{
				if(vec[i]<0)
					res-=vec[i];
			}
			ans=max(ans,res);
		}
	cout<<ans<<endl;
	return 0;
}


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

#define INF 1e9
const char color_list[] = {'R', 'G', 'B'};

int stamp(int status, const pair<int, int>& stamp, int pos_h, int pos_w, char color, const vector<char>& c){
  int up = max(pos_h, 0);
  int down = min(stamp.first + pos_h, 4);
  int left = max(pos_w, 0);
  int right = min(stamp.second + pos_w, 4);

  int stamp_bit = 0;
  for(int i = up; i < down; i++)
    for(int j = left; j < right; j++)
      stamp_bit |= 1 << ((i * 4) + j);

  for(int i = 0; i < 16; i++){
    if((stamp_bit & (1 << i)) != 0){
      if(color == c[i]){ status |= (1 << i); }
      else{ status &= ~(1 << i); }
    }
  }

  return status;
}

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

  int h, w;
  vector<pair<int, int> > stamps;
  for(int i = 0; i < n; i++){
    cin >> h >> w;
    stamps.push_back(make_pair(h, w));
  }
  vector<char> c(16);
  for(int i = 0; i < 16; i++){ cin >> c[i]; }

  
  int ans = INF;
  const int goal = (1 << 16) - 1;

  // テ・ツケツ?・ツ?ェテ・ツ?暗」ツ?凖」ツつ?
  vector<bool> used(1 << 16, false);
  queue<pair<int, int> > wait;
  wait.push(make_pair(0, 0));
  used[0] = true;
  while(!wait.empty()){
    int cost = wait.front().first;
    int status = wait.front().second;
    wait.pop();

    if(status == goal){
      ans = cost;
      break;
    }

    for(int i = 0; i < n; i++){
      for(int z = 0; z < 3; z++){
        for(int x = 1 - stamps[i].first; x < 4; x++){
          for(int y = 1 - stamps[i].second; y < 4; y++){
            int next_status = stamp(status, stamps[i], x, y, color_list[z], c);
            if(!used[next_status]){
              used[next_status] = true;
              wait.push(make_pair(cost + 1, next_status));
            }    
          }
        }
      }
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3252
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;

ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
	}
	
	mod& operator=(const ll & tx) {
		x = tx;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return (x + m2.x) % MOD;
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return (x - m2.x + MOD) % MOD;
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return (x * m2.x) % MOD;
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return mod(((*this).x * (*this).inv().x) % MOD);
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}

/* TEMPLATE ENDS HERE */

int main() {
	cout << fixed << setprecision(12);	
	int n;
	cin >> n;
	cout << n * n * n << endl;
	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
 
using namespace std;
 
#define endl '\n'
#define fi first
#define se second
#define SET(p,k) memset(p, k, sizeof(p));
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;

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

	map<int, int> mp;
	int n, a, res = 0;

	cin >> n;
	while (n--) {
		cin >> a;
		mp[a]++;
	}

	bool f = true;

	for (auto v : mp) {
		if (v.fi > v.se)
			res += v.se;
		if (v.se > v.fi)
			res += v.se - v.fi;
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 4736
#include <cstdio>
#include <algorithm>

using namespace std;

int n,r,c,i,j,t,ans;
int D[101010];

int main()
{
	scanf("%d%d%d",&n,&c,&r);

	for(i=0;i<n;i++){
		scanf("%d",D+i);
	}

	sort(D,D+n);

	for(ans=1,i=0;;ans++){
		t = D[i]+r;
		for(j=0;i<n&&j<c&&D[i]<=t;i++,j++);
		if(i>=n) break;
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main()
{
  char moji[1001];
  int sum,cou,tn;
  while(1){
    scanf("%s",moji);
    if(moji[0]=='0'){
      break;
    }
    sum=0;
    cou=0;
    while(1){
      if(moji[cou]=='\0'){
	break;
      }
      tn=moji[cou]-'0';
      sum=sum+tn;
      cou=cou+1;
    }
    printf("%d\n",sum);
  }
  return 0;
}
    

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

int main() {
  long long N,D;
  cin >> N >> D ;
  long long X[N];
  long long Y[N];
  rep(i,N) cin >> X[i] >> Y[i];
  int ans=0;
  rep(i,N) {
    int64_t XX=X[i]*X[i];
    int64_t YY=Y[i]*Y[i];
    int64_t DD=D*D;
    if (XX+YY<=DD) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 6616
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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 (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

ll com(ll a)
{
    return a * (a-1) / 2;
}

int main()
{
    ll N;
    cin >> N;
    vll A(N);
    rep(i, 0, N) cin >> A[i];

    map<ll, ll> mp;
    rep(i, 0, N) mp[A[i]]++;

    ll total = 0;     
    for (auto x : mp) {
        total += com(x.second);
    }  

    rep(i, 0, N) {
        ll tmp = total - com(mp[A[i]]);
        tmp += com(mp[A[i]]-1);
        cout << tmp << endl;
    }
} 





Measured memory_bytes: 12732
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
constexpr ll MOD = 998244353;


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

  int N;
  string X;
  cin >> N >> X;
  vector<string> A(N);
  vector<ll> pow(4040);
  pow[0] = 1;
  for(int i = 0; i < N; ++i) cin >> A[i];
  for(int i = 1; i <4040; ++i) pow[i] = pow[i-1] * 2 % MOD;

  string g = "0";
  for(int i = 0; i < N; ++i) {

    string a = g, b = A[i];
    while(true) {
      if(a.size() < b.size()) swap(a, b);
      if(a == "0" || b == "0") {
        if(a == "0") g = b;
        else g = a;
        break;
      }
      for(int j = 0; j < (int)b.size(); ++j) {
        a[j] = "01"[(a[j] - '0') ^ (b[j] - '0')];
      }
      
      string c;
      int j = 0;
      while(a[j] == '0') ++j;
      for(; j < (int)a.size(); ++j) c.push_back(a[j]);
      if(c.size() == 0) c.push_back('0');
      a = b, b = c;
    }
  }
  if(g.size() > X.size()) {
      cout << 0 << endl;
      return 0;
  }

  // matome
  ll ans = 0;
  vector<bool> res((int)X.size());
  string Y(X.size(), '0');
  for(int i = 0; i < (int)X.size() - (int)g.size() + 1; ++i) {
    if(X[i] != Y[i]) {
      for(int j = 0; j < (int)g.size(); ++j)
        Y[i + j] = "01"[(g[j] - '0') ^ (Y[i + j] - '0')];
    }
  }
  if(X >= Y) ++ans;

  for(int i = 0; i < (int)X.size() - (int)g.size() + 1; ++i) {
    if(X[i] == '1') {
      ans = (ans + pow[(int)X.size() - ((int)g.size()) - i]) % MOD;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define fi first
#define se second
#define vi vector< int > 
#define pii pair<int,int>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
	int x,y;
	cin >> x >> y;
	for (int i =0 ; i <= x; i++) {
		int j = x - i;
		if (i*2 + j*4 == y) {
			cout << "Yes\n";
			exit(0);
		}
	}
	cout << "No\n";
	
}

Measured memory_bytes: 3624
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#include <atcoder/dsu>
using namespace std;
typedef long long int ll;

int main(int, char **) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, q;
    cin >> n >> q;
    atcoder::dsu uf(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            uf.merge(u, v);
        } else {
            cout << (int)uf.same(u, v) << "\n";
        }
    }

    fflush(stdout);
}


Measured memory_bytes: 3920
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var a = int.Parse(spl[0]);
        var b = int.Parse(spl[1]);
        var x = int.Parse(spl[2]);

        return a <= x && x <= a + b ? "YES" : "NO";
    }


    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()0
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=100009;
 
// Happy Coding!



void solve(){
    int s;
    cin>>s;
    set<int> st;
    st.insert(s);
    
    int curr=s;
    int i=1;
    while(1){
        i++;
        curr=(curr&1)?3*curr+1:curr/2;
        if(st.find(curr)!=st.end()){
            cout<<i;
            return ;
        }    
        st.insert(curr);
    }
}

 
int main() {
    faster;
    int t=1;
    // cin>>t;
    
    while(t-->0){
        solve();
    }
	return 0;
}

Measured memory_bytes: 3520
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int m = scanner.nextInt();
        final Map<Integer, List<Integer>> graph = new HashMap<>();
        for (int i = 0; i < m; i++) {
            final int a = scanner.nextInt();
            final int b = scanner.nextInt();

            graph.computeIfAbsent(a, v -> new ArrayList<>())
                    .add(b);
            graph.computeIfAbsent(b, v -> new ArrayList<>())
                    .add(a);
        }

        int counter = 0;
        for (final Map.Entry<Integer, List<Integer>> map : graph.entrySet()) {
            final Integer key = map.getKey();
            final List<Integer> value = map.getValue();
            for (int i = 0; i < value.size(); i++) {
                final int node = value.get(0);
                value.remove(0);
                final boolean[] isVisited = new boolean[n + 1];
                dfs(graph, isVisited, key);
                if (!isAllTrue(isVisited)) {
                    counter++;
                }
                value.add(node);
            }
        }

        System.out.println(counter / 2);
    }

    private static void dfs(final Map<Integer, List<Integer>> graph, final boolean[] isVisited, final int vertex) {
        isVisited[vertex] = true;
        for (final int destination : graph.get(vertex)) {
            if (!isVisited[destination]) {
                dfs(graph, isVisited, destination);
            }
        }
    }

    private static boolean isAllTrue(final boolean[] array) {
        return IntStream.range(1, array.length)
                .mapToObj(i -> array[i])
                .allMatch(Boolean::booleanValue);
    }
}


Measured memory_bytes: 28756
import java.util.Scanner;
import java.lang.StringBuilder;

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

        StringBuilder str=new StringBuilder();
        str.append(scan.nextLine());
        int q=scan.nextInt();
        for(int i=0;i<q;i++){
            String in =scan.next();
            int a=scan.nextInt();
            int b=scan.nextInt();

            if(in.equals("print")){
                System.out.println(str.substring(a,b+1));
            }
            if(in.equals("replace")){
                String p=scan.next();
                str.replace(a,b+1,p);
            }
            if(in.equals("reverse")){
                StringBuilder rev =new StringBuilder();
                rev.append(str.substring(a,b+1));
                rev.reverse();
                str.replace(a,b+1,rev.toString());
            }
        }
    }
}



Measured memory_bytes: 28956
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define ff first
//#define ss second
#define se set<ll>
#define vec vector<ll>
#define inf 10000000000000000
bool mark[100005];
vec adj[100005];
ll counter;
vec cnt;
vector<string> forsubs;







int main()
{    
 

	#ifdef APNA_IO
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 

    double n;
	double k;
    cin>>n>>k;
    double ans[(int)n+1]={0};

    if(k==1)
    	cout<<"1.000000000000"<<endl;

    else
    {

	for(ll i=1;i<=min((int)n,(int)(k-1));i++)
   {
   	ll z=i;
   	double c=1.0/n;
   	//cout<<c<<endl;
   	ans[i]=c;
   //	cout<<ans[i]<<endl;
   	while(z<(int)k)
   	{
   		ans[i]=ans[i]/2.0;
   		z=z*2;
	}
	//cout<<ans[i]<<endl;
	}

	double answer=0.0;

	for(ll i=1;i<=min((int)n,(int)k-1);i++)
	{
		answer+=ans[i];
	}
	
//	cout<<fixed<<setprecision(12)<<answer<<endl;
	double d=n+1.0-k;
	double b=d/n;
//	cout<<fixed<<setprecision(12)<<b<<endl;

if(n>k-1)
	cout<<fixed<<setprecision(20)<<answer+b<<endl;;
if(n<k)
	cout<<fixed<<setprecision(20)<<answer<<endl;;

}
}
	




Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<climits>
using namespace std;
const int maxn = 1e5+7;
int a[maxn];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i];
	int pre = 0;
	int acc = 0;
	int ans = 0;
	for(int i=1;i<=n;++i)
	{
		if(a[i] <= pre)
		{
			acc++;
			ans = max(ans,acc);
			pre = a[i];
		}else
		{
			acc = 0;
			pre = a[i];
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 640
from fractions import gcd
import math
a,b=map(int,input().split())
g=gcd(a,b)
ans=1
for i in range(2,math.floor(g**.5)+1):
  if g%i==0:
    ans+=1
    while g%i==0:
      g//=i
if g!=1:
  ans+=1
print(ans)

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

res = float("inf")
suma = sum(A)
pa = [0]

for i, a in enumerate(A):
    if i == len(A) - 1:
        break
    pa.append(pa[i] + A[i])
    res = min(res, abs(suma - 2 * pa[i + 1]))

print(res)


Measured memory_bytes: 24832
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
	int x, y, z;
	int ans = 1;
	cin >> x >> y >> z;
	x -= y + 2 * z;
	ans += x / (y + z);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
string s;
int main() {
	cin >> s;
	int ret = 0;
	for (int i = 0; i < 6; i++) ret += (s[i] == '1' ? 1 : 0);
	cout << ret << endl;
	return 0;
}

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

using namespace std;

int main(){
    int tmp;
    vector<int>v(3);

    for(int i = 0; i < 3;i++)
        cin >> v[i];

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

    tmp = abs(v[0]-v[1]);

    cout << tmp + abs(v[1]-v[2]) << endl;


    return 0;
}


Measured memory_bytes: 384
import java.util.*;

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

        for (int i = 1; i <= 1000; i++) {
            int val = i * K;
            if (A <= val && val <= B) {
                System.out.println("OK");
                return;
            }
        }
        
        System.out.println("NG");
    }
}

Measured memory_bytes: 35592
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<string.h>
#include<math.h>
#include<queue>
#include<cstring>
#include<new>
#include<cmath>
#include<sstream>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define sz size()
#define em empty()
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define sett(a,b) memset(a,b,sizeof(a))
#define copy(a,b) memcpy(a,b,sizeof(a))
using namespace std;
int main(){
	string s;
	cin>>s;
	int ans=1010;
	fo(i,0,s.sz-2){
		int x=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
		ans=min(ans,abs(x-753));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();

	public static void main(String[] args) {
		int N = sc.nextInt();
		int sum = 0;
		int min = Integer.MAX_VALUE;
		for(int i=0; i<N; i++) {
			int s = sc.nextInt();
			sum += s;
			if(s%10 != 0 && s < min) {
				min = s;
			}
		}

		if(sum%10 != 0) {
			System.out.println(sum);
		} else {
			sum -= min;
			if(sum < 0) {
				System.out.println(0);
			} else {
				System.out.println(sum);
			}
		}
	}

	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


Measured memory_bytes: 21204
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    cin >> N;
    VEC(int) A(N);
    READVEC(A);

    int ret = 0, pos = 0;
    FOR(i, 1, N + 1) {
        while (pos < N && A[pos] != i)
            pos++;
        if (pos >= N)
            break;

        ret = i;
        pos++;
    }

    cout << (ret == 0 ? -1 : N - ret) << endl;
    return 0;
};

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;

int abs(int num){
   if (num > 0)
      return num;
   else
      return -num;
}

int main(){
  int A,B,X;
  cin >> A >> B >> X;
  if(A+B > X && A <= X){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

void solve()
{
	int a[5];
	while(~scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4]))
	{
		map<int, int> input;
		for(int i = 0; i < 5; ++i)
		{
			++input[a[i]];
		}
		vector<int> cards;
		map<int, int>::iterator it = input.begin();
		while(it != input.end())
		{
			cards.push_back(it->second);
			++it;
		}
		sort(cards.begin(), cards.end(), greater<int>());
		if(cards.size() == 2)
		{
			if(cards[0] == 4 && cards[1] == 1)
			{
				cout << "four card" << endl;
			}
			else if(cards[0] == 3 && cards[1] == 2)
			{
				cout << "full house" << endl;
			}
		}
		else if(cards.size() == 3)
		{
			if(cards[0] == 3 && cards[1] == 1 && cards[2] == 1)
			{
				cout << "three card" << endl;
			}
			else if(cards[0] == 2 && cards[1] == 2 && cards[2] == 1)
			{
				cout << "two pair" << endl;
			}
		}
		else if(cards.size() == 4)
		{
			cout << "one pair" << endl;
		}
		else
		{
			int b[5];
			int pos = 0;
			map<int, int>::iterator it = input.begin();
			while(it != input.end())
			{
				b[pos] = it->first;
				++it;
				++pos;
			}
			if(b[1] == b[0] + 1 && b[2] == b[1] + 1 && b[3] == b[2] + 1 && b[4] == b[3] + 1 ||
			   b[0] == 1 && b[1] == 10 && b[2] == 11 && b[3] == 12 && b[4] == 13)
			{
				cout << "straight" << endl;
			}
			else
			{
				cout << "null" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

int main() {
    string st;
    string origin;
    int cnt = 0;

    while (cin >> st) {
        origin = st;
        reverse(st.begin(), st.end());
        if (st == origin) cnt++;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3016
from numba import jit

@jit
def solve(N, K, A):
  for k in range(K):
    B = [0] * N
    for i in range(N):
      l = max(0, i - A[i])
      r = i + A[i] + 1
      B[l] += 1
      if r < N:
        B[r] -= 1

    for j in range(N - 1):
      B[j + 1] += B[j]
  
    if A == B:
      return B
    A = B
  return B
N, K = map(int, input().split())
A = list(map(int, input().split()))
B = solve(N, K, A)
for b in B:
  print(b, end=" ")


Measured memory_bytes: 129816
# C - Tsundoku
def calc_cusum(n):
	cusum = [0] * (n + 1)
	arr = input().split()
	
	for i in range(n):
		cusum[i + 1] = cusum[i] + int(arr[i])
	
	return cusum


def identify_position(i, j):
  global a
  global b
  global k
  global m
  
  if a[i] + b[j] > k:
    while j > 0:
      j -= 1
      
      if a[i] + b[j] <= k:
        break
  else:
    while j < m and a[i] + b[j+1]<= k:
      j += 1
  
  return j


n, m, k = map(int, input().split())
a = calc_cusum(n)
b = calc_cusum(m)

ans = 0
j = 0

for i in range(n + 1):
  j = identify_position(i, j) 
  
  #print(a[i])
  #print(b[j])
  #print(i + j)
  
  if a[i] + b[j] <= k:
    ans = max(ans, i+j)

print(ans)

Measured memory_bytes: 49844
#include<bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
int main(){
  string S;
  cin >> S;
  bool flag = true;
  int N = S.size();
  int par = 1;
  vector<P> ans(0);
  for(int i=0; i<N-1; i++){
    if(i == 0 && S[i] == '0'){
      flag = false;
    }
    if(S[i] != S[N-2-i]){
      flag = false;
    }
    P p = {par,i+2};
    ans.push_back(p);
    if(S[i] == '1' && i != 0){
      par = i+2;
    }
  }
  
  if(S[N-1] == '1'){
    flag = false;
  }
  
  if(flag){
    for(int i=0; i<N-1; i++){
      cout << ans[i].first << " " << ans[i].second << endl;
    }
  }
  else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 4488
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

int main() {
    cin>>A>>B>>N>>M;
    cout<<max(A*B, N*M)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
      solve();
  }
}

// youtube editorial
// 証明は pdf editorial

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) {
    if (a[i] % 2) { // 相手に全部偶数の状態を押し付けられる
      cout << "first" << endl;
      return;
    }
  }
  /*
  最初全部偶数
  相手にどれか奇数の状態を渡すことになる
  相手は自分に全部偶数の状態を押し付けてくる
  相手の勝ち
  */
  cout << "second" << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
  ll res = 1;
  while(b){
    if(b&1)res = res * x % MOD;
    x = x * x % MOD;
    b>>=1;
  }
  return res;
}

ll modinv(ll x){
  return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
  if(was_output)cout << " ";
  cout << a;
  was_output = true;
}
void outendl(){
  was_output = false;
  cout << endl;
}
ll in(){
  ll res;
  scanf("%lld", &res);
  return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
  for(auto &i:x)is >> i;
  return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
  is >> x.first >> x.second;
  return is;
}

template<class t>
void in(t&x){
  cin >> x;
}

template<class t>
void out(t x){
  cout << x;
}


class dijkstra{
public:
	int n;
	vvector<pll> edges;
	vector<ll> fast;
	dijkstra(int N):n(N){
		edges.resize(n);
	}

	void add_edge(int from, int to, ll cost){
		edges[from].emplace_back(to, cost);
	}

	void solve(int start){
		priority_queuer<pll> pq;
		fast.assign(n, INFLL);
		pq.emplace(0, 0);
		fast[start] = 0;
		pq.emplace(0, start);
		while(pq.size()){
			pll d = pq.top();
			pq.pop();
			if(d.first!=fast[d.second])continue;
			foreach(i, edges[d.second]){
				ll next_time = d.first + i.second;
				int to = i.first;
				if(fast[to] <= next_time)continue;
				fast[to] = next_time;
				pq.emplace(next_time, to);
			}
		}
	}
};


int main(){
  int n = in();
  int x = in()-1;
  int y = in()-1;
  dijkstra di(n);

  rep(i,n-1){
    di.add_edge(i,i+1,1);
    di.add_edge(i+1,i,1);
  }
  di.add_edge(x,y,1);
  di.add_edge(y,x,1);

  vector<ll> anses(n-1,0);
  rep(i,n){
    di.solve(i);
    foreach(j,di.fast){
      if(j)++anses[j-1];
    }
  }

  foreach(i,anses){
    ll ans = i;
    cout << ans/2 << endl;
  }

  return 0;
}


Measured memory_bytes: 384