akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var s = rs();
		var n = s.Select(c => (int) c  - '0').Sum();
		Console.WriteLine(int.Parse(s) % n == 0 ? "Yes" : "No");
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 11220
n = int(input())
ps = [int(p) for p in input().split(" ")]
ans = 0
for i in range(n-2):
  if ps[i] < ps[i+1] < ps[i+2]:
     ans += 1
  elif ps[i+2] < ps[i+1] < ps[i]:
     ans += 1
print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	int N;
	cin >> N;
	vector<int>H(N);
	rep(i, N) {
		cin >> H[i];
	}
	vector<int>dp(N);
	dp[0] = 0;
	dp[1] = abs(H[1] - H[0]);
	for (int i = 2; i < N; i++) {
		dp[i] = min(dp[i - 2] + abs(H[i] - H[i - 2]), dp[i - 1] + abs(H[i] - H[i - 1]));
	}
	cout << dp[N - 1] << endl;
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int,input().split()))
mx=0
c=0
for i in range(0,n-1):
    if a[i]>=a[i+1]:
        c+=1
    else:
        mx = max(mx,c)
        c=0
mx = max(mx,c)
print(mx)

Measured memory_bytes: 14252
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC124

{
    class D
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int K = input[1];
            string S = Console.ReadLine();

            List<int> list = new List<int>();
            int count;

            for (int i = 0; i < S.Length; i++)
            {
                if (i == 0 && S[0] != '1')
                {
                    list.Add(0);
                }

                count = 1;
                while (1 < S.Length && i < S.Length - 1 && S[i] == S[i + 1])
                {
                    count++;
                    i++;
                }
                list.Add(count);
            }

            if (S.Length == 1)
            {
                if (S[0] == '1') { list.Add(1); list.Add(0); }
                else { list.Add(0); list.Add(1); }
            }

            var Count = list.ToArray();

            int[] CS = new int[Count.Length + 2];
            CS[0] = 0;
            for (int i = 1; i < Count.Length; i++)
            {
                CS[i] = CS[i - 1] + Count[i - 1];
            }
            CS[Count.Length] = CS[Count.Length - 1] + Count[Count.Length - 1];
            CS[Count.Length + 1] = CS[Count.Length - 1] + Count[Count.Length - 1];

            int max = 0;
            for (int i = 0; i + 2 * K + 1 < CS.Length; i += 2)
            {
                max = Math.Max(max, CS[i + 2 * K + 1] - CS[i]);
            }

            if (S.Length == 1) max = 1;
            if (CS.Length / 2 <= K) max = S.Length;

            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 13536
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
 
#define mem(dp,a)       memset(dp,a,sizeof dp)
#define ninja           ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb(x)           push_back(x)
#define mp(x,y)         make_pair(x,y)
#define all(c)          c.begin(), c.end()
#define ff              first
#define ss              second
#define nl              '\n'
#define inf             1e9+7

bool chk(string p)
{
	int l=0,r=p.size()-1;
	while(l<=r)
	{
		if(p[l]!=p[r])
			return false;
		l++;r--;
	}
	return true;
}
int main()
{
	ninja
	string s; cin>>s;
	int n=s.size(),to=n/2;
	if(!chk(s)){
		cout<<"No";return 0;
	}
	for(int i=0;i<(n-1)/2;i++){
		if(s[i]!=s[(n-1)/2 -i-1]){
			cout<<"No"; return 0;
		}
	}
	for(int i=((n+3)/2)-1;i<n;i++){
		if(s[i]!=s[n-i-1]){
			cout<<"No"; return 0;
		}
	}
	cout<<"Yes";
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a, b; scanf("%d %d", &a, &b);
  int total = 0;
  if(a < b) total += b * 2 - 1;
  if(b < a) total += a * 2 - 1;
  if(a == b) total += a + b;

  printf("%d", total);

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 505;
const long long INF = 1e18;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n, a[MAXN][MAXN];
ll s[MAXN][MAXN], cost[MAXN][MAXN], dp[MAXN][MAXN];
int main() {
	read(n);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j < i; j++)
			read(a[i][j]);
		for (int j = i + 1; j <= n; j++)
			read(a[i][j]);
	}
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= n; j++)
		s[i][j] = s[i][j - 1] + a[i][j];
	for (int i = 0; i <= n; i++)
	for (int j = i + 1; j <= n; j++)
		dp[i][j] = INF;
	for (int i = 1; i <= n; i++)
	for (int j = i; j <= n; j++) {
		ll res = 0;
		for (int k = i; k <= j; k++)
			res += s[k][j] - s[k][k];
		cost[i][j] = res;
	}
	for (int i = 1; i <= n; i++)
		dp[0][i] = cost[1][i];
	for (int i = 0; i <= n - 1; i++)
	for (int j = i + 1; j <= n; j++) {
		ll tmp = dp[i][j];
		for (int k = j + 1; k <= n; k++) {
			tmp += s[k][i];
			chkmin(dp[j][k], tmp + cost[j + 1][k]);
		}
	}
	ll ans = INF;
	for (int i = 0; i <= n - 1; i++)
		chkmin(ans, dp[i][n]);
	writeln(ans);
	return 0;
}

Measured memory_bytes: 7168
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

const int maxn = 1e5 + 5;
int a[maxn];
int numl[maxn], numr[maxn];

struct ed{
	int l, r;
}eds[2 * maxn];

int main()
{
	int n;
	int rd = 0;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) 
	{
		scanf("%d%d", &eds[i].l ,&eds[i].r);
		a[eds[i].l]++;
		a[eds[i].r]--;
		numl[eds[i].l]++;
		numr[eds[i].r]++;
		rd = max(rd, eds[i].r);
	}
	int ma1 = 0, num = 0, ma2 = 0;
	for(int i = 1; i <= rd; i++)
	{
		a[i] += a[i - 1];
		ma2 = max(ma2, a[i]);
		numl[i] += numl[i - 1];
		numr[i] += numr[i - 1];
	}
	for(int i = 1; i <= n; i++)
	{
		int ans = numl[eds[i].r - 1] - numr[eds[i].l];
		ma1 = max(ma1, ans);
	}
	printf("%d %d\n", ma1, ma2);
	return 0;
}


Measured memory_bytes: 5924
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int e = sc.nextInt();
			if (e == 0)
				break;
			int x, y, z;
			int m = 1000000;
			for (z = 0; z * z * z <= e; z++)
				for (y = 0; z * z * z + y * y <= e; y++) {
					x = e - z * z * z - y * y;
					m = Math.min(m, x + y + z);
				}
			System.out.println(m);
		}
		sc.close();
	}
}

Measured memory_bytes: 26168
# frozen_string_literal: true

_ = gets
t = gets.split.map(&:to_i)
m = gets.to_i
p, x = Array.new(m) { gets.split.map(&:to_i) }.transpose
p.map!(&:pred)
sum = t.inject(:+)

m.times.each { |i| puts sum - t[p[i]] + x[i] }

Measured memory_bytes: 1916
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>

using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

ll tonum(string s){
    reverse(ALL(s));
    ll num = 0;
    rep(i, s.size()){
        num += (s[i]-'0')*pow(10, i);
    }
    return num;
}

int main(){
    string s;
    cin >> s;
    ll ans = 0;
    rep(i, (1<<(s.size()-1))){
        string k = "";
        ll sum = 0;
        rep(j, s.size()){
            k += s[j];
            if(i&(1<<j)){
                sum += tonum(k);
                k ="";
            }
        }
        sum += tonum(k);
        ans += sum;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// -*- coding:utf-8-unix -*-

use std::cmp::*;
use std::collections::*;
use std::fs::File;
use std::io::prelude::*;
use std::io::*;
use std::vec;

const INF: i64 = 1223372036854775807;
const MEM_SIZE: usize = 202020;
const MOD: i64 = 1000000007;
use std::cmp::*;
use std::collections::*;
use std::io::stdin;
use std::io::stdout;
use std::io::Write;
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(unused_macros)]
macro_rules! p {
    ([$($x:expr), *]) => {{
        let mut f = true;
        $(
            print!("{}{}", if f {""} else {" "}, $x);
            f = false;
        )*
78786    print!("\n");
    }};
    ($x:expr) => {{
        let mut f = true;
        for a in $x.iter() {
            print!("{}{}", if f {""} else {" "}, a);
            f = false;
        }
        print!("\n");
    }};
}
#[allow(dead_code)]
fn readii() -> (i64, i64) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<i64>().unwrap(),
        iter.next().unwrap().parse::<i64>().unwrap(),
    )
}
#[allow(dead_code)]
fn readuu() -> (usize, usize) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
    )
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn solve() {
    let n: usize = read();
    let mut cnt: i64 = 0;
    let mut cnt_a: i64 = 0;
    let mut cnt_b: i64 = 0;
    let mut cnt_ab: i64 = 0;

    for i in 0..n {
        let s: String = read();
        let mut v = s.as_bytes().to_vec();
        if (v.len() > 2) {
            for j in 0..v.len() - 1 {
                if v[j] == 'A' as u8 && v[j + 1] == 'B' as u8 {
                    cnt += 1;
                }
            }
        }
        if *v.last().unwrap() == 'A' as u8 && *v.first().unwrap() == 'B' as u8 {
            cnt_ab += 1;
        } else if *v.last().unwrap() == 'A' as u8 {
            cnt_a += 1;
        } else if *v.first().unwrap() == 'B' as u8 {
            cnt_b += 1;
        }
    }

    if cnt_ab > 0 && cnt_b > 0 {
        cnt_ab += 1;
        cnt_b -= 1;
    }

    if (cnt_ab > 0 && cnt_a > 0) {
        cnt_ab += 1;
        cnt_a -= 1;
    }
    cnt += max(0, cnt_ab - 1);
    cnt += min(cnt_a, cnt_b);
    println!("{}", cnt);

    return;
}
fn main() {
    solve()
}


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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if(a == b && b == c){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n,m,x;
	cin>>n>>m>>x;
	int l=0,r=0;
	for(int i=0;i<m;i++){
		int a;
		cin>>a;
		if(a<x)l++;
		else r++;
	}
	cout<<min(l,r)<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque

dx = (1, 0, -1, 0,)
dy = (0, 1, 0, -1,)

inf = 1<<60

def solve():
    h, w, k = map(int, sys.stdin.readline().split())

    si = -1
    sj = -1

    a = [[False]*w for i in range(h)]

    for i in range(h):
        s = sys.stdin.readline().rstrip()

        for j, ch in enumerate(s):
            if ch == '.':
                a[i][j] = True
            elif ch == 'S':
                a[i][j] = True
                si, sj = i, j

    visited = [[False]*w for i in range(h)]
    visited[si][sj] = True

    nxts = deque([(si, sj, 0)])

    ans = inf

    while nxts:
        i, j, d = nxts.popleft()

        ans = min(ans, i, h - 1 - i, j, w - 1 - j)

        for l in range(len(dx)):
            ni = i + dy[l]
            nj = j + dx[l]

            if 0 <= ni < h and 0 <= nj < w and not visited[ni][nj] and a[ni][nj] and d + 1 <= k:
                visited[ni][nj] = True
                nxts.append((ni, nj, d + 1))

    ans = (ans + k - 1) // k + 1

    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 13556
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		sc.close();
		int a = 1;
		while(N >= K){
			a++;
			N = N/K;
		}
		System.out.println(a);
	}
}

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

long long a[32]={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}, k;

int main(){
	cin >> k;
	cout << a[k-1] << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    
    int W, H, x, y, r;
    
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    
    if(0 <= x - r && x + r <= W && 0 <= y - r && y + r <= H){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
}



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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int n, m;

int cnt_on(int k, vector<int> switch_, bitset<15> button){
    int cnt=0;
    REP(i, k){
        if(button.test(switch_[i]-1)) cnt++;
    }
    return cnt;
}

int main(){
    cin >> n >> m;
    vector<int> k(m);
    vector<vector<int>> s(m, vector<int>(n));
    vector<int> p(m);
    REP(i,m){
        cin >> k[i];
        REP(j, k[i]){
            cin >> s[i][j];
        }
    }
    REP(i, m) cin >> p[i];


    int ans = 0;
    REP(i, (1<<n)){
        bitset<15> button(i);
        bool all_on = true;

        REP(j, m){
            if (cnt_on(k[j], s[j], button)%2 != p[j]) all_on=false;
        }
        if (all_on) ans++;
    
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))


int main() {
	int sx,sy,tx,ty,dx,dy;
	cin>>sx>>sy>>tx>>ty;
	string ans="";
	dx=abs(tx-sx);
	dy=abs(ty-sy);

	rep(i,dy)ans+='U';
	rep(i,dx)ans+='R';

	rep(i,dy)ans+='D';
	rep(i,dx)ans+='L';

	ans+='L';
	rep(i,dy+1)ans+='U';
	rep(i,dx+1)ans+='R';
	ans+='D';

	ans+='R';
	rep(i,dy+1)ans+='D';
	rep(i,dx+1)ans+='L';
	ans+='U';

	cout<<ans<<endl;
}

Measured memory_bytes: 256
object Main extends App {
    val Seq(_, x, y) = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt)).toSeq
    val z = (x zip y).map(p => math.abs(p._1-p._2))
    def f(n: Int) = math.pow(z.map(math.pow(_, n)).sum, 1.0/n)
    (1 to 3).foreach(n => println(f(n)))
    println(z.max)
}

Measured memory_bytes: 44568
#![allow(unused_imports)]
#![allow(dead_code)]
use datastructure::*;
use grapth::*;
use input_scanner::*;
use math::*;
use string_algorithm::*;
use util::*;

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

fn main() {
    let mut scan = Scanner::new();
    let n: usize = scan.next();
    let mut a: Vec<u32> = Vec::with_capacity(n);
    let mut b: Vec<u32> = Vec::with_capacity(n);
    for _i in 0..n {
        let x = scan.next();
        let y = scan.next();
        a.push(x);
        b.push(y);
    }
    a.sort();
    b.sort();

    if n % 2 == 0 {
        println!(
            "{}",
            b[(n - 1) / 2] + b[n / 2] - a[(n - 1) / 2] - a[n / 2] + 1
        );
    } else {
        println!("{}", b[n / 2] - a[n / 2] + 1);
    }
}

mod datastructure {}
mod grapth {}
mod math {}
mod string_algorithm {}
mod util {}
mod input_scanner {
    pub struct Scanner {
        bytes: Vec<u8>,
        begin: usize,
        end: usize,
    }

    impl Scanner {
        pub fn new() -> Self {
            use std::io::Read;
            let mut buffer: Vec<u8> = Vec::new();
            std::io::stdin().read_to_end(&mut buffer).unwrap();
            let end = (0..buffer.len())
                .find(|i| buffer[*i].is_ascii_whitespace())
                .unwrap_or(buffer.len());
            Scanner {
                bytes: buffer,
                begin: 0,
                end: end,
            }
        }
        pub fn next<T: std::str::FromStr>(&mut self) -> T {
            let s: &str =
                unsafe { std::str::from_utf8_unchecked(&self.bytes[self.begin..self.end]) };
            let ret: T = s.parse::<T>().ok().expect("Parse error.");
            self.skip();
            ret
        }
        pub fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
        pub fn next_word(&mut self) -> Vec<u8> {
            let r = Vec::from(&self.bytes[self.begin..self.end]);
            self.skip();
            r
        }
        fn skip(&mut self) {
            self.begin = (self.end..self.bytes.len())
                .find(|i| !self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
            self.end = (self.begin..self.bytes.len())
                .find(|i| self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
        }
    }
}


Measured memory_bytes: 7868
#include<bits/stdc++.h>
#define int long long
#define mod 1e18+10
#define mx 1000002
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
int a[200005];
int32_t main() {
	int n,x,y,i,j,k;
	cin>>n>>x>>y;
	for(i=1;i<n;i++)
		a[i]=n-i;
	i=x;
	while(1+i-x<y-i)
		i++;
	i--;
	int p=i;
	for(i=1;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			int d=abs(x-i)+abs(y-j)+1;
			if(j-i>d)
			{
				a[j-i]--;
				a[d]++;
			}
			
		}
	}
	for(i=1;i<n;i++)
	cout<<a[i]<<"\n";
	
		

}	

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

ll getPrime(ll N)
{
    vector<bool> sieve(N * 10 + 1, true);

    sieve[0] = sieve[1] = false;
    
    for (ll i = 2; i <= N * 10; i++)
    {
        if (sieve[i])
        {
            for (long long j = i * i; j <= N * 10; j += i)
                sieve[j] = false;
        }
    }

    if (sieve[N])
        return N;

    if (N % 2 == 0)
        ++N;

    while (true)
    {
        if (sieve[N])
            return N;
        else
            N += 2;
    }
}

int solve()
{
    ll N;
    cin >> N;

    cout << getPrime(N) << endl;

    return 0;
}

int main()
{
    solve();

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int A,B;

int main(){
	cin>>A>>B;
	if(A>B) swap(A,B);
	if((A==B?0:2*(B-A)+1)+2*A<=16) cout<<"Yay!"<<endl;
	else cout<<":("<<endl;
}

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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \t" << x.second << '\n'

int p, q, r;

signed main()
{
    cin >> p >> q >> r;
    
    cout << p + q + r - max(p, max(q, r)) << endl; 

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

int main() {
    int y,m,d;
    scanf("%d/%d/%d",&y,&m,&d);
    string ans = "Heisei";
    if (y>2019 || (y==2019&&m>4) ) ans = "TBD";

    cout << ans << endl;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)cin >> a[i];
    sort(a.begin(), a.end(), greater<>());

    long long ret = a[0];
    int remain = n - 2;
    for (int i = 1; i < n; i++) {
        int x = min(2, remain);
        ret += a[i] * x, remain -= x;
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 4052
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		t = t.substring(0, t.length() - 1);
		if (s.equals(t)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35644
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=list(map(int,input().split()))
    cnt=0
    for i in range(N):
        if A[i]%2==1 and i%2==0:
            cnt+=1
    print(cnt)
    
    
    
if __name__=="__main__":
    main()

Measured memory_bytes: 61756
n=int(input())
mod=10**9+7
if n==1:print(0);exit()
if n==2: 
    print(2);exit()

ohuku= pow(10,n,mod)- pow(9,n,mod)
all= pow(10,n,mod)-pow(8,n,mod)
print((-all+ohuku*2+mod)%mod)

Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
#define MP make_pair
#define x first
#define y second

const int N = 1e6 + 10;
const int M = 1e9 + 7;

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

priority_queue<ll> q;

int main ()
{
	ll n;
	while(scanf("%lld", &n) != EOF){
		ll t = n, x;
		for(int i = 0; i < n; i++){
			scanf("%lld", &x);
		//	printf("%lld\n", x);
			q.push(x);
		}
		
		ll cnt = 0, T = 50;
		while(true){
			ll u = q.top(); q.pop();
			if(u < t) break;
			ll k = (u-t)/n + 1;
		//	printf("u = %lld t = %lld k = %lld\n", u, t, k);
			cnt += k;
			t -= k;
			q.push(u-k*n-k);
		}
		
		printf("%lld\n", cnt);
	}
	
	return 0;
}

/*
1234567891011
1234567894848
*/

Measured memory_bytes: 256
#include <stdio.h>
int map[100][100],n,m;
bool went[100][100];
void walk(int x,int y){
    if(x<0||y<0||x>=n||y>=m)return ;
    if(went[x][y])return ;
    if(map[x][y]==0)return ;
    went[x][y]=true;
    walk(x-1,y);
    walk(x+1,y);
    walk(x,y+1);
    walk(x,y-1);
    walk(x+1,y+1);
    walk(x+1,y-1);
    walk(x-1,y+1);
    walk(x-1,y-1);
    return ;
}
int main(){
    int ans;
    while(1){
        scanf("%d%d",&m,&n);
        if(n==0&&m==0)return 0;
        ans=0;
        for(int i=0;i<n;i++)for(int j=0;j<m;j++){
            scanf("%d",&map[i][j]);
            went[i][j]=false;
        }
        for(int i=0;i<n;i++)for(int j=0;j<m;j++)if(!went[i][j]&&map[i][j]==1){
            ans++;
            walk(i,j);
        }
        printf("%d\n",ans);
    }
}

Measured memory_bytes: 2724
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n,k;
    cin >> n >> k;
    int answer = 0;
    REP(i,n){
        int tmp;
        cin >> tmp;
        if(tmp >= k)answer++;
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int jdz(int x)
{
	if(x<0)
	return -x;
	else
	return x;
}
int num[300];
int main()
{
	int n,l;
	scanf("%d %d",&n,&l);
	int min,co;
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		num[i]=l+i-1;
		sum+=num[i];
		if(i==1)
		{
			min=jdz(num[i]);
			co=i;
			continue;
		}
		
		if(jdz(num[i])<min)
		{
			min=jdz(num[i]);
			co=i;
		}
	}
	sum-=num[co];
	printf("%d",sum);
	
	
}

Measured memory_bytes: 128
L, R = map(int, input().split())

if R >= L + 2019:
    print('0')
else:
    xs = [x % 2019 for x in range(L, R + 1)]
    vs = []
    for i in range(len(xs)):
        for j in range(i + 1, len(xs)):
            vs.append((xs[i] * xs[j]) % 2019)
    print(min(vs))

Measured memory_bytes: 75436
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=44;
#define MP make_pair
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline int read(){
    int x=0,f=0;char ch=getchar();
    while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
    while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
    return f?-x:x;
}
int n,a[maxn][maxn];
char s[maxn];
ll f[maxn][maxn][maxn],fs[maxn][maxn][maxn],ans;
int main(){
	n=read()*2;
	FOR(i,1,n){
		scanf("%s",s+1);
		FOR(j,1,n) a[i][j]=s[j]-'0';
	}
	if(n==2) return printf("%d\n",a[1][2]),0;
	FOR(i,2,n){
		f[i][i][i]=1;
		FOR(j,2,n) if(a[i][j]) fs[i][j][i]+=f[i][i][i];
	}
	FOR(len,3,n-1) if(len%2==1) FOR(l,2,n-len+1){
		int r=l+len-1;
		FOR(i,l,r) FOR(j,2,n) if(a[i][j]) fs[l][j][r]-=f[l][i][r];
		FOR(p,l,r) FOR(q,p+1,r){
			ll s=0;
			FOR(k,q,r) s+=fs[l][k][p]*f[q][k][r];
			FOR(i,p+1,q-1) f[l][i][r]+=s*f[p+1][i][q-1];
		}
		FOR(i,l,r) FOR(j,2,n) if(a[i][j]) fs[l][j][r]+=f[l][i][r];
	}
	FOR(i,2,n) if(a[1][i]) ans+=f[2][i][n];
	printf("%lld\n",ans);
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define VAL(a, b, c) ((a < b) ? 0 : (a > b) ? 2 : c)
using namespace std;

const int INF = 0x3f3f3f3f;

long long a[310];
long long A, B, C;
long long dp[50][2][3][2];

// 1 <= a <= A, a + b = B, a ^ b = C

long long dfs(int now, int pd, int p1, int p2) {
	if (now == -1) return p2 == 0 && pd == 0 ? 0 : -INF;
	if (~dp[now][pd][p1][p2]) return dp[now][pd][p1][p2];
	long long &res = dp[now][pd][p1][p2] = -INF;
	for (int i = 1; i >= 0; i--) {
		long long maxj = -INF;
		for (int j = 0; j < 2; j++) {
			for (int np = 0; np < 2; np++) {
				if ((i + j + np >> 1) != pd) continue;
				if ((i + j + np & 1) != (B >> now & 1)) continue;
				if ((i ^ j) != (C >> now & 1)) continue;
				if (p1 && i > (A >> now & 1)) continue;
				maxj = max(maxj, dfs(now - 1, np, p1 & (i == (A >> now & 1)), p2 & (i == 0)));
			}
		}
		if (maxj != -INF) return res = maxj + ((long long)i << now);
	}
	return res = -INF;
}

int main () {
	int n; cin >> n;
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i > 1) sum ^= a[i];
	}
	memset(dp, -1, sizeof(dp));
	A = a[0], B = a[0] + a[1], C = sum;
	if (dfs(49, 0, 1, 1) == -INF) {
		cout << -1 << endl;
		return 0;
	}
	cout << a[0] - dfs(49, 0, 1, 1) << endl;
	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>

using namespace std;

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

    vector<int64_t> A(N);
    for(auto& a : A) cin >> a;
    vector<int64_t> rui(N+1);
    for(int i = 0; i < N; ++i){
        rui[i+1] += rui[i] + A[i];
    }

    int64_t ans = 10000000000000;
    int l = 1;
    int r = 3;
    for(int i = 2; i < N-1; ++i){
        int64_t darr[4];
        int64_t d = abs(rui[i] - rui[l] - rui[l]);
        while(i > l + 1 && d > abs(rui[i] - rui[l+1] * 2)){
            ++l;
            d = abs(rui[i] - rui[l] - rui[l]);
        }
        if(r <= i){
            r = i + 1;
        }
        int64_t d2 = abs(rui[N] - rui[r] - (rui[r] - rui[i]));
        while(N > r && d2 > abs(rui[N] - rui[r+1] - (rui[r+1] - rui[i]))){
            ++r;
            d2 = abs(rui[N] - rui[r] - (rui[r] - rui[i]));
        }
        //cout << l << "," << i << "," << r << endl;
        darr[0] = rui[l];
        darr[1] = rui[i] - rui[l];
        darr[2] = rui[r] - rui[i];
        darr[3] = rui[N] - rui[r];
        /*for(int i = 0; i < 4; ++i){
            cout << darr[i] << endl;
        }*/
        int64_t po = 0;
        for(int i = 0; i < 3; ++i){
            for(int j = i+1; j < 4; ++j){
                po = max(po, abs(darr[i] - darr[j]));
            }
        }
        ans = min(ans, po);
        //cout << po << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
#ceilevenoddformula
import math
import bisect
import copy
import time
from collections import Counter
from itertools import combinations
#map(int,input().split())
#int(x) for x in input().split()
n,m=map(int,input().split())
d={i:set() for i in range(1,n+1)}
for i in range(m):
	x,y=map(int,input().split())
	d[x].add(y)
	d[y].add(x)


vis={i:False for i in range(1,n+1)}
for u,v in d.items():
	d[u]=list(v)
count=0
que=[]
for i in range(1,n+1):
	if not vis[i]:
		que=[]
		c=1
		vis[i]=True
		que.append(i)
		while len(que)!=0:
			x=que.pop(0)
			for j in d[x]:
				if not vis[j]:
					vis[j]=True
					c+=1
					que.append(j)
		count=max(c,count)

print(count)













































Measured memory_bytes: 112824
#include <iostream>
typedef long long ll;

using namespace std;

int main(){
  int N;
  cin >> N;
  ll a[N];
  for (int i = 0; i < N; i++) cin >> a[i];

  ll ans = 0;
  for (int i = 0; i < N; i++) {
    while (a[i] % 2 == 0) { ans++; a[i] /= 2; }
  }  
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
    int A[3][3];
    int N;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }
    cin >> N;
    int* b = new int[N];
    for (int i = 0; i < N; i++) {
        cin >> b[i];
    }

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            for (int m = 0; m < N; m++) {
                if (A[i][j] == b[m]) {
                    A[i][j] = 0;
                    break;
                }
           }
        }
    }
    if (A[0][0] == 0 and A[0][1] == 0 and A[0][2] == 0) {
        cout << "Yes";
        return 0;
    }
    if (A[0][0] == 0 and A[1][0] == 0 and A[2][0] == 0) {
        cout << "Yes";
        return 0;
    }
    if (A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0) {
        cout << "Yes";
        return 0;
    }
    if (A[0][1] == 0 and A[1][1] == 0 and A[2][1] == 0) {
        cout << "Yes";
        return 0;
    }
    if (A[0][2] == 0 and A[1][2] == 0 and A[2][2] == 0) {
        cout << "Yes";
        return 0;
    }
    if (A[0][2] == 0 and A[1][1] == 0 and A[2][0] == 0) {
        cout << "Yes";
        return 0;
    }
    if (A[1][0] == 0 and A[1][1] == 0 and A[1][2] == 0) {
        cout << "Yes";
        return 0;
    }
    if (A[2][0] == 0 and A[2][1] == 0 and A[2][2] == 0) {
        cout << "Yes";
        return 0;
    }
    cout << "No";
    return 0;
}



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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int H, W, M; cin >> H >> W >> M;
	
	int bestX = 0;
	int bestY = 0;

	map<int, set<int>> xs;
	map<int, int> ys;
	F0R(i, M) {
		int y, x; cin >> x >> y;
		xs[x].insert(y);
		ys[y]++;
		bestX = max(bestX, (int) xs[x].size());
		bestY = max(bestY, ys[y]);
	}

	vi goodYs; 
	for (pair<int, int> data : ys) {
		int pos = data.first;
		int len = data.second;
		if (len == bestY) goodYs.push_back(pos);
	}

	for(pair<int, set<int>> data : xs) if (data.second.size() == bestX) {
		for (int y : goodYs) {
			if (data.second.find(y) == data.second.end()) {
				print(bestX + bestY);
				return 0;
			}
		}
	}
	print(bestX + bestY - 1);
}

Measured memory_bytes: 61544
#include <stdio.h>
int main(){
	int a,b[100],n,i;

	scanf("%d",&a);
	for(i=0;i<a;i++)
		scanf("%d",&b[i]);
	for(i=a-1;i>=0;i--){
		printf("%d",b[i]);
		if(i!=0)
			printf(" ");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a[10];
string s;
signed main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		if(s[0]=='M')a[0]++;
		else if(s[0]=='A')a[1]++;
		else if(s[0]=='R')a[2]++;
		else if(s[0]=='C')a[3]++;
		else if(s[0]=='H')a[4]++;
	}
	cout<<a[0]*a[1]*a[2]+a[0]*a[1]*a[3]+a[0]*a[1]*a[4]+a[0]*a[2]*a[3]+a[0]*a[2]*a[4]+a[0]*a[3]*a[4]+a[1]*a[2]*a[3]+a[1]*a[2]*a[4]+a[1]*a[3]*a[4]+a[2]*a[3]*a[4]<<endl;
}


Measured memory_bytes: 256
#list(map(int, input().split()))
h, n = map(int, input().split())
a_ls = list(map(int, input().split()))
sum_at = 0
for i in range(len(a_ls)):
    sum_at+=a_ls[i]
if h > sum_at:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 13964
import java.lang.Math.sqrt

fun main(args: Array<String>){
    val inp = readLine()!!.split(" ").reduce{ a, b -> a + b }.toDouble()
    val sqrtResult = sqrt(inp)

    if(sqrtResult.toInt() - sqrtResult == 0.0){
        println("Yes")
    }else{
        println("No")
    }
}

Measured memory_bytes: 37900
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define vec2(name,i,j) vector<vector<ll>> name(i,vector<ll>(j))
#define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
#define vec3(name,i,j,k) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k)))
#define vec3f(name,i,j,k,l) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k,l)))
#define vec4(name,i,j,k,l) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l))))
#define vec4f(name,i,j,k,l,m) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l,m))))
#define pb push_back
#define MOD 998244353
#define PI 3.141592653
#define INF 100000000000000 //14
#define N 262144
//cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);

int main(){
    ll a, b, c, d; cin >> a >> b >> c >> d;
    vec2f(dp,c-a+1,d-b+1,0);
    dp[0][0]=1;
    FOR(i,0,c-a)FOR(j,0,d-b){
        if (i==0&&j==0) continue;
        else if (i==0) dp[i][j]=(dp[i][j-1]*a)%MOD;
        else if (j==0) dp[i][j]=(dp[i-1][j]*b)%MOD;
        else dp[i][j]=((dp[i][j-1]*(a+i))%MOD+(dp[i-1][j]*(b+j))%MOD+MOD-(((a+i-1)*(b+j-1)*dp[i-1][j-1])%MOD))%MOD;
    }
    /*FOR(i,0,c-a){
        FOR(j,0,d-b) cout << dp[i][j] << " ";
        cout << endl;
    }*/
    cout << dp[c-a][d-b] << endl;
}

Measured memory_bytes: 73540
def cmb(n,r,mod):
  if r<0 or r>n:
    return 0
  r=min(r,n-r)
  return g1[n]*g2[r]*g2[n-r]%mod
 
h,w,a,b=map(int,input().split())
m=10**9+7
 
g1=[1,1]
g2=[1,1]
inverse=[0,1]
 
for i in range(2,h+w):
  g1.append((g1[-1]*i)%m)
  inverse.append((-inverse[m%i]*(m//i))%m)
  g2.append((g2[-1]*inverse[-1])%m)

ans=0
for i in range(b,w):
  ans+=cmb(h-a-1+i,i,m)*cmb(a-1+w-i-1,w-i-1,m)
  ans%=m
print(ans)

Measured memory_bytes: 81076
a, b, c = map(int, input().split())
if b < a:
    tmp = a
    a = b
    b = tmp
if c < a:
    tmp = c
    c = b
    b = a
    a = tmp
elif c < b:
    tmp = b
    b = c
    c = tmp
 
print(a, b, c)


Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define vec2(name,i,j) vector<vector<ll>> name(i,vector<ll>(j))
#define vec2f(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
#define vec3(name,i,j,k) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k)))
#define vec3f(name,i,j,k,l) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k,l)))
#define vec4(name,i,j,k,l) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l))))
#define vec4f(name,i,j,k,l,m) vector<vector<vector<vector<ll>>>> name(i,vector<vector<vector<ll>>>(j,vector<vector<ll>>(k,vector<ll>(l,m))))
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000 //14
//cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);

int main(){
    ll n, m, k, x, y; cin >> n >> m >> k;
    vector<ll> a(n+1,0);
    vector<ll> b(m+1,0);
    FOR(i,1,n){
        cin >> x;
        a[i]= a[i-1]+x;
    }
    FOR(i,1,m){
        cin >> y;
        b[i]=b[i-1]+y;
    }
    ll ans = 0;
    FOR(i,0,n){
        if (a[i]>k){
            break;
        }
        ll ind = upper_bound(b.begin(),b.end(),k-a[i])-b.begin();
        ans = max(ans,ind-1+i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 6428
#include <iostream>
#define N_MAX 100
#include <string>
#include <cmath>
using namespace std;

int K,N,A,B,i,j,k;
string S,Sa;
int x[N_MAX];
int y[N_MAX];
int num[N_MAX] = {0};
double ans=0;

int main(){
  cin >> A >> B;
  for (i=A;i<=B;i++){
    if (i%10 == (i/10000)%10 && (i/10)%10 == (i/1000)%10) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void resolve()
{
    int N, M;
    cin >> N >> M;

    int ans = (N <= 1 && M <= 1)
                  ? 0
                  : (N == 0) ? M * (M - 1) / 2
                             : (M == 0) ? N * (N - 1) / 2
                                        : (M * (M - 1) / 2) + (N * (N - 1) / 2);

    cout << ans << endl;
}

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


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll n,x;
ll a[111111];

int main(){
	cin.sync_with_stdio(false);
  cin>>n>>x;
  rep(i,n)cin>>a[i];
  ll res=0;
  rep(i,n-1){
    ll cost=max(0LL,a[i]+a[i+1]-x);
    res+=cost;
    a[i+1]=max(0LL,a[i+1]-cost);
  }
  cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1024
S = list(input())

dic = {}
for i, s in enumerate(S):
    if not s in dic.keys():
        dic[s] = [i]
    else:
        dic[s].append(i)

ok = False
for v in dic.values():
    x = len(v)
    if x < 2:
        continue
    B = [None]*x
    for i in range(x):
        B[i] = v[i] - 2*i
    l = 0
    for r in range(1, x):
        if B[l] >= B[r]:
            ok = True
            L, R = v[l]+1, v[r]+1
            break
        else:
            l = r
    if ok:
        break

if not ok:
    print(-1, -1)
else:
    print(L, R)

Measured memory_bytes: 9448
import sys
input = sys.stdin.readline
mod = 998244353

def sub(a, b):
    return (a % mod + mod - b % mod) % mod

n, = list(map(int, input().split()))
t = 1
dd = [t]
for _ in range(n):
    t=2*t%mod
    dd.append(t)

def power(a, b):
    return dd[b]

class SegTree:
    def __init__(self, init_val, n, ide_ele, seg_func):
        self.segfunc = seg_func
        self.num = 2**(n-1).bit_length()
        self.ide_ele = ide_ele
        self.seg=[self.ide_ele]*2*self.num
        for i in range(n):
            self.seg[i+self.num-1]=init_val[i]    
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self, p, q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res

def mm(a, b, c, d, n):
    return sub(power(2, b+c) + power(2, c+d) + power(2, d+a) + power(2, a+b),
                power(2, a) + power(2, b) + power(2, c) + power(2, d))

xs, ys = [], []
for _ in range(n):
    x, y = list(map(int, input().split()))
    xs.append(x)
    ys.append(y)

ini = sorted(list(range(n)), key=lambda x:xs[x])
for i, yi in enumerate(sorted(list(range(n)), key=lambda x:ys[x])):
    ys[yi] = i 
nys = [ys[i] for i in ini]

ss1 = SegTree([0] * n, n, 0, lambda x,y:x+y)
r = 0
for i, y in enumerate(nys):
    ss1.update(y, 1)
    d = ss1.query(0, y)
    c = i - d
    b = (n-1) - y - c
    a = (n-1) - b - c - d
    r = (r + mm(a, b, c, d, n)) % mod

print(sub((power(2, n) * n) % mod, (r+n)%mod))


Measured memory_bytes: 117352