akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <deque>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
#define for1(i,n) for (ll i=0;i<(n);i++)
#define for2(i,m,n) for (ll i=(m);i<(n);i++)
#define for3(i,m,n,d) for (ll i=(m);i<(n);i+=(d))
#define DEBUG 0

struct Item {
    ll a,b,c;
};
void solve()
{
    ll N,K,M;
    cin >> N >> K;

    ll cnt_edge = N * (N - 1) / 2;
    cnt_edge -= N - 1;
    if (K > cnt_edge) {
        cout << -1 << endl;
        return;
    }
    cout << N-1 + cnt_edge-K << endl;
    for1(i,N-1) {
        cout << i+1 << " " << N << endl;
    }
    for1(i,N-1) {
        for2(j,i+1,N-1) {
            if (cnt_edge == K) return;
            --cnt_edge;
            cout << i+1 << " " << j+1 << endl;
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    do {
        solve();
    } while (DEBUG);
}


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

int junk[123456];
char tmp[123456];
int answer;

int main()
{
	scanf("%s", tmp);
	int length = strlen(tmp);
	for (int i = 0; i < length; ++i)
	{
		junk[i] = (tmp[i] == 'p') ? 1 : 0;
	}
	for (int i = 0; i < length / 2; ++i)
	{
		answer -= junk[i];
	}
	for (int i = length / 2;i < length / 2 * 2;++i)
	{
		answer += (junk[i] == 0) ? 1 : 0;
	}
	//answer -= junk[length - 1];
	printf("%d", answer);
	return 0;
}

Measured memory_bytes: 768
import collections

N = int(input())
A = list(map(int, input().split()))

def solve():
    ans = 0
    sums = [0]
    sum_val = 0
    for i, A_i in enumerate(A):
        sum_val += A_i
        sums.append(sum_val)
    c = collections.Counter(sums)
    for v in c.values():
        ans += (v)*(v-1)//2
    print(ans)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 41696
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

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




// ***************************************

struct Eratos {
    vector<int> primes;
    vector<bool> isprime;
    vector<int> mebius;
    vector<int> min_factor;
 
    Eratos(int MAX) : primes(),
                      isprime(MAX+1, true),
                      mebius(MAX+1, 1),
                      min_factor(MAX+1, -1) {
        isprime[0] = isprime[1] = false;
        min_factor[0] = 0, min_factor[1] = 1;
        for (int i = 2; i <= MAX; ++i) {
            if (!isprime[i]) continue;
            primes.push_back(i);
            mebius[i] = -1;
            min_factor[i] = i;
            for (int j = i*2; j <= MAX; j += i) {
                isprime[j] = false;
                if ((j / i) % i == 0) mebius[j] = 0;
                else mebius[j] = -mebius[j];
                if (min_factor[j] == -1) min_factor[j] = i;
            }
        }
    }
 
    // prime factorization
    vector<pair<int,int>> prime_factors(int n) {
        vector<pair<int,int> > res;
        while (n != 1) {
            int prime = min_factor[n];
            int exp = 0;
            while (min_factor[n] == prime) {
                ++exp;
                n /= prime;
            }
            res.push_back(make_pair(prime, exp));
        }
        return res;
    }
 
    int func(int n) {
        int res = 1;
        while (n != 1) {
            int prime = min_factor[n];
            int exp = 0;
            while (min_factor[n] == prime) {
                ++exp;
                n /= prime;
            }
            res *= exp + 1;
        }
        return res;
    }
};

int main(){

    ll N;
    cin >> N;

    Eratos er = Eratos(N + 1);

    ll ans = 0;
    FOR(k, 1, N + 1){
        ans += k * er.func(k);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 86812
fun main(args: Array<String>) {
    var (h, w) = readIntList()
    val s = List(h) { readString() }

    val ans = List(h) { MutableList(w) { 0 } }

    for (i in 0 until h) {
        for (j in 0 until w) {
            for (x in -1..1) {
                for (y in -1..1) {
                    val di = i + x
                    val dj = j + y
                    if (di < 0 || di >= h) continue
                    if (dj < 0 || dj >= w) continue
                    if (s[di][dj] == '#') {
                        ans[i][j]++
                    }
                }
            }
        }
    }

    for (i in 0 until h) {
        for (j in 0 until w) {
            if (s[i][j] == '#') {
                print('#')
            } else {
                print(ans[i][j])
            }
        }
        println()
    }
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)

Measured memory_bytes: 38320
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <unordered_map>

#define ll long long
#define scani(x) scanf("%i", &x)
#define scanll(x) scanf("%I64d", &x)
#define scanfl(x) scanf("%f", &x)
#define scanch(x) scanf("%c", &x)
#define scans(x) scanf("%s", x);
#define printi(x) printf("%i", x);
#define printll(x) printf("%I64d", x);
#define printfl(x) printf("%f", x);
#define printch(x) printf("%c", x);
#define prints(x) printf("%s", x);
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define INFI (1 << 29)
#define INFL (1LL << 62)
#define sz(x) int(x.size())
#define fi first
#define se second
#define forn(i, n) for(ll i = 0; i < n; i++)
#define for1(i, n) for(ll i = 1; i <= n; i++)
#define ford(i, n) for(ll i = (n - 1); i >= 0; i--)
#define fori(i, n) for(ll i = n; i >= 1; i--)
#define fore(i, l, r) for(ll i = l; i <= r; i++)

using namespace std;

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

    ll n, r1 = 0, r2 = 0;

    cin >> n;

    vector < ll > v(n);
    unordered_map < ll, ll > mapa, mapa2;

    forn(i, n)
    {
        cin >> v[i];

        mapa[v[i]]++;

        mapa2[v[i]]++;
    }

    ll p = 1;

    forn(j, 34)
    {
        forn(i, n)
        {
            if(p < v[i])
                continue;

            ll f = (p - v[i]);

            if((v[i] == f) && (mapa[f] >= 2))
                r1++, mapa[f] -= 2;
            else if((v[i] != f) && mapa[v[i]] && mapa[f])
                r1++, mapa[f]--, mapa[v[i]]--;
        }

        p *= 2;
    }

    p = 4294967296;

    forn(j, 34)
    {
        forn(i, n)
        {
            if(p < v[i])
                continue;

            ll f = (p - v[i]);

            if((v[i] == f) && (mapa2[f] >= 2))
                r2++, mapa2[f] -= 2;
            else if((v[i] != f) && mapa2[v[i]] && mapa2[f])
                r2++, mapa2[f]--, mapa2[v[i]]--;
        }

        p /= 2;
    }

    cout << (ll)max(r1, r2) << "\n";

    return 0;
}


Measured memory_bytes: 96452
h,w,lim = map(int,input().split())
S = []
ans = 10**10
for i in range(h):
    S.append(input())
for i in range(2**(h-1)):
    bit = ''
    cur = 1
    for j in range(h-1):
        if i&cur != 0:
            bit = '1'+bit
        else:
            bit = '0'+bit
        cur *= 2
    group = []
    if i == 0:
        group = [[i for i in range(h)]]
    else:
        div = []
        for j in range(len(bit)):
            if bit[j] == '0':
                div.append(j)
            else:
                div.append(j)
                group.append(div)
                div = []
        div.append(j+1)
        if len(div) != 0:
            group.append(div)
    num = [0]*len(group)
    cur = len(group)-1
    flag1 = True
    for j in range(w):
        next = [0]*len(group)
        flag2 = True
        for k in range(len(group)):
            plus = 0
            for l in range(len(group[k])):
                if S[group[k][l]][j] == '1':
                    plus += 1
            if plus > lim:
                flag1 = False
                break
            elif plus+num[k] > lim:
                flag2 = False
                next[k] += plus
            else:
                next[k] += plus
        if flag1 == False:
            break
        else:
            if flag2 == False:
                cur += 1
                num = next
            else:
                for k in range(len(group)):
                    num[k] += next[k]
    if flag1:
        ans = min(ans, cur)
print(ans)


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

char str[200000];

int main() {

    while(cin>>str) {

        bool ok=1;
        int n=strlen(str);

        for(int i=0; i<n;)
            if(str[i]=='d') {

                string s="dream";

                int j;

                for(j=0; i+j<n && j<s.size(); j++)
                    if(s[j]!=str[i+j]) {
                        ok=0;
                        break;
                    }

                if(j<s.size())
                    break;

                if(i+j<n && str[i+j]=='e' && i+j+1<n && str[i+j+1]=='r') {

                    if(i+j+2==n)
                        i=i+j+2;
                    else if(str[i+j+2]=='a')
                        i=i+j;
                    else
                        i=i+j+2;

                } else
                    i=i+j;

            } else if(str[i]=='e') {


                string s="erase";
                int j;
                for(j=0; j<s.size() && i+j<n ; j++)
                    if(str[i+j]!=s[j])
                        break;


                if(j<s.size()) {
                    ok=0;
                    break;
                }

                if(i+j<n && str[i+j]=='r')
                    i=i+j+1;
                else
                    i=i+j;

            } else {

                ok=0;
                break;

            }


        printf((ok)?"YES\n":"NO\n");

    }



    return 0;
}

/*
dreamdreamer
YES

dreamererase
YES

dreamerase
YES

eraserase
NO

eraseerase
YES

erasedreamererase
YES

*/


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

using namespace std;

int main(){
 long n; 
  cin >> n;
 
  vector<long> a(n),b(n);
  for(long i=0;i<n;i++) cin >> a[i] >> b[i];
   
  long res=0;
  for(long i=n-1;i>=0;i--){
    a[i]+=res;
    if(a[i]%b[i]) res+=b[i]-(a[i]%b[i]);
  }
  
  cout << res << endl;
  
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
string a,b,c;
int sum;
int main()
{
	cin>>a;
	for(int i=0;i<a.size();i++)
	{
		if(i==0)
		b=a[i];
		else if(i==a.size()-1)
		c=a[i];
		else
		sum++;
	}
	cout<<b<<sum<<c;
	return 0;
}

Measured memory_bytes: 256
/*raghav0307 - Raghav Gupta*/
 
#include <bits/stdc++.h>
using namespace std;
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#define ff first
#define ss second
#define pb push_back
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int ll

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
 
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

signed main(){
	fast_io();
	
	string s;
	cin >> s;

	for(auto x : s){
		if(x != '?')
			cout << x;
		else cout << 'D';
	}
	cout << "\n";

	// int ans = (s[0] == 'D');
	// for(int i = 1; i < s.length(); i++){
	// 	if(s[i] == 'D' or s[i] == '?'){
	// 		ans++;
	// 		if(s[i-1] == 'P')
	// 			ans++;
	// 	}
	// }
	// cout << ans << "\n";

	return 0;
}


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

int main() {
  int N; cin >> N;
  int m = 1, n = 0;
  int long long sum = 0;
  
  vector<int> a(N);
  for( int i = 0; i < N; i++ )
    cin >> a.at(i);
  
  for( int i = 0; i < N; i++ ) {
    if( a.at(i) == 0 )
      m = 0;
    else if( a.at(i) < 0 ) {
      n++;
      a.at(i) *= -1;
    }
  }
  
  sort(a.begin(), a.end());
  for( int i = 0; i < N; i++ )
    sum += a.at(i);
  sum = sum - 2 * a.at(0) * m * ( n % 2 );
  cout << sum << endl;
  
}

Measured memory_bytes: 640
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()
}

fn main() {
    let s: String = read();
    let t: String = read();
    let s = s.chars().collect::<Vec<_>>();
    let t = t.chars().collect::<Vec<_>>();

    let mut dp = vec![vec![0; t.len() + 1]; s.len() + 1];
    let mut prev = vec![vec![0; t.len() + 1]; s.len() + 1];
    for i in 0..s.len() {
        for j in 0..t.len() {
            if s[i] == t[j] {
                dp[i + 1][j + 1] = dp[i][j] + 1;
                prev[i + 1][j + 1] = 2;
            } else {
                dp[i + 1][j + 1] = std::cmp::max(dp[i][j + 1], dp[i + 1][j]);
                prev[i + 1][j + 1] = if dp[i][j + 1] >= dp[i + 1][j] { 1 } else {0};
            }
        }
    }
    // println!("{:?}", dp);
    // println!("{:?}", prev);
    let mut ans: Vec<char> = Vec::new();
    let mut i = s.len();
    let mut j = t.len();
    while i != 0 && j != 0 {
        if prev[i][j] == 2 {
            ans.push(s[i - 1]);
            i -= 1;
            j -= 1;
        } else if prev[i][j] == 1 {
            i -= 1;
        } else {
            j -= 1;
        }
    }

    ans.reverse();
    for ch in ans {
        print!("{}", ch);
    }
    println!("");
}


Measured memory_bytes: 78076
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: isize = iterator.next().unwrap().parse().unwrap();
    let l: isize = iterator.next().unwrap().parse().unwrap();

    let mut t: Vec<isize> = Vec::new();
    for i in 1..=n {
        t.push(l + i - 1);
    }
    t.sort_by_key(|it| it.abs());

    let m = t.first().unwrap();
    let ans: isize = t.iter().sum::<isize>() - *m;
    return ans.to_string();
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define itrep(it, a) for(it = (a).begin(); it != (a).end(); it++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;

int main(){
    char a[8][8];
    rep(i,8) rep(j,8) cin >> a[i][j];

    cout << 90 << endl;
    rep(i,8){
        for(int j = 7; j >= 0; j--){
            cout << a[j][i];
        }cout << endl;
    }
    cout << 180 << endl;
    for(int i = 7; i >= 0; i--){
        for(int j = 7; j >= 0; j--){
            cout << a[i][j];
        }cout << endl;
    }
    cout << 270 << endl;
    for(int i = 7; i >= 0; i--){
        rep(j,8){
            cout << a[j][i];
        }cout << endl;
    }

}

Measured memory_bytes: 1140
a = input()
aSplit = a.split(' ')
A = int(aSplit[0])
B = int(aSplit[1])
wordSize = A
removePosition = B
word= str(input())
reword=''
for i in range(wordSize):
    if(i==(removePosition-1)):
        if(word[removePosition-1]=="A"):
            reword+=(str("a"))
        elif(word[removePosition-1]=="B"):
             reword+=(str("b"))
        elif(word[removePosition-1]=="C"):
             reword+=(str("c"))
    else:
        reword+=(word[i])
        
print(reword)

Measured memory_bytes: 3064
#include <iostream>
#include <limits.h>
#include <string>
using namespace std;

int main(void){
    int k, s, x, y, z, ans = 0;
    cin >> k >> s;
    for (x = 0; x <= k; x++) {
        for (y = 0; y <= k; y++) {
            z = s - x - y;
            if (0 <= z && z <= k) ans++;
        }
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <climits>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

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

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

bool comp(int i, int j) {
	return i > j;
}

int main()
{
	bool down, up;
	int n;
	cin >> n;
	vector<int> check;
	vector<int> data;
	for (int i = 0; i < n; i++)
	{
		int tmp;
		cin >> tmp;
		check.push_back(tmp);
		data.push_back(tmp);
	}

	sort(data.begin(), data.end());
	int change[2] = { 0, 0 };
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		if (data[i] != check[i])
		{
			if (count == 2)
			{
				cout <<  "NO";
				return 0;
			}
			change[count] = i;
			count++;
		}
	}

	//入れ替えてみる
	int hoge = check[change[0]];
	check[change[0]] = check[change[1]];
	check[change[1]] = hoge;

	for (int i = 0; i < n; i++)
	{
		if (data[i] != check[i])
		{
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";
}


Measured memory_bytes: 31488
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []
    m = 10**6

    a = [inf] * m
    b = [inf] * m
    a[0] = 0
    b[0] = 0
    for i in range(1,200):
        t = i * (i+1) * (i+2) // 6
        mm = min(t*5,m)
        for j in range(t,mm):
            if a[j] > a[j-t] + 1:
                a[j] = a[j-t] + 1
        if t % 2 == 0:
            continue
        for j in range(t,m):
            if b[j] > b[j-t] + 1:
                b[j] = b[j-t] + 1

    while True:
        n = I()
        if n == 0:
            break
        rr.append('{} {}'.format(a[n],b[n]))



    return '\n'.join(map(str, rr))


print(main())




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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

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

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll a; cin >> a;
  ll result = a + a*a + a*a*a;
  cout << result << endl;
  return 0;
}

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

bool isprime(int n){
    double rootn = sqrt(n);
    if (n < 2){
        return false;
    }
    else if (n == 2){
        return true;
    }
    else if (n % 2 == 0){
        return false;
    }
    else{
        for(int i = 3; i <= rootn; i += 2){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
}

// 空のベクトルを二つ渡す。N (>=2) 以下の素数を primes に順番に入れる。
void prime_vectors(int N, vector<int>& primes, vector<bool>& is_prime){
    primes = {};
    is_prime = {};
    for(int i=0; i<=N; i++){
        is_prime.push_back(true);
    }

    primes.push_back(2);
    for(int j=4; j<=N; j+=2){
        is_prime[j] = false;
    }

    int i;
    for(i=3; i*i<=N; i+=2){
        if(!is_prime[i]) continue;
        primes.push_back(i);
        for(int j=2*i; j<=N; j+=i){
            is_prime[j] = false;
        }
    }

    for(; i<=N; i+=2){
        if(is_prime[i]){
            primes.push_back(i);
        }
    }
}

// n^e % mod
int mod_pow(int n, int e, int mod){
    int ans = 1;
    n = n % mod;
    while(e != 0){
        if(e % 2 == 1){
            ans = (ans * n) % mod;
        }
        e /= 2;
        n = (n * n) % mod;
    }
    return ans;
}

// n^{-1} % mod = n^{mod-2} % mod
int mod_inv(int n, int mod){
    return mod_pow(n, mod-2, mod);
}

// nCk % mod
int mod_combination(int n, int k, int mod){
    if(n < k || k < 0) return 0;
    if(n-k < k) k = n-k;
    int ans = 1;
    for(int i=1; i<=k; i++){
        ans = (((ans * (n+1-i)) % mod) * mod_inv(i, mod)) % mod;
    }
    return ans;
}

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n, m, q;
    cin >> n >> m >> q;
    // incl[i] は 1-origin で [0, i] に完全に含まれる区間の全部
    // すなわち、終着駅が i 以前の区間の数
    // excl[j][i] は 1-origin j 以前に終着駅があるが i より前に始発駅がある区間の数
    // [i, j] に完全に含まれる運行区間は incl[j]-excl[j][i] 
    // j では終着駅を過ぎているが、i では始発駅も過ぎてしまっている場合、それは引く
    vector<int> incl(n+1, 0);
    vector<vector<int>> excl(n+1, vector<int>(n+1));
    for(int i=0; i<m; i++){
        int l, r;
        cin >> l >> r;
        for(int j=r; j<=n; j++){
            excl[j][l+1]++;
        }
        incl[r]++;
    }

    for(int i=0; i<n; i++){
        incl[i+1] += incl[i];
    }
    for(int j=0; j<=n; j++){
        for(int i=0; i<n; i++){
            excl[j][i+1] += excl[j][i];
        }
    }

    vector<int> pp(q), qq(q);
    for(int i=0; i<q; i++){
        cin >> pp[i] >> qq[i];
    }

    for(int i=0; i<q; i++){
        cout << incl[qq[i]] - excl[qq[i]][pp[i]] << endl;
    }

    return 0;
}

Measured memory_bytes: 6972
using System;
using System.Linq;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var ave = input.Split(' ').Select(s => int.Parse(s)).Average();
            Console.WriteLine(Math.Ceiling(ave));
        }
    }
}

Measured memory_bytes: 28276
#include <stdio.h>

int main(){

  int max,first,tmp,num,i;

  scanf("%d",&num);
  scanf("%d",&first);
  scanf("%d",&tmp);
  max = tmp - first;
  if(tmp<first){
    first = tmp;
  }

  for(i=2;i<num;i++){
    scanf("%d",&tmp);
    if(max<tmp-first) max=tmp-first;
    if(tmp<first){
      first=tmp;
    }
  }
  printf("%d\n",max);
  
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define endl "\n"
#define ll long long
#define eb emplace_back
#define sz(x) ((int)(x).size())
#define mo 100000000
using namespace std;
//Conditional Operator (condition?true part:false part) eg : cout<<(y<=3?"YES":"NO")<<endl;
ll getmul(ll n){ll int k{0};while(n>0){k+=n%10;n=n/10;}return k;}//Sum OF n DIGITS
int main(){
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     int t;
     cin>>t;
     map<string,int>mp;
     while(t--){
        string s;
        cin>>s;
        mp[s]++;
     }
     vector<string>arr={"AC","WA","TLE","RE"};
     for(int i=0;i<sz(arr);i++){
         if(mp.find(arr[i])!=mp.end()){
             cout<<arr[i]<<" x "<<mp[arr[i]]<<endl;
         }
         else
             cout<<arr[i]<<" x 0"<<endl;
     }
 return 0;    
}

Measured memory_bytes: 3668
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
    int max,min;
    int i,j,k;
    int tmp;
    int n;
    unsigned long int cnt = 0;
    int m;
    unsigned long int a[10000];
    scanf("%d",&n);
    for (i = 0; i < n; i++) {
        scanf("%lu",&a[i]);
    }
    for (i = 0; i < n; i++) {
        m = 1;
        for(j = 2; j <= sqrt((double)a[i]); j++) {
            if (a[i] % j == 0) {
                m = 0;break;
            }
        }
        if (m == 1) cnt++;
    }
    printf("%lu\n",cnt);
    return 0;
}

Measured memory_bytes: 684
#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); }

/*
	ツつ「ツづつつゥツカツδ可ーツコツーツドツδ可イツブツδ可δ環づつつュツづォツつ、
 */
struct Color
{
	int r, g, b;
	
	Color() : r(0), g(0), b(0) { }
	Color(int r, int g, int b) : r(r), g(g), b(b)
	{	}
	Color(string str)
	{
		r = strtol(str.substr(1, 2).c_str(), NULL, 16);
		g = strtol(str.substr(3, 2).c_str(), NULL, 16);
		b = strtol(str.substr(5, 2).c_str(), NULL, 16);
	}
};

Color operator - (const Color& left, const Color& right)
{	return Color(left.r - right.r, left.g - right.g, left.b - right.b);	}

template<class T> T SQR(T x){ return x * x; }

double abs(Color color)
{	return sqrt(SQR(color.r) + SQR(color.g) + SQR(color.b));	}

int main()
{
    string name[] = { "black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white" };
	Color colors[8];
	
	rep(i, 8) colors[i] = Color(bool(i & 1 << 2) * 0xff, bool(i & 1 << 1) * 0xff, bool(i & 1) * 0xff);
	
	for(string line; cin >> line && line != "0";)
	{
		int index = 0;
		double fit = 1 << 30;
		
		rep(i, 8) if(abs(colors[i] - Color(line)) < fit)
		{
			index = i;
			fit = abs(colors[i] - Color(line));
		}
		
		cout << name[index] << endl;
	}
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(std::string s){
    int l, r;
    
    REP(i, s.size()) {
        if(s[i] == 'A') {
            l = i;
            break;
        }
    }

    RREP(i, s.size()-1) {
        if(s[i] == 'Z') {
            r = i;
            break;
        }
    }

    cout << r - l + 1 << endl;
}

int main(){
    std::string s;
    std::cin >> s;
    solve(s);
    return 0;
}



Measured memory_bytes: 772
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use proconio::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

fn main() {
    input! {
        n: i64,
        k: i64,
    }

    let moded = n % k;
    let min = min(moded, (moded - k).abs());

    println!("{}", min);
}


Measured memory_bytes: 2148
#include <iostream>
#include <iomanip>
#include <utility>

int main(){
  while(true){
    double a, b, c, d, e, f;
    std::cin >> a >> b >> c >> d >> e >> f;
    if(std::cin.eof()) return 0;

    double x, y;
    if(a==0){
      std::swap(a,d);
      std::swap(b,e);
      std::swap(c,f);
    }
    double s=d/a;
    d-=a*s; e-=b*s; f-=c*s;
    y=f/e;
    x=(-b*y+c)/a;

    std::cout << std::fixed;
    std::cout << std::setprecision(3) << x << " " << std::setprecision(3) << y << std::endl;
  }
}


Measured memory_bytes: 3144
n=int(input())
l=list(map(int,input().split()))

d={}
for i in range(n-1):
  if l[i] not in d:
    d[l[i]]=1
  else:
    d[l[i]]+=1

for i in range(n):
  if i+1 in d:
    print(d[i+1])
  else:
    print(0)

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

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

  int N;
  cin >> N;
  vector<int> p(N);
  REP(i, N) cin >> p[i];
  int ans = 0;
  sort(p.begin(), p.end());
  REP(i, N - 1) { ans += p[i]; }
  cout << ans + p[N - 1] / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define AB 1
#define BC 3
#define INF 1<<29

using namespace std;

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

int fA (int, int, int );
int fC (int, int, int );

int fA(int A, int B, int C )
{
	if (!B && !C ) return 0;

	if (A & 1 ){
		return fA(A>>1, B>>1, C>>1 );
	} // end if
	if (B & 1 ){
		return fC(A>>1, B>>1, C>>1 ) + 1 + fA(0, 0, (A|B|C)>>1 );
	} // end if
	if (C & 1 ){
		return fA(A>>1,B>>1,C>>1) + 1 + fC((A|B|C)>>1, 0, 0 ) + 1 + fA(0, 0, (A|B|C)>>1 );
	} // end if
}

int fC(int A, int B, int C )
{
	if (!A && !B ) return 0;

	if (C & 1 ){
		return fC(A>>1, B>>1, C>>1 );
	} // end if
	if (B & 1 ){
		return fA(A>>1, B>>1, C>>1 ) + 1 + fC((A|B|C)>>1, 0, 0 );
	} // end if
	if (A & 1 ){
		return fC(A>>1, B>>1, C>>1 ) + 1 + fA(0, 0, (A|B|C)>>1 ) + 1 + fC((A|B|C)>>1, 0, 0 );
	} // end if
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.cup", "r", stdin );
	int n, m;
	while (scanf ("%d %d", &n, &m ), n, m ){
		int T[3] = {0};
		rep (i, 3 ){
			int in;
			scanf ("%d", &in );
			while (in--){
				int cup;
				scanf ("%d", &cup );
				T[i] |= 1<<(cup-1);
			} // end rep
		} // end rep
		int res = min (fA(T[0],T[1],T[2] ), fC(T[0],T[1],T[2] ) );
		printf ("%d\n", (res > m ? -1 : res ) );
	} // end loop
		
	return 0;
}

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

#define REP(i, n) for (int i = 0; i < (n); ++i)
/***** MAIN *****/
signed main() {
  int a, b, c;
  cin >> a >> b >> c;
  int ans = c - (a - b);
  if(ans < 0) cout << 0;
  else cout << ans;

  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

template<typename T>
class CumulativeSum{
public:
  Int n;
  vector<T> sum;
  vector<T> A;
  Int added;
  CumulativeSum():n(-1),added(0){}
  CumulativeSum(Int n):n(n), sum(n+1), A(n+1),added(0){}
  CumulativeSum(const vector<T> &B):n(B.size()), sum(n+1), A(n+1),added(0){
    for(Int i=1;i<=n;i++) sum[i] = sum[i-1] + B[i-1];
  }

  void apply(){
    for(Int i=1;i<=n;i++) A[i] = A[i] + A[i-1];
    for(Int i=1;i<=n;i++) A[i] = A[i] + A[i-1];
    for(Int i=1;i<=n;i++) sum[i] = sum[i] + A[i-1];
    added = 0; A.clear(); A.resize(n+1);
  }

  //[l, r)にxを加算
  void add(Int l, Int r, T x){
    added = 1;
    assert(l <= r && 0 <= l && r <= n);
    A[l] = A[l] + x;
    A[r] = A[r] - x;
  }

  //[l, r)の和を得る
  T get(Int l,Int r){
    assert(l<=r && 0<=l && r<=n);
    if(added) apply();
    return sum[r] - sum[l];
  }
};

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int N, K, Q;
  cin>>N>>K>>Q;

  CumulativeSum<Int> Sum(N);
  Sum.add(0, N, K);
  for(Int i=0;i<Q;i++){
    Int A;
    cin>>A;
    A--;
    Sum.add(0, A, -1);
    Sum.add(A+1, N, -1);
  }

  for(Int i=0;i<N;i++){
    Int ans = Sum.get(i, i+1) > 0;
    cout<<(ans? "Yes":"No")<<endl;
  }

  return 0;
}


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

//二次元配列定義
int a[3][3];
int d[3][3];

int main() {
  //二次元配列代入
  rep(i,3)rep(j,3) cin >> a[i][j];

  int n;
  cin >> n;

  //配列内に該当の数字があるかマークする
  rep(ni,n) {
    int x;
    cin >> x;
    rep(i,3)rep(j,3) if (a[i][j] == x) d[i][j] = 1;
  }
  //ビンゴが成立しているか確認する(縦、横、斜め)
  bool ans = false;
  rep(i,3) {
    int cnt = 0;
    rep(j,3) cnt += d[i][j];
    if (cnt == 3) ans = true;
  }
  rep(i,3) {
    int cnt = 0;
    rep(j,3) cnt += d[j][i];
    if (cnt == 3) ans = true;
  }
  {
    int cnt = 0;
    rep(j,3) cnt += d[j][j];
    if (cnt == 3) ans = true;
  }
  {
    int cnt = 0;
    rep(j,3) cnt += d[j][2-j];
    if (cnt == 3) ans = true;
  }
  puts(ans?"Yes":"No");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
const int mod = 1e9+7;
const int maxn = 1e5+5;
const double EPS = 1e-6;
using namespace std;
int main()
{
	int x,y,z;
	scanf("%d %d %d",&x,&y,&z);
	int cnt = 0;
	while(1){
		if((cnt+1)*z+cnt*y>x) break;
		cnt++;
	}
	cout<<cnt-1<<endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] xyxy = scanner.nextLine().split(" ", 4);
        int x1 = Integer.parseInt(xyxy[0]);
        int y1 = Integer.parseInt(xyxy[1]);
        int x2 = Integer.parseInt(xyxy[2]);
        int y2 = Integer.parseInt(xyxy[3]);

        int xDiff = y1 - y2;
        int yDiff = x2 - x1;
        int x3 = x2 + xDiff;
        int y3 = y2 + yDiff;

        xDiff = x1 - x2;
        yDiff = y1 - y2;
        int x4 = x3 + xDiff;
        int y4 = y3 + yDiff;
        System.out.printf("%d %d %d %d\n", x3, y3, x4, y4);
    }
}


Measured memory_bytes: 23764
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] a = new int[n+1];
		for(int i = 0; i < n+1; i++){
		    a[i] = sc.nextInt();
		}
		
		// 計算
		long result = 0;
		long[] upper = new long[n+1];
		long[] min = new long[n+1];
		for(int i = 0; i < n+1; i++){
		    if(i == 0){
		        upper[n-i] = a[n-i];
		        min[n-i] = a[n-i];
		    }else{
		        upper[n-i] = upper[n-i+1] + a[n-i];
		        min[n-i] = (min[n-i+1]+1)/2 + a[n-i];
		    }
		}
		for(int i = 0; i < n+1; i++){
		    if(i == 0){
		        if(min[i] > 1){
		            result = -1;
		            break;
		        }
		        upper[i] = 1;
		        result += upper[i];
		    }else{
		        upper[i] = min(upper[i], (upper[i-1]-a[i-1])*2);
		        result += upper[i];
		    }
		}
		
		// 出力
		System.out.println(result);
	}

	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 41524
import sys

N, M = map(int, input().split())

A = [list(sys.stdin.readline().strip()) for _ in range(N)]
B = [list(sys.stdin.readline().strip()) for _ in range(M)]


def check(y, x):
    for i in range(y, y + M):
        if A[i][x:x + M] != B[i - y]:
            return False
    return True

if N == M:
    print("Yes") if check(0, 0) else print("No")
else:
    for i in range(N - M):
        for j in range(N - M):
            if A[i][j] == B[0][0]:
                if check(i, j):
                    print("Yes")
                    exit()
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define setbit(s, i) (s|=(1LL<<(i)))
#define bit(s, i) (((s)>>(i))&1LL)
#define mask(i) ((1LL<<(i)))
#define builtin_popcount __builtin_popcountll
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "C"
int n;
struct point{
    int t, x, y;
    bool operator < (point x){
        return t<x.t;
    }
} p[100001];
int main(){
    #ifdef Kanikou
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Kanikou
    read(n);
    FOR(i, 1, n){
        read(p[i].t);
        read(p[i].x);
        read(p[i].y);
    }
    sort(p+1, p+n+1);
    FOR(i, 1, n){
        int dist=abs(p[i].x-p[i-1].x)+abs(p[i].y-p[i-1].y);
        if(dist>p[i].t-p[i-1].t){
            puts("No");
            return 0;
        }
        if((dist-(p[i].t-p[i-1].t))%2){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}

Measured memory_bytes: 1408
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int N = scan.nextInt();
			int [] a  = new int [N];
			int goukei  = 0;
			BigDecimal [] b = new BigDecimal[N];
			
			BigDecimal ans = new BigDecimal(1);
			BigDecimal go = new BigDecimal(0);
			
			for(int i = 0;i<N;i++) {
				a[i] = scan.nextInt();
				goukei += (a[i]-1);
			}
			
			System.out.println(goukei);
			
			
			
		}
		
		
	}
		

}


Measured memory_bytes: 25936
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define MP make_pair
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n;
  	cin >> n;
	vi a(n),b(n);
  	rep(i,n) cin >> a[i];
  	iota(all(b), 1);
  	vector<pii> data(n);
  	rep(i,n) data[i] = MP(a[i],b[i]);
  	sort(all(data));
  	
  	rep(i,n) cout << data[i].se << " ";
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 2432
use std::io::*;
use std::str::FromStr;
use std::cmp;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char) 
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
    
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let (s, t): (String, String) = (read(), read());
  println!("{}{}", t, s);
}

Measured memory_bytes: 4352
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
1000000

output:
400000
"""

import sys


def soi(n):
    k = 2
    while True:
        if pow(k, 2) > n:
            return n
        if n % k == 0:
            return k
        k += 1


def phi(n):
    ans = n
    while True:
        tmp = soi(n)
        # print(tmp)
        if n == 1:
            break
        while n % tmp == 0:
            n //= tmp
        ans *= (1 - 1 / tmp)
    return int(ans)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    n1 = int(_input[0])
    print(phi(n1))

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}

signed main(){
	int X,N;
	cin>>X>>N;

	vint P(N);
	rep(i,N)cin>>P[i];

	set<int>s;
	rep(i,N)s.insert(P[i]);

	for(int d=0;;d++){
		for(int si=-1;si<=1;si+=2){
			int a=X+d*si;
			if(s.find(a)!=s.end())continue;
			cout<<a<<endl;
			return 0;
		}
	}
    return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    cin >> k;
    for (int i = 0; i < k; ++i) {
        cout << "ACL";
    }
    cout << endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;


bool solve(string str){
	if(str == ".") return true;
	bool ans = true;
	stack<char> s;
	for(int i=0;i<str.size();i++){
		if(str[i] == '(') s.push(')');
		if(str[i] == '[') s.push(']');
		if(str[i] == ')' || str[i] == ']'){
			if(s.empty() || str[i] != s.top()){
				ans = false;
				break;
			}
			s.pop();
		}
	}
	if(ans && s.empty()){
		cout<< "yes"<< endl;
	}else{
		cout<< "no"<< endl;
	}
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	string str;
	while(getline(cin, str)){
		solve(str);
	}
	return 0;
}

 

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

using namespace std;

typedef long long ll;


const int N=2e5+10;
int n,di,indi,a[N];


bool check(ll use){
    ll tmp=use;
    for(int i=1;i<=n;i++)
        tmp-=(max(0LL,a[i]-use*indi)+di-1)/di;
    return tmp>=0;
}
int main(){
    scanf("%d%d%d",&n,&di,&indi);
    di-=indi;
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    ll L=0,R=1e9;
    while (L<=R){
        ll mid=(L+R)/2;
        if (check(mid)) R=mid-1;
        else L=mid+1;
    }
    cout<<L;
}


Measured memory_bytes: 640